From 051ae73543b291ea39a7531e613c1bbf14ef76cb Mon Sep 17 00:00:00 2001 From: Robin Hawkes Date: Mon, 14 Mar 2016 22:01:28 +0000 Subject: [PATCH] Stopped crash on destruction of GeoJSONLayer --- dist/vizicities.js | 23 +++++++++++++++++++---- dist/vizicities.min.js | 6 +++--- dist/vizicities.min.js.map | 2 +- src/layer/GeoJSONLayer.js | 12 ++++++++++++ src/layer/LayerGroup.js | 11 +++++++---- 5 files changed, 42 insertions(+), 12 deletions(-) diff --git a/dist/vizicities.js b/dist/vizicities.js index 6cfde11..82848f8 100644 --- a/dist/vizicities.js +++ b/dist/vizicities.js @@ -14255,6 +14255,18 @@ return /******/ (function(modules) { // webpackBootstrap this._pickingMesh = null; } + if (this._polygonMesh) { + this._polygonMesh = null; + } + + if (this._polylineMesh) { + this._polylineMesh = null; + } + + if (this._pointMesh) { + this._pointMesh = null; + } + // Run common destruction logic from parent _get(Object.getPrototypeOf(GeoJSONLayer.prototype), 'destroy', this).call(this); } @@ -14340,11 +14352,14 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: 'destroy', value: function destroy() { - for (var i = 0; i < this._layers.length; i++) { - this._layers[i].destroy(); - } + // TODO: Sometimes this is already null, find out why + if (this._layers) { + for (var i = 0; i < this._layers.length; i++) { + this._layers[i].destroy(); + } - this._layers = null; + this._layers = null; + } _get(Object.getPrototypeOf(LayerGroup.prototype), 'destroy', this).call(this); } diff --git a/dist/vizicities.min.js b/dist/vizicities.min.js index 4252c07..19742f8 100644 --- a/dist/vizicities.min.js +++ b/dist/vizicities.min.js @@ -2,7 +2,7 @@ }for(var l=0,f=e.children.length;f>l;l++)v(e.children[l],t)};this.render=function(e,i){var a=.5/Math.tan(o["default"].Math.degToRad(.5*i.fov))*t;u.camera.fov!==a&&(l.style.WebkitPerspective=a+"px",l.style.MozPerspective=a+"px",l.style.oPerspective=a+"px",l.style.perspective=a+"px",u.camera.fov=a),e.updateMatrixWorld(),null===i.parent&&i.updateMatrixWorld(),i.matrixWorldInverse.getInverse(i.matrixWorld);var s="translate3d(0,0,"+a+"px)"+h(i.matrixWorldInverse)+" translate3d("+n+"px,"+r+"px, 0)";u.camera.style!==s&&(c.style.WebkitTransform=s,c.style.MozTransform=s,c.style.oTransform=s,c.style.transform=s,u.camera.style=s),p(e,i)}};t.CSS3DObject=a,t.CSS3DSprite=s,t.CSS3DRenderer=u,o["default"].CSS3DObject=a,o["default"].CSS3DSprite=s,o["default"].CSS3DRenderer=u},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=(r(i),n(32)),a=n(27);r(a);t["default"]=function(e){var t=new o.CSS2DRenderer;t.domElement.style.position="absolute",t.domElement.style.top=0,e.appendChild(t.domElement);var n=function(){t.setSize(e.clientWidth,e.clientHeight)};return window.addEventListener("resize",n,!1),n(),t},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=function(e){o["default"].Object3D.call(this),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",function(e){null!==this.element.parentNode&&this.element.parentNode.removeChild(this.element)})};a.prototype=Object.create(o["default"].Object3D.prototype),a.prototype.constructor=a;var s=function(){console.log("THREE.CSS2DRenderer",o["default"].REVISION);var e,t,n,r,i=new o["default"].Vector3,s=new o["default"].Matrix4,u=new o["default"].Matrix4,l=document.createElement("div");l.style.overflow="hidden",this.domElement=l,this.setSize=function(i,o){e=i,t=o,n=e/2,r=t/2,l.style.width=i+"px",l.style.height=o+"px"};var c=function f(e,t){if(e instanceof a){i.setFromMatrixPosition(e.matrixWorld),i.applyProjection(u);var o=e.element,s="translate(-50%,-50%) translate("+(i.x*n+n)+"px,"+(-i.y*r+r)+"px)";o.style.WebkitTransform=s,o.style.MozTransform=s,o.style.oTransform=s,o.style.transform=s,o.parentNode!==l&&l.appendChild(o)}for(var c=0,h=e.children.length;h>c;c++)f(e.children[c],t)};this.render=function(e,t){e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.matrixWorldInverse.getInverse(t.matrixWorld),s.copy(t.matrixWorldInverse.getInverse(t.matrixWorld)),u.multiplyMatrices(t.projectionMatrix,s),c(e,t)}};t.CSS2DObject=a,t.CSS2DRenderer=s,o["default"].CSS2DObject=a,o["default"].CSS2DRenderer=s},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i);t["default"]=function(e){var t=new o["default"].PerspectiveCamera(45,1,1,2e5);t.position.y=400,t.position.z=400;var n=function(){t.aspect=e.clientWidth/e.clientHeight,t.updateProjectionMatrix()};return window.addEventListener("resize",n,!1),n(),t},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n0&&(i=o[0].point.clone()),this._world.emit("pick",r,a,i,o),this._world.emit("pick-"+r,a,i,o)}}},{key:"add",value:function(e){this._pickingScene.add(e),this._needUpdate=!0}},{key:"remove",value:function(e){this._pickingScene.remove(e),this._needUpdate=!0}},{key:"getNextId",value:function(){return f++}},{key:"destroy",value:function(){if(window.removeEventListener("resize",this._resizeTexture,!1),this._renderer.domElement.removeEventListener("mouseup",this._onMouseUp,!1),this._world.off("move",this._onWorldMove),this._pickingScene.children)for(var e,t=this._pickingScene.children.length-1;t>=0;t--)e=this._pickingScene.children[t],e&&(this._pickingScene.remove(e),e.material&&(e.material.map&&(e.material.map.dispose(),e.material.map=null),e.material.dispose(),e.material=null));this._pickingScene=null,this._pickingTexture=null,this._pixelBuffer=null,this._world=null,this._renderer=null,this._camera=null}}]),e}();t["default"]=function(e,t,n){return new h(e,t,n)},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i);t["default"]=function(){var e=new o["default"].Scene;return e}(),e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=(r(i),n(37)),a=r(o);t["default"]=function(e,t){var n=new a["default"](e),r=function(){n.setSize(t.clientWidth,t.clientHeight)};return window.addEventListener("resize",r,!1),r(),n},e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=n(38),s=r(a),u=n(39),l=r(u),c=n(40),f=r(c),h=function(e,t){if(this.renderer=e,void 0===t){var n=e.getPixelRatio(),r=Math.floor(e.context.canvas.width/n)||1,i=Math.floor(e.context.canvas.height/n)||1,a={minFilter:o["default"].LinearFilter,magFilter:o["default"].LinearFilter,format:o["default"].RGBAFormat,stencilBuffer:!1};t=new o["default"].WebGLRenderTarget(r,i,a)}this.renderTarget1=t,this.renderTarget2=t.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.passes=[],void 0===s["default"]&&console.error("EffectComposer relies on THREE.CopyShader"),this.copyPass=new l["default"](s["default"])};h.prototype={swapBuffers:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e},addPass:function(e){this.passes.push(e)},insertPass:function(e,t){this.passes.splice(t,0,e)},render:function(e){this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2;var t,n,r=!1,i=this.passes.length;for(n=0;i>n;n++)if(t=this.passes[n],t.enabled){if(t.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),t.needsSwap){if(r){var o=this.renderer.context;o.stencilFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),o.stencilFunc(o.EQUAL,1,4294967295)}this.swapBuffers()}t instanceof f["default"]?r=!0:t instanceof c.ClearMaskPass&&(r=!1)}},reset:function(e){if(void 0===e){e=this.renderTarget1.clone();var t=this.renderer.getPixelRatio();e.setSize(Math.floor(this.renderer.context.canvas.width/t),Math.floor(this.renderer.context.canvas.height/t))}this.renderTarget1.dispose(),this.renderTarget1=e,this.renderTarget2.dispose(),this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2},setSize:function(e,t){this.renderTarget1.setSize(e,t),this.renderTarget2.setSize(e,t)}},t["default"]=h,o["default"].EffectComposer=h,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a={uniforms:{tDiffuse:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")};t["default"]=a,o["default"].CopyShader=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=function(e,t){this.textureID=void 0!==t?t:"tDiffuse",e instanceof o["default"].ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=o["default"].UniformsUtils.clone(e.uniforms),this.material=new o["default"].ShaderMaterial({defines:e.defines||{},uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.renderToScreen=!1,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.camera=new o["default"].OrthographicCamera(-1,1,1,-1,0,1),this.scene=new o["default"].Scene,this.quad=new o["default"].Mesh(new o["default"].PlaneBufferGeometry(2,2),null),this.scene.add(this.quad)};a.prototype={render:function(e,t,n,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n),this.quad.material=this.material,this.renderToScreen?e.render(this.scene,this.camera):e.render(this.scene,this.camera,t,this.clear)}},t["default"]=a,o["default"].ShaderPass=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=function(e,t){this.scene=e,this.camera=t,this.enabled=!0,this.clear=!0,this.needsSwap=!1,this.inverse=!1};a.prototype={render:function(e,t,n,r){var i=e.context;i.colorMask(!1,!1,!1,!1),i.depthMask(!1);var o,a;this.inverse?(o=0,a=1):(o=1,a=0),i.enable(i.STENCIL_TEST),i.stencilOp(i.REPLACE,i.REPLACE,i.REPLACE),i.stencilFunc(i.ALWAYS,o,4294967295),i.clearStencil(a),e.render(this.scene,this.camera,n,this.clear),e.render(this.scene,this.camera,t,this.clear),i.colorMask(!0,!0,!0,!0),i.depthMask(!0),i.stencilFunc(i.EQUAL,1,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP)}};var s=function(){this.enabled=!0};s.prototype={render:function(e,t,n,r){var i=e.context;i.disable(i.STENCIL_TEST)}},t["default"]=a,t.ClearMaskPass=s,o["default"].MaskPass=a,o["default"].ClearMaskPass=s},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=function(e,t,n,r,i){this.scene=e,this.camera=t,this.overrideMaterial=n,this.clearColor=r,this.clearAlpha=void 0!==i?i:1,this.oldClearColor=new o["default"].Color,this.oldClearAlpha=1,this.enabled=!0,this.clear=!0,this.needsSwap=!1};a.prototype={render:function(e,t,n,r){this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(this.oldClearColor.copy(e.getClearColor()),this.oldClearAlpha=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),e.render(this.scene,this.camera,n,this.clear),this.clearColor&&e.setClearColor(this.oldClearColor,this.oldClearAlpha),this.scene.overrideMaterial=null}},t["default"]=a,o["default"].RenderPass=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a={uniforms:{tDiffuse:{type:"t",value:null},h:{type:"f",value:1/512},r:{type:"f",value:.35}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float h;","uniform float r;","varying vec2 vUv;","void main() {","vec4 sum = vec4( 0.0 );","float hh = h * abs( r - vUv.y );","sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;","sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;","sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;","sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;","sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;","sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;","sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;","sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;","gl_FragColor = sum;","}"].join("\n")};t["default"]=a,o["default"].HorizontalTiltShiftShader=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a={uniforms:{tDiffuse:{type:"t",value:null},v:{type:"f",value:1/512},r:{type:"f",value:.35}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform float v;","uniform float r;","varying vec2 vUv;","void main() {","vec4 sum = vec4( 0.0 );","float vv = v * abs( r - vUv.y );","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;","sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;","gl_FragColor = sum;","}"].join("\n")};t["default"]=a,o["default"].VerticalTiltShiftShader=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a={uniforms:{tDiffuse:{type:"t",value:null},resolution:{type:"v2",value:new o["default"].Vector2(1/1024,1/512)}},vertexShader:["void main() {","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","#define FXAA_REDUCE_MIN (1.0/128.0)","#define FXAA_REDUCE_MUL (1.0/8.0)","#define FXAA_SPAN_MAX 8.0","void main() {","vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;","vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;","vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;","vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;","vec4 rgbaM = texture2D( tDiffuse, gl_FragCoord.xy * resolution );","vec3 rgbM = rgbaM.xyz;","vec3 luma = vec3( 0.299, 0.587, 0.114 );","float lumaNW = dot( rgbNW, luma );","float lumaNE = dot( rgbNE, luma );","float lumaSW = dot( rgbSW, luma );","float lumaSE = dot( rgbSE, luma );","float lumaM = dot( rgbM, luma );","float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );","float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );","vec2 dir;","dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));","dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));","float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );","float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );","dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),","max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),","dir * rcpDirMin)) * resolution;","vec4 rgbA = (1.0/2.0) * (","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (1.0/3.0 - 0.5)) +","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (2.0/3.0 - 0.5)));","vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (0.0/3.0 - 0.5)) +","texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (3.0/3.0 - 0.5)));","float lumaB = dot(rgbB, vec4(luma, 0.0));","if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {","gl_FragColor = rgbA;","} else {","gl_FragColor = rgbB;","}","}"].join("\n")};t["default"]=a,o["default"].FXAAShader=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n=0;t--)e=this._object3D.children[t],e&&(this.remove(e),e.geometry&&(e.geometry.dispose(),e.geometry=null),e.material&&(e.material.map&&(e.material.map.dispose(),e.material.map=null),e.material.dispose(),e.material=null));if(this._domObject3D&&this._domObject3D.children)for(var e,t=this._domObject3D.children.length-1;t>=0;t--)e=this._domObject3D.children[t],e&&this.removeDOM3D(e);if(this._domObject2D&&this._domObject2D.children)for(var e,t=this._domObject2D.children.length-1;t>=0;t--)e=this._domObject2D.children[t],e&&this.removeDOM2D(e);this._domObject3D=null,this._domObject2D=null,this._world=null,this._object3D=null}}]),t}(l["default"]);t["default"]=m;var _=function(e){return new m(e)};t.layer=_},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n degrees, and the cosine of that","// earth shadow hack","const float cutoffAngle = pi/1.95;","const float steepness = 1.5;","vec3 totalRayleigh(vec3 lambda)","{","return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));","}","// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE","vec3 simplifiedRayleigh()","{","return 0.0005 / vec3(94, 40, 18);","}","float rayleighPhase(float cosTheta)","{ ","return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));","// return (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));","// return (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));","}","vec3 totalMie(vec3 lambda, vec3 K, float T)","{","float c = (0.2 * T ) * 10E-18;","return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;","}","float hgPhase(float cosTheta, float g)","{","return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));","}","float sunIntensity(float zenithAngleCos)","{","return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));","}","// float logLuminance(vec3 c)","// {","// return log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);","// }","// Filmic ToneMapping http://filmicgames.com/archives/75","float A = 0.15;","float B = 0.50;","float C = 0.10;","float D = 0.20;","float E = 0.02;","float F = 0.30;","float W = 1000.0;","vec3 Uncharted2Tonemap(vec3 x)","{","return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;","}","void main() ","{","float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);","// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;","// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);","float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));","vec3 sunDirection = normalize(sunPosition);","float sunE = sunIntensity(dot(sunDirection, up));","// extinction (absorbtion + out scattering) ","// rayleigh coefficients","vec3 betaR = simplifiedRayleigh() * reileighCoefficient;","// mie coefficients","vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;","// optical length","// cutoff angle at 90 to avoid singularity in next formula.","float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));","float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));","float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));","// combined extinction factor ","vec3 Fex = exp(-(betaR * sR + betaM * sM));","// in scattering","float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);","float rPhase = rayleighPhase(cosTheta*0.5+0.5);","vec3 betaRTheta = betaR * rPhase;","float mPhase = hgPhase(cosTheta, mieDirectionalG);","vec3 betaMTheta = betaM * mPhase;","vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));","Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));","//nightsky","vec3 direction = normalize(vWorldPosition - cameraPos);","float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]","float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]","vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);","// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;","vec3 L0 = vec3(0.1) * Fex;","// composition + solar disc","//if (cosTheta > sunAngularDiameterCos)","float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);","// if (normalize(vWorldPosition - cameraPos).y>0.0)","L0 += (sunE * 19000.0 * Fex)*sundisk;","vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));","vec3 texColor = (Lin+L0); ","texColor *= 0.04 ;","texColor += vec3(0.0,0.001,0.0025)*0.3;","float g_fMaxLuminance = 1.0;","float fLumScaled = 0.1 / luminance; ","float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ","float ExposureBias = fLumCompressed;","vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);","vec3 color = curr*whiteScale;","vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));","gl_FragColor.rgb = retColor;","gl_FragColor.a = 1.0;","}"].join("\n") };var a=function(){var e=o["default"].ShaderLib.sky,t=o["default"].UniformsUtils.clone(e.uniforms),n=new o["default"].ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:t,side:o["default"].BackSide}),r=new o["default"].SphereBufferGeometry(45e4,32,15),i=new o["default"].Mesh(r,n);this.mesh=i,this.uniforms=t};t["default"]=a,e.exports=t["default"]},function(e,t,n){function r(e,t,n){var r=!0,s=!0;if("function"!=typeof e)throw new TypeError(a);return i(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),o(e,t,{leading:r,maxWait:t,trailing:s})}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var o=n(50),a="Expected a function";e.exports=r},function(e,t){function n(e,t,n){function r(){g&&clearTimeout(g),d&&clearTimeout(d),x=0,h=d=y=g=b=void 0}function s(t,n){n&&clearTimeout(n),d=g=b=void 0,t&&(x=_(),p=e.apply(y,h),g||d||(h=y=void 0))}function u(){var e=t-(_()-v);0>=e||e>t?s(b,d):g=setTimeout(u,e)}function l(){return(g&&b||d&&E)&&(p=e.apply(y,h)),r(),p}function c(){s(E,g)}function f(){if(h=arguments,v=_(),y=this,b=E&&(g||!w),M===!1)var n=w&&!g;else{d||w||(x=v);var r=M-(v-x),i=0>=r||r>M;i?(d&&(d=clearTimeout(d)),x=v,p=e.apply(y,h)):d||(d=setTimeout(c,r))}return i&&g?g=clearTimeout(g):g||t===M||(g=setTimeout(u,t)),n&&(i=!0,p=e.apply(y,h)),!i||g||d||(h=y=void 0),p}var h,d,p,v,y,g,b,x=0,w=!1,M=!1,E=!0;if("function"!=typeof e)throw new TypeError(a);return t=o(t)||0,i(n)&&(w=!!n.leading,M="maxWait"in n&&m(o(n.maxWait)||0,t),E="trailing"in n?!!n.trailing:E),f.cancel=r,f.flush=l,f}function r(e){var t=i(e)?y.call(e):"";return t==u||t==l}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function o(e){if(i(e)){var t=r(e.valueOf)?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(c,"");var n=h.test(e);return n||d.test(e)?p(e.slice(2),n?2:8):f.test(e)?s:+e}var a="Expected a function",s=NaN,u="[object Function]",l="[object GeneratorFunction]",c=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,d=/^0o[0-7]+$/i,p=parseInt,v=Object.prototype,y=v.toString,m=Math.max,_=Date.now;e.exports=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(52),o=r(i),a={Orbit:o["default"],orbit:i.orbit,orbit:i.orbit};t["default"]=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n0?u(r()):re.y<0&&l(r()),te.copy(ne),B.update()}function v(e){Q.set(e.clientX,e.clientY),ee.subVectors(Q,$),ae(ee.x,ee.y),$.copy(Q),B.update()}function y(e){}function m(e){var t=0;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),t>0?l(r()):0>t&&u(r()),B.update()}function _(e){switch(e.keyCode){case B.keys.UP:ae(0,B.keyPanSpeed),B.update();break;case B.keys.BOTTOM:ae(0,-B.keyPanSpeed),B.update();break;case B.keys.LEFT:ae(B.keyPanSpeed,0),B.update();break;case B.keys.RIGHT:ae(-B.keyPanSpeed,0),B.update()}}function g(e){Y.set(e.pointers[0].pageX,e.pointers[0].pageY)}function b(e){var t=e.pointers[0].pageX-e.pointers[1].pageX,n=e.pointers[0].pageY-e.pointers[1].pageY,r=Math.sqrt(t*t+n*n);te.set(0,r)}function x(e){$.set(e.deltaX,e.deltaY)}function w(e){K.set(e.pointers[0].pageX,e.pointers[0].pageY),J.subVectors(K,Y);var t=B.domElement===document?B.domElement.body:B.domElement;i(2*Math.PI*J.x/t.clientWidth*B.rotateSpeed),a(2*Math.PI*J.y/t.clientHeight*B.rotateSpeed),Y.copy(K),B.update()}function M(e){var t=e.pointers[0].pageX-e.pointers[1].pageX,n=e.pointers[0].pageY-e.pointers[1].pageY,i=Math.sqrt(t*t+n*n);ne.set(0,i),re.subVectors(ne,te),re.y>0?l(r()):re.y<0&&u(r()),te.copy(ne),B.update()}function E(e){Q.set(e.deltaX,e.deltaY),ee.subVectors(Q,$),ae(ee.x,ee.y),$.copy(Q),B.update()}function O(e){}function k(e){if(B.enabled!==!1){if(e.preventDefault(),e.button===B.mouseButtons.ORBIT){if(B.enableRotate===!1)return;c(e),W=U.ROTATE}else if(e.button===B.mouseButtons.ZOOM){if(B.enableZoom===!1)return;f(e),W=U.DOLLY}else if(e.button===B.mouseButtons.PAN){if(B.enablePan===!1)return;h(e),W=U.PAN}W!==U.NONE&&(document.addEventListener("mousemove",P,!1),document.addEventListener("mouseup",T,!1),document.addEventListener("mouseout",T,!1),B.dispatchEvent(N))}}function P(e){if(B.enabled!==!1)if(e.preventDefault(),W===U.ROTATE){if(B.enableRotate===!1)return;d(e)}else if(W===U.DOLLY){if(B.enableZoom===!1)return;p(e)}else if(W===U.PAN){if(B.enablePan===!1)return;v(e)}}function T(e){B.enabled!==!1&&(y(e),document.removeEventListener("mousemove",P,!1),document.removeEventListener("mouseup",T,!1),document.removeEventListener("mouseout",T,!1),B.dispatchEvent(z),W=U.NONE)}function j(e){B.enabled!==!1&&B.enableZoom!==!1&&W===U.NONE&&(e.preventDefault(),e.stopPropagation(),m(e),B.dispatchEvent(N),B.dispatchEvent(z))}function S(e){B.enabled!==!1&&B.enableKeys!==!1&&B.enablePan!==!1&&_(e)}function A(e){if(B.enabled!==!1){switch(e.touches.length){case 1:if(B.enableRotate===!1)return;g(e),W=U.TOUCH_ROTATE;break;case 2:if(B.enableZoom===!1)return;b(e),W=U.TOUCH_DOLLY;break;case 3:if(B.enablePan===!1)return;x(e),W=U.TOUCH_PAN;break;default:W=U.NONE}W!==U.NONE&&B.dispatchEvent(N)}}function C(e){if(B.enabled!==!1)switch(e.preventDefault(),e.stopPropagation(),e.touches.length){case 1:if(B.enableRotate===!1)return;if(W!==U.TOUCH_ROTATE)return;w(e);break;case 2:if(B.enableZoom===!1)return;if(W!==U.TOUCH_DOLLY)return;M(e);break;case 3:if(B.enablePan===!1)return;if(W!==U.TOUCH_PAN)return;E(e);break;default:W=U.NONE}}function L(e){B.enabled!==!1&&(O(e),B.dispatchEvent(z),W=U.NONE)}function D(e){e.preventDefault()}this.object=e,this.domElement=void 0!==t?t:document,this.enabled=!0,this.target=new o["default"].Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-(1/0),this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:o["default"].MOUSE.LEFT,ZOOM:o["default"].MOUSE.MIDDLE,PAN:o["default"].MOUSE.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return I},this.getAzimuthalAngle=function(){return R},this.reset=function(){B.target.copy(B.target0),B.object.position.copy(B.position0),B.object.zoom=B.zoom0,B.object.updateProjectionMatrix(),B.dispatchEvent(F),B.update(),W=U.NONE},this.update=function(){var t=new o["default"].Vector3,r=(new o["default"].Quaternion).setFromUnitVectors(e.up,new o["default"].Vector3(0,1,0)),a=r.clone().inverse(),s=new o["default"].Vector3,u=new o["default"].Quaternion;return function(){var e=B.object.position;t.copy(e).sub(B.target),t.applyQuaternion(r),R=Math.atan2(t.x,t.z),I=Math.atan2(Math.sqrt(t.x*t.x+t.z*t.z),t.y),B.autoRotate&&W===U.NONE&&i(n()),R+=V,I+=q,R=Math.max(B.minAzimuthAngle,Math.min(B.maxAzimuthAngle,R)),I=Math.max(B.minPolarAngle,Math.min(B.maxPolarAngle,I)),I=Math.max(H,Math.min(Math.PI-H,I));var o=t.length()*G;return o=Math.max(B.minDistance,Math.min(B.maxDistance,o)),B.target.add(X),t.x=o*Math.sin(I)*Math.sin(R),t.y=o*Math.cos(I),t.z=o*Math.sin(I)*Math.cos(R),t.applyQuaternion(a),e.copy(B.target).add(t),B.object.lookAt(B.target),B.enableDamping===!0?(V*=1-B.dampingFactor,q*=1-B.dampingFactor):(V=0,q=0),G=1,X.set(0,0,0),Z||s.distanceToSquared(B.object.position)>H||8*(1-u.dot(B.object.quaternion))>H?(B.dispatchEvent(F),s.copy(B.object.position),u.copy(B.object.quaternion),Z=!1,!0):!1}}(),this.dispose=function(){B.domElement.removeEventListener("contextmenu",D,!1),B.domElement.removeEventListener("mousedown",k,!1),B.domElement.removeEventListener("mousewheel",j,!1),B.domElement.removeEventListener("MozMousePixelScroll",j,!1),B.domElement.removeEventListener("touchstart",A,!1),B.domElement.removeEventListener("touchend",L,!1),B.domElement.removeEventListener("touchmove",C,!1),document.removeEventListener("mousemove",P,!1),document.removeEventListener("mouseup",T,!1),document.removeEventListener("mouseout",T,!1),window.removeEventListener("keydown",S,!1)};var R,I,B=this,F={type:"change"},N={type:"start"},z={type:"end"},U={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},W=U.NONE,H=1e-6,q=0,V=0,G=1,X=new o["default"].Vector3,Z=!1,Y=new o["default"].Vector2,K=new o["default"].Vector2,J=new o["default"].Vector2,$=new o["default"].Vector2,Q=new o["default"].Vector2,ee=new o["default"].Vector2,te=new o["default"].Vector2,ne=new o["default"].Vector2,re=new o["default"].Vector2,ie=function(){var e=new o["default"].Vector3;return function(t,n){var r=n.elements;e.set(r[0],0,r[2]),e.multiplyScalar(-t),X.add(e)}}(),oe=function(){var e=new o["default"].Vector3;return function(t,n){var r=n.elements,i=t/Math.cos(I);e.set(r[4],0,r[6]),e.multiplyScalar(i),X.add(e)}}(),ae=function(){var e=new o["default"].Vector3;return function(t,n){var r=B.domElement===document?B.domElement.body:B.domElement;if(B.object instanceof o["default"].PerspectiveCamera){var i=B.object.position;e.copy(i).sub(B.target);var a=e.length();a*=Math.tan(B.object.fov/2*Math.PI/180),ie(2*t*a/r.clientHeight,B.object.matrix),oe(2*n*a/r.clientHeight,B.object.matrix)}else B.object instanceof o["default"].OrthographicCamera?(ie(t*(B.object.right-B.object.left)/r.clientWidth,B.object.matrix),oe(n*(B.object.top-B.object.bottom)/r.clientHeight,B.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),B.enablePan=!1)}}();B.domElement.addEventListener("contextmenu",D,!1),B.domElement.addEventListener("mousedown",k,!1),B.domElement.addEventListener("mousewheel",j,!1),B.domElement.addEventListener("MozMousePixelScroll",j,!1),B.hammer=new s["default"](B.domElement),B.hammer.get("pan").set({pointers:0,direction:s["default"].DIRECTION_ALL}),B.hammer.get("pinch").set({enable:!0,threshold:.1}),B.hammer.on("panstart",function(e){if(B.enabled!==!1&&"mouse"!==e.pointerType){if(1===e.pointers.length){if(B.enablePan===!1)return;x(e),W=U.TOUCH_PAN}else if(2===e.pointers.length){if(B.enableRotate===!1)return;g(e),W=U.TOUCH_ROTATE}W!==U.NONE&&B.dispatchEvent(N)}}),B.hammer.on("panend",function(e){"mouse"!==e.pointerType&&L(e)}),B.hammer.on("panmove",function(e){if(B.enabled!==!1&&"mouse"!==e.pointerType)if(1===e.pointers.length){if(B.enablePan===!1)return;if(W!==U.TOUCH_PAN)return;E(e)}else if(2===e.pointers.length){if(B.enableRotate===!1)return;if(W!==U.TOUCH_ROTATE)return;w(e)}}),B.hammer.on("pinchstart",function(e){B.enabled!==!1&&"mouse"!==e.pointerType&&B.enableZoom!==!1&&(b(e),W=U.TOUCH_DOLLY,W!==U.NONE&&B.dispatchEvent(N))}),B.hammer.on("pinchend",function(e){"mouse"!==e.pointerType&&L(e)}),B.hammer.on("pinchmove",function(e){B.enabled!==!1&&"mouse"!==e.pointerType&&B.enableZoom!==!1&&W===U.TOUCH_DOLLY&&M(e)}),window.addEventListener("keydown",S,!1),this.update()};u.prototype=Object.create(o["default"].EventDispatcher.prototype),u.prototype.constructor=o["default"].OrbitControls,Object.defineProperties(u.prototype,{center:{get:function(){return console.warn("THREE.OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.constraint.enableDamping},set:function(e){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.constraint.enableDamping=!e}},dynamicDampingFactor:{get:function(){return console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor},set:function(e){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor=e}}}),t["default"]=u,e.exports=t["default"]},function(e,t,n){var r;!function(i,o,a,s){"use strict";function u(e,t,n){return setTimeout(d(e,n),t)}function l(e,t,n){return Array.isArray(e)?(c(e,n[t],n),!0):!1}function c(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==s)for(r=0;r\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=i.console&&(i.console.warn||i.console.log);return o&&o.call(i.console,r,n),e.apply(this,arguments)}}function h(e,t,n){var r,i=t.prototype;r=e.prototype=Object.create(i),r.constructor=e,r._super=i,n&&fe(r,n)}function d(e,t){return function(){return e.apply(t,arguments)}}function p(e,t){return typeof e==pe?e.apply(t?t[0]||s:s,t):e}function v(e,t){return e===s?t:e}function y(e,t,n){c(b(t),function(t){e.addEventListener(t,n,!1)})}function m(e,t,n){c(b(t),function(t){e.removeEventListener(t,n,!1)})}function _(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function g(e,t){return e.indexOf(t)>-1}function b(e){return e.trim().split(/\s+/g)}function x(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var r=0;rn[t]}):r.sort()),r}function E(e,t){for(var n,r,i=t[0].toUpperCase()+t.slice(1),o=0;o1&&!n.firstMultiple?n.firstMultiple=L(t):1===i&&(n.firstMultiple=!1);var o=n.firstInput,a=n.firstMultiple,s=a?a.center:o.center,u=t.center=D(r);t.timeStamp=me(),t.deltaTime=t.timeStamp-o.timeStamp,t.angle=F(s,u),t.distance=B(s,u),A(n,t),t.offsetDirection=I(t.deltaX,t.deltaY);var l=R(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=l.x,t.overallVelocityY=l.y,t.overallVelocity=ye(l.x)>ye(l.y)?l.x:l.y,t.scale=a?z(a.pointers,r):1,t.rotation=a?N(a.pointers,r):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,C(n,t);var c=e.element;_(t.srcEvent.target,c)&&(c=t.srcEvent.target),t.target=c}function A(e,t){var n=t.center,r=e.offsetDelta||{},i=e.prevDelta||{},o=e.prevInput||{};(t.eventType===Se||o.eventType===Ce)&&(i=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},r=e.offsetDelta={x:n.x,y:n.y}),t.deltaX=i.x+(n.x-r.x),t.deltaY=i.y+(n.y-r.y)}function C(e,t){var n,r,i,o,a=e.lastInterval||t,u=t.timeStamp-a.timeStamp;if(t.eventType!=Le&&(u>je||a.velocity===s)){var l=t.deltaX-a.deltaX,c=t.deltaY-a.deltaY,f=R(u,l,c);r=f.x,i=f.y,n=ye(f.x)>ye(f.y)?f.x:f.y,o=I(l,c),e.lastInterval=t}else n=a.velocity,r=a.velocityX,i=a.velocityY,o=a.direction;t.velocity=n,t.velocityX=r,t.velocityY=i,t.direction=o}function L(e){for(var t=[],n=0;ni;)n+=e[i].clientX,r+=e[i].clientY,i++;return{x:ve(n/t),y:ve(r/t)}}function R(e,t,n){return{x:t/e||0,y:n/e||0}}function I(e,t){return e===t?De:ye(e)>=ye(t)?0>e?Re:Ie:0>t?Be:Fe}function B(e,t,n){n||(n=We);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return Math.sqrt(r*r+i*i)}function F(e,t,n){n||(n=We);var r=t[n[0]]-e[n[0]],i=t[n[1]]-e[n[1]];return 180*Math.atan2(i,r)/Math.PI}function N(e,t){return F(t[1],t[0],He)+F(e[1],e[0],He)}function z(e,t){return B(t[0],t[1],He)/B(e[0],e[1],He)}function U(){this.evEl=Ve,this.evWin=Ge,this.allow=!0,this.pressed=!1,P.apply(this,arguments)}function W(){this.evEl=Ye,this.evWin=Ke,P.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function H(){this.evTarget=$e,this.evWin=Qe,this.started=!1,P.apply(this,arguments)}function q(e,t){var n=w(e.touches),r=w(e.changedTouches);return t&(Ce|Le)&&(n=M(n.concat(r),"identifier",!0)),[n,r]}function V(){this.evTarget=tt,this.targetIds={},P.apply(this,arguments)}function G(e,t){var n=w(e.touches),r=this.targetIds;if(t&(Se|Ae)&&1===n.length)return r[n[0].identifier]=!0,[n,n];var i,o,a=w(e.changedTouches),s=[],u=this.target;if(o=n.filter(function(e){return _(e.target,u)}),t===Se)for(i=0;is&&(t.push(e),s=t.length-1):i&(Ce|Le)&&(n=!0),0>s||(t[s]=e,this.callback(this.manager,i,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var Je={touchstart:Se,touchmove:Ae,touchend:Ce,touchcancel:Le},$e="touchstart",Qe="touchstart touchmove touchend touchcancel";h(H,P,{handler:function(e){var t=Je[e.type];if(t===Se&&(this.started=!0),this.started){var n=q.call(this,e,t);t&(Ce|Le)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:Oe,srcEvent:e})}}});var et={touchstart:Se,touchmove:Ae,touchend:Ce,touchcancel:Le},tt="touchstart touchmove touchend touchcancel";h(V,P,{handler:function(e){var t=et[e.type],n=G.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:Oe,srcEvent:e})}}),h(X,P,{handler:function(e,t,n){var r=n.pointerType==Oe,i=n.pointerType==Pe;if(r)this.mouse.allow=!1;else if(i&&!this.mouse.allow)return;t&(Ce|Le)&&(this.mouse.allow=!0),this.callback(e,t,n)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var nt=E(de.style,"touchAction"),rt=nt!==s,it="compute",ot="auto",at="manipulation",st="none",ut="pan-x",lt="pan-y";Z.prototype={set:function(e){e==it&&(e=this.compute()),rt&&this.manager.element.style&&(this.manager.element.style[nt]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return c(this.manager.recognizers,function(t){p(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),Y(e.join(" "))},preventDefaults:function(e){if(!rt){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)return void t.preventDefault();var r=this.actions,i=g(r,st),o=g(r,lt),a=g(r,ut);if(i){var s=1===e.pointers.length,u=e.distance<2,l=e.deltaTime<250;if(s&&u&&l)return}if(!a||!o)return i||o&&n&Ne||a&&n&ze?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var ct=1,ft=2,ht=4,dt=8,pt=dt,vt=16,yt=32;K.prototype={defaults:{},set:function(e){return fe(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(l(e,"recognizeWith",this))return this;var t=this.simultaneous;return e=Q(e,this),t[e.id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return l(e,"dropRecognizeWith",this)?this:(e=Q(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(l(e,"requireFailure",this))return this;var t=this.requireFail;return e=Q(e,this),-1===x(t,e)&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(l(e,"dropRequireFailure",this))return this;e=Q(e,this);var t=x(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){function t(t){n.manager.emit(t,e)}var n=this,r=this.state;dt>r&&t(n.options.event+J(r)),t(n.options.event),e.additionalEvent&&t(e.additionalEvent),r>=dt&&t(n.options.event+J(r))},tryEmit:function(e){return this.canEmit()?this.emit(e):void(this.state=yt)},canEmit:function(){for(var e=0;eo?Re:Ie,n=o!=this.pX,r=Math.abs(e.deltaX)):(i=0===a?De:0>a?Be:Fe,n=a!=this.pY,r=Math.abs(e.deltaY))),e.direction=i,n&&r>t.threshold&&i&t.direction},attrTest:function(e){return ee.prototype.attrTest.call(this,e)&&(this.state&ft||!(this.state&ft)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=$(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),h(ne,ee,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[st]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&ft)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),h(re,K,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ot]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distancet.time;if(this._input=e,!r||!n||e.eventType&(Ce|Le)&&!i)this.reset();else if(e.eventType&Se)this.reset(),this._timer=u(function(){this.state=pt,this.tryEmit()},t.time,this);else if(e.eventType&Ce)return pt;return yt},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===pt&&(e&&e.eventType&Ce?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=me(),this.manager.emit(this.options.event,this._input)))}}),h(ie,ee,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[st]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&ft); }}),h(oe,ee,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Ne|ze,pointers:1},getTouchAction:function(){return te.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(Ne|ze)?t=e.overallVelocity:n&Ne?t=e.overallVelocityX:n&ze&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&ye(t)>this.options.velocity&&e.eventType&Ce},emit:function(e){var t=$(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),h(ae,K,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[at]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,r=e.distance0){var i=n.getCenter(),o=new v["default"].Vector3(i[0],0,i[1]).sub(t.position).length();if(o>e._options.distance)return!1}return n.getMesh()||n.requestTileAsync(),!0})}}},{key:"_divide",value:function(e){for(var t,n,r=0;r!=e.length;)t=e[r],n=t.getQuadcode(),t.length!==this._maxLOD&&this._screenSpaceError(t)?(e.splice(r,1),e.push(this._requestTile(n+"0",this)),e.push(this._requestTile(n+"1",this)),e.push(this._requestTile(n+"2",this)),e.push(this._requestTile(n+"3",this))):r++}},{key:"_screenSpaceError",value:function(e){var t=this._minLOD,n=this._maxLOD,r=e.getQuadcode(),i=this._world.getCamera(),o=3;if(r.length===n)return!1;if(r.length1}},{key:"_removeTiles",value:function(){if(this._tiles&&this._tiles.children){for(var e=this._tiles.children.length-1;e>=0;e--)this._tiles.remove(this._tiles.children[e]);if(this._tilesPicking&&this._tilesPicking.children)for(var e=this._tilesPicking.children.length-1;e>=0;e--)this._tilesPicking.remove(this._tilesPicking.children[e])}}},{key:"_createTile",value:function(e,t){}},{key:"_requestTile",value:function(e,t){var n=this._tileCache.getTile(e);return n||(n=this._createTile(e,t),this._tileCache.setTile(e,n)),n}},{key:"_destroyTile",value:function(e){this._tiles.remove(e.getMesh()),e.destroy()}},{key:"destroy",value:function(){if(this._tiles.children)for(var e=this._tiles.children.length-1;e>=0;e--)this._tiles.remove(this._tiles.children[e]);if(this.removeFromPicking(this._tilesPicking),this._tilesPicking.children)for(var e=this._tilesPicking.children.length-1;e>=0;e--)this._tilesPicking.remove(this._tilesPicking.children[e]);this._tileCache.destroy(),this._tileCache=null,this._tiles=null,this._tilesPicking=null,this._frustum=null,s(Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}}]),t}(l["default"]);t["default"]=y,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n=t)&&r(this,"max",1/0);var n=e.length||i;"function"!=typeof n&&(n=i),r(this,"lengthCalculator",n),r(this,"allowStale",e.stale||!1),r(this,"maxAge",e.maxAge||0),r(this,"dispose",e.dispose),this.reset()}function a(e,t,n,i){var o=n.value;u(e,o)&&(c(e,n),r(e,"allowStale")||(o=void 0)),o&&t.call(i,o.value,o.key,e)}function s(e,t,n){var i=r(e,"cache").get(t);if(i){var o=i.value;u(e,o)?(c(e,i),r(e,"allowStale")||(o=void 0)):n&&r(e,"lruList").unshiftNode(i),o&&(o=o.value)}return o}function u(e,t){if(!t||!t.maxAge&&!r(e,"maxAge"))return!1;var n=!1,i=Date.now()-t.now;return n=t.maxAge?i>t.maxAge:r(e,"maxAge")&&i>r(e,"maxAge")}function l(e){if(r(e,"length")>r(e,"max"))for(var t=r(e,"lruList").tail;r(e,"length")>r(e,"max")&&null!==t;){var n=t.prev;c(e,t),t=n}}function c(e,t){if(t){var n=t.value;r(e,"dispose")&&r(e,"dispose").call(this,n.key,n.value),r(e,"length",r(e,"length")-n.length),r(e,"cache")["delete"](n.key),r(e,"lruList").removeNode(t)}}function f(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}e.exports=o;var h,d=n(59),p=n(62),v=n(65),y={},m="function"==typeof Symbol;h=m?function(e){return Symbol["for"](e)}:function(e){return"_"+e},Object.defineProperty(o.prototype,"max",{set:function(e){(!e||"number"!=typeof e||0>=e)&&(e=1/0),r(this,"max",e),l(this)},get:function(){return r(this,"max")},enumerable:!0}),Object.defineProperty(o.prototype,"allowStale",{set:function(e){r(this,"allowStale",!!e)},get:function(){return r(this,"allowStale")},enumerable:!0}),Object.defineProperty(o.prototype,"maxAge",{set:function(e){(!e||"number"!=typeof e||0>e)&&(e=0),r(this,"maxAge",e),l(this)},get:function(){return r(this,"maxAge")},enumerable:!0}),Object.defineProperty(o.prototype,"lengthCalculator",{set:function(e){"function"!=typeof e&&(e=i),e!==r(this,"lengthCalculator")&&(r(this,"lengthCalculator",e),r(this,"length",0),r(this,"lruList").forEach(function(e){e.length=r(this,"lengthCalculator").call(this,e.value,e.key),r(this,"length",r(this,"length")+e.length)},this)),l(this)},get:function(){return r(this,"lengthCalculator")},enumerable:!0}),Object.defineProperty(o.prototype,"length",{get:function(){return r(this,"length")},enumerable:!0}),Object.defineProperty(o.prototype,"itemCount",{get:function(){return r(this,"lruList").length},enumerable:!0}),o.prototype.rforEach=function(e,t){t=t||this;for(var n=r(this,"lruList").tail;null!==n;){var i=n.prev;a(this,e,n,t),n=i}},o.prototype.forEach=function(e,t){t=t||this;for(var n=r(this,"lruList").head;null!==n;){var i=n.next;a(this,e,n,t),n=i}},o.prototype.keys=function(){return r(this,"lruList").toArray().map(function(e){return e.key},this)},o.prototype.values=function(){return r(this,"lruList").toArray().map(function(e){return e.value},this)},o.prototype.reset=function(){r(this,"dispose")&&r(this,"lruList")&&r(this,"lruList").length&&r(this,"lruList").forEach(function(e){r(this,"dispose").call(this,e.key,e.value)},this),r(this,"cache",new d),r(this,"lruList",new v),r(this,"length",0)},o.prototype.dump=function(){return r(this,"lruList").map(function(e){return u(this,e)?void 0:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}},this).toArray().filter(function(e){return e})},o.prototype.dumpLru=function(){return r(this,"lruList")},o.prototype.inspect=function(e,t){var n="LRUCache {",o=!1,a=r(this,"allowStale");a&&(n+="\n allowStale: true",o=!0);var s=r(this,"max");s&&s!==1/0&&(o&&(n+=","),n+="\n max: "+p.inspect(s,t),o=!0);var l=r(this,"maxAge");l&&(o&&(n+=","),n+="\n maxAge: "+p.inspect(l,t),o=!0);var c=r(this,"lengthCalculator");c&&c!==i&&(o&&(n+=","),n+="\n length: "+p.inspect(r(this,"length"),t),o=!0);var f=!1;return r(this,"lruList").forEach(function(e){f?n+=",\n ":(o&&(n+=",\n"),f=!0,n+="\n ");var r=p.inspect(e.key).split("\n").join("\n "),a={value:e.value};e.maxAge!==l&&(a.maxAge=e.maxAge),c!==i&&(a.length=e.length),u(this,e)&&(a.stale=!0),a=p.inspect(a,t).split("\n").join("\n "),n+=r+" => "+a}),(f||o)&&(n+="\n"),n+="}"},o.prototype.set=function(e,t,n){n=n||r(this,"maxAge");var i=n?Date.now():0,o=r(this,"lengthCalculator").call(this,t,e);if(r(this,"cache").has(e)){if(o>r(this,"max"))return c(this,r(this,"cache").get(e)),!1;var a=r(this,"cache").get(e),s=a.value;return r(this,"dispose")&&r(this,"dispose").call(this,e,s.value),s.now=i,s.maxAge=n,s.value=t,r(this,"length",r(this,"length")+(o-s.length)),s.length=o,this.get(e),l(this),!0}var u=new f(e,t,o,i,n);return u.length>r(this,"max")?(r(this,"dispose")&&r(this,"dispose").call(this,e,t),!1):(r(this,"length",r(this,"length")+u.length),r(this,"lruList").unshift(u),r(this,"cache").set(e,r(this,"lruList").head),l(this),!0)},o.prototype.has=function(e){if(!r(this,"cache").has(e))return!1;var t=r(this,"cache").get(e).value;return u(this,t)?!1:!0},o.prototype.get=function(e){return s(this,e,!0)},o.prototype.peek=function(e){return s(this,e,!1)},o.prototype.pop=function(){var e=r(this,"lruList").tail;return e?(c(this,e),e.value):null},o.prototype.del=function(e){c(this,r(this,"cache").get(e))},o.prototype.load=function(e){this.reset();for(var t=Date.now(),n=e.length-1;n>=0;n--){var r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{var o=i-t;o>0&&this.set(r.k,r.v,o)}}},o.prototype.prune=function(){var e=this;r(this,"cache").forEach(function(t,n){s(e,n,!1)})}},function(e,t,n){(function(t){"pseudomap"===t.env.npm_package_name&&"test"===t.env.npm_lifecycle_script&&(t.env.TEST_PSEUDOMAP="true"),"function"!=typeof Map||t.env.TEST_PSEUDOMAP?e.exports=n(61):e.exports=Map}).call(t,n(60))},function(e,t){function n(){l=!1,a.length?u=a.concat(u):c=-1,u.length&&r()}function r(){if(!l){var e=setTimeout(n);l=!0;for(var t=u.length;t;){for(a=u,u=[];++c1)for(var n=1;n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),v(n)?r.showHidden=n:n&&t._extend(r,n),x(r.showHidden)&&(r.showHidden=!1),x(r.depth)&&(r.depth=2),x(r.colors)&&(r.colors=!1),x(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e,t){return e}function s(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(e,n,r){if(e.customInspect&&n&&k(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return g(i)||(i=u(e,i,r)),i}var o=l(e,n);if(o)return o;var a=Object.keys(n),v=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),O(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(n);if(0===a.length){if(k(n)){var y=n.name?": "+n.name:"";return e.stylize("[Function"+y+"]","special")}if(w(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return e.stylize(Date.prototype.toString.call(n),"date");if(O(n))return c(n)}var m="",_=!1,b=["{","}"];if(p(n)&&(_=!0,b=["[","]"]),k(n)){var x=n.name?": "+n.name:"";m=" [Function"+x+"]"}if(w(n)&&(m=" "+RegExp.prototype.toString.call(n)),E(n)&&(m=" "+Date.prototype.toUTCString.call(n)),O(n)&&(m=" "+c(n)),0===a.length&&(!_||0==n.length))return b[0]+m+b[1];if(0>r)return w(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var M;return M=_?f(e,n,r,v,a):a.map(function(t){return h(e,n,r,v,t,_)}),e.seen.pop(),d(M,m,b)}function l(e,t){if(x(t))return e.stylize("undefined","undefined");if(g(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return _(t)?e.stylize(""+t,"number"):v(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,i){for(var o=[],a=0,s=t.length;s>a;++a)A(t,String(a))?o.push(h(e,t,n,r,String(a),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(h(e,t,n,r,i,!0))}),o}function h(e,t,n,r,i,o){var a,s,l;if(l=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},l.get?s=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(s=e.stylize("[Setter]","special")),A(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(l.value)<0?(s=y(n)?u(e,l.value,null):u(e,l.value,n-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),x(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function p(e){return Array.isArray(e)}function v(e){return"boolean"==typeof e}function y(e){return null===e}function m(e){return null==e}function _(e){return"number"==typeof e}function g(e){return"string"==typeof e}function b(e){return"symbol"==typeof e}function x(e){return void 0===e}function w(e){return M(e)&&"[object RegExp]"===T(e)}function M(e){return"object"==typeof e&&null!==e}function E(e){return M(e)&&"[object Date]"===T(e)}function O(e){return M(e)&&("[object Error]"===T(e)||e instanceof Error)}function k(e){return"function"==typeof e}function P(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function T(e){return Object.prototype.toString.call(e)}function j(e){return 10>e?"0"+e.toString(10):e.toString(10)}function S(){var e=new Date,t=[j(e.getHours()),j(e.getMinutes()),j(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function A(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var C=/%[sdj%]/g;t.format=function(e){if(!g(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),s=r[n];o>n;s=r[++n])a+=y(s)||!M(s)?" "+s:" "+i(s);return a},t.deprecate=function(n,i){function o(){if(!a){if(r.throwDeprecation)throw new Error(i);r.traceDeprecation?console.trace(i):console.error(i),a=!0}return n.apply(this,arguments)}if(x(e.process))return function(){return t.deprecate(n,i).apply(this,arguments)};if(r.noDeprecation===!0)return n;var a=!1;return o};var L,D={};t.debuglog=function(e){if(x(L)&&(L=r.env.NODE_DEBUG||""),e=e.toUpperCase(),!D[e])if(new RegExp("\\b"+e+"\\b","i").test(L)){var n=r.pid;D[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else D[e]=function(){};return D[e]},t.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=v,t.isNull=y,t.isNullOrUndefined=m,t.isNumber=_,t.isString=g,t.isSymbol=b,t.isUndefined=x,t.isRegExp=w,t.isObject=M,t.isDate=E,t.isError=O,t.isFunction=k,t.isPrimitive=P,t.isBuffer=n(63);var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];t.log=function(){console.log("%s - %s",S(),t.format.apply(t,arguments))},t.inherits=n(64),t._extend=function(e,t){if(!t||!M(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(t,function(){return this}(),n(60))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t){function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;i>r;r++)t.push(arguments[r]);return t}function r(e,t){e.tail=new o(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function i(e,t){e.head=new o(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function o(e,t,n,r){return this instanceof o?(this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,void(n?(n.prev=this,this.next=n):this.next=null)):new o(e,t,n,r)}e.exports=n,n.Node=o,n.create=n,n.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;t>e;e++)r(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;t>e;e++)i(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail.next=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head.prev=null,this.length--,e}},n.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,r=0;null!==n;r++)e.call(t,n.value,r,this),n=n.next},n.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,r=this.length-1;null!==n;r--)e.call(t,n.value,r,this),n=n.prev},n.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&e>t;t++)n=n.next;return t===e&&null!==n?n.value:void 0},n.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&e>t;t++)n=n.prev;return t===e&&null!==n?n.value:void 0},n.prototype.map=function(e,t){t=t||this;for(var r=new n,i=this.head;null!==i;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t=t||this;for(var r=new n,i=this.tail;null!==i;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=e(n,r.value,i),r=r.next;return n},n.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=e(n,r.value,i),r=r.prev;return n},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},n.prototype.slice=function(e,t){t=t||this.length,0>t&&(t+=this.length),e=e||0,0>e&&(e+=this.length);var r=new n;if(e>t||0>t)return r;0>e&&(e=0),t>this.length&&(t=this.length);for(var i=0,o=this.head;null!==o&&e>i;i++)o=o.next;for(;null!==o&&t>i;i++,o=o.next)r.push(o.value);return r},n.prototype.sliceReverse=function(e,t){t=t||this.length,0>t&&(t+=this.length),e=e||0,0>e&&(e+=this.length);var r=new n;if(e>t||0>t)return r;0>e&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,o=this.tail;null!==o&&i>t;i--)o=o.prev;for(;null!==o&&i>e;i--,o=o.prev)r.push(o.value);return r},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){ -var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this}},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n0;i--){var o=1<0){var c=m["default"].mergeAttributes(a);this._setPolygonMesh(c,s),this.add(this._polygonMesh)}if(u.length>0){var h=m["default"].mergeAttributes(u);this._setPolylineMesh(h),this.add(this._polylineMesh)}if(l.length>0){var d=m["default"].mergeAttributes(l);this._setPointMesh(d),this.add(this._pointMesh)}this._layers.forEach(function(e){e.clearBufferAttributes(),e.clearCoordinates()})}}},{key:"_setPolygonMesh",value:function(e,t){var n=new THREE.BufferGeometry;n.addAttribute("position",new THREE.BufferAttribute(e.vertices,3)),n.addAttribute("normal",new THREE.BufferAttribute(e.normals,3)),n.addAttribute("color",new THREE.BufferAttribute(e.colours,3)),e.pickingIds&&n.addAttribute("pickingId",new THREE.BufferAttribute(e.pickingIds,1)),n.computeBoundingBox();var r="function"==typeof this._options.style?this._options.style(this._geojson.features[0]):this._options.style;r=(0,f["default"])({},v["default"].defaultStyle,r);var i;this._options.polygonMaterial&&this._options.polygonMaterial instanceof THREE.Material?i=this._options.polygonMaterial:this._world._environment._skybox?(i=new THREE.MeshStandardMaterial({vertexColors:THREE.VertexColors,side:THREE.BackSide,transparent:r.transparent,opacity:r.opacity,blending:r.blending}),i.roughness=1,i.metalness=.1,i.envMapIntensity=3,i.envMap=this._world._environment._skybox.getRenderTarget()):i=new THREE.MeshPhongMaterial({vertexColors:THREE.VertexColors,side:THREE.BackSide,transparent:r.transparent,opacity:r.opacity,blending:r.blending});var o;if("function"==typeof this._options.onPolygonMesh?o=this._options.onPolygonMesh(n,i):(o=new THREE.Mesh(n,i),o.castShadow=!0,o.receiveShadow=!0),t&&(i.depthWrite=!1,o.renderOrder=1),this._options.interactive&&this._pickingMesh){i=new g["default"],i.side=THREE.BackSide;var a=new THREE.Mesh(n,i);this._pickingMesh.add(a)}this._polygonMesh=o}},{key:"_setPolylineMesh",value:function(e){var t=new THREE.BufferGeometry;t.addAttribute("position",new THREE.BufferAttribute(e.vertices,3)),e.normals&&t.addAttribute("normal",new THREE.BufferAttribute(e.normals,3)),t.addAttribute("color",new THREE.BufferAttribute(e.colours,3)),e.pickingIds&&t.addAttribute("pickingId",new THREE.BufferAttribute(e.pickingIds,1)),t.computeBoundingBox();var n="function"==typeof this._options.style?this._options.style(this._geojson.features[0]):this._options.style;n=(0,f["default"])({},v["default"].defaultStyle,n);var r;r=this._options.polylineMaterial&&this._options.polylineMaterial instanceof THREE.Material?this._options.polylineMaterial:new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors,linewidth:n.lineWidth,transparent:n.lineTransparent,opacity:n.lineOpacity,blending:n.lineBlending});var i;if("function"==typeof this._options.onPolylineMesh?i=this._options.onPolylineMesh(t,r):(i=new THREE.LineSegments(t,r),void 0!==n.lineRenderOrder&&(r.depthWrite=!1,i.renderOrder=n.lineRenderOrder),i.castShadow=!0),this._options.interactive&&this._pickingMesh){r=new g["default"],r.linewidth=n.lineWidth+r.linePadding;var o=new THREE.LineSegments(t,r);this._pickingMesh.add(o)}this._polylineMesh=i}},{key:"_setPointMesh",value:function(e){var t=new THREE.BufferGeometry;t.addAttribute("position",new THREE.BufferAttribute(e.vertices,3)),t.addAttribute("normal",new THREE.BufferAttribute(e.normals,3)),t.addAttribute("color",new THREE.BufferAttribute(e.colours,3)),e.pickingIds&&t.addAttribute("pickingId",new THREE.BufferAttribute(e.pickingIds,1)),t.computeBoundingBox();var n;this._options.pointMaterial&&this._options.pointMaterial instanceof THREE.Material?n=this._options.pointMaterial:this._world._environment._skybox?(n=new THREE.MeshStandardMaterial({vertexColors:THREE.VertexColors}),n.roughness=1,n.metalness=.1,n.envMapIntensity=3,n.envMap=this._world._environment._skybox.getRenderTarget()):n=new THREE.MeshPhongMaterial({vertexColors:THREE.VertexColors});var r;if("function"==typeof this._options.onPointMesh?r=this._options.onPointMesh(t,n):(r=new THREE.Mesh(t,n),r.castShadow=!0),this._options.interactive&&this._pickingMesh){n=new g["default"];var i=new THREE.Mesh(t,n);this._pickingMesh.add(i)}this._pointMesh=r}},{key:"_featureToLayer",value:function(e,t){var n=e.geometry,r=n.coordinates?n.coordinates:null;return r&&n?"Polygon"===n.type||"MultiPolygon"===n.type?("function"==typeof this._options.polygonMaterial&&(t.geometry=this._options.polygonMaterial(e)),"function"==typeof this._options.onPolygonMesh&&(t.onMesh=this._options.onPolygonMesh),"function"==typeof this._options.onPolygonBufferAttributes&&(t.onBufferAttributes=this._options.onPolygonBufferAttributes),new x["default"](r,t)):"LineString"===n.type||"MultiLineString"===n.type?("function"==typeof this._options.lineMaterial&&(t.geometry=this._options.lineMaterial(e)),"function"==typeof this._options.onPolylineMesh&&(t.onMesh=this._options.onPolylineMesh),"function"==typeof this._options.onPolylineBufferAttributes&&(t.onBufferAttributes=this._options.onPolylineBufferAttributes),new M["default"](r,t)):"Point"===n.type||"MultiPoint"===n.type?("function"==typeof this._options.pointGeometry&&(t.geometry=this._options.pointGeometry(e)),"function"==typeof this._options.pointMaterial&&(t.geometry=this._options.pointMaterial(e)),"function"==typeof this._options.onPointMesh&&(t.onMesh=this._options.onPointMesh),new O["default"](r,t)):void 0:void 0}},{key:"_abortRequest",value:function(){this._request&&this._request.abort()}},{key:"destroy",value:function(){this._abortRequest(),this._request=null,this._geojson=null,this._pickingMesh&&(this._pickingMesh=null),s(Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}}]),t}(l["default"]);t["default"]=k;var P=function(e,t){return new k(e,t)};t.geoJSONLayer=P},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n-1&&this._layers.splice(t,1),this._world.removeLayer(e)}},{key:"_onAdd",value:function(e){}},{key:"destroy",value:function(){for(var e=0;e0;)self._completeHandlers.shift()(e)}function success(resp){var type=o.type||resp&&setType(resp.getResponseHeader("Content-Type"));resp="jsonp"!==type?self.request:resp;var filteredResponse=globalSetupOptions.dataFilter(resp.responseText,type),r=filteredResponse;try{resp.responseText=r}catch(e){}if(r)switch(type){case"json":try{resp=context.JSON?context.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML&&resp.responseXML.parseError&&resp.responseXML.parseError.errorCode&&resp.responseXML.parseError.reason?null:resp.responseXML}for(self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp),self._successHandler(resp);self._fulfillmentHandlers.length>0;)resp=self._fulfillmentHandlers.shift()(resp);complete(resp)}function timedOut(){self._timedOut=!0,self.request.abort()}function error(e,t,n){for(e=self.request,self._responseArgs.resp=e,self._responseArgs.msg=t,self._responseArgs.t=n,self._erred=!0;self._errorHandlers.length>0;)self._errorHandlers.shift()(e,t,n);complete(e)}this.url="string"==typeof o?o:o.url,this.timeout=null,this._fulfilled=!1,this._successHandler=function(){},this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){timedOut()},o.timeout)),o.success&&(this._successHandler=function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest.call(this,success,error)}function reqwest(e,t){return new Reqwest(e,t)}function normalize(e){return e?e.replace(/\r?\n/g,"\r\n"):""}function serial(e,t){var n,r,i,o,a=e.name,s=e.tagName.toLowerCase(),u=function(e){e&&!e.disabled&&t(a,normalize(e.attributes.value&&e.attributes.value.specified?e.value:e.text))};if(!e.disabled&&a)switch(s){case"input":/reset|button|image|file/i.test(e.type)||(n=/checkbox/i.test(e.type),r=/radio/i.test(e.type),i=e.value,(!(n||r)||e.checked)&&t(a,normalize(n&&""===i?"on":i)));break;case"textarea":t(a,normalize(e.value));break;case"select":if("select-one"===e.type.toLowerCase())u(e.selectedIndex>=0?e.options[e.selectedIndex]:null);else for(o=0;e.length&&oa;a++)n.vertices.push(e[i][o][a]);i>0&&(r+=e[i-1].length,n.holes.push(r))}return n},l=function(e,t,n){var r=(0,h["default"])(e,t,n),o=[];for(i=0,il=r.length;in;){var i=n+r>>>1;e[i]e?~e:e],o=0,a=r.length;a>o;++o)t.push(n=r[o].slice()),c(n,o);0>e&&i(t,a)}function o(e){return e=e.slice(),c(e,0),e}function a(e){for(var t=[],n=0,i=e.length;i>n;++n)r(e[n],t);return t.length<2&&t.push(t[0].slice()),t}function s(e){for(var t=a(e);t.length<4;)t.push(t[0].slice());return t}function u(e){return e.map(s)}function l(e){var t=e.type;return"GeometryCollection"===t?{type:t,geometries:e.geometries.map(l)}:t in h?{type:t,coordinates:h[t](e)}:null}var c=n(e.transform),f=e.arcs,h={Point:function(e){return o(e.coordinates)},MultiPoint:function(e){return e.coordinates.map(o)},LineString:function(e){return a(e.arcs)},MultiLineString:function(e){return e.arcs.map(a)},Polygon:function(e){return u(e.arcs)},MultiPolygon:function(e){return e.arcs.map(u)}};return l(t)}function l(e,t){function n(t){var n,r=e.arcs[0>t?~t:t],i=r[0];return e.transform?(n=[0,0],r.forEach(function(e){n[0]+=e[0],n[1]+=e[1]})):n=r[r.length-1],0>t?[n,i]:[i,n]}function r(e,t){for(var n in e){var r=e[n];delete t[r.start],delete r.start,delete r.end,r.forEach(function(e){i[0>e?~e:e]=1}),s.push(r)}}var i={},o={},a={},s=[],u=-1;return t.forEach(function(n,r){var i,o=e.arcs[0>n?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(i=t[++u],t[u]=n,t[r]=i)}),t.forEach(function(e){var t,r,i=n(e),s=i[0],u=i[1];if(t=a[s])if(delete a[t.end],t.push(e),t.end=u,r=o[u]){delete o[r.start];var l=r===t?t:t.concat(r);o[l.start=t.start]=a[l.end=r.end]=l}else o[t.start]=a[t.end]=t;else if(t=o[u])if(delete o[t.start],t.unshift(e),t.start=s,r=a[s]){delete a[r.end];var c=r===t?t:r.concat(t);o[c.start=r.start]=a[c.end=t.end]=c}else o[t.start]=a[t.end]=t;else t=[e],o[t.start=s]=a[t.end=u]=t}),r(a,o),r(o,a),t.forEach(function(e){i[0>e?~e:e]||s.push([e])}),s}function c(e){return u(e,f.apply(this,arguments))}function f(e,t,n){function r(e){var t=0>e?~e:e;(c[t]||(c[t]=[])).push({i:e,g:u})}function i(e){e.forEach(r)}function o(e){e.forEach(i)}function a(e){"GeometryCollection"===e.type?e.geometries.forEach(a):e.type in f&&(u=e,f[e.type](e.arcs))}var s=[];if(arguments.length>1){var u,c=[],f={LineString:i,MultiLineString:o,Polygon:o,MultiPolygon:function(e){e.forEach(o)}};a(t),c.forEach(arguments.length<3?function(e){s.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&s.push(e[0].i)})}else for(var h=0,d=e.arcs.length;d>h;++h)s.push(h);return{type:"MultiLineString",arcs:l(e,s)}}function h(e){var t=e[0],n=e[1],r=e[2];return Math.abs((t[0]-r[0])*(n[1]-t[1])-(t[0]-n[0])*(r[1]-t[1]))}function d(e){for(var t,n=-1,r=e.length,i=e[r-1],o=0;++nt?~t:t]||(i[t]=[])).push(e)})}),o.push(e)}function r(t){return d(u(e,{type:"Polygon",arcs:[t]}).coordinates[0])>0}var i={},o=[],a=[];return t.forEach(function(e){"Polygon"===e.type?n(e.arcs):"MultiPolygon"===e.type&&e.arcs.forEach(n)}),o.forEach(function(e){if(!e._){var t=[],n=[e];for(e._=1,a.push(t);e=n.pop();)t.push(e),e.forEach(function(e){e.forEach(function(e){i[0>e?~e:e].forEach(function(e){e._||(e._=1,n.push(e))})})})}}),o.forEach(function(e){delete e._}),{type:"MultiPolygon",arcs:a.map(function(t){var n,o=[];if(t.forEach(function(e){e.forEach(function(e){e.forEach(function(e){i[0>e?~e:e].length<2&&o.push(e)})})}),o=l(e,o),(n=o.length)>1)for(var a,s=r(t[0][0]),u=0;n>u;++u)if(s===r(o[u])){a=o[0],o[0]=o[u],o[u]=a;break}return o})}}function y(e){function t(e,t){e.forEach(function(e){0>e&&(e=~e);var n=i[e];n?n.push(t):i[e]=[t]})}function n(e,n){e.forEach(function(e){t(e,n)})}function r(e,t){"GeometryCollection"===e.type?e.geometries.forEach(function(e){r(e,t)}):e.type in s&&s[e.type](e.arcs,t)}var i={},a=e.map(function(){return[]}),s={LineString:t,MultiLineString:n,Polygon:n,MultiPolygon:function(e,t){e.forEach(function(e){n(e,t)})}};e.forEach(r);for(var u in i)for(var l=i[u],c=l.length,f=0;c>f;++f)for(var h=f+1;c>h;++h){var d,p=l[f],v=l[h];(d=a[p])[u=o(d,v)]!==v&&d.splice(u,0,v),(d=a[v])[u=o(d,p)]!==p&&d.splice(u,0,p)}return a}function m(e,t){return e[1][2]-t[1][2]}function _(){function e(e,t){for(;t>0;){var n=(t+1>>1)-1,i=r[n];if(m(e,i)>=0)break;r[i._=t]=i,r[e._=t=n]=e}}function t(e,t){for(;;){var n=t+1<<1,o=n-1,a=t,s=r[a];if(i>o&&m(r[o],s)<0&&(s=r[a=o]),i>n&&m(r[n],s)<0&&(s=r[a=n]),a===t)break;r[s._=t]=s,r[e._=t=a]=e}}var n={},r=[],i=0;return n.push=function(t){return e(r[t._=i]=t,i++),i},n.pop=function(){if(!(0>=i)){var e,n=r[0];return--i>0&&(e=r[i],t(r[e._=0]=e,0)),n}},n.remove=function(n){var o,a=n._;if(r[a]===n)return a!==--i&&(o=r[i],(m(o,n)<0?e:t)(r[o._=a]=o,a)),a},n}function g(e,t){function i(e){s.remove(e),e[1][2]=t(e),s.push(e)}var o=n(e.transform),a=r(e.transform),s=_();return t||(t=h),e.arcs.forEach(function(e){var n,r,u,l,c=[],f=0;for(r=0,u=e.length;u>r;++r)l=e[r],o(e[r]=[l[0],l[1],1/0],r);for(r=1,u=e.length-1;u>r;++r)n=e.slice(r-1,r+2),n[1][2]=t(n),c.push(n),s.push(n);for(r=0,u=c.length;u>r;++r)n=c[r],n.previous=c[r-1],n.next=c[r+1];for(;n=s.pop();){var h=n.previous,d=n.next;n[1][2]80*n){l=h=e[0],f=d=e[1];for(var m=n;a>m;m+=n)p=e[m],v=e[m+1],l>p&&(l=p),f>v&&(f=v),p>h&&(h=p),v>d&&(d=v);y=Math.max(h-l,d-f)}return o(s,u,n,l,f,y),u}function r(e,t,n,r,i){var o,a,s,u=0;for(o=t,a=n-r;n>o;o+=r)u+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;if(i===u>0)for(o=t;n>o;o+=r)s=P(o,e[o],e[o+1],s);else for(o=n-r;o>=t;o-=r)s=P(o,e[o],e[o+1],s);return s}function i(e,t){if(!e)return e;t||(t=e);var n,r=e;do if(n=!1,r.steiner||!x(r,r.next)&&0!==b(r.prev,r,r.next))r=r.next;else{if(T(r),r=t=r.prev,r===r.next)return null;n=!0}while(n||r!==t);return t}function o(e,t,n,r,c,f,h){if(e){!h&&f&&p(e,r,c,f);for(var d,v,y=e;e.prev!==e.next;)if(d=e.prev,v=e.next,f?s(e,r,c,f):a(e))t.push(d.i/n),t.push(e.i/n),t.push(v.i/n),T(e),e=v.next,y=v.next;else if(e=v,e===y){h?1===h?(e=u(e,t,n),o(e,t,n,r,c,f,2)):2===h&&l(e,t,n,r,c,f):o(i(e),t,n,r,c,f,1);break}}}function a(e){var t=e.prev,n=e,r=e.next;if(b(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(_(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&b(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function s(e,t,n,r){var i=e.prev,o=e,a=e.next;if(b(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,c=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,f=y(s,u,t,n,r),h=y(l,c,t,n,r),d=e.nextZ;d&&d.z<=h;){if(d!==e.prev&&d!==e.next&&_(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&b(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=e.prevZ;d&&d.z>=f;){if(d!==e.prev&&d!==e.next&&_(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&b(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function u(e,t,n){var r=e;do{var i=r.prev,o=r.next.next;w(i,r,r.next,o)&&E(i,o)&&E(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),T(r),T(r.next),r=e=o),r=r.next}while(r!==e);return r}function l(e,t,n,r,a,s){var u=e;do{for(var l=u.next.next;l!==u.prev;){if(u.i!==l.i&&g(u,l)){var c=k(u,l);return u=i(u,u.next),c=i(c,c.next),o(u,t,n,r,a,s),void o(c,t,n,r,a,s)}l=l.next}u=u.next}while(u!==e)}function c(e,t,n,o){var a,s,u,l,c,d=[];for(a=0,s=t.length;s>a;a++)u=t[a]*o,l=s-1>a?t[a+1]*o:e.length,c=r(e,u,l,o,!1),c===c.next&&(c.steiner=!0),d.push(m(c));for(d.sort(f),a=0;a=r.next.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);i>=s&&s>a&&(a=s,n=r.x=r.x&&r.x>=n.x&&_(ou||u===c&&r.x>n.x)&&E(r,e)&&(n=r,c=u)),r=r.next;return n}function p(e,t,n,r){var i=e;do null===i.z&&(i.z=y(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,v(i)}function v(e){var t,n,r,i,o,a,s,u,l=1;do{for(n=e,e=null,o=null,a=0;n;){for(a++,r=n,s=0,t=0;l>t&&(s++,r=r.nextZ,r);t++);for(u=l;s>0||u>0&&r;)0===s?(i=r,r=r.nextZ,u--):0!==u&&r?n.z<=r.z?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,u--):(i=n,n=n.nextZ,s--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,l*=2}while(a>1);return e}function y(e,t,n,r,i){return e=32767*(e-n)/i,t=32767*(t-r)/i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function m(e){var t=e,n=e;do t.x=0&&(e-a)*(r-s)-(n-a)*(t-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function g(e,t){return x(e,t)||e.next.i!==t.i&&e.prev.i!==t.i&&!M(e,t)&&E(e,t)&&E(t,e)&&O(e,t)}function b(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function x(e,t){return e.x===t.x&&e.y===t.y}function w(e,t,n,r){return b(e,t,n)>0!=b(e,t,r)>0&&b(n,r,e)>0!=b(n,r,t)>0}function M(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&w(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function E(e,t){return b(e.prev,e,e.next)<0?b(e,t,e.next)>=0&&b(e,e.prev,t)>=0:b(e,t,e.prev)<0||b(e,e.next,t)<0}function O(e,t){var n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do n.y>o!=n.next.y>o&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function k(e,t){var n=new j(e.i,e.x,e.y),r=new j(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function P(e,t,n,r){var i=new j(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function T(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function j(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}e.exports=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=function(e,t,n){function r(){a=e.map(function(e){return[e[0],h.top,e[1]]}),s=t,u=t}function i(){a=[],e.forEach(function(e){a.push([e[0],h.top,e[1]])}),e.forEach(function(e){a.push([e[0],h.bottom,e[1]])}),s=[];for(var n=0;d>n;n++)n===d-1?(s.push([n+d,d,n]),s.push([0,n,d])):(s.push([n+d,n+d+1,n]),s.push([n+1,n,n+d+1]));if(c=[].concat(s),h.closed){var r=t,i=r.map(function(e){return e.map(function(e){return e+d})});i=i.map(function(e){return[e[0],e[2],e[1]]}),s=s.concat(r).concat(i),u=r,l=i}}var a,s,u,l,c,f={top:1,bottom:0,closed:!0},h=(0,o["default"])({},f,n),d=e.length;return h.top===h.bottom?r():i(),{positions:a,faces:s,top:u,bottom:l,sides:c}};t["default"]=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=function(){var e=function(e){var t={};e.forEach(function(e){for(var n in e)t[n]||(t[n]=0),t[n]+=e[n].length});var n={};for(var r in t)n[r]=new Float32Array(t[r]);var i={};return e.forEach(function(e){for(var t in e)i[t]||(i[t]=0),n[t].set(e[t],i[t]),i[t]+=e[t].length}),n},t=function(e,t){var n,r=new o["default"].BufferGeometry,i=new Float32Array(3*e.verticesCount),a=new Float32Array(3*e.verticesCount);e.pickingIds&&(n=new Float32Array(e.verticesCount));for(var s,u,l,c=0,f=0;f0&&(r+=e[i-1].length,n.holes.push(r))}return n}},{key:"_triangulate",value:function(e,t,n){var r=(0,_["default"])(e,t,n),o=[];for(i=0,il=r.length;i0;i--){var o=1<0){var c=m["default"].mergeAttributes(a);this._setPolygonMesh(c,s),this.add(this._polygonMesh)}if(u.length>0){var h=m["default"].mergeAttributes(u);this._setPolylineMesh(h),this.add(this._polylineMesh)}if(l.length>0){var d=m["default"].mergeAttributes(l);this._setPointMesh(d),this.add(this._pointMesh)}this._layers.forEach(function(e){e.clearBufferAttributes(),e.clearCoordinates()})}}},{key:"_setPolygonMesh",value:function(e,t){var n=new THREE.BufferGeometry;n.addAttribute("position",new THREE.BufferAttribute(e.vertices,3)),n.addAttribute("normal",new THREE.BufferAttribute(e.normals,3)),n.addAttribute("color",new THREE.BufferAttribute(e.colours,3)),e.pickingIds&&n.addAttribute("pickingId",new THREE.BufferAttribute(e.pickingIds,1)),n.computeBoundingBox();var r="function"==typeof this._options.style?this._options.style(this._geojson.features[0]):this._options.style;r=(0,f["default"])({},v["default"].defaultStyle,r);var i;this._options.polygonMaterial&&this._options.polygonMaterial instanceof THREE.Material?i=this._options.polygonMaterial:this._world._environment._skybox?(i=new THREE.MeshStandardMaterial({vertexColors:THREE.VertexColors,side:THREE.BackSide,transparent:r.transparent,opacity:r.opacity,blending:r.blending}),i.roughness=1,i.metalness=.1,i.envMapIntensity=3,i.envMap=this._world._environment._skybox.getRenderTarget()):i=new THREE.MeshPhongMaterial({vertexColors:THREE.VertexColors,side:THREE.BackSide,transparent:r.transparent,opacity:r.opacity,blending:r.blending});var o;if("function"==typeof this._options.onPolygonMesh?o=this._options.onPolygonMesh(n,i):(o=new THREE.Mesh(n,i),o.castShadow=!0,o.receiveShadow=!0),t&&(i.depthWrite=!1,o.renderOrder=1),this._options.interactive&&this._pickingMesh){i=new g["default"],i.side=THREE.BackSide;var a=new THREE.Mesh(n,i);this._pickingMesh.add(a)}this._polygonMesh=o}},{key:"_setPolylineMesh",value:function(e){var t=new THREE.BufferGeometry;t.addAttribute("position",new THREE.BufferAttribute(e.vertices,3)),e.normals&&t.addAttribute("normal",new THREE.BufferAttribute(e.normals,3)),t.addAttribute("color",new THREE.BufferAttribute(e.colours,3)),e.pickingIds&&t.addAttribute("pickingId",new THREE.BufferAttribute(e.pickingIds,1)),t.computeBoundingBox();var n="function"==typeof this._options.style?this._options.style(this._geojson.features[0]):this._options.style;n=(0,f["default"])({},v["default"].defaultStyle,n);var r;r=this._options.polylineMaterial&&this._options.polylineMaterial instanceof THREE.Material?this._options.polylineMaterial:new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors,linewidth:n.lineWidth,transparent:n.lineTransparent,opacity:n.lineOpacity,blending:n.lineBlending});var i;if("function"==typeof this._options.onPolylineMesh?i=this._options.onPolylineMesh(t,r):(i=new THREE.LineSegments(t,r),void 0!==n.lineRenderOrder&&(r.depthWrite=!1,i.renderOrder=n.lineRenderOrder),i.castShadow=!0),this._options.interactive&&this._pickingMesh){r=new g["default"],r.linewidth=n.lineWidth+r.linePadding;var o=new THREE.LineSegments(t,r);this._pickingMesh.add(o)}this._polylineMesh=i}},{key:"_setPointMesh",value:function(e){var t=new THREE.BufferGeometry;t.addAttribute("position",new THREE.BufferAttribute(e.vertices,3)),t.addAttribute("normal",new THREE.BufferAttribute(e.normals,3)),t.addAttribute("color",new THREE.BufferAttribute(e.colours,3)),e.pickingIds&&t.addAttribute("pickingId",new THREE.BufferAttribute(e.pickingIds,1)),t.computeBoundingBox();var n;this._options.pointMaterial&&this._options.pointMaterial instanceof THREE.Material?n=this._options.pointMaterial:this._world._environment._skybox?(n=new THREE.MeshStandardMaterial({vertexColors:THREE.VertexColors}),n.roughness=1,n.metalness=.1,n.envMapIntensity=3,n.envMap=this._world._environment._skybox.getRenderTarget()):n=new THREE.MeshPhongMaterial({vertexColors:THREE.VertexColors});var r;if("function"==typeof this._options.onPointMesh?r=this._options.onPointMesh(t,n):(r=new THREE.Mesh(t,n),r.castShadow=!0),this._options.interactive&&this._pickingMesh){n=new g["default"];var i=new THREE.Mesh(t,n);this._pickingMesh.add(i)}this._pointMesh=r}},{key:"_featureToLayer",value:function(e,t){var n=e.geometry,r=n.coordinates?n.coordinates:null;return r&&n?"Polygon"===n.type||"MultiPolygon"===n.type?("function"==typeof this._options.polygonMaterial&&(t.geometry=this._options.polygonMaterial(e)),"function"==typeof this._options.onPolygonMesh&&(t.onMesh=this._options.onPolygonMesh),"function"==typeof this._options.onPolygonBufferAttributes&&(t.onBufferAttributes=this._options.onPolygonBufferAttributes),new x["default"](r,t)):"LineString"===n.type||"MultiLineString"===n.type?("function"==typeof this._options.lineMaterial&&(t.geometry=this._options.lineMaterial(e)),"function"==typeof this._options.onPolylineMesh&&(t.onMesh=this._options.onPolylineMesh),"function"==typeof this._options.onPolylineBufferAttributes&&(t.onBufferAttributes=this._options.onPolylineBufferAttributes),new M["default"](r,t)):"Point"===n.type||"MultiPoint"===n.type?("function"==typeof this._options.pointGeometry&&(t.geometry=this._options.pointGeometry(e)),"function"==typeof this._options.pointMaterial&&(t.geometry=this._options.pointMaterial(e)),"function"==typeof this._options.onPointMesh&&(t.onMesh=this._options.onPointMesh),new O["default"](r,t)):void 0:void 0}},{key:"_abortRequest",value:function(){this._request&&this._request.abort()}},{key:"destroy",value:function(){this._abortRequest(),this._request=null,this._geojson=null,this._pickingMesh&&(this._pickingMesh=null),this._polygonMesh&&(this._polygonMesh=null),this._polylineMesh&&(this._polylineMesh=null),this._pointMesh&&(this._pointMesh=null),s(Object.getPrototypeOf(t.prototype),"destroy",this).call(this)}}]),t}(l["default"]);t["default"]=k;var P=function(e,t){return new k(e,t)};t.geoJSONLayer=P},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n-1&&this._layers.splice(t,1),this._world.removeLayer(e)}},{key:"_onAdd",value:function(e){}},{key:"destroy",value:function(){if(this._layers){for(var e=0;e0;)self._completeHandlers.shift()(e)}function success(resp){var type=o.type||resp&&setType(resp.getResponseHeader("Content-Type"));resp="jsonp"!==type?self.request:resp;var filteredResponse=globalSetupOptions.dataFilter(resp.responseText,type),r=filteredResponse;try{resp.responseText=r}catch(e){}if(r)switch(type){case"json":try{resp=context.JSON?context.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML&&resp.responseXML.parseError&&resp.responseXML.parseError.errorCode&&resp.responseXML.parseError.reason?null:resp.responseXML}for(self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp),self._successHandler(resp);self._fulfillmentHandlers.length>0;)resp=self._fulfillmentHandlers.shift()(resp);complete(resp)}function timedOut(){self._timedOut=!0,self.request.abort()}function error(e,t,n){for(e=self.request,self._responseArgs.resp=e,self._responseArgs.msg=t,self._responseArgs.t=n,self._erred=!0;self._errorHandlers.length>0;)self._errorHandlers.shift()(e,t,n);complete(e)}this.url="string"==typeof o?o:o.url,this.timeout=null,this._fulfilled=!1,this._successHandler=function(){},this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this;fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){timedOut()},o.timeout)),o.success&&(this._successHandler=function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest.call(this,success,error)}function reqwest(e,t){return new Reqwest(e,t)}function normalize(e){return e?e.replace(/\r?\n/g,"\r\n"):""}function serial(e,t){var n,r,i,o,a=e.name,s=e.tagName.toLowerCase(),u=function(e){e&&!e.disabled&&t(a,normalize(e.attributes.value&&e.attributes.value.specified?e.value:e.text))};if(!e.disabled&&a)switch(s){case"input":/reset|button|image|file/i.test(e.type)||(n=/checkbox/i.test(e.type),r=/radio/i.test(e.type),i=e.value,(!(n||r)||e.checked)&&t(a,normalize(n&&""===i?"on":i)));break;case"textarea":t(a,normalize(e.value));break;case"select":if("select-one"===e.type.toLowerCase())u(e.selectedIndex>=0?e.options[e.selectedIndex]:null);else for(o=0;e.length&&oa;a++)n.vertices.push(e[i][o][a]);i>0&&(r+=e[i-1].length,n.holes.push(r))}return n},l=function(e,t,n){var r=(0,h["default"])(e,t,n),o=[];for(i=0,il=r.length;in;){var i=n+r>>>1;e[i]e?~e:e],o=0,a=r.length;a>o;++o)t.push(n=r[o].slice()),c(n,o);0>e&&i(t,a)}function o(e){return e=e.slice(),c(e,0),e}function a(e){for(var t=[],n=0,i=e.length;i>n;++n)r(e[n],t);return t.length<2&&t.push(t[0].slice()),t}function s(e){for(var t=a(e);t.length<4;)t.push(t[0].slice());return t}function u(e){return e.map(s)}function l(e){var t=e.type;return"GeometryCollection"===t?{type:t,geometries:e.geometries.map(l)}:t in h?{type:t,coordinates:h[t](e)}:null}var c=n(e.transform),f=e.arcs,h={Point:function(e){return o(e.coordinates)},MultiPoint:function(e){return e.coordinates.map(o)},LineString:function(e){return a(e.arcs)},MultiLineString:function(e){return e.arcs.map(a)},Polygon:function(e){return u(e.arcs)},MultiPolygon:function(e){return e.arcs.map(u)}};return l(t)}function l(e,t){function n(t){var n,r=e.arcs[0>t?~t:t],i=r[0];return e.transform?(n=[0,0],r.forEach(function(e){n[0]+=e[0],n[1]+=e[1]})):n=r[r.length-1],0>t?[n,i]:[i,n]}function r(e,t){for(var n in e){var r=e[n];delete t[r.start],delete r.start,delete r.end,r.forEach(function(e){i[0>e?~e:e]=1}),s.push(r)}}var i={},o={},a={},s=[],u=-1;return t.forEach(function(n,r){var i,o=e.arcs[0>n?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(i=t[++u],t[u]=n,t[r]=i)}),t.forEach(function(e){var t,r,i=n(e),s=i[0],u=i[1];if(t=a[s])if(delete a[t.end],t.push(e),t.end=u,r=o[u]){delete o[r.start];var l=r===t?t:t.concat(r);o[l.start=t.start]=a[l.end=r.end]=l}else o[t.start]=a[t.end]=t;else if(t=o[u])if(delete o[t.start],t.unshift(e),t.start=s,r=a[s]){delete a[r.end];var c=r===t?t:r.concat(t);o[c.start=r.start]=a[c.end=t.end]=c}else o[t.start]=a[t.end]=t;else t=[e],o[t.start=s]=a[t.end=u]=t}),r(a,o),r(o,a),t.forEach(function(e){i[0>e?~e:e]||s.push([e])}),s}function c(e){return u(e,f.apply(this,arguments))}function f(e,t,n){function r(e){var t=0>e?~e:e;(c[t]||(c[t]=[])).push({i:e,g:u})}function i(e){e.forEach(r)}function o(e){e.forEach(i)}function a(e){"GeometryCollection"===e.type?e.geometries.forEach(a):e.type in f&&(u=e,f[e.type](e.arcs))}var s=[];if(arguments.length>1){var u,c=[],f={LineString:i,MultiLineString:o,Polygon:o,MultiPolygon:function(e){e.forEach(o)}};a(t),c.forEach(arguments.length<3?function(e){s.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&s.push(e[0].i)})}else for(var h=0,d=e.arcs.length;d>h;++h)s.push(h);return{type:"MultiLineString",arcs:l(e,s)}}function h(e){var t=e[0],n=e[1],r=e[2];return Math.abs((t[0]-r[0])*(n[1]-t[1])-(t[0]-n[0])*(r[1]-t[1]))}function d(e){for(var t,n=-1,r=e.length,i=e[r-1],o=0;++nt?~t:t]||(i[t]=[])).push(e)})}),o.push(e)}function r(t){return d(u(e,{type:"Polygon",arcs:[t]}).coordinates[0])>0}var i={},o=[],a=[];return t.forEach(function(e){"Polygon"===e.type?n(e.arcs):"MultiPolygon"===e.type&&e.arcs.forEach(n)}),o.forEach(function(e){if(!e._){var t=[],n=[e];for(e._=1,a.push(t);e=n.pop();)t.push(e),e.forEach(function(e){e.forEach(function(e){i[0>e?~e:e].forEach(function(e){e._||(e._=1,n.push(e))})})})}}),o.forEach(function(e){delete e._}),{type:"MultiPolygon",arcs:a.map(function(t){var n,o=[];if(t.forEach(function(e){e.forEach(function(e){e.forEach(function(e){i[0>e?~e:e].length<2&&o.push(e)})})}),o=l(e,o),(n=o.length)>1)for(var a,s=r(t[0][0]),u=0;n>u;++u)if(s===r(o[u])){a=o[0],o[0]=o[u],o[u]=a;break}return o})}}function y(e){function t(e,t){e.forEach(function(e){0>e&&(e=~e);var n=i[e];n?n.push(t):i[e]=[t]})}function n(e,n){e.forEach(function(e){t(e,n)})}function r(e,t){"GeometryCollection"===e.type?e.geometries.forEach(function(e){r(e,t)}):e.type in s&&s[e.type](e.arcs,t)}var i={},a=e.map(function(){return[]}),s={LineString:t,MultiLineString:n,Polygon:n,MultiPolygon:function(e,t){e.forEach(function(e){n(e,t)})}};e.forEach(r);for(var u in i)for(var l=i[u],c=l.length,f=0;c>f;++f)for(var h=f+1;c>h;++h){var d,p=l[f],v=l[h];(d=a[p])[u=o(d,v)]!==v&&d.splice(u,0,v),(d=a[v])[u=o(d,p)]!==p&&d.splice(u,0,p)}return a}function m(e,t){return e[1][2]-t[1][2]}function _(){function e(e,t){for(;t>0;){var n=(t+1>>1)-1,i=r[n];if(m(e,i)>=0)break;r[i._=t]=i,r[e._=t=n]=e}}function t(e,t){for(;;){var n=t+1<<1,o=n-1,a=t,s=r[a];if(i>o&&m(r[o],s)<0&&(s=r[a=o]),i>n&&m(r[n],s)<0&&(s=r[a=n]),a===t)break;r[s._=t]=s,r[e._=t=a]=e}}var n={},r=[],i=0;return n.push=function(t){return e(r[t._=i]=t,i++),i},n.pop=function(){if(!(0>=i)){var e,n=r[0];return--i>0&&(e=r[i],t(r[e._=0]=e,0)),n}},n.remove=function(n){var o,a=n._;if(r[a]===n)return a!==--i&&(o=r[i],(m(o,n)<0?e:t)(r[o._=a]=o,a)),a},n}function g(e,t){function i(e){s.remove(e),e[1][2]=t(e),s.push(e)}var o=n(e.transform),a=r(e.transform),s=_();return t||(t=h),e.arcs.forEach(function(e){var n,r,u,l,c=[],f=0;for(r=0,u=e.length;u>r;++r)l=e[r],o(e[r]=[l[0],l[1],1/0],r);for(r=1,u=e.length-1;u>r;++r)n=e.slice(r-1,r+2),n[1][2]=t(n),c.push(n),s.push(n);for(r=0,u=c.length;u>r;++r)n=c[r],n.previous=c[r-1],n.next=c[r+1];for(;n=s.pop();){var h=n.previous,d=n.next;n[1][2]80*n){l=h=e[0],f=d=e[1];for(var m=n;a>m;m+=n)p=e[m],v=e[m+1],l>p&&(l=p),f>v&&(f=v),p>h&&(h=p),v>d&&(d=v);y=Math.max(h-l,d-f)}return o(s,u,n,l,f,y),u}function r(e,t,n,r,i){var o,a,s,u=0;for(o=t,a=n-r;n>o;o+=r)u+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;if(i===u>0)for(o=t;n>o;o+=r)s=P(o,e[o],e[o+1],s);else for(o=n-r;o>=t;o-=r)s=P(o,e[o],e[o+1],s);return s}function i(e,t){if(!e)return e;t||(t=e);var n,r=e;do if(n=!1,r.steiner||!x(r,r.next)&&0!==b(r.prev,r,r.next))r=r.next;else{if(T(r),r=t=r.prev,r===r.next)return null;n=!0}while(n||r!==t);return t}function o(e,t,n,r,c,f,h){if(e){!h&&f&&p(e,r,c,f);for(var d,v,y=e;e.prev!==e.next;)if(d=e.prev,v=e.next,f?s(e,r,c,f):a(e))t.push(d.i/n),t.push(e.i/n),t.push(v.i/n),T(e),e=v.next,y=v.next;else if(e=v,e===y){h?1===h?(e=u(e,t,n),o(e,t,n,r,c,f,2)):2===h&&l(e,t,n,r,c,f):o(i(e),t,n,r,c,f,1);break}}}function a(e){var t=e.prev,n=e,r=e.next;if(b(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(_(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&b(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function s(e,t,n,r){var i=e.prev,o=e,a=e.next;if(b(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,c=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,f=y(s,u,t,n,r),h=y(l,c,t,n,r),d=e.nextZ;d&&d.z<=h;){if(d!==e.prev&&d!==e.next&&_(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&b(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=e.prevZ;d&&d.z>=f;){if(d!==e.prev&&d!==e.next&&_(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&b(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function u(e,t,n){var r=e;do{var i=r.prev,o=r.next.next;w(i,r,r.next,o)&&E(i,o)&&E(o,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(o.i/n),T(r),T(r.next),r=e=o),r=r.next}while(r!==e);return r}function l(e,t,n,r,a,s){var u=e;do{for(var l=u.next.next;l!==u.prev;){if(u.i!==l.i&&g(u,l)){var c=k(u,l);return u=i(u,u.next),c=i(c,c.next),o(u,t,n,r,a,s),void o(c,t,n,r,a,s)}l=l.next}u=u.next}while(u!==e)}function c(e,t,n,o){var a,s,u,l,c,d=[];for(a=0,s=t.length;s>a;a++)u=t[a]*o,l=s-1>a?t[a+1]*o:e.length,c=r(e,u,l,o,!1),c===c.next&&(c.steiner=!0),d.push(m(c));for(d.sort(f),a=0;a=r.next.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);i>=s&&s>a&&(a=s,n=r.x=r.x&&r.x>=n.x&&_(ou||u===c&&r.x>n.x)&&E(r,e)&&(n=r,c=u)),r=r.next;return n}function p(e,t,n,r){var i=e;do null===i.z&&(i.z=y(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,v(i)}function v(e){var t,n,r,i,o,a,s,u,l=1;do{for(n=e,e=null,o=null,a=0;n;){for(a++,r=n,s=0,t=0;l>t&&(s++,r=r.nextZ,r);t++);for(u=l;s>0||u>0&&r;)0===s?(i=r,r=r.nextZ,u--):0!==u&&r?n.z<=r.z?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,u--):(i=n,n=n.nextZ,s--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;n=r}o.nextZ=null,l*=2}while(a>1);return e}function y(e,t,n,r,i){return e=32767*(e-n)/i,t=32767*(t-r)/i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1}function m(e){var t=e,n=e;do t.x=0&&(e-a)*(r-s)-(n-a)*(t-s)>=0&&(n-a)*(o-s)-(i-a)*(r-s)>=0}function g(e,t){return x(e,t)||e.next.i!==t.i&&e.prev.i!==t.i&&!M(e,t)&&E(e,t)&&E(t,e)&&O(e,t)}function b(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function x(e,t){return e.x===t.x&&e.y===t.y}function w(e,t,n,r){return b(e,t,n)>0!=b(e,t,r)>0&&b(n,r,e)>0!=b(n,r,t)>0}function M(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&w(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function E(e,t){return b(e.prev,e,e.next)<0?b(e,t,e.next)>=0&&b(e,e.prev,t)>=0:b(e,t,e.prev)<0||b(e,e.next,t)<0}function O(e,t){var n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do n.y>o!=n.next.y>o&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function k(e,t){var n=new j(e.i,e.x,e.y),r=new j(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function P(e,t,n,r){var i=new j(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function T(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function j(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}e.exports=n},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=r(i),a=function(e,t,n){function r(){a=e.map(function(e){return[e[0],h.top,e[1]]}),s=t,u=t}function i(){a=[],e.forEach(function(e){a.push([e[0],h.top,e[1]])}),e.forEach(function(e){a.push([e[0],h.bottom,e[1]])}),s=[];for(var n=0;d>n;n++)n===d-1?(s.push([n+d,d,n]),s.push([0,n,d])):(s.push([n+d,n+d+1,n]),s.push([n+1,n,n+d+1]));if(c=[].concat(s),h.closed){var r=t,i=r.map(function(e){return e.map(function(e){return e+d})});i=i.map(function(e){return[e[0],e[2],e[1]]}),s=s.concat(r).concat(i),u=r,l=i}}var a,s,u,l,c,f={top:1,bottom:0,closed:!0},h=(0,o["default"])({},f,n),d=e.length;return h.top===h.bottom?r():i(),{positions:a,faces:s,top:u,bottom:l,sides:c}};t["default"]=a,e.exports=t["default"]},function(e,t,n){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),a=function(){var e=function(e){var t={};e.forEach(function(e){for(var n in e)t[n]||(t[n]=0),t[n]+=e[n].length});var n={};for(var r in t)n[r]=new Float32Array(t[r]);var i={};return e.forEach(function(e){for(var t in e)i[t]||(i[t]=0),n[t].set(e[t],i[t]),i[t]+=e[t].length}),n},t=function(e,t){var n,r=new o["default"].BufferGeometry,i=new Float32Array(3*e.verticesCount),a=new Float32Array(3*e.verticesCount);e.pickingIds&&(n=new Float32Array(e.verticesCount));for(var s,u,l,c=0,f=0;f0&&(r+=e[i-1].length,n.holes.push(r))}return n}},{key:"_triangulate",value:function(e,t,n){var r=(0,_["default"])(e,t,n),o=[];for(i=0,il=r.length;i {});\n\t // this._engine.on('postRender', () => {});\n\t }\n\t }, {\n\t key: '_initEnvironment',\n\t value: function _initEnvironment() {\n\t // Not sure if I want to keep this as a private API\n\t //\n\t // Makes sense to allow others to customise their environment so perhaps\n\t // add some method of disable / overriding the environment settings\n\t this._environment = new _layerEnvironmentEnvironmentLayer2['default']({\n\t skybox: this.options.skybox\n\t }).addTo(this);\n\t }\n\t }, {\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t this.on('controlsMoveEnd', this._onControlsMoveEnd);\n\t }\n\t }, {\n\t key: '_onControlsMoveEnd',\n\t value: function _onControlsMoveEnd(point) {\n\t var _point = (0, _geoPoint.point)(point.x, point.z);\n\t this._resetView(this.pointToLatLon(_point), _point);\n\t }\n\t\n\t // Reset world view\n\t }, {\n\t key: '_resetView',\n\t value: function _resetView(latlon, point) {\n\t this.emit('preResetView');\n\t\n\t this._moveStart();\n\t this._move(latlon, point);\n\t this._moveEnd();\n\t\n\t this.emit('postResetView');\n\t }\n\t }, {\n\t key: '_moveStart',\n\t value: function _moveStart() {\n\t this.emit('moveStart');\n\t }\n\t }, {\n\t key: '_move',\n\t value: function _move(latlon, point) {\n\t this._lastPosition = latlon;\n\t this.emit('move', latlon, point);\n\t }\n\t }, {\n\t key: '_moveEnd',\n\t value: function _moveEnd() {\n\t this.emit('moveEnd');\n\t }\n\t }, {\n\t key: '_update',\n\t value: function _update() {\n\t if (this._pause) {\n\t return;\n\t }\n\t\n\t var delta = this._engine.clock.getDelta();\n\t\n\t // Once _update is called it will run forever, for now\n\t window.requestAnimationFrame(this._update.bind(this));\n\t\n\t // Update controls\n\t this._controls.forEach(function (controls) {\n\t controls.update();\n\t });\n\t\n\t this.emit('preUpdate', delta);\n\t this._engine.update(delta);\n\t this.emit('postUpdate', delta);\n\t }\n\t\n\t // Set world view\n\t }, {\n\t key: 'setView',\n\t value: function setView(latlon) {\n\t // Store initial geographic coordinate for the [0,0,0] world position\n\t //\n\t // The origin point doesn't move in three.js / 3D space so only set it once\n\t // here instead of every time _resetView is called\n\t //\n\t // If it was updated every time then coorindates would shift over time and\n\t // would be out of place / context with previously-placed points (0,0 would\n\t // refer to a different point each time)\n\t this._originLatlon = latlon;\n\t this._originPoint = this.project(latlon);\n\t\n\t this._resetView(latlon);\n\t return this;\n\t }\n\t\n\t // Return world geographic position\n\t }, {\n\t key: 'getPosition',\n\t value: function getPosition() {\n\t return this._lastPosition;\n\t }\n\t\n\t // Transform geographic coordinate to world point\n\t //\n\t // This doesn't take into account the origin offset\n\t //\n\t // For example, this takes a geographic coordinate and returns a point\n\t // relative to the origin point of the projection (not the world)\n\t }, {\n\t key: 'project',\n\t value: function project(latlon) {\n\t return this.options.crs.latLonToPoint((0, _geoLatLon.latLon)(latlon));\n\t }\n\t\n\t // Transform world point to geographic coordinate\n\t //\n\t // This doesn't take into account the origin offset\n\t //\n\t // For example, this takes a point relative to the origin point of the\n\t // projection (not the world) and returns a geographic coordinate\n\t }, {\n\t key: 'unproject',\n\t value: function unproject(point) {\n\t return this.options.crs.pointToLatLon((0, _geoPoint.point)(point));\n\t }\n\t\n\t // Takes into account the origin offset\n\t //\n\t // For example, this takes a geographic coordinate and returns a point\n\t // relative to the three.js / 3D origin (0,0)\n\t }, {\n\t key: 'latLonToPoint',\n\t value: function latLonToPoint(latlon) {\n\t var projectedPoint = this.project((0, _geoLatLon.latLon)(latlon));\n\t return projectedPoint._subtract(this._originPoint);\n\t }\n\t\n\t // Takes into account the origin offset\n\t //\n\t // For example, this takes a point relative to the three.js / 3D origin (0,0)\n\t // and returns the exact geographic coordinate at that point\n\t }, {\n\t key: 'pointToLatLon',\n\t value: function pointToLatLon(point) {\n\t var projectedPoint = (0, _geoPoint.point)(point).add(this._originPoint);\n\t return this.unproject(projectedPoint);\n\t }\n\t\n\t // Return pointscale for a given geographic coordinate\n\t }, {\n\t key: 'pointScale',\n\t value: function pointScale(latlon, accurate) {\n\t return this.options.crs.pointScale(latlon, accurate);\n\t }\n\t\n\t // Convert from real meters to world units\n\t //\n\t // TODO: Would be nice not to have to pass in a pointscale here\n\t }, {\n\t key: 'metresToWorld',\n\t value: function metresToWorld(metres, pointScale, zoom) {\n\t return this.options.crs.metresToWorld(metres, pointScale, zoom);\n\t }\n\t\n\t // Convert from real meters to world units\n\t //\n\t // TODO: Would be nice not to have to pass in a pointscale here\n\t }, {\n\t key: 'worldToMetres',\n\t value: function worldToMetres(worldUnits, pointScale, zoom) {\n\t return this.options.crs.worldToMetres(worldUnits, pointScale, zoom);\n\t }\n\t\n\t // Unsure if it's a good idea to expose this here for components like\n\t // GridLayer to use (eg. to keep track of a frustum)\n\t }, {\n\t key: 'getCamera',\n\t value: function getCamera() {\n\t return this._engine._camera;\n\t }\n\t }, {\n\t key: 'addLayer',\n\t value: function addLayer(layer) {\n\t layer._addToWorld(this);\n\t\n\t this._layers.push(layer);\n\t\n\t if (layer.isOutput() && layer.isOutputToScene()) {\n\t // Could move this into Layer but it'll do here for now\n\t this._engine._scene.add(layer._object3D);\n\t this._engine._domScene3D.add(layer._domObject3D);\n\t this._engine._domScene2D.add(layer._domObject2D);\n\t }\n\t\n\t this.emit('layerAdded', layer);\n\t return this;\n\t }\n\t\n\t // Remove layer from world and scene but don't destroy it entirely\n\t }, {\n\t key: 'removeLayer',\n\t value: function removeLayer(layer) {\n\t var layerIndex = this._layers.indexOf(layer);\n\t\n\t if (layerIndex > -1) {\n\t // Remove from this._layers\n\t this._layers.splice(layerIndex, 1);\n\t };\n\t\n\t if (layer.isOutput() && layer.isOutputToScene()) {\n\t this._engine._scene.remove(layer._object3D);\n\t this._engine._domScene3D.remove(layer._domObject3D);\n\t this._engine._domScene2D.remove(layer._domObject2D);\n\t }\n\t\n\t this.emit('layerRemoved');\n\t return this;\n\t }\n\t }, {\n\t key: 'addControls',\n\t value: function addControls(controls) {\n\t controls._addToWorld(this);\n\t\n\t this._controls.push(controls);\n\t\n\t this.emit('controlsAdded', controls);\n\t return this;\n\t }\n\t\n\t // Remove controls from world but don't destroy them entirely\n\t }, {\n\t key: 'removeControls',\n\t value: function removeControls(controls) {\n\t var controlsIndex = this._controls.indexOf(controlsIndex);\n\t\n\t if (controlsIndex > -1) {\n\t this._controls.splice(controlsIndex, 1);\n\t };\n\t\n\t this.emit('controlsRemoved', controls);\n\t return this;\n\t }\n\t }, {\n\t key: 'stop',\n\t value: function stop() {\n\t this._pause = true;\n\t }\n\t }, {\n\t key: 'start',\n\t value: function start() {\n\t this._pause = false;\n\t this._update();\n\t }\n\t\n\t // Destroys the world(!) and removes it from the scene and memory\n\t //\n\t // TODO: World out why so much three.js stuff is left in the heap after this\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this.stop();\n\t\n\t // Remove listeners\n\t this.off('controlsMoveEnd', this._onControlsMoveEnd);\n\t\n\t var i;\n\t\n\t // Remove all controls\n\t var controls;\n\t for (i = this._controls.length - 1; i >= 0; i--) {\n\t controls = this._controls[0];\n\t this.removeControls(controls);\n\t controls.destroy();\n\t };\n\t\n\t // Remove all layers\n\t var layer;\n\t for (i = this._layers.length - 1; i >= 0; i--) {\n\t layer = this._layers[0];\n\t this.removeLayer(layer);\n\t layer.destroy();\n\t };\n\t\n\t // Environment layer is removed with the other layers\n\t this._environment = null;\n\t\n\t this._engine.destroy();\n\t this._engine = null;\n\t\n\t // TODO: Probably should clean the container too / remove the canvas\n\t this._container = null;\n\t }\n\t }]);\n\t\n\t return World;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = World;\n\t\n\tvar noNew = function noNew(domId, options) {\n\t return new World(domId, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.world = noNew;\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\t//\n\t// We store our EE objects in a plain object whose properties are event names.\n\t// If `Object.create(null)` is not supported we prefix the event names with a\n\t// `~` to make sure that the built-in object properties are not overridden or\n\t// used as an attack vector.\n\t// We also assume that `Object.create(null)` is available when the event name\n\t// is an ES6 Symbol.\n\t//\n\tvar prefix = typeof Object.create !== 'function' ? '~' : false;\n\t\n\t/**\n\t * Representation of a single EventEmitter function.\n\t *\n\t * @param {Function} fn Event handler to be called.\n\t * @param {Mixed} context Context for function execution.\n\t * @param {Boolean} once Only emit once\n\t * @api private\n\t */\n\tfunction EE(fn, context, once) {\n\t this.fn = fn;\n\t this.context = context;\n\t this.once = once || false;\n\t}\n\t\n\t/**\n\t * Minimal EventEmitter interface that is molded against the Node.js\n\t * EventEmitter interface.\n\t *\n\t * @constructor\n\t * @api public\n\t */\n\tfunction EventEmitter() { /* Nothing to set */ }\n\t\n\t/**\n\t * Holds the assigned EventEmitters by name.\n\t *\n\t * @type {Object}\n\t * @private\n\t */\n\tEventEmitter.prototype._events = undefined;\n\t\n\t/**\n\t * Return a list of assigned event listeners.\n\t *\n\t * @param {String} event The events that should be listed.\n\t * @param {Boolean} exists We only need to know if there are listeners.\n\t * @returns {Array|Boolean}\n\t * @api public\n\t */\n\tEventEmitter.prototype.listeners = function listeners(event, exists) {\n\t var evt = prefix ? prefix + event : event\n\t , available = this._events && this._events[evt];\n\t\n\t if (exists) return !!available;\n\t if (!available) return [];\n\t if (available.fn) return [available.fn];\n\t\n\t for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n\t ee[i] = available[i].fn;\n\t }\n\t\n\t return ee;\n\t};\n\t\n\t/**\n\t * Emit an event to all registered event listeners.\n\t *\n\t * @param {String} event The name of the event.\n\t * @returns {Boolean} Indication if we've emitted an event.\n\t * @api public\n\t */\n\tEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n\t var evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events || !this._events[evt]) return false;\n\t\n\t var listeners = this._events[evt]\n\t , len = arguments.length\n\t , args\n\t , i;\n\t\n\t if ('function' === typeof listeners.fn) {\n\t if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\t\n\t switch (len) {\n\t case 1: return listeners.fn.call(listeners.context), true;\n\t case 2: return listeners.fn.call(listeners.context, a1), true;\n\t case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n\t case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n\t case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n\t case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n\t }\n\t\n\t for (i = 1, args = new Array(len -1); i < len; i++) {\n\t args[i - 1] = arguments[i];\n\t }\n\t\n\t listeners.fn.apply(listeners.context, args);\n\t } else {\n\t var length = listeners.length\n\t , j;\n\t\n\t for (i = 0; i < length; i++) {\n\t if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\t\n\t switch (len) {\n\t case 1: listeners[i].fn.call(listeners[i].context); break;\n\t case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n\t case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n\t default:\n\t if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n\t args[j - 1] = arguments[j];\n\t }\n\t\n\t listeners[i].fn.apply(listeners[i].context, args);\n\t }\n\t }\n\t }\n\t\n\t return true;\n\t};\n\t\n\t/**\n\t * Register a new EventListener for the given event.\n\t *\n\t * @param {String} event Name of the event.\n\t * @param {Functon} fn Callback function.\n\t * @param {Mixed} context The context of the function.\n\t * @api public\n\t */\n\tEventEmitter.prototype.on = function on(event, fn, context) {\n\t var listener = new EE(fn, context || this)\n\t , evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events) this._events = prefix ? {} : Object.create(null);\n\t if (!this._events[evt]) this._events[evt] = listener;\n\t else {\n\t if (!this._events[evt].fn) this._events[evt].push(listener);\n\t else this._events[evt] = [\n\t this._events[evt], listener\n\t ];\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Add an EventListener that's only called once.\n\t *\n\t * @param {String} event Name of the event.\n\t * @param {Function} fn Callback function.\n\t * @param {Mixed} context The context of the function.\n\t * @api public\n\t */\n\tEventEmitter.prototype.once = function once(event, fn, context) {\n\t var listener = new EE(fn, context || this, true)\n\t , evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events) this._events = prefix ? {} : Object.create(null);\n\t if (!this._events[evt]) this._events[evt] = listener;\n\t else {\n\t if (!this._events[evt].fn) this._events[evt].push(listener);\n\t else this._events[evt] = [\n\t this._events[evt], listener\n\t ];\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Remove event listeners.\n\t *\n\t * @param {String} event The event we want to remove.\n\t * @param {Function} fn The listener that we need to find.\n\t * @param {Mixed} context Only remove listeners matching this context.\n\t * @param {Boolean} once Only remove once listeners.\n\t * @api public\n\t */\n\tEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n\t var evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events || !this._events[evt]) return this;\n\t\n\t var listeners = this._events[evt]\n\t , events = [];\n\t\n\t if (fn) {\n\t if (listeners.fn) {\n\t if (\n\t listeners.fn !== fn\n\t || (once && !listeners.once)\n\t || (context && listeners.context !== context)\n\t ) {\n\t events.push(listeners);\n\t }\n\t } else {\n\t for (var i = 0, length = listeners.length; i < length; i++) {\n\t if (\n\t listeners[i].fn !== fn\n\t || (once && !listeners[i].once)\n\t || (context && listeners[i].context !== context)\n\t ) {\n\t events.push(listeners[i]);\n\t }\n\t }\n\t }\n\t }\n\t\n\t //\n\t // Reset the array, or remove it completely if we have no more listeners.\n\t //\n\t if (events.length) {\n\t this._events[evt] = events.length === 1 ? events[0] : events;\n\t } else {\n\t delete this._events[evt];\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Remove all listeners or only the listeners for the specified event.\n\t *\n\t * @param {String} event The event want to remove all listeners for.\n\t * @api public\n\t */\n\tEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n\t if (!this._events) return this;\n\t\n\t if (event) delete this._events[prefix ? prefix + event : event];\n\t else this._events = prefix ? {} : Object.create(null);\n\t\n\t return this;\n\t};\n\t\n\t//\n\t// Alias methods names because people roll like that.\n\t//\n\tEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\tEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\t\n\t//\n\t// This function doesn't apply anymore.\n\t//\n\tEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n\t return this;\n\t};\n\t\n\t//\n\t// Expose the prefix.\n\t//\n\tEventEmitter.prefixed = prefix;\n\t\n\t//\n\t// Expose the module.\n\t//\n\tif (true) {\n\t module.exports = EventEmitter;\n\t}\n\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * lodash 4.0.2 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\tvar keys = __webpack_require__(4),\n\t rest = __webpack_require__(5);\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]';\n\t\n\t/** Used to detect unsigned integer values. */\n\tvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\t\n\t/**\n\t * Checks if `value` is a valid array-like index.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n\t * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n\t */\n\tfunction isIndex(value, length) {\n\t value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n\t length = length == null ? MAX_SAFE_INTEGER : length;\n\t return value > -1 && value % 1 == 0 && value < length;\n\t}\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/**\n\t * Assigns `value` to `key` of `object` if the existing value is not equivalent\n\t * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n\t * for equality comparisons.\n\t *\n\t * @private\n\t * @param {Object} object The object to modify.\n\t * @param {string} key The key of the property to assign.\n\t * @param {*} value The value to assign.\n\t */\n\tfunction assignValue(object, key, value) {\n\t var objValue = object[key];\n\t if ((!eq(objValue, value) ||\n\t (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) ||\n\t (value === undefined && !(key in object))) {\n\t object[key] = value;\n\t }\n\t}\n\t\n\t/**\n\t * The base implementation of `_.property` without support for deep paths.\n\t *\n\t * @private\n\t * @param {string} key The key of the property to get.\n\t * @returns {Function} Returns the new function.\n\t */\n\tfunction baseProperty(key) {\n\t return function(object) {\n\t return object == null ? undefined : object[key];\n\t };\n\t}\n\t\n\t/**\n\t * Copies properties of `source` to `object`.\n\t *\n\t * @private\n\t * @param {Object} source The object to copy properties from.\n\t * @param {Array} props The property names to copy.\n\t * @param {Object} [object={}] The object to copy properties to.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction copyObject(source, props, object) {\n\t return copyObjectWith(source, props, object);\n\t}\n\t\n\t/**\n\t * This function is like `copyObject` except that it accepts a function to\n\t * customize copied values.\n\t *\n\t * @private\n\t * @param {Object} source The object to copy properties from.\n\t * @param {Array} props The property names to copy.\n\t * @param {Object} [object={}] The object to copy properties to.\n\t * @param {Function} [customizer] The function to customize copied values.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction copyObjectWith(source, props, object, customizer) {\n\t object || (object = {});\n\t\n\t var index = -1,\n\t length = props.length;\n\t\n\t while (++index < length) {\n\t var key = props[index],\n\t newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key];\n\t\n\t assignValue(object, key, newValue);\n\t }\n\t return object;\n\t}\n\t\n\t/**\n\t * Creates a function like `_.assign`.\n\t *\n\t * @private\n\t * @param {Function} assigner The function to assign values.\n\t * @returns {Function} Returns the new assigner function.\n\t */\n\tfunction createAssigner(assigner) {\n\t return rest(function(object, sources) {\n\t var index = -1,\n\t length = sources.length,\n\t customizer = length > 1 ? sources[length - 1] : undefined,\n\t guard = length > 2 ? sources[2] : undefined;\n\t\n\t customizer = typeof customizer == 'function' ? (length--, customizer) : undefined;\n\t if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n\t customizer = length < 3 ? undefined : customizer;\n\t length = 1;\n\t }\n\t object = Object(object);\n\t while (++index < length) {\n\t var source = sources[index];\n\t if (source) {\n\t assigner(object, source, index, customizer);\n\t }\n\t }\n\t return object;\n\t });\n\t}\n\t\n\t/**\n\t * Gets the \"length\" property value of `object`.\n\t *\n\t * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n\t * that affects Safari on at least iOS 8.1-8.3 ARM64.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {*} Returns the \"length\" value.\n\t */\n\tvar getLength = baseProperty('length');\n\t\n\t/**\n\t * Checks if the provided arguments are from an iteratee call.\n\t *\n\t * @private\n\t * @param {*} value The potential iteratee value argument.\n\t * @param {*} index The potential iteratee index or key argument.\n\t * @param {*} object The potential iteratee object argument.\n\t * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n\t */\n\tfunction isIterateeCall(value, index, object) {\n\t if (!isObject(object)) {\n\t return false;\n\t }\n\t var type = typeof index;\n\t if (type == 'number'\n\t ? (isArrayLike(object) && isIndex(index, object.length))\n\t : (type == 'string' && index in object)) {\n\t return eq(object[index], value);\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n\t * comparison between two values to determine if they are equivalent.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to compare.\n\t * @param {*} other The other value to compare.\n\t * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n\t * @example\n\t *\n\t * var object = { 'user': 'fred' };\n\t * var other = { 'user': 'fred' };\n\t *\n\t * _.eq(object, object);\n\t * // => true\n\t *\n\t * _.eq(object, other);\n\t * // => false\n\t *\n\t * _.eq('a', 'a');\n\t * // => true\n\t *\n\t * _.eq('a', Object('a'));\n\t * // => false\n\t *\n\t * _.eq(NaN, NaN);\n\t * // => true\n\t */\n\tfunction eq(value, other) {\n\t return value === other || (value !== value && other !== other);\n\t}\n\t\n\t/**\n\t * Checks if `value` is array-like. A value is considered array-like if it's\n\t * not a function and has a `value.length` that's an integer greater than or\n\t * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n\t * @example\n\t *\n\t * _.isArrayLike([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArrayLike(document.body.children);\n\t * // => true\n\t *\n\t * _.isArrayLike('abc');\n\t * // => true\n\t *\n\t * _.isArrayLike(_.noop);\n\t * // => false\n\t */\n\tfunction isArrayLike(value) {\n\t return value != null &&\n\t !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is a valid array-like length.\n\t *\n\t * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n\t * @example\n\t *\n\t * _.isLength(3);\n\t * // => true\n\t *\n\t * _.isLength(Number.MIN_VALUE);\n\t * // => false\n\t *\n\t * _.isLength(Infinity);\n\t * // => false\n\t *\n\t * _.isLength('3');\n\t * // => false\n\t */\n\tfunction isLength(value) {\n\t return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Assigns own enumerable properties of source objects to the destination\n\t * object. Source objects are applied from left to right. Subsequent sources\n\t * overwrite property assignments of previous sources.\n\t *\n\t * **Note:** This method mutates `object` and is loosely based on\n\t * [`Object.assign`](https://mdn.io/Object/assign).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The destination object.\n\t * @param {...Object} [sources] The source objects.\n\t * @returns {Object} Returns `object`.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.c = 3;\n\t * }\n\t *\n\t * function Bar() {\n\t * this.e = 5;\n\t * }\n\t *\n\t * Foo.prototype.d = 4;\n\t * Bar.prototype.f = 6;\n\t *\n\t * _.assign({ 'a': 1 }, new Foo, new Bar);\n\t * // => { 'a': 1, 'c': 3, 'e': 5 }\n\t */\n\tvar assign = createAssigner(function(object, source) {\n\t copyObject(source, keys(source), object);\n\t});\n\t\n\tmodule.exports = assign;\n\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\t/**\n\t * lodash 4.0.2 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\t\n\t/** `Object#toString` result references. */\n\tvar argsTag = '[object Arguments]',\n\t funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]',\n\t stringTag = '[object String]';\n\t\n\t/** Used to detect unsigned integer values. */\n\tvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\t\n\t/**\n\t * The base implementation of `_.times` without support for iteratee shorthands\n\t * or max array length checks.\n\t *\n\t * @private\n\t * @param {number} n The number of times to invoke `iteratee`.\n\t * @param {Function} iteratee The function invoked per iteration.\n\t * @returns {Array} Returns the array of results.\n\t */\n\tfunction baseTimes(n, iteratee) {\n\t var index = -1,\n\t result = Array(n);\n\t\n\t while (++index < n) {\n\t result[index] = iteratee(index);\n\t }\n\t return result;\n\t}\n\t\n\t/**\n\t * Checks if `value` is a valid array-like index.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n\t * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n\t */\n\tfunction isIndex(value, length) {\n\t value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n\t length = length == null ? MAX_SAFE_INTEGER : length;\n\t return value > -1 && value % 1 == 0 && value < length;\n\t}\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/** Built-in value references. */\n\tvar getPrototypeOf = Object.getPrototypeOf,\n\t propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\t\n\t/* Built-in method references for those with the same name as other `lodash` methods. */\n\tvar nativeKeys = Object.keys;\n\t\n\t/**\n\t * The base implementation of `_.has` without support for deep paths.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @param {Array|string} key The key to check.\n\t * @returns {boolean} Returns `true` if `key` exists, else `false`.\n\t */\n\tfunction baseHas(object, key) {\n\t // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,\n\t // that are composed entirely of index properties, return `false` for\n\t // `hasOwnProperty` checks of them.\n\t return hasOwnProperty.call(object, key) ||\n\t (typeof object == 'object' && key in object && getPrototypeOf(object) === null);\n\t}\n\t\n\t/**\n\t * The base implementation of `_.keys` which doesn't skip the constructor\n\t * property of prototypes or treat sparse arrays as dense.\n\t *\n\t * @private\n\t * @type Function\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t */\n\tfunction baseKeys(object) {\n\t return nativeKeys(Object(object));\n\t}\n\t\n\t/**\n\t * The base implementation of `_.property` without support for deep paths.\n\t *\n\t * @private\n\t * @param {string} key The key of the property to get.\n\t * @returns {Function} Returns the new function.\n\t */\n\tfunction baseProperty(key) {\n\t return function(object) {\n\t return object == null ? undefined : object[key];\n\t };\n\t}\n\t\n\t/**\n\t * Gets the \"length\" property value of `object`.\n\t *\n\t * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n\t * that affects Safari on at least iOS 8.1-8.3 ARM64.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {*} Returns the \"length\" value.\n\t */\n\tvar getLength = baseProperty('length');\n\t\n\t/**\n\t * Creates an array of index keys for `object` values of arrays,\n\t * `arguments` objects, and strings, otherwise `null` is returned.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {Array|null} Returns index keys, else `null`.\n\t */\n\tfunction indexKeys(object) {\n\t var length = object ? object.length : undefined;\n\t if (isLength(length) &&\n\t (isArray(object) || isString(object) || isArguments(object))) {\n\t return baseTimes(length, String);\n\t }\n\t return null;\n\t}\n\t\n\t/**\n\t * Checks if `value` is likely a prototype object.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n\t */\n\tfunction isPrototype(value) {\n\t var Ctor = value && value.constructor,\n\t proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\t\n\t return value === proto;\n\t}\n\t\n\t/**\n\t * Checks if `value` is likely an `arguments` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArguments(function() { return arguments; }());\n\t * // => true\n\t *\n\t * _.isArguments([1, 2, 3]);\n\t * // => false\n\t */\n\tfunction isArguments(value) {\n\t // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\n\t return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n\t (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as an `Array` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArray([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArray(document.body.children);\n\t * // => false\n\t *\n\t * _.isArray('abc');\n\t * // => false\n\t *\n\t * _.isArray(_.noop);\n\t * // => false\n\t */\n\tvar isArray = Array.isArray;\n\t\n\t/**\n\t * Checks if `value` is array-like. A value is considered array-like if it's\n\t * not a function and has a `value.length` that's an integer greater than or\n\t * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n\t * @example\n\t *\n\t * _.isArrayLike([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArrayLike(document.body.children);\n\t * // => true\n\t *\n\t * _.isArrayLike('abc');\n\t * // => true\n\t *\n\t * _.isArrayLike(_.noop);\n\t * // => false\n\t */\n\tfunction isArrayLike(value) {\n\t return value != null &&\n\t !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n\t}\n\t\n\t/**\n\t * This method is like `_.isArrayLike` except that it also checks if `value`\n\t * is an object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.\n\t * @example\n\t *\n\t * _.isArrayLikeObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArrayLikeObject(document.body.children);\n\t * // => true\n\t *\n\t * _.isArrayLikeObject('abc');\n\t * // => false\n\t *\n\t * _.isArrayLikeObject(_.noop);\n\t * // => false\n\t */\n\tfunction isArrayLikeObject(value) {\n\t return isObjectLike(value) && isArrayLike(value);\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is a valid array-like length.\n\t *\n\t * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n\t * @example\n\t *\n\t * _.isLength(3);\n\t * // => true\n\t *\n\t * _.isLength(Number.MIN_VALUE);\n\t * // => false\n\t *\n\t * _.isLength(Infinity);\n\t * // => false\n\t *\n\t * _.isLength('3');\n\t * // => false\n\t */\n\tfunction isLength(value) {\n\t return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Checks if `value` is object-like. A value is object-like if it's not `null`\n\t * and has a `typeof` result of \"object\".\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n\t * @example\n\t *\n\t * _.isObjectLike({});\n\t * // => true\n\t *\n\t * _.isObjectLike([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObjectLike(_.noop);\n\t * // => false\n\t *\n\t * _.isObjectLike(null);\n\t * // => false\n\t */\n\tfunction isObjectLike(value) {\n\t return !!value && typeof value == 'object';\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `String` primitive or object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isString('abc');\n\t * // => true\n\t *\n\t * _.isString(1);\n\t * // => false\n\t */\n\tfunction isString(value) {\n\t return typeof value == 'string' ||\n\t (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);\n\t}\n\t\n\t/**\n\t * Creates an array of the own enumerable property names of `object`.\n\t *\n\t * **Note:** Non-object values are coerced to objects. See the\n\t * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n\t * for more details.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.a = 1;\n\t * this.b = 2;\n\t * }\n\t *\n\t * Foo.prototype.c = 3;\n\t *\n\t * _.keys(new Foo);\n\t * // => ['a', 'b'] (iteration order is not guaranteed)\n\t *\n\t * _.keys('hi');\n\t * // => ['0', '1']\n\t */\n\tfunction keys(object) {\n\t var isProto = isPrototype(object);\n\t if (!(isProto || isArrayLike(object))) {\n\t return baseKeys(object);\n\t }\n\t var indexes = indexKeys(object),\n\t skipIndexes = !!indexes,\n\t result = indexes || [],\n\t length = result.length;\n\t\n\t for (var key in object) {\n\t if (baseHas(object, key) &&\n\t !(skipIndexes && (key == 'length' || isIndex(key, length))) &&\n\t !(isProto && key == 'constructor')) {\n\t result.push(key);\n\t }\n\t }\n\t return result;\n\t}\n\t\n\tmodule.exports = keys;\n\n\n/***/ },\n/* 5 */\n/***/ function(module, exports) {\n\n\t/**\n\t * lodash 4.0.1 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\t\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar INFINITY = 1 / 0,\n\t MAX_INTEGER = 1.7976931348623157e+308,\n\t NAN = 0 / 0;\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]';\n\t\n\t/** Used to match leading and trailing whitespace. */\n\tvar reTrim = /^\\s+|\\s+$/g;\n\t\n\t/** Used to detect bad signed hexadecimal string values. */\n\tvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\t\n\t/** Used to detect binary string values. */\n\tvar reIsBinary = /^0b[01]+$/i;\n\t\n\t/** Used to detect octal string values. */\n\tvar reIsOctal = /^0o[0-7]+$/i;\n\t\n\t/** Built-in method references without a dependency on `root`. */\n\tvar freeParseInt = parseInt;\n\t\n\t/**\n\t * A faster alternative to `Function#apply`, this function invokes `func`\n\t * with the `this` binding of `thisArg` and the arguments of `args`.\n\t *\n\t * @private\n\t * @param {Function} func The function to invoke.\n\t * @param {*} thisArg The `this` binding of `func`.\n\t * @param {...*} args The arguments to invoke `func` with.\n\t * @returns {*} Returns the result of `func`.\n\t */\n\tfunction apply(func, thisArg, args) {\n\t var length = args.length;\n\t switch (length) {\n\t case 0: return func.call(thisArg);\n\t case 1: return func.call(thisArg, args[0]);\n\t case 2: return func.call(thisArg, args[0], args[1]);\n\t case 3: return func.call(thisArg, args[0], args[1], args[2]);\n\t }\n\t return func.apply(thisArg, args);\n\t}\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/* Built-in method references for those with the same name as other `lodash` methods. */\n\tvar nativeMax = Math.max;\n\t\n\t/**\n\t * Creates a function that invokes `func` with the `this` binding of the\n\t * created function and arguments from `start` and beyond provided as an array.\n\t *\n\t * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to apply a rest parameter to.\n\t * @param {number} [start=func.length-1] The start position of the rest parameter.\n\t * @returns {Function} Returns the new function.\n\t * @example\n\t *\n\t * var say = _.rest(function(what, names) {\n\t * return what + ' ' + _.initial(names).join(', ') +\n\t * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n\t * });\n\t *\n\t * say('hello', 'fred', 'barney', 'pebbles');\n\t * // => 'hello fred, barney, & pebbles'\n\t */\n\tfunction rest(func, start) {\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);\n\t return function() {\n\t var args = arguments,\n\t index = -1,\n\t length = nativeMax(args.length - start, 0),\n\t array = Array(length);\n\t\n\t while (++index < length) {\n\t array[index] = args[start + index];\n\t }\n\t switch (start) {\n\t case 0: return func.call(this, array);\n\t case 1: return func.call(this, args[0], array);\n\t case 2: return func.call(this, args[0], args[1], array);\n\t }\n\t var otherArgs = Array(start + 1);\n\t index = -1;\n\t while (++index < start) {\n\t otherArgs[index] = args[index];\n\t }\n\t otherArgs[start] = array;\n\t return apply(func, this, otherArgs);\n\t };\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Converts `value` to an integer.\n\t *\n\t * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to convert.\n\t * @returns {number} Returns the converted integer.\n\t * @example\n\t *\n\t * _.toInteger(3);\n\t * // => 3\n\t *\n\t * _.toInteger(Number.MIN_VALUE);\n\t * // => 0\n\t *\n\t * _.toInteger(Infinity);\n\t * // => 1.7976931348623157e+308\n\t *\n\t * _.toInteger('3');\n\t * // => 3\n\t */\n\tfunction toInteger(value) {\n\t if (!value) {\n\t return value === 0 ? value : 0;\n\t }\n\t value = toNumber(value);\n\t if (value === INFINITY || value === -INFINITY) {\n\t var sign = (value < 0 ? -1 : 1);\n\t return sign * MAX_INTEGER;\n\t }\n\t var remainder = value % 1;\n\t return value === value ? (remainder ? value - remainder : value) : 0;\n\t}\n\t\n\t/**\n\t * Converts `value` to a number.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to process.\n\t * @returns {number} Returns the number.\n\t * @example\n\t *\n\t * _.toNumber(3);\n\t * // => 3\n\t *\n\t * _.toNumber(Number.MIN_VALUE);\n\t * // => 5e-324\n\t *\n\t * _.toNumber(Infinity);\n\t * // => Infinity\n\t *\n\t * _.toNumber('3');\n\t * // => 3\n\t */\n\tfunction toNumber(value) {\n\t if (isObject(value)) {\n\t var other = isFunction(value.valueOf) ? value.valueOf() : value;\n\t value = isObject(other) ? (other + '') : other;\n\t }\n\t if (typeof value != 'string') {\n\t return value === 0 ? value : +value;\n\t }\n\t value = value.replace(reTrim, '');\n\t var isBinary = reIsBinary.test(value);\n\t return (isBinary || reIsOctal.test(value))\n\t ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n\t : (reIsBadHex.test(value) ? NAN : +value);\n\t}\n\t\n\tmodule.exports = rest;\n\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _CRSEPSG3857 = __webpack_require__(7);\n\t\n\tvar _CRSEPSG38572 = _interopRequireDefault(_CRSEPSG3857);\n\t\n\tvar _CRSEPSG3395 = __webpack_require__(15);\n\t\n\tvar _CRSEPSG33952 = _interopRequireDefault(_CRSEPSG3395);\n\t\n\tvar _CRSEPSG4326 = __webpack_require__(17);\n\t\n\tvar _CRSEPSG43262 = _interopRequireDefault(_CRSEPSG4326);\n\t\n\tvar _CRSSimple = __webpack_require__(19);\n\t\n\tvar _CRSSimple2 = _interopRequireDefault(_CRSSimple);\n\t\n\tvar _CRSProj4 = __webpack_require__(20);\n\t\n\tvar _CRSProj42 = _interopRequireDefault(_CRSProj4);\n\t\n\tvar CRS = {};\n\t\n\tCRS.EPSG3857 = _CRSEPSG38572['default'];\n\tCRS.EPSG900913 = _CRSEPSG3857.EPSG900913;\n\tCRS.EPSG3395 = _CRSEPSG33952['default'];\n\tCRS.EPSG4326 = _CRSEPSG43262['default'];\n\tCRS.Simple = _CRSSimple2['default'];\n\tCRS.Proj4 = _CRSProj42['default'];\n\t\n\texports['default'] = CRS;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 7 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.EPSG3857 (WGS 84 / Pseudo-Mercator) CRS implementation.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3857.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionSphericalMercator = __webpack_require__(13);\n\t\n\tvar _projectionProjectionSphericalMercator2 = _interopRequireDefault(_projectionProjectionSphericalMercator);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _EPSG3857 = {\n\t code: 'EPSG:3857',\n\t projection: _projectionProjectionSphericalMercator2['default'],\n\t\n\t // Work out how to de-dupe this (scoping issue)\n\t transformScale: 1 / (Math.PI * _projectionProjectionSphericalMercator2['default'].R),\n\t\n\t // Scale and transformation inputs changed to account for central origin in\n\t // WebGL, instead of top-left origin used in Leaflet\n\t transformation: (function () {\n\t // TODO: Cannot use this.transformScale due to scope\n\t var scale = 1 / (Math.PI * _projectionProjectionSphericalMercator2['default'].R);\n\t\n\t return new _utilTransformation2['default'](scale, 0, -scale, 0);\n\t })()\n\t};\n\t\n\tvar EPSG3857 = (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _EPSG3857);\n\t\n\tvar EPSG900913 = (0, _lodashAssign2['default'])({}, EPSG3857, {\n\t code: 'EPSG:900913'\n\t});\n\t\n\texports.EPSG900913 = EPSG900913;\n\texports['default'] = EPSG3857;\n\n/***/ },\n/* 8 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.Earth is the base class for all CRS representing Earth.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Earth.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRS = __webpack_require__(9);\n\t\n\tvar _CRS2 = _interopRequireDefault(_CRS);\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar Earth = {\n\t wrapLon: [-180, 180],\n\t\n\t R: 6378137,\n\t\n\t // Distance between two geographical points using spherical law of cosines\n\t // approximation or Haversine\n\t //\n\t // See: http://www.movable-type.co.uk/scripts/latlong.html\n\t distance: function distance(latlon1, latlon2, accurate) {\n\t var rad = Math.PI / 180;\n\t\n\t var lat1;\n\t var lat2;\n\t\n\t var a;\n\t\n\t if (!accurate) {\n\t lat1 = latlon1.lat * rad;\n\t lat2 = latlon2.lat * rad;\n\t\n\t a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((latlon2.lon - latlon1.lon) * rad);\n\t\n\t return this.R * Math.acos(Math.min(a, 1));\n\t } else {\n\t lat1 = latlon1.lat * rad;\n\t lat2 = latlon2.lat * rad;\n\t\n\t var lon1 = latlon1.lon * rad;\n\t var lon2 = latlon2.lon * rad;\n\t\n\t var deltaLat = lat2 - lat1;\n\t var deltaLon = lon2 - lon1;\n\t\n\t var halfDeltaLat = deltaLat / 2;\n\t var halfDeltaLon = deltaLon / 2;\n\t\n\t a = Math.sin(halfDeltaLat) * Math.sin(halfDeltaLat) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(halfDeltaLon) * Math.sin(halfDeltaLon);\n\t\n\t var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\t\n\t return this.R * c;\n\t }\n\t },\n\t\n\t // Scale factor for converting between real metres and projected metres\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t //\n\t // Defaults to a scale factor of 1 if no calculation method exists\n\t //\n\t // Probably need to run this through the CRS transformation or similar so the\n\t // resulting scale is relative to the dimensions of the world space\n\t // Eg. 1 metre in projected space is likly scaled up or down to some other\n\t // number\n\t pointScale: function pointScale(latlon, accurate) {\n\t return this.projection.pointScale ? this.projection.pointScale(latlon, accurate) : [1, 1];\n\t },\n\t\n\t // Convert real metres to projected units\n\t //\n\t // Latitude scale is chosen because it fluctuates more than longitude\n\t metresToProjected: function metresToProjected(metres, pointScale) {\n\t return metres * pointScale[1];\n\t },\n\t\n\t // Convert projected units to real metres\n\t //\n\t // Latitude scale is chosen because it fluctuates more than longitude\n\t projectedToMetres: function projectedToMetres(projectedUnits, pointScale) {\n\t return projectedUnits / pointScale[1];\n\t },\n\t\n\t // Convert real metres to a value in world (WebGL) units\n\t metresToWorld: function metresToWorld(metres, pointScale, zoom) {\n\t // Transform metres to projected metres using the latitude point scale\n\t //\n\t // Latitude scale is chosen because it fluctuates more than longitude\n\t var projectedMetres = this.metresToProjected(metres, pointScale);\n\t\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t // Scale projected metres\n\t var scaledMetres = scale * (this.transformScale * projectedMetres);\n\t\n\t // Not entirely sure why this is neccessary\n\t if (zoom) {\n\t scaledMetres /= pointScale[1];\n\t }\n\t\n\t return scaledMetres;\n\t },\n\t\n\t // Convert world (WebGL) units to a value in real metres\n\t worldToMetres: function worldToMetres(worldUnits, pointScale, zoom) {\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t var projectedUnits = worldUnits / scale / this.transformScale;\n\t var realMetres = this.projectedToMetres(projectedUnits, pointScale);\n\t\n\t // Not entirely sure why this is neccessary\n\t if (zoom) {\n\t realMetres *= pointScale[1];\n\t }\n\t\n\t return realMetres;\n\t }\n\t};\n\t\n\texports['default'] = (0, _lodashAssign2['default'])({}, _CRS2['default'], Earth);\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 9 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS is the base object for all defined CRS (Coordinate Reference Systems)\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar _utilWrapNum = __webpack_require__(12);\n\t\n\tvar _utilWrapNum2 = _interopRequireDefault(_utilWrapNum);\n\t\n\tvar CRS = {\n\t // Scale factor determines final dimensions of world space\n\t //\n\t // Projection transformation in range -1 to 1 is multiplied by scale factor to\n\t // find final world coordinates\n\t //\n\t // Scale factor can be considered as half the amount of the desired dimension\n\t // for the largest side when transformation is equal to 1 or -1, or as the\n\t // distance between 0 and 1 on the largest side\n\t //\n\t // For example, if you want the world dimensions to be between -1000 and 1000\n\t // then the scale factor will be 1000\n\t scaleFactor: 1000000,\n\t\n\t // Converts geo coords to pixel / WebGL ones\n\t latLonToPoint: function latLonToPoint(latlon, zoom) {\n\t var projectedPoint = this.projection.project(latlon);\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t return this.transformation._transform(projectedPoint, scale);\n\t },\n\t\n\t // Converts pixel / WebGL coords to geo coords\n\t pointToLatLon: function pointToLatLon(point, zoom) {\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t var untransformedPoint = this.transformation.untransform(point, scale);\n\t\n\t return this.projection.unproject(untransformedPoint);\n\t },\n\t\n\t // Converts geo coords to projection-specific coords (e.g. in meters)\n\t project: function project(latlon) {\n\t return this.projection.project(latlon);\n\t },\n\t\n\t // Converts projected coords to geo coords\n\t unproject: function unproject(point) {\n\t return this.projection.unproject(point);\n\t },\n\t\n\t // If zoom is provided, returns the map width in pixels for a given zoom\n\t // Else, provides fixed scale value\n\t scale: function scale(zoom) {\n\t // If zoom is provided then return scale based on map tile zoom\n\t if (zoom >= 0) {\n\t return 256 * Math.pow(2, zoom);\n\t // Else, return fixed scale value to expand projected coordinates from\n\t // their 0 to 1 range into something more practical\n\t } else {\n\t return this.scaleFactor;\n\t }\n\t },\n\t\n\t // Returns zoom level for a given scale value\n\t // This only works with a scale value that is based on map pixel width\n\t zoom: function zoom(scale) {\n\t return Math.log(scale / 256) / Math.LN2;\n\t },\n\t\n\t // Returns the bounds of the world in projected coords if applicable\n\t getProjectedBounds: function getProjectedBounds(zoom) {\n\t if (this.infinite) {\n\t return null;\n\t }\n\t\n\t var b = this.projection.bounds;\n\t var s = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t s /= 2;\n\t }\n\t\n\t // Bottom left\n\t var min = this.transformation.transform((0, _Point.point)(b[0]), s);\n\t\n\t // Top right\n\t var max = this.transformation.transform((0, _Point.point)(b[1]), s);\n\t\n\t return [min, max];\n\t },\n\t\n\t // Whether a coordinate axis wraps in a given range (e.g. longitude from -180 to 180); depends on CRS\n\t // wrapLon: [min, max],\n\t // wrapLat: [min, max],\n\t\n\t // If true, the coordinate space will be unbounded (infinite in all directions)\n\t // infinite: false,\n\t\n\t // Wraps geo coords in certain ranges if applicable\n\t wrapLatLon: function wrapLatLon(latlon) {\n\t var lat = this.wrapLat ? (0, _utilWrapNum2['default'])(latlon.lat, this.wrapLat, true) : latlon.lat;\n\t var lon = this.wrapLon ? (0, _utilWrapNum2['default'])(latlon.lon, this.wrapLon, true) : latlon.lon;\n\t var alt = latlon.alt;\n\t\n\t return (0, _LatLon.latLon)(lat, lon, alt);\n\t }\n\t};\n\t\n\texports['default'] = CRS;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 10 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\t/*\n\t * LatLon is a helper class for ensuring consistent geographic coordinates.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/LatLng.js\n\t */\n\t\n\tvar LatLon = (function () {\n\t function LatLon(lat, lon, alt) {\n\t _classCallCheck(this, LatLon);\n\t\n\t if (isNaN(lat) || isNaN(lon)) {\n\t throw new Error('Invalid LatLon object: (' + lat + ', ' + lon + ')');\n\t }\n\t\n\t this.lat = +lat;\n\t this.lon = +lon;\n\t\n\t if (alt !== undefined) {\n\t this.alt = +alt;\n\t }\n\t }\n\t\n\t _createClass(LatLon, [{\n\t key: 'clone',\n\t value: function clone() {\n\t return new LatLon(this.lat, this.lon, this.alt);\n\t }\n\t }]);\n\t\n\t return LatLon;\n\t})();\n\t\n\texports['default'] = LatLon;\n\t\n\t// Accepts (LatLon), ([lat, lon, alt]), ([lat, lon]) and (lat, lon, alt)\n\t// Also converts between lng and lon\n\tvar noNew = function noNew(a, b, c) {\n\t if (a instanceof LatLon) {\n\t return a;\n\t }\n\t if (Array.isArray(a) && typeof a[0] !== 'object') {\n\t if (a.length === 3) {\n\t return new LatLon(a[0], a[1], a[2]);\n\t }\n\t if (a.length === 2) {\n\t return new LatLon(a[0], a[1]);\n\t }\n\t return null;\n\t }\n\t if (a === undefined || a === null) {\n\t return a;\n\t }\n\t if (typeof a === 'object' && 'lat' in a) {\n\t return new LatLon(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\n\t }\n\t if (b === undefined) {\n\t return null;\n\t }\n\t return new LatLon(a, b, c);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.latLon = noNew;\n\n/***/ },\n/* 11 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/*\n\t * Point is a helper class for ensuring consistent world positions.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/Point.js\n\t */\n\t\n\tvar Point = (function () {\n\t function Point(x, y, round) {\n\t _classCallCheck(this, Point);\n\t\n\t this.x = round ? Math.round(x) : x;\n\t this.y = round ? Math.round(y) : y;\n\t }\n\t\n\t _createClass(Point, [{\n\t key: \"clone\",\n\t value: function clone() {\n\t return new Point(this.x, this.y);\n\t }\n\t\n\t // Non-destructive\n\t }, {\n\t key: \"add\",\n\t value: function add(point) {\n\t return this.clone()._add(_point(point));\n\t }\n\t\n\t // Destructive\n\t }, {\n\t key: \"_add\",\n\t value: function _add(point) {\n\t this.x += point.x;\n\t this.y += point.y;\n\t return this;\n\t }\n\t\n\t // Non-destructive\n\t }, {\n\t key: \"subtract\",\n\t value: function subtract(point) {\n\t return this.clone()._subtract(_point(point));\n\t }\n\t\n\t // Destructive\n\t }, {\n\t key: \"_subtract\",\n\t value: function _subtract(point) {\n\t this.x -= point.x;\n\t this.y -= point.y;\n\t return this;\n\t }\n\t }]);\n\t\n\t return Point;\n\t})();\n\t\n\texports[\"default\"] = Point;\n\t\n\t// Accepts (point), ([x, y]) and (x, y, round)\n\tvar _point = function _point(x, y, round) {\n\t if (x instanceof Point) {\n\t return x;\n\t }\n\t if (Array.isArray(x)) {\n\t return new Point(x[0], x[1]);\n\t }\n\t if (x === undefined || x === null) {\n\t return x;\n\t }\n\t return new Point(x, y, round);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.point = _point;\n\n/***/ },\n/* 12 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t/*\n\t * Wrap the given number to lie within a certain range (eg. longitude)\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/core/Util.js\n\t */\n\t\n\tvar wrapNum = function wrapNum(x, range, includeMax) {\n\t var max = range[1];\n\t var min = range[0];\n\t var d = max - min;\n\t return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\n\t};\n\t\n\texports[\"default\"] = wrapNum;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 13 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t/*\n\t * Spherical Mercator is the most popular map projection, used by EPSG:3857 CRS\n\t * used by default.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.SphericalMercator.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar SphericalMercator = {\n\t // Radius / WGS84 semi-major axis\n\t R: 6378137,\n\t MAX_LATITUDE: 85.0511287798,\n\t\n\t // WGS84 eccentricity\n\t ECC: 0.081819191,\n\t ECC2: 0.081819191 * 0.081819191,\n\t\n\t project: function project(latlon) {\n\t var d = Math.PI / 180;\n\t var max = this.MAX_LATITUDE;\n\t var lat = Math.max(Math.min(max, latlon.lat), -max);\n\t var sin = Math.sin(lat * d);\n\t\n\t return (0, _Point.point)(this.R * latlon.lon * d, this.R * Math.log((1 + sin) / (1 - sin)) / 2);\n\t },\n\t\n\t unproject: function unproject(point) {\n\t var d = 180 / Math.PI;\n\t\n\t return (0, _LatLon.latLon)((2 * Math.atan(Math.exp(point.y / this.R)) - Math.PI / 2) * d, point.x * d / this.R);\n\t },\n\t\n\t // Scale factor for converting between real metres and projected metres\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t //\n\t // Accurate scale factor uses proper Web Mercator scaling\n\t // See pg.9: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n\t // See: http://jsfiddle.net/robhawkes/yws924cf/\n\t pointScale: function pointScale(latlon, accurate) {\n\t var rad = Math.PI / 180;\n\t\n\t var k;\n\t\n\t if (!accurate) {\n\t k = 1 / Math.cos(latlon.lat * rad);\n\t\n\t // [scaleX, scaleY]\n\t return [k, k];\n\t } else {\n\t var lat = latlon.lat * rad;\n\t var lon = latlon.lon * rad;\n\t\n\t var a = this.R;\n\t\n\t var sinLat = Math.sin(lat);\n\t var sinLat2 = sinLat * sinLat;\n\t\n\t var cosLat = Math.cos(lat);\n\t\n\t // Radius meridian\n\t var p = a * (1 - this.ECC2) / Math.pow(1 - this.ECC2 * sinLat2, 3 / 2);\n\t\n\t // Radius prime meridian\n\t var v = a / Math.sqrt(1 - this.ECC2 * sinLat2);\n\t\n\t // Scale N/S\n\t var h = a / p / cosLat;\n\t\n\t // Scale E/W\n\t k = a / v / cosLat;\n\t\n\t // [scaleX, scaleY]\n\t return [k, h];\n\t }\n\t },\n\t\n\t // Not using this.R due to scoping\n\t bounds: (function () {\n\t var d = 6378137 * Math.PI;\n\t return [[-d, -d], [d, d]];\n\t })()\n\t};\n\t\n\texports['default'] = SphericalMercator;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 14 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\t/*\n\t * Transformation is an utility class to perform simple point transformations\n\t * through a 2d-matrix.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geometry/Transformation.js\n\t */\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar Transformation = (function () {\n\t function Transformation(a, b, c, d) {\n\t _classCallCheck(this, Transformation);\n\t\n\t this._a = a;\n\t this._b = b;\n\t this._c = c;\n\t this._d = d;\n\t }\n\t\n\t _createClass(Transformation, [{\n\t key: 'transform',\n\t value: function transform(point, scale) {\n\t // Copy input point as to not destroy the original data\n\t return this._transform(point.clone(), scale);\n\t }\n\t\n\t // Destructive transform (faster)\n\t }, {\n\t key: '_transform',\n\t value: function _transform(point, scale) {\n\t scale = scale || 1;\n\t\n\t point.x = scale * (this._a * point.x + this._b);\n\t point.y = scale * (this._c * point.y + this._d);\n\t return point;\n\t }\n\t }, {\n\t key: 'untransform',\n\t value: function untransform(point, scale) {\n\t scale = scale || 1;\n\t return (0, _geoPoint.point)((point.x / scale - this._b) / this._a, (point.y / scale - this._d) / this._c);\n\t }\n\t }]);\n\t\n\t return Transformation;\n\t})();\n\t\n\texports['default'] = Transformation;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 15 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.EPSG3395 (WGS 84 / World Mercator) CRS implementation.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3395.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionMercator = __webpack_require__(16);\n\t\n\tvar _projectionProjectionMercator2 = _interopRequireDefault(_projectionProjectionMercator);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _EPSG3395 = {\n\t code: 'EPSG:3395',\n\t projection: _projectionProjectionMercator2['default'],\n\t\n\t // Work out how to de-dupe this (scoping issue)\n\t transformScale: 1 / (Math.PI * _projectionProjectionMercator2['default'].R),\n\t\n\t // Scale and transformation inputs changed to account for central origin in\n\t // WebGL, instead of top-left origin used in Leaflet\n\t transformation: (function () {\n\t // TODO: Cannot use this.transformScale due to scope\n\t var scale = 1 / (Math.PI * _projectionProjectionMercator2['default'].R);\n\t\n\t return new _utilTransformation2['default'](scale, 0, -scale, 0);\n\t })()\n\t};\n\t\n\tvar EPSG3395 = (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _EPSG3395);\n\t\n\texports['default'] = EPSG3395;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t/*\n\t * Mercator projection that takes into account that the Earth is not a perfect\n\t * sphere. Less popular than spherical mercator; used by projections like\n\t * EPSG:3395.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.Mercator.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar Mercator = {\n\t // Radius / WGS84 semi-major axis\n\t R: 6378137,\n\t R_MINOR: 6356752.314245179,\n\t\n\t // WGS84 eccentricity\n\t ECC: 0.081819191,\n\t ECC2: 0.081819191 * 0.081819191,\n\t\n\t project: function project(latlon) {\n\t var d = Math.PI / 180;\n\t var r = this.R;\n\t var y = latlon.lat * d;\n\t var tmp = this.R_MINOR / r;\n\t var e = Math.sqrt(1 - tmp * tmp);\n\t var con = e * Math.sin(y);\n\t\n\t var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);\n\t y = -r * Math.log(Math.max(ts, 1E-10));\n\t\n\t return (0, _Point.point)(latlon.lon * d * r, y);\n\t },\n\t\n\t unproject: function unproject(point) {\n\t var d = 180 / Math.PI;\n\t var r = this.R;\n\t var tmp = this.R_MINOR / r;\n\t var e = Math.sqrt(1 - tmp * tmp);\n\t var ts = Math.exp(-point.y / r);\n\t var phi = Math.PI / 2 - 2 * Math.atan(ts);\n\t\n\t for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {\n\t con = e * Math.sin(phi);\n\t con = Math.pow((1 - con) / (1 + con), e / 2);\n\t dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;\n\t phi += dphi;\n\t }\n\t\n\t return (0, _LatLon.latLon)(phi * d, point.x * d / r);\n\t },\n\t\n\t // Scale factor for converting between real metres and projected metres\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t //\n\t // See pg.8: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n\t pointScale: function pointScale(latlon) {\n\t var rad = Math.PI / 180;\n\t var lat = latlon.lat * rad;\n\t var sinLat = Math.sin(lat);\n\t var sinLat2 = sinLat * sinLat;\n\t var cosLat = Math.cos(lat);\n\t\n\t var k = Math.sqrt(1 - this.ECC2 * sinLat2) / cosLat;\n\t\n\t // [scaleX, scaleY]\n\t return [k, k];\n\t },\n\t\n\t bounds: [[-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]]\n\t};\n\t\n\texports['default'] = Mercator;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 17 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.EPSG4326 is a CRS popular among advanced GIS specialists.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG4326.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionLatLon = __webpack_require__(18);\n\t\n\tvar _projectionProjectionLatLon2 = _interopRequireDefault(_projectionProjectionLatLon);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _EPSG4326 = {\n\t code: 'EPSG:4326',\n\t projection: _projectionProjectionLatLon2['default'],\n\t\n\t // Work out how to de-dupe this (scoping issue)\n\t transformScale: 1 / 180,\n\t\n\t // Scale and transformation inputs changed to account for central origin in\n\t // WebGL, instead of top-left origin used in Leaflet\n\t //\n\t // TODO: Cannot use this.transformScale due to scope\n\t transformation: new _utilTransformation2['default'](1 / 180, 0, -1 / 180, 0)\n\t};\n\t\n\tvar EPSG4326 = (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _EPSG4326);\n\t\n\texports['default'] = EPSG4326;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 18 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t/*\n\t * Simple equirectangular (Plate Carree) projection, used by CRS like EPSG:4326\n\t * and Simple.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.LonLat.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar ProjectionLatLon = {\n\t project: function project(latlon) {\n\t return (0, _Point.point)(latlon.lon, latlon.lat);\n\t },\n\t\n\t unproject: function unproject(point) {\n\t return (0, _LatLon.latLon)(point.y, point.x);\n\t },\n\t\n\t // Scale factor for converting between real metres and degrees\n\t //\n\t // degrees = realMetres * pointScale\n\t // realMetres = degrees / pointScale\n\t //\n\t // See: http://stackoverflow.com/questions/639695/how-to-convert-latitude-or-longitude-to-meters\n\t // See: http://gis.stackexchange.com/questions/75528/length-of-a-degree-where-do-the-terms-in-this-formula-come-from\n\t pointScale: function pointScale(latlon) {\n\t var m1 = 111132.92;\n\t var m2 = -559.82;\n\t var m3 = 1.175;\n\t var m4 = -0.0023;\n\t var p1 = 111412.84;\n\t var p2 = -93.5;\n\t var p3 = 0.118;\n\t\n\t var rad = Math.PI / 180;\n\t var lat = latlon.lat * rad;\n\t\n\t var latlen = m1 + m2 * Math.cos(2 * lat) + m3 * Math.cos(4 * lat) + m4 * Math.cos(6 * lat);\n\t var lonlen = p1 * Math.cos(lat) + p2 * Math.cos(3 * lat) + p3 * Math.cos(5 * lat);\n\t\n\t return [1 / latlen, 1 / lonlen];\n\t },\n\t\n\t bounds: [[-180, -90], [180, 90]]\n\t};\n\t\n\texports['default'] = ProjectionLatLon;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 19 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * A simple CRS that can be used for flat non-Earth maps like panoramas or game\n\t * maps.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Simple.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRS = __webpack_require__(9);\n\t\n\tvar _CRS2 = _interopRequireDefault(_CRS);\n\t\n\tvar _projectionProjectionLatLon = __webpack_require__(18);\n\t\n\tvar _projectionProjectionLatLon2 = _interopRequireDefault(_projectionProjectionLatLon);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _Simple = {\n\t projection: _projectionProjectionLatLon2['default'],\n\t\n\t // Straight 1:1 mapping (-1, -1 would be top-left)\n\t transformation: new _utilTransformation2['default'](1, 0, 1, 0),\n\t\n\t scale: function scale(zoom) {\n\t // If zoom is provided then return scale based on map tile zoom\n\t if (zoom) {\n\t return Math.pow(2, zoom);\n\t // Else, make no change to scale – may need to increase this or make it a\n\t // user-definable variable\n\t } else {\n\t return 1;\n\t }\n\t },\n\t\n\t zoom: function zoom(scale) {\n\t return Math.log(scale) / Math.LN2;\n\t },\n\t\n\t distance: function distance(latlon1, latlon2) {\n\t var dx = latlon2.lon - latlon1.lon;\n\t var dy = latlon2.lat - latlon1.lat;\n\t\n\t return Math.sqrt(dx * dx + dy * dy);\n\t },\n\t\n\t infinite: true\n\t};\n\t\n\tvar Simple = (0, _lodashAssign2['default'])({}, _CRS2['default'], _Simple);\n\t\n\texports['default'] = Simple;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 20 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.Proj4 for any Proj4-supported CRS.\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionProj4 = __webpack_require__(21);\n\t\n\tvar _projectionProjectionProj42 = _interopRequireDefault(_projectionProjectionProj4);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _Proj4 = function _Proj4(code, def, bounds) {\n\t var projection = (0, _projectionProjectionProj42['default'])(def, bounds);\n\t\n\t // Transformation calcuations\n\t var diffX = projection.bounds[1][0] - projection.bounds[0][0];\n\t var diffY = projection.bounds[1][1] - projection.bounds[0][1];\n\t\n\t var halfX = diffX / 2;\n\t var halfY = diffY / 2;\n\t\n\t // This is the raw scale factor\n\t var scaleX = 1 / halfX;\n\t var scaleY = 1 / halfY;\n\t\n\t // Find the minimum scale factor\n\t //\n\t // The minimum scale factor comes from the largest side and is the one\n\t // you want to use for both axis so they stay relative in dimension\n\t var scale = Math.min(scaleX, scaleY);\n\t\n\t // Find amount to offset each axis by to make the central point lie on\n\t // the [0,0] origin\n\t var offsetX = scale * (projection.bounds[0][0] + halfX);\n\t var offsetY = scale * (projection.bounds[0][1] + halfY);\n\t\n\t return {\n\t code: code,\n\t projection: projection,\n\t\n\t transformScale: scale,\n\t\n\t // Map the input to a [-1,1] range with [0,0] in the centre\n\t transformation: new _utilTransformation2['default'](scale, -offsetX, -scale, offsetY)\n\t };\n\t};\n\t\n\tvar Proj4 = function Proj4(code, def, bounds) {\n\t return (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _Proj4(code, def, bounds));\n\t};\n\t\n\texports['default'] = Proj4;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 21 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * Proj4 support for any projection.\n\t */\n\t\n\tvar _proj4 = __webpack_require__(22);\n\t\n\tvar _proj42 = _interopRequireDefault(_proj4);\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar Proj4 = function Proj4(def, bounds) {\n\t var proj = (0, _proj42['default'])(def);\n\t\n\t var project = function project(latlon) {\n\t return (0, _Point.point)(proj.forward([latlon.lon, latlon.lat]));\n\t };\n\t\n\t var unproject = function unproject(point) {\n\t var inverse = proj.inverse([point.x, point.y]);\n\t return (0, _LatLon.latLon)(inverse[1], inverse[0]);\n\t };\n\t\n\t return {\n\t project: project,\n\t unproject: unproject,\n\t\n\t // Scale factor for converting between real metres and projected metres\\\n\t //\n\t // Need to work out the best way to provide the pointScale calculations\n\t // for custom, unknown projections (if wanting to override default)\n\t //\n\t // For now, user can manually override crs.pointScale or\n\t // crs.projection.pointScale\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t pointScale: function pointScale(latlon, accurate) {\n\t return [1, 1];\n\t },\n\t\n\t // Try and calculate bounds if none are provided\n\t //\n\t // This will provide incorrect bounds for some projections, so perhaps make\n\t // bounds a required input instead\n\t bounds: (function () {\n\t if (bounds) {\n\t return bounds;\n\t } else {\n\t var bottomLeft = project([-90, -180]);\n\t var topRight = project([90, 180]);\n\t\n\t return [bottomLeft, topRight];\n\t }\n\t })()\n\t };\n\t};\n\t\n\texports['default'] = Proj4;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 22 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_22__;\n\n/***/ },\n/* 23 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Scene = __webpack_require__(25);\n\t\n\tvar _Scene2 = _interopRequireDefault(_Scene);\n\t\n\tvar _DOMScene3D = __webpack_require__(26);\n\t\n\tvar _DOMScene3D2 = _interopRequireDefault(_DOMScene3D);\n\t\n\tvar _DOMScene2D = __webpack_require__(27);\n\t\n\tvar _DOMScene2D2 = _interopRequireDefault(_DOMScene2D);\n\t\n\tvar _Renderer = __webpack_require__(28);\n\t\n\tvar _Renderer2 = _interopRequireDefault(_Renderer);\n\t\n\tvar _DOMRenderer3D = __webpack_require__(29);\n\t\n\tvar _DOMRenderer3D2 = _interopRequireDefault(_DOMRenderer3D);\n\t\n\tvar _DOMRenderer2D = __webpack_require__(31);\n\t\n\tvar _DOMRenderer2D2 = _interopRequireDefault(_DOMRenderer2D);\n\t\n\tvar _Camera = __webpack_require__(33);\n\t\n\tvar _Camera2 = _interopRequireDefault(_Camera);\n\t\n\tvar _Picking = __webpack_require__(34);\n\t\n\tvar _Picking2 = _interopRequireDefault(_Picking);\n\t\n\tvar _EffectComposer = __webpack_require__(36);\n\t\n\tvar _EffectComposer2 = _interopRequireDefault(_EffectComposer);\n\t\n\tvar _vendorRenderPass = __webpack_require__(41);\n\t\n\tvar _vendorRenderPass2 = _interopRequireDefault(_vendorRenderPass);\n\t\n\tvar _vendorShaderPass = __webpack_require__(39);\n\t\n\tvar _vendorShaderPass2 = _interopRequireDefault(_vendorShaderPass);\n\t\n\tvar _vendorCopyShader = __webpack_require__(38);\n\t\n\tvar _vendorCopyShader2 = _interopRequireDefault(_vendorCopyShader);\n\t\n\tvar _vendorHorizontalTiltShiftShader = __webpack_require__(42);\n\t\n\tvar _vendorHorizontalTiltShiftShader2 = _interopRequireDefault(_vendorHorizontalTiltShiftShader);\n\t\n\tvar _vendorVerticalTiltShiftShader = __webpack_require__(43);\n\t\n\tvar _vendorVerticalTiltShiftShader2 = _interopRequireDefault(_vendorVerticalTiltShiftShader);\n\t\n\tvar _vendorFXAAShader = __webpack_require__(44);\n\t\n\tvar _vendorFXAAShader2 = _interopRequireDefault(_vendorFXAAShader);\n\t\n\tvar Engine = (function (_EventEmitter) {\n\t _inherits(Engine, _EventEmitter);\n\t\n\t function Engine(container, world) {\n\t _classCallCheck(this, Engine);\n\t\n\t console.log('Init Engine');\n\t\n\t _get(Object.getPrototypeOf(Engine.prototype), 'constructor', this).call(this);\n\t\n\t this._world = world;\n\t\n\t this._scene = _Scene2['default'];\n\t this._domScene3D = _DOMScene3D2['default'];\n\t this._domScene2D = _DOMScene2D2['default'];\n\t\n\t var antialias = this._world.options.postProcessing ? false : true;\n\t this._renderer = (0, _Renderer2['default'])(container, antialias);\n\t this._domRenderer3D = (0, _DOMRenderer3D2['default'])(container);\n\t this._domRenderer2D = (0, _DOMRenderer2D2['default'])(container);\n\t\n\t this._camera = (0, _Camera2['default'])(container);\n\t\n\t this._container = container;\n\t\n\t // TODO: Make this optional\n\t this._picking = (0, _Picking2['default'])(this._world, this._renderer, this._camera);\n\t\n\t this.clock = new _three2['default'].Clock();\n\t\n\t this._frustum = new _three2['default'].Frustum();\n\t\n\t if (this._world.options.postProcessing) {\n\t this._initPostProcessing();\n\t }\n\t }\n\t\n\t // TODO: Set up composer to automatically resize on viewport change\n\t // TODO: Update passes that rely on width / height on resize\n\t // TODO: Merge default passes into a single shader / pass for performance\n\t\n\t _createClass(Engine, [{\n\t key: '_initPostProcessing',\n\t value: function _initPostProcessing() {\n\t var renderPass = new _vendorRenderPass2['default'](this._scene, this._camera);\n\t\n\t // TODO: Look at using @mattdesl's optimised FXAA shader\n\t // https://github.com/mattdesl/three-shader-fxaa\n\t var fxaaPass = new _vendorShaderPass2['default'](_vendorFXAAShader2['default']);\n\t\n\t var hblurPass = new _vendorShaderPass2['default'](_vendorHorizontalTiltShiftShader2['default']);\n\t var vblurPass = new _vendorShaderPass2['default'](_vendorVerticalTiltShiftShader2['default']);\n\t var bluriness = 5;\n\t\n\t hblurPass.uniforms.r.value = vblurPass.uniforms.r.value = 0.6;\n\t\n\t var copyPass = new _vendorShaderPass2['default'](_vendorCopyShader2['default']);\n\t copyPass.renderToScreen = true;\n\t\n\t this._composer = (0, _EffectComposer2['default'])(this._renderer, this._container);\n\t\n\t this._composer.addPass(renderPass);\n\t this._composer.addPass(fxaaPass);\n\t this._composer.addPass(hblurPass);\n\t this._composer.addPass(vblurPass);\n\t this._composer.addPass(copyPass);\n\t\n\t var self = this;\n\t var updatePostProcessingSize = function updatePostProcessingSize() {\n\t var width = self._container.clientWidth;\n\t var height = self._container.clientHeight;\n\t\n\t var pixelRatio = window.devicePixelRatio;\n\t\n\t fxaaPass.uniforms.resolution.value.set(1 / (width * pixelRatio), 1 / (height * pixelRatio));\n\t\n\t hblurPass.uniforms.h.value = bluriness / (width * pixelRatio);\n\t vblurPass.uniforms.v.value = bluriness / (height * pixelRatio);\n\t };\n\t\n\t updatePostProcessingSize();\n\t window.addEventListener('resize', updatePostProcessingSize, false);\n\t }\n\t }, {\n\t key: 'update',\n\t value: function update(delta) {\n\t this.emit('preRender');\n\t\n\t if (this._world.options.postProcessing) {\n\t this._composer.render(delta);\n\t } else {\n\t this._renderer.render(this._scene, this._camera);\n\t }\n\t\n\t // Render picking scene\n\t // this._renderer.render(this._picking._pickingScene, this._camera);\n\t\n\t // Render DOM scenes\n\t this._domRenderer3D.render(this._domScene3D, this._camera);\n\t this._domRenderer2D.render(this._domScene2D, this._camera);\n\t\n\t this.emit('postRender');\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Remove any remaining objects from scene\n\t var child;\n\t for (var i = this._scene.children.length - 1; i >= 0; i--) {\n\t child = this._scene.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._scene.remove(child);\n\t\n\t if (child.geometry) {\n\t // Dispose of mesh and materials\n\t child.geometry.dispose();\n\t child.geometry = null;\n\t }\n\t\n\t if (child.material) {\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t }\n\t };\n\t\n\t for (var i = this._domScene3D.children.length - 1; i >= 0; i--) {\n\t child = this._domScene3D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._domScene3D.remove(child);\n\t };\n\t\n\t for (var i = this._domScene2D.children.length - 1; i >= 0; i--) {\n\t child = this._domScene2D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._domScene2D.remove(child);\n\t };\n\t\n\t this._picking.destroy();\n\t this._picking = null;\n\t\n\t this._world = null;\n\t this._scene = null;\n\t this._domScene3D = null;\n\t this._domScene2D = null;\n\t\n\t this._composer = null;\n\t this._renderer = null;\n\t\n\t this._domRenderer3D = null;\n\t this._domRenderer2D = null;\n\t this._camera = null;\n\t this._clock = null;\n\t this._frustum = null;\n\t }\n\t }]);\n\t\n\t return Engine;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = Engine;\n\t\n\t// // Initialise without requiring new keyword\n\t// export default function(container, world) {\n\t// return new Engine(container, world);\n\t// };\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 24 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_24__;\n\n/***/ },\n/* 25 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.scene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t\n\t // TODO: Re-enable when this works with the skybox\n\t // scene.fog = new THREE.Fog(0xffffff, 1, 15000);\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 26 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.scene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 27 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.scene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 28 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Scene = __webpack_require__(25);\n\t\n\tvar _Scene2 = _interopRequireDefault(_Scene);\n\t\n\t// This can only be accessed from Engine.renderer if you want to reference the\n\t// same scene in multiple places\n\t\n\texports['default'] = function (container, antialias) {\n\t var renderer = new _three2['default'].WebGLRenderer({\n\t antialias: antialias\n\t });\n\t\n\t // TODO: Re-enable when this works with the skybox\n\t // renderer.setClearColor(Scene.fog.color, 1);\n\t\n\t renderer.setClearColor(0xffffff, 1);\n\t renderer.setPixelRatio(window.devicePixelRatio);\n\t\n\t // Gamma settings make things look nicer\n\t renderer.gammaInput = true;\n\t renderer.gammaOutput = true;\n\t\n\t renderer.shadowMap.enabled = true;\n\t\n\t // TODO: Work out which of the shadowmap types is best\n\t // https://github.com/mrdoob/three.js/blob/r56/src/Three.js#L107\n\t // renderer.shadowMap.type = THREE.PCFSoftShadowMap;\n\t\n\t // TODO: Check that leaving this as default (CullFrontFace) is right\n\t // renderer.shadowMap.cullFace = THREE.CullFaceBack;\n\t\n\t container.appendChild(renderer.domElement);\n\t\n\t var updateSize = function updateSize() {\n\t renderer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return renderer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 29 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorCSS3DRenderer = __webpack_require__(30);\n\t\n\tvar _DOMScene3D = __webpack_require__(26);\n\t\n\tvar _DOMScene3D2 = _interopRequireDefault(_DOMScene3D);\n\t\n\t// This can only be accessed from Engine.renderer if you want to reference the\n\t// same scene in multiple places\n\t\n\texports['default'] = function (container) {\n\t var renderer = new _vendorCSS3DRenderer.CSS3DRenderer();\n\t\n\t renderer.domElement.style.position = 'absolute';\n\t renderer.domElement.style.top = 0;\n\t\n\t container.appendChild(renderer.domElement);\n\t\n\t var updateSize = function updateSize() {\n\t renderer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return renderer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 30 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\t/**\n\t * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs\n\t * @author mrdoob / http://mrdoob.com/\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar CSS3DObject = function CSS3DObject(element) {\n\t\n\t\t_three2['default'].Object3D.call(this);\n\t\n\t\tthis.element = element;\n\t\tthis.element.style.position = 'absolute';\n\t\n\t\tthis.addEventListener('removed', function (event) {\n\t\n\t\t\tif (this.element.parentNode !== null) {\n\t\n\t\t\t\tthis.element.parentNode.removeChild(this.element);\n\t\t\t}\n\t\t});\n\t};\n\t\n\tCSS3DObject.prototype = Object.create(_three2['default'].Object3D.prototype);\n\tCSS3DObject.prototype.constructor = CSS3DObject;\n\t\n\tvar CSS3DSprite = function CSS3DSprite(element) {\n\t\n\t\tCSS3DObject.call(this, element);\n\t};\n\t\n\tCSS3DSprite.prototype = Object.create(CSS3DObject.prototype);\n\tCSS3DSprite.prototype.constructor = CSS3DSprite;\n\t\n\t//\n\t\n\tvar CSS3DRenderer = function CSS3DRenderer() {\n\t\n\t\tconsole.log('THREE.CSS3DRenderer', _three2['default'].REVISION);\n\t\n\t\tvar _width, _height;\n\t\tvar _widthHalf, _heightHalf;\n\t\n\t\tvar matrix = new _three2['default'].Matrix4();\n\t\n\t\tvar cache = {\n\t\t\tcamera: { fov: 0, style: '' },\n\t\t\tobjects: {}\n\t\t};\n\t\n\t\tvar domElement = document.createElement('div');\n\t\tdomElement.style.overflow = 'hidden';\n\t\n\t\tdomElement.style.WebkitTransformStyle = 'preserve-3d';\n\t\tdomElement.style.MozTransformStyle = 'preserve-3d';\n\t\tdomElement.style.oTransformStyle = 'preserve-3d';\n\t\tdomElement.style.transformStyle = 'preserve-3d';\n\t\n\t\tthis.domElement = domElement;\n\t\n\t\tvar cameraElement = document.createElement('div');\n\t\n\t\tcameraElement.style.WebkitTransformStyle = 'preserve-3d';\n\t\tcameraElement.style.MozTransformStyle = 'preserve-3d';\n\t\tcameraElement.style.oTransformStyle = 'preserve-3d';\n\t\tcameraElement.style.transformStyle = 'preserve-3d';\n\t\n\t\tdomElement.appendChild(cameraElement);\n\t\n\t\tthis.setClearColor = function () {};\n\t\n\t\tthis.getSize = function () {\n\t\n\t\t\treturn {\n\t\t\t\twidth: _width,\n\t\t\t\theight: _height\n\t\t\t};\n\t\t};\n\t\n\t\tthis.setSize = function (width, height) {\n\t\n\t\t\t_width = width;\n\t\t\t_height = height;\n\t\n\t\t\t_widthHalf = _width / 2;\n\t\t\t_heightHalf = _height / 2;\n\t\n\t\t\tdomElement.style.width = width + 'px';\n\t\t\tdomElement.style.height = height + 'px';\n\t\n\t\t\tcameraElement.style.width = width + 'px';\n\t\t\tcameraElement.style.height = height + 'px';\n\t\t};\n\t\n\t\tvar epsilon = function epsilon(value) {\n\t\n\t\t\treturn Math.abs(value) < Number.EPSILON ? 0 : value;\n\t\t};\n\t\n\t\tvar getCameraCSSMatrix = function getCameraCSSMatrix(matrix) {\n\t\n\t\t\tvar elements = matrix.elements;\n\t\n\t\t\treturn 'matrix3d(' + epsilon(elements[0]) + ',' + epsilon(-elements[1]) + ',' + epsilon(elements[2]) + ',' + epsilon(elements[3]) + ',' + epsilon(elements[4]) + ',' + epsilon(-elements[5]) + ',' + epsilon(elements[6]) + ',' + epsilon(elements[7]) + ',' + epsilon(elements[8]) + ',' + epsilon(-elements[9]) + ',' + epsilon(elements[10]) + ',' + epsilon(elements[11]) + ',' + epsilon(elements[12]) + ',' + epsilon(-elements[13]) + ',' + epsilon(elements[14]) + ',' + epsilon(elements[15]) + ')';\n\t\t};\n\t\n\t\tvar getObjectCSSMatrix = function getObjectCSSMatrix(matrix) {\n\t\n\t\t\tvar elements = matrix.elements;\n\t\n\t\t\treturn 'translate3d(-50%,-50%,0) matrix3d(' + epsilon(elements[0]) + ',' + epsilon(elements[1]) + ',' + epsilon(elements[2]) + ',' + epsilon(elements[3]) + ',' + epsilon(-elements[4]) + ',' + epsilon(-elements[5]) + ',' + epsilon(-elements[6]) + ',' + epsilon(-elements[7]) + ',' + epsilon(elements[8]) + ',' + epsilon(elements[9]) + ',' + epsilon(elements[10]) + ',' + epsilon(elements[11]) + ',' + epsilon(elements[12]) + ',' + epsilon(elements[13]) + ',' + epsilon(elements[14]) + ',' + epsilon(elements[15]) + ')';\n\t\t};\n\t\n\t\tvar renderObject = function renderObject(object, camera) {\n\t\n\t\t\tif (object instanceof CSS3DObject) {\n\t\n\t\t\t\tvar style;\n\t\n\t\t\t\tif (object instanceof CSS3DSprite) {\n\t\n\t\t\t\t\t// http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/\n\t\n\t\t\t\t\tmatrix.copy(camera.matrixWorldInverse);\n\t\t\t\t\tmatrix.transpose();\n\t\t\t\t\tmatrix.copyPosition(object.matrixWorld);\n\t\t\t\t\tmatrix.scale(object.scale);\n\t\n\t\t\t\t\tmatrix.elements[3] = 0;\n\t\t\t\t\tmatrix.elements[7] = 0;\n\t\t\t\t\tmatrix.elements[11] = 0;\n\t\t\t\t\tmatrix.elements[15] = 1;\n\t\n\t\t\t\t\tstyle = getObjectCSSMatrix(matrix);\n\t\t\t\t} else {\n\t\n\t\t\t\t\tstyle = getObjectCSSMatrix(object.matrixWorld);\n\t\t\t\t}\n\t\n\t\t\t\tvar element = object.element;\n\t\t\t\tvar cachedStyle = cache.objects[object.id];\n\t\n\t\t\t\tif (cachedStyle === undefined || cachedStyle !== style) {\n\t\n\t\t\t\t\telement.style.WebkitTransform = style;\n\t\t\t\t\telement.style.MozTransform = style;\n\t\t\t\t\telement.style.oTransform = style;\n\t\t\t\t\telement.style.transform = style;\n\t\n\t\t\t\t\tcache.objects[object.id] = style;\n\t\t\t\t}\n\t\n\t\t\t\tif (element.parentNode !== cameraElement) {\n\t\n\t\t\t\t\tcameraElement.appendChild(element);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tfor (var i = 0, l = object.children.length; i < l; i++) {\n\t\n\t\t\t\trenderObject(object.children[i], camera);\n\t\t\t}\n\t\t};\n\t\n\t\tthis.render = function (scene, camera) {\n\t\n\t\t\tvar fov = 0.5 / Math.tan(_three2['default'].Math.degToRad(camera.fov * 0.5)) * _height;\n\t\n\t\t\tif (cache.camera.fov !== fov) {\n\t\n\t\t\t\tdomElement.style.WebkitPerspective = fov + 'px';\n\t\t\t\tdomElement.style.MozPerspective = fov + 'px';\n\t\t\t\tdomElement.style.oPerspective = fov + 'px';\n\t\t\t\tdomElement.style.perspective = fov + 'px';\n\t\n\t\t\t\tcache.camera.fov = fov;\n\t\t\t}\n\t\n\t\t\tscene.updateMatrixWorld();\n\t\n\t\t\tif (camera.parent === null) camera.updateMatrixWorld();\n\t\n\t\t\tcamera.matrixWorldInverse.getInverse(camera.matrixWorld);\n\t\n\t\t\tvar style = 'translate3d(0,0,' + fov + 'px)' + getCameraCSSMatrix(camera.matrixWorldInverse) + ' translate3d(' + _widthHalf + 'px,' + _heightHalf + 'px, 0)';\n\t\n\t\t\tif (cache.camera.style !== style) {\n\t\n\t\t\t\tcameraElement.style.WebkitTransform = style;\n\t\t\t\tcameraElement.style.MozTransform = style;\n\t\t\t\tcameraElement.style.oTransform = style;\n\t\t\t\tcameraElement.style.transform = style;\n\t\n\t\t\t\tcache.camera.style = style;\n\t\t\t}\n\t\n\t\t\trenderObject(scene, camera);\n\t\t};\n\t};\n\t\n\texports.CSS3DObject = CSS3DObject;\n\texports.CSS3DSprite = CSS3DSprite;\n\texports.CSS3DRenderer = CSS3DRenderer;\n\t\n\t_three2['default'].CSS3DObject = CSS3DObject;\n\t_three2['default'].CSS3DSprite = CSS3DSprite;\n\t_three2['default'].CSS3DRenderer = CSS3DRenderer;\n\n/***/ },\n/* 31 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorCSS2DRenderer = __webpack_require__(32);\n\t\n\tvar _DOMScene2D = __webpack_require__(27);\n\t\n\tvar _DOMScene2D2 = _interopRequireDefault(_DOMScene2D);\n\t\n\t// This can only be accessed from Engine.renderer if you want to reference the\n\t// same scene in multiple places\n\t\n\texports['default'] = function (container) {\n\t var renderer = new _vendorCSS2DRenderer.CSS2DRenderer();\n\t\n\t renderer.domElement.style.position = 'absolute';\n\t renderer.domElement.style.top = 0;\n\t\n\t container.appendChild(renderer.domElement);\n\t\n\t var updateSize = function updateSize() {\n\t renderer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return renderer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 32 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\t/**\n\t * @author mrdoob / http://mrdoob.com/\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar CSS2DObject = function CSS2DObject(element) {\n\t\n\t\t_three2['default'].Object3D.call(this);\n\t\n\t\tthis.element = element;\n\t\tthis.element.style.position = 'absolute';\n\t\n\t\tthis.addEventListener('removed', function (event) {\n\t\n\t\t\tif (this.element.parentNode !== null) {\n\t\n\t\t\t\tthis.element.parentNode.removeChild(this.element);\n\t\t\t}\n\t\t});\n\t};\n\t\n\tCSS2DObject.prototype = Object.create(_three2['default'].Object3D.prototype);\n\tCSS2DObject.prototype.constructor = CSS2DObject;\n\t\n\t//\n\t\n\tvar CSS2DRenderer = function CSS2DRenderer() {\n\t\n\t\tconsole.log('THREE.CSS2DRenderer', _three2['default'].REVISION);\n\t\n\t\tvar _width, _height;\n\t\tvar _widthHalf, _heightHalf;\n\t\n\t\tvar vector = new _three2['default'].Vector3();\n\t\tvar viewMatrix = new _three2['default'].Matrix4();\n\t\tvar viewProjectionMatrix = new _three2['default'].Matrix4();\n\t\n\t\tvar domElement = document.createElement('div');\n\t\tdomElement.style.overflow = 'hidden';\n\t\n\t\tthis.domElement = domElement;\n\t\n\t\tthis.setSize = function (width, height) {\n\t\n\t\t\t_width = width;\n\t\t\t_height = height;\n\t\n\t\t\t_widthHalf = _width / 2;\n\t\t\t_heightHalf = _height / 2;\n\t\n\t\t\tdomElement.style.width = width + 'px';\n\t\t\tdomElement.style.height = height + 'px';\n\t\t};\n\t\n\t\tvar renderObject = function renderObject(object, camera) {\n\t\n\t\t\tif (object instanceof CSS2DObject) {\n\t\n\t\t\t\tvector.setFromMatrixPosition(object.matrixWorld);\n\t\t\t\tvector.applyProjection(viewProjectionMatrix);\n\t\n\t\t\t\tvar element = object.element;\n\t\t\t\tvar style = 'translate(-50%,-50%) translate(' + (vector.x * _widthHalf + _widthHalf) + 'px,' + (-vector.y * _heightHalf + _heightHalf) + 'px)';\n\t\n\t\t\t\telement.style.WebkitTransform = style;\n\t\t\t\telement.style.MozTransform = style;\n\t\t\t\telement.style.oTransform = style;\n\t\t\t\telement.style.transform = style;\n\t\n\t\t\t\tif (element.parentNode !== domElement) {\n\t\n\t\t\t\t\tdomElement.appendChild(element);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tfor (var i = 0, l = object.children.length; i < l; i++) {\n\t\n\t\t\t\trenderObject(object.children[i], camera);\n\t\t\t}\n\t\t};\n\t\n\t\tthis.render = function (scene, camera) {\n\t\n\t\t\tscene.updateMatrixWorld();\n\t\n\t\t\tif (camera.parent === null) camera.updateMatrixWorld();\n\t\n\t\t\tcamera.matrixWorldInverse.getInverse(camera.matrixWorld);\n\t\n\t\t\tviewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld));\n\t\t\tviewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, viewMatrix);\n\t\n\t\t\trenderObject(scene, camera);\n\t\t};\n\t};\n\t\n\texports.CSS2DObject = CSS2DObject;\n\texports.CSS2DRenderer = CSS2DRenderer;\n\t\n\t_three2['default'].CSS2DObject = CSS2DObject;\n\t_three2['default'].CSS2DRenderer = CSS2DRenderer;\n\n/***/ },\n/* 33 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can only be accessed from Engine.camera if you want to reference the\n\t// same scene in multiple places\n\t\n\t// TODO: Ensure that FOV looks natural on all aspect ratios\n\t// http://stackoverflow.com/q/26655930/997339\n\t\n\texports['default'] = function (container) {\n\t var camera = new _three2['default'].PerspectiveCamera(45, 1, 1, 200000);\n\t camera.position.y = 400;\n\t camera.position.z = 400;\n\t\n\t var updateSize = function updateSize() {\n\t camera.aspect = container.clientWidth / container.clientHeight;\n\t camera.updateProjectionMatrix();\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return camera;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 34 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _PickingScene = __webpack_require__(35);\n\t\n\tvar _PickingScene2 = _interopRequireDefault(_PickingScene);\n\t\n\t// TODO: Look into a way of setting this up without passing in a renderer and\n\t// camera from the engine\n\t\n\t// TODO: Add a basic indicator on or around the mouse pointer when it is over\n\t// something pickable / clickable\n\t//\n\t// A simple transparent disc or ring at the mouse point should work to start, or\n\t// even just changing the cursor to the CSS 'pointer' style\n\t//\n\t// Probably want this on mousemove with a throttled update as not to spam the\n\t// picking method\n\t//\n\t// Relies upon the picking method not redrawing the scene every call due to\n\t// the way TileLayer invalidates the picking scene\n\t\n\tvar nextId = 1;\n\t\n\tvar Picking = (function () {\n\t function Picking(world, renderer, camera) {\n\t _classCallCheck(this, Picking);\n\t\n\t this._world = world;\n\t this._renderer = renderer;\n\t this._camera = camera;\n\t\n\t this._raycaster = new _three2['default'].Raycaster();\n\t\n\t // TODO: Match this with the line width used in the picking layers\n\t this._raycaster.linePrecision = 3;\n\t\n\t this._pickingScene = _PickingScene2['default'];\n\t this._pickingTexture = new _three2['default'].WebGLRenderTarget();\n\t this._pickingTexture.texture.minFilter = _three2['default'].LinearFilter;\n\t this._pickingTexture.texture.generateMipmaps = false;\n\t\n\t this._nextId = 1;\n\t\n\t this._resizeTexture();\n\t this._initEvents();\n\t }\n\t\n\t // Initialise without requiring new keyword\n\t\n\t _createClass(Picking, [{\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t window.addEventListener('resize', this._resizeTexture.bind(this), false);\n\t\n\t // this._renderer.domElement.addEventListener('mousemove', this._onMouseMove.bind(this), false);\n\t this._world._container.addEventListener('mouseup', this._onMouseUp.bind(this), false);\n\t\n\t this._world.on('move', this._onWorldMove, this);\n\t }\n\t }, {\n\t key: '_onMouseUp',\n\t value: function _onMouseUp(event) {\n\t // Only react to main button click\n\t if (event.button !== 0) {\n\t return;\n\t }\n\t\n\t var point = (0, _geoPoint.point)(event.clientX, event.clientY);\n\t\n\t var normalisedPoint = (0, _geoPoint.point)(0, 0);\n\t normalisedPoint.x = point.x / this._width * 2 - 1;\n\t normalisedPoint.y = -(point.y / this._height) * 2 + 1;\n\t\n\t this._pick(point, normalisedPoint);\n\t }\n\t }, {\n\t key: '_onWorldMove',\n\t value: function _onWorldMove() {\n\t this._needUpdate = true;\n\t }\n\t\n\t // TODO: Ensure this doesn't get out of sync issue with the renderer resize\n\t }, {\n\t key: '_resizeTexture',\n\t value: function _resizeTexture() {\n\t var size = this._renderer.getSize();\n\t\n\t this._width = size.width;\n\t this._height = size.height;\n\t\n\t this._pickingTexture.setSize(this._width, this._height);\n\t this._pixelBuffer = new Uint8Array(4 * this._width * this._height);\n\t\n\t this._needUpdate = true;\n\t }\n\t\n\t // TODO: Make this only re-draw the scene if both an update is needed and the\n\t // camera has moved since the last update\n\t //\n\t // Otherwise it re-draws the scene on every click due to the way LOD updates\n\t // work in TileLayer – spamming this.add() and this.remove()\n\t //\n\t // TODO: Pause updates during map move / orbit / zoom as this is unlikely to\n\t // be a point in time where the user cares for picking functionality\n\t }, {\n\t key: '_update',\n\t value: function _update() {\n\t if (this._needUpdate) {\n\t var texture = this._pickingTexture;\n\t\n\t this._renderer.render(this._pickingScene, this._camera, this._pickingTexture);\n\t\n\t // Read the rendering texture\n\t this._renderer.readRenderTargetPixels(texture, 0, 0, texture.width, texture.height, this._pixelBuffer);\n\t\n\t this._needUpdate = false;\n\t }\n\t }\n\t }, {\n\t key: '_pick',\n\t value: function _pick(point, normalisedPoint) {\n\t this._update();\n\t\n\t var index = point.x + (this._pickingTexture.height - point.y) * this._pickingTexture.width;\n\t\n\t // Interpret the pixel as an ID\n\t var id = this._pixelBuffer[index * 4 + 2] * 255 * 255 + this._pixelBuffer[index * 4 + 1] * 255 + this._pixelBuffer[index * 4 + 0];\n\t\n\t // Skip if ID is 16646655 (white) as the background returns this\n\t if (id === 16646655) {\n\t return;\n\t }\n\t\n\t this._raycaster.setFromCamera(normalisedPoint, this._camera);\n\t\n\t // Perform ray intersection on picking scene\n\t //\n\t // TODO: Only perform intersection test on the relevant picking mesh\n\t var intersects = this._raycaster.intersectObjects(this._pickingScene.children, true);\n\t\n\t var _point2d = point.clone();\n\t\n\t var _point3d;\n\t if (intersects.length > 0) {\n\t _point3d = intersects[0].point.clone();\n\t }\n\t\n\t // Pass along as much data as possible for now until we know more about how\n\t // people use the picking API and what the returned data should be\n\t //\n\t // TODO: Look into the leak potential for passing so much by reference here\n\t this._world.emit('pick', id, _point2d, _point3d, intersects);\n\t this._world.emit('pick-' + id, _point2d, _point3d, intersects);\n\t }\n\t\n\t // Add mesh to picking scene\n\t //\n\t // Picking ID should already be added as an attribute\n\t }, {\n\t key: 'add',\n\t value: function add(mesh) {\n\t this._pickingScene.add(mesh);\n\t this._needUpdate = true;\n\t }\n\t\n\t // Remove mesh from picking scene\n\t }, {\n\t key: 'remove',\n\t value: function remove(mesh) {\n\t this._pickingScene.remove(mesh);\n\t this._needUpdate = true;\n\t }\n\t\n\t // Returns next ID to use for picking\n\t }, {\n\t key: 'getNextId',\n\t value: function getNextId() {\n\t return nextId++;\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // TODO: Find a way to properly remove these listeners as they stay\n\t // active at the moment\n\t window.removeEventListener('resize', this._resizeTexture, false);\n\t this._renderer.domElement.removeEventListener('mouseup', this._onMouseUp, false);\n\t this._world.off('move', this._onWorldMove);\n\t\n\t if (this._pickingScene.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._pickingScene.children.length - 1; i >= 0; i--) {\n\t child = this._pickingScene.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._pickingScene.remove(child);\n\t\n\t // Probably not a good idea to dispose of geometry due to it being\n\t // shared with the non-picking scene\n\t // if (child.geometry) {\n\t // // Dispose of mesh and materials\n\t // child.geometry.dispose();\n\t // child.geometry = null;\n\t // }\n\t\n\t if (child.material) {\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t }\n\t }\n\t }\n\t\n\t this._pickingScene = null;\n\t this._pickingTexture = null;\n\t this._pixelBuffer = null;\n\t\n\t this._world = null;\n\t this._renderer = null;\n\t this._camera = null;\n\t }\n\t }]);\n\t\n\t return Picking;\n\t})();\n\t\n\texports['default'] = function (world, renderer, camera) {\n\t return new Picking(world, renderer, camera);\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 35 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.pickingScene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 36 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorEffectComposer = __webpack_require__(37);\n\t\n\tvar _vendorEffectComposer2 = _interopRequireDefault(_vendorEffectComposer);\n\t\n\texports['default'] = function (renderer, container) {\n\t var composer = new _vendorEffectComposer2['default'](renderer);\n\t\n\t var updateSize = function updateSize() {\n\t composer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return composer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 37 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _CopyShader = __webpack_require__(38);\n\t\n\tvar _CopyShader2 = _interopRequireDefault(_CopyShader);\n\t\n\tvar _ShaderPass = __webpack_require__(39);\n\t\n\tvar _ShaderPass2 = _interopRequireDefault(_ShaderPass);\n\t\n\tvar _MaskPass = __webpack_require__(40);\n\t\n\tvar _MaskPass2 = _interopRequireDefault(_MaskPass);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t */\n\t\n\tvar EffectComposer = function EffectComposer(renderer, renderTarget) {\n\t\n\t\tthis.renderer = renderer;\n\t\n\t\tif (renderTarget === undefined) {\n\t\n\t\t\tvar pixelRatio = renderer.getPixelRatio();\n\t\n\t\t\tvar width = Math.floor(renderer.context.canvas.width / pixelRatio) || 1;\n\t\t\tvar height = Math.floor(renderer.context.canvas.height / pixelRatio) || 1;\n\t\t\tvar parameters = { minFilter: _three2['default'].LinearFilter, magFilter: _three2['default'].LinearFilter, format: _three2['default'].RGBAFormat, stencilBuffer: false };\n\t\n\t\t\trenderTarget = new _three2['default'].WebGLRenderTarget(width, height, parameters);\n\t\t}\n\t\n\t\tthis.renderTarget1 = renderTarget;\n\t\tthis.renderTarget2 = renderTarget.clone();\n\t\n\t\tthis.writeBuffer = this.renderTarget1;\n\t\tthis.readBuffer = this.renderTarget2;\n\t\n\t\tthis.passes = [];\n\t\n\t\tif (_CopyShader2['default'] === undefined) console.error(\"EffectComposer relies on THREE.CopyShader\");\n\t\n\t\tthis.copyPass = new _ShaderPass2['default'](_CopyShader2['default']);\n\t};\n\t\n\tEffectComposer.prototype = {\n\t\n\t\tswapBuffers: function swapBuffers() {\n\t\n\t\t\tvar tmp = this.readBuffer;\n\t\t\tthis.readBuffer = this.writeBuffer;\n\t\t\tthis.writeBuffer = tmp;\n\t\t},\n\t\n\t\taddPass: function addPass(pass) {\n\t\n\t\t\tthis.passes.push(pass);\n\t\t},\n\t\n\t\tinsertPass: function insertPass(pass, index) {\n\t\n\t\t\tthis.passes.splice(index, 0, pass);\n\t\t},\n\t\n\t\trender: function render(delta) {\n\t\n\t\t\tthis.writeBuffer = this.renderTarget1;\n\t\t\tthis.readBuffer = this.renderTarget2;\n\t\n\t\t\tvar maskActive = false;\n\t\n\t\t\tvar pass,\n\t\t\t i,\n\t\t\t il = this.passes.length;\n\t\n\t\t\tfor (i = 0; i < il; i++) {\n\t\n\t\t\t\tpass = this.passes[i];\n\t\n\t\t\t\tif (!pass.enabled) continue;\n\t\n\t\t\t\tpass.render(this.renderer, this.writeBuffer, this.readBuffer, delta, maskActive);\n\t\n\t\t\t\tif (pass.needsSwap) {\n\t\n\t\t\t\t\tif (maskActive) {\n\t\n\t\t\t\t\t\tvar context = this.renderer.context;\n\t\n\t\t\t\t\t\tcontext.stencilFunc(context.NOTEQUAL, 1, 0xffffffff);\n\t\n\t\t\t\t\t\tthis.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, delta);\n\t\n\t\t\t\t\t\tcontext.stencilFunc(context.EQUAL, 1, 0xffffffff);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tthis.swapBuffers();\n\t\t\t\t}\n\t\n\t\t\t\tif (pass instanceof _MaskPass2['default']) {\n\t\n\t\t\t\t\tmaskActive = true;\n\t\t\t\t} else if (pass instanceof _MaskPass.ClearMaskPass) {\n\t\n\t\t\t\t\tmaskActive = false;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\treset: function reset(renderTarget) {\n\t\n\t\t\tif (renderTarget === undefined) {\n\t\n\t\t\t\trenderTarget = this.renderTarget1.clone();\n\t\n\t\t\t\tvar pixelRatio = this.renderer.getPixelRatio();\n\t\n\t\t\t\trenderTarget.setSize(Math.floor(this.renderer.context.canvas.width / pixelRatio), Math.floor(this.renderer.context.canvas.height / pixelRatio));\n\t\t\t}\n\t\n\t\t\tthis.renderTarget1.dispose();\n\t\t\tthis.renderTarget1 = renderTarget;\n\t\t\tthis.renderTarget2.dispose();\n\t\t\tthis.renderTarget2 = renderTarget.clone();\n\t\n\t\t\tthis.writeBuffer = this.renderTarget1;\n\t\t\tthis.readBuffer = this.renderTarget2;\n\t\t},\n\t\n\t\tsetSize: function setSize(width, height) {\n\t\n\t\t\tthis.renderTarget1.setSize(width, height);\n\t\t\tthis.renderTarget2.setSize(width, height);\n\t\t}\n\t\n\t};\n\t\n\texports['default'] = EffectComposer;\n\t\n\t_three2['default'].EffectComposer = EffectComposer;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 38 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t *\n\t * Full-screen textured quad shader\n\t */\n\t\n\tvar CopyShader = {\n\t\n\t\tuniforms: {\n\t\n\t\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\t\"opacity\": { type: \"f\", value: 1.0 }\n\t\n\t\t},\n\t\n\t\tvertexShader: [\"varying vec2 vUv;\", \"void main() {\", \"vUv = uv;\", \"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\", \"}\"].join(\"\\n\"),\n\t\n\t\tfragmentShader: [\"uniform float opacity;\", \"uniform sampler2D tDiffuse;\", \"varying vec2 vUv;\", \"void main() {\", \"vec4 texel = texture2D( tDiffuse, vUv );\", \"gl_FragColor = opacity * texel;\", \"}\"].join(\"\\n\")\n\t\n\t};\n\t\n\texports[\"default\"] = CopyShader;\n\t\n\t_three2[\"default\"].CopyShader = CopyShader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 39 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t */\n\t\n\tvar ShaderPass = function ShaderPass(shader, textureID) {\n\t\n\t\tthis.textureID = textureID !== undefined ? textureID : \"tDiffuse\";\n\t\n\t\tif (shader instanceof _three2[\"default\"].ShaderMaterial) {\n\t\n\t\t\tthis.uniforms = shader.uniforms;\n\t\n\t\t\tthis.material = shader;\n\t\t} else if (shader) {\n\t\n\t\t\tthis.uniforms = _three2[\"default\"].UniformsUtils.clone(shader.uniforms);\n\t\n\t\t\tthis.material = new _three2[\"default\"].ShaderMaterial({\n\t\n\t\t\t\tdefines: shader.defines || {},\n\t\t\t\tuniforms: this.uniforms,\n\t\t\t\tvertexShader: shader.vertexShader,\n\t\t\t\tfragmentShader: shader.fragmentShader\n\t\n\t\t\t});\n\t\t}\n\t\n\t\tthis.renderToScreen = false;\n\t\n\t\tthis.enabled = true;\n\t\tthis.needsSwap = true;\n\t\tthis.clear = false;\n\t\n\t\tthis.camera = new _three2[\"default\"].OrthographicCamera(-1, 1, 1, -1, 0, 1);\n\t\tthis.scene = new _three2[\"default\"].Scene();\n\t\n\t\tthis.quad = new _three2[\"default\"].Mesh(new _three2[\"default\"].PlaneBufferGeometry(2, 2), null);\n\t\tthis.scene.add(this.quad);\n\t};\n\t\n\tShaderPass.prototype = {\n\t\n\t\trender: function render(renderer, writeBuffer, readBuffer, delta) {\n\t\n\t\t\tif (this.uniforms[this.textureID]) {\n\t\n\t\t\t\tthis.uniforms[this.textureID].value = readBuffer;\n\t\t\t}\n\t\n\t\t\tthis.quad.material = this.material;\n\t\n\t\t\tif (this.renderToScreen) {\n\t\n\t\t\t\trenderer.render(this.scene, this.camera);\n\t\t\t} else {\n\t\n\t\t\t\trenderer.render(this.scene, this.camera, writeBuffer, this.clear);\n\t\t\t}\n\t\t}\n\t\n\t};\n\t\n\texports[\"default\"] = ShaderPass;\n\t\n\t_three2[\"default\"].ShaderPass = ShaderPass;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 40 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t */\n\t\n\tvar MaskPass = function MaskPass(scene, camera) {\n\t\n\t\tthis.scene = scene;\n\t\tthis.camera = camera;\n\t\n\t\tthis.enabled = true;\n\t\tthis.clear = true;\n\t\tthis.needsSwap = false;\n\t\n\t\tthis.inverse = false;\n\t};\n\t\n\tMaskPass.prototype = {\n\t\n\t\trender: function render(renderer, writeBuffer, readBuffer, delta) {\n\t\n\t\t\tvar context = renderer.context;\n\t\n\t\t\t// don't update color or depth\n\t\n\t\t\tcontext.colorMask(false, false, false, false);\n\t\t\tcontext.depthMask(false);\n\t\n\t\t\t// set up stencil\n\t\n\t\t\tvar writeValue, clearValue;\n\t\n\t\t\tif (this.inverse) {\n\t\n\t\t\t\twriteValue = 0;\n\t\t\t\tclearValue = 1;\n\t\t\t} else {\n\t\n\t\t\t\twriteValue = 1;\n\t\t\t\tclearValue = 0;\n\t\t\t}\n\t\n\t\t\tcontext.enable(context.STENCIL_TEST);\n\t\t\tcontext.stencilOp(context.REPLACE, context.REPLACE, context.REPLACE);\n\t\t\tcontext.stencilFunc(context.ALWAYS, writeValue, 0xffffffff);\n\t\t\tcontext.clearStencil(clearValue);\n\t\n\t\t\t// draw into the stencil buffer\n\t\n\t\t\trenderer.render(this.scene, this.camera, readBuffer, this.clear);\n\t\t\trenderer.render(this.scene, this.camera, writeBuffer, this.clear);\n\t\n\t\t\t// re-enable update of color and depth\n\t\n\t\t\tcontext.colorMask(true, true, true, true);\n\t\t\tcontext.depthMask(true);\n\t\n\t\t\t// only render where stencil is set to 1\n\t\n\t\t\tcontext.stencilFunc(context.EQUAL, 1, 0xffffffff); // draw if == 1\n\t\t\tcontext.stencilOp(context.KEEP, context.KEEP, context.KEEP);\n\t\t}\n\t\n\t};\n\t\n\tvar ClearMaskPass = function ClearMaskPass() {\n\t\n\t\tthis.enabled = true;\n\t};\n\t\n\tClearMaskPass.prototype = {\n\t\n\t\trender: function render(renderer, writeBuffer, readBuffer, delta) {\n\t\n\t\t\tvar context = renderer.context;\n\t\n\t\t\tcontext.disable(context.STENCIL_TEST);\n\t\t}\n\t\n\t};\n\t\n\texports['default'] = MaskPass;\n\texports.ClearMaskPass = ClearMaskPass;\n\t\n\t_three2['default'].MaskPass = MaskPass;\n\t_three2['default'].ClearMaskPass = ClearMaskPass;\n\n/***/ },\n/* 41 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t */\n\t\n\tvar RenderPass = function RenderPass(scene, camera, overrideMaterial, clearColor, clearAlpha) {\n\t\n\t\tthis.scene = scene;\n\t\tthis.camera = camera;\n\t\n\t\tthis.overrideMaterial = overrideMaterial;\n\t\n\t\tthis.clearColor = clearColor;\n\t\tthis.clearAlpha = clearAlpha !== undefined ? clearAlpha : 1;\n\t\n\t\tthis.oldClearColor = new _three2['default'].Color();\n\t\tthis.oldClearAlpha = 1;\n\t\n\t\tthis.enabled = true;\n\t\tthis.clear = true;\n\t\tthis.needsSwap = false;\n\t};\n\t\n\tRenderPass.prototype = {\n\t\n\t\trender: function render(renderer, writeBuffer, readBuffer, delta) {\n\t\n\t\t\tthis.scene.overrideMaterial = this.overrideMaterial;\n\t\n\t\t\tif (this.clearColor) {\n\t\n\t\t\t\tthis.oldClearColor.copy(renderer.getClearColor());\n\t\t\t\tthis.oldClearAlpha = renderer.getClearAlpha();\n\t\n\t\t\t\trenderer.setClearColor(this.clearColor, this.clearAlpha);\n\t\t\t}\n\t\n\t\t\trenderer.render(this.scene, this.camera, readBuffer, this.clear);\n\t\n\t\t\tif (this.clearColor) {\n\t\n\t\t\t\trenderer.setClearColor(this.oldClearColor, this.oldClearAlpha);\n\t\t\t}\n\t\n\t\t\tthis.scene.overrideMaterial = null;\n\t\t}\n\t\n\t};\n\t\n\texports['default'] = RenderPass;\n\t\n\t_three2['default'].RenderPass = RenderPass;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 42 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t *\n\t * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position\n\t *\n\t * - 9 samples per pass\n\t * - standard deviation 2.7\n\t * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n\t * - \"r\" parameter control where \"focused\" horizontal line lies\n\t */\n\t\n\tvar HorizontalTiltShiftShader = {\n\t\n\t\tuniforms: {\n\t\n\t\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\t\"h\": { type: \"f\", value: 1.0 / 512.0 },\n\t\t\t\"r\": { type: \"f\", value: 0.35 }\n\t\n\t\t},\n\t\n\t\tvertexShader: [\"varying vec2 vUv;\", \"void main() {\", \"vUv = uv;\", \"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\", \"}\"].join(\"\\n\"),\n\t\n\t\tfragmentShader: [\"uniform sampler2D tDiffuse;\", \"uniform float h;\", \"uniform float r;\", \"varying vec2 vUv;\", \"void main() {\", \"vec4 sum = vec4( 0.0 );\", \"float hh = h * abs( r - vUv.y );\", \"sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;\", \"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;\", \"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;\", \"sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\", \"sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;\", \"sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;\", \"sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;\", \"sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;\", \"gl_FragColor = sum;\", \"}\"].join(\"\\n\")\n\t\n\t};\n\t\n\texports[\"default\"] = HorizontalTiltShiftShader;\n\t\n\t_three2[\"default\"].HorizontalTiltShiftShader = HorizontalTiltShiftShader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 43 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t *\n\t * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position\n\t *\n\t * - 9 samples per pass\n\t * - standard deviation 2.7\n\t * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n\t * - \"r\" parameter control where \"focused\" horizontal line lies\n\t */\n\t\n\tvar VerticalTiltShiftShader = {\n\t\n\t\tuniforms: {\n\t\n\t\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\t\"v\": { type: \"f\", value: 1.0 / 512.0 },\n\t\t\t\"r\": { type: \"f\", value: 0.35 }\n\t\n\t\t},\n\t\n\t\tvertexShader: [\"varying vec2 vUv;\", \"void main() {\", \"vUv = uv;\", \"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\", \"}\"].join(\"\\n\"),\n\t\n\t\tfragmentShader: [\"uniform sampler2D tDiffuse;\", \"uniform float v;\", \"uniform float r;\", \"varying vec2 vUv;\", \"void main() {\", \"vec4 sum = vec4( 0.0 );\", \"float vv = v * abs( r - vUv.y );\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;\", \"gl_FragColor = sum;\", \"}\"].join(\"\\n\")\n\t\n\t};\n\t\n\texports[\"default\"] = VerticalTiltShiftShader;\n\t\n\t_three2[\"default\"].VerticalTiltShiftShader = VerticalTiltShiftShader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 44 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t * @author davidedc / http://www.sketchpatch.net/\n\t *\n\t * NVIDIA FXAA by Timothy Lottes\n\t * http://timothylottes.blogspot.com/2011/06/fxaa3-source-released.html\n\t * - WebGL port by @supereggbert\n\t * http://www.glge.org/demos/fxaa/\n\t */\n\t\n\tvar FXAAShader = {\n\t\n\t\tuniforms: {\n\t\n\t\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\t\"resolution\": { type: \"v2\", value: new _three2[\"default\"].Vector2(1 / 1024, 1 / 512) }\n\t\n\t\t},\n\t\n\t\tvertexShader: [\"void main() {\", \"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\", \"}\"].join(\"\\n\"),\n\t\n\t\tfragmentShader: [\"uniform sampler2D tDiffuse;\", \"uniform vec2 resolution;\", \"#define FXAA_REDUCE_MIN (1.0/128.0)\", \"#define FXAA_REDUCE_MUL (1.0/8.0)\", \"#define FXAA_SPAN_MAX 8.0\", \"void main() {\", \"vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;\", \"vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;\", \"vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;\", \"vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;\", \"vec4 rgbaM = texture2D( tDiffuse, gl_FragCoord.xy * resolution );\", \"vec3 rgbM = rgbaM.xyz;\", \"vec3 luma = vec3( 0.299, 0.587, 0.114 );\", \"float lumaNW = dot( rgbNW, luma );\", \"float lumaNE = dot( rgbNE, luma );\", \"float lumaSW = dot( rgbSW, luma );\", \"float lumaSE = dot( rgbSE, luma );\", \"float lumaM = dot( rgbM, luma );\", \"float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\", \"float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\", \"vec2 dir;\", \"dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\", \"dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\", \"float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\", \"float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\", \"dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\", \"max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\", \"dir * rcpDirMin)) * resolution;\", \"vec4 rgbA = (1.0/2.0) * (\", \"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (1.0/3.0 - 0.5)) +\", \"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (2.0/3.0 - 0.5)));\", \"vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (\", \"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (0.0/3.0 - 0.5)) +\", \"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (3.0/3.0 - 0.5)));\", \"float lumaB = dot(rgbB, vec4(luma, 0.0));\", \"if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {\", \"gl_FragColor = rgbA;\", \"} else {\", \"gl_FragColor = rgbB;\", \"}\", \"}\"].join(\"\\n\")\n\t\n\t};\n\t\n\texports[\"default\"] = FXAAShader;\n\t\n\t_three2[\"default\"].FXAAShader = FXAAShader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 45 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Layer2 = __webpack_require__(46);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Skybox = __webpack_require__(47);\n\t\n\tvar _Skybox2 = _interopRequireDefault(_Skybox);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\tvar EnvironmentLayer = (function (_Layer) {\n\t _inherits(EnvironmentLayer, _Layer);\n\t\n\t function EnvironmentLayer(options) {\n\t _classCallCheck(this, EnvironmentLayer);\n\t\n\t var defaults = {\n\t skybox: false\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(EnvironmentLayer.prototype), 'constructor', this).call(this, _options);\n\t }\n\t\n\t _createClass(EnvironmentLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd() {\n\t this._initLights();\n\t\n\t if (this._options.skybox) {\n\t this._initSkybox();\n\t }\n\t\n\t // this._initGrid();\n\t }\n\t\n\t // Not fleshed out or thought through yet\n\t //\n\t // Lights could potentially be put it their own 'layer' to keep this class\n\t // much simpler and less messy\n\t }, {\n\t key: '_initLights',\n\t value: function _initLights() {\n\t // Position doesn't really matter (the angle is important), however it's\n\t // used here so the helpers look more natural.\n\t\n\t if (!this._options.skybox) {\n\t var directionalLight = new _three2['default'].DirectionalLight(0xffffff, 1);\n\t directionalLight.position.x = 1000;\n\t directionalLight.position.y = 1000;\n\t directionalLight.position.z = 1000;\n\t\n\t // TODO: Get shadows working in non-PBR scenes\n\t\n\t // directionalLight.castShadow = true;\n\t //\n\t // var d = 100;\n\t // directionalLight.shadow.camera.left = -d;\n\t // directionalLight.shadow.camera.right = d;\n\t // directionalLight.shadow.camera.top = d;\n\t // directionalLight.shadow.camera.bottom = -d;\n\t //\n\t // directionalLight.shadow.camera.near = 10;\n\t // directionalLight.shadow.camera.far = 100;\n\t //\n\t // // TODO: Need to dial in on a good shadowmap size\n\t // directionalLight.shadow.mapSize.width = 2048;\n\t // directionalLight.shadow.mapSize.height = 2048;\n\t //\n\t // // directionalLight.shadowBias = -0.0010;\n\t // // directionalLight.shadow.darkness = 0.15;\n\t\n\t var directionalLight2 = new _three2['default'].DirectionalLight(0xffffff, 0.5);\n\t directionalLight2.position.x = -1000;\n\t directionalLight2.position.y = 1000;\n\t directionalLight2.position.z = -1000;\n\t\n\t // var helper = new THREE.DirectionalLightHelper(directionalLight, 10);\n\t // var helper2 = new THREE.DirectionalLightHelper(directionalLight2, 10);\n\t\n\t this.add(directionalLight);\n\t this.add(directionalLight2);\n\t\n\t // this.add(helper);\n\t // this.add(helper2);\n\t } else {\n\t // Directional light that will be projected from the sun\n\t this._skyboxLight = new _three2['default'].DirectionalLight(0xffffff, 1);\n\t\n\t this._skyboxLight.castShadow = true;\n\t\n\t var d = 1000;\n\t this._skyboxLight.shadow.camera.left = -d;\n\t this._skyboxLight.shadow.camera.right = d;\n\t this._skyboxLight.shadow.camera.top = d;\n\t this._skyboxLight.shadow.camera.bottom = -d;\n\t\n\t this._skyboxLight.shadow.camera.near = 10000;\n\t this._skyboxLight.shadow.camera.far = 70000;\n\t\n\t // TODO: Need to dial in on a good shadowmap size\n\t this._skyboxLight.shadow.mapSize.width = 2048;\n\t this._skyboxLight.shadow.mapSize.height = 2048;\n\t\n\t // this._skyboxLight.shadowBias = -0.0010;\n\t // this._skyboxLight.shadow.darkness = 0.15;\n\t\n\t // this._object3D.add(new THREE.CameraHelper(this._skyboxLight.shadow.camera));\n\t\n\t this.add(this._skyboxLight);\n\t }\n\t }\n\t }, {\n\t key: '_initSkybox',\n\t value: function _initSkybox() {\n\t this._skybox = new _Skybox2['default'](this._world, this._skyboxLight);\n\t this.add(this._skybox._mesh);\n\t }\n\t\n\t // Add grid helper for context during initial development\n\t }, {\n\t key: '_initGrid',\n\t value: function _initGrid() {\n\t var size = 4000;\n\t var step = 100;\n\t\n\t var gridHelper = new _three2['default'].GridHelper(size, step);\n\t this.add(gridHelper);\n\t }\n\t\n\t // Clean up environment\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._skyboxLight = null;\n\t\n\t this.remove(this._skybox._mesh);\n\t this._skybox.destroy();\n\t this._skybox = null;\n\t\n\t _get(Object.getPrototypeOf(EnvironmentLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return EnvironmentLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = EnvironmentLayer;\n\t\n\tvar noNew = function noNew(options) {\n\t return new EnvironmentLayer(options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.environmentLayer = noNew;\n\n/***/ },\n/* 46 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _engineScene = __webpack_require__(25);\n\t\n\tvar _engineScene2 = _interopRequireDefault(_engineScene);\n\t\n\tvar _vendorCSS3DRenderer = __webpack_require__(30);\n\t\n\tvar _vendorCSS2DRenderer = __webpack_require__(32);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Need a single move method that handles moving all the various object\n\t// layers so that the DOM layers stay in sync with the 3D layer\n\t\n\t// TODO: Double check that objects within the _object3D Object3D parent are frustum\n\t// culled even if the layer position stays at the default (0,0,0) and the child\n\t// objects are positioned much further away\n\t//\n\t// Or does the layer being at (0,0,0) prevent the child objects from being\n\t// culled because the layer parent is effectively always in view even if the\n\t// child is actually out of camera\n\t\n\tvar Layer = (function (_EventEmitter) {\n\t _inherits(Layer, _EventEmitter);\n\t\n\t function Layer(options) {\n\t _classCallCheck(this, Layer);\n\t\n\t _get(Object.getPrototypeOf(Layer.prototype), 'constructor', this).call(this);\n\t\n\t var defaults = {\n\t output: true,\n\t outputToScene: true\n\t };\n\t\n\t this._options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t if (this.isOutput()) {\n\t this._object3D = new _three2['default'].Object3D();\n\t\n\t this._dom3D = document.createElement('div');\n\t this._domObject3D = new _vendorCSS3DRenderer.CSS3DObject(this._dom3D);\n\t\n\t this._dom2D = document.createElement('div');\n\t this._domObject2D = new _vendorCSS2DRenderer.CSS2DObject(this._dom2D);\n\t }\n\t }\n\t\n\t // Add THREE object directly to layer\n\t\n\t _createClass(Layer, [{\n\t key: 'add',\n\t value: function add(object) {\n\t this._object3D.add(object);\n\t }\n\t\n\t // Remove THREE object from to layer\n\t }, {\n\t key: 'remove',\n\t value: function remove(object) {\n\t this._object3D.remove(object);\n\t }\n\t }, {\n\t key: 'addDOM3D',\n\t value: function addDOM3D(object) {\n\t this._domObject3D.add(object);\n\t }\n\t }, {\n\t key: 'removeDOM3D',\n\t value: function removeDOM3D(object) {\n\t this._domObject3D.remove(object);\n\t }\n\t }, {\n\t key: 'addDOM2D',\n\t value: function addDOM2D(object) {\n\t this._domObject2D.add(object);\n\t }\n\t }, {\n\t key: 'removeDOM2D',\n\t value: function removeDOM2D(object) {\n\t this._domObject2D.remove(object);\n\t }\n\t\n\t // Add layer to world instance and store world reference\n\t }, {\n\t key: 'addTo',\n\t value: function addTo(world) {\n\t world.addLayer(this);\n\t return this;\n\t }\n\t\n\t // Internal method called by World.addLayer to actually add the layer\n\t }, {\n\t key: '_addToWorld',\n\t value: function _addToWorld(world) {\n\t this._world = world;\n\t this._onAdd(world);\n\t this.emit('added');\n\t }\n\t }, {\n\t key: '_onAdd',\n\t value: function _onAdd(world) {}\n\t }, {\n\t key: 'getPickingId',\n\t value: function getPickingId() {\n\t if (this._world._engine._picking) {\n\t return this._world._engine._picking.getNextId();\n\t }\n\t\n\t return false;\n\t }\n\t\n\t // TODO: Tidy this up and don't access so many private properties to work\n\t }, {\n\t key: 'addToPicking',\n\t value: function addToPicking(object) {\n\t if (!this._world._engine._picking) {\n\t return;\n\t }\n\t\n\t this._world._engine._picking.add(object);\n\t }\n\t }, {\n\t key: 'removeFromPicking',\n\t value: function removeFromPicking(object) {\n\t if (!this._world._engine._picking) {\n\t return;\n\t }\n\t\n\t this._world._engine._picking.remove(object);\n\t }\n\t }, {\n\t key: 'isOutput',\n\t value: function isOutput() {\n\t return this._options.output;\n\t }\n\t }, {\n\t key: 'isOutputToScene',\n\t value: function isOutputToScene() {\n\t return this._options.outputToScene;\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._object3D && this._object3D.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._object3D.children.length - 1; i >= 0; i--) {\n\t child = this._object3D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this.remove(child);\n\t\n\t if (child.geometry) {\n\t // Dispose of mesh and materials\n\t child.geometry.dispose();\n\t child.geometry = null;\n\t }\n\t\n\t if (child.material) {\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t }\n\t }\n\t }\n\t\n\t if (this._domObject3D && this._domObject3D.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._domObject3D.children.length - 1; i >= 0; i--) {\n\t child = this._domObject3D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this.removeDOM3D(child);\n\t }\n\t }\n\t\n\t if (this._domObject2D && this._domObject2D.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._domObject2D.children.length - 1; i >= 0; i--) {\n\t child = this._domObject2D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this.removeDOM2D(child);\n\t }\n\t }\n\t\n\t this._domObject3D = null;\n\t this._domObject2D = null;\n\t\n\t this._world = null;\n\t this._object3D = null;\n\t }\n\t }]);\n\t\n\t return Layer;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = Layer;\n\t\n\tvar noNew = function noNew(options) {\n\t return new Layer(options);\n\t};\n\t\n\texports.layer = noNew;\n\n/***/ },\n/* 47 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Sky = __webpack_require__(48);\n\t\n\tvar _Sky2 = _interopRequireDefault(_Sky);\n\t\n\tvar _lodashThrottle = __webpack_require__(49);\n\t\n\tvar _lodashThrottle2 = _interopRequireDefault(_lodashThrottle);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\tvar cubemap = {\n\t vertexShader: ['varying vec3 vPosition;', 'void main() {', 'vPosition = position;', 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\\n'),\n\t\n\t fragmentShader: ['uniform samplerCube cubemap;', 'varying vec3 vPosition;', 'void main() {', 'gl_FragColor = textureCube(cubemap, normalize(vPosition));', '}'].join('\\n')\n\t};\n\t\n\tvar Skybox = (function () {\n\t function Skybox(world, light) {\n\t _classCallCheck(this, Skybox);\n\t\n\t this._world = world;\n\t this._light = light;\n\t\n\t this._settings = {\n\t distance: 38000,\n\t turbidity: 10,\n\t reileigh: 2,\n\t mieCoefficient: 0.005,\n\t mieDirectionalG: 0.8,\n\t luminance: 1,\n\t // 0.48 is a cracking dusk / sunset\n\t // 0.4 is a beautiful early-morning / late-afternoon\n\t // 0.2 is a nice day time\n\t inclination: 0.48, // Elevation / inclination\n\t azimuth: 0.25 };\n\t\n\t // Facing front\n\t this._initSkybox();\n\t this._updateUniforms();\n\t this._initEvents();\n\t }\n\t\n\t _createClass(Skybox, [{\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t // Throttled to 1 per 100ms\n\t this._throttledWorldUpdate = (0, _lodashThrottle2['default'])(this._update, 100);\n\t this._world.on('preUpdate', this._throttledWorldUpdate, this);\n\t }\n\t }, {\n\t key: '_initSkybox',\n\t value: function _initSkybox() {\n\t // Cube camera for skybox\n\t this._cubeCamera = new _three2['default'].CubeCamera(1, 2000000, 128);\n\t\n\t // Cube material\n\t var cubeTarget = this._cubeCamera.renderTarget;\n\t\n\t // Add Sky Mesh\n\t this._sky = new _Sky2['default']();\n\t this._skyScene = new _three2['default'].Scene();\n\t this._skyScene.add(this._sky.mesh);\n\t\n\t // Add Sun Helper\n\t this._sunSphere = new _three2['default'].Mesh(new _three2['default'].SphereBufferGeometry(2000, 16, 8), new _three2['default'].MeshBasicMaterial({\n\t color: 0xffffff\n\t }));\n\t\n\t // TODO: This isn't actually visible because it's not added to the layer\n\t // this._sunSphere.visible = true;\n\t\n\t var skyboxUniforms = {\n\t cubemap: { type: 't', value: cubeTarget }\n\t };\n\t\n\t var skyboxMat = new _three2['default'].ShaderMaterial({\n\t uniforms: skyboxUniforms,\n\t vertexShader: cubemap.vertexShader,\n\t fragmentShader: cubemap.fragmentShader,\n\t side: _three2['default'].BackSide\n\t });\n\t\n\t this._mesh = new _three2['default'].Mesh(new _three2['default'].BoxGeometry(190000, 190000, 190000), skyboxMat);\n\t\n\t this._updateSkybox = true;\n\t }\n\t }, {\n\t key: '_updateUniforms',\n\t value: function _updateUniforms() {\n\t var settings = this._settings;\n\t var uniforms = this._sky.uniforms;\n\t uniforms.turbidity.value = settings.turbidity;\n\t uniforms.reileigh.value = settings.reileigh;\n\t uniforms.luminance.value = settings.luminance;\n\t uniforms.mieCoefficient.value = settings.mieCoefficient;\n\t uniforms.mieDirectionalG.value = settings.mieDirectionalG;\n\t\n\t var theta = Math.PI * (settings.inclination - 0.5);\n\t var phi = 2 * Math.PI * (settings.azimuth - 0.5);\n\t\n\t this._sunSphere.position.x = settings.distance * Math.cos(phi);\n\t this._sunSphere.position.y = settings.distance * Math.sin(phi) * Math.sin(theta);\n\t this._sunSphere.position.z = settings.distance * Math.sin(phi) * Math.cos(theta);\n\t\n\t // Move directional light to sun position\n\t this._light.position.copy(this._sunSphere.position);\n\t\n\t this._sky.uniforms.sunPosition.value.copy(this._sunSphere.position);\n\t }\n\t }, {\n\t key: '_update',\n\t value: function _update(delta) {\n\t if (this._updateSkybox) {\n\t this._updateSkybox = false;\n\t } else {\n\t return;\n\t }\n\t\n\t // if (!this._angle) {\n\t // this._angle = 0;\n\t // }\n\t //\n\t // // Animate inclination\n\t // this._angle += Math.PI * delta;\n\t // this._settings.inclination = 0.5 * (Math.sin(this._angle) / 2 + 0.5);\n\t\n\t // Update light intensity depending on elevation of sun (day to night)\n\t this._light.intensity = 1 - 0.95 * (this._settings.inclination / 0.5);\n\t\n\t // // console.log(delta, this._angle, this._settings.inclination);\n\t //\n\t // TODO: Only do this when the uniforms have been changed\n\t this._updateUniforms();\n\t\n\t // TODO: Only do this when the cubemap has actually changed\n\t this._cubeCamera.updateCubeMap(this._world._engine._renderer, this._skyScene);\n\t }\n\t }, {\n\t key: 'getRenderTarget',\n\t value: function getRenderTarget() {\n\t return this._cubeCamera.renderTarget;\n\t }\n\t }, {\n\t key: 'setInclination',\n\t value: function setInclination(inclination) {\n\t this._settings.inclination = inclination;\n\t this._updateSkybox = true;\n\t }\n\t\n\t // Destroy the skybox and remove it from memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._world.off('preUpdate', this._throttledWorldUpdate);\n\t this._throttledWorldUpdate = null;\n\t\n\t this._world = null;\n\t this._light = null;\n\t\n\t this._cubeCamera = null;\n\t\n\t this._sky.mesh.geometry.dispose();\n\t this._sky.mesh.geometry = null;\n\t\n\t if (this._sky.mesh.material.map) {\n\t this._sky.mesh.material.map.dispose();\n\t this._sky.mesh.material.map = null;\n\t }\n\t\n\t this._sky.mesh.material.dispose();\n\t this._sky.mesh.material = null;\n\t\n\t this._sky.mesh = null;\n\t this._sky = null;\n\t\n\t this._skyScene = null;\n\t\n\t this._sunSphere.geometry.dispose();\n\t this._sunSphere.geometry = null;\n\t\n\t if (this._sunSphere.material.map) {\n\t this._sunSphere.material.map.dispose();\n\t this._sunSphere.material.map = null;\n\t }\n\t\n\t this._sunSphere.material.dispose();\n\t this._sunSphere.material = null;\n\t\n\t this._sunSphere = null;\n\t\n\t this._mesh.geometry.dispose();\n\t this._mesh.geometry = null;\n\t\n\t if (this._mesh.material.map) {\n\t this._mesh.material.map.dispose();\n\t this._mesh.material.map = null;\n\t }\n\t\n\t this._mesh.material.dispose();\n\t this._mesh.material = null;\n\t }\n\t }]);\n\t\n\t return Skybox;\n\t})();\n\t\n\texports['default'] = Skybox;\n\t\n\tvar noNew = function noNew(world, light) {\n\t return new Skybox(world, light);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.skybox = noNew;\n\n/***/ },\n/* 48 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/*eslint eqeqeq:0*/\n\t\n\t/**\n\t * @author zz85 / https://github.com/zz85\n\t *\n\t * Based on 'A Practical Analytic Model for Daylight'\n\t * aka The Preetham Model, the de facto standard analytic skydome model\n\t * http://www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf\n\t *\n\t * First implemented by Simon Wallner\n\t * http://www.simonwallner.at/projects/atmospheric-scattering\n\t *\n\t * Improved by Martin Upitis\n\t * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n\t *\n\t * Three.js integration by zz85 http://twitter.com/blurspline\n\t*/\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t_three2['default'].ShaderLib['sky'] = {\n\t\n\t\tuniforms: {\n\t\n\t\t\tluminance: { type: 'f', value: 1 },\n\t\t\tturbidity: { type: 'f', value: 2 },\n\t\t\treileigh: { type: 'f', value: 1 },\n\t\t\tmieCoefficient: { type: 'f', value: 0.005 },\n\t\t\tmieDirectionalG: { type: 'f', value: 0.8 },\n\t\t\tsunPosition: { type: 'v3', value: new _three2['default'].Vector3() }\n\t\n\t\t},\n\t\n\t\tvertexShader: ['varying vec3 vWorldPosition;', 'void main() {', 'vec4 worldPosition = modelMatrix * vec4( position, 1.0 );', 'vWorldPosition = worldPosition.xyz;', 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\\n'),\n\t\n\t\tfragmentShader: ['uniform sampler2D skySampler;', 'uniform vec3 sunPosition;', 'varying vec3 vWorldPosition;', 'vec3 cameraPos = vec3(0., 0., 0.);', '// uniform sampler2D sDiffuse;', '// const float turbidity = 10.0; //', '// const float reileigh = 2.; //', '// const float luminance = 1.0; //', '// const float mieCoefficient = 0.005;', '// const float mieDirectionalG = 0.8;', 'uniform float luminance;', 'uniform float turbidity;', 'uniform float reileigh;', 'uniform float mieCoefficient;', 'uniform float mieDirectionalG;', '// constants for atmospheric scattering', 'const float e = 2.71828182845904523536028747135266249775724709369995957;', 'const float pi = 3.141592653589793238462643383279502884197169;', 'const float n = 1.0003; // refractive index of air', 'const float N = 2.545E25; // number of molecules per unit volume for air at', '// 288.15K and 1013mb (sea level -45 celsius)', 'const float pn = 0.035;\t// depolatization factor for standard air', '// wavelength of used primaries, according to preetham', 'const vec3 lambda = vec3(680E-9, 550E-9, 450E-9);', '// mie stuff', '// K coefficient for the primaries', 'const vec3 K = vec3(0.686, 0.678, 0.666);', 'const float v = 4.0;', '// optical length at zenith for molecules', 'const float rayleighZenithLength = 8.4E3;', 'const float mieZenithLength = 1.25E3;', 'const vec3 up = vec3(0.0, 1.0, 0.0);', 'const float EE = 1000.0;', 'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;', '// 66 arc seconds -> degrees, and the cosine of that', '// earth shadow hack', 'const float cutoffAngle = pi/1.95;', 'const float steepness = 1.5;', 'vec3 totalRayleigh(vec3 lambda)', '{', 'return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));', '}',\n\t\n\t\t// see http://blenderartists.org/forum/showthread.php?321110-Shaders-and-Skybox-madness\n\t\t'// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE', 'vec3 simplifiedRayleigh()', '{', 'return 0.0005 / vec3(94, 40, 18);',\n\t\t// return 0.00054532832366 / (3.0 * 2.545E25 * pow(vec3(680E-9, 550E-9, 450E-9), vec3(4.0)) * 6.245);\n\t\t'}', 'float rayleighPhase(float cosTheta)', '{\t ', 'return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));', '//\treturn (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));', '//\treturn (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));', '}', 'vec3 totalMie(vec3 lambda, vec3 K, float T)', '{', 'float c = (0.2 * T ) * 10E-18;', 'return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;', '}', 'float hgPhase(float cosTheta, float g)', '{', 'return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));', '}', 'float sunIntensity(float zenithAngleCos)', '{', 'return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));', '}', '// float logLuminance(vec3 c)', '// {', '// \treturn log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);', '// }', '// Filmic ToneMapping http://filmicgames.com/archives/75', 'float A = 0.15;', 'float B = 0.50;', 'float C = 0.10;', 'float D = 0.20;', 'float E = 0.02;', 'float F = 0.30;', 'float W = 1000.0;', 'vec3 Uncharted2Tonemap(vec3 x)', '{', 'return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;', '}', 'void main() ', '{', 'float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);', '// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;', '// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);', 'float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));', 'vec3 sunDirection = normalize(sunPosition);', 'float sunE = sunIntensity(dot(sunDirection, up));', '// extinction (absorbtion + out scattering) ', '// rayleigh coefficients',\n\t\n\t\t// 'vec3 betaR = totalRayleigh(lambda) * reileighCoefficient;',\n\t\t'vec3 betaR = simplifiedRayleigh() * reileighCoefficient;', '// mie coefficients', 'vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;', '// optical length', '// cutoff angle at 90 to avoid singularity in next formula.', 'float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));', 'float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));', 'float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));', '// combined extinction factor\t', 'vec3 Fex = exp(-(betaR * sR + betaM * sM));', '// in scattering', 'float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);', 'float rPhase = rayleighPhase(cosTheta*0.5+0.5);', 'vec3 betaRTheta = betaR * rPhase;', 'float mPhase = hgPhase(cosTheta, mieDirectionalG);', 'vec3 betaMTheta = betaM * mPhase;', 'vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));', 'Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));', '//nightsky', 'vec3 direction = normalize(vWorldPosition - cameraPos);', 'float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]', 'float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]', 'vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);', '// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;', 'vec3 L0 = vec3(0.1) * Fex;', '// composition + solar disc', '//if (cosTheta > sunAngularDiameterCos)', 'float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);', '// if (normalize(vWorldPosition - cameraPos).y>0.0)', 'L0 += (sunE * 19000.0 * Fex)*sundisk;', 'vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));', 'vec3 texColor = (Lin+L0); ', 'texColor *= 0.04 ;', 'texColor += vec3(0.0,0.001,0.0025)*0.3;', 'float g_fMaxLuminance = 1.0;', 'float fLumScaled = 0.1 / luminance; ', 'float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ', 'float ExposureBias = fLumCompressed;', 'vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);', 'vec3 color = curr*whiteScale;', 'vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));', 'gl_FragColor.rgb = retColor;', 'gl_FragColor.a = 1.0;', '}'].join('\\n')\n\t\n\t};\n\t\n\tvar Sky = function Sky() {\n\t\n\t\tvar skyShader = _three2['default'].ShaderLib['sky'];\n\t\tvar skyUniforms = _three2['default'].UniformsUtils.clone(skyShader.uniforms);\n\t\n\t\tvar skyMat = new _three2['default'].ShaderMaterial({\n\t\t\tfragmentShader: skyShader.fragmentShader,\n\t\t\tvertexShader: skyShader.vertexShader,\n\t\t\tuniforms: skyUniforms,\n\t\t\tside: _three2['default'].BackSide\n\t\t});\n\t\n\t\tvar skyGeo = new _three2['default'].SphereBufferGeometry(450000, 32, 15);\n\t\tvar skyMesh = new _three2['default'].Mesh(skyGeo, skyMat);\n\t\n\t\t// Expose variables\n\t\tthis.mesh = skyMesh;\n\t\tthis.uniforms = skyUniforms;\n\t};\n\t\n\texports['default'] = Sky;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 49 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * lodash 4.0.0 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\tvar debounce = __webpack_require__(50);\n\t\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/**\n\t * Creates a throttled function that only invokes `func` at most once per\n\t * every `wait` milliseconds. The throttled function comes with a `cancel`\n\t * method to cancel delayed `func` invocations and a `flush` method to\n\t * immediately invoke them. Provide an options object to indicate whether\n\t * `func` should be invoked on the leading and/or trailing edge of the `wait`\n\t * timeout. The `func` is invoked with the last arguments provided to the\n\t * throttled function. Subsequent calls to the throttled function return the\n\t * result of the last `func` invocation.\n\t *\n\t * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n\t * on the trailing edge of the timeout only if the the throttled function is\n\t * invoked more than once during the `wait` timeout.\n\t *\n\t * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n\t * for details over the differences between `_.throttle` and `_.debounce`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to throttle.\n\t * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n\t * @param {Object} [options] The options object.\n\t * @param {boolean} [options.leading=true] Specify invoking on the leading\n\t * edge of the timeout.\n\t * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n\t * edge of the timeout.\n\t * @returns {Function} Returns the new throttled function.\n\t * @example\n\t *\n\t * // avoid excessively updating the position while scrolling\n\t * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n\t *\n\t * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes\n\t * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n\t * jQuery(element).on('click', throttled);\n\t *\n\t * // cancel a trailing throttled invocation\n\t * jQuery(window).on('popstate', throttled.cancel);\n\t */\n\tfunction throttle(func, wait, options) {\n\t var leading = true,\n\t trailing = true;\n\t\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t if (isObject(options)) {\n\t leading = 'leading' in options ? !!options.leading : leading;\n\t trailing = 'trailing' in options ? !!options.trailing : trailing;\n\t }\n\t return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing });\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t // Avoid a V8 JIT bug in Chrome 19-20.\n\t // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\tmodule.exports = throttle;\n\n\n/***/ },\n/* 50 */\n/***/ function(module, exports) {\n\n\t/**\n\t * lodash 4.0.1 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\t\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar NAN = 0 / 0;\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]';\n\t\n\t/** Used to match leading and trailing whitespace. */\n\tvar reTrim = /^\\s+|\\s+$/g;\n\t\n\t/** Used to detect bad signed hexadecimal string values. */\n\tvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\t\n\t/** Used to detect binary string values. */\n\tvar reIsBinary = /^0b[01]+$/i;\n\t\n\t/** Used to detect octal string values. */\n\tvar reIsOctal = /^0o[0-7]+$/i;\n\t\n\t/** Built-in method references without a dependency on `root`. */\n\tvar freeParseInt = parseInt;\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/* Built-in method references for those with the same name as other `lodash` methods. */\n\tvar nativeMax = Math.max;\n\t\n\t/**\n\t * Gets the timestamp of the number of milliseconds that have elapsed since\n\t * the Unix epoch (1 January 1970 00:00:00 UTC).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Date\n\t * @returns {number} Returns the timestamp.\n\t * @example\n\t *\n\t * _.defer(function(stamp) {\n\t * console.log(_.now() - stamp);\n\t * }, _.now());\n\t * // => logs the number of milliseconds it took for the deferred function to be invoked\n\t */\n\tvar now = Date.now;\n\t\n\t/**\n\t * Creates a debounced function that delays invoking `func` until after `wait`\n\t * milliseconds have elapsed since the last time the debounced function was\n\t * invoked. The debounced function comes with a `cancel` method to cancel\n\t * delayed `func` invocations and a `flush` method to immediately invoke them.\n\t * Provide an options object to indicate whether `func` should be invoked on\n\t * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n\t * with the last arguments provided to the debounced function. Subsequent calls\n\t * to the debounced function return the result of the last `func` invocation.\n\t *\n\t * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n\t * on the trailing edge of the timeout only if the the debounced function is\n\t * invoked more than once during the `wait` timeout.\n\t *\n\t * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n\t * for details over the differences between `_.debounce` and `_.throttle`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to debounce.\n\t * @param {number} [wait=0] The number of milliseconds to delay.\n\t * @param {Object} [options] The options object.\n\t * @param {boolean} [options.leading=false] Specify invoking on the leading\n\t * edge of the timeout.\n\t * @param {number} [options.maxWait] The maximum time `func` is allowed to be\n\t * delayed before it's invoked.\n\t * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n\t * edge of the timeout.\n\t * @returns {Function} Returns the new debounced function.\n\t * @example\n\t *\n\t * // Avoid costly calculations while the window size is in flux.\n\t * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n\t *\n\t * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n\t * jQuery(element).on('click', _.debounce(sendMail, 300, {\n\t * 'leading': true,\n\t * 'trailing': false\n\t * }));\n\t *\n\t * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n\t * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n\t * var source = new EventSource('/stream');\n\t * jQuery(source).on('message', debounced);\n\t *\n\t * // Cancel the trailing debounced invocation.\n\t * jQuery(window).on('popstate', debounced.cancel);\n\t */\n\tfunction debounce(func, wait, options) {\n\t var args,\n\t maxTimeoutId,\n\t result,\n\t stamp,\n\t thisArg,\n\t timeoutId,\n\t trailingCall,\n\t lastCalled = 0,\n\t leading = false,\n\t maxWait = false,\n\t trailing = true;\n\t\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t wait = toNumber(wait) || 0;\n\t if (isObject(options)) {\n\t leading = !!options.leading;\n\t maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait);\n\t trailing = 'trailing' in options ? !!options.trailing : trailing;\n\t }\n\t\n\t function cancel() {\n\t if (timeoutId) {\n\t clearTimeout(timeoutId);\n\t }\n\t if (maxTimeoutId) {\n\t clearTimeout(maxTimeoutId);\n\t }\n\t lastCalled = 0;\n\t args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined;\n\t }\n\t\n\t function complete(isCalled, id) {\n\t if (id) {\n\t clearTimeout(id);\n\t }\n\t maxTimeoutId = timeoutId = trailingCall = undefined;\n\t if (isCalled) {\n\t lastCalled = now();\n\t result = func.apply(thisArg, args);\n\t if (!timeoutId && !maxTimeoutId) {\n\t args = thisArg = undefined;\n\t }\n\t }\n\t }\n\t\n\t function delayed() {\n\t var remaining = wait - (now() - stamp);\n\t if (remaining <= 0 || remaining > wait) {\n\t complete(trailingCall, maxTimeoutId);\n\t } else {\n\t timeoutId = setTimeout(delayed, remaining);\n\t }\n\t }\n\t\n\t function flush() {\n\t if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) {\n\t result = func.apply(thisArg, args);\n\t }\n\t cancel();\n\t return result;\n\t }\n\t\n\t function maxDelayed() {\n\t complete(trailing, timeoutId);\n\t }\n\t\n\t function debounced() {\n\t args = arguments;\n\t stamp = now();\n\t thisArg = this;\n\t trailingCall = trailing && (timeoutId || !leading);\n\t\n\t if (maxWait === false) {\n\t var leadingCall = leading && !timeoutId;\n\t } else {\n\t if (!maxTimeoutId && !leading) {\n\t lastCalled = stamp;\n\t }\n\t var remaining = maxWait - (stamp - lastCalled),\n\t isCalled = remaining <= 0 || remaining > maxWait;\n\t\n\t if (isCalled) {\n\t if (maxTimeoutId) {\n\t maxTimeoutId = clearTimeout(maxTimeoutId);\n\t }\n\t lastCalled = stamp;\n\t result = func.apply(thisArg, args);\n\t }\n\t else if (!maxTimeoutId) {\n\t maxTimeoutId = setTimeout(maxDelayed, remaining);\n\t }\n\t }\n\t if (isCalled && timeoutId) {\n\t timeoutId = clearTimeout(timeoutId);\n\t }\n\t else if (!timeoutId && wait !== maxWait) {\n\t timeoutId = setTimeout(delayed, wait);\n\t }\n\t if (leadingCall) {\n\t isCalled = true;\n\t result = func.apply(thisArg, args);\n\t }\n\t if (isCalled && !timeoutId && !maxTimeoutId) {\n\t args = thisArg = undefined;\n\t }\n\t return result;\n\t }\n\t debounced.cancel = cancel;\n\t debounced.flush = flush;\n\t return debounced;\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Converts `value` to a number.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to process.\n\t * @returns {number} Returns the number.\n\t * @example\n\t *\n\t * _.toNumber(3);\n\t * // => 3\n\t *\n\t * _.toNumber(Number.MIN_VALUE);\n\t * // => 5e-324\n\t *\n\t * _.toNumber(Infinity);\n\t * // => Infinity\n\t *\n\t * _.toNumber('3');\n\t * // => 3\n\t */\n\tfunction toNumber(value) {\n\t if (isObject(value)) {\n\t var other = isFunction(value.valueOf) ? value.valueOf() : value;\n\t value = isObject(other) ? (other + '') : other;\n\t }\n\t if (typeof value != 'string') {\n\t return value === 0 ? value : +value;\n\t }\n\t value = value.replace(reTrim, '');\n\t var isBinary = reIsBinary.test(value);\n\t return (isBinary || reIsOctal.test(value))\n\t ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n\t : (reIsBadHex.test(value) ? NAN : +value);\n\t}\n\t\n\tmodule.exports = debounce;\n\n\n/***/ },\n/* 51 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _ControlsOrbit = __webpack_require__(52);\n\t\n\tvar _ControlsOrbit2 = _interopRequireDefault(_ControlsOrbit);\n\t\n\tvar Controls = {\n\t Orbit: _ControlsOrbit2['default'],\n\t orbit: _ControlsOrbit.orbit, orbit: _ControlsOrbit.orbit\n\t};\n\t\n\texports['default'] = Controls;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 52 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorOrbitControls = __webpack_require__(53);\n\t\n\tvar _vendorOrbitControls2 = _interopRequireDefault(_vendorOrbitControls);\n\t\n\tvar Orbit = (function (_EventEmitter) {\n\t _inherits(Orbit, _EventEmitter);\n\t\n\t function Orbit() {\n\t _classCallCheck(this, Orbit);\n\t\n\t _get(Object.getPrototypeOf(Orbit.prototype), 'constructor', this).call(this);\n\t }\n\t\n\t // Proxy control events\n\t //\n\t // There's currently no distinction between pan, orbit and zoom events\n\t\n\t _createClass(Orbit, [{\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t var _this = this;\n\t\n\t this._controls.addEventListener('start', function (event) {\n\t _this._world.emit('controlsMoveStart', event.target.target);\n\t });\n\t\n\t this._controls.addEventListener('change', function (event) {\n\t _this._world.emit('controlsMove', event.target.target);\n\t });\n\t\n\t this._controls.addEventListener('end', function (event) {\n\t _this._world.emit('controlsMoveEnd', event.target.target);\n\t });\n\t }\n\t\n\t // Moving the camera along the [x,y,z] axis based on a target position\n\t }, {\n\t key: '_panTo',\n\t value: function _panTo(point, animate) {}\n\t }, {\n\t key: '_panBy',\n\t value: function _panBy(pointDelta, animate) {}\n\t\n\t // Zooming the camera in and out\n\t }, {\n\t key: '_zoomTo',\n\t value: function _zoomTo(metres, animate) {}\n\t }, {\n\t key: '_zoomBy',\n\t value: function _zoomBy(metresDelta, animate) {}\n\t\n\t // Force camera to look at something other than the target\n\t }, {\n\t key: '_lookAt',\n\t value: function _lookAt(point, animate) {}\n\t\n\t // Make camera look at the target\n\t }, {\n\t key: '_lookAtTarget',\n\t value: function _lookAtTarget() {}\n\t\n\t // Tilt (up and down)\n\t }, {\n\t key: '_tiltTo',\n\t value: function _tiltTo(angle, animate) {}\n\t }, {\n\t key: '_tiltBy',\n\t value: function _tiltBy(angleDelta, animate) {}\n\t\n\t // Rotate (left and right)\n\t }, {\n\t key: '_rotateTo',\n\t value: function _rotateTo(angle, animate) {}\n\t }, {\n\t key: '_rotateBy',\n\t value: function _rotateBy(angleDelta, animate) {}\n\t\n\t // Fly to the given point, animating pan and tilt/rotation to final position\n\t // with nice zoom out and in\n\t //\n\t // Calling flyTo a second time before the previous animation has completed\n\t // will immediately start the new animation from wherever the previous one\n\t // has got to\n\t }, {\n\t key: '_flyTo',\n\t value: function _flyTo(point, noZoom) {}\n\t\n\t // Proxy to OrbitControls.update()\n\t }, {\n\t key: 'update',\n\t value: function update() {\n\t this._controls.update();\n\t }\n\t\n\t // Add controls to world instance and store world reference\n\t }, {\n\t key: 'addTo',\n\t value: function addTo(world) {\n\t world.addControls(this);\n\t return this;\n\t }\n\t\n\t // Internal method called by World.addControls to actually add the controls\n\t }, {\n\t key: '_addToWorld',\n\t value: function _addToWorld(world) {\n\t this._world = world;\n\t\n\t // TODO: Override panLeft and panUp methods to prevent panning on Y axis\n\t // See: http://stackoverflow.com/a/26188674/997339\n\t this._controls = new _vendorOrbitControls2['default'](world._engine._camera, world._container);\n\t\n\t // Disable keys for now as no events are fired for them anyway\n\t this._controls.keys = false;\n\t\n\t // 89 degrees\n\t this._controls.maxPolarAngle = 1.5533;\n\t\n\t // this._controls.enableDamping = true;\n\t // this._controls.dampingFactor = 0.25;\n\t\n\t this._initEvents();\n\t\n\t this.emit('added');\n\t }\n\t\n\t // Destroys the controls and removes them from memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // TODO: Remove event listeners\n\t\n\t this._controls.dispose();\n\t\n\t this._world = null;\n\t this._controls = null;\n\t }\n\t }]);\n\t\n\t return Orbit;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = Orbit;\n\t\n\tvar noNew = function noNew() {\n\t return new Orbit();\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.orbit = noNew;\n\n/***/ },\n/* 53 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _hammerjs = __webpack_require__(54);\n\t\n\tvar _hammerjs2 = _interopRequireDefault(_hammerjs);\n\t\n\t/**\n\t * @author qiao / https://github.com/qiao\n\t * @author mrdoob / http://mrdoob.com\n\t * @author alteredq / http://alteredqualia.com/\n\t * @author WestLangley / http://github.com/WestLangley\n\t * @author erich666 / http://erichaines.com\n\t */\n\t\n\t// This set of controls performs orbiting, dollying (zooming), and panning.\n\t// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n\t//\n\t// Orbit - left mouse / touch: one finger move\n\t// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish\n\t// Pan - right mouse, or arrow keys / touch: three finter swipe\n\t\n\tvar OrbitControls = function OrbitControls(object, domElement) {\n\t\n\t\tthis.object = object;\n\t\n\t\tthis.domElement = domElement !== undefined ? domElement : document;\n\t\n\t\t// Set to false to disable this control\n\t\tthis.enabled = true;\n\t\n\t\t// \"target\" sets the location of focus, where the object orbits around\n\t\tthis.target = new _three2['default'].Vector3();\n\t\n\t\t// How far you can dolly in and out ( PerspectiveCamera only )\n\t\tthis.minDistance = 0;\n\t\tthis.maxDistance = Infinity;\n\t\n\t\t// How far you can zoom in and out ( OrthographicCamera only )\n\t\tthis.minZoom = 0;\n\t\tthis.maxZoom = Infinity;\n\t\n\t\t// How far you can orbit vertically, upper and lower limits.\n\t\t// Range is 0 to Math.PI radians.\n\t\tthis.minPolarAngle = 0; // radians\n\t\tthis.maxPolarAngle = Math.PI; // radians\n\t\n\t\t// How far you can orbit horizontally, upper and lower limits.\n\t\t// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].\n\t\tthis.minAzimuthAngle = -Infinity; // radians\n\t\tthis.maxAzimuthAngle = Infinity; // radians\n\t\n\t\t// Set to true to enable damping (inertia)\n\t\t// If damping is enabled, you must call controls.update() in your animation loop\n\t\tthis.enableDamping = false;\n\t\tthis.dampingFactor = 0.25;\n\t\n\t\t// This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n\t\t// Set to false to disable zooming\n\t\tthis.enableZoom = true;\n\t\tthis.zoomSpeed = 1.0;\n\t\n\t\t// Set to false to disable rotating\n\t\tthis.enableRotate = true;\n\t\tthis.rotateSpeed = 1.0;\n\t\n\t\t// Set to false to disable panning\n\t\tthis.enablePan = true;\n\t\tthis.keyPanSpeed = 7.0; // pixels moved per arrow key push\n\t\n\t\t// Set to true to automatically rotate around the target\n\t\t// If auto-rotate is enabled, you must call controls.update() in your animation loop\n\t\tthis.autoRotate = false;\n\t\tthis.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\t\n\t\t// Set to false to disable use of the keys\n\t\tthis.enableKeys = true;\n\t\n\t\t// The four arrow keys\n\t\tthis.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };\n\t\n\t\t// Mouse buttons\n\t\tthis.mouseButtons = { ORBIT: _three2['default'].MOUSE.LEFT, ZOOM: _three2['default'].MOUSE.MIDDLE, PAN: _three2['default'].MOUSE.RIGHT };\n\t\n\t\t// for reset\n\t\tthis.target0 = this.target.clone();\n\t\tthis.position0 = this.object.position.clone();\n\t\tthis.zoom0 = this.object.zoom;\n\t\n\t\t//\n\t\t// public methods\n\t\t//\n\t\n\t\tthis.getPolarAngle = function () {\n\t\n\t\t\treturn phi;\n\t\t};\n\t\n\t\tthis.getAzimuthalAngle = function () {\n\t\n\t\t\treturn theta;\n\t\t};\n\t\n\t\tthis.reset = function () {\n\t\n\t\t\tscope.target.copy(scope.target0);\n\t\t\tscope.object.position.copy(scope.position0);\n\t\t\tscope.object.zoom = scope.zoom0;\n\t\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tscope.dispatchEvent(changeEvent);\n\t\n\t\t\tscope.update();\n\t\n\t\t\tstate = STATE.NONE;\n\t\t};\n\t\n\t\t// this method is exposed, but perhaps it would be better if we can make it private...\n\t\tthis.update = (function () {\n\t\n\t\t\tvar offset = new _three2['default'].Vector3();\n\t\n\t\t\t// so camera.up is the orbit axis\n\t\t\tvar quat = new _three2['default'].Quaternion().setFromUnitVectors(object.up, new _three2['default'].Vector3(0, 1, 0));\n\t\t\tvar quatInverse = quat.clone().inverse();\n\t\n\t\t\tvar lastPosition = new _three2['default'].Vector3();\n\t\t\tvar lastQuaternion = new _three2['default'].Quaternion();\n\t\n\t\t\treturn function () {\n\t\n\t\t\t\tvar position = scope.object.position;\n\t\n\t\t\t\toffset.copy(position).sub(scope.target);\n\t\n\t\t\t\t// rotate offset to \"y-axis-is-up\" space\n\t\t\t\toffset.applyQuaternion(quat);\n\t\n\t\t\t\t// angle from z-axis around y-axis\n\t\n\t\t\t\ttheta = Math.atan2(offset.x, offset.z);\n\t\n\t\t\t\t// angle from y-axis\n\t\n\t\t\t\tphi = Math.atan2(Math.sqrt(offset.x * offset.x + offset.z * offset.z), offset.y);\n\t\n\t\t\t\tif (scope.autoRotate && state === STATE.NONE) {\n\t\n\t\t\t\t\trotateLeft(getAutoRotationAngle());\n\t\t\t\t}\n\t\n\t\t\t\ttheta += thetaDelta;\n\t\t\t\tphi += phiDelta;\n\t\n\t\t\t\t// restrict theta to be between desired limits\n\t\t\t\ttheta = Math.max(scope.minAzimuthAngle, Math.min(scope.maxAzimuthAngle, theta));\n\t\n\t\t\t\t// restrict phi to be between desired limits\n\t\t\t\tphi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, phi));\n\t\n\t\t\t\t// restrict phi to be betwee EPS and PI-EPS\n\t\t\t\tphi = Math.max(EPS, Math.min(Math.PI - EPS, phi));\n\t\n\t\t\t\tvar radius = offset.length() * scale;\n\t\n\t\t\t\t// restrict radius to be between desired limits\n\t\t\t\tradius = Math.max(scope.minDistance, Math.min(scope.maxDistance, radius));\n\t\n\t\t\t\t// move target to panned location\n\t\t\t\tscope.target.add(panOffset);\n\t\n\t\t\t\toffset.x = radius * Math.sin(phi) * Math.sin(theta);\n\t\t\t\toffset.y = radius * Math.cos(phi);\n\t\t\t\toffset.z = radius * Math.sin(phi) * Math.cos(theta);\n\t\n\t\t\t\t// rotate offset back to \"camera-up-vector-is-up\" space\n\t\t\t\toffset.applyQuaternion(quatInverse);\n\t\n\t\t\t\tposition.copy(scope.target).add(offset);\n\t\n\t\t\t\tscope.object.lookAt(scope.target);\n\t\n\t\t\t\tif (scope.enableDamping === true) {\n\t\n\t\t\t\t\tthetaDelta *= 1 - scope.dampingFactor;\n\t\t\t\t\tphiDelta *= 1 - scope.dampingFactor;\n\t\t\t\t} else {\n\t\n\t\t\t\t\tthetaDelta = 0;\n\t\t\t\t\tphiDelta = 0;\n\t\t\t\t}\n\t\n\t\t\t\tscale = 1;\n\t\t\t\tpanOffset.set(0, 0, 0);\n\t\n\t\t\t\t// update condition is:\n\t\t\t\t// min(camera displacement, camera rotation in radians)^2 > EPS\n\t\t\t\t// using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\t\n\t\t\t\tif (zoomChanged || lastPosition.distanceToSquared(scope.object.position) > EPS || 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS) {\n\t\n\t\t\t\t\tscope.dispatchEvent(changeEvent);\n\t\n\t\t\t\t\tlastPosition.copy(scope.object.position);\n\t\t\t\t\tlastQuaternion.copy(scope.object.quaternion);\n\t\t\t\t\tzoomChanged = false;\n\t\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\n\t\t\t\treturn false;\n\t\t\t};\n\t\t})();\n\t\n\t\tthis.dispose = function () {\n\t\n\t\t\tscope.domElement.removeEventListener('contextmenu', onContextMenu, false);\n\t\t\tscope.domElement.removeEventListener('mousedown', onMouseDown, false);\n\t\t\tscope.domElement.removeEventListener('mousewheel', onMouseWheel, false);\n\t\t\tscope.domElement.removeEventListener('MozMousePixelScroll', onMouseWheel, false); // firefox\n\t\n\t\t\tscope.domElement.removeEventListener('touchstart', onTouchStart, false);\n\t\t\tscope.domElement.removeEventListener('touchend', onTouchEnd, false);\n\t\t\tscope.domElement.removeEventListener('touchmove', onTouchMove, false);\n\t\n\t\t\tdocument.removeEventListener('mousemove', onMouseMove, false);\n\t\t\tdocument.removeEventListener('mouseup', onMouseUp, false);\n\t\t\tdocument.removeEventListener('mouseout', onMouseUp, false);\n\t\n\t\t\twindow.removeEventListener('keydown', onKeyDown, false);\n\t\n\t\t\t//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n\t\t};\n\t\n\t\t//\n\t\t// internals\n\t\t//\n\t\n\t\tvar scope = this;\n\t\n\t\tvar changeEvent = { type: 'change' };\n\t\tvar startEvent = { type: 'start' };\n\t\tvar endEvent = { type: 'end' };\n\t\n\t\tvar STATE = { NONE: -1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY: 4, TOUCH_PAN: 5 };\n\t\n\t\tvar state = STATE.NONE;\n\t\n\t\tvar EPS = 0.000001;\n\t\n\t\t// current position in spherical coordinates\n\t\tvar theta;\n\t\tvar phi;\n\t\n\t\tvar phiDelta = 0;\n\t\tvar thetaDelta = 0;\n\t\tvar scale = 1;\n\t\tvar panOffset = new _three2['default'].Vector3();\n\t\tvar zoomChanged = false;\n\t\n\t\tvar rotateStart = new _three2['default'].Vector2();\n\t\tvar rotateEnd = new _three2['default'].Vector2();\n\t\tvar rotateDelta = new _three2['default'].Vector2();\n\t\n\t\tvar panStart = new _three2['default'].Vector2();\n\t\tvar panEnd = new _three2['default'].Vector2();\n\t\tvar panDelta = new _three2['default'].Vector2();\n\t\n\t\tvar dollyStart = new _three2['default'].Vector2();\n\t\tvar dollyEnd = new _three2['default'].Vector2();\n\t\tvar dollyDelta = new _three2['default'].Vector2();\n\t\n\t\tfunction getAutoRotationAngle() {\n\t\n\t\t\treturn 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n\t\t}\n\t\n\t\tfunction getZoomScale() {\n\t\n\t\t\treturn Math.pow(0.95, scope.zoomSpeed);\n\t\t}\n\t\n\t\tfunction rotateLeft(angle) {\n\t\n\t\t\tthetaDelta -= angle;\n\t\t}\n\t\n\t\tfunction rotateUp(angle) {\n\t\n\t\t\tphiDelta -= angle;\n\t\t}\n\t\n\t\tvar panLeft = (function () {\n\t\n\t\t\tvar v = new _three2['default'].Vector3();\n\t\n\t\t\t// return function panLeft( distance, objectMatrix ) {\n\t\t\t//\n\t\t\t// \tvar te = objectMatrix.elements;\n\t\t\t//\n\t\t\t// \t// get X column of objectMatrix\n\t\t\t// \tv.set( te[ 0 ], te[ 1 ], te[ 2 ] );\n\t\t\t//\n\t\t\t// \tv.multiplyScalar( - distance );\n\t\t\t//\n\t\t\t// \tpanOffset.add( v );\n\t\t\t//\n\t\t\t// };\n\t\n\t\t\t// Fixed panning to x/y plane\n\t\t\treturn function panLeft(distance, objectMatrix) {\n\t\t\t\tvar te = objectMatrix.elements;\n\t\t\t\t// var adjDist = distance / Math.cos(phi);\n\t\n\t\t\t\tv.set(te[0], 0, te[2]);\n\t\t\t\tv.multiplyScalar(-distance);\n\t\n\t\t\t\tpanOffset.add(v);\n\t\t\t};\n\t\t})();\n\t\n\t\t// Fixed panning to x/y plane\n\t\tvar panUp = (function () {\n\t\n\t\t\tvar v = new _three2['default'].Vector3();\n\t\n\t\t\t// return function panUp( distance, objectMatrix ) {\n\t\t\t//\n\t\t\t// \tvar te = objectMatrix.elements;\n\t\t\t//\n\t\t\t// \t// get Y column of objectMatrix\n\t\t\t// \tv.set( te[ 4 ], te[ 5 ], te[ 6 ] );\n\t\t\t//\n\t\t\t// \tv.multiplyScalar( distance );\n\t\t\t//\n\t\t\t// \tpanOffset.add( v );\n\t\t\t//\n\t\t\t// };\n\t\n\t\t\treturn function panUp(distance, objectMatrix) {\n\t\t\t\tvar te = objectMatrix.elements;\n\t\t\t\tvar adjDist = distance / Math.cos(phi);\n\t\n\t\t\t\tv.set(te[4], 0, te[6]);\n\t\t\t\tv.multiplyScalar(adjDist);\n\t\n\t\t\t\tpanOffset.add(v);\n\t\t\t};\n\t\t})();\n\t\n\t\t// deltaX and deltaY are in pixels; right and down are positive\n\t\tvar pan = (function () {\n\t\n\t\t\tvar offset = new _three2['default'].Vector3();\n\t\n\t\t\treturn function (deltaX, deltaY) {\n\t\n\t\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\t\n\t\t\t\tif (scope.object instanceof _three2['default'].PerspectiveCamera) {\n\t\n\t\t\t\t\t// perspective\n\t\t\t\t\tvar position = scope.object.position;\n\t\t\t\t\toffset.copy(position).sub(scope.target);\n\t\t\t\t\tvar targetDistance = offset.length();\n\t\n\t\t\t\t\t// half of the fov is center to top of screen\n\t\t\t\t\ttargetDistance *= Math.tan(scope.object.fov / 2 * Math.PI / 180.0);\n\t\n\t\t\t\t\t// we actually don't use screenWidth, since perspective camera is fixed to screen height\n\t\t\t\t\tpanLeft(2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix);\n\t\t\t\t\tpanUp(2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix);\n\t\t\t\t} else if (scope.object instanceof _three2['default'].OrthographicCamera) {\n\t\n\t\t\t\t\t// orthographic\n\t\t\t\t\tpanLeft(deltaX * (scope.object.right - scope.object.left) / element.clientWidth, scope.object.matrix);\n\t\t\t\t\tpanUp(deltaY * (scope.object.top - scope.object.bottom) / element.clientHeight, scope.object.matrix);\n\t\t\t\t} else {\n\t\n\t\t\t\t\t// camera neither orthographic nor perspective\n\t\t\t\t\tconsole.warn('WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.');\n\t\t\t\t\tscope.enablePan = false;\n\t\t\t\t}\n\t\t\t};\n\t\t})();\n\t\n\t\tfunction dollyIn(dollyScale) {\n\t\n\t\t\tif (scope.object instanceof _three2['default'].PerspectiveCamera) {\n\t\n\t\t\t\tscale /= dollyScale;\n\t\t\t} else if (scope.object instanceof _three2['default'].OrthographicCamera) {\n\t\n\t\t\t\tscope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom * dollyScale));\n\t\t\t\tscope.object.updateProjectionMatrix();\n\t\t\t\tzoomChanged = true;\n\t\t\t} else {\n\t\n\t\t\t\tconsole.warn('WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.');\n\t\t\t\tscope.enableZoom = false;\n\t\t\t}\n\t\t}\n\t\n\t\tfunction dollyOut(dollyScale) {\n\t\n\t\t\tif (scope.object instanceof _three2['default'].PerspectiveCamera) {\n\t\n\t\t\t\tscale *= dollyScale;\n\t\t\t} else if (scope.object instanceof _three2['default'].OrthographicCamera) {\n\t\n\t\t\t\tscope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / dollyScale));\n\t\t\t\tscope.object.updateProjectionMatrix();\n\t\t\t\tzoomChanged = true;\n\t\t\t} else {\n\t\n\t\t\t\tconsole.warn('WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.');\n\t\t\t\tscope.enableZoom = false;\n\t\t\t}\n\t\t}\n\t\n\t\t//\n\t\t// event callbacks - update the object state\n\t\t//\n\t\n\t\tfunction handleMouseDownRotate(event) {\n\t\n\t\t\t//console.log( 'handleMouseDownRotate' );\n\t\n\t\t\trotateStart.set(event.clientX, event.clientY);\n\t\t}\n\t\n\t\tfunction handleMouseDownDolly(event) {\n\t\n\t\t\t//console.log( 'handleMouseDownDolly' );\n\t\n\t\t\tdollyStart.set(event.clientX, event.clientY);\n\t\t}\n\t\n\t\tfunction handleMouseDownPan(event) {\n\t\n\t\t\t//console.log( 'handleMouseDownPan' );\n\t\n\t\t\tpanStart.set(event.clientX, event.clientY);\n\t\t}\n\t\n\t\tfunction handleMouseMoveRotate(event) {\n\t\n\t\t\t//console.log( 'handleMouseMoveRotate' );\n\t\n\t\t\trotateEnd.set(event.clientX, event.clientY);\n\t\t\trotateDelta.subVectors(rotateEnd, rotateStart);\n\t\n\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\t\n\t\t\t// rotating across whole screen goes 360 degrees around\n\t\t\trotateLeft(2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed);\n\t\n\t\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\t\trotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed);\n\t\n\t\t\trotateStart.copy(rotateEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleMouseMoveDolly(event) {\n\t\n\t\t\t//console.log( 'handleMouseMoveDolly' );\n\t\n\t\t\tdollyEnd.set(event.clientX, event.clientY);\n\t\n\t\t\tdollyDelta.subVectors(dollyEnd, dollyStart);\n\t\n\t\t\tif (dollyDelta.y > 0) {\n\t\n\t\t\t\tdollyIn(getZoomScale());\n\t\t\t} else if (dollyDelta.y < 0) {\n\t\n\t\t\t\tdollyOut(getZoomScale());\n\t\t\t}\n\t\n\t\t\tdollyStart.copy(dollyEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleMouseMovePan(event) {\n\t\n\t\t\t//console.log( 'handleMouseMovePan' );\n\t\n\t\t\tpanEnd.set(event.clientX, event.clientY);\n\t\n\t\t\tpanDelta.subVectors(panEnd, panStart);\n\t\n\t\t\tpan(panDelta.x, panDelta.y);\n\t\n\t\t\tpanStart.copy(panEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleMouseUp(event) {\n\t\n\t\t\t//console.log( 'handleMouseUp' );\n\t\n\t\t}\n\t\n\t\tfunction handleMouseWheel(event) {\n\t\n\t\t\t//console.log( 'handleMouseWheel' );\n\t\n\t\t\tvar delta = 0;\n\t\n\t\t\tif (event.wheelDelta !== undefined) {\n\t\n\t\t\t\t// WebKit / Opera / Explorer 9\n\t\n\t\t\t\tdelta = event.wheelDelta;\n\t\t\t} else if (event.detail !== undefined) {\n\t\n\t\t\t\t// Firefox\n\t\n\t\t\t\tdelta = -event.detail;\n\t\t\t}\n\t\n\t\t\tif (delta > 0) {\n\t\n\t\t\t\tdollyOut(getZoomScale());\n\t\t\t} else if (delta < 0) {\n\t\n\t\t\t\tdollyIn(getZoomScale());\n\t\t\t}\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleKeyDown(event) {\n\t\n\t\t\t//console.log( 'handleKeyDown' );\n\t\n\t\t\tswitch (event.keyCode) {\n\t\n\t\t\t\tcase scope.keys.UP:\n\t\t\t\t\tpan(0, scope.keyPanSpeed);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase scope.keys.BOTTOM:\n\t\t\t\t\tpan(0, -scope.keyPanSpeed);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase scope.keys.LEFT:\n\t\t\t\t\tpan(scope.keyPanSpeed, 0);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase scope.keys.RIGHT:\n\t\t\t\t\tpan(-scope.keyPanSpeed, 0);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t}\n\t\t}\n\t\n\t\tfunction handleTouchStartRotate(event) {\n\t\n\t\t\t//console.log( 'handleTouchStartRotate' );\n\t\n\t\t\trotateStart.set(event.pointers[0].pageX, event.pointers[0].pageY);\n\t\t}\n\t\n\t\tfunction handleTouchStartDolly(event) {\n\t\n\t\t\t//console.log( 'handleTouchStartDolly' );\n\t\n\t\t\tvar dx = event.pointers[0].pageX - event.pointers[1].pageX;\n\t\t\tvar dy = event.pointers[0].pageY - event.pointers[1].pageY;\n\t\n\t\t\tvar distance = Math.sqrt(dx * dx + dy * dy);\n\t\n\t\t\tdollyStart.set(0, distance);\n\t\t}\n\t\n\t\tfunction handleTouchStartPan(event) {\n\t\n\t\t\t//console.log( 'handleTouchStartPan' );\n\t\n\t\t\tpanStart.set(event.deltaX, event.deltaY);\n\t\t}\n\t\n\t\tfunction handleTouchMoveRotate(event) {\n\t\n\t\t\t//console.log( 'handleTouchMoveRotate' );\n\t\n\t\t\trotateEnd.set(event.pointers[0].pageX, event.pointers[0].pageY);\n\t\t\trotateDelta.subVectors(rotateEnd, rotateStart);\n\t\n\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\t\n\t\t\t// rotating across whole screen goes 360 degrees around\n\t\t\trotateLeft(2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed);\n\t\n\t\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\t\trotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed);\n\t\n\t\t\trotateStart.copy(rotateEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleTouchMoveDolly(event) {\n\t\n\t\t\t//console.log( 'handleTouchMoveDolly' );\n\t\n\t\t\tvar dx = event.pointers[0].pageX - event.pointers[1].pageX;\n\t\t\tvar dy = event.pointers[0].pageY - event.pointers[1].pageY;\n\t\n\t\t\tvar distance = Math.sqrt(dx * dx + dy * dy);\n\t\n\t\t\tdollyEnd.set(0, distance);\n\t\n\t\t\tdollyDelta.subVectors(dollyEnd, dollyStart);\n\t\n\t\t\tif (dollyDelta.y > 0) {\n\t\n\t\t\t\tdollyOut(getZoomScale());\n\t\t\t} else if (dollyDelta.y < 0) {\n\t\n\t\t\t\tdollyIn(getZoomScale());\n\t\t\t}\n\t\n\t\t\tdollyStart.copy(dollyEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleTouchMovePan(event) {\n\t\n\t\t\t//console.log( 'handleTouchMovePan' );\n\t\n\t\t\tpanEnd.set(event.deltaX, event.deltaY);\n\t\n\t\t\tpanDelta.subVectors(panEnd, panStart);\n\t\n\t\t\tpan(panDelta.x, panDelta.y);\n\t\n\t\t\tpanStart.copy(panEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleTouchEnd(event) {}\n\t\n\t\t//console.log( 'handleTouchEnd' );\n\t\n\t\t//\n\t\t// event handlers - FSM: listen for events and reset state\n\t\t//\n\t\n\t\tfunction onMouseDown(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tevent.preventDefault();\n\t\n\t\t\tif (event.button === scope.mouseButtons.ORBIT) {\n\t\n\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\thandleMouseDownRotate(event);\n\t\n\t\t\t\tstate = STATE.ROTATE;\n\t\t\t} else if (event.button === scope.mouseButtons.ZOOM) {\n\t\n\t\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\t\thandleMouseDownDolly(event);\n\t\n\t\t\t\tstate = STATE.DOLLY;\n\t\t\t} else if (event.button === scope.mouseButtons.PAN) {\n\t\n\t\t\t\tif (scope.enablePan === false) return;\n\t\n\t\t\t\thandleMouseDownPan(event);\n\t\n\t\t\t\tstate = STATE.PAN;\n\t\t\t}\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\n\t\t\t\tdocument.addEventListener('mousemove', onMouseMove, false);\n\t\t\t\tdocument.addEventListener('mouseup', onMouseUp, false);\n\t\t\t\tdocument.addEventListener('mouseout', onMouseUp, false);\n\t\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onMouseMove(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tevent.preventDefault();\n\t\n\t\t\tif (state === STATE.ROTATE) {\n\t\n\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\thandleMouseMoveRotate(event);\n\t\t\t} else if (state === STATE.DOLLY) {\n\t\n\t\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\t\thandleMouseMoveDolly(event);\n\t\t\t} else if (state === STATE.PAN) {\n\t\n\t\t\t\tif (scope.enablePan === false) return;\n\t\n\t\t\t\thandleMouseMovePan(event);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onMouseUp(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\thandleMouseUp(event);\n\t\n\t\t\tdocument.removeEventListener('mousemove', onMouseMove, false);\n\t\t\tdocument.removeEventListener('mouseup', onMouseUp, false);\n\t\t\tdocument.removeEventListener('mouseout', onMouseUp, false);\n\t\n\t\t\tscope.dispatchEvent(endEvent);\n\t\n\t\t\tstate = STATE.NONE;\n\t\t}\n\t\n\t\tfunction onMouseWheel(event) {\n\t\n\t\t\tif (scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE) return;\n\t\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\n\t\t\thandleMouseWheel(event);\n\t\n\t\t\tscope.dispatchEvent(startEvent); // not sure why these are here...\n\t\t\tscope.dispatchEvent(endEvent);\n\t\t}\n\t\n\t\tfunction onKeyDown(event) {\n\t\n\t\t\tif (scope.enabled === false || scope.enableKeys === false || scope.enablePan === false) return;\n\t\n\t\t\thandleKeyDown(event);\n\t\t}\n\t\n\t\tfunction onTouchStart(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tswitch (event.touches.length) {\n\t\n\t\t\t\tcase 1:\n\t\t\t\t\t// one-fingered touch: rotate\n\t\n\t\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\t\thandleTouchStartRotate(event);\n\t\n\t\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 2:\n\t\t\t\t\t// two-fingered touch: dolly\n\t\n\t\t\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\t\t\thandleTouchStartDolly(event);\n\t\n\t\t\t\t\tstate = STATE.TOUCH_DOLLY;\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 3:\n\t\t\t\t\t// three-fingered touch: pan\n\t\n\t\t\t\t\tif (scope.enablePan === false) return;\n\t\n\t\t\t\t\thandleTouchStartPan(event);\n\t\n\t\t\t\t\tstate = STATE.TOUCH_PAN;\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tdefault:\n\t\n\t\t\t\t\tstate = STATE.NONE;\n\t\n\t\t\t}\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onTouchMove(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\n\t\t\tswitch (event.touches.length) {\n\t\n\t\t\t\tcase 1:\n\t\t\t\t\t// one-fingered touch: rotate\n\t\n\t\t\t\t\tif (scope.enableRotate === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_ROTATE) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMoveRotate(event);\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 2:\n\t\t\t\t\t// two-fingered touch: dolly\n\t\n\t\t\t\t\tif (scope.enableZoom === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_DOLLY) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMoveDolly(event);\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 3:\n\t\t\t\t\t// three-fingered touch: pan\n\t\n\t\t\t\t\tif (scope.enablePan === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_PAN) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMovePan(event);\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tdefault:\n\t\n\t\t\t\t\tstate = STATE.NONE;\n\t\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onTouchEnd(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\thandleTouchEnd(event);\n\t\n\t\t\tscope.dispatchEvent(endEvent);\n\t\n\t\t\tstate = STATE.NONE;\n\t\t}\n\t\n\t\tfunction onContextMenu(event) {\n\t\n\t\t\tevent.preventDefault();\n\t\t}\n\t\n\t\t//\n\t\n\t\tscope.domElement.addEventListener('contextmenu', onContextMenu, false);\n\t\n\t\tscope.domElement.addEventListener('mousedown', onMouseDown, false);\n\t\tscope.domElement.addEventListener('mousewheel', onMouseWheel, false);\n\t\tscope.domElement.addEventListener('MozMousePixelScroll', onMouseWheel, false); // firefox\n\t\n\t\t// scope.domElement.addEventListener( 'touchstart', onTouchStart, false );\n\t\t// scope.domElement.addEventListener( 'touchend', onTouchEnd, false );\n\t\t// scope.domElement.addEventListener( 'touchmove', onTouchMove, false );\n\t\n\t\tscope.hammer = new _hammerjs2['default'](scope.domElement);\n\t\n\t\tscope.hammer.get('pan').set({\n\t\t\tpointers: 0,\n\t\t\tdirection: _hammerjs2['default'].DIRECTION_ALL\n\t\t});\n\t\n\t\tscope.hammer.get('pinch').set({\n\t\t\tenable: true,\n\t\t\tthreshold: 0.1\n\t\t});\n\t\n\t\tscope.hammer.on('panstart', function (event) {\n\t\t\tif (scope.enabled === false) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (event.pointers.length === 1) {\n\t\t\t\tif (scope.enablePan === false) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\thandleTouchStartPan(event);\n\t\t\t\t// panStart.set(event.deltaX, event.deltaY);\n\t\n\t\t\t\tstate = STATE.TOUCH_PAN;\n\t\t\t} else if (event.pointers.length === 2) {\n\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\thandleTouchStartRotate(event);\n\t\n\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\t\t\t}\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t});\n\t\n\t\tscope.hammer.on('panend', function (event) {\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tonTouchEnd(event);\n\t\t});\n\t\n\t\tscope.hammer.on('panmove', function (event) {\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// event.preventDefault();\n\t\t\t// event.stopPropagation();\n\t\n\t\t\tif (event.pointers.length === 1) {\n\t\t\t\tif (scope.enablePan === false) return;\n\t\t\t\tif (state !== STATE.TOUCH_PAN) return; // is this needed?...\n\t\n\t\t\t\thandleTouchMovePan(event);\n\t\n\t\t\t\t// panEnd.set( event.deltaX, event.deltaY );\n\t\t\t\t//\n\t\t\t\t// panDelta.subVectors( panEnd, panStart );\n\t\t\t\t//\n\t\t\t\t// pan( panDelta.x, panDelta.y );\n\t\t\t\t//\n\t\t\t\t// panStart.copy( panEnd );\n\t\t\t\t//\n\t\t\t\t// scope.update();\n\t\t\t} else if (event.pointers.length === 2) {\n\t\t\t\t\tif (scope.enableRotate === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_ROTATE) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMoveRotate(event);\n\t\t\t\t}\n\t\t});\n\t\n\t\tscope.hammer.on('pinchstart', function (event) {\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\thandleTouchStartDolly(event);\n\t\n\t\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t\t//\n\t\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t\t//\n\t\t\t// dollyStart.set( 0, distance );\n\t\t\t//\n\t\t\tstate = STATE.TOUCH_DOLLY;\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t});\n\t\n\t\tscope.hammer.on('pinchend', function (event) {\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tonTouchEnd(event);\n\t\t});\n\t\n\t\tscope.hammer.on('pinchmove', function (event) {\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// event.preventDefault();\n\t\t\t// event.stopPropagation();\n\t\n\t\t\tif (scope.enableZoom === false) return;\n\t\t\tif (state !== STATE.TOUCH_DOLLY) return; // is this needed?...\n\t\n\t\t\thandleTouchMoveDolly(event);\n\t\n\t\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t\t//\n\t\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t\t//\n\t\t\t// dollyEnd.set( 0, distance );\n\t\t\t//\n\t\t\t// dollyDelta.subVectors( dollyEnd, dollyStart );\n\t\t\t//\n\t\t\t// if ( dollyDelta.y > 0 ) {\n\t\t\t//\n\t\t\t// \tdollyOut( getZoomScale() );\n\t\t\t//\n\t\t\t// } else if ( dollyDelta.y < 0 ) {\n\t\t\t//\n\t\t\t// \tdollyIn( getZoomScale() );\n\t\t\t//\n\t\t\t// }\n\t\t\t//\n\t\t\t// dollyStart.copy( dollyEnd );\n\t\t\t//\n\t\t\t// scope.update();\n\t\t});\n\t\n\t\twindow.addEventListener('keydown', onKeyDown, false);\n\t\n\t\t// force an update at start\n\t\n\t\tthis.update();\n\t};\n\t\n\tOrbitControls.prototype = Object.create(_three2['default'].EventDispatcher.prototype);\n\tOrbitControls.prototype.constructor = _three2['default'].OrbitControls;\n\t\n\tObject.defineProperties(OrbitControls.prototype, {\n\t\n\t\tcenter: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .center has been renamed to .target');\n\t\t\t\treturn this.target;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\t// backward compatibility\n\t\n\t\tnoZoom: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.');\n\t\t\t\treturn !this.enableZoom;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.');\n\t\t\t\tthis.enableZoom = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tnoRotate: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.');\n\t\t\t\treturn !this.enableRotate;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.');\n\t\t\t\tthis.enableRotate = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tnoPan: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.');\n\t\t\t\treturn !this.enablePan;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.');\n\t\t\t\tthis.enablePan = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tnoKeys: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.');\n\t\t\t\treturn !this.enableKeys;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.');\n\t\t\t\tthis.enableKeys = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tstaticMoving: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.');\n\t\t\t\treturn !this.constraint.enableDamping;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.');\n\t\t\t\tthis.constraint.enableDamping = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tdynamicDampingFactor: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.');\n\t\t\t\treturn this.constraint.dampingFactor;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.');\n\t\t\t\tthis.constraint.dampingFactor = value;\n\t\t\t}\n\t\n\t\t}\n\t\n\t});\n\t\n\texports['default'] = OrbitControls;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 54 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_RESULT__;/*! Hammer.JS - v2.0.6 - 2015-12-23\n\t * http://hammerjs.github.io/\n\t *\n\t * Copyright (c) 2015 Jorik Tangelder;\n\t * Licensed under the license */\n\t(function(window, document, exportName, undefined) {\n\t 'use strict';\n\t\n\tvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\n\tvar TEST_ELEMENT = document.createElement('div');\n\t\n\tvar TYPE_FUNCTION = 'function';\n\t\n\tvar round = Math.round;\n\tvar abs = Math.abs;\n\tvar now = Date.now;\n\t\n\t/**\n\t * set a timeout with a given scope\n\t * @param {Function} fn\n\t * @param {Number} timeout\n\t * @param {Object} context\n\t * @returns {number}\n\t */\n\tfunction setTimeoutContext(fn, timeout, context) {\n\t return setTimeout(bindFn(fn, context), timeout);\n\t}\n\t\n\t/**\n\t * if the argument is an array, we want to execute the fn on each entry\n\t * if it aint an array we don't want to do a thing.\n\t * this is used by all the methods that accept a single and array argument.\n\t * @param {*|Array} arg\n\t * @param {String} fn\n\t * @param {Object} [context]\n\t * @returns {Boolean}\n\t */\n\tfunction invokeArrayArg(arg, fn, context) {\n\t if (Array.isArray(arg)) {\n\t each(arg, context[fn], context);\n\t return true;\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * walk objects and arrays\n\t * @param {Object} obj\n\t * @param {Function} iterator\n\t * @param {Object} context\n\t */\n\tfunction each(obj, iterator, context) {\n\t var i;\n\t\n\t if (!obj) {\n\t return;\n\t }\n\t\n\t if (obj.forEach) {\n\t obj.forEach(iterator, context);\n\t } else if (obj.length !== undefined) {\n\t i = 0;\n\t while (i < obj.length) {\n\t iterator.call(context, obj[i], i, obj);\n\t i++;\n\t }\n\t } else {\n\t for (i in obj) {\n\t obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n\t }\n\t }\n\t}\n\t\n\t/**\n\t * wrap a method with a deprecation warning and stack trace\n\t * @param {Function} method\n\t * @param {String} name\n\t * @param {String} message\n\t * @returns {Function} A new function wrapping the supplied method.\n\t */\n\tfunction deprecate(method, name, message) {\n\t var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n\t return function() {\n\t var e = new Error('get-stack-trace');\n\t var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '')\n\t .replace(/^\\s+at\\s+/gm, '')\n\t .replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n\t\n\t var log = window.console && (window.console.warn || window.console.log);\n\t if (log) {\n\t log.call(window.console, deprecationMessage, stack);\n\t }\n\t return method.apply(this, arguments);\n\t };\n\t}\n\t\n\t/**\n\t * extend object.\n\t * means that properties in dest will be overwritten by the ones in src.\n\t * @param {Object} target\n\t * @param {...Object} objects_to_assign\n\t * @returns {Object} target\n\t */\n\tvar assign;\n\tif (typeof Object.assign !== 'function') {\n\t assign = function assign(target) {\n\t if (target === undefined || target === null) {\n\t throw new TypeError('Cannot convert undefined or null to object');\n\t }\n\t\n\t var output = Object(target);\n\t for (var index = 1; index < arguments.length; index++) {\n\t var source = arguments[index];\n\t if (source !== undefined && source !== null) {\n\t for (var nextKey in source) {\n\t if (source.hasOwnProperty(nextKey)) {\n\t output[nextKey] = source[nextKey];\n\t }\n\t }\n\t }\n\t }\n\t return output;\n\t };\n\t} else {\n\t assign = Object.assign;\n\t}\n\t\n\t/**\n\t * extend object.\n\t * means that properties in dest will be overwritten by the ones in src.\n\t * @param {Object} dest\n\t * @param {Object} src\n\t * @param {Boolean=false} [merge]\n\t * @returns {Object} dest\n\t */\n\tvar extend = deprecate(function extend(dest, src, merge) {\n\t var keys = Object.keys(src);\n\t var i = 0;\n\t while (i < keys.length) {\n\t if (!merge || (merge && dest[keys[i]] === undefined)) {\n\t dest[keys[i]] = src[keys[i]];\n\t }\n\t i++;\n\t }\n\t return dest;\n\t}, 'extend', 'Use `assign`.');\n\t\n\t/**\n\t * merge the values from src in the dest.\n\t * means that properties that exist in dest will not be overwritten by src\n\t * @param {Object} dest\n\t * @param {Object} src\n\t * @returns {Object} dest\n\t */\n\tvar merge = deprecate(function merge(dest, src) {\n\t return extend(dest, src, true);\n\t}, 'merge', 'Use `assign`.');\n\t\n\t/**\n\t * simple class inheritance\n\t * @param {Function} child\n\t * @param {Function} base\n\t * @param {Object} [properties]\n\t */\n\tfunction inherit(child, base, properties) {\n\t var baseP = base.prototype,\n\t childP;\n\t\n\t childP = child.prototype = Object.create(baseP);\n\t childP.constructor = child;\n\t childP._super = baseP;\n\t\n\t if (properties) {\n\t assign(childP, properties);\n\t }\n\t}\n\t\n\t/**\n\t * simple function bind\n\t * @param {Function} fn\n\t * @param {Object} context\n\t * @returns {Function}\n\t */\n\tfunction bindFn(fn, context) {\n\t return function boundFn() {\n\t return fn.apply(context, arguments);\n\t };\n\t}\n\t\n\t/**\n\t * let a boolean value also be a function that must return a boolean\n\t * this first item in args will be used as the context\n\t * @param {Boolean|Function} val\n\t * @param {Array} [args]\n\t * @returns {Boolean}\n\t */\n\tfunction boolOrFn(val, args) {\n\t if (typeof val == TYPE_FUNCTION) {\n\t return val.apply(args ? args[0] || undefined : undefined, args);\n\t }\n\t return val;\n\t}\n\t\n\t/**\n\t * use the val2 when val1 is undefined\n\t * @param {*} val1\n\t * @param {*} val2\n\t * @returns {*}\n\t */\n\tfunction ifUndefined(val1, val2) {\n\t return (val1 === undefined) ? val2 : val1;\n\t}\n\t\n\t/**\n\t * addEventListener with multiple events at once\n\t * @param {EventTarget} target\n\t * @param {String} types\n\t * @param {Function} handler\n\t */\n\tfunction addEventListeners(target, types, handler) {\n\t each(splitStr(types), function(type) {\n\t target.addEventListener(type, handler, false);\n\t });\n\t}\n\t\n\t/**\n\t * removeEventListener with multiple events at once\n\t * @param {EventTarget} target\n\t * @param {String} types\n\t * @param {Function} handler\n\t */\n\tfunction removeEventListeners(target, types, handler) {\n\t each(splitStr(types), function(type) {\n\t target.removeEventListener(type, handler, false);\n\t });\n\t}\n\t\n\t/**\n\t * find if a node is in the given parent\n\t * @method hasParent\n\t * @param {HTMLElement} node\n\t * @param {HTMLElement} parent\n\t * @return {Boolean} found\n\t */\n\tfunction hasParent(node, parent) {\n\t while (node) {\n\t if (node == parent) {\n\t return true;\n\t }\n\t node = node.parentNode;\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * small indexOf wrapper\n\t * @param {String} str\n\t * @param {String} find\n\t * @returns {Boolean} found\n\t */\n\tfunction inStr(str, find) {\n\t return str.indexOf(find) > -1;\n\t}\n\t\n\t/**\n\t * split string on whitespace\n\t * @param {String} str\n\t * @returns {Array} words\n\t */\n\tfunction splitStr(str) {\n\t return str.trim().split(/\\s+/g);\n\t}\n\t\n\t/**\n\t * find if a array contains the object using indexOf or a simple polyFill\n\t * @param {Array} src\n\t * @param {String} find\n\t * @param {String} [findByKey]\n\t * @return {Boolean|Number} false when not found, or the index\n\t */\n\tfunction inArray(src, find, findByKey) {\n\t if (src.indexOf && !findByKey) {\n\t return src.indexOf(find);\n\t } else {\n\t var i = 0;\n\t while (i < src.length) {\n\t if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n\t return i;\n\t }\n\t i++;\n\t }\n\t return -1;\n\t }\n\t}\n\t\n\t/**\n\t * convert array-like objects to real arrays\n\t * @param {Object} obj\n\t * @returns {Array}\n\t */\n\tfunction toArray(obj) {\n\t return Array.prototype.slice.call(obj, 0);\n\t}\n\t\n\t/**\n\t * unique array with objects based on a key (like 'id') or just by the array's value\n\t * @param {Array} src [{id:1},{id:2},{id:1}]\n\t * @param {String} [key]\n\t * @param {Boolean} [sort=False]\n\t * @returns {Array} [{id:1},{id:2}]\n\t */\n\tfunction uniqueArray(src, key, sort) {\n\t var results = [];\n\t var values = [];\n\t var i = 0;\n\t\n\t while (i < src.length) {\n\t var val = key ? src[i][key] : src[i];\n\t if (inArray(values, val) < 0) {\n\t results.push(src[i]);\n\t }\n\t values[i] = val;\n\t i++;\n\t }\n\t\n\t if (sort) {\n\t if (!key) {\n\t results = results.sort();\n\t } else {\n\t results = results.sort(function sortUniqueArray(a, b) {\n\t return a[key] > b[key];\n\t });\n\t }\n\t }\n\t\n\t return results;\n\t}\n\t\n\t/**\n\t * get the prefixed property\n\t * @param {Object} obj\n\t * @param {String} property\n\t * @returns {String|Undefined} prefixed\n\t */\n\tfunction prefixed(obj, property) {\n\t var prefix, prop;\n\t var camelProp = property[0].toUpperCase() + property.slice(1);\n\t\n\t var i = 0;\n\t while (i < VENDOR_PREFIXES.length) {\n\t prefix = VENDOR_PREFIXES[i];\n\t prop = (prefix) ? prefix + camelProp : property;\n\t\n\t if (prop in obj) {\n\t return prop;\n\t }\n\t i++;\n\t }\n\t return undefined;\n\t}\n\t\n\t/**\n\t * get a unique id\n\t * @returns {number} uniqueId\n\t */\n\tvar _uniqueId = 1;\n\tfunction uniqueId() {\n\t return _uniqueId++;\n\t}\n\t\n\t/**\n\t * get the window object of an element\n\t * @param {HTMLElement} element\n\t * @returns {DocumentView|Window}\n\t */\n\tfunction getWindowForElement(element) {\n\t var doc = element.ownerDocument || element;\n\t return (doc.defaultView || doc.parentWindow || window);\n\t}\n\t\n\tvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n\t\n\tvar SUPPORT_TOUCH = ('ontouchstart' in window);\n\tvar SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\n\tvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n\t\n\tvar INPUT_TYPE_TOUCH = 'touch';\n\tvar INPUT_TYPE_PEN = 'pen';\n\tvar INPUT_TYPE_MOUSE = 'mouse';\n\tvar INPUT_TYPE_KINECT = 'kinect';\n\t\n\tvar COMPUTE_INTERVAL = 25;\n\t\n\tvar INPUT_START = 1;\n\tvar INPUT_MOVE = 2;\n\tvar INPUT_END = 4;\n\tvar INPUT_CANCEL = 8;\n\t\n\tvar DIRECTION_NONE = 1;\n\tvar DIRECTION_LEFT = 2;\n\tvar DIRECTION_RIGHT = 4;\n\tvar DIRECTION_UP = 8;\n\tvar DIRECTION_DOWN = 16;\n\t\n\tvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\n\tvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\n\tvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n\t\n\tvar PROPS_XY = ['x', 'y'];\n\tvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\t\n\t/**\n\t * create new input type manager\n\t * @param {Manager} manager\n\t * @param {Function} callback\n\t * @returns {Input}\n\t * @constructor\n\t */\n\tfunction Input(manager, callback) {\n\t var self = this;\n\t this.manager = manager;\n\t this.callback = callback;\n\t this.element = manager.element;\n\t this.target = manager.options.inputTarget;\n\t\n\t // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n\t // so when disabled the input events are completely bypassed.\n\t this.domHandler = function(ev) {\n\t if (boolOrFn(manager.options.enable, [manager])) {\n\t self.handler(ev);\n\t }\n\t };\n\t\n\t this.init();\n\t\n\t}\n\t\n\tInput.prototype = {\n\t /**\n\t * should handle the inputEvent data and trigger the callback\n\t * @virtual\n\t */\n\t handler: function() { },\n\t\n\t /**\n\t * bind the events\n\t */\n\t init: function() {\n\t this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n\t this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n\t this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n\t },\n\t\n\t /**\n\t * unbind the events\n\t */\n\t destroy: function() {\n\t this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n\t this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n\t this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n\t }\n\t};\n\t\n\t/**\n\t * create new input type manager\n\t * called by the Manager constructor\n\t * @param {Hammer} manager\n\t * @returns {Input}\n\t */\n\tfunction createInputInstance(manager) {\n\t var Type;\n\t var inputClass = manager.options.inputClass;\n\t\n\t if (inputClass) {\n\t Type = inputClass;\n\t } else if (SUPPORT_POINTER_EVENTS) {\n\t Type = PointerEventInput;\n\t } else if (SUPPORT_ONLY_TOUCH) {\n\t Type = TouchInput;\n\t } else if (!SUPPORT_TOUCH) {\n\t Type = MouseInput;\n\t } else {\n\t Type = TouchMouseInput;\n\t }\n\t return new (Type)(manager, inputHandler);\n\t}\n\t\n\t/**\n\t * handle input events\n\t * @param {Manager} manager\n\t * @param {String} eventType\n\t * @param {Object} input\n\t */\n\tfunction inputHandler(manager, eventType, input) {\n\t var pointersLen = input.pointers.length;\n\t var changedPointersLen = input.changedPointers.length;\n\t var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n\t var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n\t\n\t input.isFirst = !!isFirst;\n\t input.isFinal = !!isFinal;\n\t\n\t if (isFirst) {\n\t manager.session = {};\n\t }\n\t\n\t // source event is the normalized value of the domEvents\n\t // like 'touchstart, mouseup, pointerdown'\n\t input.eventType = eventType;\n\t\n\t // compute scale, rotation etc\n\t computeInputData(manager, input);\n\t\n\t // emit secret event\n\t manager.emit('hammer.input', input);\n\t\n\t manager.recognize(input);\n\t manager.session.prevInput = input;\n\t}\n\t\n\t/**\n\t * extend the data with some usable properties like scale, rotate, velocity etc\n\t * @param {Object} manager\n\t * @param {Object} input\n\t */\n\tfunction computeInputData(manager, input) {\n\t var session = manager.session;\n\t var pointers = input.pointers;\n\t var pointersLength = pointers.length;\n\t\n\t // store the first input to calculate the distance and direction\n\t if (!session.firstInput) {\n\t session.firstInput = simpleCloneInputData(input);\n\t }\n\t\n\t // to compute scale and rotation we need to store the multiple touches\n\t if (pointersLength > 1 && !session.firstMultiple) {\n\t session.firstMultiple = simpleCloneInputData(input);\n\t } else if (pointersLength === 1) {\n\t session.firstMultiple = false;\n\t }\n\t\n\t var firstInput = session.firstInput;\n\t var firstMultiple = session.firstMultiple;\n\t var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n\t\n\t var center = input.center = getCenter(pointers);\n\t input.timeStamp = now();\n\t input.deltaTime = input.timeStamp - firstInput.timeStamp;\n\t\n\t input.angle = getAngle(offsetCenter, center);\n\t input.distance = getDistance(offsetCenter, center);\n\t\n\t computeDeltaXY(session, input);\n\t input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n\t\n\t var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n\t input.overallVelocityX = overallVelocity.x;\n\t input.overallVelocityY = overallVelocity.y;\n\t input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n\t\n\t input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n\t input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n\t\n\t input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n\t session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n\t\n\t computeIntervalInputData(session, input);\n\t\n\t // find the correct target\n\t var target = manager.element;\n\t if (hasParent(input.srcEvent.target, target)) {\n\t target = input.srcEvent.target;\n\t }\n\t input.target = target;\n\t}\n\t\n\tfunction computeDeltaXY(session, input) {\n\t var center = input.center;\n\t var offset = session.offsetDelta || {};\n\t var prevDelta = session.prevDelta || {};\n\t var prevInput = session.prevInput || {};\n\t\n\t if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n\t prevDelta = session.prevDelta = {\n\t x: prevInput.deltaX || 0,\n\t y: prevInput.deltaY || 0\n\t };\n\t\n\t offset = session.offsetDelta = {\n\t x: center.x,\n\t y: center.y\n\t };\n\t }\n\t\n\t input.deltaX = prevDelta.x + (center.x - offset.x);\n\t input.deltaY = prevDelta.y + (center.y - offset.y);\n\t}\n\t\n\t/**\n\t * velocity is calculated every x ms\n\t * @param {Object} session\n\t * @param {Object} input\n\t */\n\tfunction computeIntervalInputData(session, input) {\n\t var last = session.lastInterval || input,\n\t deltaTime = input.timeStamp - last.timeStamp,\n\t velocity, velocityX, velocityY, direction;\n\t\n\t if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n\t var deltaX = input.deltaX - last.deltaX;\n\t var deltaY = input.deltaY - last.deltaY;\n\t\n\t var v = getVelocity(deltaTime, deltaX, deltaY);\n\t velocityX = v.x;\n\t velocityY = v.y;\n\t velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n\t direction = getDirection(deltaX, deltaY);\n\t\n\t session.lastInterval = input;\n\t } else {\n\t // use latest velocity info if it doesn't overtake a minimum period\n\t velocity = last.velocity;\n\t velocityX = last.velocityX;\n\t velocityY = last.velocityY;\n\t direction = last.direction;\n\t }\n\t\n\t input.velocity = velocity;\n\t input.velocityX = velocityX;\n\t input.velocityY = velocityY;\n\t input.direction = direction;\n\t}\n\t\n\t/**\n\t * create a simple clone from the input used for storage of firstInput and firstMultiple\n\t * @param {Object} input\n\t * @returns {Object} clonedInputData\n\t */\n\tfunction simpleCloneInputData(input) {\n\t // make a simple copy of the pointers because we will get a reference if we don't\n\t // we only need clientXY for the calculations\n\t var pointers = [];\n\t var i = 0;\n\t while (i < input.pointers.length) {\n\t pointers[i] = {\n\t clientX: round(input.pointers[i].clientX),\n\t clientY: round(input.pointers[i].clientY)\n\t };\n\t i++;\n\t }\n\t\n\t return {\n\t timeStamp: now(),\n\t pointers: pointers,\n\t center: getCenter(pointers),\n\t deltaX: input.deltaX,\n\t deltaY: input.deltaY\n\t };\n\t}\n\t\n\t/**\n\t * get the center of all the pointers\n\t * @param {Array} pointers\n\t * @return {Object} center contains `x` and `y` properties\n\t */\n\tfunction getCenter(pointers) {\n\t var pointersLength = pointers.length;\n\t\n\t // no need to loop when only one touch\n\t if (pointersLength === 1) {\n\t return {\n\t x: round(pointers[0].clientX),\n\t y: round(pointers[0].clientY)\n\t };\n\t }\n\t\n\t var x = 0, y = 0, i = 0;\n\t while (i < pointersLength) {\n\t x += pointers[i].clientX;\n\t y += pointers[i].clientY;\n\t i++;\n\t }\n\t\n\t return {\n\t x: round(x / pointersLength),\n\t y: round(y / pointersLength)\n\t };\n\t}\n\t\n\t/**\n\t * calculate the velocity between two points. unit is in px per ms.\n\t * @param {Number} deltaTime\n\t * @param {Number} x\n\t * @param {Number} y\n\t * @return {Object} velocity `x` and `y`\n\t */\n\tfunction getVelocity(deltaTime, x, y) {\n\t return {\n\t x: x / deltaTime || 0,\n\t y: y / deltaTime || 0\n\t };\n\t}\n\t\n\t/**\n\t * get the direction between two points\n\t * @param {Number} x\n\t * @param {Number} y\n\t * @return {Number} direction\n\t */\n\tfunction getDirection(x, y) {\n\t if (x === y) {\n\t return DIRECTION_NONE;\n\t }\n\t\n\t if (abs(x) >= abs(y)) {\n\t return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n\t }\n\t return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n\t}\n\t\n\t/**\n\t * calculate the absolute distance between two points\n\t * @param {Object} p1 {x, y}\n\t * @param {Object} p2 {x, y}\n\t * @param {Array} [props] containing x and y keys\n\t * @return {Number} distance\n\t */\n\tfunction getDistance(p1, p2, props) {\n\t if (!props) {\n\t props = PROPS_XY;\n\t }\n\t var x = p2[props[0]] - p1[props[0]],\n\t y = p2[props[1]] - p1[props[1]];\n\t\n\t return Math.sqrt((x * x) + (y * y));\n\t}\n\t\n\t/**\n\t * calculate the angle between two coordinates\n\t * @param {Object} p1\n\t * @param {Object} p2\n\t * @param {Array} [props] containing x and y keys\n\t * @return {Number} angle\n\t */\n\tfunction getAngle(p1, p2, props) {\n\t if (!props) {\n\t props = PROPS_XY;\n\t }\n\t var x = p2[props[0]] - p1[props[0]],\n\t y = p2[props[1]] - p1[props[1]];\n\t return Math.atan2(y, x) * 180 / Math.PI;\n\t}\n\t\n\t/**\n\t * calculate the rotation degrees between two pointersets\n\t * @param {Array} start array of pointers\n\t * @param {Array} end array of pointers\n\t * @return {Number} rotation\n\t */\n\tfunction getRotation(start, end) {\n\t return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n\t}\n\t\n\t/**\n\t * calculate the scale factor between two pointersets\n\t * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n\t * @param {Array} start array of pointers\n\t * @param {Array} end array of pointers\n\t * @return {Number} scale\n\t */\n\tfunction getScale(start, end) {\n\t return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n\t}\n\t\n\tvar MOUSE_INPUT_MAP = {\n\t mousedown: INPUT_START,\n\t mousemove: INPUT_MOVE,\n\t mouseup: INPUT_END\n\t};\n\t\n\tvar MOUSE_ELEMENT_EVENTS = 'mousedown';\n\tvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\t\n\t/**\n\t * Mouse events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction MouseInput() {\n\t this.evEl = MOUSE_ELEMENT_EVENTS;\n\t this.evWin = MOUSE_WINDOW_EVENTS;\n\t\n\t this.allow = true; // used by Input.TouchMouse to disable mouse events\n\t this.pressed = false; // mousedown state\n\t\n\t Input.apply(this, arguments);\n\t}\n\t\n\tinherit(MouseInput, Input, {\n\t /**\n\t * handle mouse events\n\t * @param {Object} ev\n\t */\n\t handler: function MEhandler(ev) {\n\t var eventType = MOUSE_INPUT_MAP[ev.type];\n\t\n\t // on start we want to have the left mouse button down\n\t if (eventType & INPUT_START && ev.button === 0) {\n\t this.pressed = true;\n\t }\n\t\n\t if (eventType & INPUT_MOVE && ev.which !== 1) {\n\t eventType = INPUT_END;\n\t }\n\t\n\t // mouse must be down, and mouse events are allowed (see the TouchMouse input)\n\t if (!this.pressed || !this.allow) {\n\t return;\n\t }\n\t\n\t if (eventType & INPUT_END) {\n\t this.pressed = false;\n\t }\n\t\n\t this.callback(this.manager, eventType, {\n\t pointers: [ev],\n\t changedPointers: [ev],\n\t pointerType: INPUT_TYPE_MOUSE,\n\t srcEvent: ev\n\t });\n\t }\n\t});\n\t\n\tvar POINTER_INPUT_MAP = {\n\t pointerdown: INPUT_START,\n\t pointermove: INPUT_MOVE,\n\t pointerup: INPUT_END,\n\t pointercancel: INPUT_CANCEL,\n\t pointerout: INPUT_CANCEL\n\t};\n\t\n\t// in IE10 the pointer types is defined as an enum\n\tvar IE10_POINTER_TYPE_ENUM = {\n\t 2: INPUT_TYPE_TOUCH,\n\t 3: INPUT_TYPE_PEN,\n\t 4: INPUT_TYPE_MOUSE,\n\t 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n\t};\n\t\n\tvar POINTER_ELEMENT_EVENTS = 'pointerdown';\n\tvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\t\n\t// IE10 has prefixed support, and case-sensitive\n\tif (window.MSPointerEvent && !window.PointerEvent) {\n\t POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n\t POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n\t}\n\t\n\t/**\n\t * Pointer events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction PointerEventInput() {\n\t this.evEl = POINTER_ELEMENT_EVENTS;\n\t this.evWin = POINTER_WINDOW_EVENTS;\n\t\n\t Input.apply(this, arguments);\n\t\n\t this.store = (this.manager.session.pointerEvents = []);\n\t}\n\t\n\tinherit(PointerEventInput, Input, {\n\t /**\n\t * handle mouse events\n\t * @param {Object} ev\n\t */\n\t handler: function PEhandler(ev) {\n\t var store = this.store;\n\t var removePointer = false;\n\t\n\t var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n\t var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n\t var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n\t\n\t var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n\t\n\t // get index of the event in the store\n\t var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\t\n\t // start and mouse must be down\n\t if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n\t if (storeIndex < 0) {\n\t store.push(ev);\n\t storeIndex = store.length - 1;\n\t }\n\t } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n\t removePointer = true;\n\t }\n\t\n\t // it not found, so the pointer hasn't been down (so it's probably a hover)\n\t if (storeIndex < 0) {\n\t return;\n\t }\n\t\n\t // update the event in the store\n\t store[storeIndex] = ev;\n\t\n\t this.callback(this.manager, eventType, {\n\t pointers: store,\n\t changedPointers: [ev],\n\t pointerType: pointerType,\n\t srcEvent: ev\n\t });\n\t\n\t if (removePointer) {\n\t // remove from the store\n\t store.splice(storeIndex, 1);\n\t }\n\t }\n\t});\n\t\n\tvar SINGLE_TOUCH_INPUT_MAP = {\n\t touchstart: INPUT_START,\n\t touchmove: INPUT_MOVE,\n\t touchend: INPUT_END,\n\t touchcancel: INPUT_CANCEL\n\t};\n\t\n\tvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\n\tvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\t\n\t/**\n\t * Touch events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction SingleTouchInput() {\n\t this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n\t this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n\t this.started = false;\n\t\n\t Input.apply(this, arguments);\n\t}\n\t\n\tinherit(SingleTouchInput, Input, {\n\t handler: function TEhandler(ev) {\n\t var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\t\n\t // should we handle the touch events?\n\t if (type === INPUT_START) {\n\t this.started = true;\n\t }\n\t\n\t if (!this.started) {\n\t return;\n\t }\n\t\n\t var touches = normalizeSingleTouches.call(this, ev, type);\n\t\n\t // when done, reset the started state\n\t if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n\t this.started = false;\n\t }\n\t\n\t this.callback(this.manager, type, {\n\t pointers: touches[0],\n\t changedPointers: touches[1],\n\t pointerType: INPUT_TYPE_TOUCH,\n\t srcEvent: ev\n\t });\n\t }\n\t});\n\t\n\t/**\n\t * @this {TouchInput}\n\t * @param {Object} ev\n\t * @param {Number} type flag\n\t * @returns {undefined|Array} [all, changed]\n\t */\n\tfunction normalizeSingleTouches(ev, type) {\n\t var all = toArray(ev.touches);\n\t var changed = toArray(ev.changedTouches);\n\t\n\t if (type & (INPUT_END | INPUT_CANCEL)) {\n\t all = uniqueArray(all.concat(changed), 'identifier', true);\n\t }\n\t\n\t return [all, changed];\n\t}\n\t\n\tvar TOUCH_INPUT_MAP = {\n\t touchstart: INPUT_START,\n\t touchmove: INPUT_MOVE,\n\t touchend: INPUT_END,\n\t touchcancel: INPUT_CANCEL\n\t};\n\t\n\tvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\t\n\t/**\n\t * Multi-user touch events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction TouchInput() {\n\t this.evTarget = TOUCH_TARGET_EVENTS;\n\t this.targetIds = {};\n\t\n\t Input.apply(this, arguments);\n\t}\n\t\n\tinherit(TouchInput, Input, {\n\t handler: function MTEhandler(ev) {\n\t var type = TOUCH_INPUT_MAP[ev.type];\n\t var touches = getTouches.call(this, ev, type);\n\t if (!touches) {\n\t return;\n\t }\n\t\n\t this.callback(this.manager, type, {\n\t pointers: touches[0],\n\t changedPointers: touches[1],\n\t pointerType: INPUT_TYPE_TOUCH,\n\t srcEvent: ev\n\t });\n\t }\n\t});\n\t\n\t/**\n\t * @this {TouchInput}\n\t * @param {Object} ev\n\t * @param {Number} type flag\n\t * @returns {undefined|Array} [all, changed]\n\t */\n\tfunction getTouches(ev, type) {\n\t var allTouches = toArray(ev.touches);\n\t var targetIds = this.targetIds;\n\t\n\t // when there is only one touch, the process can be simplified\n\t if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n\t targetIds[allTouches[0].identifier] = true;\n\t return [allTouches, allTouches];\n\t }\n\t\n\t var i,\n\t targetTouches,\n\t changedTouches = toArray(ev.changedTouches),\n\t changedTargetTouches = [],\n\t target = this.target;\n\t\n\t // get target touches from touches\n\t targetTouches = allTouches.filter(function(touch) {\n\t return hasParent(touch.target, target);\n\t });\n\t\n\t // collect touches\n\t if (type === INPUT_START) {\n\t i = 0;\n\t while (i < targetTouches.length) {\n\t targetIds[targetTouches[i].identifier] = true;\n\t i++;\n\t }\n\t }\n\t\n\t // filter changed touches to only contain touches that exist in the collected target ids\n\t i = 0;\n\t while (i < changedTouches.length) {\n\t if (targetIds[changedTouches[i].identifier]) {\n\t changedTargetTouches.push(changedTouches[i]);\n\t }\n\t\n\t // cleanup removed touches\n\t if (type & (INPUT_END | INPUT_CANCEL)) {\n\t delete targetIds[changedTouches[i].identifier];\n\t }\n\t i++;\n\t }\n\t\n\t if (!changedTargetTouches.length) {\n\t return;\n\t }\n\t\n\t return [\n\t // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n\t uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n\t changedTargetTouches\n\t ];\n\t}\n\t\n\t/**\n\t * Combined touch and mouse input\n\t *\n\t * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n\t * This because touch devices also emit mouse events while doing a touch.\n\t *\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction TouchMouseInput() {\n\t Input.apply(this, arguments);\n\t\n\t var handler = bindFn(this.handler, this);\n\t this.touch = new TouchInput(this.manager, handler);\n\t this.mouse = new MouseInput(this.manager, handler);\n\t}\n\t\n\tinherit(TouchMouseInput, Input, {\n\t /**\n\t * handle mouse and touch events\n\t * @param {Hammer} manager\n\t * @param {String} inputEvent\n\t * @param {Object} inputData\n\t */\n\t handler: function TMEhandler(manager, inputEvent, inputData) {\n\t var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),\n\t isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n\t\n\t // when we're in a touch event, so block all upcoming mouse events\n\t // most mobile browser also emit mouseevents, right after touchstart\n\t if (isTouch) {\n\t this.mouse.allow = false;\n\t } else if (isMouse && !this.mouse.allow) {\n\t return;\n\t }\n\t\n\t // reset the allowMouse when we're done\n\t if (inputEvent & (INPUT_END | INPUT_CANCEL)) {\n\t this.mouse.allow = true;\n\t }\n\t\n\t this.callback(manager, inputEvent, inputData);\n\t },\n\t\n\t /**\n\t * remove the event listeners\n\t */\n\t destroy: function destroy() {\n\t this.touch.destroy();\n\t this.mouse.destroy();\n\t }\n\t});\n\t\n\tvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\n\tvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\t\n\t// magical touchAction value\n\tvar TOUCH_ACTION_COMPUTE = 'compute';\n\tvar TOUCH_ACTION_AUTO = 'auto';\n\tvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n\tvar TOUCH_ACTION_NONE = 'none';\n\tvar TOUCH_ACTION_PAN_X = 'pan-x';\n\tvar TOUCH_ACTION_PAN_Y = 'pan-y';\n\t\n\t/**\n\t * Touch Action\n\t * sets the touchAction property or uses the js alternative\n\t * @param {Manager} manager\n\t * @param {String} value\n\t * @constructor\n\t */\n\tfunction TouchAction(manager, value) {\n\t this.manager = manager;\n\t this.set(value);\n\t}\n\t\n\tTouchAction.prototype = {\n\t /**\n\t * set the touchAction value on the element or enable the polyfill\n\t * @param {String} value\n\t */\n\t set: function(value) {\n\t // find out the touch-action by the event handlers\n\t if (value == TOUCH_ACTION_COMPUTE) {\n\t value = this.compute();\n\t }\n\t\n\t if (NATIVE_TOUCH_ACTION && this.manager.element.style) {\n\t this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n\t }\n\t this.actions = value.toLowerCase().trim();\n\t },\n\t\n\t /**\n\t * just re-set the touchAction value\n\t */\n\t update: function() {\n\t this.set(this.manager.options.touchAction);\n\t },\n\t\n\t /**\n\t * compute the value for the touchAction property based on the recognizer's settings\n\t * @returns {String} value\n\t */\n\t compute: function() {\n\t var actions = [];\n\t each(this.manager.recognizers, function(recognizer) {\n\t if (boolOrFn(recognizer.options.enable, [recognizer])) {\n\t actions = actions.concat(recognizer.getTouchAction());\n\t }\n\t });\n\t return cleanTouchActions(actions.join(' '));\n\t },\n\t\n\t /**\n\t * this method is called on each input cycle and provides the preventing of the browser behavior\n\t * @param {Object} input\n\t */\n\t preventDefaults: function(input) {\n\t // not needed with native support for the touchAction property\n\t if (NATIVE_TOUCH_ACTION) {\n\t return;\n\t }\n\t\n\t var srcEvent = input.srcEvent;\n\t var direction = input.offsetDirection;\n\t\n\t // if the touch action did prevented once this session\n\t if (this.manager.session.prevented) {\n\t srcEvent.preventDefault();\n\t return;\n\t }\n\t\n\t var actions = this.actions;\n\t var hasNone = inStr(actions, TOUCH_ACTION_NONE);\n\t var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\t var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\t\n\t if (hasNone) {\n\t //do not prevent defaults if this is a tap gesture\n\t\n\t var isTapPointer = input.pointers.length === 1;\n\t var isTapMovement = input.distance < 2;\n\t var isTapTouchTime = input.deltaTime < 250;\n\t\n\t if (isTapPointer && isTapMovement && isTapTouchTime) {\n\t return;\n\t }\n\t }\n\t\n\t if (hasPanX && hasPanY) {\n\t // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n\t return;\n\t }\n\t\n\t if (hasNone ||\n\t (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n\t (hasPanX && direction & DIRECTION_VERTICAL)) {\n\t return this.preventSrc(srcEvent);\n\t }\n\t },\n\t\n\t /**\n\t * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n\t * @param {Object} srcEvent\n\t */\n\t preventSrc: function(srcEvent) {\n\t this.manager.session.prevented = true;\n\t srcEvent.preventDefault();\n\t }\n\t};\n\t\n\t/**\n\t * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n\t * @param {String} actions\n\t * @returns {*}\n\t */\n\tfunction cleanTouchActions(actions) {\n\t // none\n\t if (inStr(actions, TOUCH_ACTION_NONE)) {\n\t return TOUCH_ACTION_NONE;\n\t }\n\t\n\t var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\t var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\t\n\t // if both pan-x and pan-y are set (different recognizers\n\t // for different directions, e.g. horizontal pan but vertical swipe?)\n\t // we need none (as otherwise with pan-x pan-y combined none of these\n\t // recognizers will work, since the browser would handle all panning\n\t if (hasPanX && hasPanY) {\n\t return TOUCH_ACTION_NONE;\n\t }\n\t\n\t // pan-x OR pan-y\n\t if (hasPanX || hasPanY) {\n\t return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n\t }\n\t\n\t // manipulation\n\t if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n\t return TOUCH_ACTION_MANIPULATION;\n\t }\n\t\n\t return TOUCH_ACTION_AUTO;\n\t}\n\t\n\t/**\n\t * Recognizer flow explained; *\n\t * All recognizers have the initial state of POSSIBLE when a input session starts.\n\t * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n\t * Example session for mouse-input: mousedown -> mousemove -> mouseup\n\t *\n\t * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n\t * which determines with state it should be.\n\t *\n\t * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n\t * POSSIBLE to give it another change on the next cycle.\n\t *\n\t * Possible\n\t * |\n\t * +-----+---------------+\n\t * | |\n\t * +-----+-----+ |\n\t * | | |\n\t * Failed Cancelled |\n\t * +-------+------+\n\t * | |\n\t * Recognized Began\n\t * |\n\t * Changed\n\t * |\n\t * Ended/Recognized\n\t */\n\tvar STATE_POSSIBLE = 1;\n\tvar STATE_BEGAN = 2;\n\tvar STATE_CHANGED = 4;\n\tvar STATE_ENDED = 8;\n\tvar STATE_RECOGNIZED = STATE_ENDED;\n\tvar STATE_CANCELLED = 16;\n\tvar STATE_FAILED = 32;\n\t\n\t/**\n\t * Recognizer\n\t * Every recognizer needs to extend from this class.\n\t * @constructor\n\t * @param {Object} options\n\t */\n\tfunction Recognizer(options) {\n\t this.options = assign({}, this.defaults, options || {});\n\t\n\t this.id = uniqueId();\n\t\n\t this.manager = null;\n\t\n\t // default is enable true\n\t this.options.enable = ifUndefined(this.options.enable, true);\n\t\n\t this.state = STATE_POSSIBLE;\n\t\n\t this.simultaneous = {};\n\t this.requireFail = [];\n\t}\n\t\n\tRecognizer.prototype = {\n\t /**\n\t * @virtual\n\t * @type {Object}\n\t */\n\t defaults: {},\n\t\n\t /**\n\t * set options\n\t * @param {Object} options\n\t * @return {Recognizer}\n\t */\n\t set: function(options) {\n\t assign(this.options, options);\n\t\n\t // also update the touchAction, in case something changed about the directions/enabled state\n\t this.manager && this.manager.touchAction.update();\n\t return this;\n\t },\n\t\n\t /**\n\t * recognize simultaneous with an other recognizer.\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t recognizeWith: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n\t return this;\n\t }\n\t\n\t var simultaneous = this.simultaneous;\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t if (!simultaneous[otherRecognizer.id]) {\n\t simultaneous[otherRecognizer.id] = otherRecognizer;\n\t otherRecognizer.recognizeWith(this);\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t dropRecognizeWith: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n\t return this;\n\t }\n\t\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t delete this.simultaneous[otherRecognizer.id];\n\t return this;\n\t },\n\t\n\t /**\n\t * recognizer can only run when an other is failing\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t requireFailure: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n\t return this;\n\t }\n\t\n\t var requireFail = this.requireFail;\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t if (inArray(requireFail, otherRecognizer) === -1) {\n\t requireFail.push(otherRecognizer);\n\t otherRecognizer.requireFailure(this);\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * drop the requireFailure link. it does not remove the link on the other recognizer.\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t dropRequireFailure: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n\t return this;\n\t }\n\t\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t var index = inArray(this.requireFail, otherRecognizer);\n\t if (index > -1) {\n\t this.requireFail.splice(index, 1);\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * has require failures boolean\n\t * @returns {boolean}\n\t */\n\t hasRequireFailures: function() {\n\t return this.requireFail.length > 0;\n\t },\n\t\n\t /**\n\t * if the recognizer can recognize simultaneous with an other recognizer\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Boolean}\n\t */\n\t canRecognizeWith: function(otherRecognizer) {\n\t return !!this.simultaneous[otherRecognizer.id];\n\t },\n\t\n\t /**\n\t * You should use `tryEmit` instead of `emit` directly to check\n\t * that all the needed recognizers has failed before emitting.\n\t * @param {Object} input\n\t */\n\t emit: function(input) {\n\t var self = this;\n\t var state = this.state;\n\t\n\t function emit(event) {\n\t self.manager.emit(event, input);\n\t }\n\t\n\t // 'panstart' and 'panmove'\n\t if (state < STATE_ENDED) {\n\t emit(self.options.event + stateStr(state));\n\t }\n\t\n\t emit(self.options.event); // simple 'eventName' events\n\t\n\t if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n\t emit(input.additionalEvent);\n\t }\n\t\n\t // panend and pancancel\n\t if (state >= STATE_ENDED) {\n\t emit(self.options.event + stateStr(state));\n\t }\n\t },\n\t\n\t /**\n\t * Check that all the require failure recognizers has failed,\n\t * if true, it emits a gesture event,\n\t * otherwise, setup the state to FAILED.\n\t * @param {Object} input\n\t */\n\t tryEmit: function(input) {\n\t if (this.canEmit()) {\n\t return this.emit(input);\n\t }\n\t // it's failing anyway\n\t this.state = STATE_FAILED;\n\t },\n\t\n\t /**\n\t * can we emit?\n\t * @returns {boolean}\n\t */\n\t canEmit: function() {\n\t var i = 0;\n\t while (i < this.requireFail.length) {\n\t if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n\t return false;\n\t }\n\t i++;\n\t }\n\t return true;\n\t },\n\t\n\t /**\n\t * update the recognizer\n\t * @param {Object} inputData\n\t */\n\t recognize: function(inputData) {\n\t // make a new copy of the inputData\n\t // so we can change the inputData without messing up the other recognizers\n\t var inputDataClone = assign({}, inputData);\n\t\n\t // is is enabled and allow recognizing?\n\t if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n\t this.reset();\n\t this.state = STATE_FAILED;\n\t return;\n\t }\n\t\n\t // reset when we've reached the end\n\t if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n\t this.state = STATE_POSSIBLE;\n\t }\n\t\n\t this.state = this.process(inputDataClone);\n\t\n\t // the recognizer has recognized a gesture\n\t // so trigger an event\n\t if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n\t this.tryEmit(inputDataClone);\n\t }\n\t },\n\t\n\t /**\n\t * return the state of the recognizer\n\t * the actual recognizing happens in this method\n\t * @virtual\n\t * @param {Object} inputData\n\t * @returns {Const} STATE\n\t */\n\t process: function(inputData) { }, // jshint ignore:line\n\t\n\t /**\n\t * return the preferred touch-action\n\t * @virtual\n\t * @returns {Array}\n\t */\n\t getTouchAction: function() { },\n\t\n\t /**\n\t * called when the gesture isn't allowed to recognize\n\t * like when another is being recognized or it is disabled\n\t * @virtual\n\t */\n\t reset: function() { }\n\t};\n\t\n\t/**\n\t * get a usable string, used as event postfix\n\t * @param {Const} state\n\t * @returns {String} state\n\t */\n\tfunction stateStr(state) {\n\t if (state & STATE_CANCELLED) {\n\t return 'cancel';\n\t } else if (state & STATE_ENDED) {\n\t return 'end';\n\t } else if (state & STATE_CHANGED) {\n\t return 'move';\n\t } else if (state & STATE_BEGAN) {\n\t return 'start';\n\t }\n\t return '';\n\t}\n\t\n\t/**\n\t * direction cons to string\n\t * @param {Const} direction\n\t * @returns {String}\n\t */\n\tfunction directionStr(direction) {\n\t if (direction == DIRECTION_DOWN) {\n\t return 'down';\n\t } else if (direction == DIRECTION_UP) {\n\t return 'up';\n\t } else if (direction == DIRECTION_LEFT) {\n\t return 'left';\n\t } else if (direction == DIRECTION_RIGHT) {\n\t return 'right';\n\t }\n\t return '';\n\t}\n\t\n\t/**\n\t * get a recognizer by name if it is bound to a manager\n\t * @param {Recognizer|String} otherRecognizer\n\t * @param {Recognizer} recognizer\n\t * @returns {Recognizer}\n\t */\n\tfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n\t var manager = recognizer.manager;\n\t if (manager) {\n\t return manager.get(otherRecognizer);\n\t }\n\t return otherRecognizer;\n\t}\n\t\n\t/**\n\t * This recognizer is just used as a base for the simple attribute recognizers.\n\t * @constructor\n\t * @extends Recognizer\n\t */\n\tfunction AttrRecognizer() {\n\t Recognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(AttrRecognizer, Recognizer, {\n\t /**\n\t * @namespace\n\t * @memberof AttrRecognizer\n\t */\n\t defaults: {\n\t /**\n\t * @type {Number}\n\t * @default 1\n\t */\n\t pointers: 1\n\t },\n\t\n\t /**\n\t * Used to check if it the recognizer receives valid input, like input.distance > 10.\n\t * @memberof AttrRecognizer\n\t * @param {Object} input\n\t * @returns {Boolean} recognized\n\t */\n\t attrTest: function(input) {\n\t var optionPointers = this.options.pointers;\n\t return optionPointers === 0 || input.pointers.length === optionPointers;\n\t },\n\t\n\t /**\n\t * Process the input and return the state for the recognizer\n\t * @memberof AttrRecognizer\n\t * @param {Object} input\n\t * @returns {*} State\n\t */\n\t process: function(input) {\n\t var state = this.state;\n\t var eventType = input.eventType;\n\t\n\t var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n\t var isValid = this.attrTest(input);\n\t\n\t // on cancel input and we've recognized before, return STATE_CANCELLED\n\t if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n\t return state | STATE_CANCELLED;\n\t } else if (isRecognized || isValid) {\n\t if (eventType & INPUT_END) {\n\t return state | STATE_ENDED;\n\t } else if (!(state & STATE_BEGAN)) {\n\t return STATE_BEGAN;\n\t }\n\t return state | STATE_CHANGED;\n\t }\n\t return STATE_FAILED;\n\t }\n\t});\n\t\n\t/**\n\t * Pan\n\t * Recognized when the pointer is down and moved in the allowed direction.\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction PanRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t\n\t this.pX = null;\n\t this.pY = null;\n\t}\n\t\n\tinherit(PanRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PanRecognizer\n\t */\n\t defaults: {\n\t event: 'pan',\n\t threshold: 10,\n\t pointers: 1,\n\t direction: DIRECTION_ALL\n\t },\n\t\n\t getTouchAction: function() {\n\t var direction = this.options.direction;\n\t var actions = [];\n\t if (direction & DIRECTION_HORIZONTAL) {\n\t actions.push(TOUCH_ACTION_PAN_Y);\n\t }\n\t if (direction & DIRECTION_VERTICAL) {\n\t actions.push(TOUCH_ACTION_PAN_X);\n\t }\n\t return actions;\n\t },\n\t\n\t directionTest: function(input) {\n\t var options = this.options;\n\t var hasMoved = true;\n\t var distance = input.distance;\n\t var direction = input.direction;\n\t var x = input.deltaX;\n\t var y = input.deltaY;\n\t\n\t // lock to axis?\n\t if (!(direction & options.direction)) {\n\t if (options.direction & DIRECTION_HORIZONTAL) {\n\t direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n\t hasMoved = x != this.pX;\n\t distance = Math.abs(input.deltaX);\n\t } else {\n\t direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n\t hasMoved = y != this.pY;\n\t distance = Math.abs(input.deltaY);\n\t }\n\t }\n\t input.direction = direction;\n\t return hasMoved && distance > options.threshold && direction & options.direction;\n\t },\n\t\n\t attrTest: function(input) {\n\t return AttrRecognizer.prototype.attrTest.call(this, input) &&\n\t (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n\t },\n\t\n\t emit: function(input) {\n\t\n\t this.pX = input.deltaX;\n\t this.pY = input.deltaY;\n\t\n\t var direction = directionStr(input.direction);\n\t\n\t if (direction) {\n\t input.additionalEvent = this.options.event + direction;\n\t }\n\t this._super.emit.call(this, input);\n\t }\n\t});\n\t\n\t/**\n\t * Pinch\n\t * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction PinchRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(PinchRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PinchRecognizer\n\t */\n\t defaults: {\n\t event: 'pinch',\n\t threshold: 0,\n\t pointers: 2\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_NONE];\n\t },\n\t\n\t attrTest: function(input) {\n\t return this._super.attrTest.call(this, input) &&\n\t (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n\t },\n\t\n\t emit: function(input) {\n\t if (input.scale !== 1) {\n\t var inOut = input.scale < 1 ? 'in' : 'out';\n\t input.additionalEvent = this.options.event + inOut;\n\t }\n\t this._super.emit.call(this, input);\n\t }\n\t});\n\t\n\t/**\n\t * Press\n\t * Recognized when the pointer is down for x ms without any movement.\n\t * @constructor\n\t * @extends Recognizer\n\t */\n\tfunction PressRecognizer() {\n\t Recognizer.apply(this, arguments);\n\t\n\t this._timer = null;\n\t this._input = null;\n\t}\n\t\n\tinherit(PressRecognizer, Recognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PressRecognizer\n\t */\n\t defaults: {\n\t event: 'press',\n\t pointers: 1,\n\t time: 251, // minimal time of the pointer to be pressed\n\t threshold: 9 // a minimal movement is ok, but keep it low\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_AUTO];\n\t },\n\t\n\t process: function(input) {\n\t var options = this.options;\n\t var validPointers = input.pointers.length === options.pointers;\n\t var validMovement = input.distance < options.threshold;\n\t var validTime = input.deltaTime > options.time;\n\t\n\t this._input = input;\n\t\n\t // we only allow little movement\n\t // and we've reached an end event, so a tap is possible\n\t if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n\t this.reset();\n\t } else if (input.eventType & INPUT_START) {\n\t this.reset();\n\t this._timer = setTimeoutContext(function() {\n\t this.state = STATE_RECOGNIZED;\n\t this.tryEmit();\n\t }, options.time, this);\n\t } else if (input.eventType & INPUT_END) {\n\t return STATE_RECOGNIZED;\n\t }\n\t return STATE_FAILED;\n\t },\n\t\n\t reset: function() {\n\t clearTimeout(this._timer);\n\t },\n\t\n\t emit: function(input) {\n\t if (this.state !== STATE_RECOGNIZED) {\n\t return;\n\t }\n\t\n\t if (input && (input.eventType & INPUT_END)) {\n\t this.manager.emit(this.options.event + 'up', input);\n\t } else {\n\t this._input.timeStamp = now();\n\t this.manager.emit(this.options.event, this._input);\n\t }\n\t }\n\t});\n\t\n\t/**\n\t * Rotate\n\t * Recognized when two or more pointer are moving in a circular motion.\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction RotateRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(RotateRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof RotateRecognizer\n\t */\n\t defaults: {\n\t event: 'rotate',\n\t threshold: 0,\n\t pointers: 2\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_NONE];\n\t },\n\t\n\t attrTest: function(input) {\n\t return this._super.attrTest.call(this, input) &&\n\t (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n\t }\n\t});\n\t\n\t/**\n\t * Swipe\n\t * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction SwipeRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(SwipeRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof SwipeRecognizer\n\t */\n\t defaults: {\n\t event: 'swipe',\n\t threshold: 10,\n\t velocity: 0.3,\n\t direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n\t pointers: 1\n\t },\n\t\n\t getTouchAction: function() {\n\t return PanRecognizer.prototype.getTouchAction.call(this);\n\t },\n\t\n\t attrTest: function(input) {\n\t var direction = this.options.direction;\n\t var velocity;\n\t\n\t if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n\t velocity = input.overallVelocity;\n\t } else if (direction & DIRECTION_HORIZONTAL) {\n\t velocity = input.overallVelocityX;\n\t } else if (direction & DIRECTION_VERTICAL) {\n\t velocity = input.overallVelocityY;\n\t }\n\t\n\t return this._super.attrTest.call(this, input) &&\n\t direction & input.offsetDirection &&\n\t input.distance > this.options.threshold &&\n\t input.maxPointers == this.options.pointers &&\n\t abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n\t },\n\t\n\t emit: function(input) {\n\t var direction = directionStr(input.offsetDirection);\n\t if (direction) {\n\t this.manager.emit(this.options.event + direction, input);\n\t }\n\t\n\t this.manager.emit(this.options.event, input);\n\t }\n\t});\n\t\n\t/**\n\t * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n\t * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n\t * a single tap.\n\t *\n\t * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n\t * multi-taps being recognized.\n\t * @constructor\n\t * @extends Recognizer\n\t */\n\tfunction TapRecognizer() {\n\t Recognizer.apply(this, arguments);\n\t\n\t // previous time and center,\n\t // used for tap counting\n\t this.pTime = false;\n\t this.pCenter = false;\n\t\n\t this._timer = null;\n\t this._input = null;\n\t this.count = 0;\n\t}\n\t\n\tinherit(TapRecognizer, Recognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PinchRecognizer\n\t */\n\t defaults: {\n\t event: 'tap',\n\t pointers: 1,\n\t taps: 1,\n\t interval: 300, // max time between the multi-tap taps\n\t time: 250, // max time of the pointer to be down (like finger on the screen)\n\t threshold: 9, // a minimal movement is ok, but keep it low\n\t posThreshold: 10 // a multi-tap can be a bit off the initial position\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_MANIPULATION];\n\t },\n\t\n\t process: function(input) {\n\t var options = this.options;\n\t\n\t var validPointers = input.pointers.length === options.pointers;\n\t var validMovement = input.distance < options.threshold;\n\t var validTouchTime = input.deltaTime < options.time;\n\t\n\t this.reset();\n\t\n\t if ((input.eventType & INPUT_START) && (this.count === 0)) {\n\t return this.failTimeout();\n\t }\n\t\n\t // we only allow little movement\n\t // and we've reached an end event, so a tap is possible\n\t if (validMovement && validTouchTime && validPointers) {\n\t if (input.eventType != INPUT_END) {\n\t return this.failTimeout();\n\t }\n\t\n\t var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n\t var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n\t\n\t this.pTime = input.timeStamp;\n\t this.pCenter = input.center;\n\t\n\t if (!validMultiTap || !validInterval) {\n\t this.count = 1;\n\t } else {\n\t this.count += 1;\n\t }\n\t\n\t this._input = input;\n\t\n\t // if tap count matches we have recognized it,\n\t // else it has began recognizing...\n\t var tapCount = this.count % options.taps;\n\t if (tapCount === 0) {\n\t // no failing requirements, immediately trigger the tap event\n\t // or wait as long as the multitap interval to trigger\n\t if (!this.hasRequireFailures()) {\n\t return STATE_RECOGNIZED;\n\t } else {\n\t this._timer = setTimeoutContext(function() {\n\t this.state = STATE_RECOGNIZED;\n\t this.tryEmit();\n\t }, options.interval, this);\n\t return STATE_BEGAN;\n\t }\n\t }\n\t }\n\t return STATE_FAILED;\n\t },\n\t\n\t failTimeout: function() {\n\t this._timer = setTimeoutContext(function() {\n\t this.state = STATE_FAILED;\n\t }, this.options.interval, this);\n\t return STATE_FAILED;\n\t },\n\t\n\t reset: function() {\n\t clearTimeout(this._timer);\n\t },\n\t\n\t emit: function() {\n\t if (this.state == STATE_RECOGNIZED) {\n\t this._input.tapCount = this.count;\n\t this.manager.emit(this.options.event, this._input);\n\t }\n\t }\n\t});\n\t\n\t/**\n\t * Simple way to create a manager with a default set of recognizers.\n\t * @param {HTMLElement} element\n\t * @param {Object} [options]\n\t * @constructor\n\t */\n\tfunction Hammer(element, options) {\n\t options = options || {};\n\t options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n\t return new Manager(element, options);\n\t}\n\t\n\t/**\n\t * @const {string}\n\t */\n\tHammer.VERSION = '2.0.6';\n\t\n\t/**\n\t * default settings\n\t * @namespace\n\t */\n\tHammer.defaults = {\n\t /**\n\t * set if DOM events are being triggered.\n\t * But this is slower and unused by simple implementations, so disabled by default.\n\t * @type {Boolean}\n\t * @default false\n\t */\n\t domEvents: false,\n\t\n\t /**\n\t * The value for the touchAction property/fallback.\n\t * When set to `compute` it will magically set the correct value based on the added recognizers.\n\t * @type {String}\n\t * @default compute\n\t */\n\t touchAction: TOUCH_ACTION_COMPUTE,\n\t\n\t /**\n\t * @type {Boolean}\n\t * @default true\n\t */\n\t enable: true,\n\t\n\t /**\n\t * EXPERIMENTAL FEATURE -- can be removed/changed\n\t * Change the parent input target element.\n\t * If Null, then it is being set the to main element.\n\t * @type {Null|EventTarget}\n\t * @default null\n\t */\n\t inputTarget: null,\n\t\n\t /**\n\t * force an input class\n\t * @type {Null|Function}\n\t * @default null\n\t */\n\t inputClass: null,\n\t\n\t /**\n\t * Default recognizer setup when calling `Hammer()`\n\t * When creating a new Manager these will be skipped.\n\t * @type {Array}\n\t */\n\t preset: [\n\t // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n\t [RotateRecognizer, {enable: false}],\n\t [PinchRecognizer, {enable: false}, ['rotate']],\n\t [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],\n\t [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],\n\t [TapRecognizer],\n\t [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],\n\t [PressRecognizer]\n\t ],\n\t\n\t /**\n\t * Some CSS properties can be used to improve the working of Hammer.\n\t * Add them to this method and they will be set when creating a new Manager.\n\t * @namespace\n\t */\n\t cssProps: {\n\t /**\n\t * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t userSelect: 'none',\n\t\n\t /**\n\t * Disable the Windows Phone grippers when pressing an element.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t touchSelect: 'none',\n\t\n\t /**\n\t * Disables the default callout shown when you touch and hold a touch target.\n\t * On iOS, when you touch and hold a touch target such as a link, Safari displays\n\t * a callout containing information about the link. This property allows you to disable that callout.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t touchCallout: 'none',\n\t\n\t /**\n\t * Specifies whether zooming is enabled. Used by IE10>\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t contentZooming: 'none',\n\t\n\t /**\n\t * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t userDrag: 'none',\n\t\n\t /**\n\t * Overrides the highlight color shown when the user taps a link or a JavaScript\n\t * clickable element in iOS. This property obeys the alpha value, if specified.\n\t * @type {String}\n\t * @default 'rgba(0,0,0,0)'\n\t */\n\t tapHighlightColor: 'rgba(0,0,0,0)'\n\t }\n\t};\n\t\n\tvar STOP = 1;\n\tvar FORCED_STOP = 2;\n\t\n\t/**\n\t * Manager\n\t * @param {HTMLElement} element\n\t * @param {Object} [options]\n\t * @constructor\n\t */\n\tfunction Manager(element, options) {\n\t this.options = assign({}, Hammer.defaults, options || {});\n\t\n\t this.options.inputTarget = this.options.inputTarget || element;\n\t\n\t this.handlers = {};\n\t this.session = {};\n\t this.recognizers = [];\n\t\n\t this.element = element;\n\t this.input = createInputInstance(this);\n\t this.touchAction = new TouchAction(this, this.options.touchAction);\n\t\n\t toggleCssProps(this, true);\n\t\n\t each(this.options.recognizers, function(item) {\n\t var recognizer = this.add(new (item[0])(item[1]));\n\t item[2] && recognizer.recognizeWith(item[2]);\n\t item[3] && recognizer.requireFailure(item[3]);\n\t }, this);\n\t}\n\t\n\tManager.prototype = {\n\t /**\n\t * set options\n\t * @param {Object} options\n\t * @returns {Manager}\n\t */\n\t set: function(options) {\n\t assign(this.options, options);\n\t\n\t // Options that need a little more setup\n\t if (options.touchAction) {\n\t this.touchAction.update();\n\t }\n\t if (options.inputTarget) {\n\t // Clean up existing event listeners and reinitialize\n\t this.input.destroy();\n\t this.input.target = options.inputTarget;\n\t this.input.init();\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * stop recognizing for this session.\n\t * This session will be discarded, when a new [input]start event is fired.\n\t * When forced, the recognizer cycle is stopped immediately.\n\t * @param {Boolean} [force]\n\t */\n\t stop: function(force) {\n\t this.session.stopped = force ? FORCED_STOP : STOP;\n\t },\n\t\n\t /**\n\t * run the recognizers!\n\t * called by the inputHandler function on every movement of the pointers (touches)\n\t * it walks through all the recognizers and tries to detect the gesture that is being made\n\t * @param {Object} inputData\n\t */\n\t recognize: function(inputData) {\n\t var session = this.session;\n\t if (session.stopped) {\n\t return;\n\t }\n\t\n\t // run the touch-action polyfill\n\t this.touchAction.preventDefaults(inputData);\n\t\n\t var recognizer;\n\t var recognizers = this.recognizers;\n\t\n\t // this holds the recognizer that is being recognized.\n\t // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n\t // if no recognizer is detecting a thing, it is set to `null`\n\t var curRecognizer = session.curRecognizer;\n\t\n\t // reset when the last recognizer is recognized\n\t // or when we're in a new session\n\t if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n\t curRecognizer = session.curRecognizer = null;\n\t }\n\t\n\t var i = 0;\n\t while (i < recognizers.length) {\n\t recognizer = recognizers[i];\n\t\n\t // find out if we are allowed try to recognize the input for this one.\n\t // 1. allow if the session is NOT forced stopped (see the .stop() method)\n\t // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n\t // that is being recognized.\n\t // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n\t // this can be setup with the `recognizeWith()` method on the recognizer.\n\t if (session.stopped !== FORCED_STOP && ( // 1\n\t !curRecognizer || recognizer == curRecognizer || // 2\n\t recognizer.canRecognizeWith(curRecognizer))) { // 3\n\t recognizer.recognize(inputData);\n\t } else {\n\t recognizer.reset();\n\t }\n\t\n\t // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n\t // current active recognizer. but only if we don't already have an active recognizer\n\t if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n\t curRecognizer = session.curRecognizer = recognizer;\n\t }\n\t i++;\n\t }\n\t },\n\t\n\t /**\n\t * get a recognizer by its event name.\n\t * @param {Recognizer|String} recognizer\n\t * @returns {Recognizer|Null}\n\t */\n\t get: function(recognizer) {\n\t if (recognizer instanceof Recognizer) {\n\t return recognizer;\n\t }\n\t\n\t var recognizers = this.recognizers;\n\t for (var i = 0; i < recognizers.length; i++) {\n\t if (recognizers[i].options.event == recognizer) {\n\t return recognizers[i];\n\t }\n\t }\n\t return null;\n\t },\n\t\n\t /**\n\t * add a recognizer to the manager\n\t * existing recognizers with the same event name will be removed\n\t * @param {Recognizer} recognizer\n\t * @returns {Recognizer|Manager}\n\t */\n\t add: function(recognizer) {\n\t if (invokeArrayArg(recognizer, 'add', this)) {\n\t return this;\n\t }\n\t\n\t // remove existing\n\t var existing = this.get(recognizer.options.event);\n\t if (existing) {\n\t this.remove(existing);\n\t }\n\t\n\t this.recognizers.push(recognizer);\n\t recognizer.manager = this;\n\t\n\t this.touchAction.update();\n\t return recognizer;\n\t },\n\t\n\t /**\n\t * remove a recognizer by name or instance\n\t * @param {Recognizer|String} recognizer\n\t * @returns {Manager}\n\t */\n\t remove: function(recognizer) {\n\t if (invokeArrayArg(recognizer, 'remove', this)) {\n\t return this;\n\t }\n\t\n\t recognizer = this.get(recognizer);\n\t\n\t // let's make sure this recognizer exists\n\t if (recognizer) {\n\t var recognizers = this.recognizers;\n\t var index = inArray(recognizers, recognizer);\n\t\n\t if (index !== -1) {\n\t recognizers.splice(index, 1);\n\t this.touchAction.update();\n\t }\n\t }\n\t\n\t return this;\n\t },\n\t\n\t /**\n\t * bind event\n\t * @param {String} events\n\t * @param {Function} handler\n\t * @returns {EventEmitter} this\n\t */\n\t on: function(events, handler) {\n\t var handlers = this.handlers;\n\t each(splitStr(events), function(event) {\n\t handlers[event] = handlers[event] || [];\n\t handlers[event].push(handler);\n\t });\n\t return this;\n\t },\n\t\n\t /**\n\t * unbind event, leave emit blank to remove all handlers\n\t * @param {String} events\n\t * @param {Function} [handler]\n\t * @returns {EventEmitter} this\n\t */\n\t off: function(events, handler) {\n\t var handlers = this.handlers;\n\t each(splitStr(events), function(event) {\n\t if (!handler) {\n\t delete handlers[event];\n\t } else {\n\t handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /**\n\t * emit event to the listeners\n\t * @param {String} event\n\t * @param {Object} data\n\t */\n\t emit: function(event, data) {\n\t // we also want to trigger dom events\n\t if (this.options.domEvents) {\n\t triggerDomEvent(event, data);\n\t }\n\t\n\t // no handlers, so skip it all\n\t var handlers = this.handlers[event] && this.handlers[event].slice();\n\t if (!handlers || !handlers.length) {\n\t return;\n\t }\n\t\n\t data.type = event;\n\t data.preventDefault = function() {\n\t data.srcEvent.preventDefault();\n\t };\n\t\n\t var i = 0;\n\t while (i < handlers.length) {\n\t handlers[i](data);\n\t i++;\n\t }\n\t },\n\t\n\t /**\n\t * destroy the manager and unbinds all events\n\t * it doesn't unbind dom events, that is the user own responsibility\n\t */\n\t destroy: function() {\n\t this.element && toggleCssProps(this, false);\n\t\n\t this.handlers = {};\n\t this.session = {};\n\t this.input.destroy();\n\t this.element = null;\n\t }\n\t};\n\t\n\t/**\n\t * add/remove the css properties as defined in manager.options.cssProps\n\t * @param {Manager} manager\n\t * @param {Boolean} add\n\t */\n\tfunction toggleCssProps(manager, add) {\n\t var element = manager.element;\n\t if (!element.style) {\n\t return;\n\t }\n\t each(manager.options.cssProps, function(value, name) {\n\t element.style[prefixed(element.style, name)] = add ? value : '';\n\t });\n\t}\n\t\n\t/**\n\t * trigger dom event\n\t * @param {String} event\n\t * @param {Object} data\n\t */\n\tfunction triggerDomEvent(event, data) {\n\t var gestureEvent = document.createEvent('Event');\n\t gestureEvent.initEvent(event, true, true);\n\t gestureEvent.gesture = data;\n\t data.target.dispatchEvent(gestureEvent);\n\t}\n\t\n\tassign(Hammer, {\n\t INPUT_START: INPUT_START,\n\t INPUT_MOVE: INPUT_MOVE,\n\t INPUT_END: INPUT_END,\n\t INPUT_CANCEL: INPUT_CANCEL,\n\t\n\t STATE_POSSIBLE: STATE_POSSIBLE,\n\t STATE_BEGAN: STATE_BEGAN,\n\t STATE_CHANGED: STATE_CHANGED,\n\t STATE_ENDED: STATE_ENDED,\n\t STATE_RECOGNIZED: STATE_RECOGNIZED,\n\t STATE_CANCELLED: STATE_CANCELLED,\n\t STATE_FAILED: STATE_FAILED,\n\t\n\t DIRECTION_NONE: DIRECTION_NONE,\n\t DIRECTION_LEFT: DIRECTION_LEFT,\n\t DIRECTION_RIGHT: DIRECTION_RIGHT,\n\t DIRECTION_UP: DIRECTION_UP,\n\t DIRECTION_DOWN: DIRECTION_DOWN,\n\t DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n\t DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n\t DIRECTION_ALL: DIRECTION_ALL,\n\t\n\t Manager: Manager,\n\t Input: Input,\n\t TouchAction: TouchAction,\n\t\n\t TouchInput: TouchInput,\n\t MouseInput: MouseInput,\n\t PointerEventInput: PointerEventInput,\n\t TouchMouseInput: TouchMouseInput,\n\t SingleTouchInput: SingleTouchInput,\n\t\n\t Recognizer: Recognizer,\n\t AttrRecognizer: AttrRecognizer,\n\t Tap: TapRecognizer,\n\t Pan: PanRecognizer,\n\t Swipe: SwipeRecognizer,\n\t Pinch: PinchRecognizer,\n\t Rotate: RotateRecognizer,\n\t Press: PressRecognizer,\n\t\n\t on: addEventListeners,\n\t off: removeEventListeners,\n\t each: each,\n\t merge: merge,\n\t extend: extend,\n\t assign: assign,\n\t inherit: inherit,\n\t bindFn: bindFn,\n\t prefixed: prefixed\n\t});\n\t\n\t// this prevents errors when Hammer is loaded in the presence of an AMD\n\t// style loader but by script tag, not by the loader.\n\tvar freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\n\tfreeGlobal.Hammer = Hammer;\n\t\n\tif (true) {\n\t !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {\n\t return Hammer;\n\t }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else if (typeof module != 'undefined' && module.exports) {\n\t module.exports = Hammer;\n\t} else {\n\t window[exportName] = Hammer;\n\t}\n\t\n\t})(window, document, 'Hammer');\n\n\n/***/ },\n/* 55 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _TileLayer2 = __webpack_require__(56);\n\t\n\tvar _TileLayer3 = _interopRequireDefault(_TileLayer2);\n\t\n\tvar _ImageTile = __webpack_require__(66);\n\t\n\tvar _ImageTile2 = _interopRequireDefault(_ImageTile);\n\t\n\tvar _ImageTileLayerBaseMaterial = __webpack_require__(69);\n\t\n\tvar _ImageTileLayerBaseMaterial2 = _interopRequireDefault(_ImageTileLayerBaseMaterial);\n\t\n\tvar _lodashThrottle = __webpack_require__(49);\n\t\n\tvar _lodashThrottle2 = _interopRequireDefault(_lodashThrottle);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// DONE: Find a way to avoid the flashing caused by the gap between old tiles\n\t// being removed and the new tiles being ready for display\n\t//\n\t// DONE: Simplest first step for MVP would be to give each tile mesh the colour\n\t// of the basemap ground so it blends in a little more, or have a huge ground\n\t// plane underneath all the tiles that shows through between tile updates.\n\t//\n\t// Could keep the old tiles around until the new ones are ready, though they'd\n\t// probably need to be layered in a way so the old tiles don't overlap new ones,\n\t// which is similar to how Leaflet approaches this (it has 2 layers)\n\t//\n\t// Could keep the tile from the previous quadtree level visible until all 4\n\t// tiles at the new / current level have finished loading and are displayed.\n\t// Perhaps by keeping a map of tiles by quadcode and a boolean for each of the\n\t// child quadcodes showing whether they are loaded and in view. If all true then\n\t// remove the parent tile, otherwise keep it on a lower layer.\n\t\n\t// TODO: Load and display a base layer separate to the LOD grid that is at a low\n\t// resolution – used as a backup / background to fill in empty areas / distance\n\t\n\t// DONE: Fix the issue where some tiles just don't load, or at least the texture\n\t// never shows up – tends to happen if you quickly zoom in / out past it while\n\t// it's still loading, leaving a blank space\n\t\n\t// TODO: Optimise the request of many image tiles – look at how Leaflet and\n\t// OpenWebGlobe approach this (eg. batching, queues, etc)\n\t\n\t// TODO: Cancel pending tile requests if they get removed from view before they\n\t// reach a ready state (eg. cancel image requests, etc). Need to ensure that the\n\t// images are re-requested when the tile is next in scene (even if from cache)\n\t\n\t// TODO: Consider not performing an LOD calculation on every frame, instead only\n\t// on move end so panning, orbiting and zooming stays smooth. Otherwise it's\n\t// possible for performance to tank if you pan, orbit or zoom rapidly while all\n\t// the LOD calculations are being made and new tiles requested.\n\t//\n\t// Pending tiles should continue to be requested and output to the scene on each\n\t// frame, but no new LOD calculations should be made.\n\t\n\t// This tile layer both updates the quadtree and outputs tiles on every frame\n\t// (throttled to some amount)\n\t//\n\t// This is because the computational complexity of image tiles is generally low\n\t// and so there isn't much jank when running these calculations and outputs in\n\t// realtime\n\t//\n\t// The benefit to doing this is that the underlying map layer continues to\n\t// refresh and update during movement, which is an arguably better experience\n\t\n\tvar ImageTileLayer = (function (_TileLayer) {\n\t _inherits(ImageTileLayer, _TileLayer);\n\t\n\t function ImageTileLayer(path, options) {\n\t _classCallCheck(this, ImageTileLayer);\n\t\n\t var defaults = {\n\t distance: 40000\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(ImageTileLayer.prototype), 'constructor', this).call(this, options);\n\t\n\t this._path = path;\n\t }\n\t\n\t _createClass(ImageTileLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t var _this = this;\n\t\n\t _get(Object.getPrototypeOf(ImageTileLayer.prototype), '_onAdd', this).call(this, world);\n\t\n\t // Add base layer\n\t var geom = new _three2['default'].PlaneBufferGeometry(200000, 200000, 1);\n\t\n\t var baseMaterial;\n\t if (this._world._environment._skybox) {\n\t baseMaterial = (0, _ImageTileLayerBaseMaterial2['default'])('#f5f5f3', this._world._environment._skybox.getRenderTarget());\n\t } else {\n\t baseMaterial = (0, _ImageTileLayerBaseMaterial2['default'])('#f5f5f3');\n\t }\n\t\n\t var mesh = new _three2['default'].Mesh(geom, baseMaterial);\n\t mesh.renderOrder = 0;\n\t mesh.rotation.x = -90 * Math.PI / 180;\n\t\n\t // TODO: It might be overkill to receive a shadow on the base layer as it's\n\t // rarely seen (good to have if performance difference is negligible)\n\t mesh.receiveShadow = true;\n\t\n\t this._baseLayer = mesh;\n\t this.add(mesh);\n\t\n\t // Trigger initial quadtree calculation on the next frame\n\t //\n\t // TODO: This is a hack to ensure the camera is all set up - a better\n\t // solution should be found\n\t setTimeout(function () {\n\t _this._calculateLOD();\n\t _this._initEvents();\n\t }, 0);\n\t }\n\t }, {\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t // Run LOD calculations based on render calls\n\t //\n\t // Throttled to 1 LOD calculation per 100ms\n\t this._throttledWorldUpdate = (0, _lodashThrottle2['default'])(this._onWorldUpdate, 100);\n\t\n\t this._world.on('preUpdate', this._throttledWorldUpdate, this);\n\t this._world.on('move', this._onWorldMove, this);\n\t }\n\t }, {\n\t key: '_onWorldUpdate',\n\t value: function _onWorldUpdate() {\n\t this._calculateLOD();\n\t this._outputTiles();\n\t }\n\t }, {\n\t key: '_onWorldMove',\n\t value: function _onWorldMove(latlon, point) {\n\t this._moveBaseLayer(point);\n\t }\n\t }, {\n\t key: '_moveBaseLayer',\n\t value: function _moveBaseLayer(point) {\n\t this._baseLayer.position.x = point.x;\n\t this._baseLayer.position.z = point.y;\n\t }\n\t }, {\n\t key: '_createTile',\n\t value: function _createTile(quadcode, layer) {\n\t return new _ImageTile2['default'](quadcode, this._path, layer);\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._world.off('preUpdate', this._throttledWorldUpdate);\n\t this._world.off('move', this._onWorldMove);\n\t\n\t this._throttledWorldUpdate = null;\n\t\n\t // Dispose of mesh and materials\n\t this._baseLayer.geometry.dispose();\n\t this._baseLayer.geometry = null;\n\t\n\t if (this._baseLayer.material.map) {\n\t this._baseLayer.material.map.dispose();\n\t this._baseLayer.material.map = null;\n\t }\n\t\n\t this._baseLayer.material.dispose();\n\t this._baseLayer.material = null;\n\t\n\t this._baseLayer = null;\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(ImageTileLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return ImageTileLayer;\n\t})(_TileLayer3['default']);\n\t\n\texports['default'] = ImageTileLayer;\n\t\n\tvar noNew = function noNew(path, options) {\n\t return new ImageTileLayer(path, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.imageTileLayer = noNew;\n\n/***/ },\n/* 56 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Layer2 = __webpack_require__(46);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _TileCache = __webpack_require__(57);\n\t\n\tvar _TileCache2 = _interopRequireDefault(_TileCache);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Consider removing picking from TileLayer instances as there aren't\n\t// (m)any situations where it would be practical\n\t//\n\t// For example, how would you even know what picking IDs to listen to and what\n\t// to do with them?\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Consider keeping a single TileLayer / LOD instance running by default\n\t// that keeps a standard LOD grid for other layers to utilise, rather than\n\t// having to create their own, unique LOD grid and duplicate calculations when\n\t// they're going to use the same grid setup anyway\n\t//\n\t// It still makes sense to be able to have a custom LOD grid for some layers as\n\t// they may want to customise things, maybe not even using a quadtree at all!\n\t//\n\t// Perhaps it makes sense to split out the quadtree stuff into a singleton and\n\t// pass in the necessary parameters each time for the calculation step.\n\t//\n\t// Either way, it seems silly to force layers to have to create a new LOD grid\n\t// each time and create extra, duplicated processing every frame.\n\t\n\t// TODO: Allow passing in of options to define min/max LOD and a distance to use\n\t// for culling tiles beyond that distance.\n\t\n\t// DONE: Prevent tiles from being loaded if they are further than a certain\n\t// distance from the camera and are unlikely to be seen anyway\n\t\n\t// TODO: Avoid performing LOD calculation when it isn't required. For example,\n\t// when nothing has changed since the last frame and there are no tiles to be\n\t// loaded or in need of rendering\n\t\n\t// TODO: Only remove tiles from the layer that aren't to be rendered in the\n\t// current frame – it seems excessive to remove all tiles and re-add them on\n\t// every single frame, even if it's just array manipulation\n\t\n\t// TODO: Fix LOD calculation so min and max LOD can be changed without causing\n\t// problems (eg. making min above 5 causes all sorts of issues)\n\t\n\t// TODO: Reuse THREE objects where possible instead of creating new instances\n\t// on every LOD calculation\n\t\n\t// TODO: Consider not using THREE or LatLon / Point objects in LOD calculations\n\t// to avoid creating unnecessary memory for garbage collection\n\t\n\t// TODO: Prioritise loading of tiles at highest level in the quadtree (those\n\t// closest to the camera) so visual inconsistancies during loading are minimised\n\t\n\tvar TileLayer = (function (_Layer) {\n\t _inherits(TileLayer, _Layer);\n\t\n\t function TileLayer(options) {\n\t var _this = this;\n\t\n\t _classCallCheck(this, TileLayer);\n\t\n\t var defaults = {\n\t picking: false,\n\t maxCache: 1000,\n\t maxLOD: 18\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(TileLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t this._tileCache = new _TileCache2['default'](this._options.maxCache, function (tile) {\n\t _this._destroyTile(tile);\n\t });\n\t\n\t // List of tiles from the previous LOD calculation\n\t this._tileList = [];\n\t\n\t // TODO: Work out why changing the minLOD causes loads of issues\n\t this._minLOD = 3;\n\t this._maxLOD = this._options.maxLOD;\n\t\n\t this._frustum = new _three2['default'].Frustum();\n\t this._tiles = new _three2['default'].Object3D();\n\t this._tilesPicking = new _three2['default'].Object3D();\n\t }\n\t\n\t _createClass(TileLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this.addToPicking(this._tilesPicking);\n\t this.add(this._tiles);\n\t }\n\t }, {\n\t key: '_updateFrustum',\n\t value: function _updateFrustum() {\n\t var camera = this._world.getCamera();\n\t var projScreenMatrix = new _three2['default'].Matrix4();\n\t projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n\t\n\t this._frustum.setFromMatrix(camera.projectionMatrix);\n\t this._frustum.setFromMatrix(new _three2['default'].Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse));\n\t }\n\t }, {\n\t key: '_tileInFrustum',\n\t value: function _tileInFrustum(tile) {\n\t var bounds = tile.getBounds();\n\t return this._frustum.intersectsBox(new _three2['default'].Box3(new _three2['default'].Vector3(bounds[0], 0, bounds[3]), new _three2['default'].Vector3(bounds[2], 0, bounds[1])));\n\t }\n\t\n\t // Update and output tiles from the previous LOD checklist\n\t }, {\n\t key: '_outputTiles',\n\t value: function _outputTiles() {\n\t var _this2 = this;\n\t\n\t if (!this._tiles) {\n\t return;\n\t }\n\t\n\t // Remove all tiles from layer\n\t this._removeTiles();\n\t\n\t // Add / re-add tiles\n\t this._tileList.forEach(function (tile) {\n\t // Are the mesh and texture ready?\n\t //\n\t // If yes, continue\n\t // If no, skip\n\t if (!tile.isReady()) {\n\t return;\n\t }\n\t\n\t // Add tile to layer (and to scene) if not already there\n\t _this2._tiles.add(tile.getMesh());\n\t\n\t if (tile.getPickingMesh()) {\n\t _this2._tilesPicking.add(tile.getPickingMesh());\n\t }\n\t });\n\t }\n\t\n\t // Works out tiles in the view frustum and stores them in an array\n\t //\n\t // Does not output the tiles, deferring this to _outputTiles()\n\t }, {\n\t key: '_calculateLOD',\n\t value: function _calculateLOD() {\n\t var _this3 = this;\n\t\n\t if (this._stop || !this._world) {\n\t return;\n\t }\n\t\n\t // var start = performance.now();\n\t\n\t var camera = this._world.getCamera();\n\t\n\t // 1. Update and retrieve camera frustum\n\t this._updateFrustum(this._frustum, camera);\n\t\n\t // 2. Add the four root items of the quadtree to a check list\n\t var checkList = this._checklist;\n\t checkList = [];\n\t checkList.push(this._requestTile('0', this));\n\t checkList.push(this._requestTile('1', this));\n\t checkList.push(this._requestTile('2', this));\n\t checkList.push(this._requestTile('3', this));\n\t\n\t // 3. Call Divide, passing in the check list\n\t this._divide(checkList);\n\t\n\t // // 4. Remove all tiles from layer\n\t //\n\t // Moved to _outputTiles() for now\n\t // this._removeTiles();\n\t\n\t // 5. Filter the tiles remaining in the check list\n\t this._tileList = checkList.filter(function (tile, index) {\n\t // Skip tile if it's not in the current view frustum\n\t if (!_this3._tileInFrustum(tile)) {\n\t return false;\n\t }\n\t\n\t if (_this3._options.distance && _this3._options.distance > 0) {\n\t // TODO: Can probably speed this up\n\t var center = tile.getCenter();\n\t var dist = new _three2['default'].Vector3(center[0], 0, center[1]).sub(camera.position).length();\n\t\n\t // Manual distance limit to cut down on tiles so far away\n\t if (dist > _this3._options.distance) {\n\t return false;\n\t }\n\t }\n\t\n\t // Does the tile have a mesh?\n\t //\n\t // If yes, continue\n\t // If no, generate tile mesh, request texture and skip\n\t if (!tile.getMesh()) {\n\t tile.requestTileAsync();\n\t }\n\t\n\t return true;\n\t\n\t // Are the mesh and texture ready?\n\t //\n\t // If yes, continue\n\t // If no, skip\n\t // if (!tile.isReady()) {\n\t // return;\n\t // }\n\t //\n\t // // Add tile to layer (and to scene)\n\t // this._tiles.add(tile.getMesh());\n\t });\n\t\n\t // console.log(performance.now() - start);\n\t }\n\t }, {\n\t key: '_divide',\n\t value: function _divide(checkList) {\n\t var count = 0;\n\t var currentItem;\n\t var quadcode;\n\t\n\t // 1. Loop until count equals check list length\n\t while (count != checkList.length) {\n\t currentItem = checkList[count];\n\t quadcode = currentItem.getQuadcode();\n\t\n\t // 2. Increase count and continue loop if quadcode equals max LOD / zoom\n\t if (currentItem.length === this._maxLOD) {\n\t count++;\n\t continue;\n\t }\n\t\n\t // 3. Else, calculate screen-space error metric for quadcode\n\t if (this._screenSpaceError(currentItem)) {\n\t // 4. If error is sufficient...\n\t\n\t // 4a. Remove parent item from the check list\n\t checkList.splice(count, 1);\n\t\n\t // 4b. Add 4 child items to the check list\n\t checkList.push(this._requestTile(quadcode + '0', this));\n\t checkList.push(this._requestTile(quadcode + '1', this));\n\t checkList.push(this._requestTile(quadcode + '2', this));\n\t checkList.push(this._requestTile(quadcode + '3', this));\n\t\n\t // 4d. Continue the loop without increasing count\n\t continue;\n\t } else {\n\t // 5. Else, increase count and continue loop\n\t count++;\n\t }\n\t }\n\t }\n\t }, {\n\t key: '_screenSpaceError',\n\t value: function _screenSpaceError(tile) {\n\t var minDepth = this._minLOD;\n\t var maxDepth = this._maxLOD;\n\t\n\t var quadcode = tile.getQuadcode();\n\t\n\t var camera = this._world.getCamera();\n\t\n\t // Tweak this value to refine specific point that each quad is subdivided\n\t //\n\t // It's used to multiple the dimensions of the tile sides before\n\t // comparing against the tile distance from camera\n\t var quality = 3.0;\n\t\n\t // 1. Return false if quadcode length equals maxDepth (stop dividing)\n\t if (quadcode.length === maxDepth) {\n\t return false;\n\t }\n\t\n\t // 2. Return true if quadcode length is less than minDepth\n\t if (quadcode.length < minDepth) {\n\t return true;\n\t }\n\t\n\t // 3. Return false if quadcode bounds are not in view frustum\n\t if (!this._tileInFrustum(tile)) {\n\t return false;\n\t }\n\t\n\t var center = tile.getCenter();\n\t\n\t // 4. Calculate screen-space error metric\n\t // TODO: Use closest distance to one of the 4 tile corners\n\t var dist = new _three2['default'].Vector3(center[0], 0, center[1]).sub(camera.position).length();\n\t\n\t var error = quality * tile.getSide() / dist;\n\t\n\t // 5. Return true if error is greater than 1.0, else return false\n\t return error > 1.0;\n\t }\n\t }, {\n\t key: '_removeTiles',\n\t value: function _removeTiles() {\n\t if (!this._tiles || !this._tiles.children) {\n\t return;\n\t }\n\t\n\t for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n\t this._tiles.remove(this._tiles.children[i]);\n\t }\n\t\n\t if (!this._tilesPicking || !this._tilesPicking.children) {\n\t return;\n\t }\n\t\n\t for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n\t this._tilesPicking.remove(this._tilesPicking.children[i]);\n\t }\n\t }\n\t\n\t // Return a new tile instance\n\t }, {\n\t key: '_createTile',\n\t value: function _createTile(quadcode, layer) {}\n\t\n\t // Get a cached tile or request a new one if not in cache\n\t }, {\n\t key: '_requestTile',\n\t value: function _requestTile(quadcode, layer) {\n\t var tile = this._tileCache.getTile(quadcode);\n\t\n\t if (!tile) {\n\t // Set up a brand new tile\n\t tile = this._createTile(quadcode, layer);\n\t\n\t // Add tile to cache, though it won't be ready yet as the data is being\n\t // requested from various places asynchronously\n\t this._tileCache.setTile(quadcode, tile);\n\t }\n\t\n\t return tile;\n\t }\n\t }, {\n\t key: '_destroyTile',\n\t value: function _destroyTile(tile) {\n\t // Remove tile from scene\n\t this._tiles.remove(tile.getMesh());\n\t\n\t // Delete any references to the tile within this component\n\t\n\t // Call destory on tile instance\n\t tile.destroy();\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._tiles.children) {\n\t // Remove all tiles\n\t for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n\t this._tiles.remove(this._tiles.children[i]);\n\t }\n\t }\n\t\n\t // Remove tile from picking scene\n\t this.removeFromPicking(this._tilesPicking);\n\t\n\t if (this._tilesPicking.children) {\n\t // Remove all tiles\n\t for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n\t this._tilesPicking.remove(this._tilesPicking.children[i]);\n\t }\n\t }\n\t\n\t this._tileCache.destroy();\n\t this._tileCache = null;\n\t\n\t this._tiles = null;\n\t this._tilesPicking = null;\n\t this._frustum = null;\n\t\n\t _get(Object.getPrototypeOf(TileLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return TileLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = TileLayer;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 57 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _lruCache = __webpack_require__(58);\n\t\n\tvar _lruCache2 = _interopRequireDefault(_lruCache);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// This process is based on a similar approach taken by OpenWebGlobe\n\t// See: https://github.com/OpenWebGlobe/WebViewer/blob/master/source/core/globecache.js\n\t\n\tvar TileCache = (function () {\n\t function TileCache(cacheLimit, onDestroyTile) {\n\t _classCallCheck(this, TileCache);\n\t\n\t this._cache = (0, _lruCache2['default'])({\n\t max: cacheLimit,\n\t dispose: function dispose(key, tile) {\n\t onDestroyTile(tile);\n\t }\n\t });\n\t }\n\t\n\t // Returns true if all specified tile providers are ready to be used\n\t // Otherwise, returns false\n\t\n\t _createClass(TileCache, [{\n\t key: 'isReady',\n\t value: function isReady() {\n\t return false;\n\t }\n\t\n\t // Get a cached tile without requesting a new one\n\t }, {\n\t key: 'getTile',\n\t value: function getTile(quadcode) {\n\t return this._cache.get(quadcode);\n\t }\n\t\n\t // Add tile to cache\n\t }, {\n\t key: 'setTile',\n\t value: function setTile(quadcode, tile) {\n\t this._cache.set(quadcode, tile);\n\t }\n\t\n\t // Destroy the cache and remove it from memory\n\t //\n\t // TODO: Call destroy method on items in cache\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._cache.reset();\n\t this._cache = null;\n\t }\n\t }]);\n\t\n\t return TileCache;\n\t})();\n\t\n\texports['default'] = TileCache;\n\t\n\tvar noNew = function noNew(cacheLimit, onDestroyTile) {\n\t return new TileCache(cacheLimit, onDestroyTile);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.tileCache = noNew;\n\n/***/ },\n/* 58 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = LRUCache\n\t\n\t// This will be a proper iterable 'Map' in engines that support it,\n\t// or a fakey-fake PseudoMap in older versions.\n\tvar Map = __webpack_require__(59)\n\tvar util = __webpack_require__(62)\n\t\n\t// A linked list to keep track of recently-used-ness\n\tvar Yallist = __webpack_require__(65)\n\t\n\t// use symbols if possible, otherwise just _props\n\tvar symbols = {}\n\tvar hasSymbol = typeof Symbol === 'function'\n\tvar makeSymbol\n\tif (hasSymbol) {\n\t makeSymbol = function (key) {\n\t return Symbol.for(key)\n\t }\n\t} else {\n\t makeSymbol = function (key) {\n\t return '_' + key\n\t }\n\t}\n\t\n\tfunction priv (obj, key, val) {\n\t var sym\n\t if (symbols[key]) {\n\t sym = symbols[key]\n\t } else {\n\t sym = makeSymbol(key)\n\t symbols[key] = sym\n\t }\n\t if (arguments.length === 2) {\n\t return obj[sym]\n\t } else {\n\t obj[sym] = val\n\t return val\n\t }\n\t}\n\t\n\tfunction naiveLength () { return 1 }\n\t\n\t// lruList is a yallist where the head is the youngest\n\t// item, and the tail is the oldest. the list contains the Hit\n\t// objects as the entries.\n\t// Each Hit object has a reference to its Yallist.Node. This\n\t// never changes.\n\t//\n\t// cache is a Map (or PseudoMap) that matches the keys to\n\t// the Yallist.Node object.\n\tfunction LRUCache (options) {\n\t if (!(this instanceof LRUCache)) {\n\t return new LRUCache(options)\n\t }\n\t\n\t if (typeof options === 'number') {\n\t options = { max: options }\n\t }\n\t\n\t if (!options) {\n\t options = {}\n\t }\n\t\n\t var max = priv(this, 'max', options.max)\n\t // Kind of weird to have a default max of Infinity, but oh well.\n\t if (!max ||\n\t !(typeof max === 'number') ||\n\t max <= 0) {\n\t priv(this, 'max', Infinity)\n\t }\n\t\n\t var lc = options.length || naiveLength\n\t if (typeof lc !== 'function') {\n\t lc = naiveLength\n\t }\n\t priv(this, 'lengthCalculator', lc)\n\t\n\t priv(this, 'allowStale', options.stale || false)\n\t priv(this, 'maxAge', options.maxAge || 0)\n\t priv(this, 'dispose', options.dispose)\n\t this.reset()\n\t}\n\t\n\t// resize the cache when the max changes.\n\tObject.defineProperty(LRUCache.prototype, 'max', {\n\t set: function (mL) {\n\t if (!mL || !(typeof mL === 'number') || mL <= 0) {\n\t mL = Infinity\n\t }\n\t priv(this, 'max', mL)\n\t trim(this)\n\t },\n\t get: function () {\n\t return priv(this, 'max')\n\t },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'allowStale', {\n\t set: function (allowStale) {\n\t priv(this, 'allowStale', !!allowStale)\n\t },\n\t get: function () {\n\t return priv(this, 'allowStale')\n\t },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'maxAge', {\n\t set: function (mA) {\n\t if (!mA || !(typeof mA === 'number') || mA < 0) {\n\t mA = 0\n\t }\n\t priv(this, 'maxAge', mA)\n\t trim(this)\n\t },\n\t get: function () {\n\t return priv(this, 'maxAge')\n\t },\n\t enumerable: true\n\t})\n\t\n\t// resize the cache when the lengthCalculator changes.\n\tObject.defineProperty(LRUCache.prototype, 'lengthCalculator', {\n\t set: function (lC) {\n\t if (typeof lC !== 'function') {\n\t lC = naiveLength\n\t }\n\t if (lC !== priv(this, 'lengthCalculator')) {\n\t priv(this, 'lengthCalculator', lC)\n\t priv(this, 'length', 0)\n\t priv(this, 'lruList').forEach(function (hit) {\n\t hit.length = priv(this, 'lengthCalculator').call(this, hit.value, hit.key)\n\t priv(this, 'length', priv(this, 'length') + hit.length)\n\t }, this)\n\t }\n\t trim(this)\n\t },\n\t get: function () { return priv(this, 'lengthCalculator') },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'length', {\n\t get: function () { return priv(this, 'length') },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'itemCount', {\n\t get: function () { return priv(this, 'lruList').length },\n\t enumerable: true\n\t})\n\t\n\tLRUCache.prototype.rforEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = priv(this, 'lruList').tail; walker !== null;) {\n\t var prev = walker.prev\n\t forEachStep(this, fn, walker, thisp)\n\t walker = prev\n\t }\n\t}\n\t\n\tfunction forEachStep (self, fn, node, thisp) {\n\t var hit = node.value\n\t if (isStale(self, hit)) {\n\t del(self, node)\n\t if (!priv(self, 'allowStale')) {\n\t hit = undefined\n\t }\n\t }\n\t if (hit) {\n\t fn.call(thisp, hit.value, hit.key, self)\n\t }\n\t}\n\t\n\tLRUCache.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = priv(this, 'lruList').head; walker !== null;) {\n\t var next = walker.next\n\t forEachStep(this, fn, walker, thisp)\n\t walker = next\n\t }\n\t}\n\t\n\tLRUCache.prototype.keys = function () {\n\t return priv(this, 'lruList').toArray().map(function (k) {\n\t return k.key\n\t }, this)\n\t}\n\t\n\tLRUCache.prototype.values = function () {\n\t return priv(this, 'lruList').toArray().map(function (k) {\n\t return k.value\n\t }, this)\n\t}\n\t\n\tLRUCache.prototype.reset = function () {\n\t if (priv(this, 'dispose') &&\n\t priv(this, 'lruList') &&\n\t priv(this, 'lruList').length) {\n\t priv(this, 'lruList').forEach(function (hit) {\n\t priv(this, 'dispose').call(this, hit.key, hit.value)\n\t }, this)\n\t }\n\t\n\t priv(this, 'cache', new Map()) // hash of items by key\n\t priv(this, 'lruList', new Yallist()) // list of items in order of use recency\n\t priv(this, 'length', 0) // length of items in the list\n\t}\n\t\n\tLRUCache.prototype.dump = function () {\n\t return priv(this, 'lruList').map(function (hit) {\n\t if (!isStale(this, hit)) {\n\t return {\n\t k: hit.key,\n\t v: hit.value,\n\t e: hit.now + (hit.maxAge || 0)\n\t }\n\t }\n\t }, this).toArray().filter(function (h) {\n\t return h\n\t })\n\t}\n\t\n\tLRUCache.prototype.dumpLru = function () {\n\t return priv(this, 'lruList')\n\t}\n\t\n\tLRUCache.prototype.inspect = function (n, opts) {\n\t var str = 'LRUCache {'\n\t var extras = false\n\t\n\t var as = priv(this, 'allowStale')\n\t if (as) {\n\t str += '\\n allowStale: true'\n\t extras = true\n\t }\n\t\n\t var max = priv(this, 'max')\n\t if (max && max !== Infinity) {\n\t if (extras) {\n\t str += ','\n\t }\n\t str += '\\n max: ' + util.inspect(max, opts)\n\t extras = true\n\t }\n\t\n\t var maxAge = priv(this, 'maxAge')\n\t if (maxAge) {\n\t if (extras) {\n\t str += ','\n\t }\n\t str += '\\n maxAge: ' + util.inspect(maxAge, opts)\n\t extras = true\n\t }\n\t\n\t var lc = priv(this, 'lengthCalculator')\n\t if (lc && lc !== naiveLength) {\n\t if (extras) {\n\t str += ','\n\t }\n\t str += '\\n length: ' + util.inspect(priv(this, 'length'), opts)\n\t extras = true\n\t }\n\t\n\t var didFirst = false\n\t priv(this, 'lruList').forEach(function (item) {\n\t if (didFirst) {\n\t str += ',\\n '\n\t } else {\n\t if (extras) {\n\t str += ',\\n'\n\t }\n\t didFirst = true\n\t str += '\\n '\n\t }\n\t var key = util.inspect(item.key).split('\\n').join('\\n ')\n\t var val = { value: item.value }\n\t if (item.maxAge !== maxAge) {\n\t val.maxAge = item.maxAge\n\t }\n\t if (lc !== naiveLength) {\n\t val.length = item.length\n\t }\n\t if (isStale(this, item)) {\n\t val.stale = true\n\t }\n\t\n\t val = util.inspect(val, opts).split('\\n').join('\\n ')\n\t str += key + ' => ' + val\n\t })\n\t\n\t if (didFirst || extras) {\n\t str += '\\n'\n\t }\n\t str += '}'\n\t\n\t return str\n\t}\n\t\n\tLRUCache.prototype.set = function (key, value, maxAge) {\n\t maxAge = maxAge || priv(this, 'maxAge')\n\t\n\t var now = maxAge ? Date.now() : 0\n\t var len = priv(this, 'lengthCalculator').call(this, value, key)\n\t\n\t if (priv(this, 'cache').has(key)) {\n\t if (len > priv(this, 'max')) {\n\t del(this, priv(this, 'cache').get(key))\n\t return false\n\t }\n\t\n\t var node = priv(this, 'cache').get(key)\n\t var item = node.value\n\t\n\t // dispose of the old one before overwriting\n\t if (priv(this, 'dispose')) {\n\t priv(this, 'dispose').call(this, key, item.value)\n\t }\n\t\n\t item.now = now\n\t item.maxAge = maxAge\n\t item.value = value\n\t priv(this, 'length', priv(this, 'length') + (len - item.length))\n\t item.length = len\n\t this.get(key)\n\t trim(this)\n\t return true\n\t }\n\t\n\t var hit = new Entry(key, value, len, now, maxAge)\n\t\n\t // oversized objects fall out of cache automatically.\n\t if (hit.length > priv(this, 'max')) {\n\t if (priv(this, 'dispose')) {\n\t priv(this, 'dispose').call(this, key, value)\n\t }\n\t return false\n\t }\n\t\n\t priv(this, 'length', priv(this, 'length') + hit.length)\n\t priv(this, 'lruList').unshift(hit)\n\t priv(this, 'cache').set(key, priv(this, 'lruList').head)\n\t trim(this)\n\t return true\n\t}\n\t\n\tLRUCache.prototype.has = function (key) {\n\t if (!priv(this, 'cache').has(key)) return false\n\t var hit = priv(this, 'cache').get(key).value\n\t if (isStale(this, hit)) {\n\t return false\n\t }\n\t return true\n\t}\n\t\n\tLRUCache.prototype.get = function (key) {\n\t return get(this, key, true)\n\t}\n\t\n\tLRUCache.prototype.peek = function (key) {\n\t return get(this, key, false)\n\t}\n\t\n\tLRUCache.prototype.pop = function () {\n\t var node = priv(this, 'lruList').tail\n\t if (!node) return null\n\t del(this, node)\n\t return node.value\n\t}\n\t\n\tLRUCache.prototype.del = function (key) {\n\t del(this, priv(this, 'cache').get(key))\n\t}\n\t\n\tLRUCache.prototype.load = function (arr) {\n\t // reset the cache\n\t this.reset()\n\t\n\t var now = Date.now()\n\t // A previous serialized cache has the most recent items first\n\t for (var l = arr.length - 1; l >= 0; l--) {\n\t var hit = arr[l]\n\t var expiresAt = hit.e || 0\n\t if (expiresAt === 0) {\n\t // the item was created without expiration in a non aged cache\n\t this.set(hit.k, hit.v)\n\t } else {\n\t var maxAge = expiresAt - now\n\t // dont add already expired items\n\t if (maxAge > 0) {\n\t this.set(hit.k, hit.v, maxAge)\n\t }\n\t }\n\t }\n\t}\n\t\n\tLRUCache.prototype.prune = function () {\n\t var self = this\n\t priv(this, 'cache').forEach(function (value, key) {\n\t get(self, key, false)\n\t })\n\t}\n\t\n\tfunction get (self, key, doUse) {\n\t var node = priv(self, 'cache').get(key)\n\t if (node) {\n\t var hit = node.value\n\t if (isStale(self, hit)) {\n\t del(self, node)\n\t if (!priv(self, 'allowStale')) hit = undefined\n\t } else {\n\t if (doUse) {\n\t priv(self, 'lruList').unshiftNode(node)\n\t }\n\t }\n\t if (hit) hit = hit.value\n\t }\n\t return hit\n\t}\n\t\n\tfunction isStale (self, hit) {\n\t if (!hit || (!hit.maxAge && !priv(self, 'maxAge'))) {\n\t return false\n\t }\n\t var stale = false\n\t var diff = Date.now() - hit.now\n\t if (hit.maxAge) {\n\t stale = diff > hit.maxAge\n\t } else {\n\t stale = priv(self, 'maxAge') && (diff > priv(self, 'maxAge'))\n\t }\n\t return stale\n\t}\n\t\n\tfunction trim (self) {\n\t if (priv(self, 'length') > priv(self, 'max')) {\n\t for (var walker = priv(self, 'lruList').tail;\n\t priv(self, 'length') > priv(self, 'max') && walker !== null;) {\n\t // We know that we're about to delete this one, and also\n\t // what the next least recently used key will be, so just\n\t // go ahead and set it now.\n\t var prev = walker.prev\n\t del(self, walker)\n\t walker = prev\n\t }\n\t }\n\t}\n\t\n\tfunction del (self, node) {\n\t if (node) {\n\t var hit = node.value\n\t if (priv(self, 'dispose')) {\n\t priv(self, 'dispose').call(this, hit.key, hit.value)\n\t }\n\t priv(self, 'length', priv(self, 'length') - hit.length)\n\t priv(self, 'cache').delete(hit.key)\n\t priv(self, 'lruList').removeNode(node)\n\t }\n\t}\n\t\n\t// classy, since V8 prefers predictable objects.\n\tfunction Entry (key, value, length, now, maxAge) {\n\t this.key = key\n\t this.value = value\n\t this.length = length\n\t this.now = now\n\t this.maxAge = maxAge || 0\n\t}\n\n\n/***/ },\n/* 59 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(process) {if (process.env.npm_package_name === 'pseudomap' &&\n\t process.env.npm_lifecycle_script === 'test')\n\t process.env.TEST_PSEUDOMAP = 'true'\n\t\n\tif (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) {\n\t module.exports = Map\n\t} else {\n\t module.exports = __webpack_require__(61)\n\t}\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(60)))\n\n/***/ },\n/* 60 */\n/***/ function(module, exports) {\n\n\t// shim for using process in browser\n\t\n\tvar process = module.exports = {};\n\tvar queue = [];\n\tvar draining = false;\n\tvar currentQueue;\n\tvar queueIndex = -1;\n\t\n\tfunction cleanUpNextTick() {\n\t draining = false;\n\t if (currentQueue.length) {\n\t queue = currentQueue.concat(queue);\n\t } else {\n\t queueIndex = -1;\n\t }\n\t if (queue.length) {\n\t drainQueue();\n\t }\n\t}\n\t\n\tfunction drainQueue() {\n\t if (draining) {\n\t return;\n\t }\n\t var timeout = setTimeout(cleanUpNextTick);\n\t draining = true;\n\t\n\t var len = queue.length;\n\t while(len) {\n\t currentQueue = queue;\n\t queue = [];\n\t while (++queueIndex < len) {\n\t if (currentQueue) {\n\t currentQueue[queueIndex].run();\n\t }\n\t }\n\t queueIndex = -1;\n\t len = queue.length;\n\t }\n\t currentQueue = null;\n\t draining = false;\n\t clearTimeout(timeout);\n\t}\n\t\n\tprocess.nextTick = function (fun) {\n\t var args = new Array(arguments.length - 1);\n\t if (arguments.length > 1) {\n\t for (var i = 1; i < arguments.length; i++) {\n\t args[i - 1] = arguments[i];\n\t }\n\t }\n\t queue.push(new Item(fun, args));\n\t if (queue.length === 1 && !draining) {\n\t setTimeout(drainQueue, 0);\n\t }\n\t};\n\t\n\t// v8 likes predictible objects\n\tfunction Item(fun, array) {\n\t this.fun = fun;\n\t this.array = array;\n\t}\n\tItem.prototype.run = function () {\n\t this.fun.apply(null, this.array);\n\t};\n\tprocess.title = 'browser';\n\tprocess.browser = true;\n\tprocess.env = {};\n\tprocess.argv = [];\n\tprocess.version = ''; // empty string to avoid regexp issues\n\tprocess.versions = {};\n\t\n\tfunction noop() {}\n\t\n\tprocess.on = noop;\n\tprocess.addListener = noop;\n\tprocess.once = noop;\n\tprocess.off = noop;\n\tprocess.removeListener = noop;\n\tprocess.removeAllListeners = noop;\n\tprocess.emit = noop;\n\t\n\tprocess.binding = function (name) {\n\t throw new Error('process.binding is not supported');\n\t};\n\t\n\tprocess.cwd = function () { return '/' };\n\tprocess.chdir = function (dir) {\n\t throw new Error('process.chdir is not supported');\n\t};\n\tprocess.umask = function() { return 0; };\n\n\n/***/ },\n/* 61 */\n/***/ function(module, exports) {\n\n\tvar hasOwnProperty = Object.prototype.hasOwnProperty\n\t\n\tmodule.exports = PseudoMap\n\t\n\tfunction PseudoMap (set) {\n\t if (!(this instanceof PseudoMap)) // whyyyyyyy\n\t throw new TypeError(\"Constructor PseudoMap requires 'new'\")\n\t\n\t this.clear()\n\t\n\t if (set) {\n\t if ((set instanceof PseudoMap) ||\n\t (typeof Map === 'function' && set instanceof Map))\n\t set.forEach(function (value, key) {\n\t this.set(key, value)\n\t }, this)\n\t else if (Array.isArray(set))\n\t set.forEach(function (kv) {\n\t this.set(kv[0], kv[1])\n\t }, this)\n\t else\n\t throw new TypeError('invalid argument')\n\t }\n\t}\n\t\n\tPseudoMap.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t Object.keys(this._data).forEach(function (k) {\n\t if (k !== 'size')\n\t fn.call(thisp, this._data[k].value, this._data[k].key)\n\t }, this)\n\t}\n\t\n\tPseudoMap.prototype.has = function (k) {\n\t return !!find(this._data, k)\n\t}\n\t\n\tPseudoMap.prototype.get = function (k) {\n\t var res = find(this._data, k)\n\t return res && res.value\n\t}\n\t\n\tPseudoMap.prototype.set = function (k, v) {\n\t set(this._data, k, v)\n\t}\n\t\n\tPseudoMap.prototype.delete = function (k) {\n\t var res = find(this._data, k)\n\t if (res) {\n\t delete this._data[res._index]\n\t this._data.size--\n\t }\n\t}\n\t\n\tPseudoMap.prototype.clear = function () {\n\t var data = Object.create(null)\n\t data.size = 0\n\t\n\t Object.defineProperty(this, '_data', {\n\t value: data,\n\t enumerable: false,\n\t configurable: true,\n\t writable: false\n\t })\n\t}\n\t\n\tObject.defineProperty(PseudoMap.prototype, 'size', {\n\t get: function () {\n\t return this._data.size\n\t },\n\t set: function (n) {},\n\t enumerable: true,\n\t configurable: true\n\t})\n\t\n\tPseudoMap.prototype.values =\n\tPseudoMap.prototype.keys =\n\tPseudoMap.prototype.entries = function () {\n\t throw new Error('iterators are not implemented in this version')\n\t}\n\t\n\t// Either identical, or both NaN\n\tfunction same (a, b) {\n\t return a === b || a !== a && b !== b\n\t}\n\t\n\tfunction Entry (k, v, i) {\n\t this.key = k\n\t this.value = v\n\t this._index = i\n\t}\n\t\n\tfunction find (data, k) {\n\t for (var i = 0, s = '_' + k, key = s;\n\t hasOwnProperty.call(data, key);\n\t key = s + i++) {\n\t if (same(data[key].key, k))\n\t return data[key]\n\t }\n\t}\n\t\n\tfunction set (data, k, v) {\n\t for (var i = 0, s = '_' + k, key = s;\n\t hasOwnProperty.call(data, key);\n\t key = s + i++) {\n\t if (same(data[key].key, k)) {\n\t data[key].value = v\n\t return\n\t }\n\t }\n\t data.size++\n\t data[key] = new Entry(k, v, key)\n\t}\n\n\n/***/ },\n/* 62 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.\n\t//\n\t// Permission is hereby granted, free of charge, to any person obtaining a\n\t// copy of this software and associated documentation files (the\n\t// \"Software\"), to deal in the Software without restriction, including\n\t// without limitation the rights to use, copy, modify, merge, publish,\n\t// distribute, sublicense, and/or sell copies of the Software, and to permit\n\t// persons to whom the Software is furnished to do so, subject to the\n\t// following conditions:\n\t//\n\t// The above copyright notice and this permission notice shall be included\n\t// in all copies or substantial portions of the Software.\n\t//\n\t// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n\t// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\t// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n\t// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n\t// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n\t// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n\t// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\t\n\tvar formatRegExp = /%[sdj%]/g;\n\texports.format = function(f) {\n\t if (!isString(f)) {\n\t var objects = [];\n\t for (var i = 0; i < arguments.length; i++) {\n\t objects.push(inspect(arguments[i]));\n\t }\n\t return objects.join(' ');\n\t }\n\t\n\t var i = 1;\n\t var args = arguments;\n\t var len = args.length;\n\t var str = String(f).replace(formatRegExp, function(x) {\n\t if (x === '%%') return '%';\n\t if (i >= len) return x;\n\t switch (x) {\n\t case '%s': return String(args[i++]);\n\t case '%d': return Number(args[i++]);\n\t case '%j':\n\t try {\n\t return JSON.stringify(args[i++]);\n\t } catch (_) {\n\t return '[Circular]';\n\t }\n\t default:\n\t return x;\n\t }\n\t });\n\t for (var x = args[i]; i < len; x = args[++i]) {\n\t if (isNull(x) || !isObject(x)) {\n\t str += ' ' + x;\n\t } else {\n\t str += ' ' + inspect(x);\n\t }\n\t }\n\t return str;\n\t};\n\t\n\t\n\t// Mark that a method should not be used.\n\t// Returns a modified function which warns once by default.\n\t// If --no-deprecation is set, then it is a no-op.\n\texports.deprecate = function(fn, msg) {\n\t // Allow for deprecating things in the process of starting up.\n\t if (isUndefined(global.process)) {\n\t return function() {\n\t return exports.deprecate(fn, msg).apply(this, arguments);\n\t };\n\t }\n\t\n\t if (process.noDeprecation === true) {\n\t return fn;\n\t }\n\t\n\t var warned = false;\n\t function deprecated() {\n\t if (!warned) {\n\t if (process.throwDeprecation) {\n\t throw new Error(msg);\n\t } else if (process.traceDeprecation) {\n\t console.trace(msg);\n\t } else {\n\t console.error(msg);\n\t }\n\t warned = true;\n\t }\n\t return fn.apply(this, arguments);\n\t }\n\t\n\t return deprecated;\n\t};\n\t\n\t\n\tvar debugs = {};\n\tvar debugEnviron;\n\texports.debuglog = function(set) {\n\t if (isUndefined(debugEnviron))\n\t debugEnviron = process.env.NODE_DEBUG || '';\n\t set = set.toUpperCase();\n\t if (!debugs[set]) {\n\t if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n\t var pid = process.pid;\n\t debugs[set] = function() {\n\t var msg = exports.format.apply(exports, arguments);\n\t console.error('%s %d: %s', set, pid, msg);\n\t };\n\t } else {\n\t debugs[set] = function() {};\n\t }\n\t }\n\t return debugs[set];\n\t};\n\t\n\t\n\t/**\n\t * Echos the value of a value. Trys to print the value out\n\t * in the best way possible given the different types.\n\t *\n\t * @param {Object} obj The object to print out.\n\t * @param {Object} opts Optional options object that alters the output.\n\t */\n\t/* legacy: obj, showHidden, depth, colors*/\n\tfunction inspect(obj, opts) {\n\t // default options\n\t var ctx = {\n\t seen: [],\n\t stylize: stylizeNoColor\n\t };\n\t // legacy...\n\t if (arguments.length >= 3) ctx.depth = arguments[2];\n\t if (arguments.length >= 4) ctx.colors = arguments[3];\n\t if (isBoolean(opts)) {\n\t // legacy...\n\t ctx.showHidden = opts;\n\t } else if (opts) {\n\t // got an \"options\" object\n\t exports._extend(ctx, opts);\n\t }\n\t // set default options\n\t if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n\t if (isUndefined(ctx.depth)) ctx.depth = 2;\n\t if (isUndefined(ctx.colors)) ctx.colors = false;\n\t if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n\t if (ctx.colors) ctx.stylize = stylizeWithColor;\n\t return formatValue(ctx, obj, ctx.depth);\n\t}\n\texports.inspect = inspect;\n\t\n\t\n\t// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\n\tinspect.colors = {\n\t 'bold' : [1, 22],\n\t 'italic' : [3, 23],\n\t 'underline' : [4, 24],\n\t 'inverse' : [7, 27],\n\t 'white' : [37, 39],\n\t 'grey' : [90, 39],\n\t 'black' : [30, 39],\n\t 'blue' : [34, 39],\n\t 'cyan' : [36, 39],\n\t 'green' : [32, 39],\n\t 'magenta' : [35, 39],\n\t 'red' : [31, 39],\n\t 'yellow' : [33, 39]\n\t};\n\t\n\t// Don't use 'blue' not visible on cmd.exe\n\tinspect.styles = {\n\t 'special': 'cyan',\n\t 'number': 'yellow',\n\t 'boolean': 'yellow',\n\t 'undefined': 'grey',\n\t 'null': 'bold',\n\t 'string': 'green',\n\t 'date': 'magenta',\n\t // \"name\": intentionally not styling\n\t 'regexp': 'red'\n\t};\n\t\n\t\n\tfunction stylizeWithColor(str, styleType) {\n\t var style = inspect.styles[styleType];\n\t\n\t if (style) {\n\t return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n\t '\\u001b[' + inspect.colors[style][1] + 'm';\n\t } else {\n\t return str;\n\t }\n\t}\n\t\n\t\n\tfunction stylizeNoColor(str, styleType) {\n\t return str;\n\t}\n\t\n\t\n\tfunction arrayToHash(array) {\n\t var hash = {};\n\t\n\t array.forEach(function(val, idx) {\n\t hash[val] = true;\n\t });\n\t\n\t return hash;\n\t}\n\t\n\t\n\tfunction formatValue(ctx, value, recurseTimes) {\n\t // Provide a hook for user-specified inspect functions.\n\t // Check that value is an object with an inspect function on it\n\t if (ctx.customInspect &&\n\t value &&\n\t isFunction(value.inspect) &&\n\t // Filter out the util module, it's inspect function is special\n\t value.inspect !== exports.inspect &&\n\t // Also filter out any prototype objects using the circular check.\n\t !(value.constructor && value.constructor.prototype === value)) {\n\t var ret = value.inspect(recurseTimes, ctx);\n\t if (!isString(ret)) {\n\t ret = formatValue(ctx, ret, recurseTimes);\n\t }\n\t return ret;\n\t }\n\t\n\t // Primitive types cannot have properties\n\t var primitive = formatPrimitive(ctx, value);\n\t if (primitive) {\n\t return primitive;\n\t }\n\t\n\t // Look up the keys of the object.\n\t var keys = Object.keys(value);\n\t var visibleKeys = arrayToHash(keys);\n\t\n\t if (ctx.showHidden) {\n\t keys = Object.getOwnPropertyNames(value);\n\t }\n\t\n\t // IE doesn't make error fields non-enumerable\n\t // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n\t if (isError(value)\n\t && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n\t return formatError(value);\n\t }\n\t\n\t // Some type of object without properties can be shortcutted.\n\t if (keys.length === 0) {\n\t if (isFunction(value)) {\n\t var name = value.name ? ': ' + value.name : '';\n\t return ctx.stylize('[Function' + name + ']', 'special');\n\t }\n\t if (isRegExp(value)) {\n\t return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n\t }\n\t if (isDate(value)) {\n\t return ctx.stylize(Date.prototype.toString.call(value), 'date');\n\t }\n\t if (isError(value)) {\n\t return formatError(value);\n\t }\n\t }\n\t\n\t var base = '', array = false, braces = ['{', '}'];\n\t\n\t // Make Array say that they are Array\n\t if (isArray(value)) {\n\t array = true;\n\t braces = ['[', ']'];\n\t }\n\t\n\t // Make functions say that they are functions\n\t if (isFunction(value)) {\n\t var n = value.name ? ': ' + value.name : '';\n\t base = ' [Function' + n + ']';\n\t }\n\t\n\t // Make RegExps say that they are RegExps\n\t if (isRegExp(value)) {\n\t base = ' ' + RegExp.prototype.toString.call(value);\n\t }\n\t\n\t // Make dates with properties first say the date\n\t if (isDate(value)) {\n\t base = ' ' + Date.prototype.toUTCString.call(value);\n\t }\n\t\n\t // Make error with message first say the error\n\t if (isError(value)) {\n\t base = ' ' + formatError(value);\n\t }\n\t\n\t if (keys.length === 0 && (!array || value.length == 0)) {\n\t return braces[0] + base + braces[1];\n\t }\n\t\n\t if (recurseTimes < 0) {\n\t if (isRegExp(value)) {\n\t return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n\t } else {\n\t return ctx.stylize('[Object]', 'special');\n\t }\n\t }\n\t\n\t ctx.seen.push(value);\n\t\n\t var output;\n\t if (array) {\n\t output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n\t } else {\n\t output = keys.map(function(key) {\n\t return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n\t });\n\t }\n\t\n\t ctx.seen.pop();\n\t\n\t return reduceToSingleString(output, base, braces);\n\t}\n\t\n\t\n\tfunction formatPrimitive(ctx, value) {\n\t if (isUndefined(value))\n\t return ctx.stylize('undefined', 'undefined');\n\t if (isString(value)) {\n\t var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n\t .replace(/'/g, \"\\\\'\")\n\t .replace(/\\\\\"/g, '\"') + '\\'';\n\t return ctx.stylize(simple, 'string');\n\t }\n\t if (isNumber(value))\n\t return ctx.stylize('' + value, 'number');\n\t if (isBoolean(value))\n\t return ctx.stylize('' + value, 'boolean');\n\t // For some reason typeof null is \"object\", so special case here.\n\t if (isNull(value))\n\t return ctx.stylize('null', 'null');\n\t}\n\t\n\t\n\tfunction formatError(value) {\n\t return '[' + Error.prototype.toString.call(value) + ']';\n\t}\n\t\n\t\n\tfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n\t var output = [];\n\t for (var i = 0, l = value.length; i < l; ++i) {\n\t if (hasOwnProperty(value, String(i))) {\n\t output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n\t String(i), true));\n\t } else {\n\t output.push('');\n\t }\n\t }\n\t keys.forEach(function(key) {\n\t if (!key.match(/^\\d+$/)) {\n\t output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n\t key, true));\n\t }\n\t });\n\t return output;\n\t}\n\t\n\t\n\tfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n\t var name, str, desc;\n\t desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n\t if (desc.get) {\n\t if (desc.set) {\n\t str = ctx.stylize('[Getter/Setter]', 'special');\n\t } else {\n\t str = ctx.stylize('[Getter]', 'special');\n\t }\n\t } else {\n\t if (desc.set) {\n\t str = ctx.stylize('[Setter]', 'special');\n\t }\n\t }\n\t if (!hasOwnProperty(visibleKeys, key)) {\n\t name = '[' + key + ']';\n\t }\n\t if (!str) {\n\t if (ctx.seen.indexOf(desc.value) < 0) {\n\t if (isNull(recurseTimes)) {\n\t str = formatValue(ctx, desc.value, null);\n\t } else {\n\t str = formatValue(ctx, desc.value, recurseTimes - 1);\n\t }\n\t if (str.indexOf('\\n') > -1) {\n\t if (array) {\n\t str = str.split('\\n').map(function(line) {\n\t return ' ' + line;\n\t }).join('\\n').substr(2);\n\t } else {\n\t str = '\\n' + str.split('\\n').map(function(line) {\n\t return ' ' + line;\n\t }).join('\\n');\n\t }\n\t }\n\t } else {\n\t str = ctx.stylize('[Circular]', 'special');\n\t }\n\t }\n\t if (isUndefined(name)) {\n\t if (array && key.match(/^\\d+$/)) {\n\t return str;\n\t }\n\t name = JSON.stringify('' + key);\n\t if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n\t name = name.substr(1, name.length - 2);\n\t name = ctx.stylize(name, 'name');\n\t } else {\n\t name = name.replace(/'/g, \"\\\\'\")\n\t .replace(/\\\\\"/g, '\"')\n\t .replace(/(^\"|\"$)/g, \"'\");\n\t name = ctx.stylize(name, 'string');\n\t }\n\t }\n\t\n\t return name + ': ' + str;\n\t}\n\t\n\t\n\tfunction reduceToSingleString(output, base, braces) {\n\t var numLinesEst = 0;\n\t var length = output.reduce(function(prev, cur) {\n\t numLinesEst++;\n\t if (cur.indexOf('\\n') >= 0) numLinesEst++;\n\t return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n\t }, 0);\n\t\n\t if (length > 60) {\n\t return braces[0] +\n\t (base === '' ? '' : base + '\\n ') +\n\t ' ' +\n\t output.join(',\\n ') +\n\t ' ' +\n\t braces[1];\n\t }\n\t\n\t return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n\t}\n\t\n\t\n\t// NOTE: These type checking functions intentionally don't use `instanceof`\n\t// because it is fragile and can be easily faked with `Object.create()`.\n\tfunction isArray(ar) {\n\t return Array.isArray(ar);\n\t}\n\texports.isArray = isArray;\n\t\n\tfunction isBoolean(arg) {\n\t return typeof arg === 'boolean';\n\t}\n\texports.isBoolean = isBoolean;\n\t\n\tfunction isNull(arg) {\n\t return arg === null;\n\t}\n\texports.isNull = isNull;\n\t\n\tfunction isNullOrUndefined(arg) {\n\t return arg == null;\n\t}\n\texports.isNullOrUndefined = isNullOrUndefined;\n\t\n\tfunction isNumber(arg) {\n\t return typeof arg === 'number';\n\t}\n\texports.isNumber = isNumber;\n\t\n\tfunction isString(arg) {\n\t return typeof arg === 'string';\n\t}\n\texports.isString = isString;\n\t\n\tfunction isSymbol(arg) {\n\t return typeof arg === 'symbol';\n\t}\n\texports.isSymbol = isSymbol;\n\t\n\tfunction isUndefined(arg) {\n\t return arg === void 0;\n\t}\n\texports.isUndefined = isUndefined;\n\t\n\tfunction isRegExp(re) {\n\t return isObject(re) && objectToString(re) === '[object RegExp]';\n\t}\n\texports.isRegExp = isRegExp;\n\t\n\tfunction isObject(arg) {\n\t return typeof arg === 'object' && arg !== null;\n\t}\n\texports.isObject = isObject;\n\t\n\tfunction isDate(d) {\n\t return isObject(d) && objectToString(d) === '[object Date]';\n\t}\n\texports.isDate = isDate;\n\t\n\tfunction isError(e) {\n\t return isObject(e) &&\n\t (objectToString(e) === '[object Error]' || e instanceof Error);\n\t}\n\texports.isError = isError;\n\t\n\tfunction isFunction(arg) {\n\t return typeof arg === 'function';\n\t}\n\texports.isFunction = isFunction;\n\t\n\tfunction isPrimitive(arg) {\n\t return arg === null ||\n\t typeof arg === 'boolean' ||\n\t typeof arg === 'number' ||\n\t typeof arg === 'string' ||\n\t typeof arg === 'symbol' || // ES6 symbol\n\t typeof arg === 'undefined';\n\t}\n\texports.isPrimitive = isPrimitive;\n\t\n\texports.isBuffer = __webpack_require__(63);\n\t\n\tfunction objectToString(o) {\n\t return Object.prototype.toString.call(o);\n\t}\n\t\n\t\n\tfunction pad(n) {\n\t return n < 10 ? '0' + n.toString(10) : n.toString(10);\n\t}\n\t\n\t\n\tvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n\t 'Oct', 'Nov', 'Dec'];\n\t\n\t// 26 Feb 16:19:34\n\tfunction timestamp() {\n\t var d = new Date();\n\t var time = [pad(d.getHours()),\n\t pad(d.getMinutes()),\n\t pad(d.getSeconds())].join(':');\n\t return [d.getDate(), months[d.getMonth()], time].join(' ');\n\t}\n\t\n\t\n\t// log is just a thin wrapper to console.log that prepends a timestamp\n\texports.log = function() {\n\t console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n\t};\n\t\n\t\n\t/**\n\t * Inherit the prototype methods from one constructor into another.\n\t *\n\t * The Function.prototype.inherits from lang.js rewritten as a standalone\n\t * function (not on Function.prototype). NOTE: If this file is to be loaded\n\t * during bootstrapping this function needs to be rewritten using some native\n\t * functions as prototype setup using normal JavaScript does not work as\n\t * expected during bootstrapping (see mirror.js in r114903).\n\t *\n\t * @param {function} ctor Constructor function which needs to inherit the\n\t * prototype.\n\t * @param {function} superCtor Constructor function to inherit prototype from.\n\t */\n\texports.inherits = __webpack_require__(64);\n\t\n\texports._extend = function(origin, add) {\n\t // Don't do anything if add isn't an object\n\t if (!add || !isObject(add)) return origin;\n\t\n\t var keys = Object.keys(add);\n\t var i = keys.length;\n\t while (i--) {\n\t origin[keys[i]] = add[keys[i]];\n\t }\n\t return origin;\n\t};\n\t\n\tfunction hasOwnProperty(obj, prop) {\n\t return Object.prototype.hasOwnProperty.call(obj, prop);\n\t}\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(60)))\n\n/***/ },\n/* 63 */\n/***/ function(module, exports) {\n\n\tmodule.exports = function isBuffer(arg) {\n\t return arg && typeof arg === 'object'\n\t && typeof arg.copy === 'function'\n\t && typeof arg.fill === 'function'\n\t && typeof arg.readUInt8 === 'function';\n\t}\n\n/***/ },\n/* 64 */\n/***/ function(module, exports) {\n\n\tif (typeof Object.create === 'function') {\n\t // implementation from standard node.js 'util' module\n\t module.exports = function inherits(ctor, superCtor) {\n\t ctor.super_ = superCtor\n\t ctor.prototype = Object.create(superCtor.prototype, {\n\t constructor: {\n\t value: ctor,\n\t enumerable: false,\n\t writable: true,\n\t configurable: true\n\t }\n\t });\n\t };\n\t} else {\n\t // old school shim for old browsers\n\t module.exports = function inherits(ctor, superCtor) {\n\t ctor.super_ = superCtor\n\t var TempCtor = function () {}\n\t TempCtor.prototype = superCtor.prototype\n\t ctor.prototype = new TempCtor()\n\t ctor.prototype.constructor = ctor\n\t }\n\t}\n\n\n/***/ },\n/* 65 */\n/***/ function(module, exports) {\n\n\tmodule.exports = Yallist\n\t\n\tYallist.Node = Node\n\tYallist.create = Yallist\n\t\n\tfunction Yallist (list) {\n\t var self = this\n\t if (!(self instanceof Yallist)) {\n\t self = new Yallist()\n\t }\n\t\n\t self.tail = null\n\t self.head = null\n\t self.length = 0\n\t\n\t if (list && typeof list.forEach === 'function') {\n\t list.forEach(function (item) {\n\t self.push(item)\n\t })\n\t } else if (arguments.length > 0) {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t self.push(arguments[i])\n\t }\n\t }\n\t\n\t return self\n\t}\n\t\n\tYallist.prototype.removeNode = function (node) {\n\t if (node.list !== this) {\n\t throw new Error('removing node which does not belong to this list')\n\t }\n\t\n\t var next = node.next\n\t var prev = node.prev\n\t\n\t if (next) {\n\t next.prev = prev\n\t }\n\t\n\t if (prev) {\n\t prev.next = next\n\t }\n\t\n\t if (node === this.head) {\n\t this.head = next\n\t }\n\t if (node === this.tail) {\n\t this.tail = prev\n\t }\n\t\n\t node.list.length --\n\t node.next = null\n\t node.prev = null\n\t node.list = null\n\t}\n\t\n\tYallist.prototype.unshiftNode = function (node) {\n\t if (node === this.head) {\n\t return\n\t }\n\t\n\t if (node.list) {\n\t node.list.removeNode(node)\n\t }\n\t\n\t var head = this.head\n\t node.list = this\n\t node.next = head\n\t if (head) {\n\t head.prev = node\n\t }\n\t\n\t this.head = node\n\t if (!this.tail) {\n\t this.tail = node\n\t }\n\t this.length ++\n\t}\n\t\n\tYallist.prototype.pushNode = function (node) {\n\t if (node === this.tail) {\n\t return\n\t }\n\t\n\t if (node.list) {\n\t node.list.removeNode(node)\n\t }\n\t\n\t var tail = this.tail\n\t node.list = this\n\t node.prev = tail\n\t if (tail) {\n\t tail.next = node\n\t }\n\t\n\t this.tail = node\n\t if (!this.head) {\n\t this.head = node\n\t }\n\t this.length ++\n\t}\n\t\n\tYallist.prototype.push = function () {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t push(this, arguments[i])\n\t }\n\t return this.length\n\t}\n\t\n\tYallist.prototype.unshift = function () {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t unshift(this, arguments[i])\n\t }\n\t return this.length\n\t}\n\t\n\tYallist.prototype.pop = function () {\n\t if (!this.tail)\n\t return undefined\n\t\n\t var res = this.tail.value\n\t this.tail = this.tail.prev\n\t this.tail.next = null\n\t this.length --\n\t return res\n\t}\n\t\n\tYallist.prototype.shift = function () {\n\t if (!this.head)\n\t return undefined\n\t\n\t var res = this.head.value\n\t this.head = this.head.next\n\t this.head.prev = null\n\t this.length --\n\t return res\n\t}\n\t\n\tYallist.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = this.head, i = 0; walker !== null; i++) {\n\t fn.call(thisp, walker.value, i, this)\n\t walker = walker.next\n\t }\n\t}\n\t\n\tYallist.prototype.forEachReverse = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n\t fn.call(thisp, walker.value, i, this)\n\t walker = walker.prev\n\t }\n\t}\n\t\n\tYallist.prototype.get = function (n) {\n\t for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n\t // abort out of the list early if we hit a cycle\n\t walker = walker.next\n\t }\n\t if (i === n && walker !== null) {\n\t return walker.value\n\t }\n\t}\n\t\n\tYallist.prototype.getReverse = function (n) {\n\t for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n\t // abort out of the list early if we hit a cycle\n\t walker = walker.prev\n\t }\n\t if (i === n && walker !== null) {\n\t return walker.value\n\t }\n\t}\n\t\n\tYallist.prototype.map = function (fn, thisp) {\n\t thisp = thisp || this\n\t var res = new Yallist()\n\t for (var walker = this.head; walker !== null; ) {\n\t res.push(fn.call(thisp, walker.value, this))\n\t walker = walker.next\n\t }\n\t return res\n\t}\n\t\n\tYallist.prototype.mapReverse = function (fn, thisp) {\n\t thisp = thisp || this\n\t var res = new Yallist()\n\t for (var walker = this.tail; walker !== null;) {\n\t res.push(fn.call(thisp, walker.value, this))\n\t walker = walker.prev\n\t }\n\t return res\n\t}\n\t\n\tYallist.prototype.reduce = function (fn, initial) {\n\t var acc\n\t var walker = this.head\n\t if (arguments.length > 1) {\n\t acc = initial\n\t } else if (this.head) {\n\t walker = this.head.next\n\t acc = this.head.value\n\t } else {\n\t throw new TypeError('Reduce of empty list with no initial value')\n\t }\n\t\n\t for (var i = 0; walker !== null; i++) {\n\t acc = fn(acc, walker.value, i)\n\t walker = walker.next\n\t }\n\t\n\t return acc\n\t}\n\t\n\tYallist.prototype.reduceReverse = function (fn, initial) {\n\t var acc\n\t var walker = this.tail\n\t if (arguments.length > 1) {\n\t acc = initial\n\t } else if (this.tail) {\n\t walker = this.tail.prev\n\t acc = this.tail.value\n\t } else {\n\t throw new TypeError('Reduce of empty list with no initial value')\n\t }\n\t\n\t for (var i = this.length - 1; walker !== null; i--) {\n\t acc = fn(acc, walker.value, i)\n\t walker = walker.prev\n\t }\n\t\n\t return acc\n\t}\n\t\n\tYallist.prototype.toArray = function () {\n\t var arr = new Array(this.length)\n\t for (var i = 0, walker = this.head; walker !== null; i++) {\n\t arr[i] = walker.value\n\t walker = walker.next\n\t }\n\t return arr\n\t}\n\t\n\tYallist.prototype.toArrayReverse = function () {\n\t var arr = new Array(this.length)\n\t for (var i = 0, walker = this.tail; walker !== null; i++) {\n\t arr[i] = walker.value\n\t walker = walker.prev\n\t }\n\t return arr\n\t}\n\t\n\tYallist.prototype.slice = function (from, to) {\n\t to = to || this.length\n\t if (to < 0) {\n\t to += this.length\n\t }\n\t from = from || 0\n\t if (from < 0) {\n\t from += this.length\n\t }\n\t var ret = new Yallist()\n\t if (to < from || to < 0) {\n\t return ret\n\t }\n\t if (from < 0) {\n\t from = 0\n\t }\n\t if (to > this.length) {\n\t to = this.length\n\t }\n\t for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n\t walker = walker.next\n\t }\n\t for (; walker !== null && i < to; i++, walker = walker.next) {\n\t ret.push(walker.value)\n\t }\n\t return ret\n\t}\n\t\n\tYallist.prototype.sliceReverse = function (from, to) {\n\t to = to || this.length\n\t if (to < 0) {\n\t to += this.length\n\t }\n\t from = from || 0\n\t if (from < 0) {\n\t from += this.length\n\t }\n\t var ret = new Yallist()\n\t if (to < from || to < 0) {\n\t return ret\n\t }\n\t if (from < 0) {\n\t from = 0\n\t }\n\t if (to > this.length) {\n\t to = this.length\n\t }\n\t for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n\t walker = walker.prev\n\t }\n\t for (; walker !== null && i > from; i--, walker = walker.prev) {\n\t ret.push(walker.value)\n\t }\n\t return ret\n\t}\n\t\n\tYallist.prototype.reverse = function () {\n\t var head = this.head\n\t var tail = this.tail\n\t for (var walker = head; walker !== null; walker = walker.prev) {\n\t var p = walker.prev\n\t walker.prev = walker.next\n\t walker.next = p\n\t }\n\t this.head = tail\n\t this.tail = head\n\t return this\n\t}\n\t\n\tfunction push (self, item) {\n\t self.tail = new Node(item, self.tail, null, self)\n\t if (!self.head) {\n\t self.head = self.tail\n\t }\n\t self.length ++\n\t}\n\t\n\tfunction unshift (self, item) {\n\t self.head = new Node(item, null, self.head, self)\n\t if (!self.tail) {\n\t self.tail = self.head\n\t }\n\t self.length ++\n\t}\n\t\n\tfunction Node (value, prev, next, list) {\n\t if (!(this instanceof Node)) {\n\t return new Node(value, prev, next, list)\n\t }\n\t\n\t this.list = list\n\t this.value = value\n\t\n\t if (prev) {\n\t prev.next = this\n\t this.prev = prev\n\t } else {\n\t this.prev = null\n\t }\n\t\n\t if (next) {\n\t next.prev = this\n\t this.next = next\n\t } else {\n\t this.next = null\n\t }\n\t}\n\n\n/***/ },\n/* 66 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Tile2 = __webpack_require__(67);\n\t\n\tvar _Tile3 = _interopRequireDefault(_Tile2);\n\t\n\tvar _vendorBoxHelper = __webpack_require__(68);\n\t\n\tvar _vendorBoxHelper2 = _interopRequireDefault(_vendorBoxHelper);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\tvar ImageTile = (function (_Tile) {\n\t _inherits(ImageTile, _Tile);\n\t\n\t function ImageTile(quadcode, path, layer) {\n\t _classCallCheck(this, ImageTile);\n\t\n\t _get(Object.getPrototypeOf(ImageTile.prototype), 'constructor', this).call(this, quadcode, path, layer);\n\t }\n\t\n\t // Request data for the tile\n\t\n\t _createClass(ImageTile, [{\n\t key: 'requestTileAsync',\n\t value: function requestTileAsync() {\n\t var _this = this;\n\t\n\t // Making this asynchronous really speeds up the LOD framerate\n\t setTimeout(function () {\n\t if (!_this._mesh) {\n\t _this._mesh = _this._createMesh();\n\t _this._requestTile();\n\t }\n\t }, 0);\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Cancel any pending requests\n\t this._abortRequest();\n\t\n\t // Clear image reference\n\t this._image = null;\n\t\n\t _get(Object.getPrototypeOf(ImageTile.prototype), 'destroy', this).call(this);\n\t }\n\t }, {\n\t key: '_createMesh',\n\t value: function _createMesh() {\n\t // Something went wrong and the tile\n\t //\n\t // Possibly removed by the cache before loaded\n\t if (!this._center) {\n\t return;\n\t }\n\t\n\t var mesh = new _three2['default'].Object3D();\n\t var geom = new _three2['default'].PlaneBufferGeometry(this._side, this._side, 1);\n\t\n\t var material;\n\t if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshBasicMaterial({\n\t depthWrite: false\n\t });\n\t\n\t // var material = new THREE.MeshPhongMaterial({\n\t // depthWrite: false\n\t // });\n\t } else {\n\t // Other MeshStandardMaterial settings\n\t //\n\t // material.envMapIntensity will change the amount of colour reflected(?)\n\t // from the environment map – can be greater than 1 for more intensity\n\t\n\t material = new _three2['default'].MeshStandardMaterial({\n\t depthWrite: false\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var localMesh = new _three2['default'].Mesh(geom, material);\n\t localMesh.rotation.x = -90 * Math.PI / 180;\n\t\n\t localMesh.receiveShadow = true;\n\t\n\t mesh.add(localMesh);\n\t mesh.renderOrder = 0.1;\n\t\n\t mesh.position.x = this._center[0];\n\t mesh.position.z = this._center[1];\n\t\n\t // var box = new BoxHelper(localMesh);\n\t // mesh.add(box);\n\t //\n\t // mesh.add(this._createDebugMesh());\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_createDebugMesh',\n\t value: function _createDebugMesh() {\n\t var canvas = document.createElement('canvas');\n\t canvas.width = 256;\n\t canvas.height = 256;\n\t\n\t var context = canvas.getContext('2d');\n\t context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n\t context.fillStyle = '#ff0000';\n\t context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n\t context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\t\n\t var texture = new _three2['default'].Texture(canvas);\n\t\n\t // Silky smooth images when tilted\n\t texture.magFilter = _three2['default'].LinearFilter;\n\t texture.minFilter = _three2['default'].LinearMipMapLinearFilter;\n\t\n\t // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t texture.anisotropy = 4;\n\t\n\t texture.needsUpdate = true;\n\t\n\t var material = new _three2['default'].MeshBasicMaterial({\n\t map: texture,\n\t transparent: true,\n\t depthWrite: false\n\t });\n\t\n\t var geom = new _three2['default'].PlaneBufferGeometry(this._side, this._side, 1);\n\t var mesh = new _three2['default'].Mesh(geom, material);\n\t\n\t mesh.rotation.x = -90 * Math.PI / 180;\n\t mesh.position.y = 0.1;\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_requestTile',\n\t value: function _requestTile() {\n\t var _this2 = this;\n\t\n\t var urlParams = {\n\t x: this._tile[0],\n\t y: this._tile[1],\n\t z: this._tile[2]\n\t };\n\t\n\t var url = this._getTileURL(urlParams);\n\t\n\t var image = document.createElement('img');\n\t\n\t image.addEventListener('load', function (event) {\n\t var texture = new _three2['default'].Texture();\n\t\n\t texture.image = image;\n\t texture.needsUpdate = true;\n\t\n\t // Silky smooth images when tilted\n\t texture.magFilter = _three2['default'].LinearFilter;\n\t texture.minFilter = _three2['default'].LinearMipMapLinearFilter;\n\t\n\t // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t texture.anisotropy = 4;\n\t\n\t texture.needsUpdate = true;\n\t\n\t // Something went wrong and the tile or its material is missing\n\t //\n\t // Possibly removed by the cache before the image loaded\n\t if (!_this2._mesh || !_this2._mesh.children[0] || !_this2._mesh.children[0].material) {\n\t return;\n\t }\n\t\n\t _this2._mesh.children[0].material.map = texture;\n\t _this2._mesh.children[0].material.needsUpdate = true;\n\t\n\t _this2._texture = texture;\n\t _this2._ready = true;\n\t }, false);\n\t\n\t // image.addEventListener('progress', event => {}, false);\n\t // image.addEventListener('error', event => {}, false);\n\t\n\t image.crossOrigin = '';\n\t\n\t // Load image\n\t image.src = url;\n\t\n\t this._image = image;\n\t }\n\t }, {\n\t key: '_abortRequest',\n\t value: function _abortRequest() {\n\t if (!this._image) {\n\t return;\n\t }\n\t\n\t this._image.src = '';\n\t }\n\t }]);\n\t\n\t return ImageTile;\n\t})(_Tile3['default']);\n\t\n\texports['default'] = ImageTile;\n\t\n\tvar noNew = function noNew(quadcode, path, layer) {\n\t return new ImageTile(quadcode, path, layer);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.imageTile = noNew;\n\n/***/ },\n/* 67 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// Manages a single tile and its layers\n\t\n\tvar r2d = 180 / Math.PI;\n\t\n\tvar tileURLRegex = /\\{([szxy])\\}/g;\n\t\n\tvar Tile = (function () {\n\t function Tile(quadcode, path, layer) {\n\t _classCallCheck(this, Tile);\n\t\n\t this._layer = layer;\n\t this._world = layer._world;\n\t this._quadcode = quadcode;\n\t this._path = path;\n\t\n\t this._ready = false;\n\t\n\t this._tile = this._quadcodeToTile(quadcode);\n\t\n\t // Bottom-left and top-right bounds in WGS84 coordinates\n\t this._boundsLatLon = this._tileBoundsWGS84(this._tile);\n\t\n\t // Bottom-left and top-right bounds in world coordinates\n\t this._boundsWorld = this._tileBoundsFromWGS84(this._boundsLatLon);\n\t\n\t // Tile center in world coordinates\n\t this._center = this._boundsToCenter(this._boundsWorld);\n\t\n\t // Tile center in projected coordinates\n\t this._centerLatlon = this._world.pointToLatLon((0, _geoPoint.point)(this._center[0], this._center[1]));\n\t\n\t // Length of a tile side in world coorindates\n\t this._side = this._getSide(this._boundsWorld);\n\t\n\t // Point scale for tile (for unit conversion)\n\t this._pointScale = this._world.pointScale(this._centerLatlon);\n\t }\n\t\n\t // Returns true if the tile mesh and texture are ready to be used\n\t // Otherwise, returns false\n\t\n\t _createClass(Tile, [{\n\t key: 'isReady',\n\t value: function isReady() {\n\t return this._ready;\n\t }\n\t\n\t // Request data for the tile\n\t }, {\n\t key: 'requestTileAsync',\n\t value: function requestTileAsync() {}\n\t }, {\n\t key: 'getQuadcode',\n\t value: function getQuadcode() {\n\t return this._quadcode;\n\t }\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {\n\t return this._boundsWorld;\n\t }\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._center;\n\t }\n\t }, {\n\t key: 'getSide',\n\t value: function getSide() {\n\t return this._side;\n\t }\n\t }, {\n\t key: 'getMesh',\n\t value: function getMesh() {\n\t return this._mesh;\n\t }\n\t }, {\n\t key: 'getPickingMesh',\n\t value: function getPickingMesh() {\n\t return this._pickingMesh;\n\t }\n\t\n\t // Destroys the tile and removes it from the layer and memory\n\t //\n\t // Ensure that this leaves no trace of the tile – no textures, no meshes,\n\t // nothing in memory or the GPU\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Delete reference to layer and world\n\t this._layer = null;\n\t this._world = null;\n\t\n\t // Delete location references\n\t this._boundsLatLon = null;\n\t this._boundsWorld = null;\n\t this._center = null;\n\t\n\t // Done if no mesh\n\t if (!this._mesh) {\n\t return;\n\t }\n\t\n\t if (this._mesh.children) {\n\t // Dispose of mesh and materials\n\t this._mesh.children.forEach(function (child) {\n\t child.geometry.dispose();\n\t child.geometry = null;\n\t\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t });\n\t } else {\n\t this._mesh.geometry.dispose();\n\t this._mesh.geometry = null;\n\t\n\t if (this._mesh.material.map) {\n\t this._mesh.material.map.dispose();\n\t this._mesh.material.map = null;\n\t }\n\t\n\t this._mesh.material.dispose();\n\t this._mesh.material = null;\n\t }\n\t }\n\t }, {\n\t key: '_createMesh',\n\t value: function _createMesh() {}\n\t }, {\n\t key: '_createDebugMesh',\n\t value: function _createDebugMesh() {}\n\t }, {\n\t key: '_getTileURL',\n\t value: function _getTileURL(urlParams) {\n\t if (!urlParams.s) {\n\t // Default to a random choice of a, b or c\n\t urlParams.s = String.fromCharCode(97 + Math.floor(Math.random() * 3));\n\t }\n\t\n\t tileURLRegex.lastIndex = 0;\n\t return this._path.replace(tileURLRegex, function (value, key) {\n\t // Replace with paramter, otherwise keep existing value\n\t return urlParams[key];\n\t });\n\t }\n\t\n\t // Convert from quadcode to TMS tile coordinates\n\t }, {\n\t key: '_quadcodeToTile',\n\t value: function _quadcodeToTile(quadcode) {\n\t var x = 0;\n\t var y = 0;\n\t var z = quadcode.length;\n\t\n\t for (var i = z; i > 0; i--) {\n\t var mask = 1 << i - 1;\n\t var q = +quadcode[z - i];\n\t if (q === 1) {\n\t x |= mask;\n\t }\n\t if (q === 2) {\n\t y |= mask;\n\t }\n\t if (q === 3) {\n\t x |= mask;\n\t y |= mask;\n\t }\n\t }\n\t\n\t return [x, y, z];\n\t }\n\t\n\t // Convert WGS84 tile bounds to world coordinates\n\t }, {\n\t key: '_tileBoundsFromWGS84',\n\t value: function _tileBoundsFromWGS84(boundsWGS84) {\n\t var sw = this._layer._world.latLonToPoint((0, _geoLatLon.latLon)(boundsWGS84[1], boundsWGS84[0]));\n\t var ne = this._layer._world.latLonToPoint((0, _geoLatLon.latLon)(boundsWGS84[3], boundsWGS84[2]));\n\t\n\t return [sw.x, sw.y, ne.x, ne.y];\n\t }\n\t\n\t // Get tile bounds in WGS84 coordinates\n\t }, {\n\t key: '_tileBoundsWGS84',\n\t value: function _tileBoundsWGS84(tile) {\n\t var e = this._tile2lon(tile[0] + 1, tile[2]);\n\t var w = this._tile2lon(tile[0], tile[2]);\n\t var s = this._tile2lat(tile[1] + 1, tile[2]);\n\t var n = this._tile2lat(tile[1], tile[2]);\n\t return [w, s, e, n];\n\t }\n\t }, {\n\t key: '_tile2lon',\n\t value: function _tile2lon(x, z) {\n\t return x / Math.pow(2, z) * 360 - 180;\n\t }\n\t }, {\n\t key: '_tile2lat',\n\t value: function _tile2lat(y, z) {\n\t var n = Math.PI - 2 * Math.PI * y / Math.pow(2, z);\n\t return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));\n\t }\n\t }, {\n\t key: '_boundsToCenter',\n\t value: function _boundsToCenter(bounds) {\n\t var x = bounds[0] + (bounds[2] - bounds[0]) / 2;\n\t var y = bounds[1] + (bounds[3] - bounds[1]) / 2;\n\t\n\t return [x, y];\n\t }\n\t }, {\n\t key: '_getSide',\n\t value: function _getSide(bounds) {\n\t return new _three2['default'].Vector3(bounds[0], 0, bounds[3]).sub(new _three2['default'].Vector3(bounds[0], 0, bounds[1])).length();\n\t }\n\t }]);\n\t\n\t return Tile;\n\t})();\n\t\n\texports['default'] = Tile;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 68 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author mrdoob / http://mrdoob.com/\n\t */\n\t\n\tBoxHelper = function (object) {\n\t\n\t\tvar indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]);\n\t\tvar positions = new Float32Array(8 * 3);\n\t\n\t\tvar geometry = new _three2['default'].BufferGeometry();\n\t\tgeometry.setIndex(new _three2['default'].BufferAttribute(indices, 1));\n\t\tgeometry.addAttribute('position', new _three2['default'].BufferAttribute(positions, 3));\n\t\n\t\t_three2['default'].LineSegments.call(this, geometry, new _three2['default'].LineBasicMaterial({ linewidth: 2, color: 0xff0000 }));\n\t\n\t\tif (object !== undefined) {\n\t\n\t\t\tthis.update(object);\n\t\t}\n\t};\n\t\n\tBoxHelper.prototype = Object.create(_three2['default'].LineSegments.prototype);\n\tBoxHelper.prototype.constructor = BoxHelper;\n\t\n\tBoxHelper.prototype.update = (function () {\n\t\n\t\tvar box = new _three2['default'].Box3();\n\t\n\t\treturn function (object) {\n\t\n\t\t\tbox.setFromObject(object);\n\t\n\t\t\tif (box.isEmpty()) return;\n\t\n\t\t\tvar min = box.min;\n\t\t\tvar max = box.max;\n\t\n\t\t\t/*\n\t 5____4\n\t 1/___0/|\n\t | 6__|_7\n\t 2/___3/\n\t \t0: max.x, max.y, max.z\n\t 1: min.x, max.y, max.z\n\t 2: min.x, min.y, max.z\n\t 3: max.x, min.y, max.z\n\t 4: max.x, max.y, min.z\n\t 5: min.x, max.y, min.z\n\t 6: min.x, min.y, min.z\n\t 7: max.x, min.y, min.z\n\t */\n\t\n\t\t\tvar position = this.geometry.attributes.position;\n\t\t\tvar array = position.array;\n\t\n\t\t\tarray[0] = max.x;array[1] = max.y;array[2] = max.z;\n\t\t\tarray[3] = min.x;array[4] = max.y;array[5] = max.z;\n\t\t\tarray[6] = min.x;array[7] = min.y;array[8] = max.z;\n\t\t\tarray[9] = max.x;array[10] = min.y;array[11] = max.z;\n\t\t\tarray[12] = max.x;array[13] = max.y;array[14] = min.z;\n\t\t\tarray[15] = min.x;array[16] = max.y;array[17] = min.z;\n\t\t\tarray[18] = min.x;array[19] = min.y;array[20] = min.z;\n\t\t\tarray[21] = max.x;array[22] = min.y;array[23] = min.z;\n\t\n\t\t\tposition.needsUpdate = true;\n\t\n\t\t\tthis.geometry.computeBoundingSphere();\n\t\t};\n\t})();\n\t\n\texports['default'] = BoxHelper;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 69 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\texports['default'] = function (colour, skyboxTarget) {\n\t var canvas = document.createElement('canvas');\n\t canvas.width = 1;\n\t canvas.height = 1;\n\t\n\t var context = canvas.getContext('2d');\n\t context.fillStyle = colour;\n\t context.fillRect(0, 0, canvas.width, canvas.height);\n\t // context.strokeStyle = '#D0D0CF';\n\t // context.strokeRect(0, 0, canvas.width, canvas.height);\n\t\n\t var texture = new _three2['default'].Texture(canvas);\n\t\n\t // // Silky smooth images when tilted\n\t // texture.magFilter = THREE.LinearFilter;\n\t // texture.minFilter = THREE.LinearMipMapLinearFilter;\n\t // //\n\t // // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t // texture.anisotropy = 4;\n\t\n\t // texture.wrapS = THREE.RepeatWrapping;\n\t // texture.wrapT = THREE.RepeatWrapping;\n\t // texture.repeat.set(segments, segments);\n\t\n\t texture.needsUpdate = true;\n\t\n\t var material;\n\t\n\t if (!skyboxTarget) {\n\t material = new _three2['default'].MeshBasicMaterial({\n\t map: texture,\n\t depthWrite: false\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t depthWrite: false\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMap = skyboxTarget;\n\t }\n\t\n\t return material;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 70 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _TileLayer2 = __webpack_require__(56);\n\t\n\tvar _TileLayer3 = _interopRequireDefault(_TileLayer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _GeoJSONTile = __webpack_require__(71);\n\t\n\tvar _GeoJSONTile2 = _interopRequireDefault(_GeoJSONTile);\n\t\n\tvar _lodashThrottle = __webpack_require__(49);\n\t\n\tvar _lodashThrottle2 = _interopRequireDefault(_lodashThrottle);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Offer on-the-fly slicing of static, non-tile-based GeoJSON files into a\n\t// tile grid using geojson-vt\n\t//\n\t// See: https://github.com/mapbox/geojson-vt\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Consider pausing per-frame output during movement so there's little to\n\t// no jank caused by previous tiles still processing\n\t\n\t// This tile layer only updates the quadtree after world movement has occurred\n\t//\n\t// Tiles from previous quadtree updates are updated and outputted every frame\n\t// (or at least every frame, throttled to some amount)\n\t//\n\t// This is because the complexity of TopoJSON tiles requires a lot of processing\n\t// and so makes movement janky if updates occur every frame – only updating\n\t// after movement means frame drops are less obvious due to heavy processing\n\t// occurring while the view is generally stationary\n\t//\n\t// The downside is that until new tiles are requested and outputted you will\n\t// see blank spaces as you orbit and move around\n\t//\n\t// An added benefit is that it dramatically reduces the number of tiles being\n\t// requested over a period of time and the time it takes to go from request to\n\t// screen output\n\t//\n\t// It may be possible to perform these updates per-frame once Web Worker\n\t// processing is added\n\t\n\tvar GeoJSONTileLayer = (function (_TileLayer) {\n\t _inherits(GeoJSONTileLayer, _TileLayer);\n\t\n\t function GeoJSONTileLayer(path, options) {\n\t _classCallCheck(this, GeoJSONTileLayer);\n\t\n\t var defaults = {\n\t maxLOD: 14,\n\t distance: 2000\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTileLayer.prototype), 'constructor', this).call(this, options);\n\t\n\t this._path = path;\n\t }\n\t\n\t _createClass(GeoJSONTileLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t var _this = this;\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTileLayer.prototype), '_onAdd', this).call(this, world);\n\t\n\t // Trigger initial quadtree calculation on the next frame\n\t //\n\t // TODO: This is a hack to ensure the camera is all set up - a better\n\t // solution should be found\n\t setTimeout(function () {\n\t _this._calculateLOD();\n\t _this._initEvents();\n\t }, 0);\n\t }\n\t }, {\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t // Run LOD calculations based on render calls\n\t //\n\t // Throttled to 1 LOD calculation per 100ms\n\t this._throttledWorldUpdate = (0, _lodashThrottle2['default'])(this._onWorldUpdate, 100);\n\t\n\t this._world.on('preUpdate', this._throttledWorldUpdate, this);\n\t this._world.on('move', this._onWorldMove, this);\n\t this._world.on('controlsMove', this._onControlsMove, this);\n\t }\n\t\n\t // Update and output tiles each frame (throttled)\n\t }, {\n\t key: '_onWorldUpdate',\n\t value: function _onWorldUpdate() {\n\t if (this._pauseOutput) {\n\t return;\n\t }\n\t\n\t this._outputTiles();\n\t }\n\t\n\t // Update tiles grid after world move, but don't output them\n\t }, {\n\t key: '_onWorldMove',\n\t value: function _onWorldMove(latlon, point) {\n\t this._pauseOutput = false;\n\t this._calculateLOD();\n\t }\n\t\n\t // Pause updates during control movement for less visual jank\n\t }, {\n\t key: '_onControlsMove',\n\t value: function _onControlsMove() {\n\t this._pauseOutput = true;\n\t }\n\t }, {\n\t key: '_createTile',\n\t value: function _createTile(quadcode, layer) {\n\t var options = {};\n\t\n\t // if (this._options.filter) {\n\t // options.filter = this._options.filter;\n\t // }\n\t //\n\t // if (this._options.style) {\n\t // options.style = this._options.style;\n\t // }\n\t //\n\t // if (this._options.topojson) {\n\t // options.topojson = true;\n\t // }\n\t //\n\t // if (this._options.interactive) {\n\t // options.interactive = true;\n\t // }\n\t //\n\t // if (this._options.onClick) {\n\t // options.onClick = this._options.onClick;\n\t // }\n\t\n\t return new _GeoJSONTile2['default'](quadcode, this._path, layer, this._options);\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._world.off('preUpdate', this._throttledWorldUpdate);\n\t this._world.off('move', this._onWorldMove);\n\t\n\t this._throttledWorldUpdate = null;\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(GeoJSONTileLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return GeoJSONTileLayer;\n\t})(_TileLayer3['default']);\n\t\n\texports['default'] = GeoJSONTileLayer;\n\t\n\tvar noNew = function noNew(path, options) {\n\t return new GeoJSONTileLayer(path, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.geoJSONTileLayer = noNew;\n\n/***/ },\n/* 71 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Tile2 = __webpack_require__(67);\n\t\n\tvar _Tile3 = _interopRequireDefault(_Tile2);\n\t\n\tvar _GeoJSONLayer = __webpack_require__(72);\n\t\n\tvar _vendorBoxHelper = __webpack_require__(68);\n\t\n\tvar _vendorBoxHelper2 = _interopRequireDefault(_vendorBoxHelper);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _reqwest = __webpack_require__(74);\n\t\n\tvar _reqwest2 = _interopRequireDefault(_reqwest);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\t// import Offset from 'polygon-offset';\n\t\n\tvar _utilGeoJSON = __webpack_require__(76);\n\t\n\tvar _utilGeoJSON2 = _interopRequireDefault(_utilGeoJSON);\n\t\n\tvar _utilBuffer = __webpack_require__(82);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(83);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\t// TODO: Map picking IDs to some reference within the tile data / geometry so\n\t// that something useful can be done when an object is picked / clicked on\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Perform tile request and processing in a Web Worker\n\t//\n\t// Use Operative (https://github.com/padolsey/operative)\n\t//\n\t// Would it make sense to have the worker functionality defined in a static\n\t// method so it only gets initialised once and not on every tile instance?\n\t//\n\t// Otherwise, worker processing logic would have to go in the tile layer so not\n\t// to waste loads of time setting up a brand new worker with three.js for each\n\t// tile every single time.\n\t//\n\t// Unsure of the best way to get three.js and VIZI into the worker\n\t//\n\t// Would need to set up a CRS / projection identical to the world instance\n\t//\n\t// Is it possible to bypass requirements on external script by having multiple\n\t// simple worker methods that each take enough inputs to perform a single task\n\t// without requiring VIZI or three.js? So long as the heaviest logic is done in\n\t// the worker and transferrable objects are used then it should be better than\n\t// nothing. Would probably still need things like earcut...\n\t//\n\t// After all, the three.js logic and object creation will still need to be\n\t// done on the main thread regardless so the worker should try to do as much as\n\t// possible with as few dependencies as possible.\n\t//\n\t// Have a look at how this is done in Tangram before implementing anything as\n\t// the approach there is pretty similar and robust.\n\t\n\tvar GeoJSONTile = (function (_Tile) {\n\t _inherits(GeoJSONTile, _Tile);\n\t\n\t function GeoJSONTile(quadcode, path, layer, options) {\n\t _classCallCheck(this, GeoJSONTile);\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTile.prototype), 'constructor', this).call(this, quadcode, path, layer);\n\t\n\t this._defaultStyle = _utilGeoJSON2['default'].defaultStyle;\n\t\n\t var defaults = {\n\t output: true,\n\t outputToScene: false,\n\t interactive: false,\n\t topojson: false,\n\t filter: null,\n\t onEachFeature: null,\n\t polygonMaterial: null,\n\t onPolygonMesh: null,\n\t onPolygonBufferAttributes: null,\n\t polylineMaterial: null,\n\t onPolylineMesh: null,\n\t onPolylineBufferAttributes: null,\n\t pointGeometry: null,\n\t pointMaterial: null,\n\t onPointMesh: null,\n\t style: _utilGeoJSON2['default'].defaultStyle,\n\t keepFeatures: false\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t if (typeof options.style === 'function') {\n\t _options.style = options.style;\n\t } else {\n\t _options.style = (0, _lodashAssign2['default'])({}, defaults.style, options.style);\n\t }\n\t\n\t this._options = _options;\n\t }\n\t\n\t // Request data for the tile\n\t\n\t _createClass(GeoJSONTile, [{\n\t key: 'requestTileAsync',\n\t value: function requestTileAsync() {\n\t var _this = this;\n\t\n\t // Making this asynchronous really speeds up the LOD framerate\n\t setTimeout(function () {\n\t if (!_this._mesh) {\n\t _this._mesh = _this._createMesh();\n\t\n\t // this._shadowCanvas = this._createShadowCanvas();\n\t\n\t _this._requestTile();\n\t }\n\t }, 0);\n\t }\n\t\n\t // TODO: Destroy GeoJSONLayer\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Cancel any pending requests\n\t this._abortRequest();\n\t\n\t // Clear request reference\n\t this._request = null;\n\t\n\t if (this._geojsonLayer) {\n\t this._geojsonLayer.destroy();\n\t this._geojsonLayer = null;\n\t }\n\t\n\t this._mesh = null;\n\t\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTile.prototype), 'destroy', this).call(this);\n\t }\n\t }, {\n\t key: '_createMesh',\n\t value: function _createMesh() {\n\t // Something went wrong and the tile\n\t //\n\t // Possibly removed by the cache before loaded\n\t if (!this._center) {\n\t return;\n\t }\n\t\n\t var mesh = new _three2['default'].Object3D();\n\t // mesh.add(this._createDebugMesh());\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_createDebugMesh',\n\t value: function _createDebugMesh() {\n\t var canvas = document.createElement('canvas');\n\t canvas.width = 256;\n\t canvas.height = 256;\n\t\n\t var context = canvas.getContext('2d');\n\t context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n\t context.fillStyle = '#ff0000';\n\t context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n\t context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\t\n\t var texture = new _three2['default'].Texture(canvas);\n\t\n\t // Silky smooth images when tilted\n\t texture.magFilter = _three2['default'].LinearFilter;\n\t texture.minFilter = _three2['default'].LinearMipMapLinearFilter;\n\t\n\t // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t texture.anisotropy = 4;\n\t\n\t texture.needsUpdate = true;\n\t\n\t var material = new _three2['default'].MeshBasicMaterial({\n\t map: texture,\n\t transparent: true,\n\t depthWrite: false\n\t });\n\t\n\t var geom = new _three2['default'].PlaneBufferGeometry(this._side, this._side, 1);\n\t var mesh = new _three2['default'].Mesh(geom, material);\n\t\n\t mesh.rotation.x = -90 * Math.PI / 180;\n\t mesh.position.y = 0.1;\n\t\n\t return mesh;\n\t }\n\t\n\t // _createShadowCanvas() {\n\t // var canvas = document.createElement('canvas');\n\t //\n\t // // Rendered at a low resolution and later scaled up for a low-quality blur\n\t // canvas.width = 512;\n\t // canvas.height = 512;\n\t //\n\t // return canvas;\n\t // }\n\t\n\t // _addShadow(coordinates) {\n\t // var ctx = this._shadowCanvas.getContext('2d');\n\t // var width = this._shadowCanvas.width;\n\t // var height = this._shadowCanvas.height;\n\t //\n\t // var _coords;\n\t // var _offset;\n\t // var offset = new Offset();\n\t //\n\t // // Transform coordinates to shadowCanvas space and draw on canvas\n\t // coordinates.forEach((ring, index) => {\n\t // ctx.beginPath();\n\t //\n\t // _coords = ring.map(coord => {\n\t // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n\t // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n\t // return [xFrac * width, yFrac * height];\n\t // });\n\t //\n\t // if (index > 0) {\n\t // _offset = _coords;\n\t // } else {\n\t // _offset = offset.data(_coords).padding(1.3);\n\t // }\n\t //\n\t // // TODO: This is super flaky and crashes the browser if run on anything\n\t // // put the outer ring (potentially due to winding)\n\t // _offset.forEach((coord, index) => {\n\t // // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n\t // // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n\t //\n\t // if (index === 0) {\n\t // ctx.moveTo(coord[0], coord[1]);\n\t // } else {\n\t // ctx.lineTo(coord[0], coord[1]);\n\t // }\n\t // });\n\t //\n\t // ctx.closePath();\n\t // });\n\t //\n\t // ctx.fillStyle = 'rgba(80, 80, 80, 0.7)';\n\t // ctx.fill();\n\t // }\n\t\n\t }, {\n\t key: '_requestTile',\n\t value: function _requestTile() {\n\t var _this2 = this;\n\t\n\t var urlParams = {\n\t x: this._tile[0],\n\t y: this._tile[1],\n\t z: this._tile[2]\n\t };\n\t\n\t var url = this._getTileURL(urlParams);\n\t\n\t this._request = (0, _reqwest2['default'])({\n\t url: url,\n\t type: 'json',\n\t crossOrigin: true\n\t }).then(function (res) {\n\t // Clear request reference\n\t _this2._request = null;\n\t _this2._processTileData(res);\n\t })['catch'](function (err) {\n\t console.error(err);\n\t\n\t // Clear request reference\n\t _this2._request = null;\n\t });\n\t }\n\t }, {\n\t key: '_processTileData',\n\t value: function _processTileData(data) {\n\t console.time(this._tile);\n\t\n\t // Using this creates a huge amount of memory due to the quantity of tiles\n\t this._geojsonLayer = (0, _GeoJSONLayer.geoJSONLayer)(data, this._options).addTo(this._world);\n\t\n\t this._mesh = this._geojsonLayer._object3D;\n\t this._pickingMesh = this._geojsonLayer._pickingMesh;\n\t\n\t // Free the GeoJSON memory as we don't need it\n\t //\n\t // TODO: This should probably be a method within GeoJSONLayer\n\t this._geojsonLayer._geojson = null;\n\t\n\t // TODO: Fix or store shadow canvas stuff and get rid of this code\n\t // Draw footprint on shadow canvas\n\t //\n\t // TODO: Disabled for the time-being until it can be sped up / moved to\n\t // a worker\n\t // this._addShadow(coordinates);\n\t\n\t // Output shadow canvas\n\t\n\t // TODO: Disabled for the time-being until it can be sped up / moved to\n\t // a worker\n\t\n\t // var texture = new THREE.Texture(this._shadowCanvas);\n\t //\n\t // // Silky smooth images when tilted\n\t // texture.magFilter = THREE.LinearFilter;\n\t // texture.minFilter = THREE.LinearMipMapLinearFilter;\n\t //\n\t // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t // texture.anisotropy = 4;\n\t //\n\t // texture.needsUpdate = true;\n\t //\n\t // var material;\n\t // if (!this._world._environment._skybox) {\n\t // material = new THREE.MeshBasicMaterial({\n\t // map: texture,\n\t // transparent: true,\n\t // depthWrite: false\n\t // });\n\t // } else {\n\t // material = new THREE.MeshStandardMaterial({\n\t // map: texture,\n\t // transparent: true,\n\t // depthWrite: false\n\t // });\n\t // material.roughness = 1;\n\t // material.metalness = 0.1;\n\t // material.envMap = this._world._environment._skybox.getRenderTarget();\n\t // }\n\t //\n\t // var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n\t // var mesh = new THREE.Mesh(geom, material);\n\t //\n\t // mesh.castShadow = false;\n\t // mesh.receiveShadow = false;\n\t // mesh.renderOrder = 1;\n\t //\n\t // mesh.rotation.x = -90 * Math.PI / 180;\n\t //\n\t // this._mesh.add(mesh);\n\t\n\t this._ready = true;\n\t console.timeEnd(this._tile);\n\t }\n\t }, {\n\t key: '_abortRequest',\n\t value: function _abortRequest() {\n\t if (!this._request) {\n\t return;\n\t }\n\t\n\t this._request.abort();\n\t }\n\t }]);\n\t\n\t return GeoJSONTile;\n\t})(_Tile3['default']);\n\t\n\texports['default'] = GeoJSONTile;\n\t\n\tvar noNew = function noNew(quadcode, path, layer, options) {\n\t return new GeoJSONTile(quadcode, path, layer, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.geoJSONTile = noNew;\n\n/***/ },\n/* 72 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Consider adopting GeoJSON CSS\n\t// http://wiki.openstreetmap.org/wiki/Geojson_CSS\n\t\n\t// TODO: Allow interaction to be defined per-layer to save on resources\n\t//\n\t// For example, only allow polygons to be interactive via a polygonInteractive\n\t// option\n\t\n\tvar _LayerGroup2 = __webpack_require__(73);\n\t\n\tvar _LayerGroup3 = _interopRequireDefault(_LayerGroup2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _reqwest = __webpack_require__(74);\n\t\n\tvar _reqwest2 = _interopRequireDefault(_reqwest);\n\t\n\tvar _utilGeoJSON = __webpack_require__(76);\n\t\n\tvar _utilGeoJSON2 = _interopRequireDefault(_utilGeoJSON);\n\t\n\tvar _utilBuffer = __webpack_require__(82);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(83);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _geometryPolygonLayer = __webpack_require__(85);\n\t\n\tvar _geometryPolygonLayer2 = _interopRequireDefault(_geometryPolygonLayer);\n\t\n\tvar _geometryPolylineLayer = __webpack_require__(86);\n\t\n\tvar _geometryPolylineLayer2 = _interopRequireDefault(_geometryPolylineLayer);\n\t\n\tvar _geometryPointLayer = __webpack_require__(87);\n\t\n\tvar _geometryPointLayer2 = _interopRequireDefault(_geometryPointLayer);\n\t\n\tvar GeoJSONLayer = (function (_LayerGroup) {\n\t _inherits(GeoJSONLayer, _LayerGroup);\n\t\n\t function GeoJSONLayer(geojson, options) {\n\t _classCallCheck(this, GeoJSONLayer);\n\t\n\t var defaults = {\n\t output: false,\n\t interactive: false,\n\t topojson: false,\n\t filter: null,\n\t onEachFeature: null,\n\t polygonMaterial: null,\n\t onPolygonMesh: null,\n\t onPolygonBufferAttributes: null,\n\t polylineMaterial: null,\n\t onPolylineMesh: null,\n\t onPolylineBufferAttributes: null,\n\t pointGeometry: null,\n\t pointMaterial: null,\n\t onPointMesh: null,\n\t style: _utilGeoJSON2['default'].defaultStyle,\n\t keepFeatures: true\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t if (typeof options.style === 'function') {\n\t _options.style = options.style;\n\t } else {\n\t _options.style = (0, _lodashAssign2['default'])({}, defaults.style, options.style);\n\t }\n\t\n\t _get(Object.getPrototypeOf(GeoJSONLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t this._geojson = geojson;\n\t }\n\t\n\t _createClass(GeoJSONLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new THREE.Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t // Request data from URL if needed\n\t if (typeof this._geojson === 'string') {\n\t this._requestData(this._geojson);\n\t } else {\n\t // Process and add GeoJSON to layer\n\t this._processData(this._geojson);\n\t }\n\t }\n\t }, {\n\t key: '_requestData',\n\t value: function _requestData(url) {\n\t var _this = this;\n\t\n\t this._request = (0, _reqwest2['default'])({\n\t url: url,\n\t type: 'json',\n\t crossOrigin: true\n\t }).then(function (res) {\n\t // Clear request reference\n\t _this._request = null;\n\t _this._processData(res);\n\t })['catch'](function (err) {\n\t console.error(err);\n\t\n\t // Clear request reference\n\t _this._request = null;\n\t });\n\t }\n\t\n\t // TODO: Wrap into a helper method so this isn't duplicated in the tiled\n\t // GeoJSON output layer\n\t //\n\t // Need to be careful as to not make it impossible to fork this off into a\n\t // worker script at a later stage\n\t }, {\n\t key: '_processData',\n\t value: function _processData(data) {\n\t var _this2 = this;\n\t\n\t // Collects features into a single FeatureCollection\n\t //\n\t // Also converts TopoJSON to GeoJSON if instructed\n\t this._geojson = _utilGeoJSON2['default'].collectFeatures(data, this._options.topojson);\n\t\n\t // TODO: Check that GeoJSON is valid / usable\n\t\n\t var features = this._geojson.features;\n\t\n\t // Run filter, if provided\n\t if (this._options.filter) {\n\t features = this._geojson.features.filter(this._options.filter);\n\t }\n\t\n\t var defaults = {};\n\t\n\t // Assume that a style won't be set per feature\n\t var style = this._options.style;\n\t\n\t var options;\n\t features.forEach(function (feature) {\n\t // Get per-feature style object, if provided\n\t if (typeof _this2._options.style === 'function') {\n\t style = (0, _lodashAssign2['default'])({}, _utilGeoJSON2['default'].defaultStyle, _this2._options.style(feature));\n\t }\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, {\n\t // If merging feature layers, stop them outputting themselves\n\t // If not, let feature layers output themselves to the world\n\t output: !_this2.isOutput(),\n\t interactive: _this2._options.interactive,\n\t style: style\n\t });\n\t\n\t var layer = _this2._featureToLayer(feature, options);\n\t\n\t if (!layer) {\n\t return;\n\t }\n\t\n\t // Sometimes you don't want to store a reference to the feature\n\t //\n\t // For example, to save memory when being used by tile layers\n\t if (_this2._options.keepFeatures) {\n\t layer.feature = feature;\n\t }\n\t\n\t // If defined, call a function for each feature\n\t //\n\t // This is commonly used for adding event listeners from the user script\n\t if (_this2._options.onEachFeature) {\n\t _this2._options.onEachFeature(feature, layer);\n\t }\n\t\n\t _this2.addLayer(layer);\n\t });\n\t\n\t // If merging layers do that now, otherwise skip as the geometry layers\n\t // should have already outputted themselves\n\t if (!this.isOutput()) {\n\t return;\n\t }\n\t\n\t // From here on we can assume that we want to merge the layers\n\t\n\t var polygonAttributes = [];\n\t var polygonFlat = true;\n\t\n\t var polylineAttributes = [];\n\t var pointAttributes = [];\n\t\n\t this._layers.forEach(function (layer) {\n\t if (layer instanceof _geometryPolygonLayer2['default']) {\n\t polygonAttributes.push(layer.getBufferAttributes());\n\t\n\t if (polygonFlat && !layer.isFlat()) {\n\t polygonFlat = false;\n\t }\n\t } else if (layer instanceof _geometryPolylineLayer2['default']) {\n\t polylineAttributes.push(layer.getBufferAttributes());\n\t } else if (layer instanceof _geometryPointLayer2['default']) {\n\t pointAttributes.push(layer.getBufferAttributes());\n\t }\n\t });\n\t\n\t if (polygonAttributes.length > 0) {\n\t var mergedPolygonAttributes = _utilBuffer2['default'].mergeAttributes(polygonAttributes);\n\t this._setPolygonMesh(mergedPolygonAttributes, polygonFlat);\n\t this.add(this._polygonMesh);\n\t }\n\t\n\t if (polylineAttributes.length > 0) {\n\t var mergedPolylineAttributes = _utilBuffer2['default'].mergeAttributes(polylineAttributes);\n\t this._setPolylineMesh(mergedPolylineAttributes);\n\t this.add(this._polylineMesh);\n\t }\n\t\n\t if (pointAttributes.length > 0) {\n\t var mergedPointAttributes = _utilBuffer2['default'].mergeAttributes(pointAttributes);\n\t this._setPointMesh(mergedPointAttributes);\n\t this.add(this._pointMesh);\n\t }\n\t\n\t // Clean up layers\n\t //\n\t // TODO: Are there ever situations where the unmerged buffer attributes\n\t // and coordinates would still be required?\n\t this._layers.forEach(function (layer) {\n\t layer.clearBufferAttributes();\n\t layer.clearCoordinates();\n\t });\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // TODO: De-dupe this from the individual mesh creation logic within each\n\t // geometry layer (materials, settings, etc)\n\t //\n\t // Could make this an abstract method for each geometry layer\n\t }, {\n\t key: '_setPolygonMesh',\n\t value: function _setPolygonMesh(attributes, flat) {\n\t var geometry = new THREE.BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t // TODO: Make this work when style is a function per feature\n\t var style = typeof this._options.style === 'function' ? this._options.style(this._geojson.features[0]) : this._options.style;\n\t style = (0, _lodashAssign2['default'])({}, _utilGeoJSON2['default'].defaultStyle, style);\n\t\n\t var material;\n\t if (this._options.polygonMaterial && this._options.polygonMaterial instanceof THREE.Material) {\n\t material = this._options.polygonMaterial;\n\t } else if (!this._world._environment._skybox) {\n\t material = new THREE.MeshPhongMaterial({\n\t vertexColors: THREE.VertexColors,\n\t side: THREE.BackSide,\n\t transparent: style.transparent,\n\t opacity: style.opacity,\n\t blending: style.blending\n\t });\n\t } else {\n\t material = new THREE.MeshStandardMaterial({\n\t vertexColors: THREE.VertexColors,\n\t side: THREE.BackSide,\n\t transparent: style.transparent,\n\t opacity: style.opacity,\n\t blending: style.blending\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var mesh;\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onPolygonMesh === 'function') {\n\t mesh = this._options.onPolygonMesh(geometry, material);\n\t } else {\n\t mesh = new THREE.Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t mesh.receiveShadow = true;\n\t }\n\t\n\t if (flat) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = 1;\n\t }\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t material.side = THREE.BackSide;\n\t\n\t var pickingMesh = new THREE.Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._polygonMesh = mesh;\n\t }\n\t }, {\n\t key: '_setPolylineMesh',\n\t value: function _setPolylineMesh(attributes) {\n\t var geometry = new THREE.BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\t\n\t if (attributes.normals) {\n\t geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n\t }\n\t\n\t geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t // TODO: Make this work when style is a function per feature\n\t var style = typeof this._options.style === 'function' ? this._options.style(this._geojson.features[0]) : this._options.style;\n\t style = (0, _lodashAssign2['default'])({}, _utilGeoJSON2['default'].defaultStyle, style);\n\t\n\t var material;\n\t if (this._options.polylineMaterial && this._options.polylineMaterial instanceof THREE.Material) {\n\t material = this._options.polylineMaterial;\n\t } else {\n\t material = new THREE.LineBasicMaterial({\n\t vertexColors: THREE.VertexColors,\n\t linewidth: style.lineWidth,\n\t transparent: style.lineTransparent,\n\t opacity: style.lineOpacity,\n\t blending: style.lineBlending\n\t });\n\t }\n\t\n\t var mesh;\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onPolylineMesh === 'function') {\n\t mesh = this._options.onPolylineMesh(geometry, material);\n\t } else {\n\t mesh = new THREE.LineSegments(geometry, material);\n\t\n\t if (style.lineRenderOrder !== undefined) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = style.lineRenderOrder;\n\t }\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t }\n\t\n\t // TODO: Allow this to be overridden, or copy mesh instead of creating a new\n\t // one just for picking\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t // Make the line wider / easier to pick\n\t material.linewidth = style.lineWidth + material.linePadding;\n\t\n\t var pickingMesh = new THREE.LineSegments(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._polylineMesh = mesh;\n\t }\n\t }, {\n\t key: '_setPointMesh',\n\t value: function _setPointMesh(attributes) {\n\t var geometry = new THREE.BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t if (this._options.pointMaterial && this._options.pointMaterial instanceof THREE.Material) {\n\t material = this._options.pointMaterial;\n\t } else if (!this._world._environment._skybox) {\n\t material = new THREE.MeshPhongMaterial({\n\t vertexColors: THREE.VertexColors\n\t // side: THREE.BackSide\n\t });\n\t } else {\n\t material = new THREE.MeshStandardMaterial({\n\t vertexColors: THREE.VertexColors\n\t // side: THREE.BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var mesh;\n\t\n\t // Pass mesh callback, if defined\n\t if (typeof this._options.onPointMesh === 'function') {\n\t mesh = this._options.onPointMesh(geometry, material);\n\t } else {\n\t mesh = new THREE.Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t }\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t var pickingMesh = new THREE.Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._pointMesh = mesh;\n\t }\n\t\n\t // TODO: Support all GeoJSON geometry types\n\t }, {\n\t key: '_featureToLayer',\n\t value: function _featureToLayer(feature, options) {\n\t var geometry = feature.geometry;\n\t var coordinates = geometry.coordinates ? geometry.coordinates : null;\n\t\n\t if (!coordinates || !geometry) {\n\t return;\n\t }\n\t\n\t if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {\n\t // Get material instance to use for polygon, if provided\n\t if (typeof this._options.polygonMaterial === 'function') {\n\t options.geometry = this._options.polygonMaterial(feature);\n\t }\n\t\n\t if (typeof this._options.onPolygonMesh === 'function') {\n\t options.onMesh = this._options.onPolygonMesh;\n\t }\n\t\n\t // Pass onBufferAttributes callback, if defined\n\t if (typeof this._options.onPolygonBufferAttributes === 'function') {\n\t options.onBufferAttributes = this._options.onPolygonBufferAttributes;\n\t }\n\t\n\t return new _geometryPolygonLayer2['default'](coordinates, options);\n\t }\n\t\n\t if (geometry.type === 'LineString' || geometry.type === 'MultiLineString') {\n\t // Get material instance to use for line, if provided\n\t if (typeof this._options.lineMaterial === 'function') {\n\t options.geometry = this._options.lineMaterial(feature);\n\t }\n\t\n\t if (typeof this._options.onPolylineMesh === 'function') {\n\t options.onMesh = this._options.onPolylineMesh;\n\t }\n\t\n\t // Pass onBufferAttributes callback, if defined\n\t if (typeof this._options.onPolylineBufferAttributes === 'function') {\n\t options.onBufferAttributes = this._options.onPolylineBufferAttributes;\n\t }\n\t\n\t return new _geometryPolylineLayer2['default'](coordinates, options);\n\t }\n\t\n\t if (geometry.type === 'Point' || geometry.type === 'MultiPoint') {\n\t // Get geometry object to use for point, if provided\n\t if (typeof this._options.pointGeometry === 'function') {\n\t options.geometry = this._options.pointGeometry(feature);\n\t }\n\t\n\t // Get material instance to use for point, if provided\n\t if (typeof this._options.pointMaterial === 'function') {\n\t options.geometry = this._options.pointMaterial(feature);\n\t }\n\t\n\t if (typeof this._options.onPointMesh === 'function') {\n\t options.onMesh = this._options.onPointMesh;\n\t }\n\t\n\t return new _geometryPointLayer2['default'](coordinates, options);\n\t }\n\t }\n\t }, {\n\t key: '_abortRequest',\n\t value: function _abortRequest() {\n\t if (!this._request) {\n\t return;\n\t }\n\t\n\t this._request.abort();\n\t }\n\t\n\t // Destroy the layers and remove them from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Cancel any pending requests\n\t this._abortRequest();\n\t\n\t // Clear request reference\n\t this._request = null;\n\t\n\t this._geojson = null;\n\t\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(GeoJSONLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return GeoJSONLayer;\n\t})(_LayerGroup3['default']);\n\t\n\texports['default'] = GeoJSONLayer;\n\t\n\tvar noNew = function noNew(geojson, options) {\n\t return new GeoJSONLayer(geojson, options);\n\t};\n\t\n\texports.geoJSONLayer = noNew;\n\n/***/ },\n/* 73 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Layer2 = __webpack_require__(46);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar LayerGroup = (function (_Layer) {\n\t _inherits(LayerGroup, _Layer);\n\t\n\t function LayerGroup(options) {\n\t _classCallCheck(this, LayerGroup);\n\t\n\t var defaults = {\n\t output: false\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(LayerGroup.prototype), 'constructor', this).call(this, _options);\n\t\n\t this._layers = [];\n\t }\n\t\n\t _createClass(LayerGroup, [{\n\t key: 'addLayer',\n\t value: function addLayer(layer) {\n\t this._layers.push(layer);\n\t this._world.addLayer(layer);\n\t }\n\t }, {\n\t key: 'removeLayer',\n\t value: function removeLayer(layer) {\n\t var layerIndex = this._layers.indexOf(layer);\n\t\n\t if (layerIndex > -1) {\n\t // Remove from this._layers\n\t this._layers.splice(layerIndex, 1);\n\t };\n\t\n\t this._world.removeLayer(layer);\n\t }\n\t }, {\n\t key: '_onAdd',\n\t value: function _onAdd(world) {}\n\t\n\t // Destroy the layers and remove them from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t for (var i = 0; i < this._layers.length; i++) {\n\t this._layers[i].destroy();\n\t }\n\t\n\t this._layers = null;\n\t\n\t _get(Object.getPrototypeOf(LayerGroup.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return LayerGroup;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = LayerGroup;\n\t\n\tvar noNew = function noNew(options) {\n\t return new LayerGroup(options);\n\t};\n\t\n\texports.layerGroup = noNew;\n\n/***/ },\n/* 74 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n\t * Reqwest! A general purpose XHR connection manager\n\t * license MIT (c) Dustin Diaz 2015\n\t * https://github.com/ded/reqwest\n\t */\n\t\n\t!function (name, context, definition) {\n\t if (typeof module != 'undefined' && module.exports) module.exports = definition()\n\t else if (true) !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))\n\t else context[name] = definition()\n\t}('reqwest', this, function () {\n\t\n\t var context = this\n\t\n\t if ('window' in context) {\n\t var doc = document\n\t , byTag = 'getElementsByTagName'\n\t , head = doc[byTag]('head')[0]\n\t } else {\n\t var XHR2\n\t try {\n\t XHR2 = __webpack_require__(75)\n\t } catch (ex) {\n\t throw new Error('Peer dependency `xhr2` required! Please npm install xhr2')\n\t }\n\t }\n\t\n\t\n\t var httpsRe = /^http/\n\t , protocolRe = /(^\\w+):\\/\\//\n\t , twoHundo = /^(20\\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n\t , readyState = 'readyState'\n\t , contentType = 'Content-Type'\n\t , requestedWith = 'X-Requested-With'\n\t , uniqid = 0\n\t , callbackPrefix = 'reqwest_' + (+new Date())\n\t , lastValue // data stored by the most recent JSONP callback\n\t , xmlHttpRequest = 'XMLHttpRequest'\n\t , xDomainRequest = 'XDomainRequest'\n\t , noop = function () {}\n\t\n\t , isArray = typeof Array.isArray == 'function'\n\t ? Array.isArray\n\t : function (a) {\n\t return a instanceof Array\n\t }\n\t\n\t , defaultHeaders = {\n\t 'contentType': 'application/x-www-form-urlencoded'\n\t , 'requestedWith': xmlHttpRequest\n\t , 'accept': {\n\t '*': 'text/javascript, text/html, application/xml, text/xml, */*'\n\t , 'xml': 'application/xml, text/xml'\n\t , 'html': 'text/html'\n\t , 'text': 'text/plain'\n\t , 'json': 'application/json, text/javascript'\n\t , 'js': 'application/javascript, text/javascript'\n\t }\n\t }\n\t\n\t , xhr = function(o) {\n\t // is it x-domain\n\t if (o['crossOrigin'] === true) {\n\t var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null\n\t if (xhr && 'withCredentials' in xhr) {\n\t return xhr\n\t } else if (context[xDomainRequest]) {\n\t return new XDomainRequest()\n\t } else {\n\t throw new Error('Browser does not support cross-origin requests')\n\t }\n\t } else if (context[xmlHttpRequest]) {\n\t return new XMLHttpRequest()\n\t } else if (XHR2) {\n\t return new XHR2()\n\t } else {\n\t return new ActiveXObject('Microsoft.XMLHTTP')\n\t }\n\t }\n\t , globalSetupOptions = {\n\t dataFilter: function (data) {\n\t return data\n\t }\n\t }\n\t\n\t function succeed(r) {\n\t var protocol = protocolRe.exec(r.url)\n\t protocol = (protocol && protocol[1]) || context.location.protocol\n\t return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response\n\t }\n\t\n\t function handleReadyState(r, success, error) {\n\t return function () {\n\t // use _aborted to mitigate against IE err c00c023f\n\t // (can't read props on aborted request objects)\n\t if (r._aborted) return error(r.request)\n\t if (r._timedOut) return error(r.request, 'Request is aborted: timeout')\n\t if (r.request && r.request[readyState] == 4) {\n\t r.request.onreadystatechange = noop\n\t if (succeed(r)) success(r.request)\n\t else\n\t error(r.request)\n\t }\n\t }\n\t }\n\t\n\t function setHeaders(http, o) {\n\t var headers = o['headers'] || {}\n\t , h\n\t\n\t headers['Accept'] = headers['Accept']\n\t || defaultHeaders['accept'][o['type']]\n\t || defaultHeaders['accept']['*']\n\t\n\t var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData);\n\t // breaks cross-origin requests with legacy browsers\n\t if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith']\n\t if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType']\n\t for (h in headers)\n\t headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h])\n\t }\n\t\n\t function setCredentials(http, o) {\n\t if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') {\n\t http.withCredentials = !!o['withCredentials']\n\t }\n\t }\n\t\n\t function generalCallback(data) {\n\t lastValue = data\n\t }\n\t\n\t function urlappend (url, s) {\n\t return url + (/\\?/.test(url) ? '&' : '?') + s\n\t }\n\t\n\t function handleJsonp(o, fn, err, url) {\n\t var reqId = uniqid++\n\t , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key\n\t , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId)\n\t , cbreg = new RegExp('((^|\\\\?|&)' + cbkey + ')=([^&]+)')\n\t , match = url.match(cbreg)\n\t , script = doc.createElement('script')\n\t , loaded = 0\n\t , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1\n\t\n\t if (match) {\n\t if (match[3] === '?') {\n\t url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name\n\t } else {\n\t cbval = match[3] // provided callback func name\n\t }\n\t } else {\n\t url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em\n\t }\n\t\n\t context[cbval] = generalCallback\n\t\n\t script.type = 'text/javascript'\n\t script.src = url\n\t script.async = true\n\t if (typeof script.onreadystatechange !== 'undefined' && !isIE10) {\n\t // need this for IE due to out-of-order onreadystatechange(), binding script\n\t // execution to an event listener gives us control over when the script\n\t // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html\n\t script.htmlFor = script.id = '_reqwest_' + reqId\n\t }\n\t\n\t script.onload = script.onreadystatechange = function () {\n\t if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) {\n\t return false\n\t }\n\t script.onload = script.onreadystatechange = null\n\t script.onclick && script.onclick()\n\t // Call the user callback with the last value stored and clean up values and scripts.\n\t fn(lastValue)\n\t lastValue = undefined\n\t head.removeChild(script)\n\t loaded = 1\n\t }\n\t\n\t // Add the script to the DOM head\n\t head.appendChild(script)\n\t\n\t // Enable JSONP timeout\n\t return {\n\t abort: function () {\n\t script.onload = script.onreadystatechange = null\n\t err({}, 'Request is aborted: timeout', {})\n\t lastValue = undefined\n\t head.removeChild(script)\n\t loaded = 1\n\t }\n\t }\n\t }\n\t\n\t function getRequest(fn, err) {\n\t var o = this.o\n\t , method = (o['method'] || 'GET').toUpperCase()\n\t , url = typeof o === 'string' ? o : o['url']\n\t // convert non-string objects to query-string form unless o['processData'] is false\n\t , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string')\n\t ? reqwest.toQueryString(o['data'])\n\t : (o['data'] || null)\n\t , http\n\t , sendWait = false\n\t\n\t // if we're working on a GET request and we have data then we should append\n\t // query string to end of URL and not post data\n\t if ((o['type'] == 'jsonp' || method == 'GET') && data) {\n\t url = urlappend(url, data)\n\t data = null\n\t }\n\t\n\t if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url)\n\t\n\t // get the xhr from the factory if passed\n\t // if the factory returns null, fall-back to ours\n\t http = (o.xhr && o.xhr(o)) || xhr(o)\n\t\n\t http.open(method, url, o['async'] === false ? false : true)\n\t setHeaders(http, o)\n\t setCredentials(http, o)\n\t if (context[xDomainRequest] && http instanceof context[xDomainRequest]) {\n\t http.onload = fn\n\t http.onerror = err\n\t // NOTE: see\n\t // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e\n\t http.onprogress = function() {}\n\t sendWait = true\n\t } else {\n\t http.onreadystatechange = handleReadyState(this, fn, err)\n\t }\n\t o['before'] && o['before'](http)\n\t if (sendWait) {\n\t setTimeout(function () {\n\t http.send(data)\n\t }, 200)\n\t } else {\n\t http.send(data)\n\t }\n\t return http\n\t }\n\t\n\t function Reqwest(o, fn) {\n\t this.o = o\n\t this.fn = fn\n\t\n\t init.apply(this, arguments)\n\t }\n\t\n\t function setType(header) {\n\t // json, javascript, text/plain, text/html, xml\n\t if (header === null) return undefined; //In case of no content-type.\n\t if (header.match('json')) return 'json'\n\t if (header.match('javascript')) return 'js'\n\t if (header.match('text')) return 'html'\n\t if (header.match('xml')) return 'xml'\n\t }\n\t\n\t function init(o, fn) {\n\t\n\t this.url = typeof o == 'string' ? o : o['url']\n\t this.timeout = null\n\t\n\t // whether request has been fulfilled for purpose\n\t // of tracking the Promises\n\t this._fulfilled = false\n\t // success handlers\n\t this._successHandler = function(){}\n\t this._fulfillmentHandlers = []\n\t // error handlers\n\t this._errorHandlers = []\n\t // complete (both success and fail) handlers\n\t this._completeHandlers = []\n\t this._erred = false\n\t this._responseArgs = {}\n\t\n\t var self = this\n\t\n\t fn = fn || function () {}\n\t\n\t if (o['timeout']) {\n\t this.timeout = setTimeout(function () {\n\t timedOut()\n\t }, o['timeout'])\n\t }\n\t\n\t if (o['success']) {\n\t this._successHandler = function () {\n\t o['success'].apply(o, arguments)\n\t }\n\t }\n\t\n\t if (o['error']) {\n\t this._errorHandlers.push(function () {\n\t o['error'].apply(o, arguments)\n\t })\n\t }\n\t\n\t if (o['complete']) {\n\t this._completeHandlers.push(function () {\n\t o['complete'].apply(o, arguments)\n\t })\n\t }\n\t\n\t function complete (resp) {\n\t o['timeout'] && clearTimeout(self.timeout)\n\t self.timeout = null\n\t while (self._completeHandlers.length > 0) {\n\t self._completeHandlers.shift()(resp)\n\t }\n\t }\n\t\n\t function success (resp) {\n\t var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE\n\t resp = (type !== 'jsonp') ? self.request : resp\n\t // use global data filter on response text\n\t var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type)\n\t , r = filteredResponse\n\t try {\n\t resp.responseText = r\n\t } catch (e) {\n\t // can't assign this in IE<=8, just ignore\n\t }\n\t if (r) {\n\t switch (type) {\n\t case 'json':\n\t try {\n\t resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')')\n\t } catch (err) {\n\t return error(resp, 'Could not parse JSON in response', err)\n\t }\n\t break\n\t case 'js':\n\t resp = eval(r)\n\t break\n\t case 'html':\n\t resp = r\n\t break\n\t case 'xml':\n\t resp = resp.responseXML\n\t && resp.responseXML.parseError // IE trololo\n\t && resp.responseXML.parseError.errorCode\n\t && resp.responseXML.parseError.reason\n\t ? null\n\t : resp.responseXML\n\t break\n\t }\n\t }\n\t\n\t self._responseArgs.resp = resp\n\t self._fulfilled = true\n\t fn(resp)\n\t self._successHandler(resp)\n\t while (self._fulfillmentHandlers.length > 0) {\n\t resp = self._fulfillmentHandlers.shift()(resp)\n\t }\n\t\n\t complete(resp)\n\t }\n\t\n\t function timedOut() {\n\t self._timedOut = true\n\t self.request.abort()\n\t }\n\t\n\t function error(resp, msg, t) {\n\t resp = self.request\n\t self._responseArgs.resp = resp\n\t self._responseArgs.msg = msg\n\t self._responseArgs.t = t\n\t self._erred = true\n\t while (self._errorHandlers.length > 0) {\n\t self._errorHandlers.shift()(resp, msg, t)\n\t }\n\t complete(resp)\n\t }\n\t\n\t this.request = getRequest.call(this, success, error)\n\t }\n\t\n\t Reqwest.prototype = {\n\t abort: function () {\n\t this._aborted = true\n\t this.request.abort()\n\t }\n\t\n\t , retry: function () {\n\t init.call(this, this.o, this.fn)\n\t }\n\t\n\t /**\n\t * Small deviation from the Promises A CommonJs specification\n\t * http://wiki.commonjs.org/wiki/Promises/A\n\t */\n\t\n\t /**\n\t * `then` will execute upon successful requests\n\t */\n\t , then: function (success, fail) {\n\t success = success || function () {}\n\t fail = fail || function () {}\n\t if (this._fulfilled) {\n\t this._responseArgs.resp = success(this._responseArgs.resp)\n\t } else if (this._erred) {\n\t fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n\t } else {\n\t this._fulfillmentHandlers.push(success)\n\t this._errorHandlers.push(fail)\n\t }\n\t return this\n\t }\n\t\n\t /**\n\t * `always` will execute whether the request succeeds or fails\n\t */\n\t , always: function (fn) {\n\t if (this._fulfilled || this._erred) {\n\t fn(this._responseArgs.resp)\n\t } else {\n\t this._completeHandlers.push(fn)\n\t }\n\t return this\n\t }\n\t\n\t /**\n\t * `fail` will execute when the request fails\n\t */\n\t , fail: function (fn) {\n\t if (this._erred) {\n\t fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n\t } else {\n\t this._errorHandlers.push(fn)\n\t }\n\t return this\n\t }\n\t , 'catch': function (fn) {\n\t return this.fail(fn)\n\t }\n\t }\n\t\n\t function reqwest(o, fn) {\n\t return new Reqwest(o, fn)\n\t }\n\t\n\t // normalize newline variants according to spec -> CRLF\n\t function normalize(s) {\n\t return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n\t }\n\t\n\t function serial(el, cb) {\n\t var n = el.name\n\t , t = el.tagName.toLowerCase()\n\t , optCb = function (o) {\n\t // IE gives value=\"\" even where there is no value attribute\n\t // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273\n\t if (o && !o['disabled'])\n\t cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text']))\n\t }\n\t , ch, ra, val, i\n\t\n\t // don't serialize elements that are disabled or without a name\n\t if (el.disabled || !n) return\n\t\n\t switch (t) {\n\t case 'input':\n\t if (!/reset|button|image|file/i.test(el.type)) {\n\t ch = /checkbox/i.test(el.type)\n\t ra = /radio/i.test(el.type)\n\t val = el.value\n\t // WebKit gives us \"\" instead of \"on\" if a checkbox has no value, so correct it here\n\t ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val))\n\t }\n\t break\n\t case 'textarea':\n\t cb(n, normalize(el.value))\n\t break\n\t case 'select':\n\t if (el.type.toLowerCase() === 'select-one') {\n\t optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null)\n\t } else {\n\t for (i = 0; el.length && i < el.length; i++) {\n\t el.options[i].selected && optCb(el.options[i])\n\t }\n\t }\n\t break\n\t }\n\t }\n\t\n\t // collect up all form elements found from the passed argument elements all\n\t // the way down to child elements; pass a '
' or form fields.\n\t // called with 'this'=callback to use for serial() on each element\n\t function eachFormElement() {\n\t var cb = this\n\t , e, i\n\t , serializeSubtags = function (e, tags) {\n\t var i, j, fa\n\t for (i = 0; i < tags.length; i++) {\n\t fa = e[byTag](tags[i])\n\t for (j = 0; j < fa.length; j++) serial(fa[j], cb)\n\t }\n\t }\n\t\n\t for (i = 0; i < arguments.length; i++) {\n\t e = arguments[i]\n\t if (/input|select|textarea/i.test(e.tagName)) serial(e, cb)\n\t serializeSubtags(e, [ 'input', 'select', 'textarea' ])\n\t }\n\t }\n\t\n\t // standard query string style serialization\n\t function serializeQueryString() {\n\t return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments))\n\t }\n\t\n\t // { 'name': 'value', ... } style serialization\n\t function serializeHash() {\n\t var hash = {}\n\t eachFormElement.apply(function (name, value) {\n\t if (name in hash) {\n\t hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])\n\t hash[name].push(value)\n\t } else hash[name] = value\n\t }, arguments)\n\t return hash\n\t }\n\t\n\t // [ { name: 'name', value: 'value' }, ... ] style serialization\n\t reqwest.serializeArray = function () {\n\t var arr = []\n\t eachFormElement.apply(function (name, value) {\n\t arr.push({name: name, value: value})\n\t }, arguments)\n\t return arr\n\t }\n\t\n\t reqwest.serialize = function () {\n\t if (arguments.length === 0) return ''\n\t var opt, fn\n\t , args = Array.prototype.slice.call(arguments, 0)\n\t\n\t opt = args.pop()\n\t opt && opt.nodeType && args.push(opt) && (opt = null)\n\t opt && (opt = opt.type)\n\t\n\t if (opt == 'map') fn = serializeHash\n\t else if (opt == 'array') fn = reqwest.serializeArray\n\t else fn = serializeQueryString\n\t\n\t return fn.apply(null, args)\n\t }\n\t\n\t reqwest.toQueryString = function (o, trad) {\n\t var prefix, i\n\t , traditional = trad || false\n\t , s = []\n\t , enc = encodeURIComponent\n\t , add = function (key, value) {\n\t // If value is a function, invoke it and return its value\n\t value = ('function' === typeof value) ? value() : (value == null ? '' : value)\n\t s[s.length] = enc(key) + '=' + enc(value)\n\t }\n\t // If an array was passed in, assume that it is an array of form elements.\n\t if (isArray(o)) {\n\t for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value'])\n\t } else {\n\t // If traditional, encode the \"old\" way (the way 1.3.2 or older\n\t // did it), otherwise encode params recursively.\n\t for (prefix in o) {\n\t if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add)\n\t }\n\t }\n\t\n\t // spaces should be + according to spec\n\t return s.join('&').replace(/%20/g, '+')\n\t }\n\t\n\t function buildParams(prefix, obj, traditional, add) {\n\t var name, i, v\n\t , rbracket = /\\[\\]$/\n\t\n\t if (isArray(obj)) {\n\t // Serialize array item.\n\t for (i = 0; obj && i < obj.length; i++) {\n\t v = obj[i]\n\t if (traditional || rbracket.test(prefix)) {\n\t // Treat each array item as a scalar.\n\t add(prefix, v)\n\t } else {\n\t buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add)\n\t }\n\t }\n\t } else if (obj && obj.toString() === '[object Object]') {\n\t // Serialize object item.\n\t for (name in obj) {\n\t buildParams(prefix + '[' + name + ']', obj[name], traditional, add)\n\t }\n\t\n\t } else {\n\t // Serialize scalar item.\n\t add(prefix, obj)\n\t }\n\t }\n\t\n\t reqwest.getcallbackPrefix = function () {\n\t return callbackPrefix\n\t }\n\t\n\t // jQuery and Zepto compatibility, differences can be remapped here so you can call\n\t // .ajax.compat(options, callback)\n\t reqwest.compat = function (o, fn) {\n\t if (o) {\n\t o['type'] && (o['method'] = o['type']) && delete o['type']\n\t o['dataType'] && (o['type'] = o['dataType'])\n\t o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback']\n\t o['jsonp'] && (o['jsonpCallback'] = o['jsonp'])\n\t }\n\t return new Reqwest(o, fn)\n\t }\n\t\n\t reqwest.ajaxSetup = function (options) {\n\t options = options || {}\n\t for (var k in options) {\n\t globalSetupOptions[k] = options[k]\n\t }\n\t }\n\t\n\t return reqwest\n\t});\n\n\n/***/ },\n/* 75 */\n/***/ function(module, exports) {\n\n\t/* (ignored) */\n\n/***/ },\n/* 76 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * GeoJSON helpers for handling data and generating objects\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _topojson2 = __webpack_require__(77);\n\t\n\tvar _topojson3 = _interopRequireDefault(_topojson2);\n\t\n\tvar _geojsonMerge = __webpack_require__(78);\n\t\n\tvar _geojsonMerge2 = _interopRequireDefault(_geojsonMerge);\n\t\n\tvar _earcut = __webpack_require__(80);\n\t\n\tvar _earcut2 = _interopRequireDefault(_earcut);\n\t\n\tvar _extrudePolygon = __webpack_require__(81);\n\t\n\tvar _extrudePolygon2 = _interopRequireDefault(_extrudePolygon);\n\t\n\t// TODO: Make it so height can be per-coordinate / point but connected together\n\t// as a linestring (eg. GPS points with an elevation at each point)\n\t//\n\t// This isn't really valid GeoJSON so perhaps something best left to an external\n\t// component for now, until a better approach can be considered\n\t//\n\t// See: http://lists.geojson.org/pipermail/geojson-geojson.org/2009-June/000489.html\n\t\n\t// Light and dark colours used for poor-mans AO gradient on object sides\n\tvar light = new _three2['default'].Color(0xffffff);\n\tvar shadow = new _three2['default'].Color(0x666666);\n\t\n\tvar GeoJSON = (function () {\n\t var defaultStyle = {\n\t color: '#ffffff',\n\t transparent: false,\n\t opacity: 1,\n\t blending: _three2['default'].NormalBlending,\n\t height: 0,\n\t lineOpacity: 1,\n\t lineTransparent: false,\n\t lineColor: '#ffffff',\n\t lineWidth: 1,\n\t lineBlending: _three2['default'].NormalBlending\n\t };\n\t\n\t // Attempts to merge together multiple GeoJSON Features or FeatureCollections\n\t // into a single FeatureCollection\n\t var collectFeatures = function collectFeatures(data, _topojson) {\n\t var collections = [];\n\t\n\t if (_topojson) {\n\t // TODO: Allow TopoJSON objects to be overridden as an option\n\t\n\t // If not overridden, merge all features from all objects\n\t for (var tk in data.objects) {\n\t collections.push(_topojson3['default'].feature(data, data.objects[tk]));\n\t }\n\t\n\t return (0, _geojsonMerge2['default'])(collections);\n\t } else {\n\t // If root doesn't have a type then let's see if there are features in the\n\t // next step down\n\t if (!data.type) {\n\t // TODO: Allow GeoJSON objects to be overridden as an option\n\t\n\t // If not overridden, merge all features from all objects\n\t for (var gk in data) {\n\t if (!data[gk].type) {\n\t continue;\n\t }\n\t\n\t collections.push(data[gk]);\n\t }\n\t\n\t return (0, _geojsonMerge2['default'])(collections);\n\t } else if (Array.isArray(data)) {\n\t return (0, _geojsonMerge2['default'])(data);\n\t } else {\n\t return data;\n\t }\n\t }\n\t };\n\t\n\t // TODO: This is only used by GeoJSONTile so either roll it into that or\n\t // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n\t var lineStringAttributes = function lineStringAttributes(coordinates, colour, height) {\n\t var _coords = [];\n\t var _colours = [];\n\t\n\t var nextCoord;\n\t\n\t // Connect coordinate with the next to make a pair\n\t //\n\t // LineSegments requires pairs of vertices so repeat the last point if\n\t // there's an odd number of vertices\n\t coordinates.forEach(function (coordinate, index) {\n\t _colours.push([colour.r, colour.g, colour.b]);\n\t _coords.push([coordinate[0], height, coordinate[1]]);\n\t\n\t nextCoord = coordinates[index + 1] ? coordinates[index + 1] : coordinate;\n\t\n\t _colours.push([colour.r, colour.g, colour.b]);\n\t _coords.push([nextCoord[0], height, nextCoord[1]]);\n\t });\n\t\n\t return {\n\t vertices: _coords,\n\t colours: _colours\n\t };\n\t };\n\t\n\t // TODO: This is only used by GeoJSONTile so either roll it into that or\n\t // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n\t var multiLineStringAttributes = function multiLineStringAttributes(coordinates, colour, height) {\n\t var _coords = [];\n\t var _colours = [];\n\t\n\t var result;\n\t coordinates.forEach(function (coordinate) {\n\t result = lineStringAttributes(coordinate, colour, height);\n\t\n\t result.vertices.forEach(function (coord) {\n\t _coords.push(coord);\n\t });\n\t\n\t result.colours.forEach(function (colour) {\n\t _colours.push(colour);\n\t });\n\t });\n\t\n\t return {\n\t vertices: _coords,\n\t colours: _colours\n\t };\n\t };\n\t\n\t // TODO: This is only used by GeoJSONTile so either roll it into that or\n\t // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n\t var polygonAttributes = function polygonAttributes(coordinates, colour, height) {\n\t var earcutData = _toEarcut(coordinates);\n\t\n\t var faces = _triangulate(earcutData.vertices, earcutData.holes, earcutData.dimensions);\n\t\n\t var groupedVertices = [];\n\t for (i = 0, il = earcutData.vertices.length; i < il; i += earcutData.dimensions) {\n\t groupedVertices.push(earcutData.vertices.slice(i, i + earcutData.dimensions));\n\t }\n\t\n\t var extruded = (0, _extrudePolygon2['default'])(groupedVertices, faces, {\n\t bottom: 0,\n\t top: height\n\t });\n\t\n\t var topColor = colour.clone().multiply(light);\n\t var bottomColor = colour.clone().multiply(shadow);\n\t\n\t var _vertices = extruded.positions;\n\t var _faces = [];\n\t var _colours = [];\n\t\n\t var _colour;\n\t extruded.top.forEach(function (face, fi) {\n\t _colour = [];\n\t\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t\n\t _faces.push(face);\n\t _colours.push(_colour);\n\t });\n\t\n\t var allFlat = true;\n\t\n\t if (extruded.sides) {\n\t if (allFlat) {\n\t allFlat = false;\n\t }\n\t\n\t // Set up colours for every vertex with poor-mans AO on the sides\n\t extruded.sides.forEach(function (face, fi) {\n\t _colour = [];\n\t\n\t // First face is always bottom-bottom-top\n\t if (fi % 2 === 0) {\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t // Reverse winding for the second face\n\t // top-top-bottom\n\t } else {\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t }\n\t\n\t _faces.push(face);\n\t _colours.push(_colour);\n\t });\n\t }\n\t\n\t // Skip bottom as there's no point rendering it\n\t // allFaces.push(extruded.faces);\n\t\n\t return {\n\t vertices: _vertices,\n\t faces: _faces,\n\t colours: _colours,\n\t flat: allFlat\n\t };\n\t };\n\t\n\t // TODO: This is only used by GeoJSONTile so either roll it into that or\n\t // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n\t var _toEarcut = function _toEarcut(data) {\n\t var dim = data[0][0].length;\n\t var result = { vertices: [], holes: [], dimensions: dim };\n\t var holeIndex = 0;\n\t\n\t for (var i = 0; i < data.length; i++) {\n\t for (var j = 0; j < data[i].length; j++) {\n\t for (var d = 0; d < dim; d++) {\n\t result.vertices.push(data[i][j][d]);\n\t }\n\t }\n\t if (i > 0) {\n\t holeIndex += data[i - 1].length;\n\t result.holes.push(holeIndex);\n\t }\n\t }\n\t\n\t return result;\n\t };\n\t\n\t // TODO: This is only used by GeoJSONTile so either roll it into that or\n\t // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n\t var _triangulate = function _triangulate(contour, holes, dim) {\n\t // console.time('earcut');\n\t\n\t var faces = (0, _earcut2['default'])(contour, holes, dim);\n\t var result = [];\n\t\n\t for (i = 0, il = faces.length; i < il; i += 3) {\n\t result.push(faces.slice(i, i + 3));\n\t }\n\t\n\t // console.timeEnd('earcut');\n\t\n\t return result;\n\t };\n\t\n\t return {\n\t defaultStyle: defaultStyle,\n\t collectFeatures: collectFeatures,\n\t lineStringAttributes: lineStringAttributes,\n\t multiLineStringAttributes: multiLineStringAttributes,\n\t polygonAttributes: polygonAttributes\n\t };\n\t})();\n\t\n\texports['default'] = GeoJSON;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 77 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t(function (global, factory) {\n\t true ? factory(exports) :\n\t typeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t (factory((global.topojson = {})));\n\t}(this, function (exports) { 'use strict';\n\t\n\t function noop() {}\n\t\n\t function absolute(transform) {\n\t if (!transform) return noop;\n\t var x0,\n\t y0,\n\t kx = transform.scale[0],\n\t ky = transform.scale[1],\n\t dx = transform.translate[0],\n\t dy = transform.translate[1];\n\t return function(point, i) {\n\t if (!i) x0 = y0 = 0;\n\t point[0] = (x0 += point[0]) * kx + dx;\n\t point[1] = (y0 += point[1]) * ky + dy;\n\t };\n\t }\n\t\n\t function relative(transform) {\n\t if (!transform) return noop;\n\t var x0,\n\t y0,\n\t kx = transform.scale[0],\n\t ky = transform.scale[1],\n\t dx = transform.translate[0],\n\t dy = transform.translate[1];\n\t return function(point, i) {\n\t if (!i) x0 = y0 = 0;\n\t var x1 = (point[0] - dx) / kx | 0,\n\t y1 = (point[1] - dy) / ky | 0;\n\t point[0] = x1 - x0;\n\t point[1] = y1 - y0;\n\t x0 = x1;\n\t y0 = y1;\n\t };\n\t }\n\t\n\t function reverse(array, n) {\n\t var t, j = array.length, i = j - n;\n\t while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;\n\t }\n\t\n\t function bisect(a, x) {\n\t var lo = 0, hi = a.length;\n\t while (lo < hi) {\n\t var mid = lo + hi >>> 1;\n\t if (a[mid] < x) lo = mid + 1;\n\t else hi = mid;\n\t }\n\t return lo;\n\t }\n\t\n\t function feature(topology, o) {\n\t return o.type === \"GeometryCollection\" ? {\n\t type: \"FeatureCollection\",\n\t features: o.geometries.map(function(o) { return feature$1(topology, o); })\n\t } : feature$1(topology, o);\n\t }\n\t\n\t function feature$1(topology, o) {\n\t var f = {\n\t type: \"Feature\",\n\t id: o.id,\n\t properties: o.properties || {},\n\t geometry: object(topology, o)\n\t };\n\t if (o.id == null) delete f.id;\n\t return f;\n\t }\n\t\n\t function object(topology, o) {\n\t var absolute$$ = absolute(topology.transform),\n\t arcs = topology.arcs;\n\t\n\t function arc(i, points) {\n\t if (points.length) points.pop();\n\t for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) {\n\t points.push(p = a[k].slice());\n\t absolute$$(p, k);\n\t }\n\t if (i < 0) reverse(points, n);\n\t }\n\t\n\t function point(p) {\n\t p = p.slice();\n\t absolute$$(p, 0);\n\t return p;\n\t }\n\t\n\t function line(arcs) {\n\t var points = [];\n\t for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);\n\t if (points.length < 2) points.push(points[0].slice());\n\t return points;\n\t }\n\t\n\t function ring(arcs) {\n\t var points = line(arcs);\n\t while (points.length < 4) points.push(points[0].slice());\n\t return points;\n\t }\n\t\n\t function polygon(arcs) {\n\t return arcs.map(ring);\n\t }\n\t\n\t function geometry(o) {\n\t var t = o.type;\n\t return t === \"GeometryCollection\" ? {type: t, geometries: o.geometries.map(geometry)}\n\t : t in geometryType ? {type: t, coordinates: geometryType[t](o)}\n\t : null;\n\t }\n\t\n\t var geometryType = {\n\t Point: function(o) { return point(o.coordinates); },\n\t MultiPoint: function(o) { return o.coordinates.map(point); },\n\t LineString: function(o) { return line(o.arcs); },\n\t MultiLineString: function(o) { return o.arcs.map(line); },\n\t Polygon: function(o) { return polygon(o.arcs); },\n\t MultiPolygon: function(o) { return o.arcs.map(polygon); }\n\t };\n\t\n\t return geometry(o);\n\t }\n\t\n\t function stitchArcs(topology, arcs) {\n\t var stitchedArcs = {},\n\t fragmentByStart = {},\n\t fragmentByEnd = {},\n\t fragments = [],\n\t emptyIndex = -1;\n\t\n\t // Stitch empty arcs first, since they may be subsumed by other arcs.\n\t arcs.forEach(function(i, j) {\n\t var arc = topology.arcs[i < 0 ? ~i : i], t;\n\t if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {\n\t t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;\n\t }\n\t });\n\t\n\t arcs.forEach(function(i) {\n\t var e = ends(i),\n\t start = e[0],\n\t end = e[1],\n\t f, g;\n\t\n\t if (f = fragmentByEnd[start]) {\n\t delete fragmentByEnd[f.end];\n\t f.push(i);\n\t f.end = end;\n\t if (g = fragmentByStart[end]) {\n\t delete fragmentByStart[g.start];\n\t var fg = g === f ? f : f.concat(g);\n\t fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;\n\t } else {\n\t fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n\t }\n\t } else if (f = fragmentByStart[end]) {\n\t delete fragmentByStart[f.start];\n\t f.unshift(i);\n\t f.start = start;\n\t if (g = fragmentByEnd[start]) {\n\t delete fragmentByEnd[g.end];\n\t var gf = g === f ? f : g.concat(f);\n\t fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;\n\t } else {\n\t fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n\t }\n\t } else {\n\t f = [i];\n\t fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;\n\t }\n\t });\n\t\n\t function ends(i) {\n\t var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;\n\t if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; });\n\t else p1 = arc[arc.length - 1];\n\t return i < 0 ? [p1, p0] : [p0, p1];\n\t }\n\t\n\t function flush(fragmentByEnd, fragmentByStart) {\n\t for (var k in fragmentByEnd) {\n\t var f = fragmentByEnd[k];\n\t delete fragmentByStart[f.start];\n\t delete f.start;\n\t delete f.end;\n\t f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });\n\t fragments.push(f);\n\t }\n\t }\n\t\n\t flush(fragmentByEnd, fragmentByStart);\n\t flush(fragmentByStart, fragmentByEnd);\n\t arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });\n\t\n\t return fragments;\n\t }\n\t\n\t function mesh(topology) {\n\t return object(topology, meshArcs.apply(this, arguments));\n\t }\n\t\n\t function meshArcs(topology, o, filter) {\n\t var arcs = [];\n\t\n\t function arc(i) {\n\t var j = i < 0 ? ~i : i;\n\t (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom});\n\t }\n\t\n\t function line(arcs) {\n\t arcs.forEach(arc);\n\t }\n\t\n\t function polygon(arcs) {\n\t arcs.forEach(line);\n\t }\n\t\n\t function geometry(o) {\n\t if (o.type === \"GeometryCollection\") o.geometries.forEach(geometry);\n\t else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs);\n\t }\n\t\n\t if (arguments.length > 1) {\n\t var geomsByArc = [],\n\t geom;\n\t\n\t var geometryType = {\n\t LineString: line,\n\t MultiLineString: polygon,\n\t Polygon: polygon,\n\t MultiPolygon: function(arcs) { arcs.forEach(polygon); }\n\t };\n\t\n\t geometry(o);\n\t\n\t geomsByArc.forEach(arguments.length < 3\n\t ? function(geoms) { arcs.push(geoms[0].i); }\n\t : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });\n\t } else {\n\t for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i);\n\t }\n\t\n\t return {type: \"MultiLineString\", arcs: stitchArcs(topology, arcs)};\n\t }\n\t\n\t function triangle(triangle) {\n\t var a = triangle[0], b = triangle[1], c = triangle[2];\n\t return Math.abs((a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]));\n\t }\n\t\n\t function ring(ring) {\n\t var i = -1,\n\t n = ring.length,\n\t a,\n\t b = ring[n - 1],\n\t area = 0;\n\t\n\t while (++i < n) {\n\t a = b;\n\t b = ring[i];\n\t area += a[0] * b[1] - a[1] * b[0];\n\t }\n\t\n\t return area / 2;\n\t }\n\t\n\t function merge(topology) {\n\t return object(topology, mergeArcs.apply(this, arguments));\n\t }\n\t\n\t function mergeArcs(topology, objects) {\n\t var polygonsByArc = {},\n\t polygons = [],\n\t components = [];\n\t\n\t objects.forEach(function(o) {\n\t if (o.type === \"Polygon\") register(o.arcs);\n\t else if (o.type === \"MultiPolygon\") o.arcs.forEach(register);\n\t });\n\t\n\t function register(polygon) {\n\t polygon.forEach(function(ring$$) {\n\t ring$$.forEach(function(arc) {\n\t (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);\n\t });\n\t });\n\t polygons.push(polygon);\n\t }\n\t\n\t function exterior(ring$$) {\n\t return ring(object(topology, {type: \"Polygon\", arcs: [ring$$]}).coordinates[0]) > 0; // TODO allow spherical?\n\t }\n\t\n\t polygons.forEach(function(polygon) {\n\t if (!polygon._) {\n\t var component = [],\n\t neighbors = [polygon];\n\t polygon._ = 1;\n\t components.push(component);\n\t while (polygon = neighbors.pop()) {\n\t component.push(polygon);\n\t polygon.forEach(function(ring$$) {\n\t ring$$.forEach(function(arc) {\n\t polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) {\n\t if (!polygon._) {\n\t polygon._ = 1;\n\t neighbors.push(polygon);\n\t }\n\t });\n\t });\n\t });\n\t }\n\t }\n\t });\n\t\n\t polygons.forEach(function(polygon) {\n\t delete polygon._;\n\t });\n\t\n\t return {\n\t type: \"MultiPolygon\",\n\t arcs: components.map(function(polygons) {\n\t var arcs = [], n;\n\t\n\t // Extract the exterior (unique) arcs.\n\t polygons.forEach(function(polygon) {\n\t polygon.forEach(function(ring$$) {\n\t ring$$.forEach(function(arc) {\n\t if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {\n\t arcs.push(arc);\n\t }\n\t });\n\t });\n\t });\n\t\n\t // Stitch the arcs into one or more rings.\n\t arcs = stitchArcs(topology, arcs);\n\t\n\t // If more than one ring is returned,\n\t // at most one of these rings can be the exterior;\n\t // this exterior ring has the same winding order\n\t // as any exterior ring in the original polygons.\n\t if ((n = arcs.length) > 1) {\n\t var sgn = exterior(polygons[0][0]);\n\t for (var i = 0, t; i < n; ++i) {\n\t if (sgn === exterior(arcs[i])) {\n\t t = arcs[0], arcs[0] = arcs[i], arcs[i] = t;\n\t break;\n\t }\n\t }\n\t }\n\t\n\t return arcs;\n\t })\n\t };\n\t }\n\t\n\t function neighbors(objects) {\n\t var indexesByArc = {}, // arc index -> array of object indexes\n\t neighbors = objects.map(function() { return []; });\n\t\n\t function line(arcs, i) {\n\t arcs.forEach(function(a) {\n\t if (a < 0) a = ~a;\n\t var o = indexesByArc[a];\n\t if (o) o.push(i);\n\t else indexesByArc[a] = [i];\n\t });\n\t }\n\t\n\t function polygon(arcs, i) {\n\t arcs.forEach(function(arc) { line(arc, i); });\n\t }\n\t\n\t function geometry(o, i) {\n\t if (o.type === \"GeometryCollection\") o.geometries.forEach(function(o) { geometry(o, i); });\n\t else if (o.type in geometryType) geometryType[o.type](o.arcs, i);\n\t }\n\t\n\t var geometryType = {\n\t LineString: line,\n\t MultiLineString: polygon,\n\t Polygon: polygon,\n\t MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); }\n\t };\n\t\n\t objects.forEach(geometry);\n\t\n\t for (var i in indexesByArc) {\n\t for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) {\n\t for (var k = j + 1; k < m; ++k) {\n\t var ij = indexes[j], ik = indexes[k], n;\n\t if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik);\n\t if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij);\n\t }\n\t }\n\t }\n\t\n\t return neighbors;\n\t }\n\t\n\t function compareArea(a, b) {\n\t return a[1][2] - b[1][2];\n\t }\n\t\n\t function minAreaHeap() {\n\t var heap = {},\n\t array = [],\n\t size = 0;\n\t\n\t heap.push = function(object) {\n\t up(array[object._ = size] = object, size++);\n\t return size;\n\t };\n\t\n\t heap.pop = function() {\n\t if (size <= 0) return;\n\t var removed = array[0], object;\n\t if (--size > 0) object = array[size], down(array[object._ = 0] = object, 0);\n\t return removed;\n\t };\n\t\n\t heap.remove = function(removed) {\n\t var i = removed._, object;\n\t if (array[i] !== removed) return; // invalid request\n\t if (i !== --size) object = array[size], (compareArea(object, removed) < 0 ? up : down)(array[object._ = i] = object, i);\n\t return i;\n\t };\n\t\n\t function up(object, i) {\n\t while (i > 0) {\n\t var j = ((i + 1) >> 1) - 1,\n\t parent = array[j];\n\t if (compareArea(object, parent) >= 0) break;\n\t array[parent._ = i] = parent;\n\t array[object._ = i = j] = object;\n\t }\n\t }\n\t\n\t function down(object, i) {\n\t while (true) {\n\t var r = (i + 1) << 1,\n\t l = r - 1,\n\t j = i,\n\t child = array[j];\n\t if (l < size && compareArea(array[l], child) < 0) child = array[j = l];\n\t if (r < size && compareArea(array[r], child) < 0) child = array[j = r];\n\t if (j === i) break;\n\t array[child._ = i] = child;\n\t array[object._ = i = j] = object;\n\t }\n\t }\n\t\n\t return heap;\n\t }\n\t\n\t function presimplify(topology, triangleArea) {\n\t var absolute$$ = absolute(topology.transform),\n\t relative$$ = relative(topology.transform),\n\t heap = minAreaHeap();\n\t\n\t if (!triangleArea) triangleArea = triangle;\n\t\n\t topology.arcs.forEach(function(arc) {\n\t var triangles = [],\n\t maxArea = 0,\n\t triangle,\n\t i,\n\t n,\n\t p;\n\t\n\t // To store each point’s effective area, we create a new array rather than\n\t // extending the passed-in point to workaround a Chrome/V8 bug (getting\n\t // stuck in smi mode). For midpoints, the initial effective area of\n\t // Infinity will be computed in the next step.\n\t for (i = 0, n = arc.length; i < n; ++i) {\n\t p = arc[i];\n\t absolute$$(arc[i] = [p[0], p[1], Infinity], i);\n\t }\n\t\n\t for (i = 1, n = arc.length - 1; i < n; ++i) {\n\t triangle = arc.slice(i - 1, i + 2);\n\t triangle[1][2] = triangleArea(triangle);\n\t triangles.push(triangle);\n\t heap.push(triangle);\n\t }\n\t\n\t for (i = 0, n = triangles.length; i < n; ++i) {\n\t triangle = triangles[i];\n\t triangle.previous = triangles[i - 1];\n\t triangle.next = triangles[i + 1];\n\t }\n\t\n\t while (triangle = heap.pop()) {\n\t var previous = triangle.previous,\n\t next = triangle.next;\n\t\n\t // If the area of the current point is less than that of the previous point\n\t // to be eliminated, use the latter's area instead. This ensures that the\n\t // current point cannot be eliminated without eliminating previously-\n\t // eliminated points.\n\t if (triangle[1][2] < maxArea) triangle[1][2] = maxArea;\n\t else maxArea = triangle[1][2];\n\t\n\t if (previous) {\n\t previous.next = next;\n\t previous[2] = triangle[2];\n\t update(previous);\n\t }\n\t\n\t if (next) {\n\t next.previous = previous;\n\t next[0] = triangle[0];\n\t update(next);\n\t }\n\t }\n\t\n\t arc.forEach(relative$$);\n\t });\n\t\n\t function update(triangle) {\n\t heap.remove(triangle);\n\t triangle[1][2] = triangleArea(triangle);\n\t heap.push(triangle);\n\t }\n\t\n\t return topology;\n\t }\n\t\n\t var version = \"1.6.24\";\n\t\n\t exports.version = version;\n\t exports.mesh = mesh;\n\t exports.meshArcs = meshArcs;\n\t exports.merge = merge;\n\t exports.mergeArcs = mergeArcs;\n\t exports.feature = feature;\n\t exports.neighbors = neighbors;\n\t exports.presimplify = presimplify;\n\t\n\t}));\n\n/***/ },\n/* 78 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar normalize = __webpack_require__(79);\n\t\n\tmodule.exports = function(inputs) {\n\t return {\n\t type: 'FeatureCollection',\n\t features: inputs.reduce(function(memo, input) {\n\t return memo.concat(normalize(input).features);\n\t }, [])\n\t };\n\t};\n\n\n/***/ },\n/* 79 */\n/***/ function(module, exports) {\n\n\tmodule.exports = normalize;\n\t\n\tvar types = {\n\t Point: 'geometry',\n\t MultiPoint: 'geometry',\n\t LineString: 'geometry',\n\t MultiLineString: 'geometry',\n\t Polygon: 'geometry',\n\t MultiPolygon: 'geometry',\n\t GeometryCollection: 'geometry',\n\t Feature: 'feature',\n\t FeatureCollection: 'featurecollection'\n\t};\n\t\n\t/**\n\t * Normalize a GeoJSON feature into a FeatureCollection.\n\t *\n\t * @param {object} gj geojson data\n\t * @returns {object} normalized geojson data\n\t */\n\tfunction normalize(gj) {\n\t if (!gj || !gj.type) return null;\n\t var type = types[gj.type];\n\t if (!type) return null;\n\t\n\t if (type === 'geometry') {\n\t return {\n\t type: 'FeatureCollection',\n\t features: [{\n\t type: 'Feature',\n\t properties: {},\n\t geometry: gj\n\t }]\n\t };\n\t } else if (type === 'feature') {\n\t return {\n\t type: 'FeatureCollection',\n\t features: [gj]\n\t };\n\t } else if (type === 'featurecollection') {\n\t return gj;\n\t }\n\t}\n\n\n/***/ },\n/* 80 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tmodule.exports = earcut;\n\t\n\tfunction earcut(data, holeIndices, dim) {\n\t\n\t dim = dim || 2;\n\t\n\t var hasHoles = holeIndices && holeIndices.length,\n\t outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n\t outerNode = linkedList(data, 0, outerLen, dim, true),\n\t triangles = [];\n\t\n\t if (!outerNode) return triangles;\n\t\n\t var minX, minY, maxX, maxY, x, y, size;\n\t\n\t if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\t\n\t // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t if (data.length > 80 * dim) {\n\t minX = maxX = data[0];\n\t minY = maxY = data[1];\n\t\n\t for (var i = dim; i < outerLen; i += dim) {\n\t x = data[i];\n\t y = data[i + 1];\n\t if (x < minX) minX = x;\n\t if (y < minY) minY = y;\n\t if (x > maxX) maxX = x;\n\t if (y > maxY) maxY = y;\n\t }\n\t\n\t // minX, minY and size are later used to transform coords into integers for z-order calculation\n\t size = Math.max(maxX - minX, maxY - minY);\n\t }\n\t\n\t earcutLinked(outerNode, triangles, dim, minX, minY, size);\n\t\n\t return triangles;\n\t}\n\t\n\t// create a circular doubly linked list from polygon points in the specified winding order\n\tfunction linkedList(data, start, end, dim, clockwise) {\n\t var sum = 0,\n\t i, j, last;\n\t\n\t // calculate original winding order of a polygon ring\n\t for (i = start, j = end - dim; i < end; i += dim) {\n\t sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n\t j = i;\n\t }\n\t\n\t // link points into circular doubly-linked list in the specified winding order\n\t if (clockwise === (sum > 0)) {\n\t for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n\t } else {\n\t for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n\t }\n\t\n\t return last;\n\t}\n\t\n\t// eliminate colinear or duplicate points\n\tfunction filterPoints(start, end) {\n\t if (!start) return start;\n\t if (!end) end = start;\n\t\n\t var p = start,\n\t again;\n\t do {\n\t again = false;\n\t\n\t if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n\t removeNode(p);\n\t p = end = p.prev;\n\t if (p === p.next) return null;\n\t again = true;\n\t\n\t } else {\n\t p = p.next;\n\t }\n\t } while (again || p !== end);\n\t\n\t return end;\n\t}\n\t\n\t// main ear slicing loop which triangulates a polygon (given as a linked list)\n\tfunction earcutLinked(ear, triangles, dim, minX, minY, size, pass) {\n\t if (!ear) return;\n\t\n\t // interlink polygon nodes in z-order\n\t if (!pass && size) indexCurve(ear, minX, minY, size);\n\t\n\t var stop = ear,\n\t prev, next;\n\t\n\t // iterate through ears, slicing them one by one\n\t while (ear.prev !== ear.next) {\n\t prev = ear.prev;\n\t next = ear.next;\n\t\n\t if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {\n\t // cut off the triangle\n\t triangles.push(prev.i / dim);\n\t triangles.push(ear.i / dim);\n\t triangles.push(next.i / dim);\n\t\n\t removeNode(ear);\n\t\n\t // skipping the next vertice leads to less sliver triangles\n\t ear = next.next;\n\t stop = next.next;\n\t\n\t continue;\n\t }\n\t\n\t ear = next;\n\t\n\t // if we looped through the whole remaining polygon and can't find any more ears\n\t if (ear === stop) {\n\t // try filtering points and slicing again\n\t if (!pass) {\n\t earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1);\n\t\n\t // if this didn't work, try curing all small self-intersections locally\n\t } else if (pass === 1) {\n\t ear = cureLocalIntersections(ear, triangles, dim);\n\t earcutLinked(ear, triangles, dim, minX, minY, size, 2);\n\t\n\t // as a last resort, try splitting the remaining polygon into two\n\t } else if (pass === 2) {\n\t splitEarcut(ear, triangles, dim, minX, minY, size);\n\t }\n\t\n\t break;\n\t }\n\t }\n\t}\n\t\n\t// check whether a polygon node forms a valid ear with adjacent nodes\n\tfunction isEar(ear) {\n\t var a = ear.prev,\n\t b = ear,\n\t c = ear.next;\n\t\n\t if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\t\n\t // now make sure we don't have other points inside the potential ear\n\t var p = ear.next.next;\n\t\n\t while (p !== ear.prev) {\n\t if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n\t area(p.prev, p, p.next) >= 0) return false;\n\t p = p.next;\n\t }\n\t\n\t return true;\n\t}\n\t\n\tfunction isEarHashed(ear, minX, minY, size) {\n\t var a = ear.prev,\n\t b = ear,\n\t c = ear.next;\n\t\n\t if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\t\n\t // triangle bbox; min & max are calculated like this for speed\n\t var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n\t minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n\t maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n\t maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\t\n\t // z-order range for the current triangle bbox;\n\t var minZ = zOrder(minTX, minTY, minX, minY, size),\n\t maxZ = zOrder(maxTX, maxTY, minX, minY, size);\n\t\n\t // first look for points inside the triangle in increasing z-order\n\t var p = ear.nextZ;\n\t\n\t while (p && p.z <= maxZ) {\n\t if (p !== ear.prev && p !== ear.next &&\n\t pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n\t area(p.prev, p, p.next) >= 0) return false;\n\t p = p.nextZ;\n\t }\n\t\n\t // then look for points in decreasing z-order\n\t p = ear.prevZ;\n\t\n\t while (p && p.z >= minZ) {\n\t if (p !== ear.prev && p !== ear.next &&\n\t pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n\t area(p.prev, p, p.next) >= 0) return false;\n\t p = p.prevZ;\n\t }\n\t\n\t return true;\n\t}\n\t\n\t// go through all polygon nodes and cure small local self-intersections\n\tfunction cureLocalIntersections(start, triangles, dim) {\n\t var p = start;\n\t do {\n\t var a = p.prev,\n\t b = p.next.next;\n\t\n\t // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])\n\t if (intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\t\n\t triangles.push(a.i / dim);\n\t triangles.push(p.i / dim);\n\t triangles.push(b.i / dim);\n\t\n\t // remove two nodes involved\n\t removeNode(p);\n\t removeNode(p.next);\n\t\n\t p = start = b;\n\t }\n\t p = p.next;\n\t } while (p !== start);\n\t\n\t return p;\n\t}\n\t\n\t// try splitting polygon into two and triangulate them independently\n\tfunction splitEarcut(start, triangles, dim, minX, minY, size) {\n\t // look for a valid diagonal that divides the polygon into two\n\t var a = start;\n\t do {\n\t var b = a.next.next;\n\t while (b !== a.prev) {\n\t if (a.i !== b.i && isValidDiagonal(a, b)) {\n\t // split the polygon in two by the diagonal\n\t var c = splitPolygon(a, b);\n\t\n\t // filter colinear points around the cuts\n\t a = filterPoints(a, a.next);\n\t c = filterPoints(c, c.next);\n\t\n\t // run earcut on each half\n\t earcutLinked(a, triangles, dim, minX, minY, size);\n\t earcutLinked(c, triangles, dim, minX, minY, size);\n\t return;\n\t }\n\t b = b.next;\n\t }\n\t a = a.next;\n\t } while (a !== start);\n\t}\n\t\n\t// link every hole into the outer loop, producing a single-ring polygon without holes\n\tfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n\t var queue = [],\n\t i, len, start, end, list;\n\t\n\t for (i = 0, len = holeIndices.length; i < len; i++) {\n\t start = holeIndices[i] * dim;\n\t end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n\t list = linkedList(data, start, end, dim, false);\n\t if (list === list.next) list.steiner = true;\n\t queue.push(getLeftmost(list));\n\t }\n\t\n\t queue.sort(compareX);\n\t\n\t // process holes from left to right\n\t for (i = 0; i < queue.length; i++) {\n\t eliminateHole(queue[i], outerNode);\n\t outerNode = filterPoints(outerNode, outerNode.next);\n\t }\n\t\n\t return outerNode;\n\t}\n\t\n\tfunction compareX(a, b) {\n\t return a.x - b.x;\n\t}\n\t\n\t// find a bridge between vertices that connects hole with an outer ring and and link it\n\tfunction eliminateHole(hole, outerNode) {\n\t outerNode = findHoleBridge(hole, outerNode);\n\t if (outerNode) {\n\t var b = splitPolygon(outerNode, hole);\n\t filterPoints(b, b.next);\n\t }\n\t}\n\t\n\t// David Eberly's algorithm for finding a bridge between hole and outer polygon\n\tfunction findHoleBridge(hole, outerNode) {\n\t var p = outerNode,\n\t hx = hole.x,\n\t hy = hole.y,\n\t qx = -Infinity,\n\t m;\n\t\n\t // find a segment intersected by a ray from the hole's leftmost point to the left;\n\t // segment's endpoint with lesser x will be potential connection point\n\t do {\n\t if (hy <= p.y && hy >= p.next.y) {\n\t var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n\t if (x <= hx && x > qx) {\n\t qx = x;\n\t m = p.x < p.next.x ? p : p.next;\n\t }\n\t }\n\t p = p.next;\n\t } while (p !== outerNode);\n\t\n\t if (!m) return null;\n\t\n\t if (hole.x === m.x) return m.prev; // hole touches outer segment; pick lower endpoint\n\t\n\t // look for points inside the triangle of hole point, segment intersection and endpoint;\n\t // if there are no points found, we have a valid connection;\n\t // otherwise choose the point of the minimum angle with the ray as connection point\n\t\n\t var stop = m,\n\t tanMin = Infinity,\n\t tan;\n\t\n\t p = m.next;\n\t\n\t while (p !== stop) {\n\t if (hx >= p.x && p.x >= m.x &&\n\t pointInTriangle(hy < m.y ? hx : qx, hy, m.x, m.y, hy < m.y ? qx : hx, hy, p.x, p.y)) {\n\t\n\t tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\t\n\t if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n\t m = p;\n\t tanMin = tan;\n\t }\n\t }\n\t\n\t p = p.next;\n\t }\n\t\n\t return m;\n\t}\n\t\n\t// interlink polygon nodes in z-order\n\tfunction indexCurve(start, minX, minY, size) {\n\t var p = start;\n\t do {\n\t if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);\n\t p.prevZ = p.prev;\n\t p.nextZ = p.next;\n\t p = p.next;\n\t } while (p !== start);\n\t\n\t p.prevZ.nextZ = null;\n\t p.prevZ = null;\n\t\n\t sortLinked(p);\n\t}\n\t\n\t// Simon Tatham's linked list merge sort algorithm\n\t// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\n\tfunction sortLinked(list) {\n\t var i, p, q, e, tail, numMerges, pSize, qSize,\n\t inSize = 1;\n\t\n\t do {\n\t p = list;\n\t list = null;\n\t tail = null;\n\t numMerges = 0;\n\t\n\t while (p) {\n\t numMerges++;\n\t q = p;\n\t pSize = 0;\n\t for (i = 0; i < inSize; i++) {\n\t pSize++;\n\t q = q.nextZ;\n\t if (!q) break;\n\t }\n\t\n\t qSize = inSize;\n\t\n\t while (pSize > 0 || (qSize > 0 && q)) {\n\t\n\t if (pSize === 0) {\n\t e = q;\n\t q = q.nextZ;\n\t qSize--;\n\t } else if (qSize === 0 || !q) {\n\t e = p;\n\t p = p.nextZ;\n\t pSize--;\n\t } else if (p.z <= q.z) {\n\t e = p;\n\t p = p.nextZ;\n\t pSize--;\n\t } else {\n\t e = q;\n\t q = q.nextZ;\n\t qSize--;\n\t }\n\t\n\t if (tail) tail.nextZ = e;\n\t else list = e;\n\t\n\t e.prevZ = tail;\n\t tail = e;\n\t }\n\t\n\t p = q;\n\t }\n\t\n\t tail.nextZ = null;\n\t inSize *= 2;\n\t\n\t } while (numMerges > 1);\n\t\n\t return list;\n\t}\n\t\n\t// z-order of a point given coords and size of the data bounding box\n\tfunction zOrder(x, y, minX, minY, size) {\n\t // coords are transformed into non-negative 15-bit integer range\n\t x = 32767 * (x - minX) / size;\n\t y = 32767 * (y - minY) / size;\n\t\n\t x = (x | (x << 8)) & 0x00FF00FF;\n\t x = (x | (x << 4)) & 0x0F0F0F0F;\n\t x = (x | (x << 2)) & 0x33333333;\n\t x = (x | (x << 1)) & 0x55555555;\n\t\n\t y = (y | (y << 8)) & 0x00FF00FF;\n\t y = (y | (y << 4)) & 0x0F0F0F0F;\n\t y = (y | (y << 2)) & 0x33333333;\n\t y = (y | (y << 1)) & 0x55555555;\n\t\n\t return x | (y << 1);\n\t}\n\t\n\t// find the leftmost node of a polygon ring\n\tfunction getLeftmost(start) {\n\t var p = start,\n\t leftmost = start;\n\t do {\n\t if (p.x < leftmost.x) leftmost = p;\n\t p = p.next;\n\t } while (p !== start);\n\t\n\t return leftmost;\n\t}\n\t\n\t// check if a point lies within a convex triangle\n\tfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n\t return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n\t (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n\t (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n\t}\n\t\n\t// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\n\tfunction isValidDiagonal(a, b) {\n\t return equals(a, b) || a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n\t locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n\t}\n\t\n\t// signed area of a triangle\n\tfunction area(p, q, r) {\n\t return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n\t}\n\t\n\t// check if two points are equal\n\tfunction equals(p1, p2) {\n\t return p1.x === p2.x && p1.y === p2.y;\n\t}\n\t\n\t// check if two segments intersect\n\tfunction intersects(p1, q1, p2, q2) {\n\t return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n\t area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n\t}\n\t\n\t// check if a polygon diagonal intersects any polygon segments\n\tfunction intersectsPolygon(a, b) {\n\t var p = a;\n\t do {\n\t if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t intersects(p, p.next, a, b)) return true;\n\t p = p.next;\n\t } while (p !== a);\n\t\n\t return false;\n\t}\n\t\n\t// check if a polygon diagonal is locally inside the polygon\n\tfunction locallyInside(a, b) {\n\t return area(a.prev, a, a.next) < 0 ?\n\t area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n\t area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n\t}\n\t\n\t// check if the middle point of a polygon diagonal is inside the polygon\n\tfunction middleInside(a, b) {\n\t var p = a,\n\t inside = false,\n\t px = (a.x + b.x) / 2,\n\t py = (a.y + b.y) / 2;\n\t do {\n\t if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n\t inside = !inside;\n\t p = p.next;\n\t } while (p !== a);\n\t\n\t return inside;\n\t}\n\t\n\t// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n\t// if one belongs to the outer ring and another to a hole, it merges it into a single ring\n\tfunction splitPolygon(a, b) {\n\t var a2 = new Node(a.i, a.x, a.y),\n\t b2 = new Node(b.i, b.x, b.y),\n\t an = a.next,\n\t bp = b.prev;\n\t\n\t a.next = b;\n\t b.prev = a;\n\t\n\t a2.next = an;\n\t an.prev = a2;\n\t\n\t b2.next = a2;\n\t a2.prev = b2;\n\t\n\t bp.next = b2;\n\t b2.prev = bp;\n\t\n\t return b2;\n\t}\n\t\n\t// create a node and optionally link it with previous one (in a circular doubly linked list)\n\tfunction insertNode(i, x, y, last) {\n\t var p = new Node(i, x, y);\n\t\n\t if (!last) {\n\t p.prev = p;\n\t p.next = p;\n\t\n\t } else {\n\t p.next = last.next;\n\t p.prev = last;\n\t last.next.prev = p;\n\t last.next = p;\n\t }\n\t return p;\n\t}\n\t\n\tfunction removeNode(p) {\n\t p.next.prev = p.prev;\n\t p.prev.next = p.next;\n\t\n\t if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n\t if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n\t}\n\t\n\tfunction Node(i, x, y) {\n\t // vertice index in coordinates array\n\t this.i = i;\n\t\n\t // vertex coordinates\n\t this.x = x;\n\t this.y = y;\n\t\n\t // previous and next vertice nodes in a polygon ring\n\t this.prev = null;\n\t this.next = null;\n\t\n\t // z-order curve value\n\t this.z = null;\n\t\n\t // previous and next nodes in z-order\n\t this.prevZ = null;\n\t this.nextZ = null;\n\t\n\t // indicates whether this is a steiner point\n\t this.steiner = false;\n\t}\n\n\n/***/ },\n/* 81 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * Extrude a polygon given its vertices and triangulated faces\n\t *\n\t * Based on:\n\t * https://github.com/freeman-lab/extrude\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar extrudePolygon = function extrudePolygon(points, faces, _options) {\n\t var defaults = {\n\t top: 1,\n\t bottom: 0,\n\t closed: true\n\t };\n\t\n\t var options = (0, _lodashAssign2['default'])({}, defaults, _options);\n\t\n\t var n = points.length;\n\t var positions;\n\t var cells;\n\t var topCells;\n\t var bottomCells;\n\t var sideCells;\n\t\n\t // If bottom and top values are identical then return the flat shape\n\t options.top === options.bottom ? flat() : full();\n\t\n\t function flat() {\n\t positions = points.map(function (p) {\n\t return [p[0], options.top, p[1]];\n\t });\n\t cells = faces;\n\t topCells = faces;\n\t }\n\t\n\t function full() {\n\t positions = [];\n\t points.forEach(function (p) {\n\t positions.push([p[0], options.top, p[1]]);\n\t });\n\t points.forEach(function (p) {\n\t positions.push([p[0], options.bottom, p[1]]);\n\t });\n\t\n\t cells = [];\n\t for (var i = 0; i < n; i++) {\n\t if (i === n - 1) {\n\t cells.push([i + n, n, i]);\n\t cells.push([0, i, n]);\n\t } else {\n\t cells.push([i + n, i + n + 1, i]);\n\t cells.push([i + 1, i, i + n + 1]);\n\t }\n\t }\n\t\n\t sideCells = [].concat(cells);\n\t\n\t if (options.closed) {\n\t var top = faces;\n\t var bottom = top.map(function (p) {\n\t return p.map(function (v) {\n\t return v + n;\n\t });\n\t });\n\t bottom = bottom.map(function (p) {\n\t return [p[0], p[2], p[1]];\n\t });\n\t cells = cells.concat(top).concat(bottom);\n\t\n\t topCells = top;\n\t bottomCells = bottom;\n\t }\n\t }\n\t\n\t return {\n\t positions: positions,\n\t faces: cells,\n\t top: topCells,\n\t bottom: bottomCells,\n\t sides: sideCells\n\t };\n\t};\n\t\n\texports['default'] = extrudePolygon;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 82 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * BufferGeometry helpers\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar Buffer = (function () {\n\t // Merge multiple attribute objects into a single attribute object\n\t //\n\t // Attribute objects must all use the same attribute keys\n\t var mergeAttributes = function mergeAttributes(attributes) {\n\t var lengths = {};\n\t\n\t // Find array lengths\n\t attributes.forEach(function (_attributes) {\n\t for (var k in _attributes) {\n\t if (!lengths[k]) {\n\t lengths[k] = 0;\n\t }\n\t\n\t lengths[k] += _attributes[k].length;\n\t }\n\t });\n\t\n\t var mergedAttributes = {};\n\t\n\t // Set up arrays to merge into\n\t for (var k in lengths) {\n\t mergedAttributes[k] = new Float32Array(lengths[k]);\n\t }\n\t\n\t var lastLengths = {};\n\t\n\t attributes.forEach(function (_attributes) {\n\t for (var k in _attributes) {\n\t if (!lastLengths[k]) {\n\t lastLengths[k] = 0;\n\t }\n\t\n\t mergedAttributes[k].set(_attributes[k], lastLengths[k]);\n\t\n\t lastLengths[k] += _attributes[k].length;\n\t }\n\t });\n\t\n\t return mergedAttributes;\n\t };\n\t\n\t var createLineGeometry = function createLineGeometry(lines, offset) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t var vertices = new Float32Array(lines.verticesCount * 3);\n\t var colours = new Float32Array(lines.verticesCount * 3);\n\t\n\t var pickingIds;\n\t if (lines.pickingIds) {\n\t // One component per vertex (1)\n\t pickingIds = new Float32Array(lines.verticesCount);\n\t }\n\t\n\t var _vertices;\n\t var _colour;\n\t var _pickingId;\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < lines.vertices.length; i++) {\n\t _vertices = lines.vertices[i];\n\t _colour = lines.colours[i];\n\t\n\t if (pickingIds) {\n\t _pickingId = lines.pickingIds[i];\n\t }\n\t\n\t for (var j = 0; j < _vertices.length; j++) {\n\t var ax = _vertices[j][0] + offset.x;\n\t var ay = _vertices[j][1];\n\t var az = _vertices[j][2] + offset.y;\n\t\n\t var c1 = _colour[j];\n\t\n\t vertices[lastIndex * 3 + 0] = ax;\n\t vertices[lastIndex * 3 + 1] = ay;\n\t vertices[lastIndex * 3 + 2] = az;\n\t\n\t colours[lastIndex * 3 + 0] = c1[0];\n\t colours[lastIndex * 3 + 1] = c1[1];\n\t colours[lastIndex * 3 + 2] = c1[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t }\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(vertices, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(colours, 3));\n\t\n\t if (pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t return geometry;\n\t };\n\t\n\t // TODO: Make picking IDs optional\n\t var createGeometry = function createGeometry(attributes, offset) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // Three components per vertex per face (3 x 3 = 9)\n\t var vertices = new Float32Array(attributes.facesCount * 9);\n\t var normals = new Float32Array(attributes.facesCount * 9);\n\t var colours = new Float32Array(attributes.facesCount * 9);\n\t\n\t var pickingIds;\n\t if (attributes.pickingIds) {\n\t // One component per vertex per face (1 x 3 = 3)\n\t pickingIds = new Float32Array(attributes.facesCount * 3);\n\t }\n\t\n\t var pA = new _three2['default'].Vector3();\n\t var pB = new _three2['default'].Vector3();\n\t var pC = new _three2['default'].Vector3();\n\t\n\t var cb = new _three2['default'].Vector3();\n\t var ab = new _three2['default'].Vector3();\n\t\n\t var index;\n\t var _faces;\n\t var _vertices;\n\t var _colour;\n\t var _pickingId;\n\t var lastIndex = 0;\n\t for (var i = 0; i < attributes.faces.length; i++) {\n\t _faces = attributes.faces[i];\n\t _vertices = attributes.vertices[i];\n\t _colour = attributes.colours[i];\n\t\n\t if (pickingIds) {\n\t _pickingId = attributes.pickingIds[i];\n\t }\n\t\n\t for (var j = 0; j < _faces.length; j++) {\n\t // Array of vertex indexes for the face\n\t index = _faces[j][0];\n\t\n\t var ax = _vertices[index][0] + offset.x;\n\t var ay = _vertices[index][1];\n\t var az = _vertices[index][2] + offset.y;\n\t\n\t var c1 = _colour[j][0];\n\t\n\t index = _faces[j][1];\n\t\n\t var bx = _vertices[index][0] + offset.x;\n\t var by = _vertices[index][1];\n\t var bz = _vertices[index][2] + offset.y;\n\t\n\t var c2 = _colour[j][1];\n\t\n\t index = _faces[j][2];\n\t\n\t var cx = _vertices[index][0] + offset.x;\n\t var cy = _vertices[index][1];\n\t var cz = _vertices[index][2] + offset.y;\n\t\n\t var c3 = _colour[j][2];\n\t\n\t // Flat face normals\n\t // From: http://threejs.org/examples/webgl_buffergeometry.html\n\t pA.set(ax, ay, az);\n\t pB.set(bx, by, bz);\n\t pC.set(cx, cy, cz);\n\t\n\t cb.subVectors(pC, pB);\n\t ab.subVectors(pA, pB);\n\t cb.cross(ab);\n\t\n\t cb.normalize();\n\t\n\t var nx = cb.x;\n\t var ny = cb.y;\n\t var nz = cb.z;\n\t\n\t vertices[lastIndex * 9 + 0] = ax;\n\t vertices[lastIndex * 9 + 1] = ay;\n\t vertices[lastIndex * 9 + 2] = az;\n\t\n\t normals[lastIndex * 9 + 0] = nx;\n\t normals[lastIndex * 9 + 1] = ny;\n\t normals[lastIndex * 9 + 2] = nz;\n\t\n\t colours[lastIndex * 9 + 0] = c1[0];\n\t colours[lastIndex * 9 + 1] = c1[1];\n\t colours[lastIndex * 9 + 2] = c1[2];\n\t\n\t vertices[lastIndex * 9 + 3] = bx;\n\t vertices[lastIndex * 9 + 4] = by;\n\t vertices[lastIndex * 9 + 5] = bz;\n\t\n\t normals[lastIndex * 9 + 3] = nx;\n\t normals[lastIndex * 9 + 4] = ny;\n\t normals[lastIndex * 9 + 5] = nz;\n\t\n\t colours[lastIndex * 9 + 3] = c2[0];\n\t colours[lastIndex * 9 + 4] = c2[1];\n\t colours[lastIndex * 9 + 5] = c2[2];\n\t\n\t vertices[lastIndex * 9 + 6] = cx;\n\t vertices[lastIndex * 9 + 7] = cy;\n\t vertices[lastIndex * 9 + 8] = cz;\n\t\n\t normals[lastIndex * 9 + 6] = nx;\n\t normals[lastIndex * 9 + 7] = ny;\n\t normals[lastIndex * 9 + 8] = nz;\n\t\n\t colours[lastIndex * 9 + 6] = c3[0];\n\t colours[lastIndex * 9 + 7] = c3[1];\n\t colours[lastIndex * 9 + 8] = c3[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex * 3 + 0] = _pickingId;\n\t pickingIds[lastIndex * 3 + 1] = _pickingId;\n\t pickingIds[lastIndex * 3 + 2] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t }\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(vertices, 3));\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(normals, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(colours, 3));\n\t\n\t if (pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t return geometry;\n\t };\n\t\n\t return {\n\t mergeAttributes: mergeAttributes,\n\t createLineGeometry: createLineGeometry,\n\t createGeometry: createGeometry\n\t };\n\t})();\n\t\n\texports['default'] = Buffer;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 83 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _PickingShader = __webpack_require__(84);\n\t\n\tvar _PickingShader2 = _interopRequireDefault(_PickingShader);\n\t\n\t// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\t\n\tvar PickingMaterial = function PickingMaterial() {\n\t _three2['default'].ShaderMaterial.call(this, {\n\t uniforms: {\n\t size: {\n\t type: 'f',\n\t value: 0.01\n\t },\n\t scale: {\n\t type: 'f',\n\t value: 400\n\t }\n\t },\n\t // attributes: ['position', 'id'],\n\t vertexShader: _PickingShader2['default'].vertexShader,\n\t fragmentShader: _PickingShader2['default'].fragmentShader\n\t });\n\t\n\t this.linePadding = 2;\n\t};\n\t\n\tPickingMaterial.prototype = Object.create(_three2['default'].ShaderMaterial.prototype);\n\t\n\tPickingMaterial.prototype.constructor = PickingMaterial;\n\t\n\tPickingMaterial.prototype.setPointSize = function (size) {\n\t this.uniforms.size.value = size;\n\t};\n\t\n\tPickingMaterial.prototype.setPointScale = function (scale) {\n\t this.uniforms.scale.value = scale;\n\t};\n\t\n\texports['default'] = PickingMaterial;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 84 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\t\n\tvar PickingShader = {\n\t\tvertexShader: ['attribute float pickingId;',\n\t\t// '',\n\t\t// 'uniform float size;',\n\t\t// 'uniform float scale;',\n\t\t'', 'varying vec4 worldId;', '', 'void main() {', ' vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n\t\t// ' gl_PointSize = size * ( scale / length( mvPosition.xyz ) );',\n\t\t' vec3 a = fract(vec3(1.0/255.0, 1.0/(255.0*255.0), 1.0/(255.0*255.0*255.0)) * pickingId);', ' a -= a.xxy * vec3(0.0, 1.0/255.0, 1.0/255.0);', ' worldId = vec4(a,1);', ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\\n'),\n\t\n\t\tfragmentShader: ['#ifdef GL_ES\\n', 'precision highp float;\\n', '#endif\\n', '', 'varying vec4 worldId;', '', 'void main() {', ' gl_FragColor = worldId;', '}'].join('\\n')\n\t};\n\t\n\texports['default'] = PickingShader;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 85 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\t\n\t// TODO: Look at ways to drop unneeded references to array buffers, etc to\n\t// reduce memory footprint\n\t\n\t// TODO: Support dynamic updating / hiding / animation of geometry\n\t//\n\t// This could be pretty hard as it's all packed away within BufferGeometry and\n\t// may even be merged by another layer (eg. GeoJSONLayer)\n\t//\n\t// How much control should this layer support? Perhaps a different or custom\n\t// layer would be better suited for animation, for example.\n\t\n\t// TODO: Allow _setBufferAttributes to use a custom function passed in to\n\t// generate a custom mesh\n\t\n\tvar _Layer2 = __webpack_require__(46);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _earcut2 = __webpack_require__(80);\n\t\n\tvar _earcut3 = _interopRequireDefault(_earcut2);\n\t\n\tvar _utilExtrudePolygon = __webpack_require__(81);\n\t\n\tvar _utilExtrudePolygon2 = _interopRequireDefault(_utilExtrudePolygon);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(83);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _utilBuffer = __webpack_require__(82);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar PolygonLayer = (function (_Layer) {\n\t _inherits(PolygonLayer, _Layer);\n\t\n\t function PolygonLayer(coordinates, options) {\n\t _classCallCheck(this, PolygonLayer);\n\t\n\t var defaults = {\n\t output: true,\n\t interactive: false,\n\t // Custom material override\n\t //\n\t // TODO: Should this be in the style object?\n\t material: null,\n\t onMesh: null,\n\t onBufferAttributes: null,\n\t // This default style is separate to Util.GeoJSON.defaultStyle\n\t style: {\n\t color: '#ffffff',\n\t transparent: false,\n\t opacity: 1,\n\t blending: _three2['default'].NormalBlending,\n\t height: 0\n\t }\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(PolygonLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t // Return coordinates as array of polygons so it's easy to support\n\t // MultiPolygon features (a single polygon would be a MultiPolygon with a\n\t // single polygon in the array)\n\t this._coordinates = PolygonLayer.isSingle(coordinates) ? [coordinates] : coordinates;\n\t }\n\t\n\t _createClass(PolygonLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this._setCoordinates();\n\t\n\t if (this._options.interactive) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new _three2['default'].Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t this._setPickingId();\n\t this._addPickingEvents();\n\t }\n\t\n\t // Store geometry representation as instances of THREE.BufferAttribute\n\t this._setBufferAttributes();\n\t\n\t if (this.isOutput()) {\n\t // Set mesh if not merging elsewhere\n\t this._setMesh(this._bufferAttributes);\n\t\n\t // Output mesh\n\t this.add(this._mesh);\n\t }\n\t }\n\t\n\t // Return center of polygon as a LatLon\n\t //\n\t // This is used for things like placing popups / UI elements on the layer\n\t //\n\t // TODO: Find proper center position instead of returning first coordinate\n\t // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polygon.js#L15\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._center;\n\t }\n\t\n\t // Return polygon bounds in geographic coordinates\n\t //\n\t // TODO: Implement getBounds()\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {}\n\t\n\t // Get unique ID for picking interaction\n\t }, {\n\t key: '_setPickingId',\n\t value: function _setPickingId() {\n\t this._pickingId = this.getPickingId();\n\t }\n\t\n\t // Set up and re-emit interaction events\n\t }, {\n\t key: '_addPickingEvents',\n\t value: function _addPickingEvents() {\n\t var _this = this;\n\t\n\t // TODO: Find a way to properly remove this listener on destroy\n\t this._world.on('pick-' + this._pickingId, function (point2d, point3d, intersects) {\n\t // Re-emit click event from the layer\n\t _this.emit('click', _this, point2d, point3d, intersects);\n\t });\n\t }\n\t\n\t // Create and store reference to THREE.BufferAttribute data for this layer\n\t }, {\n\t key: '_setBufferAttributes',\n\t value: function _setBufferAttributes() {\n\t var _this2 = this;\n\t\n\t var attributes;\n\t\n\t // Only use this if you know what you're doing\n\t if (typeof this._options.onBufferAttributes === 'function') {\n\t // TODO: Probably want to pass something less general as arguments,\n\t // though passing the instance will do for now (it's everything)\n\t attributes = this._options.onBufferAttributes(this);\n\t } else {\n\t var height = 0;\n\t\n\t // Convert height into world units\n\t if (this._options.style.height && this._options.style.height !== 0) {\n\t height = this._world.metresToWorld(this._options.style.height, this._pointScale);\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t colour.set(this._options.style.color);\n\t\n\t // Light and dark colours used for poor-mans AO gradient on object sides\n\t var light = new _three2['default'].Color(0xffffff);\n\t var shadow = new _three2['default'].Color(0x666666);\n\t\n\t // For each polygon\n\t attributes = this._projectedCoordinates.map(function (_projectedCoordinates) {\n\t // Convert coordinates to earcut format\n\t var _earcut = _this2._toEarcut(_projectedCoordinates);\n\t\n\t // Triangulate faces using earcut\n\t var faces = _this2._triangulate(_earcut.vertices, _earcut.holes, _earcut.dimensions);\n\t\n\t var groupedVertices = [];\n\t for (i = 0, il = _earcut.vertices.length; i < il; i += _earcut.dimensions) {\n\t groupedVertices.push(_earcut.vertices.slice(i, i + _earcut.dimensions));\n\t }\n\t\n\t var extruded = (0, _utilExtrudePolygon2['default'])(groupedVertices, faces, {\n\t bottom: 0,\n\t top: height\n\t });\n\t\n\t var topColor = colour.clone().multiply(light);\n\t var bottomColor = colour.clone().multiply(shadow);\n\t\n\t var _vertices = extruded.positions;\n\t var _faces = [];\n\t var _colours = [];\n\t\n\t var _colour;\n\t extruded.top.forEach(function (face, fi) {\n\t _colour = [];\n\t\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t\n\t _faces.push(face);\n\t _colours.push(_colour);\n\t });\n\t\n\t _this2._flat = true;\n\t\n\t if (extruded.sides) {\n\t _this2._flat = false;\n\t\n\t // Set up colours for every vertex with poor-mans AO on the sides\n\t extruded.sides.forEach(function (face, fi) {\n\t _colour = [];\n\t\n\t // First face is always bottom-bottom-top\n\t if (fi % 2 === 0) {\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t // Reverse winding for the second face\n\t // top-top-bottom\n\t } else {\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t }\n\t\n\t _faces.push(face);\n\t _colours.push(_colour);\n\t });\n\t }\n\t\n\t // Skip bottom as there's no point rendering it\n\t // allFaces.push(extruded.faces);\n\t\n\t var polygon = {\n\t vertices: _vertices,\n\t faces: _faces,\n\t colours: _colours,\n\t facesCount: _faces.length\n\t };\n\t\n\t if (_this2._options.interactive && _this2._pickingId) {\n\t // Inject picking ID\n\t polygon.pickingId = _this2._pickingId;\n\t }\n\t\n\t // Convert polygon representation to proper attribute arrays\n\t return _this2._toAttributes(polygon);\n\t });\n\t }\n\t\n\t this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes);\n\t\n\t // Original attributes are no longer required so free the memory\n\t attributes = null;\n\t }\n\t }, {\n\t key: 'getBufferAttributes',\n\t value: function getBufferAttributes() {\n\t return this._bufferAttributes;\n\t }\n\t\n\t // Used by external components to clear some memory when the attributes\n\t // are no longer required to be stored in this layer\n\t //\n\t // For example, you would want to clear the attributes here after merging them\n\t // using something like the GeoJSONLayer\n\t }, {\n\t key: 'clearBufferAttributes',\n\t value: function clearBufferAttributes() {\n\t this._bufferAttributes = null;\n\t }\n\t\n\t // Used by external components to clear some memory when the coordinates\n\t // are no longer required to be stored in this layer\n\t //\n\t // For example, you would want to clear the coordinates here after this\n\t // layer is merged in something like the GeoJSONLayer\n\t }, {\n\t key: 'clearCoordinates',\n\t value: function clearCoordinates() {\n\t this._coordinates = null;\n\t this._projectedCoordinates = null;\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // This is only called if the layer is controlling its own output\n\t }, {\n\t key: '_setMesh',\n\t value: function _setMesh(attributes) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t if (this._options.material && this._options.material instanceof _three2['default'].Material) {\n\t material = this._options.material;\n\t } else if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshPhongMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t side: _three2['default'].BackSide,\n\t transparent: this._options.style.transparent,\n\t opacity: this._options.style.opacity,\n\t blending: this._options.style.blending\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t side: _three2['default'].BackSide,\n\t transparent: this._options.style.transparent,\n\t opacity: this._options.style.opacity,\n\t blending: this._options.style.blending\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var mesh;\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onMesh === 'function') {\n\t mesh = this._options.onMesh(geometry, material);\n\t } else {\n\t mesh = new _three2['default'].Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t mesh.receiveShadow = true;\n\t }\n\t\n\t if (this.isFlat()) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = 1;\n\t }\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t material.side = _three2['default'].BackSide;\n\t\n\t var pickingMesh = new _three2['default'].Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._mesh = mesh;\n\t }\n\t\n\t // Convert and project coordinates\n\t //\n\t // TODO: Calculate bounds\n\t }, {\n\t key: '_setCoordinates',\n\t value: function _setCoordinates() {\n\t this._bounds = [];\n\t this._coordinates = this._convertCoordinates(this._coordinates);\n\t\n\t this._projectedBounds = [];\n\t this._projectedCoordinates = this._projectCoordinates();\n\t\n\t this._center = this._coordinates[0][0][0];\n\t }\n\t\n\t // Recursively convert input coordinates into LatLon objects\n\t //\n\t // Calculate geographic bounds at the same time\n\t //\n\t // TODO: Calculate geographic bounds\n\t }, {\n\t key: '_convertCoordinates',\n\t value: function _convertCoordinates(coordinates) {\n\t return coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (ring) {\n\t return ring.map(function (coordinate) {\n\t return (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t });\n\t });\n\t });\n\t }\n\t\n\t // Recursively project coordinates into world positions\n\t //\n\t // Calculate world bounds, offset and pointScale at the same time\n\t //\n\t // TODO: Calculate world bounds\n\t }, {\n\t key: '_projectCoordinates',\n\t value: function _projectCoordinates() {\n\t var _this3 = this;\n\t\n\t var point;\n\t return this._coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (ring) {\n\t return ring.map(function (latlon) {\n\t point = _this3._world.latLonToPoint(latlon);\n\t\n\t // TODO: Is offset ever being used or needed?\n\t if (!_this3._offset) {\n\t _this3._offset = (0, _geoPoint.point)(0, 0);\n\t _this3._offset.x = -1 * point.x;\n\t _this3._offset.y = -1 * point.y;\n\t\n\t _this3._pointScale = _this3._world.pointScale(latlon);\n\t }\n\t\n\t return point;\n\t });\n\t });\n\t });\n\t }\n\t\n\t // Convert coordinates array to something earcut can understand\n\t }, {\n\t key: '_toEarcut',\n\t value: function _toEarcut(coordinates) {\n\t var dim = 2;\n\t var result = { vertices: [], holes: [], dimensions: dim };\n\t var holeIndex = 0;\n\t\n\t for (var i = 0; i < coordinates.length; i++) {\n\t for (var j = 0; j < coordinates[i].length; j++) {\n\t // for (var d = 0; d < dim; d++) {\n\t result.vertices.push(coordinates[i][j].x);\n\t result.vertices.push(coordinates[i][j].y);\n\t // }\n\t }\n\t if (i > 0) {\n\t holeIndex += coordinates[i - 1].length;\n\t result.holes.push(holeIndex);\n\t }\n\t }\n\t\n\t return result;\n\t }\n\t\n\t // Triangulate earcut-based input using earcut\n\t }, {\n\t key: '_triangulate',\n\t value: function _triangulate(contour, holes, dim) {\n\t // console.time('earcut');\n\t\n\t var faces = (0, _earcut3['default'])(contour, holes, dim);\n\t var result = [];\n\t\n\t for (i = 0, il = faces.length; i < il; i += 3) {\n\t result.push(faces.slice(i, i + 3));\n\t }\n\t\n\t // console.timeEnd('earcut');\n\t\n\t return result;\n\t }\n\t\n\t // Transform polygon representation into attribute arrays that can be used by\n\t // THREE.BufferGeometry\n\t //\n\t // TODO: Can this be simplified? It's messy and huge\n\t }, {\n\t key: '_toAttributes',\n\t value: function _toAttributes(polygon) {\n\t // Three components per vertex per face (3 x 3 = 9)\n\t var vertices = new Float32Array(polygon.facesCount * 9);\n\t var normals = new Float32Array(polygon.facesCount * 9);\n\t var colours = new Float32Array(polygon.facesCount * 9);\n\t\n\t var pickingIds;\n\t if (polygon.pickingId) {\n\t // One component per vertex per face (1 x 3 = 3)\n\t pickingIds = new Float32Array(polygon.facesCount * 3);\n\t }\n\t\n\t var pA = new _three2['default'].Vector3();\n\t var pB = new _three2['default'].Vector3();\n\t var pC = new _three2['default'].Vector3();\n\t\n\t var cb = new _three2['default'].Vector3();\n\t var ab = new _three2['default'].Vector3();\n\t\n\t var index;\n\t\n\t var _faces = polygon.faces;\n\t var _vertices = polygon.vertices;\n\t var _colour = polygon.colours;\n\t\n\t var _pickingId;\n\t if (pickingIds) {\n\t _pickingId = polygon.pickingId;\n\t }\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < _faces.length; i++) {\n\t // Array of vertex indexes for the face\n\t index = _faces[i][0];\n\t\n\t var ax = _vertices[index][0];\n\t var ay = _vertices[index][1];\n\t var az = _vertices[index][2];\n\t\n\t var c1 = _colour[i][0];\n\t\n\t index = _faces[i][1];\n\t\n\t var bx = _vertices[index][0];\n\t var by = _vertices[index][1];\n\t var bz = _vertices[index][2];\n\t\n\t var c2 = _colour[i][1];\n\t\n\t index = _faces[i][2];\n\t\n\t var cx = _vertices[index][0];\n\t var cy = _vertices[index][1];\n\t var cz = _vertices[index][2];\n\t\n\t var c3 = _colour[i][2];\n\t\n\t // Flat face normals\n\t // From: http://threejs.org/examples/webgl_buffergeometry.html\n\t pA.set(ax, ay, az);\n\t pB.set(bx, by, bz);\n\t pC.set(cx, cy, cz);\n\t\n\t cb.subVectors(pC, pB);\n\t ab.subVectors(pA, pB);\n\t cb.cross(ab);\n\t\n\t cb.normalize();\n\t\n\t var nx = cb.x;\n\t var ny = cb.y;\n\t var nz = cb.z;\n\t\n\t vertices[lastIndex * 9 + 0] = ax;\n\t vertices[lastIndex * 9 + 1] = ay;\n\t vertices[lastIndex * 9 + 2] = az;\n\t\n\t normals[lastIndex * 9 + 0] = nx;\n\t normals[lastIndex * 9 + 1] = ny;\n\t normals[lastIndex * 9 + 2] = nz;\n\t\n\t colours[lastIndex * 9 + 0] = c1[0];\n\t colours[lastIndex * 9 + 1] = c1[1];\n\t colours[lastIndex * 9 + 2] = c1[2];\n\t\n\t vertices[lastIndex * 9 + 3] = bx;\n\t vertices[lastIndex * 9 + 4] = by;\n\t vertices[lastIndex * 9 + 5] = bz;\n\t\n\t normals[lastIndex * 9 + 3] = nx;\n\t normals[lastIndex * 9 + 4] = ny;\n\t normals[lastIndex * 9 + 5] = nz;\n\t\n\t colours[lastIndex * 9 + 3] = c2[0];\n\t colours[lastIndex * 9 + 4] = c2[1];\n\t colours[lastIndex * 9 + 5] = c2[2];\n\t\n\t vertices[lastIndex * 9 + 6] = cx;\n\t vertices[lastIndex * 9 + 7] = cy;\n\t vertices[lastIndex * 9 + 8] = cz;\n\t\n\t normals[lastIndex * 9 + 6] = nx;\n\t normals[lastIndex * 9 + 7] = ny;\n\t normals[lastIndex * 9 + 8] = nz;\n\t\n\t colours[lastIndex * 9 + 6] = c3[0];\n\t colours[lastIndex * 9 + 7] = c3[1];\n\t colours[lastIndex * 9 + 8] = c3[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex * 3 + 0] = _pickingId;\n\t pickingIds[lastIndex * 3 + 1] = _pickingId;\n\t pickingIds[lastIndex * 3 + 2] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t\n\t var attributes = {\n\t vertices: vertices,\n\t normals: normals,\n\t colours: colours\n\t };\n\t\n\t if (pickingIds) {\n\t attributes.pickingIds = pickingIds;\n\t }\n\t\n\t return attributes;\n\t }\n\t\n\t // Returns true if the polygon is flat (has no height)\n\t }, {\n\t key: 'isFlat',\n\t value: function isFlat() {\n\t return this._flat;\n\t }\n\t\n\t // Returns true if coordinates refer to a single geometry\n\t //\n\t // For example, not coordinates for a MultiPolygon GeoJSON feature\n\t }, {\n\t key: 'destroy',\n\t\n\t // TODO: Make sure this is cleaning everything\n\t value: function destroy() {\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t this.clearCoordinates();\n\t this.clearBufferAttributes();\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(PolygonLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }], [{\n\t key: 'isSingle',\n\t value: function isSingle(coordinates) {\n\t return !Array.isArray(coordinates[0][0][0]);\n\t }\n\t }]);\n\t\n\t return PolygonLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = PolygonLayer;\n\t\n\tvar noNew = function noNew(coordinates, options) {\n\t return new PolygonLayer(coordinates, options);\n\t};\n\t\n\texports.polygonLayer = noNew;\n\n/***/ },\n/* 86 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\t\n\t// TODO: Look at ways to drop unneeded references to array buffers, etc to\n\t// reduce memory footprint\n\t\n\t// TODO: Provide alternative output using tubes and splines / curves\n\t\n\t// TODO: Support dynamic updating / hiding / animation of geometry\n\t//\n\t// This could be pretty hard as it's all packed away within BufferGeometry and\n\t// may even be merged by another layer (eg. GeoJSONLayer)\n\t//\n\t// How much control should this layer support? Perhaps a different or custom\n\t// layer would be better suited for animation, for example.\n\t\n\t// TODO: Allow _setBufferAttributes to use a custom function passed in to\n\t// generate a custom mesh\n\t\n\tvar _Layer2 = __webpack_require__(46);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(83);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _utilBuffer = __webpack_require__(82);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar PolylineLayer = (function (_Layer) {\n\t _inherits(PolylineLayer, _Layer);\n\t\n\t function PolylineLayer(coordinates, options) {\n\t _classCallCheck(this, PolylineLayer);\n\t\n\t var defaults = {\n\t output: true,\n\t interactive: false,\n\t // Custom material override\n\t //\n\t // TODO: Should this be in the style object?\n\t material: null,\n\t onMesh: null,\n\t onBufferAttributes: null,\n\t // This default style is separate to Util.GeoJSON.defaultStyle\n\t style: {\n\t lineOpacity: 1,\n\t lineTransparent: false,\n\t lineColor: '#ffffff',\n\t lineWidth: 1,\n\t lineBlending: _three2['default'].NormalBlending\n\t }\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(PolylineLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t // Return coordinates as array of lines so it's easy to support\n\t // MultiLineString features (a single line would be a MultiLineString with a\n\t // single line in the array)\n\t this._coordinates = PolylineLayer.isSingle(coordinates) ? [coordinates] : coordinates;\n\t\n\t // Polyline features are always flat (for now at least)\n\t this._flat = true;\n\t }\n\t\n\t _createClass(PolylineLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this._setCoordinates();\n\t\n\t if (this._options.interactive) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new _three2['default'].Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t this._setPickingId();\n\t this._addPickingEvents();\n\t }\n\t\n\t // Store geometry representation as instances of THREE.BufferAttribute\n\t this._setBufferAttributes();\n\t\n\t if (this.isOutput()) {\n\t // Set mesh if not merging elsewhere\n\t this._setMesh(this._bufferAttributes);\n\t\n\t // Output mesh\n\t this.add(this._mesh);\n\t }\n\t }\n\t\n\t // Return center of polyline as a LatLon\n\t //\n\t // This is used for things like placing popups / UI elements on the layer\n\t //\n\t // TODO: Find proper center position instead of returning first coordinate\n\t // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polyline.js#L59\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._center;\n\t }\n\t\n\t // Return line bounds in geographic coordinates\n\t //\n\t // TODO: Implement getBounds()\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {}\n\t\n\t // Get unique ID for picking interaction\n\t }, {\n\t key: '_setPickingId',\n\t value: function _setPickingId() {\n\t this._pickingId = this.getPickingId();\n\t }\n\t\n\t // Set up and re-emit interaction events\n\t }, {\n\t key: '_addPickingEvents',\n\t value: function _addPickingEvents() {\n\t var _this = this;\n\t\n\t // TODO: Find a way to properly remove this listener on destroy\n\t this._world.on('pick-' + this._pickingId, function (point2d, point3d, intersects) {\n\t // Re-emit click event from the layer\n\t _this.emit('click', _this, point2d, point3d, intersects);\n\t });\n\t }\n\t\n\t // Create and store reference to THREE.BufferAttribute data for this layer\n\t }, {\n\t key: '_setBufferAttributes',\n\t value: function _setBufferAttributes() {\n\t var _this2 = this;\n\t\n\t var attributes;\n\t\n\t // Only use this if you know what you're doing\n\t if (typeof this._options.onBufferAttributes === 'function') {\n\t // TODO: Probably want to pass something less general as arguments,\n\t // though passing the instance will do for now (it's everything)\n\t attributes = this._options.onBufferAttributes(this);\n\t } else {\n\t var height = 0;\n\t\n\t // Convert height into world units\n\t if (this._options.style.lineHeight) {\n\t height = this._world.metresToWorld(this._options.style.lineHeight, this._pointScale);\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t colour.set(this._options.style.lineColor);\n\t\n\t // For each line\n\t attributes = this._projectedCoordinates.map(function (_projectedCoordinates) {\n\t var _vertices = [];\n\t var _colours = [];\n\t\n\t // Connect coordinate with the next to make a pair\n\t //\n\t // LineSegments requires pairs of vertices so repeat the last point if\n\t // there's an odd number of vertices\n\t var nextCoord;\n\t _projectedCoordinates.forEach(function (coordinate, index) {\n\t _colours.push([colour.r, colour.g, colour.b]);\n\t _vertices.push([coordinate.x, height, coordinate.y]);\n\t\n\t nextCoord = _projectedCoordinates[index + 1] ? _projectedCoordinates[index + 1] : coordinate;\n\t\n\t _colours.push([colour.r, colour.g, colour.b]);\n\t _vertices.push([nextCoord.x, height, nextCoord.y]);\n\t });\n\t\n\t var line = {\n\t vertices: _vertices,\n\t colours: _colours,\n\t verticesCount: _vertices.length\n\t };\n\t\n\t if (_this2._options.interactive && _this2._pickingId) {\n\t // Inject picking ID\n\t line.pickingId = _this2._pickingId;\n\t }\n\t\n\t // Convert line representation to proper attribute arrays\n\t return _this2._toAttributes(line);\n\t });\n\t }\n\t\n\t this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes);\n\t\n\t // Original attributes are no longer required so free the memory\n\t attributes = null;\n\t }\n\t }, {\n\t key: 'getBufferAttributes',\n\t value: function getBufferAttributes() {\n\t return this._bufferAttributes;\n\t }\n\t\n\t // Used by external components to clear some memory when the attributes\n\t // are no longer required to be stored in this layer\n\t //\n\t // For example, you would want to clear the attributes here after merging them\n\t // using something like the GeoJSONLayer\n\t }, {\n\t key: 'clearBufferAttributes',\n\t value: function clearBufferAttributes() {\n\t this._bufferAttributes = null;\n\t }\n\t\n\t // Used by external components to clear some memory when the coordinates\n\t // are no longer required to be stored in this layer\n\t //\n\t // For example, you would want to clear the coordinates here after this\n\t // layer is merged in something like the GeoJSONLayer\n\t }, {\n\t key: 'clearCoordinates',\n\t value: function clearCoordinates() {\n\t this._coordinates = null;\n\t this._projectedCoordinates = null;\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // This is only called if the layer is controlling its own output\n\t }, {\n\t key: '_setMesh',\n\t value: function _setMesh(attributes) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(attributes.vertices, 3));\n\t\n\t if (attributes.normals) {\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(attributes.normals, 3));\n\t }\n\t\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var style = this._options.style;\n\t var material;\n\t\n\t if (this._options.material && this._options.material instanceof _three2['default'].Material) {\n\t material = this._options.material;\n\t } else {\n\t material = new _three2['default'].LineBasicMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t linewidth: style.lineWidth,\n\t transparent: style.lineTransparent,\n\t opacity: style.lineOpacity,\n\t blending: style.lineBlending\n\t });\n\t }\n\t\n\t var mesh;\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onMesh === 'function') {\n\t mesh = this._options.onMesh(geometry, material);\n\t } else {\n\t mesh = new _three2['default'].LineSegments(geometry, material);\n\t\n\t if (style.lineRenderOrder !== undefined) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = style.lineRenderOrder;\n\t }\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t }\n\t\n\t // TODO: Allow this to be overridden, or copy mesh instead of creating a new\n\t // one just for picking\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t // Make the line wider / easier to pick\n\t material.linewidth = style.lineWidth + material.linePadding;\n\t\n\t var pickingMesh = new _three2['default'].LineSegments(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._mesh = mesh;\n\t }\n\t\n\t // Convert and project coordinates\n\t //\n\t // TODO: Calculate bounds\n\t }, {\n\t key: '_setCoordinates',\n\t value: function _setCoordinates() {\n\t this._bounds = [];\n\t this._coordinates = this._convertCoordinates(this._coordinates);\n\t\n\t this._projectedBounds = [];\n\t this._projectedCoordinates = this._projectCoordinates();\n\t\n\t this._center = this._coordinates[0][0];\n\t }\n\t\n\t // Recursively convert input coordinates into LatLon objects\n\t //\n\t // Calculate geographic bounds at the same time\n\t //\n\t // TODO: Calculate geographic bounds\n\t }, {\n\t key: '_convertCoordinates',\n\t value: function _convertCoordinates(coordinates) {\n\t return coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (coordinate) {\n\t return (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t });\n\t });\n\t }\n\t\n\t // Recursively project coordinates into world positions\n\t //\n\t // Calculate world bounds, offset and pointScale at the same time\n\t //\n\t // TODO: Calculate world bounds\n\t }, {\n\t key: '_projectCoordinates',\n\t value: function _projectCoordinates() {\n\t var _this3 = this;\n\t\n\t var point;\n\t return this._coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (latlon) {\n\t point = _this3._world.latLonToPoint(latlon);\n\t\n\t // TODO: Is offset ever being used or needed?\n\t if (!_this3._offset) {\n\t _this3._offset = (0, _geoPoint.point)(0, 0);\n\t _this3._offset.x = -1 * point.x;\n\t _this3._offset.y = -1 * point.y;\n\t\n\t _this3._pointScale = _this3._world.pointScale(latlon);\n\t }\n\t\n\t return point;\n\t });\n\t });\n\t }\n\t\n\t // Transform line representation into attribute arrays that can be used by\n\t // THREE.BufferGeometry\n\t //\n\t // TODO: Can this be simplified? It's messy and huge\n\t }, {\n\t key: '_toAttributes',\n\t value: function _toAttributes(line) {\n\t // Three components per vertex\n\t var vertices = new Float32Array(line.verticesCount * 3);\n\t var colours = new Float32Array(line.verticesCount * 3);\n\t\n\t var pickingIds;\n\t if (line.pickingId) {\n\t // One component per vertex\n\t pickingIds = new Float32Array(line.verticesCount);\n\t }\n\t\n\t var _vertices = line.vertices;\n\t var _colour = line.colours;\n\t\n\t var normals;\n\t var _normals;\n\t if (line.normals) {\n\t normals = new Float32Array(line.verticesCount * 3);\n\t _normals = line.normals;\n\t }\n\t\n\t var _pickingId;\n\t if (pickingIds) {\n\t _pickingId = line.pickingId;\n\t }\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < _vertices.length; i++) {\n\t var ax = _vertices[i][0];\n\t var ay = _vertices[i][1];\n\t var az = _vertices[i][2];\n\t\n\t var nx;\n\t var ny;\n\t var nz;\n\t if (_normals) {\n\t nx = _normals[i][0];\n\t ny = _normals[i][1];\n\t nz = _normals[i][2];\n\t }\n\t\n\t var c1 = _colour[i];\n\t\n\t vertices[lastIndex * 3 + 0] = ax;\n\t vertices[lastIndex * 3 + 1] = ay;\n\t vertices[lastIndex * 3 + 2] = az;\n\t\n\t if (normals) {\n\t normals[lastIndex * 3 + 0] = nx;\n\t normals[lastIndex * 3 + 1] = ny;\n\t normals[lastIndex * 3 + 2] = nz;\n\t }\n\t\n\t colours[lastIndex * 3 + 0] = c1[0];\n\t colours[lastIndex * 3 + 1] = c1[1];\n\t colours[lastIndex * 3 + 2] = c1[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t\n\t var attributes = {\n\t vertices: vertices,\n\t colours: colours\n\t };\n\t\n\t if (normals) {\n\t attributes.normals = normals;\n\t }\n\t\n\t if (pickingIds) {\n\t attributes.pickingIds = pickingIds;\n\t }\n\t\n\t return attributes;\n\t }\n\t\n\t // Returns true if the line is flat (has no height)\n\t }, {\n\t key: 'isFlat',\n\t value: function isFlat() {\n\t return this._flat;\n\t }\n\t\n\t // Returns true if coordinates refer to a single geometry\n\t //\n\t // For example, not coordinates for a MultiLineString GeoJSON feature\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t this.clearCoordinates();\n\t this.clearBufferAttributes();\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(PolylineLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }], [{\n\t key: 'isSingle',\n\t value: function isSingle(coordinates) {\n\t return !Array.isArray(coordinates[0][0]);\n\t }\n\t }]);\n\t\n\t return PolylineLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = PolylineLayer;\n\t\n\tvar noNew = function noNew(coordinates, options) {\n\t return new PolylineLayer(coordinates, options);\n\t};\n\t\n\texports.polylineLayer = noNew;\n\n/***/ },\n/* 87 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\t\n\t// TODO: Look at ways to drop unneeded references to array buffers, etc to\n\t// reduce memory footprint\n\t\n\t// TODO: Point features may be using custom models / meshes and so an approach\n\t// needs to be found to allow these to be brokwn down into buffer attributes for\n\t// merging\n\t//\n\t// Can probably use fromGeometry() or setFromObject() from THREE.BufferGeometry\n\t// and pull out the attributes\n\t\n\t// TODO: Support sprite objects using textures\n\t\n\t// TODO: Provide option to billboard geometry so it always faces the camera\n\t\n\t// TODO: Support dynamic updating / hiding / animation of geometry\n\t//\n\t// This could be pretty hard as it's all packed away within BufferGeometry and\n\t// may even be merged by another layer (eg. GeoJSONLayer)\n\t//\n\t// How much control should this layer support? Perhaps a different or custom\n\t// layer would be better suited for animation, for example.\n\t\n\tvar _Layer2 = __webpack_require__(46);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(83);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _utilBuffer = __webpack_require__(82);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar PointLayer = (function (_Layer) {\n\t _inherits(PointLayer, _Layer);\n\t\n\t function PointLayer(coordinates, options) {\n\t _classCallCheck(this, PointLayer);\n\t\n\t var defaults = {\n\t output: true,\n\t interactive: false,\n\t // THREE.Geometry or THREE.BufferGeometry to use for point output\n\t geometry: null,\n\t // Custom material override\n\t //\n\t // TODO: Should this be in the style object?\n\t material: null,\n\t onMesh: null,\n\t // This default style is separate to Util.GeoJSON.defaultStyle\n\t style: {\n\t pointColor: '#ff0000'\n\t }\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(PointLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t // Return coordinates as array of points so it's easy to support\n\t // MultiPoint features (a single point would be a MultiPoint with a\n\t // single point in the array)\n\t this._coordinates = PointLayer.isSingle(coordinates) ? [coordinates] : coordinates;\n\t\n\t // Point features are always flat (for now at least)\n\t //\n\t // This won't always be the case once custom point objects / meshes are\n\t // added\n\t this._flat = true;\n\t }\n\t\n\t _createClass(PointLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this._setCoordinates();\n\t\n\t if (this._options.interactive) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new _three2['default'].Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t this._setPickingId();\n\t this._addPickingEvents();\n\t }\n\t\n\t // Store geometry representation as instances of THREE.BufferAttribute\n\t this._setBufferAttributes();\n\t\n\t if (this.isOutput()) {\n\t // Set mesh if not merging elsewhere\n\t this._setMesh(this._bufferAttributes);\n\t\n\t // Output mesh\n\t this.add(this._mesh);\n\t }\n\t }\n\t\n\t // Return center of point as a LatLon\n\t //\n\t // This is used for things like placing popups / UI elements on the layer\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._center;\n\t }\n\t\n\t // Return point bounds in geographic coordinates\n\t //\n\t // While not useful for single points, it could be useful for MultiPoint\n\t //\n\t // TODO: Implement getBounds()\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {}\n\t\n\t // Get unique ID for picking interaction\n\t }, {\n\t key: '_setPickingId',\n\t value: function _setPickingId() {\n\t this._pickingId = this.getPickingId();\n\t }\n\t\n\t // Set up and re-emit interaction events\n\t }, {\n\t key: '_addPickingEvents',\n\t value: function _addPickingEvents() {\n\t var _this = this;\n\t\n\t // TODO: Find a way to properly remove this listener on destroy\n\t this._world.on('pick-' + this._pickingId, function (point2d, point3d, intersects) {\n\t // Re-emit click event from the layer\n\t _this.emit('click', _this, point2d, point3d, intersects);\n\t });\n\t }\n\t\n\t // Create and store reference to THREE.BufferAttribute data for this layer\n\t }, {\n\t key: '_setBufferAttributes',\n\t value: function _setBufferAttributes() {\n\t var _this2 = this;\n\t\n\t var height = 0;\n\t\n\t // Convert height into world units\n\t if (this._options.style.pointHeight) {\n\t height = this._world.metresToWorld(this._options.style.pointHeight, this._pointScale);\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t colour.set(this._options.style.pointColor);\n\t\n\t var geometry;\n\t\n\t // Use default geometry if none has been provided or the provided geometry\n\t // isn't valid\n\t if (!this._options.geometry || !this._options.geometry instanceof _three2['default'].Geometry || !this._options.geometry instanceof _three2['default'].BufferGeometry) {\n\t // Debug geometry for points is a thin bar\n\t //\n\t // TODO: Allow point geometry to be customised / overridden\n\t var geometryWidth = this._world.metresToWorld(25, this._pointScale);\n\t var geometryHeight = this._world.metresToWorld(200, this._pointScale);\n\t var _geometry = new _three2['default'].BoxGeometry(geometryWidth, geometryHeight, geometryWidth);\n\t\n\t // Shift geometry up so it sits on the ground\n\t _geometry.translate(0, geometryHeight * 0.5, 0);\n\t\n\t // Pull attributes out of debug geometry\n\t geometry = new _three2['default'].BufferGeometry().fromGeometry(_geometry);\n\t } else {\n\t if (this._options.geometry instanceof _three2['default'].BufferGeometry) {\n\t geometry = this._options.geometry;\n\t } else {\n\t geometry = new _three2['default'].BufferGeometry().fromGeometry(this._options.geometry);\n\t }\n\t }\n\t\n\t // For each point\n\t var attributes = this._projectedCoordinates.map(function (coordinate) {\n\t var _vertices = [];\n\t var _normals = [];\n\t var _colours = [];\n\t\n\t var _geometry = geometry.clone();\n\t\n\t _geometry.translate(coordinate.x, height, coordinate.y);\n\t\n\t var _vertices = _geometry.attributes.position.clone().array;\n\t var _normals = _geometry.attributes.normal.clone().array;\n\t var _colours = _geometry.attributes.color.clone().array;\n\t\n\t for (var i = 0; i < _colours.length; i += 3) {\n\t _colours[i] = colour.r;\n\t _colours[i + 1] = colour.g;\n\t _colours[i + 2] = colour.b;\n\t }\n\t\n\t var _point = {\n\t vertices: _vertices,\n\t normals: _normals,\n\t colours: _colours\n\t };\n\t\n\t if (_this2._options.interactive && _this2._pickingId) {\n\t // Inject picking ID\n\t // point.pickingId = this._pickingId;\n\t _point.pickingIds = new Float32Array(_vertices.length / 3);\n\t for (var i = 0; i < _point.pickingIds.length; i++) {\n\t _point.pickingIds[i] = _this2._pickingId;\n\t }\n\t }\n\t\n\t // Convert point representation to proper attribute arrays\n\t // return this._toAttributes(_point);\n\t return _point;\n\t });\n\t\n\t this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes);\n\t\n\t // Original attributes are no longer required so free the memory\n\t attributes = null;\n\t }\n\t }, {\n\t key: 'getBufferAttributes',\n\t value: function getBufferAttributes() {\n\t return this._bufferAttributes;\n\t }\n\t\n\t // Used by external components to clear some memory when the attributes\n\t // are no longer required to be stored in this layer\n\t //\n\t // For example, you would want to clear the attributes here after merging them\n\t // using something like the GeoJSONLayer\n\t }, {\n\t key: 'clearBufferAttributes',\n\t value: function clearBufferAttributes() {\n\t this._bufferAttributes = null;\n\t }\n\t\n\t // Used by external components to clear some memory when the coordinates\n\t // are no longer required to be stored in this layer\n\t //\n\t // For example, you would want to clear the coordinates here after this\n\t // layer is merged in something like the GeoJSONLayer\n\t }, {\n\t key: 'clearCoordinates',\n\t value: function clearCoordinates() {\n\t this._coordinates = null;\n\t this._projectedCoordinates = null;\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // This is only called if the layer is controlling its own output\n\t }, {\n\t key: '_setMesh',\n\t value: function _setMesh(attributes) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t\n\t if (this._options.material && this._options.material instanceof _three2['default'].Material) {\n\t material = this._options.material;\n\t } else if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshBasicMaterial({\n\t vertexColors: _three2['default'].VertexColors\n\t // side: THREE.BackSide\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t vertexColors: _three2['default'].VertexColors\n\t // side: THREE.BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var mesh;\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onMesh === 'function') {\n\t mesh = this._options.onMesh(geometry, material);\n\t } else {\n\t mesh = new _three2['default'].Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t }\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t var pickingMesh = new _three2['default'].Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._mesh = mesh;\n\t }\n\t\n\t // Convert and project coordinates\n\t //\n\t // TODO: Calculate bounds\n\t }, {\n\t key: '_setCoordinates',\n\t value: function _setCoordinates() {\n\t this._bounds = [];\n\t this._coordinates = this._convertCoordinates(this._coordinates);\n\t\n\t this._projectedBounds = [];\n\t this._projectedCoordinates = this._projectCoordinates();\n\t\n\t this._center = this._coordinates;\n\t }\n\t\n\t // Recursively convert input coordinates into LatLon objects\n\t //\n\t // Calculate geographic bounds at the same time\n\t //\n\t // TODO: Calculate geographic bounds\n\t }, {\n\t key: '_convertCoordinates',\n\t value: function _convertCoordinates(coordinates) {\n\t return coordinates.map(function (coordinate) {\n\t return (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t });\n\t }\n\t\n\t // Recursively project coordinates into world positions\n\t //\n\t // Calculate world bounds, offset and pointScale at the same time\n\t //\n\t // TODO: Calculate world bounds\n\t }, {\n\t key: '_projectCoordinates',\n\t value: function _projectCoordinates() {\n\t var _this3 = this;\n\t\n\t var _point;\n\t return this._coordinates.map(function (latlon) {\n\t _point = _this3._world.latLonToPoint(latlon);\n\t\n\t // TODO: Is offset ever being used or needed?\n\t if (!_this3._offset) {\n\t _this3._offset = (0, _geoPoint.point)(0, 0);\n\t _this3._offset.x = -1 * _point.x;\n\t _this3._offset.y = -1 * _point.y;\n\t\n\t _this3._pointScale = _this3._world.pointScale(latlon);\n\t }\n\t\n\t return _point;\n\t });\n\t }\n\t\n\t // Transform line representation into attribute arrays that can be used by\n\t // THREE.BufferGeometry\n\t //\n\t // TODO: Can this be simplified? It's messy and huge\n\t }, {\n\t key: '_toAttributes',\n\t value: function _toAttributes(line) {\n\t // Three components per vertex\n\t var vertices = new Float32Array(line.verticesCount * 3);\n\t var colours = new Float32Array(line.verticesCount * 3);\n\t\n\t var pickingIds;\n\t if (line.pickingId) {\n\t // One component per vertex\n\t pickingIds = new Float32Array(line.verticesCount);\n\t }\n\t\n\t var _vertices = line.vertices;\n\t var _colour = line.colours;\n\t\n\t var _pickingId;\n\t if (pickingIds) {\n\t _pickingId = line.pickingId;\n\t }\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < _vertices.length; i++) {\n\t var ax = _vertices[i][0];\n\t var ay = _vertices[i][1];\n\t var az = _vertices[i][2];\n\t\n\t var c1 = _colour[i];\n\t\n\t vertices[lastIndex * 3 + 0] = ax;\n\t vertices[lastIndex * 3 + 1] = ay;\n\t vertices[lastIndex * 3 + 2] = az;\n\t\n\t colours[lastIndex * 3 + 0] = c1[0];\n\t colours[lastIndex * 3 + 1] = c1[1];\n\t colours[lastIndex * 3 + 2] = c1[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t\n\t var attributes = {\n\t vertices: vertices,\n\t colours: colours\n\t };\n\t\n\t if (pickingIds) {\n\t attributes.pickingIds = pickingIds;\n\t }\n\t\n\t return attributes;\n\t }\n\t\n\t // Returns true if the line is flat (has no height)\n\t }, {\n\t key: 'isFlat',\n\t value: function isFlat() {\n\t return this._flat;\n\t }\n\t\n\t // Returns true if coordinates refer to a single geometry\n\t //\n\t // For example, not coordinates for a MultiPoint GeoJSON feature\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t this.clearCoordinates();\n\t this.clearBufferAttributes();\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(PointLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }], [{\n\t key: 'isSingle',\n\t value: function isSingle(coordinates) {\n\t return !Array.isArray(coordinates[0]);\n\t }\n\t }]);\n\t\n\t return PointLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = PointLayer;\n\t\n\tvar noNew = function noNew(coordinates, options) {\n\t return new PointLayer(coordinates, options);\n\t};\n\t\n\texports.pointLayer = noNew;\n\n/***/ },\n/* 88 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _GeoJSONTileLayer2 = __webpack_require__(70);\n\t\n\tvar _GeoJSONTileLayer3 = _interopRequireDefault(_GeoJSONTileLayer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar TopoJSONTileLayer = (function (_GeoJSONTileLayer) {\n\t _inherits(TopoJSONTileLayer, _GeoJSONTileLayer);\n\t\n\t function TopoJSONTileLayer(path, options) {\n\t _classCallCheck(this, TopoJSONTileLayer);\n\t\n\t var defaults = {\n\t topojson: true\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(TopoJSONTileLayer.prototype), 'constructor', this).call(this, path, options);\n\t }\n\t\n\t return TopoJSONTileLayer;\n\t})(_GeoJSONTileLayer3['default']);\n\t\n\texports['default'] = TopoJSONTileLayer;\n\t\n\tvar noNew = function noNew(path, options) {\n\t return new TopoJSONTileLayer(path, options);\n\t};\n\t\n\texports.topoJSONTileLayer = noNew;\n\n/***/ },\n/* 89 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _GeoJSONLayer2 = __webpack_require__(72);\n\t\n\tvar _GeoJSONLayer3 = _interopRequireDefault(_GeoJSONLayer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar TopoJSONLayer = (function (_GeoJSONLayer) {\n\t _inherits(TopoJSONLayer, _GeoJSONLayer);\n\t\n\t function TopoJSONLayer(topojson, options) {\n\t _classCallCheck(this, TopoJSONLayer);\n\t\n\t var defaults = {\n\t topojson: true\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(TopoJSONLayer.prototype), 'constructor', this).call(this, topojson, options);\n\t }\n\t\n\t return TopoJSONLayer;\n\t})(_GeoJSONLayer3['default']);\n\t\n\texports['default'] = TopoJSONLayer;\n\t\n\tvar noNew = function noNew(topojson, options) {\n\t return new TopoJSONLayer(topojson, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.topoJSONLayer = noNew;\n\n/***/ },\n/* 90 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// TODO: A lot of these utils don't need to be in separate, tiny files\n\t\n\tvar _Transformation = __webpack_require__(14);\n\t\n\tvar _Transformation2 = _interopRequireDefault(_Transformation);\n\t\n\tvar _wrapNum = __webpack_require__(12);\n\t\n\tvar _wrapNum2 = _interopRequireDefault(_wrapNum);\n\t\n\tvar _extrudePolygon = __webpack_require__(81);\n\t\n\tvar _extrudePolygon2 = _interopRequireDefault(_extrudePolygon);\n\t\n\tvar _GeoJSON = __webpack_require__(76);\n\t\n\tvar _GeoJSON2 = _interopRequireDefault(_GeoJSON);\n\t\n\tvar _Buffer = __webpack_require__(82);\n\t\n\tvar _Buffer2 = _interopRequireDefault(_Buffer);\n\t\n\tvar Util = {};\n\t\n\tUtil.Transformation = _Transformation2['default'];\n\tUtil.wrapNum = _wrapNum2['default'];\n\tUtil.extrudePolygon = _extrudePolygon2['default'];\n\tUtil.GeoJSON = _GeoJSON2['default'];\n\tUtil.Buffer = _Buffer2['default'];\n\t\n\texports['default'] = Util;\n\tmodule.exports = exports['default'];\n\n/***/ }\n/******/ ])\n});\n;"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 7587ac926a05cef79c62\n **/","import World, {world} from './World';\nimport Controls from './controls/index';\n\nimport Layer, {layer} from './layer/Layer';\nimport EnvironmentLayer, {environmentLayer} from './layer/environment/EnvironmentLayer';\nimport ImageTileLayer, {imageTileLayer} from './layer/tile/ImageTileLayer';\nimport GeoJSONTileLayer, {geoJSONTileLayer} from './layer/tile/GeoJSONTileLayer';\nimport TopoJSONTileLayer, {topoJSONTileLayer} from './layer/tile/TopoJSONTileLayer';\nimport GeoJSONLayer, {geoJSONLayer} from './layer/GeoJSONLayer';\nimport TopoJSONLayer, {topoJSONLayer} from './layer/TopoJSONLayer';\nimport PolygonLayer, {polygonLayer} from './layer/geometry/PolygonLayer';\nimport PolylineLayer, {polylineLayer} from './layer/geometry/PolylineLayer';\nimport PointLayer, {pointLayer} from './layer/geometry/PointLayer';\n\nimport Point, {point} from './geo/Point';\nimport LatLon, {latLon} from './geo/LatLon';\n\nimport Util from './util/index';\n\nconst VIZI = {\n version: '0.3',\n\n // Public API\n World: World,\n world: world,\n Controls: Controls,\n Layer: Layer,\n layer: layer,\n EnvironmentLayer: EnvironmentLayer,\n environmentLayer: environmentLayer,\n ImageTileLayer: ImageTileLayer,\n imageTileLayer: imageTileLayer,\n GeoJSONTileLayer: GeoJSONTileLayer,\n geoJSONTileLayer: geoJSONTileLayer,\n TopoJSONTileLayer: TopoJSONTileLayer,\n topoJSONTileLayer: topoJSONTileLayer,\n GeoJSONLayer: GeoJSONLayer,\n geoJSONLayer: geoJSONLayer,\n TopoJSONLayer: TopoJSONLayer,\n topoJSONLayer: topoJSONLayer,\n PolygonLayer: PolygonLayer,\n polygonLayer: polygonLayer,\n PolylineLayer: PolylineLayer,\n polylineLayer: polylineLayer,\n PointLayer: PointLayer,\n pointLayer: pointLayer,\n Point: Point,\n point: point,\n LatLon: LatLon,\n latLon: latLon,\n Util: Util\n};\n\nexport default VIZI;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vizicities.js\n **/","import EventEmitter from 'eventemitter3';\nimport extend from 'lodash.assign';\nimport CRS from './geo/crs/index';\nimport {point as Point} from './geo/Point';\nimport {latLon as LatLon} from './geo/LatLon';\nimport Engine from './engine/Engine';\nimport EnvironmentLayer from './layer/environment/EnvironmentLayer';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// Pretty much any event someone using ViziCities would need will be emitted or\n// proxied by World (eg. render events, etc)\n\nclass World extends EventEmitter {\n constructor(domId, options) {\n super();\n\n var defaults = {\n crs: CRS.EPSG3857,\n skybox: false,\n postProcessing: false\n };\n\n this.options = extend({}, defaults, options);\n\n this._layers = [];\n this._controls = [];\n\n this._initContainer(domId);\n this._initEngine();\n this._initEnvironment();\n this._initEvents();\n\n this._pause = false;\n\n // Kick off the update and render loop\n this._update();\n }\n\n _initContainer(domId) {\n this._container = document.getElementById(domId);\n }\n\n _initEngine() {\n this._engine = new Engine(this._container, this);\n\n // Engine events\n //\n // Consider proxying these through events on World for public access\n // this._engine.on('preRender', () => {});\n // this._engine.on('postRender', () => {});\n }\n\n _initEnvironment() {\n // Not sure if I want to keep this as a private API\n //\n // Makes sense to allow others to customise their environment so perhaps\n // add some method of disable / overriding the environment settings\n this._environment = new EnvironmentLayer({\n skybox: this.options.skybox\n }).addTo(this);\n }\n\n _initEvents() {\n this.on('controlsMoveEnd', this._onControlsMoveEnd);\n }\n\n _onControlsMoveEnd(point) {\n var _point = Point(point.x, point.z);\n this._resetView(this.pointToLatLon(_point), _point);\n }\n\n // Reset world view\n _resetView(latlon, point) {\n this.emit('preResetView');\n\n this._moveStart();\n this._move(latlon, point);\n this._moveEnd();\n\n this.emit('postResetView');\n }\n\n _moveStart() {\n this.emit('moveStart');\n }\n\n _move(latlon, point) {\n this._lastPosition = latlon;\n this.emit('move', latlon, point);\n }\n _moveEnd() {\n this.emit('moveEnd');\n }\n\n _update() {\n if (this._pause) {\n return;\n }\n\n var delta = this._engine.clock.getDelta();\n\n // Once _update is called it will run forever, for now\n window.requestAnimationFrame(this._update.bind(this));\n\n // Update controls\n this._controls.forEach(controls => {\n controls.update();\n });\n\n this.emit('preUpdate', delta);\n this._engine.update(delta);\n this.emit('postUpdate', delta);\n }\n\n // Set world view\n setView(latlon) {\n // Store initial geographic coordinate for the [0,0,0] world position\n //\n // The origin point doesn't move in three.js / 3D space so only set it once\n // here instead of every time _resetView is called\n //\n // If it was updated every time then coorindates would shift over time and\n // would be out of place / context with previously-placed points (0,0 would\n // refer to a different point each time)\n this._originLatlon = latlon;\n this._originPoint = this.project(latlon);\n\n this._resetView(latlon);\n return this;\n }\n\n // Return world geographic position\n getPosition() {\n return this._lastPosition;\n }\n\n // Transform geographic coordinate to world point\n //\n // This doesn't take into account the origin offset\n //\n // For example, this takes a geographic coordinate and returns a point\n // relative to the origin point of the projection (not the world)\n project(latlon) {\n return this.options.crs.latLonToPoint(LatLon(latlon));\n }\n\n // Transform world point to geographic coordinate\n //\n // This doesn't take into account the origin offset\n //\n // For example, this takes a point relative to the origin point of the\n // projection (not the world) and returns a geographic coordinate\n unproject(point) {\n return this.options.crs.pointToLatLon(Point(point));\n }\n\n // Takes into account the origin offset\n //\n // For example, this takes a geographic coordinate and returns a point\n // relative to the three.js / 3D origin (0,0)\n latLonToPoint(latlon) {\n var projectedPoint = this.project(LatLon(latlon));\n return projectedPoint._subtract(this._originPoint);\n }\n\n // Takes into account the origin offset\n //\n // For example, this takes a point relative to the three.js / 3D origin (0,0)\n // and returns the exact geographic coordinate at that point\n pointToLatLon(point) {\n var projectedPoint = Point(point).add(this._originPoint);\n return this.unproject(projectedPoint);\n }\n\n // Return pointscale for a given geographic coordinate\n pointScale(latlon, accurate) {\n return this.options.crs.pointScale(latlon, accurate);\n }\n\n // Convert from real meters to world units\n //\n // TODO: Would be nice not to have to pass in a pointscale here\n metresToWorld(metres, pointScale, zoom) {\n return this.options.crs.metresToWorld(metres, pointScale, zoom);\n }\n\n // Convert from real meters to world units\n //\n // TODO: Would be nice not to have to pass in a pointscale here\n worldToMetres(worldUnits, pointScale, zoom) {\n return this.options.crs.worldToMetres(worldUnits, pointScale, zoom);\n }\n\n // Unsure if it's a good idea to expose this here for components like\n // GridLayer to use (eg. to keep track of a frustum)\n getCamera() {\n return this._engine._camera;\n }\n\n addLayer(layer) {\n layer._addToWorld(this);\n\n this._layers.push(layer);\n\n if (layer.isOutput() && layer.isOutputToScene()) {\n // Could move this into Layer but it'll do here for now\n this._engine._scene.add(layer._object3D);\n this._engine._domScene3D.add(layer._domObject3D);\n this._engine._domScene2D.add(layer._domObject2D);\n }\n\n this.emit('layerAdded', layer);\n return this;\n }\n\n // Remove layer from world and scene but don't destroy it entirely\n removeLayer(layer) {\n var layerIndex = this._layers.indexOf(layer);\n\n if (layerIndex > -1) {\n // Remove from this._layers\n this._layers.splice(layerIndex, 1);\n };\n\n if (layer.isOutput() && layer.isOutputToScene()) {\n this._engine._scene.remove(layer._object3D);\n this._engine._domScene3D.remove(layer._domObject3D);\n this._engine._domScene2D.remove(layer._domObject2D);\n }\n\n this.emit('layerRemoved');\n return this;\n }\n\n addControls(controls) {\n controls._addToWorld(this);\n\n this._controls.push(controls);\n\n this.emit('controlsAdded', controls);\n return this;\n }\n\n // Remove controls from world but don't destroy them entirely\n removeControls(controls) {\n var controlsIndex = this._controls.indexOf(controlsIndex);\n\n if (controlsIndex > -1) {\n this._controls.splice(controlsIndex, 1);\n };\n\n this.emit('controlsRemoved', controls);\n return this;\n }\n\n stop() {\n this._pause = true;\n }\n\n start() {\n this._pause = false;\n this._update();\n }\n\n // Destroys the world(!) and removes it from the scene and memory\n //\n // TODO: World out why so much three.js stuff is left in the heap after this\n destroy() {\n this.stop();\n\n // Remove listeners\n this.off('controlsMoveEnd', this._onControlsMoveEnd);\n\n var i;\n\n // Remove all controls\n var controls;\n for (i = this._controls.length - 1; i >= 0; i--) {\n controls = this._controls[0];\n this.removeControls(controls);\n controls.destroy();\n };\n\n // Remove all layers\n var layer;\n for (i = this._layers.length - 1; i >= 0; i--) {\n layer = this._layers[0];\n this.removeLayer(layer);\n layer.destroy();\n };\n\n // Environment layer is removed with the other layers\n this._environment = null;\n\n this._engine.destroy();\n this._engine = null;\n\n // TODO: Probably should clean the container too / remove the canvas\n this._container = null;\n }\n}\n\nexport default World;\n\nvar noNew = function(domId, options) {\n return new World(domId, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as world};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/World.js\n **/","'use strict';\n\n//\n// We store our EE objects in a plain object whose properties are event names.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// `~` to make sure that the built-in object properties are not overridden or\n// used as an attack vector.\n// We also assume that `Object.create(null)` is available when the event name\n// is an ES6 Symbol.\n//\nvar prefix = typeof Object.create !== 'function' ? '~' : false;\n\n/**\n * Representation of a single EventEmitter function.\n *\n * @param {Function} fn Event handler to be called.\n * @param {Mixed} context Context for function execution.\n * @param {Boolean} once Only emit once\n * @api private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Minimal EventEmitter interface that is molded against the Node.js\n * EventEmitter interface.\n *\n * @constructor\n * @api public\n */\nfunction EventEmitter() { /* Nothing to set */ }\n\n/**\n * Holds the assigned EventEmitters by name.\n *\n * @type {Object}\n * @private\n */\nEventEmitter.prototype._events = undefined;\n\n/**\n * Return a list of assigned event listeners.\n *\n * @param {String} event The events that should be listed.\n * @param {Boolean} exists We only need to know if there are listeners.\n * @returns {Array|Boolean}\n * @api public\n */\nEventEmitter.prototype.listeners = function listeners(event, exists) {\n var evt = prefix ? prefix + event : event\n , available = this._events && this._events[evt];\n\n if (exists) return !!available;\n if (!available) return [];\n if (available.fn) return [available.fn];\n\n for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n ee[i] = available[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Emit an event to all registered event listeners.\n *\n * @param {String} event The name of the event.\n * @returns {Boolean} Indication if we've emitted an event.\n * @api public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events || !this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if ('function' === typeof listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Register a new EventListener for the given event.\n *\n * @param {String} event Name of the event.\n * @param {Functon} fn Callback function.\n * @param {Mixed} context The context of the function.\n * @api public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n var listener = new EE(fn, context || this)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events) this._events = prefix ? {} : Object.create(null);\n if (!this._events[evt]) this._events[evt] = listener;\n else {\n if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [\n this._events[evt], listener\n ];\n }\n\n return this;\n};\n\n/**\n * Add an EventListener that's only called once.\n *\n * @param {String} event Name of the event.\n * @param {Function} fn Callback function.\n * @param {Mixed} context The context of the function.\n * @api public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n var listener = new EE(fn, context || this, true)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events) this._events = prefix ? {} : Object.create(null);\n if (!this._events[evt]) this._events[evt] = listener;\n else {\n if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [\n this._events[evt], listener\n ];\n }\n\n return this;\n};\n\n/**\n * Remove event listeners.\n *\n * @param {String} event The event we want to remove.\n * @param {Function} fn The listener that we need to find.\n * @param {Mixed} context Only remove listeners matching this context.\n * @param {Boolean} once Only remove once listeners.\n * @api public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events || !this._events[evt]) return this;\n\n var listeners = this._events[evt]\n , events = [];\n\n if (fn) {\n if (listeners.fn) {\n if (\n listeners.fn !== fn\n || (once && !listeners.once)\n || (context && listeners.context !== context)\n ) {\n events.push(listeners);\n }\n } else {\n for (var i = 0, length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn\n || (once && !listeners[i].once)\n || (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) {\n this._events[evt] = events.length === 1 ? events[0] : events;\n } else {\n delete this._events[evt];\n }\n\n return this;\n};\n\n/**\n * Remove all listeners or only the listeners for the specified event.\n *\n * @param {String} event The event want to remove all listeners for.\n * @api public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n if (!this._events) return this;\n\n if (event) delete this._events[prefix ? prefix + event : event];\n else this._events = prefix ? {} : Object.create(null);\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// This function doesn't apply anymore.\n//\nEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n return this;\n};\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/eventemitter3/index.js\n ** module id = 2\n ** module chunks = 0\n **/","/**\n * lodash 4.0.2 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar keys = require('lodash.keys'),\n rest = require('lodash.rest');\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if ((!eq(objValue, value) ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object) {\n return copyObjectWith(source, props, object);\n}\n\n/**\n * This function is like `copyObject` except that it accepts a function to\n * customize copied values.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObjectWith(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index],\n newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key];\n\n assignValue(object, key, newValue);\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return rest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = typeof customizer == 'function' ? (length--, customizer) : undefined;\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Checks if the provided arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'user': 'fred' };\n * var other = { 'user': 'fred' };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null &&\n !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Assigns own enumerable properties of source objects to the destination\n * object. Source objects are applied from left to right. Subsequent sources\n * overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.c = 3;\n * }\n *\n * function Bar() {\n * this.e = 5;\n * }\n *\n * Foo.prototype.d = 4;\n * Bar.prototype.f = 6;\n *\n * _.assign({ 'a': 1 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3, 'e': 5 }\n */\nvar assign = createAssigner(function(object, source) {\n copyObject(source, keys(source), object);\n});\n\nmodule.exports = assign;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.assign/index.js\n ** module id = 3\n ** module chunks = 0\n **/","/**\n * lodash 4.0.2 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n stringTag = '[object String]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar getPrototypeOf = Object.getPrototypeOf,\n propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = Object.keys;\n\n/**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHas(object, key) {\n // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,\n // that are composed entirely of index properties, return `false` for\n // `hasOwnProperty` checks of them.\n return hasOwnProperty.call(object, key) ||\n (typeof object == 'object' && key in object && getPrototypeOf(object) === null);\n}\n\n/**\n * The base implementation of `_.keys` which doesn't skip the constructor\n * property of prototypes or treat sparse arrays as dense.\n *\n * @private\n * @type Function\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n return nativeKeys(Object(object));\n}\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Creates an array of index keys for `object` values of arrays,\n * `arguments` objects, and strings, otherwise `null` is returned.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array|null} Returns index keys, else `null`.\n */\nfunction indexKeys(object) {\n var length = object ? object.length : undefined;\n if (isLength(length) &&\n (isArray(object) || isString(object) || isArguments(object))) {\n return baseTimes(length, String);\n }\n return null;\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null &&\n !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n var isProto = isPrototype(object);\n if (!(isProto || isArrayLike(object))) {\n return baseKeys(object);\n }\n var indexes = indexKeys(object),\n skipIndexes = !!indexes,\n result = indexes || [],\n length = result.length;\n\n for (var key in object) {\n if (baseHas(object, key) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length))) &&\n !(isProto && key == 'constructor')) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = keys;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.keys/index.js\n ** module id = 4\n ** module chunks = 0\n **/","/**\n * lodash 4.0.1 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308,\n NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {...*} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n var length = args.length;\n switch (length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as an array.\n *\n * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.rest(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\nfunction rest(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n switch (start) {\n case 0: return func.call(this, array);\n case 1: return func.call(this, args[0], array);\n case 2: return func.call(this, args[0], args[1], array);\n }\n var otherArgs = Array(start + 1);\n index = -1;\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = array;\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3');\n * // => 3\n */\nfunction toInteger(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n var remainder = value % 1;\n return value === value ? (remainder ? value - remainder : value) : 0;\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3);\n * // => 3\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3');\n * // => 3\n */\nfunction toNumber(value) {\n if (isObject(value)) {\n var other = isFunction(value.valueOf) ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = rest;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.rest/index.js\n ** module id = 5\n ** module chunks = 0\n **/","import EPSG3857 from './CRS.EPSG3857';\nimport {EPSG900913} from './CRS.EPSG3857';\nimport EPSG3395 from './CRS.EPSG3395';\nimport EPSG4326 from './CRS.EPSG4326';\nimport Simple from './CRS.Simple';\nimport Proj4 from './CRS.Proj4';\n\nconst CRS = {};\n\nCRS.EPSG3857 = EPSG3857;\nCRS.EPSG900913 = EPSG900913;\nCRS.EPSG3395 = EPSG3395;\nCRS.EPSG4326 = EPSG4326;\nCRS.Simple = Simple;\nCRS.Proj4 = Proj4;\n\nexport default CRS;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/index.js\n **/","/*\n * CRS.EPSG3857 (WGS 84 / Pseudo-Mercator) CRS implementation.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3857.js\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport SphericalMercator from '../projection/Projection.SphericalMercator';\nimport Transformation from '../../util/Transformation';\n\nvar _EPSG3857 = {\n code: 'EPSG:3857',\n projection: SphericalMercator,\n\n // Work out how to de-dupe this (scoping issue)\n transformScale: 1 / (Math.PI * SphericalMercator.R),\n\n // Scale and transformation inputs changed to account for central origin in\n // WebGL, instead of top-left origin used in Leaflet\n transformation: (function() {\n // TODO: Cannot use this.transformScale due to scope\n var scale = 1 / (Math.PI * SphericalMercator.R);\n\n return new Transformation(scale, 0, -scale, 0);\n }())\n};\n\nconst EPSG3857 = extend({}, Earth, _EPSG3857);\n\nconst EPSG900913 = extend({}, EPSG3857, {\n code: 'EPSG:900913'\n});\n\nexport {EPSG900913};\n\nexport default EPSG3857;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.EPSG3857.js\n **/","/*\n * CRS.Earth is the base class for all CRS representing Earth.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Earth.js\n */\n\nimport extend from 'lodash.assign';\nimport CRS from './CRS';\nimport {latLon as LatLon} from '../LatLon';\n\nconst Earth = {\n wrapLon: [-180, 180],\n\n R: 6378137,\n\n // Distance between two geographical points using spherical law of cosines\n // approximation or Haversine\n //\n // See: http://www.movable-type.co.uk/scripts/latlong.html\n distance: function(latlon1, latlon2, accurate) {\n var rad = Math.PI / 180;\n\n var lat1;\n var lat2;\n\n var a;\n\n if (!accurate) {\n lat1 = latlon1.lat * rad;\n lat2 = latlon2.lat * rad;\n\n a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((latlon2.lon - latlon1.lon) * rad);\n\n return this.R * Math.acos(Math.min(a, 1));\n } else {\n lat1 = latlon1.lat * rad;\n lat2 = latlon2.lat * rad;\n\n var lon1 = latlon1.lon * rad;\n var lon2 = latlon2.lon * rad;\n\n var deltaLat = lat2 - lat1;\n var deltaLon = lon2 - lon1;\n\n var halfDeltaLat = deltaLat / 2;\n var halfDeltaLon = deltaLon / 2;\n\n a = Math.sin(halfDeltaLat) * Math.sin(halfDeltaLat) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(halfDeltaLon) * Math.sin(halfDeltaLon);\n\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\n return this.R * c;\n }\n },\n\n // Scale factor for converting between real metres and projected metres\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n //\n // Defaults to a scale factor of 1 if no calculation method exists\n //\n // Probably need to run this through the CRS transformation or similar so the\n // resulting scale is relative to the dimensions of the world space\n // Eg. 1 metre in projected space is likly scaled up or down to some other\n // number\n pointScale: function(latlon, accurate) {\n return (this.projection.pointScale) ? this.projection.pointScale(latlon, accurate) : [1, 1];\n },\n\n // Convert real metres to projected units\n //\n // Latitude scale is chosen because it fluctuates more than longitude\n metresToProjected: function(metres, pointScale) {\n return metres * pointScale[1];\n },\n\n // Convert projected units to real metres\n //\n // Latitude scale is chosen because it fluctuates more than longitude\n projectedToMetres: function(projectedUnits, pointScale) {\n return projectedUnits / pointScale[1];\n },\n\n // Convert real metres to a value in world (WebGL) units\n metresToWorld: function(metres, pointScale, zoom) {\n // Transform metres to projected metres using the latitude point scale\n //\n // Latitude scale is chosen because it fluctuates more than longitude\n var projectedMetres = this.metresToProjected(metres, pointScale);\n\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n // Scale projected metres\n var scaledMetres = (scale * (this.transformScale * projectedMetres));\n\n // Not entirely sure why this is neccessary\n if (zoom) {\n scaledMetres /= pointScale[1];\n }\n\n return scaledMetres;\n },\n\n // Convert world (WebGL) units to a value in real metres\n worldToMetres: function(worldUnits, pointScale, zoom) {\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n var projectedUnits = ((worldUnits / scale) / this.transformScale);\n var realMetres = this.projectedToMetres(projectedUnits, pointScale);\n\n // Not entirely sure why this is neccessary\n if (zoom) {\n realMetres *= pointScale[1];\n }\n\n return realMetres;\n }\n};\n\nexport default extend({}, CRS, Earth);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.Earth.js\n **/","/*\n * CRS is the base object for all defined CRS (Coordinate Reference Systems)\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\nimport wrapNum from '../../util/wrapNum';\n\nconst CRS = {\n // Scale factor determines final dimensions of world space\n //\n // Projection transformation in range -1 to 1 is multiplied by scale factor to\n // find final world coordinates\n //\n // Scale factor can be considered as half the amount of the desired dimension\n // for the largest side when transformation is equal to 1 or -1, or as the\n // distance between 0 and 1 on the largest side\n //\n // For example, if you want the world dimensions to be between -1000 and 1000\n // then the scale factor will be 1000\n scaleFactor: 1000000,\n\n // Converts geo coords to pixel / WebGL ones\n latLonToPoint: function(latlon, zoom) {\n var projectedPoint = this.projection.project(latlon);\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n return this.transformation._transform(projectedPoint, scale);\n },\n\n // Converts pixel / WebGL coords to geo coords\n pointToLatLon: function(point, zoom) {\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n var untransformedPoint = this.transformation.untransform(point, scale);\n\n return this.projection.unproject(untransformedPoint);\n },\n\n // Converts geo coords to projection-specific coords (e.g. in meters)\n project: function(latlon) {\n return this.projection.project(latlon);\n },\n\n // Converts projected coords to geo coords\n unproject: function(point) {\n return this.projection.unproject(point);\n },\n\n // If zoom is provided, returns the map width in pixels for a given zoom\n // Else, provides fixed scale value\n scale: function(zoom) {\n // If zoom is provided then return scale based on map tile zoom\n if (zoom >= 0) {\n return 256 * Math.pow(2, zoom);\n // Else, return fixed scale value to expand projected coordinates from\n // their 0 to 1 range into something more practical\n } else {\n return this.scaleFactor;\n }\n },\n\n // Returns zoom level for a given scale value\n // This only works with a scale value that is based on map pixel width\n zoom: function(scale) {\n return Math.log(scale / 256) / Math.LN2;\n },\n\n // Returns the bounds of the world in projected coords if applicable\n getProjectedBounds: function(zoom) {\n if (this.infinite) { return null; }\n\n var b = this.projection.bounds;\n var s = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n s /= 2;\n }\n\n // Bottom left\n var min = this.transformation.transform(Point(b[0]), s);\n\n // Top right\n var max = this.transformation.transform(Point(b[1]), s);\n\n return [min, max];\n },\n\n // Whether a coordinate axis wraps in a given range (e.g. longitude from -180 to 180); depends on CRS\n // wrapLon: [min, max],\n // wrapLat: [min, max],\n\n // If true, the coordinate space will be unbounded (infinite in all directions)\n // infinite: false,\n\n // Wraps geo coords in certain ranges if applicable\n wrapLatLon: function(latlon) {\n var lat = this.wrapLat ? wrapNum(latlon.lat, this.wrapLat, true) : latlon.lat;\n var lon = this.wrapLon ? wrapNum(latlon.lon, this.wrapLon, true) : latlon.lon;\n var alt = latlon.alt;\n\n return LatLon(lat, lon, alt);\n }\n};\n\nexport default CRS;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.js\n **/","/*\n * LatLon is a helper class for ensuring consistent geographic coordinates.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/LatLng.js\n */\n\nclass LatLon {\n constructor(lat, lon, alt) {\n if (isNaN(lat) || isNaN(lon)) {\n throw new Error('Invalid LatLon object: (' + lat + ', ' + lon + ')');\n }\n\n this.lat = +lat;\n this.lon = +lon;\n\n if (alt !== undefined) {\n this.alt = +alt;\n }\n }\n\n clone() {\n return new LatLon(this.lat, this.lon, this.alt);\n }\n}\n\nexport default LatLon;\n\n// Accepts (LatLon), ([lat, lon, alt]), ([lat, lon]) and (lat, lon, alt)\n// Also converts between lng and lon\nvar noNew = function(a, b, c) {\n if (a instanceof LatLon) {\n return a;\n }\n if (Array.isArray(a) && typeof a[0] !== 'object') {\n if (a.length === 3) {\n return new LatLon(a[0], a[1], a[2]);\n }\n if (a.length === 2) {\n return new LatLon(a[0], a[1]);\n }\n return null;\n }\n if (a === undefined || a === null) {\n return a;\n }\n if (typeof a === 'object' && 'lat' in a) {\n return new LatLon(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\n }\n if (b === undefined) {\n return null;\n }\n return new LatLon(a, b, c);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as latLon};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/LatLon.js\n **/","/*\n * Point is a helper class for ensuring consistent world positions.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/Point.js\n */\n\nclass Point {\n constructor(x, y, round) {\n this.x = (round ? Math.round(x) : x);\n this.y = (round ? Math.round(y) : y);\n }\n\n clone() {\n return new Point(this.x, this.y);\n }\n\n // Non-destructive\n add(point) {\n return this.clone()._add(_point(point));\n }\n\n // Destructive\n _add(point) {\n this.x += point.x;\n this.y += point.y;\n return this;\n }\n\n // Non-destructive\n subtract(point) {\n return this.clone()._subtract(_point(point));\n }\n\n // Destructive\n _subtract(point) {\n this.x -= point.x;\n this.y -= point.y;\n return this;\n }\n}\n\nexport default Point;\n\n// Accepts (point), ([x, y]) and (x, y, round)\nvar _point = function(x, y, round) {\n if (x instanceof Point) {\n return x;\n }\n if (Array.isArray(x)) {\n return new Point(x[0], x[1]);\n }\n if (x === undefined || x === null) {\n return x;\n }\n return new Point(x, y, round);\n};\n\n// Initialise without requiring new keyword\nexport {_point as point};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/Point.js\n **/","/*\n * Wrap the given number to lie within a certain range (eg. longitude)\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/core/Util.js\n */\n\nvar wrapNum = function(x, range, includeMax) {\n var max = range[1];\n var min = range[0];\n var d = max - min;\n return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\n};\n\nexport default wrapNum;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/wrapNum.js\n **/","/*\n * Spherical Mercator is the most popular map projection, used by EPSG:3857 CRS\n * used by default.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.SphericalMercator.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst SphericalMercator = {\n // Radius / WGS84 semi-major axis\n R: 6378137,\n MAX_LATITUDE: 85.0511287798,\n\n // WGS84 eccentricity\n ECC: 0.081819191,\n ECC2: 0.081819191 * 0.081819191,\n\n project: function(latlon) {\n var d = Math.PI / 180;\n var max = this.MAX_LATITUDE;\n var lat = Math.max(Math.min(max, latlon.lat), -max);\n var sin = Math.sin(lat * d);\n\n return Point(\n this.R * latlon.lon * d,\n this.R * Math.log((1 + sin) / (1 - sin)) / 2\n );\n },\n\n unproject: function(point) {\n var d = 180 / Math.PI;\n\n return LatLon(\n (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d,\n point.x * d / this.R\n );\n },\n\n // Scale factor for converting between real metres and projected metres\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n //\n // Accurate scale factor uses proper Web Mercator scaling\n // See pg.9: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n // See: http://jsfiddle.net/robhawkes/yws924cf/\n pointScale: function(latlon, accurate) {\n var rad = Math.PI / 180;\n\n var k;\n\n if (!accurate) {\n k = 1 / Math.cos(latlon.lat * rad);\n\n // [scaleX, scaleY]\n return [k, k];\n } else {\n var lat = latlon.lat * rad;\n var lon = latlon.lon * rad;\n\n var a = this.R;\n\n var sinLat = Math.sin(lat);\n var sinLat2 = sinLat * sinLat;\n\n var cosLat = Math.cos(lat);\n\n // Radius meridian\n var p = a * (1 - this.ECC2) / Math.pow(1 - this.ECC2 * sinLat2, 3 / 2);\n\n // Radius prime meridian\n var v = a / Math.sqrt(1 - this.ECC2 * sinLat2);\n\n // Scale N/S\n var h = (a / p) / cosLat;\n\n // Scale E/W\n k = (a / v) / cosLat;\n\n // [scaleX, scaleY]\n return [k, h];\n }\n },\n\n // Not using this.R due to scoping\n bounds: (function() {\n var d = 6378137 * Math.PI;\n return [[-d, -d], [d, d]];\n })()\n};\n\nexport default SphericalMercator;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.SphericalMercator.js\n **/","/*\n * Transformation is an utility class to perform simple point transformations\n * through a 2d-matrix.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geometry/Transformation.js\n */\n\nimport {point as Point} from '../geo/Point';\n\nclass Transformation {\n constructor(a, b, c, d) {\n this._a = a;\n this._b = b;\n this._c = c;\n this._d = d;\n }\n\n transform(point, scale) {\n // Copy input point as to not destroy the original data\n return this._transform(point.clone(), scale);\n }\n\n // Destructive transform (faster)\n _transform(point, scale) {\n scale = scale || 1;\n\n point.x = scale * (this._a * point.x + this._b);\n point.y = scale * (this._c * point.y + this._d);\n return point;\n }\n\n untransform(point, scale) {\n scale = scale || 1;\n return Point(\n (point.x / scale - this._b) / this._a,\n (point.y / scale - this._d) / this._c\n );\n }\n}\n\nexport default Transformation;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/Transformation.js\n **/","/*\n * CRS.EPSG3395 (WGS 84 / World Mercator) CRS implementation.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3395.js\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport Mercator from '../projection/Projection.Mercator';\nimport Transformation from '../../util/Transformation';\n\nvar _EPSG3395 = {\n code: 'EPSG:3395',\n projection: Mercator,\n\n // Work out how to de-dupe this (scoping issue)\n transformScale: 1 / (Math.PI * Mercator.R),\n\n // Scale and transformation inputs changed to account for central origin in\n // WebGL, instead of top-left origin used in Leaflet\n transformation: (function() {\n // TODO: Cannot use this.transformScale due to scope\n var scale = 1 / (Math.PI * Mercator.R);\n\n return new Transformation(scale, 0, -scale, 0);\n }())\n};\n\nconst EPSG3395 = extend({}, Earth, _EPSG3395);\n\nexport default EPSG3395;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.EPSG3395.js\n **/","/*\n * Mercator projection that takes into account that the Earth is not a perfect\n * sphere. Less popular than spherical mercator; used by projections like\n * EPSG:3395.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.Mercator.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst Mercator = {\n // Radius / WGS84 semi-major axis\n R: 6378137,\n R_MINOR: 6356752.314245179,\n\n // WGS84 eccentricity\n ECC: 0.081819191,\n ECC2: 0.081819191 * 0.081819191,\n\n project: function(latlon) {\n var d = Math.PI / 180;\n var r = this.R;\n var y = latlon.lat * d;\n var tmp = this.R_MINOR / r;\n var e = Math.sqrt(1 - tmp * tmp);\n var con = e * Math.sin(y);\n\n var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);\n y = -r * Math.log(Math.max(ts, 1E-10));\n\n return Point(latlon.lon * d * r, y);\n },\n\n unproject: function(point) {\n var d = 180 / Math.PI;\n var r = this.R;\n var tmp = this.R_MINOR / r;\n var e = Math.sqrt(1 - tmp * tmp);\n var ts = Math.exp(-point.y / r);\n var phi = Math.PI / 2 - 2 * Math.atan(ts);\n\n for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {\n con = e * Math.sin(phi);\n con = Math.pow((1 - con) / (1 + con), e / 2);\n dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;\n phi += dphi;\n }\n\n return LatLon(phi * d, point.x * d / r);\n },\n\n // Scale factor for converting between real metres and projected metres\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n //\n // See pg.8: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n pointScale: function(latlon) {\n var rad = Math.PI / 180;\n var lat = latlon.lat * rad;\n var sinLat = Math.sin(lat);\n var sinLat2 = sinLat * sinLat;\n var cosLat = Math.cos(lat);\n\n var k = Math.sqrt(1 - this.ECC2 * sinLat2) / cosLat;\n\n // [scaleX, scaleY]\n return [k, k];\n },\n\n bounds: [[-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]]\n};\n\nexport default Mercator;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.Mercator.js\n **/","/*\n * CRS.EPSG4326 is a CRS popular among advanced GIS specialists.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG4326.js\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport LatLonProjection from '../projection/Projection.LatLon';\nimport Transformation from '../../util/Transformation';\n\nvar _EPSG4326 = {\n code: 'EPSG:4326',\n projection: LatLonProjection,\n\n // Work out how to de-dupe this (scoping issue)\n transformScale: 1 / 180,\n\n // Scale and transformation inputs changed to account for central origin in\n // WebGL, instead of top-left origin used in Leaflet\n //\n // TODO: Cannot use this.transformScale due to scope\n transformation: new Transformation(1 / 180, 0, -1 / 180, 0)\n};\n\nconst EPSG4326 = extend({}, Earth, _EPSG4326);\n\nexport default EPSG4326;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.EPSG4326.js\n **/","/*\n * Simple equirectangular (Plate Carree) projection, used by CRS like EPSG:4326\n * and Simple.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.LonLat.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst ProjectionLatLon = {\n project: function(latlon) {\n return Point(latlon.lon, latlon.lat);\n },\n\n unproject: function(point) {\n return LatLon(point.y, point.x);\n },\n\n // Scale factor for converting between real metres and degrees\n //\n // degrees = realMetres * pointScale\n // realMetres = degrees / pointScale\n //\n // See: http://stackoverflow.com/questions/639695/how-to-convert-latitude-or-longitude-to-meters\n // See: http://gis.stackexchange.com/questions/75528/length-of-a-degree-where-do-the-terms-in-this-formula-come-from\n pointScale: function(latlon) {\n var m1 = 111132.92;\n var m2 = -559.82;\n var m3 = 1.175;\n var m4 = -0.0023;\n var p1 = 111412.84;\n var p2 = -93.5;\n var p3 = 0.118;\n\n var rad = Math.PI / 180;\n var lat = latlon.lat * rad;\n\n var latlen = m1 + m2 * Math.cos(2 * lat) + m3 * Math.cos(4 * lat) + m4 * Math.cos(6 * lat);\n var lonlen = p1 * Math.cos(lat) + p2 * Math.cos(3 * lat) + p3 * Math.cos(5 * lat);\n\n return [1 / latlen, 1 / lonlen];\n },\n\n bounds: [[-180, -90], [180, 90]]\n};\n\nexport default ProjectionLatLon;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.LatLon.js\n **/","/*\n * A simple CRS that can be used for flat non-Earth maps like panoramas or game\n * maps.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Simple.js\n */\n\nimport extend from 'lodash.assign';\nimport CRS from './CRS';\nimport LatLonProjection from '../projection/Projection.LatLon';\nimport Transformation from '../../util/Transformation';\n\nvar _Simple = {\n projection: LatLonProjection,\n\n // Straight 1:1 mapping (-1, -1 would be top-left)\n transformation: new Transformation(1, 0, 1, 0),\n\n scale: function(zoom) {\n // If zoom is provided then return scale based on map tile zoom\n if (zoom) {\n return Math.pow(2, zoom);\n // Else, make no change to scale – may need to increase this or make it a\n // user-definable variable\n } else {\n return 1;\n }\n },\n\n zoom: function(scale) {\n return Math.log(scale) / Math.LN2;\n },\n\n distance: function(latlon1, latlon2) {\n var dx = latlon2.lon - latlon1.lon;\n var dy = latlon2.lat - latlon1.lat;\n\n return Math.sqrt(dx * dx + dy * dy);\n },\n\n infinite: true\n};\n\nconst Simple = extend({}, CRS, _Simple);\n\nexport default Simple;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.Simple.js\n **/","/*\n * CRS.Proj4 for any Proj4-supported CRS.\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport Proj4Projection from '../projection/Projection.Proj4';\nimport Transformation from '../../util/Transformation';\n\nvar _Proj4 = function(code, def, bounds) {\n var projection = Proj4Projection(def, bounds);\n\n // Transformation calcuations\n var diffX = projection.bounds[1][0] - projection.bounds[0][0];\n var diffY = projection.bounds[1][1] - projection.bounds[0][1];\n\n var halfX = diffX / 2;\n var halfY = diffY / 2;\n\n // This is the raw scale factor\n var scaleX = 1 / halfX;\n var scaleY = 1 / halfY;\n\n // Find the minimum scale factor\n //\n // The minimum scale factor comes from the largest side and is the one\n // you want to use for both axis so they stay relative in dimension\n var scale = Math.min(scaleX, scaleY);\n\n // Find amount to offset each axis by to make the central point lie on\n // the [0,0] origin\n var offsetX = scale * (projection.bounds[0][0] + halfX);\n var offsetY = scale * (projection.bounds[0][1] + halfY);\n\n return {\n code: code,\n projection: projection,\n\n transformScale: scale,\n\n // Map the input to a [-1,1] range with [0,0] in the centre\n transformation: new Transformation(scale, -offsetX, -scale, offsetY)\n };\n};\n\nconst Proj4 = function(code, def, bounds) {\n return extend({}, Earth, _Proj4(code, def, bounds));\n};\n\nexport default Proj4;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.Proj4.js\n **/","/*\n * Proj4 support for any projection.\n */\n\nimport proj4 from 'proj4';\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst Proj4 = function(def, bounds) {\n var proj = proj4(def);\n\n var project = function(latlon) {\n return Point(proj.forward([latlon.lon, latlon.lat]));\n };\n\n var unproject = function(point) {\n var inverse = proj.inverse([point.x, point.y]);\n return LatLon(inverse[1], inverse[0]);\n };\n\n return {\n project: project,\n unproject: unproject,\n\n // Scale factor for converting between real metres and projected metres\\\n //\n // Need to work out the best way to provide the pointScale calculations\n // for custom, unknown projections (if wanting to override default)\n //\n // For now, user can manually override crs.pointScale or\n // crs.projection.pointScale\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n pointScale: function(latlon, accurate) {\n return [1, 1];\n },\n\n // Try and calculate bounds if none are provided\n //\n // This will provide incorrect bounds for some projections, so perhaps make\n // bounds a required input instead\n bounds: (function() {\n if (bounds) {\n return bounds;\n } else {\n var bottomLeft = project([-90, -180]);\n var topRight = project([90, 180]);\n\n return [bottomLeft, topRight];\n }\n })()\n };\n};\n\nexport default Proj4;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.Proj4.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_22__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"proj4\"\n ** module id = 22\n ** module chunks = 0\n **/","import EventEmitter from 'eventemitter3';\nimport THREE from 'three';\nimport Scene from './Scene';\nimport DOMScene3D from './DOMScene3D';\nimport DOMScene2D from './DOMScene2D';\nimport Renderer from './Renderer';\nimport DOMRenderer3D from './DOMRenderer3D';\nimport DOMRenderer2D from './DOMRenderer2D';\nimport Camera from './Camera';\nimport Picking from './Picking';\nimport EffectComposer from './EffectComposer';\nimport RenderPass from '../vendor/RenderPass';\nimport ShaderPass from '../vendor/ShaderPass';\nimport CopyShader from '../vendor/CopyShader';\nimport HorizontalTiltShiftShader from '../vendor/HorizontalTiltShiftShader';\nimport VerticalTiltShiftShader from '../vendor/VerticalTiltShiftShader';\nimport FXAAShader from '../vendor/FXAAShader';\n\nclass Engine extends EventEmitter {\n constructor(container, world) {\n console.log('Init Engine');\n\n super();\n\n this._world = world;\n\n this._scene = Scene;\n this._domScene3D = DOMScene3D;\n this._domScene2D = DOMScene2D;\n\n var antialias = (this._world.options.postProcessing) ? false : true;\n this._renderer = Renderer(container, antialias);\n this._domRenderer3D = DOMRenderer3D(container);\n this._domRenderer2D = DOMRenderer2D(container);\n\n this._camera = Camera(container);\n\n this._container = container;\n\n // TODO: Make this optional\n this._picking = Picking(this._world, this._renderer, this._camera);\n\n this.clock = new THREE.Clock();\n\n this._frustum = new THREE.Frustum();\n\n if (this._world.options.postProcessing) {\n this._initPostProcessing();\n }\n }\n\n // TODO: Set up composer to automatically resize on viewport change\n // TODO: Update passes that rely on width / height on resize\n // TODO: Merge default passes into a single shader / pass for performance\n _initPostProcessing() {\n var renderPass = new RenderPass(this._scene, this._camera);\n\n // TODO: Look at using @mattdesl's optimised FXAA shader\n // https://github.com/mattdesl/three-shader-fxaa\n var fxaaPass = new ShaderPass(FXAAShader);\n\n var hblurPass = new ShaderPass(HorizontalTiltShiftShader);\n var vblurPass = new ShaderPass(VerticalTiltShiftShader);\n var bluriness = 5;\n\n hblurPass.uniforms.r.value = vblurPass.uniforms.r.value = 0.6;\n\n var copyPass = new ShaderPass(CopyShader);\n copyPass.renderToScreen = true;\n\n this._composer = EffectComposer(this._renderer, this._container);\n\n this._composer.addPass(renderPass);\n this._composer.addPass(fxaaPass);\n this._composer.addPass(hblurPass);\n this._composer.addPass(vblurPass);\n this._composer.addPass(copyPass);\n\n var self = this;\n var updatePostProcessingSize = function() {\n var width = self._container.clientWidth;\n var height = self._container.clientHeight;\n\n var pixelRatio = window.devicePixelRatio;\n\n fxaaPass.uniforms.resolution.value.set(1 / (width * pixelRatio), 1 / (height * pixelRatio));\n\n hblurPass.uniforms.h.value = bluriness / (width * pixelRatio);\n vblurPass.uniforms.v.value = bluriness / (height * pixelRatio);\n };\n\n updatePostProcessingSize();\n window.addEventListener('resize', updatePostProcessingSize, false);\n }\n\n update(delta) {\n this.emit('preRender');\n\n if (this._world.options.postProcessing) {\n this._composer.render(delta);\n } else {\n this._renderer.render(this._scene, this._camera);\n }\n\n // Render picking scene\n // this._renderer.render(this._picking._pickingScene, this._camera);\n\n // Render DOM scenes\n this._domRenderer3D.render(this._domScene3D, this._camera);\n this._domRenderer2D.render(this._domScene2D, this._camera);\n\n this.emit('postRender');\n }\n\n destroy() {\n // Remove any remaining objects from scene\n var child;\n for (var i = this._scene.children.length - 1; i >= 0; i--) {\n child = this._scene.children[i];\n\n if (!child) {\n continue;\n }\n\n this._scene.remove(child);\n\n if (child.geometry) {\n // Dispose of mesh and materials\n child.geometry.dispose();\n child.geometry = null;\n }\n\n if (child.material) {\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n }\n };\n\n for (var i = this._domScene3D.children.length - 1; i >= 0; i--) {\n child = this._domScene3D.children[i];\n\n if (!child) {\n continue;\n }\n\n this._domScene3D.remove(child);\n };\n\n for (var i = this._domScene2D.children.length - 1; i >= 0; i--) {\n child = this._domScene2D.children[i];\n\n if (!child) {\n continue;\n }\n\n this._domScene2D.remove(child);\n };\n\n this._picking.destroy();\n this._picking = null;\n\n this._world = null;\n this._scene = null;\n this._domScene3D = null;\n this._domScene2D = null;\n\n this._composer = null;\n this._renderer = null;\n\n this._domRenderer3D = null;\n this._domRenderer2D = null;\n this._camera = null;\n this._clock = null;\n this._frustum = null;\n }\n}\n\nexport default Engine;\n\n// // Initialise without requiring new keyword\n// export default function(container, world) {\n// return new Engine(container, world);\n// };\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Engine.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_24__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"THREE\"\n ** module id = 24\n ** module chunks = 0\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.scene\n\nexport default (function() {\n var scene = new THREE.Scene();\n\n // TODO: Re-enable when this works with the skybox\n // scene.fog = new THREE.Fog(0xffffff, 1, 15000);\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Scene.js\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.scene\n\nexport default (function() {\n var scene = new THREE.Scene();\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMScene3D.js\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.scene\n\nexport default (function() {\n var scene = new THREE.Scene();\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMScene2D.js\n **/","import THREE from 'three';\nimport Scene from './Scene';\n\n// This can only be accessed from Engine.renderer if you want to reference the\n// same scene in multiple places\n\nexport default function(container, antialias) {\n var renderer = new THREE.WebGLRenderer({\n antialias: antialias\n });\n\n // TODO: Re-enable when this works with the skybox\n // renderer.setClearColor(Scene.fog.color, 1);\n\n renderer.setClearColor(0xffffff, 1);\n renderer.setPixelRatio(window.devicePixelRatio);\n\n // Gamma settings make things look nicer\n renderer.gammaInput = true;\n renderer.gammaOutput = true;\n\n renderer.shadowMap.enabled = true;\n\n // TODO: Work out which of the shadowmap types is best\n // https://github.com/mrdoob/three.js/blob/r56/src/Three.js#L107\n // renderer.shadowMap.type = THREE.PCFSoftShadowMap;\n\n // TODO: Check that leaving this as default (CullFrontFace) is right\n // renderer.shadowMap.cullFace = THREE.CullFaceBack;\n\n container.appendChild(renderer.domElement);\n\n var updateSize = function() {\n renderer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return renderer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Renderer.js\n **/","import THREE from 'three';\nimport {CSS3DRenderer} from '../vendor/CSS3DRenderer';\nimport DOMScene3D from './DOMScene3D';\n\n// This can only be accessed from Engine.renderer if you want to reference the\n// same scene in multiple places\n\nexport default function(container) {\n var renderer = new CSS3DRenderer();\n\n renderer.domElement.style.position = 'absolute';\n renderer.domElement.style.top = 0;\n\n container.appendChild(renderer.domElement);\n\n var updateSize = function() {\n renderer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return renderer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMRenderer3D.js\n **/","// jscs:disable\n/* eslint-disable */\n\n/**\n * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs\n * @author mrdoob / http://mrdoob.com/\n */\n\nimport THREE from 'three';\n\nvar CSS3DObject = function ( element ) {\n\n\tTHREE.Object3D.call( this );\n\n\tthis.element = element;\n\tthis.element.style.position = 'absolute';\n\n\tthis.addEventListener( 'removed', function ( event ) {\n\n\t\tif ( this.element.parentNode !== null ) {\n\n\t\t\tthis.element.parentNode.removeChild( this.element );\n\n\t\t}\n\n\t} );\n\n};\n\nCSS3DObject.prototype = Object.create( THREE.Object3D.prototype );\nCSS3DObject.prototype.constructor = CSS3DObject;\n\nvar CSS3DSprite = function ( element ) {\n\n\tCSS3DObject.call( this, element );\n\n};\n\nCSS3DSprite.prototype = Object.create( CSS3DObject.prototype );\nCSS3DSprite.prototype.constructor = CSS3DSprite;\n\n//\n\nvar CSS3DRenderer = function () {\n\n\tconsole.log( 'THREE.CSS3DRenderer', THREE.REVISION );\n\n\tvar _width, _height;\n\tvar _widthHalf, _heightHalf;\n\n\tvar matrix = new THREE.Matrix4();\n\n\tvar cache = {\n\t\tcamera: { fov: 0, style: '' },\n\t\tobjects: {}\n\t};\n\n\tvar domElement = document.createElement( 'div' );\n\tdomElement.style.overflow = 'hidden';\n\n\tdomElement.style.WebkitTransformStyle = 'preserve-3d';\n\tdomElement.style.MozTransformStyle = 'preserve-3d';\n\tdomElement.style.oTransformStyle = 'preserve-3d';\n\tdomElement.style.transformStyle = 'preserve-3d';\n\n\tthis.domElement = domElement;\n\n\tvar cameraElement = document.createElement( 'div' );\n\n\tcameraElement.style.WebkitTransformStyle = 'preserve-3d';\n\tcameraElement.style.MozTransformStyle = 'preserve-3d';\n\tcameraElement.style.oTransformStyle = 'preserve-3d';\n\tcameraElement.style.transformStyle = 'preserve-3d';\n\n\tdomElement.appendChild( cameraElement );\n\n\tthis.setClearColor = function () {};\n\n\tthis.getSize = function() {\n\n\t\treturn {\n\t\t\twidth: _width,\n\t\t\theight: _height\n\t\t};\n\n\t};\n\n\tthis.setSize = function ( width, height ) {\n\n\t\t_width = width;\n\t\t_height = height;\n\n\t\t_widthHalf = _width / 2;\n\t\t_heightHalf = _height / 2;\n\n\t\tdomElement.style.width = width + 'px';\n\t\tdomElement.style.height = height + 'px';\n\n\t\tcameraElement.style.width = width + 'px';\n\t\tcameraElement.style.height = height + 'px';\n\n\t};\n\n\tvar epsilon = function ( value ) {\n\n\t\treturn Math.abs( value ) < Number.EPSILON ? 0 : value;\n\n\t};\n\n\tvar getCameraCSSMatrix = function ( matrix ) {\n\n\t\tvar elements = matrix.elements;\n\n\t\treturn 'matrix3d(' +\n\t\t\tepsilon( elements[ 0 ] ) + ',' +\n\t\t\tepsilon( - elements[ 1 ] ) + ',' +\n\t\t\tepsilon( elements[ 2 ] ) + ',' +\n\t\t\tepsilon( elements[ 3 ] ) + ',' +\n\t\t\tepsilon( elements[ 4 ] ) + ',' +\n\t\t\tepsilon( - elements[ 5 ] ) + ',' +\n\t\t\tepsilon( elements[ 6 ] ) + ',' +\n\t\t\tepsilon( elements[ 7 ] ) + ',' +\n\t\t\tepsilon( elements[ 8 ] ) + ',' +\n\t\t\tepsilon( - elements[ 9 ] ) + ',' +\n\t\t\tepsilon( elements[ 10 ] ) + ',' +\n\t\t\tepsilon( elements[ 11 ] ) + ',' +\n\t\t\tepsilon( elements[ 12 ] ) + ',' +\n\t\t\tepsilon( - elements[ 13 ] ) + ',' +\n\t\t\tepsilon( elements[ 14 ] ) + ',' +\n\t\t\tepsilon( elements[ 15 ] ) +\n\t\t')';\n\n\t};\n\n\tvar getObjectCSSMatrix = function ( matrix ) {\n\n\t\tvar elements = matrix.elements;\n\n\t\treturn 'translate3d(-50%,-50%,0) matrix3d(' +\n\t\t\tepsilon( elements[ 0 ] ) + ',' +\n\t\t\tepsilon( elements[ 1 ] ) + ',' +\n\t\t\tepsilon( elements[ 2 ] ) + ',' +\n\t\t\tepsilon( elements[ 3 ] ) + ',' +\n\t\t\tepsilon( - elements[ 4 ] ) + ',' +\n\t\t\tepsilon( - elements[ 5 ] ) + ',' +\n\t\t\tepsilon( - elements[ 6 ] ) + ',' +\n\t\t\tepsilon( - elements[ 7 ] ) + ',' +\n\t\t\tepsilon( elements[ 8 ] ) + ',' +\n\t\t\tepsilon( elements[ 9 ] ) + ',' +\n\t\t\tepsilon( elements[ 10 ] ) + ',' +\n\t\t\tepsilon( elements[ 11 ] ) + ',' +\n\t\t\tepsilon( elements[ 12 ] ) + ',' +\n\t\t\tepsilon( elements[ 13 ] ) + ',' +\n\t\t\tepsilon( elements[ 14 ] ) + ',' +\n\t\t\tepsilon( elements[ 15 ] ) +\n\t\t')';\n\n\t};\n\n\tvar renderObject = function ( object, camera ) {\n\n\t\tif ( object instanceof CSS3DObject ) {\n\n\t\t\tvar style;\n\n\t\t\tif ( object instanceof CSS3DSprite ) {\n\n\t\t\t\t// http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/\n\n\t\t\t\tmatrix.copy( camera.matrixWorldInverse );\n\t\t\t\tmatrix.transpose();\n\t\t\t\tmatrix.copyPosition( object.matrixWorld );\n\t\t\t\tmatrix.scale( object.scale );\n\n\t\t\t\tmatrix.elements[ 3 ] = 0;\n\t\t\t\tmatrix.elements[ 7 ] = 0;\n\t\t\t\tmatrix.elements[ 11 ] = 0;\n\t\t\t\tmatrix.elements[ 15 ] = 1;\n\n\t\t\t\tstyle = getObjectCSSMatrix( matrix );\n\n\t\t\t} else {\n\n\t\t\t\tstyle = getObjectCSSMatrix( object.matrixWorld );\n\n\t\t\t}\n\n\t\t\tvar element = object.element;\n\t\t\tvar cachedStyle = cache.objects[ object.id ];\n\n\t\t\tif ( cachedStyle === undefined || cachedStyle !== style ) {\n\n\t\t\t\telement.style.WebkitTransform = style;\n\t\t\t\telement.style.MozTransform = style;\n\t\t\t\telement.style.oTransform = style;\n\t\t\t\telement.style.transform = style;\n\n\t\t\t\tcache.objects[ object.id ] = style;\n\n\t\t\t}\n\n\t\t\tif ( element.parentNode !== cameraElement ) {\n\n\t\t\t\tcameraElement.appendChild( element );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( var i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( object.children[ i ], camera );\n\n\t\t}\n\n\t};\n\n\tthis.render = function ( scene, camera ) {\n\n\t\tvar fov = 0.5 / Math.tan( THREE.Math.degToRad( camera.fov * 0.5 ) ) * _height;\n\n\t\tif ( cache.camera.fov !== fov ) {\n\n\t\t\tdomElement.style.WebkitPerspective = fov + 'px';\n\t\t\tdomElement.style.MozPerspective = fov + 'px';\n\t\t\tdomElement.style.oPerspective = fov + 'px';\n\t\t\tdomElement.style.perspective = fov + 'px';\n\n\t\t\tcache.camera.fov = fov;\n\n\t\t}\n\n\t\tscene.updateMatrixWorld();\n\n\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\tcamera.matrixWorldInverse.getInverse( camera.matrixWorld );\n\n\t\tvar style = 'translate3d(0,0,' + fov + 'px)' + getCameraCSSMatrix( camera.matrixWorldInverse ) +\n\t\t\t' translate3d(' + _widthHalf + 'px,' + _heightHalf + 'px, 0)';\n\n\t\tif ( cache.camera.style !== style ) {\n\n\t\t\tcameraElement.style.WebkitTransform = style;\n\t\t\tcameraElement.style.MozTransform = style;\n\t\t\tcameraElement.style.oTransform = style;\n\t\t\tcameraElement.style.transform = style;\n\n\t\t\tcache.camera.style = style;\n\n\t\t}\n\n\t\trenderObject( scene, camera );\n\n\t};\n\n};\n\nexport {CSS3DObject as CSS3DObject};\nexport {CSS3DSprite as CSS3DSprite};\nexport {CSS3DRenderer as CSS3DRenderer};\n\nTHREE.CSS3DObject = CSS3DObject;\nTHREE.CSS3DSprite = CSS3DSprite;\nTHREE.CSS3DRenderer = CSS3DRenderer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/CSS3DRenderer.js\n **/","import THREE from 'three';\nimport {CSS2DRenderer} from '../vendor/CSS2DRenderer';\nimport DOMScene2D from './DOMScene2D';\n\n// This can only be accessed from Engine.renderer if you want to reference the\n// same scene in multiple places\n\nexport default function(container) {\n var renderer = new CSS2DRenderer();\n\n renderer.domElement.style.position = 'absolute';\n renderer.domElement.style.top = 0;\n\n container.appendChild(renderer.domElement);\n\n var updateSize = function() {\n renderer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return renderer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMRenderer2D.js\n **/","// jscs:disable\n/* eslint-disable */\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nimport THREE from 'three';\n\nvar CSS2DObject = function ( element ) {\n\n\tTHREE.Object3D.call( this );\n\n\tthis.element = element;\n\tthis.element.style.position = 'absolute';\n\n\tthis.addEventListener( 'removed', function ( event ) {\n\n\t\tif ( this.element.parentNode !== null ) {\n\n\t\t\tthis.element.parentNode.removeChild( this.element );\n\n\t\t}\n\n\t} );\n\n};\n\nCSS2DObject.prototype = Object.create( THREE.Object3D.prototype );\nCSS2DObject.prototype.constructor = CSS2DObject;\n\n//\n\nvar CSS2DRenderer = function () {\n\n\tconsole.log( 'THREE.CSS2DRenderer', THREE.REVISION );\n\n\tvar _width, _height;\n\tvar _widthHalf, _heightHalf;\n\n\tvar vector = new THREE.Vector3();\n\tvar viewMatrix = new THREE.Matrix4();\n\tvar viewProjectionMatrix = new THREE.Matrix4();\n\n\tvar domElement = document.createElement( 'div' );\n\tdomElement.style.overflow = 'hidden';\n\n\tthis.domElement = domElement;\n\n\tthis.setSize = function ( width, height ) {\n\n\t\t_width = width;\n\t\t_height = height;\n\n\t\t_widthHalf = _width / 2;\n\t\t_heightHalf = _height / 2;\n\n\t\tdomElement.style.width = width + 'px';\n\t\tdomElement.style.height = height + 'px';\n\n\t};\n\n\tvar renderObject = function ( object, camera ) {\n\n\t\tif ( object instanceof CSS2DObject ) {\n\n\t\t\tvector.setFromMatrixPosition( object.matrixWorld );\n\t\t\tvector.applyProjection( viewProjectionMatrix );\n\n\t\t\tvar element = object.element;\n\t\t\tvar style = 'translate(-50%,-50%) translate(' + ( vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - vector.y * _heightHalf + _heightHalf ) + 'px)';\n\n\t\t\telement.style.WebkitTransform = style;\n\t\t\telement.style.MozTransform = style;\n\t\t\telement.style.oTransform = style;\n\t\t\telement.style.transform = style;\n\n\t\t\tif ( element.parentNode !== domElement ) {\n\n\t\t\t\tdomElement.appendChild( element );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( var i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( object.children[ i ], camera );\n\n\t\t}\n\n\t};\n\n\tthis.render = function ( scene, camera ) {\n\n\t\tscene.updateMatrixWorld();\n\n\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\tcamera.matrixWorldInverse.getInverse( camera.matrixWorld );\n\n\t\tviewMatrix.copy( camera.matrixWorldInverse.getInverse( camera.matrixWorld ) );\n\t\tviewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, viewMatrix );\n\n\t\trenderObject( scene, camera );\n\n\t};\n\n};\n\nexport {CSS2DObject as CSS2DObject};\nexport {CSS2DRenderer as CSS2DRenderer};\n\nTHREE.CSS2DObject = CSS2DObject;\nTHREE.CSS2DRenderer = CSS2DRenderer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/CSS2DRenderer.js\n **/","import THREE from 'three';\n\n// This can only be accessed from Engine.camera if you want to reference the\n// same scene in multiple places\n\n// TODO: Ensure that FOV looks natural on all aspect ratios\n// http://stackoverflow.com/q/26655930/997339\n\nexport default function(container) {\n var camera = new THREE.PerspectiveCamera(45, 1, 1, 200000);\n camera.position.y = 400;\n camera.position.z = 400;\n\n var updateSize = function() {\n camera.aspect = container.clientWidth / container.clientHeight;\n camera.updateProjectionMatrix();\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return camera;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Camera.js\n **/","import THREE from 'three';\nimport {point as Point} from '../geo/Point';\nimport PickingScene from './PickingScene';\n\n// TODO: Look into a way of setting this up without passing in a renderer and\n// camera from the engine\n\n// TODO: Add a basic indicator on or around the mouse pointer when it is over\n// something pickable / clickable\n//\n// A simple transparent disc or ring at the mouse point should work to start, or\n// even just changing the cursor to the CSS 'pointer' style\n//\n// Probably want this on mousemove with a throttled update as not to spam the\n// picking method\n//\n// Relies upon the picking method not redrawing the scene every call due to\n// the way TileLayer invalidates the picking scene\n\nvar nextId = 1;\n\nclass Picking {\n constructor(world, renderer, camera) {\n this._world = world;\n this._renderer = renderer;\n this._camera = camera;\n\n this._raycaster = new THREE.Raycaster();\n\n // TODO: Match this with the line width used in the picking layers\n this._raycaster.linePrecision = 3;\n\n this._pickingScene = PickingScene;\n this._pickingTexture = new THREE.WebGLRenderTarget();\n this._pickingTexture.texture.minFilter = THREE.LinearFilter;\n this._pickingTexture.texture.generateMipmaps = false;\n\n this._nextId = 1;\n\n this._resizeTexture();\n this._initEvents();\n }\n\n _initEvents() {\n window.addEventListener('resize', this._resizeTexture.bind(this), false);\n\n // this._renderer.domElement.addEventListener('mousemove', this._onMouseMove.bind(this), false);\n this._world._container.addEventListener('mouseup', this._onMouseUp.bind(this), false);\n\n this._world.on('move', this._onWorldMove, this);\n }\n\n _onMouseUp(event) {\n // Only react to main button click\n if (event.button !== 0) {\n return;\n }\n\n var point = Point(event.clientX, event.clientY);\n\n var normalisedPoint = Point(0, 0);\n normalisedPoint.x = (point.x / this._width) * 2 - 1;\n normalisedPoint.y = -(point.y / this._height) * 2 + 1;\n\n this._pick(point, normalisedPoint);\n }\n\n _onWorldMove() {\n this._needUpdate = true;\n }\n\n // TODO: Ensure this doesn't get out of sync issue with the renderer resize\n _resizeTexture() {\n var size = this._renderer.getSize();\n\n this._width = size.width;\n this._height = size.height;\n\n this._pickingTexture.setSize(this._width, this._height);\n this._pixelBuffer = new Uint8Array(4 * this._width * this._height);\n\n this._needUpdate = true;\n }\n\n // TODO: Make this only re-draw the scene if both an update is needed and the\n // camera has moved since the last update\n //\n // Otherwise it re-draws the scene on every click due to the way LOD updates\n // work in TileLayer – spamming this.add() and this.remove()\n //\n // TODO: Pause updates during map move / orbit / zoom as this is unlikely to\n // be a point in time where the user cares for picking functionality\n _update() {\n if (this._needUpdate) {\n var texture = this._pickingTexture;\n\n this._renderer.render(this._pickingScene, this._camera, this._pickingTexture);\n\n // Read the rendering texture\n this._renderer.readRenderTargetPixels(texture, 0, 0, texture.width, texture.height, this._pixelBuffer);\n\n this._needUpdate = false;\n }\n }\n\n _pick(point, normalisedPoint) {\n this._update();\n\n var index = point.x + (this._pickingTexture.height - point.y) * this._pickingTexture.width;\n\n // Interpret the pixel as an ID\n var id = (this._pixelBuffer[index * 4 + 2] * 255 * 255) + (this._pixelBuffer[index * 4 + 1] * 255) + (this._pixelBuffer[index * 4 + 0]);\n\n // Skip if ID is 16646655 (white) as the background returns this\n if (id === 16646655) {\n return;\n }\n\n this._raycaster.setFromCamera(normalisedPoint, this._camera);\n\n // Perform ray intersection on picking scene\n //\n // TODO: Only perform intersection test on the relevant picking mesh\n var intersects = this._raycaster.intersectObjects(this._pickingScene.children, true);\n\n var _point2d = point.clone();\n\n var _point3d;\n if (intersects.length > 0) {\n _point3d = intersects[0].point.clone();\n }\n\n // Pass along as much data as possible for now until we know more about how\n // people use the picking API and what the returned data should be\n //\n // TODO: Look into the leak potential for passing so much by reference here\n this._world.emit('pick', id, _point2d, _point3d, intersects);\n this._world.emit('pick-' + id, _point2d, _point3d, intersects);\n }\n\n // Add mesh to picking scene\n //\n // Picking ID should already be added as an attribute\n add(mesh) {\n this._pickingScene.add(mesh);\n this._needUpdate = true;\n }\n\n // Remove mesh from picking scene\n remove(mesh) {\n this._pickingScene.remove(mesh);\n this._needUpdate = true;\n }\n\n // Returns next ID to use for picking\n getNextId() {\n return nextId++;\n }\n\n destroy() {\n // TODO: Find a way to properly remove these listeners as they stay\n // active at the moment\n window.removeEventListener('resize', this._resizeTexture, false);\n this._renderer.domElement.removeEventListener('mouseup', this._onMouseUp, false);\n this._world.off('move', this._onWorldMove);\n\n if (this._pickingScene.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._pickingScene.children.length - 1; i >= 0; i--) {\n child = this._pickingScene.children[i];\n\n if (!child) {\n continue;\n }\n\n this._pickingScene.remove(child);\n\n // Probably not a good idea to dispose of geometry due to it being\n // shared with the non-picking scene\n // if (child.geometry) {\n // // Dispose of mesh and materials\n // child.geometry.dispose();\n // child.geometry = null;\n // }\n\n if (child.material) {\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n }\n }\n }\n\n this._pickingScene = null;\n this._pickingTexture = null;\n this._pixelBuffer = null;\n\n this._world = null;\n this._renderer = null;\n this._camera = null;\n }\n}\n\n// Initialise without requiring new keyword\nexport default function(world, renderer, camera) {\n return new Picking(world, renderer, camera);\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Picking.js\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.pickingScene\n\nexport default (function() {\n var scene = new THREE.Scene();\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/PickingScene.js\n **/","import THREE from 'three';\nimport EffectComposer from '../vendor/EffectComposer';\n\nexport default function(renderer, container) {\n var composer = new EffectComposer(renderer);\n\n var updateSize = function() {\n composer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return composer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/EffectComposer.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\nimport CopyShader from './CopyShader';\nimport ShaderPass from './ShaderPass';\nimport MaskPass, {ClearMaskPass} from './MaskPass';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nvar EffectComposer = function ( renderer, renderTarget ) {\n\n\tthis.renderer = renderer;\n\n\tif ( renderTarget === undefined ) {\n\n\t\tvar pixelRatio = renderer.getPixelRatio();\n\n\t\tvar width = Math.floor( renderer.context.canvas.width / pixelRatio ) || 1;\n\t\tvar height = Math.floor( renderer.context.canvas.height / pixelRatio ) || 1;\n\t\tvar parameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, stencilBuffer: false };\n\n\t\trenderTarget = new THREE.WebGLRenderTarget( width, height, parameters );\n\n\t}\n\n\tthis.renderTarget1 = renderTarget;\n\tthis.renderTarget2 = renderTarget.clone();\n\n\tthis.writeBuffer = this.renderTarget1;\n\tthis.readBuffer = this.renderTarget2;\n\n\tthis.passes = [];\n\n\tif ( CopyShader === undefined )\n\t\tconsole.error( \"EffectComposer relies on THREE.CopyShader\" );\n\n\tthis.copyPass = new ShaderPass( CopyShader );\n\n};\n\nEffectComposer.prototype = {\n\n\tswapBuffers: function() {\n\n\t\tvar tmp = this.readBuffer;\n\t\tthis.readBuffer = this.writeBuffer;\n\t\tthis.writeBuffer = tmp;\n\n\t},\n\n\taddPass: function ( pass ) {\n\n\t\tthis.passes.push( pass );\n\n\t},\n\n\tinsertPass: function ( pass, index ) {\n\n\t\tthis.passes.splice( index, 0, pass );\n\n\t},\n\n\trender: function ( delta ) {\n\n\t\tthis.writeBuffer = this.renderTarget1;\n\t\tthis.readBuffer = this.renderTarget2;\n\n\t\tvar maskActive = false;\n\n\t\tvar pass, i, il = this.passes.length;\n\n\t\tfor ( i = 0; i < il; i ++ ) {\n\n\t\t\tpass = this.passes[ i ];\n\n\t\t\tif ( ! pass.enabled ) continue;\n\n\t\t\tpass.render( this.renderer, this.writeBuffer, this.readBuffer, delta, maskActive );\n\n\t\t\tif ( pass.needsSwap ) {\n\n\t\t\t\tif ( maskActive ) {\n\n\t\t\t\t\tvar context = this.renderer.context;\n\n\t\t\t\t\tcontext.stencilFunc( context.NOTEQUAL, 1, 0xffffffff );\n\n\t\t\t\t\tthis.copyPass.render( this.renderer, this.writeBuffer, this.readBuffer, delta );\n\n\t\t\t\t\tcontext.stencilFunc( context.EQUAL, 1, 0xffffffff );\n\n\t\t\t\t}\n\n\t\t\t\tthis.swapBuffers();\n\n\t\t\t}\n\n\t\t\tif ( pass instanceof MaskPass ) {\n\n\t\t\t\tmaskActive = true;\n\n\t\t\t} else if ( pass instanceof ClearMaskPass ) {\n\n\t\t\t\tmaskActive = false;\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\treset: function ( renderTarget ) {\n\n\t\tif ( renderTarget === undefined ) {\n\n\t\t\trenderTarget = this.renderTarget1.clone();\n\n\t\t\tvar pixelRatio = this.renderer.getPixelRatio();\n\n\t\t\trenderTarget.setSize(\n\t\t\t\tMath.floor( this.renderer.context.canvas.width / pixelRatio ),\n\t\t\t\tMath.floor( this.renderer.context.canvas.height / pixelRatio )\n\t\t\t);\n\n\t\t}\n\n\t\tthis.renderTarget1.dispose();\n\t\tthis.renderTarget1 = renderTarget;\n\t\tthis.renderTarget2.dispose();\n\t\tthis.renderTarget2 = renderTarget.clone();\n\n\t\tthis.writeBuffer = this.renderTarget1;\n\t\tthis.readBuffer = this.renderTarget2;\n\n\t},\n\n\tsetSize: function ( width, height ) {\n\n\t\tthis.renderTarget1.setSize( width, height );\n\t\tthis.renderTarget2.setSize( width, height );\n\n\t}\n\n};\n\nexport default EffectComposer;\nTHREE.EffectComposer = EffectComposer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/EffectComposer.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * Full-screen textured quad shader\n */\n\nvar CopyShader = {\n\n\tuniforms: {\n\n\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\"opacity\": { type: \"f\", value: 1.0 }\n\n\t},\n\n\tvertexShader: [\n\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vUv = uv;\",\n\t\t\t\"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" ),\n\n\tfragmentShader: [\n\n\t\t\"uniform float opacity;\",\n\n\t\t\"uniform sampler2D tDiffuse;\",\n\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vec4 texel = texture2D( tDiffuse, vUv );\",\n\t\t\t\"gl_FragColor = opacity * texel;\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" )\n\n};\n\nexport default CopyShader;\nTHREE.CopyShader = CopyShader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/CopyShader.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nvar ShaderPass = function( shader, textureID ) {\n\n\tthis.textureID = ( textureID !== undefined ) ? textureID : \"tDiffuse\";\n\n\tif ( shader instanceof THREE.ShaderMaterial ) {\n\n\t\tthis.uniforms = shader.uniforms;\n\n\t\tthis.material = shader;\n\n\t}\n\telse if ( shader ) {\n\n\t\tthis.uniforms = THREE.UniformsUtils.clone( shader.uniforms );\n\n\t\tthis.material = new THREE.ShaderMaterial( {\n\n\t\t\tdefines: shader.defines || {},\n\t\t\tuniforms: this.uniforms,\n\t\t\tvertexShader: shader.vertexShader,\n\t\t\tfragmentShader: shader.fragmentShader\n\n\t\t} );\n\n\t}\n\n\tthis.renderToScreen = false;\n\n\tthis.enabled = true;\n\tthis.needsSwap = true;\n\tthis.clear = false;\n\n\n\tthis.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n\tthis.scene = new THREE.Scene();\n\n\tthis.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );\n\tthis.scene.add( this.quad );\n\n};\n\nShaderPass.prototype = {\n\n\trender: function( renderer, writeBuffer, readBuffer, delta ) {\n\n\t\tif ( this.uniforms[ this.textureID ] ) {\n\n\t\t\tthis.uniforms[ this.textureID ].value = readBuffer;\n\n\t\t}\n\n\t\tthis.quad.material = this.material;\n\n\t\tif ( this.renderToScreen ) {\n\n\t\t\trenderer.render( this.scene, this.camera );\n\n\t\t} else {\n\n\t\t\trenderer.render( this.scene, this.camera, writeBuffer, this.clear );\n\n\t\t}\n\n\t}\n\n};\n\nexport default ShaderPass;\nTHREE.ShaderPass = ShaderPass;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/ShaderPass.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nvar MaskPass = function ( scene, camera ) {\n\n\tthis.scene = scene;\n\tthis.camera = camera;\n\n\tthis.enabled = true;\n\tthis.clear = true;\n\tthis.needsSwap = false;\n\n\tthis.inverse = false;\n\n};\n\nMaskPass.prototype = {\n\n\trender: function ( renderer, writeBuffer, readBuffer, delta ) {\n\n\t\tvar context = renderer.context;\n\n\t\t// don't update color or depth\n\n\t\tcontext.colorMask( false, false, false, false );\n\t\tcontext.depthMask( false );\n\n\t\t// set up stencil\n\n\t\tvar writeValue, clearValue;\n\n\t\tif ( this.inverse ) {\n\n\t\t\twriteValue = 0;\n\t\t\tclearValue = 1;\n\n\t\t} else {\n\n\t\t\twriteValue = 1;\n\t\t\tclearValue = 0;\n\n\t\t}\n\n\t\tcontext.enable( context.STENCIL_TEST );\n\t\tcontext.stencilOp( context.REPLACE, context.REPLACE, context.REPLACE );\n\t\tcontext.stencilFunc( context.ALWAYS, writeValue, 0xffffffff );\n\t\tcontext.clearStencil( clearValue );\n\n\t\t// draw into the stencil buffer\n\n\t\trenderer.render( this.scene, this.camera, readBuffer, this.clear );\n\t\trenderer.render( this.scene, this.camera, writeBuffer, this.clear );\n\n\t\t// re-enable update of color and depth\n\n\t\tcontext.colorMask( true, true, true, true );\n\t\tcontext.depthMask( true );\n\n\t\t// only render where stencil is set to 1\n\n\t\tcontext.stencilFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1\n\t\tcontext.stencilOp( context.KEEP, context.KEEP, context.KEEP );\n\n\t}\n\n};\n\n\nvar ClearMaskPass = function () {\n\n\tthis.enabled = true;\n\n};\n\nClearMaskPass.prototype = {\n\n\trender: function ( renderer, writeBuffer, readBuffer, delta ) {\n\n\t\tvar context = renderer.context;\n\n\t\tcontext.disable( context.STENCIL_TEST );\n\n\t}\n\n};\n\nexport default MaskPass;\nexport {ClearMaskPass as ClearMaskPass};\n\nTHREE.MaskPass = MaskPass;\nTHREE.ClearMaskPass = ClearMaskPass;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/MaskPass.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nvar RenderPass = function ( scene, camera, overrideMaterial, clearColor, clearAlpha ) {\n\n\tthis.scene = scene;\n\tthis.camera = camera;\n\n\tthis.overrideMaterial = overrideMaterial;\n\n\tthis.clearColor = clearColor;\n\tthis.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 1;\n\n\tthis.oldClearColor = new THREE.Color();\n\tthis.oldClearAlpha = 1;\n\n\tthis.enabled = true;\n\tthis.clear = true;\n\tthis.needsSwap = false;\n\n};\n\nRenderPass.prototype = {\n\n\trender: function ( renderer, writeBuffer, readBuffer, delta ) {\n\n\t\tthis.scene.overrideMaterial = this.overrideMaterial;\n\n\t\tif ( this.clearColor ) {\n\n\t\t\tthis.oldClearColor.copy( renderer.getClearColor() );\n\t\t\tthis.oldClearAlpha = renderer.getClearAlpha();\n\n\t\t\trenderer.setClearColor( this.clearColor, this.clearAlpha );\n\n\t\t}\n\n\t\trenderer.render( this.scene, this.camera, readBuffer, this.clear );\n\n\t\tif ( this.clearColor ) {\n\n\t\t\trenderer.setClearColor( this.oldClearColor, this.oldClearAlpha );\n\n\t\t}\n\n\t\tthis.scene.overrideMaterial = null;\n\n\t}\n\n};\n\nexport default RenderPass;\nTHREE.RenderPass = RenderPass;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/RenderPass.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n * - \"r\" parameter control where \"focused\" horizontal line lies\n */\n\nvar HorizontalTiltShiftShader = {\n\n\tuniforms: {\n\n\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\"h\": { type: \"f\", value: 1.0 / 512.0 },\n\t\t\"r\": { type: \"f\", value: 0.35 }\n\n\t},\n\n\tvertexShader: [\n\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vUv = uv;\",\n\t\t\t\"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" ),\n\n\tfragmentShader: [\n\n\t\t\"uniform sampler2D tDiffuse;\",\n\t\t\"uniform float h;\",\n\t\t\"uniform float r;\",\n\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vec4 sum = vec4( 0.0 );\",\n\n\t\t\t\"float hh = h * abs( r - vUv.y );\",\n\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;\",\n\n\t\t\t\"gl_FragColor = sum;\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" )\n\n};\n\nexport default HorizontalTiltShiftShader;\nTHREE.HorizontalTiltShiftShader = HorizontalTiltShiftShader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/HorizontalTiltShiftShader.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n * - \"r\" parameter control where \"focused\" horizontal line lies\n */\n\nvar VerticalTiltShiftShader = {\n\n\tuniforms: {\n\n\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\"v\": { type: \"f\", value: 1.0 / 512.0 },\n\t\t\"r\": { type: \"f\", value: 0.35 }\n\n\t},\n\n\tvertexShader: [\n\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vUv = uv;\",\n\t\t\t\"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" ),\n\n\tfragmentShader: [\n\n\t\t\"uniform sampler2D tDiffuse;\",\n\t\t\"uniform float v;\",\n\t\t\"uniform float r;\",\n\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vec4 sum = vec4( 0.0 );\",\n\n\t\t\t\"float vv = v * abs( r - vUv.y );\",\n\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;\",\n\n\t\t\t\"gl_FragColor = sum;\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" )\n\n};\n\nexport default VerticalTiltShiftShader;\nTHREE.VerticalTiltShiftShader = VerticalTiltShiftShader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/VerticalTiltShiftShader.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author davidedc / http://www.sketchpatch.net/\n *\n * NVIDIA FXAA by Timothy Lottes\n * http://timothylottes.blogspot.com/2011/06/fxaa3-source-released.html\n * - WebGL port by @supereggbert\n * http://www.glge.org/demos/fxaa/\n */\n\nvar FXAAShader = {\n\n\tuniforms: {\n\n\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\"resolution\": { type: \"v2\", value: new THREE.Vector2( 1 / 1024, 1 / 512 ) }\n\n\t},\n\n\tvertexShader: [\n\n\t\t\"void main() {\",\n\n\t\t\t\"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" ),\n\n\tfragmentShader: [\n\n\t\t\"uniform sampler2D tDiffuse;\",\n\t\t\"uniform vec2 resolution;\",\n\n\t\t\"#define FXAA_REDUCE_MIN (1.0/128.0)\",\n\t\t\"#define FXAA_REDUCE_MUL (1.0/8.0)\",\n\t\t\"#define FXAA_SPAN_MAX 8.0\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;\",\n\t\t\t\"vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;\",\n\t\t\t\"vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;\",\n\t\t\t\"vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;\",\n\t\t\t\"vec4 rgbaM = texture2D( tDiffuse, gl_FragCoord.xy * resolution );\",\n\t\t\t\"vec3 rgbM = rgbaM.xyz;\",\n\t\t\t\"vec3 luma = vec3( 0.299, 0.587, 0.114 );\",\n\n\t\t\t\"float lumaNW = dot( rgbNW, luma );\",\n\t\t\t\"float lumaNE = dot( rgbNE, luma );\",\n\t\t\t\"float lumaSW = dot( rgbSW, luma );\",\n\t\t\t\"float lumaSE = dot( rgbSE, luma );\",\n\t\t\t\"float lumaM = dot( rgbM, luma );\",\n\t\t\t\"float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\",\n\t\t\t\"float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\",\n\n\t\t\t\"vec2 dir;\",\n\t\t\t\"dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\",\n\t\t\t\"dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\",\n\n\t\t\t\"float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\",\n\n\t\t\t\"float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\",\n\t\t\t\"dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\",\n\t\t\t\t \"max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\",\n\t\t\t\t\t\t\"dir * rcpDirMin)) * resolution;\",\n\t\t\t\"vec4 rgbA = (1.0/2.0) * (\",\n \t\"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (1.0/3.0 - 0.5)) +\",\n\t\t\t\"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (2.0/3.0 - 0.5)));\",\n \t\t\"vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (\",\n\t\t\t\"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (0.0/3.0 - 0.5)) +\",\n \t\t\"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (3.0/3.0 - 0.5)));\",\n \t\t\"float lumaB = dot(rgbB, vec4(luma, 0.0));\",\n\n\t\t\t\"if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {\",\n\n\t\t\t\t\"gl_FragColor = rgbA;\",\n\n\t\t\t\"} else {\",\n\t\t\t\t\"gl_FragColor = rgbB;\",\n\n\t\t\t\"}\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" )\n\n};\n\nexport default FXAAShader;\nTHREE.FXAAShader = FXAAShader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/FXAAShader.js\n **/","import Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport Skybox from './Skybox';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\nclass EnvironmentLayer extends Layer {\n constructor(options) {\n var defaults = {\n skybox: false\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n }\n\n _onAdd() {\n this._initLights();\n\n if (this._options.skybox) {\n this._initSkybox();\n }\n\n // this._initGrid();\n }\n\n // Not fleshed out or thought through yet\n //\n // Lights could potentially be put it their own 'layer' to keep this class\n // much simpler and less messy\n _initLights() {\n // Position doesn't really matter (the angle is important), however it's\n // used here so the helpers look more natural.\n\n if (!this._options.skybox) {\n var directionalLight = new THREE.DirectionalLight(0xffffff, 1);\n directionalLight.position.x = 1000;\n directionalLight.position.y = 1000;\n directionalLight.position.z = 1000;\n\n // TODO: Get shadows working in non-PBR scenes\n\n // directionalLight.castShadow = true;\n //\n // var d = 100;\n // directionalLight.shadow.camera.left = -d;\n // directionalLight.shadow.camera.right = d;\n // directionalLight.shadow.camera.top = d;\n // directionalLight.shadow.camera.bottom = -d;\n //\n // directionalLight.shadow.camera.near = 10;\n // directionalLight.shadow.camera.far = 100;\n //\n // // TODO: Need to dial in on a good shadowmap size\n // directionalLight.shadow.mapSize.width = 2048;\n // directionalLight.shadow.mapSize.height = 2048;\n //\n // // directionalLight.shadowBias = -0.0010;\n // // directionalLight.shadow.darkness = 0.15;\n\n var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.5);\n directionalLight2.position.x = -1000;\n directionalLight2.position.y = 1000;\n directionalLight2.position.z = -1000;\n\n // var helper = new THREE.DirectionalLightHelper(directionalLight, 10);\n // var helper2 = new THREE.DirectionalLightHelper(directionalLight2, 10);\n\n this.add(directionalLight);\n this.add(directionalLight2);\n\n // this.add(helper);\n // this.add(helper2);\n } else {\n // Directional light that will be projected from the sun\n this._skyboxLight = new THREE.DirectionalLight(0xffffff, 1);\n\n this._skyboxLight.castShadow = true;\n\n var d = 1000;\n this._skyboxLight.shadow.camera.left = -d;\n this._skyboxLight.shadow.camera.right = d;\n this._skyboxLight.shadow.camera.top = d;\n this._skyboxLight.shadow.camera.bottom = -d;\n\n this._skyboxLight.shadow.camera.near = 10000;\n this._skyboxLight.shadow.camera.far = 70000;\n\n // TODO: Need to dial in on a good shadowmap size\n this._skyboxLight.shadow.mapSize.width = 2048;\n this._skyboxLight.shadow.mapSize.height = 2048;\n\n // this._skyboxLight.shadowBias = -0.0010;\n // this._skyboxLight.shadow.darkness = 0.15;\n\n // this._object3D.add(new THREE.CameraHelper(this._skyboxLight.shadow.camera));\n\n this.add(this._skyboxLight);\n }\n }\n\n _initSkybox() {\n this._skybox = new Skybox(this._world, this._skyboxLight);\n this.add(this._skybox._mesh);\n }\n\n // Add grid helper for context during initial development\n _initGrid() {\n var size = 4000;\n var step = 100;\n\n var gridHelper = new THREE.GridHelper(size, step);\n this.add(gridHelper);\n }\n\n // Clean up environment\n destroy() {\n this._skyboxLight = null;\n\n this.remove(this._skybox._mesh);\n this._skybox.destroy();\n this._skybox = null;\n\n super.destroy();\n }\n}\n\nexport default EnvironmentLayer;\n\nvar noNew = function(options) {\n return new EnvironmentLayer(options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as environmentLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/environment/EnvironmentLayer.js\n **/","import EventEmitter from 'eventemitter3';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport Scene from '../engine/Scene';\nimport {CSS3DObject} from '../vendor/CSS3DRenderer';\nimport {CSS2DObject} from '../vendor/CSS2DRenderer';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Need a single move method that handles moving all the various object\n// layers so that the DOM layers stay in sync with the 3D layer\n\n// TODO: Double check that objects within the _object3D Object3D parent are frustum\n// culled even if the layer position stays at the default (0,0,0) and the child\n// objects are positioned much further away\n//\n// Or does the layer being at (0,0,0) prevent the child objects from being\n// culled because the layer parent is effectively always in view even if the\n// child is actually out of camera\n\nclass Layer extends EventEmitter {\n constructor(options) {\n super();\n\n var defaults = {\n output: true,\n outputToScene: true\n };\n\n this._options = extend({}, defaults, options);\n\n if (this.isOutput()) {\n this._object3D = new THREE.Object3D();\n\n this._dom3D = document.createElement('div');\n this._domObject3D = new CSS3DObject(this._dom3D);\n\n this._dom2D = document.createElement('div');\n this._domObject2D = new CSS2DObject(this._dom2D);\n }\n }\n\n // Add THREE object directly to layer\n add(object) {\n this._object3D.add(object);\n }\n\n // Remove THREE object from to layer\n remove(object) {\n this._object3D.remove(object);\n }\n\n addDOM3D(object) {\n this._domObject3D.add(object);\n }\n\n removeDOM3D(object) {\n this._domObject3D.remove(object);\n }\n\n addDOM2D(object) {\n this._domObject2D.add(object);\n }\n\n removeDOM2D(object) {\n this._domObject2D.remove(object);\n }\n\n // Add layer to world instance and store world reference\n addTo(world) {\n world.addLayer(this);\n return this;\n }\n\n // Internal method called by World.addLayer to actually add the layer\n _addToWorld(world) {\n this._world = world;\n this._onAdd(world);\n this.emit('added');\n }\n\n _onAdd(world) {}\n\n getPickingId() {\n if (this._world._engine._picking) {\n return this._world._engine._picking.getNextId();\n }\n\n return false;\n }\n\n // TODO: Tidy this up and don't access so many private properties to work\n addToPicking(object) {\n if (!this._world._engine._picking) {\n return;\n }\n\n this._world._engine._picking.add(object);\n }\n\n removeFromPicking(object) {\n if (!this._world._engine._picking) {\n return;\n }\n\n this._world._engine._picking.remove(object);\n }\n\n isOutput() {\n return this._options.output;\n }\n\n isOutputToScene() {\n return this._options.outputToScene;\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n if (this._object3D && this._object3D.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._object3D.children.length - 1; i >= 0; i--) {\n child = this._object3D.children[i];\n\n if (!child) {\n continue;\n }\n\n this.remove(child);\n\n if (child.geometry) {\n // Dispose of mesh and materials\n child.geometry.dispose();\n child.geometry = null;\n }\n\n if (child.material) {\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n }\n }\n }\n\n if (this._domObject3D && this._domObject3D.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._domObject3D.children.length - 1; i >= 0; i--) {\n child = this._domObject3D.children[i];\n\n if (!child) {\n continue;\n }\n\n this.removeDOM3D(child);\n }\n }\n\n if (this._domObject2D && this._domObject2D.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._domObject2D.children.length - 1; i >= 0; i--) {\n child = this._domObject2D.children[i];\n\n if (!child) {\n continue;\n }\n\n this.removeDOM2D(child);\n }\n }\n\n this._domObject3D = null;\n this._domObject2D = null;\n\n this._world = null;\n this._object3D = null;\n }\n}\n\nexport default Layer;\n\nvar noNew = function(options) {\n return new Layer(options);\n};\n\nexport {noNew as layer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/Layer.js\n **/","import THREE from 'three';\nimport Sky from './Sky';\nimport throttle from 'lodash.throttle';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\nvar cubemap = {\n vertexShader: [\n\t\t'varying vec3 vPosition;',\n\t\t'void main() {',\n\t\t\t'vPosition = position;',\n\t\t\t'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\t\t'}'\n\t].join('\\n'),\n\n fragmentShader: [\n 'uniform samplerCube cubemap;',\n 'varying vec3 vPosition;',\n\n 'void main() {',\n 'gl_FragColor = textureCube(cubemap, normalize(vPosition));',\n '}'\n ].join('\\n')\n};\n\nclass Skybox {\n constructor(world, light) {\n this._world = world;\n this._light = light;\n\n this._settings = {\n distance: 38000,\n turbidity: 10,\n reileigh: 2,\n mieCoefficient: 0.005,\n mieDirectionalG: 0.8,\n luminance: 1,\n // 0.48 is a cracking dusk / sunset\n // 0.4 is a beautiful early-morning / late-afternoon\n // 0.2 is a nice day time\n inclination: 0.48, // Elevation / inclination\n azimuth: 0.25, // Facing front\n };\n\n this._initSkybox();\n this._updateUniforms();\n this._initEvents();\n }\n\n _initEvents() {\n // Throttled to 1 per 100ms\n this._throttledWorldUpdate = throttle(this._update, 100);\n this._world.on('preUpdate', this._throttledWorldUpdate, this);\n }\n\n _initSkybox() {\n // Cube camera for skybox\n this._cubeCamera = new THREE.CubeCamera(1, 2000000, 128);\n\n // Cube material\n var cubeTarget = this._cubeCamera.renderTarget;\n\n // Add Sky Mesh\n this._sky = new Sky();\n this._skyScene = new THREE.Scene();\n this._skyScene.add(this._sky.mesh);\n\n // Add Sun Helper\n this._sunSphere = new THREE.Mesh(\n new THREE.SphereBufferGeometry(2000, 16, 8),\n new THREE.MeshBasicMaterial({\n color: 0xffffff\n })\n );\n\n // TODO: This isn't actually visible because it's not added to the layer\n // this._sunSphere.visible = true;\n\n var skyboxUniforms = {\n cubemap: { type: 't', value: cubeTarget }\n };\n\n var skyboxMat = new THREE.ShaderMaterial({\n uniforms: skyboxUniforms,\n vertexShader: cubemap.vertexShader,\n fragmentShader: cubemap.fragmentShader,\n side: THREE.BackSide\n });\n\n this._mesh = new THREE.Mesh(new THREE.BoxGeometry(190000, 190000, 190000), skyboxMat);\n\n this._updateSkybox = true;\n }\n\n _updateUniforms() {\n var settings = this._settings;\n var uniforms = this._sky.uniforms;\n uniforms.turbidity.value = settings.turbidity;\n uniforms.reileigh.value = settings.reileigh;\n uniforms.luminance.value = settings.luminance;\n uniforms.mieCoefficient.value = settings.mieCoefficient;\n uniforms.mieDirectionalG.value = settings.mieDirectionalG;\n\n var theta = Math.PI * (settings.inclination - 0.5);\n var phi = 2 * Math.PI * (settings.azimuth - 0.5);\n\n this._sunSphere.position.x = settings.distance * Math.cos(phi);\n this._sunSphere.position.y = settings.distance * Math.sin(phi) * Math.sin(theta);\n this._sunSphere.position.z = settings.distance * Math.sin(phi) * Math.cos(theta);\n\n // Move directional light to sun position\n this._light.position.copy(this._sunSphere.position);\n\n this._sky.uniforms.sunPosition.value.copy(this._sunSphere.position);\n }\n\n _update(delta) {\n if (this._updateSkybox) {\n this._updateSkybox = false;\n } else {\n return;\n }\n\n // if (!this._angle) {\n // this._angle = 0;\n // }\n //\n // // Animate inclination\n // this._angle += Math.PI * delta;\n // this._settings.inclination = 0.5 * (Math.sin(this._angle) / 2 + 0.5);\n\n // Update light intensity depending on elevation of sun (day to night)\n this._light.intensity = 1 - 0.95 * (this._settings.inclination / 0.5);\n\n // // console.log(delta, this._angle, this._settings.inclination);\n //\n // TODO: Only do this when the uniforms have been changed\n this._updateUniforms();\n\n // TODO: Only do this when the cubemap has actually changed\n this._cubeCamera.updateCubeMap(this._world._engine._renderer, this._skyScene);\n }\n\n getRenderTarget() {\n return this._cubeCamera.renderTarget;\n }\n\n setInclination(inclination) {\n this._settings.inclination = inclination;\n this._updateSkybox = true;\n }\n\n // Destroy the skybox and remove it from memory\n destroy() {\n this._world.off('preUpdate', this._throttledWorldUpdate);\n this._throttledWorldUpdate = null;\n\n this._world = null;\n this._light = null;\n\n this._cubeCamera = null;\n\n this._sky.mesh.geometry.dispose();\n this._sky.mesh.geometry = null;\n\n if (this._sky.mesh.material.map) {\n this._sky.mesh.material.map.dispose();\n this._sky.mesh.material.map = null;\n }\n\n this._sky.mesh.material.dispose();\n this._sky.mesh.material = null;\n\n this._sky.mesh = null;\n this._sky = null;\n\n this._skyScene = null;\n\n this._sunSphere.geometry.dispose();\n this._sunSphere.geometry = null;\n\n if (this._sunSphere.material.map) {\n this._sunSphere.material.map.dispose();\n this._sunSphere.material.map = null;\n }\n\n this._sunSphere.material.dispose();\n this._sunSphere.material = null;\n\n this._sunSphere = null;\n\n this._mesh.geometry.dispose();\n this._mesh.geometry = null;\n\n if (this._mesh.material.map) {\n this._mesh.material.map.dispose();\n this._mesh.material.map = null;\n }\n\n this._mesh.material.dispose();\n this._mesh.material = null;\n }\n}\n\nexport default Skybox;\n\nvar noNew = function(world, light) {\n return new Skybox(world, light);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as skybox};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/environment/Skybox.js\n **/","// jscs:disable\n/*eslint eqeqeq:0*/\n\n/**\n * @author zz85 / https://github.com/zz85\n *\n * Based on 'A Practical Analytic Model for Daylight'\n * aka The Preetham Model, the de facto standard analytic skydome model\n * http://www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf\n *\n * First implemented by Simon Wallner\n * http://www.simonwallner.at/projects/atmospheric-scattering\n *\n * Improved by Martin Upitis\n * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n *\n * Three.js integration by zz85 http://twitter.com/blurspline\n*/\n\nimport THREE from 'three';\n\nTHREE.ShaderLib[ 'sky' ] = {\n\n\tuniforms: {\n\n\t\tluminance:\t { type: 'f', value: 1 },\n\t\tturbidity:\t { type: 'f', value: 2 },\n\t\treileigh:\t { type: 'f', value: 1 },\n\t\tmieCoefficient:\t { type: 'f', value: 0.005 },\n\t\tmieDirectionalG: { type: 'f', value: 0.8 },\n\t\tsunPosition: \t { type: 'v3', value: new THREE.Vector3() }\n\n\t},\n\n\tvertexShader: [\n\n\t\t'varying vec3 vWorldPosition;',\n\n\t\t'void main() {',\n\n\t\t\t'vec4 worldPosition = modelMatrix * vec4( position, 1.0 );',\n\t\t\t'vWorldPosition = worldPosition.xyz;',\n\n\t\t\t'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n\t\t'}',\n\n\t].join( '\\n' ),\n\n\tfragmentShader: [\n\n\t\t'uniform sampler2D skySampler;',\n\t\t'uniform vec3 sunPosition;',\n\t\t'varying vec3 vWorldPosition;',\n\n\t\t'vec3 cameraPos = vec3(0., 0., 0.);',\n\t\t'// uniform sampler2D sDiffuse;',\n\t\t'// const float turbidity = 10.0; //',\n\t\t'// const float reileigh = 2.; //',\n\t\t'// const float luminance = 1.0; //',\n\t\t'// const float mieCoefficient = 0.005;',\n\t\t'// const float mieDirectionalG = 0.8;',\n\n\t\t'uniform float luminance;',\n\t\t'uniform float turbidity;',\n\t\t'uniform float reileigh;',\n\t\t'uniform float mieCoefficient;',\n\t\t'uniform float mieDirectionalG;',\n\n\t\t'// constants for atmospheric scattering',\n\t\t'const float e = 2.71828182845904523536028747135266249775724709369995957;',\n\t\t'const float pi = 3.141592653589793238462643383279502884197169;',\n\n\t\t'const float n = 1.0003; // refractive index of air',\n\t\t'const float N = 2.545E25; // number of molecules per unit volume for air at',\n\t\t\t\t\t\t\t\t'// 288.15K and 1013mb (sea level -45 celsius)',\n\t\t'const float pn = 0.035;\t// depolatization factor for standard air',\n\n\t\t'// wavelength of used primaries, according to preetham',\n\t\t'const vec3 lambda = vec3(680E-9, 550E-9, 450E-9);',\n\n\t\t'// mie stuff',\n\t\t'// K coefficient for the primaries',\n\t\t'const vec3 K = vec3(0.686, 0.678, 0.666);',\n\t\t'const float v = 4.0;',\n\n\t\t'// optical length at zenith for molecules',\n\t\t'const float rayleighZenithLength = 8.4E3;',\n\t\t'const float mieZenithLength = 1.25E3;',\n\t\t'const vec3 up = vec3(0.0, 1.0, 0.0);',\n\n\t\t'const float EE = 1000.0;',\n\t\t'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;',\n\t\t'// 66 arc seconds -> degrees, and the cosine of that',\n\n\t\t'// earth shadow hack',\n\t\t'const float cutoffAngle = pi/1.95;',\n\t\t'const float steepness = 1.5;',\n\n\n\t\t'vec3 totalRayleigh(vec3 lambda)',\n\t\t'{',\n\t\t\t'return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));',\n\t\t'}',\n\n\t\t// see http://blenderartists.org/forum/showthread.php?321110-Shaders-and-Skybox-madness\n\t\t'// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE',\n\t\t'vec3 simplifiedRayleigh()',\n\t\t'{',\n\t\t\t'return 0.0005 / vec3(94, 40, 18);',\n\t\t\t// return 0.00054532832366 / (3.0 * 2.545E25 * pow(vec3(680E-9, 550E-9, 450E-9), vec3(4.0)) * 6.245);\n\t\t'}',\n\n\t\t'float rayleighPhase(float cosTheta)',\n\t\t'{\t ',\n\t\t\t'return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));',\n\t\t'//\treturn (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));',\n\t\t'//\treturn (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));',\n\t\t'}',\n\n\t\t'vec3 totalMie(vec3 lambda, vec3 K, float T)',\n\t\t'{',\n\t\t\t'float c = (0.2 * T ) * 10E-18;',\n\t\t\t'return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;',\n\t\t'}',\n\n\t\t'float hgPhase(float cosTheta, float g)',\n\t\t'{',\n\t\t\t'return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));',\n\t\t'}',\n\n\t\t'float sunIntensity(float zenithAngleCos)',\n\t\t'{',\n\t\t\t'return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));',\n\t\t'}',\n\n\t\t'// float logLuminance(vec3 c)',\n\t\t'// {',\n\t\t'// \treturn log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);',\n\t\t'// }',\n\n\t\t'// Filmic ToneMapping http://filmicgames.com/archives/75',\n\t\t'float A = 0.15;',\n\t\t'float B = 0.50;',\n\t\t'float C = 0.10;',\n\t\t'float D = 0.20;',\n\t\t'float E = 0.02;',\n\t\t'float F = 0.30;',\n\t\t'float W = 1000.0;',\n\n\t\t'vec3 Uncharted2Tonemap(vec3 x)',\n\t\t'{',\n\t\t 'return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;',\n\t\t'}',\n\n\n\t\t'void main() ',\n\t\t'{',\n\t\t\t'float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);',\n\n\t\t\t'// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;',\n\n\t\t\t '// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);',\n\n\t\t\t'float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));',\n\n\t\t\t'vec3 sunDirection = normalize(sunPosition);',\n\n\t\t\t'float sunE = sunIntensity(dot(sunDirection, up));',\n\n\t\t\t'// extinction (absorbtion + out scattering) ',\n\t\t\t'// rayleigh coefficients',\n\n\t\t\t// 'vec3 betaR = totalRayleigh(lambda) * reileighCoefficient;',\n\t\t\t'vec3 betaR = simplifiedRayleigh() * reileighCoefficient;',\n\n\t\t\t'// mie coefficients',\n\t\t\t'vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;',\n\n\t\t\t'// optical length',\n\t\t\t'// cutoff angle at 90 to avoid singularity in next formula.',\n\t\t\t'float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));',\n\t\t\t'float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));',\n\t\t\t'float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));',\n\n\n\n\t\t\t'// combined extinction factor\t',\n\t\t\t'vec3 Fex = exp(-(betaR * sR + betaM * sM));',\n\n\t\t\t'// in scattering',\n\t\t\t'float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);',\n\n\t\t\t'float rPhase = rayleighPhase(cosTheta*0.5+0.5);',\n\t\t\t'vec3 betaRTheta = betaR * rPhase;',\n\n\t\t\t'float mPhase = hgPhase(cosTheta, mieDirectionalG);',\n\t\t\t'vec3 betaMTheta = betaM * mPhase;',\n\n\n\t\t\t'vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));',\n\t\t\t'Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));',\n\n\t\t\t'//nightsky',\n\t\t\t'vec3 direction = normalize(vWorldPosition - cameraPos);',\n\t\t\t'float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]',\n\t\t\t'float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]',\n\t\t\t'vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);',\n\t\t\t'// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;',\n\t\t\t'vec3 L0 = vec3(0.1) * Fex;',\n\n\t\t\t'// composition + solar disc',\n\t\t\t'//if (cosTheta > sunAngularDiameterCos)',\n\t\t\t'float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);',\n\t\t\t'// if (normalize(vWorldPosition - cameraPos).y>0.0)',\n\t\t\t'L0 += (sunE * 19000.0 * Fex)*sundisk;',\n\n\n\t\t\t'vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));',\n\n\t\t\t'vec3 texColor = (Lin+L0); ',\n\t\t\t'texColor *= 0.04 ;',\n\t\t\t'texColor += vec3(0.0,0.001,0.0025)*0.3;',\n\n\t\t\t'float g_fMaxLuminance = 1.0;',\n\t\t\t'float fLumScaled = 0.1 / luminance; ',\n\t\t\t'float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ',\n\n\t\t\t'float ExposureBias = fLumCompressed;',\n\n\t\t\t'vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);',\n\t\t\t'vec3 color = curr*whiteScale;',\n\n\t\t\t'vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));',\n\n\n\t\t\t'gl_FragColor.rgb = retColor;',\n\n\t\t\t'gl_FragColor.a = 1.0;',\n\t\t'}',\n\n\t].join( '\\n' )\n\n};\n\nvar Sky = function () {\n\n\tvar skyShader = THREE.ShaderLib[ 'sky' ];\n\tvar skyUniforms = THREE.UniformsUtils.clone( skyShader.uniforms );\n\n\tvar skyMat = new THREE.ShaderMaterial( {\n\t\tfragmentShader: skyShader.fragmentShader,\n\t\tvertexShader: skyShader.vertexShader,\n\t\tuniforms: skyUniforms,\n\t\tside: THREE.BackSide\n\t} );\n\n\tvar skyGeo = new THREE.SphereBufferGeometry( 450000, 32, 15 );\n\tvar skyMesh = new THREE.Mesh( skyGeo, skyMat );\n\n\n\t// Expose variables\n\tthis.mesh = skyMesh;\n\tthis.uniforms = skyUniforms;\n\n};\n\nexport default Sky;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/environment/Sky.js\n **/","/**\n * lodash 4.0.0 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar debounce = require('lodash.debounce');\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide an options object to indicate whether\n * `func` should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the throttled function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=true] Specify invoking on the leading\n * edge of the timeout.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // avoid excessively updating the position while scrolling\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // cancel a trailing throttled invocation\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing });\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = throttle;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.throttle/index.js\n ** module id = 49\n ** module chunks = 0\n **/","/**\n * lodash 4.0.1 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => logs the number of milliseconds it took for the deferred function to be invoked\n */\nvar now = Date.now;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide an options object to indicate whether `func` should be invoked on\n * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent calls\n * to the debounced function return the result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the debounced function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=false] Specify invoking on the leading\n * edge of the timeout.\n * @param {number} [options.maxWait] The maximum time `func` is allowed to be\n * delayed before it's invoked.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var args,\n maxTimeoutId,\n result,\n stamp,\n thisArg,\n timeoutId,\n trailingCall,\n lastCalled = 0,\n leading = false,\n maxWait = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait);\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (maxTimeoutId) {\n clearTimeout(maxTimeoutId);\n }\n lastCalled = 0;\n args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined;\n }\n\n function complete(isCalled, id) {\n if (id) {\n clearTimeout(id);\n }\n maxTimeoutId = timeoutId = trailingCall = undefined;\n if (isCalled) {\n lastCalled = now();\n result = func.apply(thisArg, args);\n if (!timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n }\n }\n\n function delayed() {\n var remaining = wait - (now() - stamp);\n if (remaining <= 0 || remaining > wait) {\n complete(trailingCall, maxTimeoutId);\n } else {\n timeoutId = setTimeout(delayed, remaining);\n }\n }\n\n function flush() {\n if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) {\n result = func.apply(thisArg, args);\n }\n cancel();\n return result;\n }\n\n function maxDelayed() {\n complete(trailing, timeoutId);\n }\n\n function debounced() {\n args = arguments;\n stamp = now();\n thisArg = this;\n trailingCall = trailing && (timeoutId || !leading);\n\n if (maxWait === false) {\n var leadingCall = leading && !timeoutId;\n } else {\n if (!maxTimeoutId && !leading) {\n lastCalled = stamp;\n }\n var remaining = maxWait - (stamp - lastCalled),\n isCalled = remaining <= 0 || remaining > maxWait;\n\n if (isCalled) {\n if (maxTimeoutId) {\n maxTimeoutId = clearTimeout(maxTimeoutId);\n }\n lastCalled = stamp;\n result = func.apply(thisArg, args);\n }\n else if (!maxTimeoutId) {\n maxTimeoutId = setTimeout(maxDelayed, remaining);\n }\n }\n if (isCalled && timeoutId) {\n timeoutId = clearTimeout(timeoutId);\n }\n else if (!timeoutId && wait !== maxWait) {\n timeoutId = setTimeout(delayed, wait);\n }\n if (leadingCall) {\n isCalled = true;\n result = func.apply(thisArg, args);\n }\n if (isCalled && !timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3);\n * // => 3\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3');\n * // => 3\n */\nfunction toNumber(value) {\n if (isObject(value)) {\n var other = isFunction(value.valueOf) ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.throttle/~/lodash.debounce/index.js\n ** module id = 50\n ** module chunks = 0\n **/","import Orbit, {orbit} from './Controls.Orbit';\n\nconst Controls = {\n Orbit: Orbit,\n orbit, orbit\n};\n\nexport default Controls;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/controls/index.js\n **/","import EventEmitter from 'eventemitter3';\nimport THREE from 'three';\nimport OrbitControls from '../vendor/OrbitControls';\n\nclass Orbit extends EventEmitter {\n constructor() {\n super();\n }\n\n // Proxy control events\n //\n // There's currently no distinction between pan, orbit and zoom events\n _initEvents() {\n this._controls.addEventListener('start', (event) => {\n this._world.emit('controlsMoveStart', event.target.target);\n });\n\n this._controls.addEventListener('change', (event) => {\n this._world.emit('controlsMove', event.target.target);\n });\n\n this._controls.addEventListener('end', (event) => {\n this._world.emit('controlsMoveEnd', event.target.target);\n });\n }\n\n // Moving the camera along the [x,y,z] axis based on a target position\n _panTo(point, animate) {}\n _panBy(pointDelta, animate) {}\n\n // Zooming the camera in and out\n _zoomTo(metres, animate) {}\n _zoomBy(metresDelta, animate) {}\n\n // Force camera to look at something other than the target\n _lookAt(point, animate) {}\n\n // Make camera look at the target\n _lookAtTarget() {}\n\n // Tilt (up and down)\n _tiltTo(angle, animate) {}\n _tiltBy(angleDelta, animate) {}\n\n // Rotate (left and right)\n _rotateTo(angle, animate) {}\n _rotateBy(angleDelta, animate) {}\n\n // Fly to the given point, animating pan and tilt/rotation to final position\n // with nice zoom out and in\n //\n // Calling flyTo a second time before the previous animation has completed\n // will immediately start the new animation from wherever the previous one\n // has got to\n _flyTo(point, noZoom) {}\n\n // Proxy to OrbitControls.update()\n update() {\n this._controls.update();\n }\n\n // Add controls to world instance and store world reference\n addTo(world) {\n world.addControls(this);\n return this;\n }\n\n // Internal method called by World.addControls to actually add the controls\n _addToWorld(world) {\n this._world = world;\n\n // TODO: Override panLeft and panUp methods to prevent panning on Y axis\n // See: http://stackoverflow.com/a/26188674/997339\n this._controls = new OrbitControls(world._engine._camera, world._container);\n\n // Disable keys for now as no events are fired for them anyway\n this._controls.keys = false;\n\n // 89 degrees\n this._controls.maxPolarAngle = 1.5533;\n\n // this._controls.enableDamping = true;\n // this._controls.dampingFactor = 0.25;\n\n this._initEvents();\n\n this.emit('added');\n }\n\n // Destroys the controls and removes them from memory\n destroy() {\n // TODO: Remove event listeners\n\n this._controls.dispose();\n\n this._world = null;\n this._controls = null;\n }\n}\n\nexport default Orbit;\n\nvar noNew = function() {\n return new Orbit();\n};\n\n// Initialise without requiring new keyword\nexport {noNew as orbit};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/controls/Controls.Orbit.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\nimport Hammer from 'hammerjs';\n\n/**\n * @author qiao / https://github.com/qiao\n * @author mrdoob / http://mrdoob.com\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n * @author erich666 / http://erichaines.com\n */\n\n// This set of controls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - left mouse / touch: one finger move\n// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish\n// Pan - right mouse, or arrow keys / touch: three finter swipe\n\nvar OrbitControls = function ( object, domElement ) {\n\n\tthis.object = object;\n\n\tthis.domElement = ( domElement !== undefined ) ? domElement : document;\n\n\t// Set to false to disable this control\n\tthis.enabled = true;\n\n\t// \"target\" sets the location of focus, where the object orbits around\n\tthis.target = new THREE.Vector3();\n\n\t// How far you can dolly in and out ( PerspectiveCamera only )\n\tthis.minDistance = 0;\n\tthis.maxDistance = Infinity;\n\n\t// How far you can zoom in and out ( OrthographicCamera only )\n\tthis.minZoom = 0;\n\tthis.maxZoom = Infinity;\n\n\t// How far you can orbit vertically, upper and lower limits.\n\t// Range is 0 to Math.PI radians.\n\tthis.minPolarAngle = 0; // radians\n\tthis.maxPolarAngle = Math.PI; // radians\n\n\t// How far you can orbit horizontally, upper and lower limits.\n\t// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].\n\tthis.minAzimuthAngle = - Infinity; // radians\n\tthis.maxAzimuthAngle = Infinity; // radians\n\n\t// Set to true to enable damping (inertia)\n\t// If damping is enabled, you must call controls.update() in your animation loop\n\tthis.enableDamping = false;\n\tthis.dampingFactor = 0.25;\n\n\t// This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n\t// Set to false to disable zooming\n\tthis.enableZoom = true;\n\tthis.zoomSpeed = 1.0;\n\n\t// Set to false to disable rotating\n\tthis.enableRotate = true;\n\tthis.rotateSpeed = 1.0;\n\n\t// Set to false to disable panning\n\tthis.enablePan = true;\n\tthis.keyPanSpeed = 7.0;\t// pixels moved per arrow key push\n\n\t// Set to true to automatically rotate around the target\n\t// If auto-rotate is enabled, you must call controls.update() in your animation loop\n\tthis.autoRotate = false;\n\tthis.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\n\t// Set to false to disable use of the keys\n\tthis.enableKeys = true;\n\n\t// The four arrow keys\n\tthis.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };\n\n\t// Mouse buttons\n\tthis.mouseButtons = { ORBIT: THREE.MOUSE.LEFT, ZOOM: THREE.MOUSE.MIDDLE, PAN: THREE.MOUSE.RIGHT };\n\n\t// for reset\n\tthis.target0 = this.target.clone();\n\tthis.position0 = this.object.position.clone();\n\tthis.zoom0 = this.object.zoom;\n\n\t//\n\t// public methods\n\t//\n\n\tthis.getPolarAngle = function () {\n\n\t\treturn phi;\n\n\t};\n\n\tthis.getAzimuthalAngle = function () {\n\n\t\treturn theta;\n\n\t};\n\n\tthis.reset = function () {\n\n\t\tscope.target.copy( scope.target0 );\n\t\tscope.object.position.copy( scope.position0 );\n\t\tscope.object.zoom = scope.zoom0;\n\n\t\tscope.object.updateProjectionMatrix();\n\t\tscope.dispatchEvent( changeEvent );\n\n\t\tscope.update();\n\n\t\tstate = STATE.NONE;\n\n\t};\n\n\t// this method is exposed, but perhaps it would be better if we can make it private...\n\tthis.update = function() {\n\n\t\tvar offset = new THREE.Vector3();\n\n\t\t// so camera.up is the orbit axis\n\t\tvar quat = new THREE.Quaternion().setFromUnitVectors( object.up, new THREE.Vector3( 0, 1, 0 ) );\n\t\tvar quatInverse = quat.clone().inverse();\n\n\t\tvar lastPosition = new THREE.Vector3();\n\t\tvar lastQuaternion = new THREE.Quaternion();\n\n\t\treturn function () {\n\n\t\t\tvar position = scope.object.position;\n\n\t\t\toffset.copy( position ).sub( scope.target );\n\n\t\t\t// rotate offset to \"y-axis-is-up\" space\n\t\t\toffset.applyQuaternion( quat );\n\n\t\t\t// angle from z-axis around y-axis\n\n\t\t\ttheta = Math.atan2( offset.x, offset.z );\n\n\t\t\t// angle from y-axis\n\n\t\t\tphi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y );\n\n\t\t\tif ( scope.autoRotate && state === STATE.NONE ) {\n\n\t\t\t\trotateLeft( getAutoRotationAngle() );\n\n\t\t\t}\n\n\t\t\ttheta += thetaDelta;\n\t\t\tphi += phiDelta;\n\n\t\t\t// restrict theta to be between desired limits\n\t\t\ttheta = Math.max( scope.minAzimuthAngle, Math.min( scope.maxAzimuthAngle, theta ) );\n\n\t\t\t// restrict phi to be between desired limits\n\t\t\tphi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, phi ) );\n\n\t\t\t// restrict phi to be betwee EPS and PI-EPS\n\t\t\tphi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) );\n\n\t\t\tvar radius = offset.length() * scale;\n\n\t\t\t// restrict radius to be between desired limits\n\t\t\tradius = Math.max( scope.minDistance, Math.min( scope.maxDistance, radius ) );\n\n\t\t\t// move target to panned location\n\t\t\tscope.target.add( panOffset );\n\n\t\t\toffset.x = radius * Math.sin( phi ) * Math.sin( theta );\n\t\t\toffset.y = radius * Math.cos( phi );\n\t\t\toffset.z = radius * Math.sin( phi ) * Math.cos( theta );\n\n\t\t\t// rotate offset back to \"camera-up-vector-is-up\" space\n\t\t\toffset.applyQuaternion( quatInverse );\n\n\t\t\tposition.copy( scope.target ).add( offset );\n\n\t\t\tscope.object.lookAt( scope.target );\n\n\t\t\tif ( scope.enableDamping === true ) {\n\n\t\t\t\tthetaDelta *= ( 1 - scope.dampingFactor );\n\t\t\t\tphiDelta *= ( 1 - scope.dampingFactor );\n\n\t\t\t} else {\n\n\t\t\t\tthetaDelta = 0;\n\t\t\t\tphiDelta = 0;\n\n\t\t\t}\n\n\t\t\tscale = 1;\n\t\t\tpanOffset.set( 0, 0, 0 );\n\n\t\t\t// update condition is:\n\t\t\t// min(camera displacement, camera rotation in radians)^2 > EPS\n\t\t\t// using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\n\t\t\tif ( zoomChanged ||\n\t\t\t\tlastPosition.distanceToSquared( scope.object.position ) > EPS ||\n\t\t\t\t8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {\n\n\t\t\t\tscope.dispatchEvent( changeEvent );\n\n\t\t\t\tlastPosition.copy( scope.object.position );\n\t\t\t\tlastQuaternion.copy( scope.object.quaternion );\n\t\t\t\tzoomChanged = false;\n\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t\treturn false;\n\n\t\t};\n\n\t}();\n\n\tthis.dispose = function() {\n\n\t\tscope.domElement.removeEventListener( 'contextmenu', onContextMenu, false );\n\t\tscope.domElement.removeEventListener( 'mousedown', onMouseDown, false );\n\t\tscope.domElement.removeEventListener( 'mousewheel', onMouseWheel, false );\n\t\tscope.domElement.removeEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox\n\n\t\tscope.domElement.removeEventListener( 'touchstart', onTouchStart, false );\n\t\tscope.domElement.removeEventListener( 'touchend', onTouchEnd, false );\n\t\tscope.domElement.removeEventListener( 'touchmove', onTouchMove, false );\n\n\t\tdocument.removeEventListener( 'mousemove', onMouseMove, false );\n\t\tdocument.removeEventListener( 'mouseup', onMouseUp, false );\n\t\tdocument.removeEventListener( 'mouseout', onMouseUp, false );\n\n\t\twindow.removeEventListener( 'keydown', onKeyDown, false );\n\n\t\t//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n\n\t};\n\n\t//\n\t// internals\n\t//\n\n\tvar scope = this;\n\n\tvar changeEvent = { type: 'change' };\n\tvar startEvent = { type: 'start' };\n\tvar endEvent = { type: 'end' };\n\n\tvar STATE = { NONE : - 1, ROTATE : 0, DOLLY : 1, PAN : 2, TOUCH_ROTATE : 3, TOUCH_DOLLY : 4, TOUCH_PAN : 5 };\n\n\tvar state = STATE.NONE;\n\n\tvar EPS = 0.000001;\n\n\t// current position in spherical coordinates\n\tvar theta;\n\tvar phi;\n\n\tvar phiDelta = 0;\n\tvar thetaDelta = 0;\n\tvar scale = 1;\n\tvar panOffset = new THREE.Vector3();\n\tvar zoomChanged = false;\n\n\tvar rotateStart = new THREE.Vector2();\n\tvar rotateEnd = new THREE.Vector2();\n\tvar rotateDelta = new THREE.Vector2();\n\n\tvar panStart = new THREE.Vector2();\n\tvar panEnd = new THREE.Vector2();\n\tvar panDelta = new THREE.Vector2();\n\n\tvar dollyStart = new THREE.Vector2();\n\tvar dollyEnd = new THREE.Vector2();\n\tvar dollyDelta = new THREE.Vector2();\n\n\tfunction getAutoRotationAngle() {\n\n\t\treturn 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n\n\t}\n\n\tfunction getZoomScale() {\n\n\t\treturn Math.pow( 0.95, scope.zoomSpeed );\n\n\t}\n\n\tfunction rotateLeft( angle ) {\n\n\t\tthetaDelta -= angle;\n\n\t}\n\n\tfunction rotateUp( angle ) {\n\n\t\tphiDelta -= angle;\n\n\t}\n\n\tvar panLeft = function() {\n\n\t\tvar v = new THREE.Vector3();\n\n\t\t// return function panLeft( distance, objectMatrix ) {\n //\n\t\t// \tvar te = objectMatrix.elements;\n //\n\t\t// \t// get X column of objectMatrix\n\t\t// \tv.set( te[ 0 ], te[ 1 ], te[ 2 ] );\n //\n\t\t// \tv.multiplyScalar( - distance );\n //\n\t\t// \tpanOffset.add( v );\n //\n\t\t// };\n\n // Fixed panning to x/y plane\n return function panLeft(distance, objectMatrix) {\n\t var te = objectMatrix.elements;\n\t // var adjDist = distance / Math.cos(phi);\n\n\t v.set(te[ 0 ], 0, te[ 2 ]);\n\t v.multiplyScalar(-distance);\n\n\t panOffset.add(v);\n\t };\n\n\t}();\n\n // Fixed panning to x/y plane\n\tvar panUp = function() {\n\n\t\tvar v = new THREE.Vector3();\n\n\t\t// return function panUp( distance, objectMatrix ) {\n //\n\t\t// \tvar te = objectMatrix.elements;\n //\n\t\t// \t// get Y column of objectMatrix\n\t\t// \tv.set( te[ 4 ], te[ 5 ], te[ 6 ] );\n //\n\t\t// \tv.multiplyScalar( distance );\n //\n\t\t// \tpanOffset.add( v );\n //\n\t\t// };\n\n return function panUp(distance, objectMatrix) {\n\t var te = objectMatrix.elements;\n\t var adjDist = distance / Math.cos(phi);\n\n\t v.set(te[ 4 ], 0, te[ 6 ]);\n\t v.multiplyScalar(adjDist);\n\n\t panOffset.add(v);\n\t };\n\n\t}();\n\n\t// deltaX and deltaY are in pixels; right and down are positive\n\tvar pan = function() {\n\n\t\tvar offset = new THREE.Vector3();\n\n\t\treturn function( deltaX, deltaY ) {\n\n\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n\t\t\tif ( scope.object instanceof THREE.PerspectiveCamera ) {\n\n\t\t\t\t// perspective\n\t\t\t\tvar position = scope.object.position;\n\t\t\t\toffset.copy( position ).sub( scope.target );\n\t\t\t\tvar targetDistance = offset.length();\n\n\t\t\t\t// half of the fov is center to top of screen\n\t\t\t\ttargetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );\n\n\t\t\t\t// we actually don't use screenWidth, since perspective camera is fixed to screen height\n\t\t\t\tpanLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix );\n\t\t\t\tpanUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix );\n\n\t\t\t} else if ( scope.object instanceof THREE.OrthographicCamera ) {\n\n\t\t\t\t// orthographic\n\t\t\t\tpanLeft( deltaX * ( scope.object.right - scope.object.left ) / element.clientWidth, scope.object.matrix );\n\t\t\t\tpanUp( deltaY * ( scope.object.top - scope.object.bottom ) / element.clientHeight, scope.object.matrix );\n\n\t\t\t} else {\n\n\t\t\t\t// camera neither orthographic nor perspective\n\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );\n\t\t\t\tscope.enablePan = false;\n\n\t\t\t}\n\n\t\t};\n\n\t}();\n\n\tfunction dollyIn( dollyScale ) {\n\n\t\tif ( scope.object instanceof THREE.PerspectiveCamera ) {\n\n\t\t\tscale /= dollyScale;\n\n\t\t} else if ( scope.object instanceof THREE.OrthographicCamera ) {\n\n\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tzoomChanged = true;\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\tscope.enableZoom = false;\n\n\t\t}\n\n\t}\n\n\tfunction dollyOut( dollyScale ) {\n\n\t\tif ( scope.object instanceof THREE.PerspectiveCamera ) {\n\n\t\t\tscale *= dollyScale;\n\n\t\t} else if ( scope.object instanceof THREE.OrthographicCamera ) {\n\n\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tzoomChanged = true;\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\tscope.enableZoom = false;\n\n\t\t}\n\n\t}\n\n\t//\n\t// event callbacks - update the object state\n\t//\n\n\tfunction handleMouseDownRotate( event ) {\n\n\t\t//console.log( 'handleMouseDownRotate' );\n\n\t\trotateStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseDownDolly( event ) {\n\n\t\t//console.log( 'handleMouseDownDolly' );\n\n\t\tdollyStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseDownPan( event ) {\n\n\t\t//console.log( 'handleMouseDownPan' );\n\n\t\tpanStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseMoveRotate( event ) {\n\n\t\t//console.log( 'handleMouseMoveRotate' );\n\n\t\trotateEnd.set( event.clientX, event.clientY );\n\t\trotateDelta.subVectors( rotateEnd, rotateStart );\n\n\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n\t\t// rotating across whole screen goes 360 degrees around\n\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );\n\n\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );\n\n\t\trotateStart.copy( rotateEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseMoveDolly( event ) {\n\n\t\t//console.log( 'handleMouseMoveDolly' );\n\n\t\tdollyEnd.set( event.clientX, event.clientY );\n\n\t\tdollyDelta.subVectors( dollyEnd, dollyStart );\n\n\t\tif ( dollyDelta.y > 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t} else if ( dollyDelta.y < 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t}\n\n\t\tdollyStart.copy( dollyEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseMovePan( event ) {\n\n\t\t//console.log( 'handleMouseMovePan' );\n\n\t\tpanEnd.set( event.clientX, event.clientY );\n\n\t\tpanDelta.subVectors( panEnd, panStart );\n\n\t\tpan( panDelta.x, panDelta.y );\n\n\t\tpanStart.copy( panEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseUp( event ) {\n\n\t\t//console.log( 'handleMouseUp' );\n\n\t}\n\n\tfunction handleMouseWheel( event ) {\n\n\t\t//console.log( 'handleMouseWheel' );\n\n\t\tvar delta = 0;\n\n\t\tif ( event.wheelDelta !== undefined ) {\n\n\t\t\t// WebKit / Opera / Explorer 9\n\n\t\t\tdelta = event.wheelDelta;\n\n\t\t} else if ( event.detail !== undefined ) {\n\n\t\t\t// Firefox\n\n\t\t\tdelta = - event.detail;\n\n\t\t}\n\n\t\tif ( delta > 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t} else if ( delta < 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t}\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleKeyDown( event ) {\n\n\t\t//console.log( 'handleKeyDown' );\n\n\t\tswitch ( event.keyCode ) {\n\n\t\t\tcase scope.keys.UP:\n\t\t\t\tpan( 0, scope.keyPanSpeed );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.BOTTOM:\n\t\t\t\tpan( 0, - scope.keyPanSpeed );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.LEFT:\n\t\t\t\tpan( scope.keyPanSpeed, 0 );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.RIGHT:\n\t\t\t\tpan( - scope.keyPanSpeed, 0 );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction handleTouchStartRotate( event ) {\n\n\t\t//console.log( 'handleTouchStartRotate' );\n\n\t\trotateStart.set( event.pointers[ 0 ].pageX, event.pointers[ 0 ].pageY );\n\n\t}\n\n\tfunction handleTouchStartDolly( event ) {\n\n\t\t//console.log( 'handleTouchStartDolly' );\n\n\t\tvar dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\tvar dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\n\t\tvar distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\tdollyStart.set( 0, distance );\n\n\t}\n\n\tfunction handleTouchStartPan( event ) {\n\n\t\t//console.log( 'handleTouchStartPan' );\n\n\t\tpanStart.set( event.deltaX, event.deltaY );\n\n\t}\n\n\tfunction handleTouchMoveRotate( event ) {\n\n\t\t//console.log( 'handleTouchMoveRotate' );\n\n\t\trotateEnd.set( event.pointers[ 0 ].pageX, event.pointers[ 0 ].pageY );\n\t\trotateDelta.subVectors( rotateEnd, rotateStart );\n\n\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n\t\t// rotating across whole screen goes 360 degrees around\n\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );\n\n\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );\n\n\t\trotateStart.copy( rotateEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleTouchMoveDolly( event ) {\n\n\t\t//console.log( 'handleTouchMoveDolly' );\n\n\t\tvar dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\tvar dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\n\t\tvar distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\tdollyEnd.set( 0, distance );\n\n\t\tdollyDelta.subVectors( dollyEnd, dollyStart );\n\n\t\tif ( dollyDelta.y > 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t} else if ( dollyDelta.y < 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t}\n\n\t\tdollyStart.copy( dollyEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleTouchMovePan( event ) {\n\n\t\t//console.log( 'handleTouchMovePan' );\n\n\t\tpanEnd.set( event.deltaX, event.deltaY );\n\n\t\tpanDelta.subVectors( panEnd, panStart );\n\n\t\tpan( panDelta.x, panDelta.y );\n\n\t\tpanStart.copy( panEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleTouchEnd( event ) {\n\n\t\t//console.log( 'handleTouchEnd' );\n\n\t}\n\n\t//\n\t// event handlers - FSM: listen for events and reset state\n\t//\n\n\tfunction onMouseDown( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\n\t\tif ( event.button === scope.mouseButtons.ORBIT ) {\n\n\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\thandleMouseDownRotate( event );\n\n\t\t\tstate = STATE.ROTATE;\n\n\t\t} else if ( event.button === scope.mouseButtons.ZOOM ) {\n\n\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\thandleMouseDownDolly( event );\n\n\t\t\tstate = STATE.DOLLY;\n\n\t\t} else if ( event.button === scope.mouseButtons.PAN ) {\n\n\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\thandleMouseDownPan( event );\n\n\t\t\tstate = STATE.PAN;\n\n\t\t}\n\n\t\tif ( state !== STATE.NONE ) {\n\n\t\t\tdocument.addEventListener( 'mousemove', onMouseMove, false );\n\t\t\tdocument.addEventListener( 'mouseup', onMouseUp, false );\n\t\t\tdocument.addEventListener( 'mouseout', onMouseUp, false );\n\n\t\t\tscope.dispatchEvent( startEvent );\n\n\t\t}\n\n\t}\n\n\tfunction onMouseMove( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\n\t\tif ( state === STATE.ROTATE ) {\n\n\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\thandleMouseMoveRotate( event );\n\n\t\t} else if ( state === STATE.DOLLY ) {\n\n\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\thandleMouseMoveDolly( event );\n\n\t\t} else if ( state === STATE.PAN ) {\n\n\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\thandleMouseMovePan( event );\n\n\t\t}\n\n\t}\n\n\tfunction onMouseUp( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\thandleMouseUp( event );\n\n\t\tdocument.removeEventListener( 'mousemove', onMouseMove, false );\n\t\tdocument.removeEventListener( 'mouseup', onMouseUp, false );\n\t\tdocument.removeEventListener( 'mouseout', onMouseUp, false );\n\n\t\tscope.dispatchEvent( endEvent );\n\n\t\tstate = STATE.NONE;\n\n\t}\n\n\tfunction onMouseWheel( event ) {\n\n\t\tif ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;\n\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\thandleMouseWheel( event );\n\n\t\tscope.dispatchEvent( startEvent ); // not sure why these are here...\n\t\tscope.dispatchEvent( endEvent );\n\n\t}\n\n\tfunction onKeyDown( event ) {\n\n\t\tif ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return;\n\n\t\thandleKeyDown( event );\n\n\t}\n\n\tfunction onTouchStart( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tswitch ( event.touches.length ) {\n\n\t\t\tcase 1:\t// one-fingered touch: rotate\n\n\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\thandleTouchStartRotate( event );\n\n\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\t// two-fingered touch: dolly\n\n\t\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\t\thandleTouchStartDolly( event );\n\n\t\t\t\tstate = STATE.TOUCH_DOLLY;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 3: // three-fingered touch: pan\n\n\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\thandleTouchStartPan( event );\n\n\t\t\t\tstate = STATE.TOUCH_PAN;\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tstate = STATE.NONE;\n\n\t\t}\n\n\t\tif ( state !== STATE.NONE ) {\n\n\t\t\tscope.dispatchEvent( startEvent );\n\n\t\t}\n\n\t}\n\n\tfunction onTouchMove( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\tswitch ( event.touches.length ) {\n\n\t\t\tcase 1: // one-fingered touch: rotate\n\n\t\t\t\tif ( scope.enableRotate === false ) return;\n\t\t\t\tif ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...\n\n\t\t\t\thandleTouchMoveRotate( event );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 2: // two-fingered touch: dolly\n\n\t\t\t\tif ( scope.enableZoom === false ) return;\n\t\t\t\tif ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...\n\n\t\t\t\thandleTouchMoveDolly( event );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 3: // three-fingered touch: pan\n\n\t\t\t\tif ( scope.enablePan === false ) return;\n\t\t\t\tif ( state !== STATE.TOUCH_PAN ) return; // is this needed?...\n\n\t\t\t\thandleTouchMovePan( event );\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tstate = STATE.NONE;\n\n\t\t}\n\n\t}\n\n\tfunction onTouchEnd( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\thandleTouchEnd( event );\n\n\t\tscope.dispatchEvent( endEvent );\n\n\t\tstate = STATE.NONE;\n\n\t}\n\n\tfunction onContextMenu( event ) {\n\n\t\tevent.preventDefault();\n\n\t}\n\n\t//\n\n\tscope.domElement.addEventListener( 'contextmenu', onContextMenu, false );\n\n\tscope.domElement.addEventListener( 'mousedown', onMouseDown, false );\n\tscope.domElement.addEventListener( 'mousewheel', onMouseWheel, false );\n\tscope.domElement.addEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox\n\n\t// scope.domElement.addEventListener( 'touchstart', onTouchStart, false );\n\t// scope.domElement.addEventListener( 'touchend', onTouchEnd, false );\n\t// scope.domElement.addEventListener( 'touchmove', onTouchMove, false );\n\n\tscope.hammer = new Hammer(scope.domElement);\n\n\tscope.hammer.get('pan').set({\n\t\tpointers: 0,\n\t\tdirection: Hammer.DIRECTION_ALL\n\t});\n\n\tscope.hammer.get('pinch').set({\n\t\tenable: true,\n\t\tthreshold: 0.1\n\t});\n\n\tscope.hammer.on('panstart', function(event) {\n\t\tif (scope.enabled === false) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.pointers.length === 1) {\n\t\t\tif (scope.enablePan === false) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\thandleTouchStartPan(event);\n\t\t\t// panStart.set(event.deltaX, event.deltaY);\n\n\t\t\tstate = STATE.TOUCH_PAN;\n\t\t} else if (event.pointers.length === 2) {\n\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\thandleTouchStartRotate( event );\n\n\t\t\tstate = STATE.TOUCH_ROTATE;\n\t\t}\n\n\t\tif (state !== STATE.NONE) {\n\t\t\tscope.dispatchEvent(startEvent);\n\t\t}\n\t});\n\n\tscope.hammer.on('panend', function(event) {\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tonTouchEnd(event);\n\t});\n\n\tscope.hammer.on('panmove', function(event) {\n\t\tif ( scope.enabled === false ) return;\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\t// event.preventDefault();\n\t\t// event.stopPropagation();\n\n\t\tif (event.pointers.length === 1) {\n\t\t\tif ( scope.enablePan === false ) return;\n\t\t\tif ( state !== STATE.TOUCH_PAN ) return; // is this needed?...\n\n\t\t\thandleTouchMovePan( event );\n\n\t\t\t// panEnd.set( event.deltaX, event.deltaY );\n\t\t\t//\n\t\t\t// panDelta.subVectors( panEnd, panStart );\n\t\t\t//\n\t\t\t// pan( panDelta.x, panDelta.y );\n\t\t\t//\n\t\t\t// panStart.copy( panEnd );\n\t\t\t//\n\t\t\t// scope.update();\n\t\t} else if (event.pointers.length === 2) {\n\t\t\tif ( scope.enableRotate === false ) return;\n\t\t\tif ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...\n\n\t\t\thandleTouchMoveRotate( event );\n\t\t}\n\t});\n\n\tscope.hammer.on('pinchstart', function(event) {\n\t\tif ( scope.enabled === false ) return;\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( scope.enableZoom === false ) return;\n\n\t\thandleTouchStartDolly( event );\n\n\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t//\n\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t//\n\t\t// dollyStart.set( 0, distance );\n\t\t//\n\t\tstate = STATE.TOUCH_DOLLY;\n\n\t\tif (state !== STATE.NONE) {\n\t\t\tscope.dispatchEvent(startEvent);\n\t\t}\n\t});\n\n\tscope.hammer.on('pinchend', function(event) {\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tonTouchEnd(event);\n\t});\n\n\tscope.hammer.on('pinchmove', function(event) {\n\t\tif ( scope.enabled === false ) return;\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\t// event.preventDefault();\n\t\t// event.stopPropagation();\n\n\t\tif ( scope.enableZoom === false ) return;\n\t\tif ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...\n\n\t\thandleTouchMoveDolly( event );\n\n\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t//\n\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t//\n\t\t// dollyEnd.set( 0, distance );\n\t\t//\n\t\t// dollyDelta.subVectors( dollyEnd, dollyStart );\n\t\t//\n\t\t// if ( dollyDelta.y > 0 ) {\n\t\t//\n\t\t// \tdollyOut( getZoomScale() );\n\t\t//\n\t\t// } else if ( dollyDelta.y < 0 ) {\n\t\t//\n\t\t// \tdollyIn( getZoomScale() );\n\t\t//\n\t\t// }\n\t\t//\n\t\t// dollyStart.copy( dollyEnd );\n\t\t//\n\t\t// scope.update();\n\t});\n\n\twindow.addEventListener( 'keydown', onKeyDown, false );\n\n\t// force an update at start\n\n\tthis.update();\n\n};\n\nOrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );\nOrbitControls.prototype.constructor = THREE.OrbitControls;\n\nObject.defineProperties( OrbitControls.prototype, {\n\n\tcenter: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .center has been renamed to .target' );\n\t\t\treturn this.target;\n\n\t\t}\n\n\t},\n\n\t// backward compatibility\n\n\tnoZoom: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );\n\t\t\treturn ! this.enableZoom;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );\n\t\t\tthis.enableZoom = ! value;\n\n\t\t}\n\n\t},\n\n\tnoRotate: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );\n\t\t\treturn ! this.enableRotate;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );\n\t\t\tthis.enableRotate = ! value;\n\n\t\t}\n\n\t},\n\n\tnoPan: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );\n\t\t\treturn ! this.enablePan;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );\n\t\t\tthis.enablePan = ! value;\n\n\t\t}\n\n\t},\n\n\tnoKeys: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );\n\t\t\treturn ! this.enableKeys;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );\n\t\t\tthis.enableKeys = ! value;\n\n\t\t}\n\n\t},\n\n\tstaticMoving : {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );\n\t\t\treturn ! this.constraint.enableDamping;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );\n\t\t\tthis.constraint.enableDamping = ! value;\n\n\t\t}\n\n\t},\n\n\tdynamicDampingFactor : {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );\n\t\t\treturn this.constraint.dampingFactor;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );\n\t\t\tthis.constraint.dampingFactor = value;\n\n\t\t}\n\n\t}\n\n} );\n\nexport default OrbitControls;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/OrbitControls.js\n **/","/*! Hammer.JS - v2.0.6 - 2015-12-23\n * http://hammerjs.github.io/\n *\n * Copyright (c) 2015 Jorik Tangelder;\n * Licensed under the license */\n(function(window, document, exportName, undefined) {\n 'use strict';\n\nvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\nvar TEST_ELEMENT = document.createElement('div');\n\nvar TYPE_FUNCTION = 'function';\n\nvar round = Math.round;\nvar abs = Math.abs;\nvar now = Date.now;\n\n/**\n * set a timeout with a given scope\n * @param {Function} fn\n * @param {Number} timeout\n * @param {Object} context\n * @returns {number}\n */\nfunction setTimeoutContext(fn, timeout, context) {\n return setTimeout(bindFn(fn, context), timeout);\n}\n\n/**\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\nfunction invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n return false;\n}\n\n/**\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\nfunction each(obj, iterator, context) {\n var i;\n\n if (!obj) {\n return;\n }\n\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n}\n\n/**\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\nfunction deprecate(method, name, message) {\n var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n return function() {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '')\n .replace(/^\\s+at\\s+/gm, '')\n .replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n\n var log = window.console && (window.console.warn || window.console.log);\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n return method.apply(this, arguments);\n };\n}\n\n/**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\nvar assign;\nif (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n} else {\n assign = Object.assign;\n}\n\n/**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean=false} [merge]\n * @returns {Object} dest\n */\nvar extend = deprecate(function extend(dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n while (i < keys.length) {\n if (!merge || (merge && dest[keys[i]] === undefined)) {\n dest[keys[i]] = src[keys[i]];\n }\n i++;\n }\n return dest;\n}, 'extend', 'Use `assign`.');\n\n/**\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\nvar merge = deprecate(function merge(dest, src) {\n return extend(dest, src, true);\n}, 'merge', 'Use `assign`.');\n\n/**\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\nfunction inherit(child, base, properties) {\n var baseP = base.prototype,\n childP;\n\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n\n if (properties) {\n assign(childP, properties);\n }\n}\n\n/**\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\nfunction bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n}\n\n/**\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\nfunction boolOrFn(val, args) {\n if (typeof val == TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n return val;\n}\n\n/**\n * use the val2 when val1 is undefined\n * @param {*} val1\n * @param {*} val2\n * @returns {*}\n */\nfunction ifUndefined(val1, val2) {\n return (val1 === undefined) ? val2 : val1;\n}\n\n/**\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\nfunction addEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.addEventListener(type, handler, false);\n });\n}\n\n/**\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\nfunction removeEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.removeEventListener(type, handler, false);\n });\n}\n\n/**\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\nfunction hasParent(node, parent) {\n while (node) {\n if (node == parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n}\n\n/**\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\nfunction inStr(str, find) {\n return str.indexOf(find) > -1;\n}\n\n/**\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\nfunction splitStr(str) {\n return str.trim().split(/\\s+/g);\n}\n\n/**\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\nfunction inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n while (i < src.length) {\n if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n return i;\n }\n i++;\n }\n return -1;\n }\n}\n\n/**\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\nfunction toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n}\n\n/**\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\nfunction uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n values[i] = val;\n i++;\n }\n\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function sortUniqueArray(a, b) {\n return a[key] > b[key];\n });\n }\n }\n\n return results;\n}\n\n/**\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\nfunction prefixed(obj, property) {\n var prefix, prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n\n var i = 0;\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = (prefix) ? prefix + camelProp : property;\n\n if (prop in obj) {\n return prop;\n }\n i++;\n }\n return undefined;\n}\n\n/**\n * get a unique id\n * @returns {number} uniqueId\n */\nvar _uniqueId = 1;\nfunction uniqueId() {\n return _uniqueId++;\n}\n\n/**\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\nfunction getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return (doc.defaultView || doc.parentWindow || window);\n}\n\nvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n\nvar SUPPORT_TOUCH = ('ontouchstart' in window);\nvar SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\nvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n\nvar INPUT_TYPE_TOUCH = 'touch';\nvar INPUT_TYPE_PEN = 'pen';\nvar INPUT_TYPE_MOUSE = 'mouse';\nvar INPUT_TYPE_KINECT = 'kinect';\n\nvar COMPUTE_INTERVAL = 25;\n\nvar INPUT_START = 1;\nvar INPUT_MOVE = 2;\nvar INPUT_END = 4;\nvar INPUT_CANCEL = 8;\n\nvar DIRECTION_NONE = 1;\nvar DIRECTION_LEFT = 2;\nvar DIRECTION_RIGHT = 4;\nvar DIRECTION_UP = 8;\nvar DIRECTION_DOWN = 16;\n\nvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\nvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\nvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n\nvar PROPS_XY = ['x', 'y'];\nvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n/**\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\nfunction Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget;\n\n // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n this.domHandler = function(ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n\n this.init();\n\n}\n\nInput.prototype = {\n /**\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n handler: function() { },\n\n /**\n * bind the events\n */\n init: function() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n },\n\n /**\n * unbind the events\n */\n destroy: function() {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n }\n};\n\n/**\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\nfunction createInputInstance(manager) {\n var Type;\n var inputClass = manager.options.inputClass;\n\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n return new (Type)(manager, inputHandler);\n}\n\n/**\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\nfunction inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n\n if (isFirst) {\n manager.session = {};\n }\n\n // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n input.eventType = eventType;\n\n // compute scale, rotation etc\n computeInputData(manager, input);\n\n // emit secret event\n manager.emit('hammer.input', input);\n\n manager.recognize(input);\n manager.session.prevInput = input;\n}\n\n/**\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\nfunction computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length;\n\n // store the first input to calculate the distance and direction\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n }\n\n // to compute scale and rotation we need to store the multiple touches\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n\n var firstInput = session.firstInput;\n var firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n\n input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n\n computeIntervalInputData(session, input);\n\n // find the correct target\n var target = manager.element;\n if (hasParent(input.srcEvent.target, target)) {\n target = input.srcEvent.target;\n }\n input.target = target;\n}\n\nfunction computeDeltaXY(session, input) {\n var center = input.center;\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n}\n\n/**\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\nfunction computeIntervalInputData(session, input) {\n var last = session.lastInterval || input,\n deltaTime = input.timeStamp - last.timeStamp,\n velocity, velocityX, velocityY, direction;\n\n if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n}\n\n/**\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\nfunction simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n}\n\n/**\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\nfunction getCenter(pointers) {\n var pointersLength = pointers.length;\n\n // no need to loop when only one touch\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n\n var x = 0, y = 0, i = 0;\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n}\n\n/**\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\nfunction getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n}\n\n/**\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\nfunction getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n}\n\n/**\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\nfunction getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n\n return Math.sqrt((x * x) + (y * y));\n}\n\n/**\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\nfunction getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n}\n\n/**\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\nfunction getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n}\n\n/**\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\nfunction getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n}\n\nvar MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n};\n\nvar MOUSE_ELEMENT_EVENTS = 'mousedown';\nvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\n/**\n * Mouse events input\n * @constructor\n * @extends Input\n */\nfunction MouseInput() {\n this.evEl = MOUSE_ELEMENT_EVENTS;\n this.evWin = MOUSE_WINDOW_EVENTS;\n\n this.allow = true; // used by Input.TouchMouse to disable mouse events\n this.pressed = false; // mousedown state\n\n Input.apply(this, arguments);\n}\n\ninherit(MouseInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function MEhandler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type];\n\n // on start we want to have the left mouse button down\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n }\n\n // mouse must be down, and mouse events are allowed (see the TouchMouse input)\n if (!this.pressed || !this.allow) {\n return;\n }\n\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n }\n});\n\nvar POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n};\n\n// in IE10 the pointer types is defined as an enum\nvar IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n};\n\nvar POINTER_ELEMENT_EVENTS = 'pointerdown';\nvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\n// IE10 has prefixed support, and case-sensitive\nif (window.MSPointerEvent && !window.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n}\n\n/**\n * Pointer events input\n * @constructor\n * @extends Input\n */\nfunction PointerEventInput() {\n this.evEl = POINTER_ELEMENT_EVENTS;\n this.evWin = POINTER_WINDOW_EVENTS;\n\n Input.apply(this, arguments);\n\n this.store = (this.manager.session.pointerEvents = []);\n}\n\ninherit(PointerEventInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function PEhandler(ev) {\n var store = this.store;\n var removePointer = false;\n\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n\n var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n\n // get index of the event in the store\n var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\n // start and mouse must be down\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n }\n\n // it not found, so the pointer hasn't been down (so it's probably a hover)\n if (storeIndex < 0) {\n return;\n }\n\n // update the event in the store\n store[storeIndex] = ev;\n\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n }\n});\n\nvar SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\n\nvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\nvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n/**\n * Touch events input\n * @constructor\n * @extends Input\n */\nfunction SingleTouchInput() {\n this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n this.started = false;\n\n Input.apply(this, arguments);\n}\n\ninherit(SingleTouchInput, Input, {\n handler: function TEhandler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\n // should we handle the touch events?\n if (type === INPUT_START) {\n this.started = true;\n }\n\n if (!this.started) {\n return;\n }\n\n var touches = normalizeSingleTouches.call(this, ev, type);\n\n // when done, reset the started state\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n});\n\n/**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\nfunction normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n\n return [all, changed];\n}\n\nvar TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\n\nvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n/**\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\nfunction TouchInput() {\n this.evTarget = TOUCH_TARGET_EVENTS;\n this.targetIds = {};\n\n Input.apply(this, arguments);\n}\n\ninherit(TouchInput, Input, {\n handler: function MTEhandler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n if (!touches) {\n return;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n});\n\n/**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\nfunction getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds;\n\n // when there is only one touch, the process can be simplified\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n\n var i,\n targetTouches,\n changedTouches = toArray(ev.changedTouches),\n changedTargetTouches = [],\n target = this.target;\n\n // get target touches from touches\n targetTouches = allTouches.filter(function(touch) {\n return hasParent(touch.target, target);\n });\n\n // collect touches\n if (type === INPUT_START) {\n i = 0;\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n }\n\n // filter changed touches to only contain touches that exist in the collected target ids\n i = 0;\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n }\n\n // cleanup removed touches\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n i++;\n }\n\n if (!changedTargetTouches.length) {\n return;\n }\n\n return [\n // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n changedTargetTouches\n ];\n}\n\n/**\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\nfunction TouchMouseInput() {\n Input.apply(this, arguments);\n\n var handler = bindFn(this.handler, this);\n this.touch = new TouchInput(this.manager, handler);\n this.mouse = new MouseInput(this.manager, handler);\n}\n\ninherit(TouchMouseInput, Input, {\n /**\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n handler: function TMEhandler(manager, inputEvent, inputData) {\n var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),\n isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n\n // when we're in a touch event, so block all upcoming mouse events\n // most mobile browser also emit mouseevents, right after touchstart\n if (isTouch) {\n this.mouse.allow = false;\n } else if (isMouse && !this.mouse.allow) {\n return;\n }\n\n // reset the allowMouse when we're done\n if (inputEvent & (INPUT_END | INPUT_CANCEL)) {\n this.mouse.allow = true;\n }\n\n this.callback(manager, inputEvent, inputData);\n },\n\n /**\n * remove the event listeners\n */\n destroy: function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n }\n});\n\nvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\nvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\n// magical touchAction value\nvar TOUCH_ACTION_COMPUTE = 'compute';\nvar TOUCH_ACTION_AUTO = 'auto';\nvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\nvar TOUCH_ACTION_NONE = 'none';\nvar TOUCH_ACTION_PAN_X = 'pan-x';\nvar TOUCH_ACTION_PAN_Y = 'pan-y';\n\n/**\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\nfunction TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n}\n\nTouchAction.prototype = {\n /**\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n set: function(value) {\n // find out the touch-action by the event handlers\n if (value == TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n\n if (NATIVE_TOUCH_ACTION && this.manager.element.style) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n this.actions = value.toLowerCase().trim();\n },\n\n /**\n * just re-set the touchAction value\n */\n update: function() {\n this.set(this.manager.options.touchAction);\n },\n\n /**\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n compute: function() {\n var actions = [];\n each(this.manager.recognizers, function(recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n },\n\n /**\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n preventDefaults: function(input) {\n // not needed with native support for the touchAction property\n if (NATIVE_TOUCH_ACTION) {\n return;\n }\n\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection;\n\n // if the touch action did prevented once this session\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\n if (hasNone) {\n //do not prevent defaults if this is a tap gesture\n\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n\n if (hasNone ||\n (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n (hasPanX && direction & DIRECTION_VERTICAL)) {\n return this.preventSrc(srcEvent);\n }\n },\n\n /**\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n preventSrc: function(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n }\n};\n\n/**\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\nfunction cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\n // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n }\n\n // pan-x OR pan-y\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n }\n\n // manipulation\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n\n return TOUCH_ACTION_AUTO;\n}\n\n/**\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\nvar STATE_POSSIBLE = 1;\nvar STATE_BEGAN = 2;\nvar STATE_CHANGED = 4;\nvar STATE_ENDED = 8;\nvar STATE_RECOGNIZED = STATE_ENDED;\nvar STATE_CANCELLED = 16;\nvar STATE_FAILED = 32;\n\n/**\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\nfunction Recognizer(options) {\n this.options = assign({}, this.defaults, options || {});\n\n this.id = uniqueId();\n\n this.manager = null;\n\n // default is enable true\n this.options.enable = ifUndefined(this.options.enable, true);\n\n this.state = STATE_POSSIBLE;\n\n this.simultaneous = {};\n this.requireFail = [];\n}\n\nRecognizer.prototype = {\n /**\n * @virtual\n * @type {Object}\n */\n defaults: {},\n\n /**\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n set: function(options) {\n assign(this.options, options);\n\n // also update the touchAction, in case something changed about the directions/enabled state\n this.manager && this.manager.touchAction.update();\n return this;\n },\n\n /**\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n recognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n return this;\n },\n\n /**\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRecognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n },\n\n /**\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n requireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n return this;\n },\n\n /**\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRequireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n return this;\n },\n\n /**\n * has require failures boolean\n * @returns {boolean}\n */\n hasRequireFailures: function() {\n return this.requireFail.length > 0;\n },\n\n /**\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n canRecognizeWith: function(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n },\n\n /**\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n emit: function(input) {\n var self = this;\n var state = this.state;\n\n function emit(event) {\n self.manager.emit(event, input);\n }\n\n // 'panstart' and 'panmove'\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n }\n\n // panend and pancancel\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n },\n\n /**\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n tryEmit: function(input) {\n if (this.canEmit()) {\n return this.emit(input);\n }\n // it's failing anyway\n this.state = STATE_FAILED;\n },\n\n /**\n * can we emit?\n * @returns {boolean}\n */\n canEmit: function() {\n var i = 0;\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n i++;\n }\n return true;\n },\n\n /**\n * update the recognizer\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign({}, inputData);\n\n // is is enabled and allow recognizing?\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n }\n\n // reset when we've reached the end\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n\n this.state = this.process(inputDataClone);\n\n // the recognizer has recognized a gesture\n // so trigger an event\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n },\n\n /**\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {Const} STATE\n */\n process: function(inputData) { }, // jshint ignore:line\n\n /**\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n getTouchAction: function() { },\n\n /**\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n reset: function() { }\n};\n\n/**\n * get a usable string, used as event postfix\n * @param {Const} state\n * @returns {String} state\n */\nfunction stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n return '';\n}\n\n/**\n * direction cons to string\n * @param {Const} direction\n * @returns {String}\n */\nfunction directionStr(direction) {\n if (direction == DIRECTION_DOWN) {\n return 'down';\n } else if (direction == DIRECTION_UP) {\n return 'up';\n } else if (direction == DIRECTION_LEFT) {\n return 'left';\n } else if (direction == DIRECTION_RIGHT) {\n return 'right';\n }\n return '';\n}\n\n/**\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\nfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n if (manager) {\n return manager.get(otherRecognizer);\n }\n return otherRecognizer;\n}\n\n/**\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\nfunction AttrRecognizer() {\n Recognizer.apply(this, arguments);\n}\n\ninherit(AttrRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof AttrRecognizer\n */\n defaults: {\n /**\n * @type {Number}\n * @default 1\n */\n pointers: 1\n },\n\n /**\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n attrTest: function(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n },\n\n /**\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n process: function(input) {\n var state = this.state;\n var eventType = input.eventType;\n\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input);\n\n // on cancel input and we've recognized before, return STATE_CANCELLED\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n return state | STATE_CHANGED;\n }\n return STATE_FAILED;\n }\n});\n\n/**\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction PanRecognizer() {\n AttrRecognizer.apply(this, arguments);\n\n this.pX = null;\n this.pY = null;\n}\n\ninherit(PanRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PanRecognizer\n */\n defaults: {\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n },\n\n getTouchAction: function() {\n var direction = this.options.direction;\n var actions = [];\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n return actions;\n },\n\n directionTest: function(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY;\n\n // lock to axis?\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x != this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y != this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n },\n\n attrTest: function(input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) &&\n (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n },\n\n emit: function(input) {\n\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n\n var direction = directionStr(input.direction);\n\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n this._super.emit.call(this, input);\n }\n});\n\n/**\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\nfunction PinchRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(PinchRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'pinch',\n threshold: 0,\n pointers: 2\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n\n attrTest: function(input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n },\n\n emit: function(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n this._super.emit.call(this, input);\n }\n});\n\n/**\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\nfunction PressRecognizer() {\n Recognizer.apply(this, arguments);\n\n this._timer = null;\n this._input = null;\n}\n\ninherit(PressRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PressRecognizer\n */\n defaults: {\n event: 'press',\n pointers: 1,\n time: 251, // minimal time of the pointer to be pressed\n threshold: 9 // a minimal movement is ok, but keep it low\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_AUTO];\n },\n\n process: function(input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n\n this._input = input;\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeoutContext(function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.time, this);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n return STATE_FAILED;\n },\n\n reset: function() {\n clearTimeout(this._timer);\n },\n\n emit: function(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n\n if (input && (input.eventType & INPUT_END)) {\n this.manager.emit(this.options.event + 'up', input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n }\n});\n\n/**\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction RotateRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(RotateRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof RotateRecognizer\n */\n defaults: {\n event: 'rotate',\n threshold: 0,\n pointers: 2\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n\n attrTest: function(input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n }\n});\n\n/**\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction SwipeRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(SwipeRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof SwipeRecognizer\n */\n defaults: {\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n },\n\n getTouchAction: function() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n },\n\n attrTest: function(input) {\n var direction = this.options.direction;\n var velocity;\n\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n\n return this._super.attrTest.call(this, input) &&\n direction & input.offsetDirection &&\n input.distance > this.options.threshold &&\n input.maxPointers == this.options.pointers &&\n abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n },\n\n emit: function(input) {\n var direction = directionStr(input.offsetDirection);\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n\n this.manager.emit(this.options.event, input);\n }\n});\n\n/**\n * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\nfunction TapRecognizer() {\n Recognizer.apply(this, arguments);\n\n // previous time and center,\n // used for tap counting\n this.pTime = false;\n this.pCenter = false;\n\n this._timer = null;\n this._input = null;\n this.count = 0;\n}\n\ninherit(TapRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300, // max time between the multi-tap taps\n time: 250, // max time of the pointer to be down (like finger on the screen)\n threshold: 9, // a minimal movement is ok, but keep it low\n posThreshold: 10 // a multi-tap can be a bit off the initial position\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_MANIPULATION];\n },\n\n process: function(input) {\n var options = this.options;\n\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n\n this.reset();\n\n if ((input.eventType & INPUT_START) && (this.count === 0)) {\n return this.failTimeout();\n }\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType != INPUT_END) {\n return this.failTimeout();\n }\n\n var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n\n this._input = input;\n\n // if tap count matches we have recognized it,\n // else it has began recognizing...\n var tapCount = this.count % options.taps;\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeoutContext(function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.interval, this);\n return STATE_BEGAN;\n }\n }\n }\n return STATE_FAILED;\n },\n\n failTimeout: function() {\n this._timer = setTimeoutContext(function() {\n this.state = STATE_FAILED;\n }, this.options.interval, this);\n return STATE_FAILED;\n },\n\n reset: function() {\n clearTimeout(this._timer);\n },\n\n emit: function() {\n if (this.state == STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n }\n});\n\n/**\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\nfunction Hammer(element, options) {\n options = options || {};\n options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n return new Manager(element, options);\n}\n\n/**\n * @const {string}\n */\nHammer.VERSION = '2.0.6';\n\n/**\n * default settings\n * @namespace\n */\nHammer.defaults = {\n /**\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n\n /**\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n\n /**\n * @type {Boolean}\n * @default true\n */\n enable: true,\n\n /**\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n\n /**\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n\n /**\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * @type {Array}\n */\n preset: [\n // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n [RotateRecognizer, {enable: false}],\n [PinchRecognizer, {enable: false}, ['rotate']],\n [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],\n [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],\n [TapRecognizer],\n [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],\n [PressRecognizer]\n ],\n\n /**\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: 'none',\n\n /**\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: 'none',\n\n /**\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: 'none',\n\n /**\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: 'none',\n\n /**\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: 'none',\n\n /**\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: 'rgba(0,0,0,0)'\n }\n};\n\nvar STOP = 1;\nvar FORCED_STOP = 2;\n\n/**\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\nfunction Manager(element, options) {\n this.options = assign({}, Hammer.defaults, options || {});\n\n this.options.inputTarget = this.options.inputTarget || element;\n\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n\n toggleCssProps(this, true);\n\n each(this.options.recognizers, function(item) {\n var recognizer = this.add(new (item[0])(item[1]));\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n}\n\nManager.prototype = {\n /**\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n set: function(options) {\n assign(this.options, options);\n\n // Options that need a little more setup\n if (options.touchAction) {\n this.touchAction.update();\n }\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n return this;\n },\n\n /**\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n stop: function(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n },\n\n /**\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n var session = this.session;\n if (session.stopped) {\n return;\n }\n\n // run the touch-action polyfill\n this.touchAction.preventDefaults(inputData);\n\n var recognizer;\n var recognizers = this.recognizers;\n\n // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n var curRecognizer = session.curRecognizer;\n\n // reset when the last recognizer is recognized\n // or when we're in a new session\n if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n curRecognizer = session.curRecognizer = null;\n }\n\n var i = 0;\n while (i < recognizers.length) {\n recognizer = recognizers[i];\n\n // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer == curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) { // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n }\n\n // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n curRecognizer = session.curRecognizer = recognizer;\n }\n i++;\n }\n },\n\n /**\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n get: function(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n\n var recognizers = this.recognizers;\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event == recognizer) {\n return recognizers[i];\n }\n }\n return null;\n },\n\n /**\n * add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n add: function(recognizer) {\n if (invokeArrayArg(recognizer, 'add', this)) {\n return this;\n }\n\n // remove existing\n var existing = this.get(recognizer.options.event);\n if (existing) {\n this.remove(existing);\n }\n\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n\n this.touchAction.update();\n return recognizer;\n },\n\n /**\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n remove: function(recognizer) {\n if (invokeArrayArg(recognizer, 'remove', this)) {\n return this;\n }\n\n recognizer = this.get(recognizer);\n\n // let's make sure this recognizer exists\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, recognizer);\n\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n\n return this;\n },\n\n /**\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n on: function(events, handler) {\n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n },\n\n /**\n * unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n off: function(events, handler) {\n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n },\n\n /**\n * emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n emit: function(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n }\n\n // no handlers, so skip it all\n var handlers = this.handlers[event] && this.handlers[event].slice();\n if (!handlers || !handlers.length) {\n return;\n }\n\n data.type = event;\n data.preventDefault = function() {\n data.srcEvent.preventDefault();\n };\n\n var i = 0;\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n },\n\n /**\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n destroy: function() {\n this.element && toggleCssProps(this, false);\n\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n }\n};\n\n/**\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\nfunction toggleCssProps(manager, add) {\n var element = manager.element;\n if (!element.style) {\n return;\n }\n each(manager.options.cssProps, function(value, name) {\n element.style[prefixed(element.style, name)] = add ? value : '';\n });\n}\n\n/**\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\nfunction triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent('Event');\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n}\n\nassign(Hammer, {\n INPUT_START: INPUT_START,\n INPUT_MOVE: INPUT_MOVE,\n INPUT_END: INPUT_END,\n INPUT_CANCEL: INPUT_CANCEL,\n\n STATE_POSSIBLE: STATE_POSSIBLE,\n STATE_BEGAN: STATE_BEGAN,\n STATE_CHANGED: STATE_CHANGED,\n STATE_ENDED: STATE_ENDED,\n STATE_RECOGNIZED: STATE_RECOGNIZED,\n STATE_CANCELLED: STATE_CANCELLED,\n STATE_FAILED: STATE_FAILED,\n\n DIRECTION_NONE: DIRECTION_NONE,\n DIRECTION_LEFT: DIRECTION_LEFT,\n DIRECTION_RIGHT: DIRECTION_RIGHT,\n DIRECTION_UP: DIRECTION_UP,\n DIRECTION_DOWN: DIRECTION_DOWN,\n DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n DIRECTION_ALL: DIRECTION_ALL,\n\n Manager: Manager,\n Input: Input,\n TouchAction: TouchAction,\n\n TouchInput: TouchInput,\n MouseInput: MouseInput,\n PointerEventInput: PointerEventInput,\n TouchMouseInput: TouchMouseInput,\n SingleTouchInput: SingleTouchInput,\n\n Recognizer: Recognizer,\n AttrRecognizer: AttrRecognizer,\n Tap: TapRecognizer,\n Pan: PanRecognizer,\n Swipe: SwipeRecognizer,\n Pinch: PinchRecognizer,\n Rotate: RotateRecognizer,\n Press: PressRecognizer,\n\n on: addEventListeners,\n off: removeEventListeners,\n each: each,\n merge: merge,\n extend: extend,\n assign: assign,\n inherit: inherit,\n bindFn: bindFn,\n prefixed: prefixed\n});\n\n// this prevents errors when Hammer is loaded in the presence of an AMD\n// style loader but by script tag, not by the loader.\nvar freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\nfreeGlobal.Hammer = Hammer;\n\nif (typeof define === 'function' && define.amd) {\n define(function() {\n return Hammer;\n });\n} else if (typeof module != 'undefined' && module.exports) {\n module.exports = Hammer;\n} else {\n window[exportName] = Hammer;\n}\n\n})(window, document, 'Hammer');\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/hammerjs/hammer.js\n ** module id = 54\n ** module chunks = 0\n **/","import TileLayer from './TileLayer';\nimport ImageTile from './ImageTile';\nimport ImageTileLayerBaseMaterial from './ImageTileLayerBaseMaterial';\nimport throttle from 'lodash.throttle';\nimport THREE from 'three';\nimport extend from 'lodash.assign';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// DONE: Find a way to avoid the flashing caused by the gap between old tiles\n// being removed and the new tiles being ready for display\n//\n// DONE: Simplest first step for MVP would be to give each tile mesh the colour\n// of the basemap ground so it blends in a little more, or have a huge ground\n// plane underneath all the tiles that shows through between tile updates.\n//\n// Could keep the old tiles around until the new ones are ready, though they'd\n// probably need to be layered in a way so the old tiles don't overlap new ones,\n// which is similar to how Leaflet approaches this (it has 2 layers)\n//\n// Could keep the tile from the previous quadtree level visible until all 4\n// tiles at the new / current level have finished loading and are displayed.\n// Perhaps by keeping a map of tiles by quadcode and a boolean for each of the\n// child quadcodes showing whether they are loaded and in view. If all true then\n// remove the parent tile, otherwise keep it on a lower layer.\n\n// TODO: Load and display a base layer separate to the LOD grid that is at a low\n// resolution – used as a backup / background to fill in empty areas / distance\n\n// DONE: Fix the issue where some tiles just don't load, or at least the texture\n// never shows up – tends to happen if you quickly zoom in / out past it while\n// it's still loading, leaving a blank space\n\n// TODO: Optimise the request of many image tiles – look at how Leaflet and\n// OpenWebGlobe approach this (eg. batching, queues, etc)\n\n// TODO: Cancel pending tile requests if they get removed from view before they\n// reach a ready state (eg. cancel image requests, etc). Need to ensure that the\n// images are re-requested when the tile is next in scene (even if from cache)\n\n// TODO: Consider not performing an LOD calculation on every frame, instead only\n// on move end so panning, orbiting and zooming stays smooth. Otherwise it's\n// possible for performance to tank if you pan, orbit or zoom rapidly while all\n// the LOD calculations are being made and new tiles requested.\n//\n// Pending tiles should continue to be requested and output to the scene on each\n// frame, but no new LOD calculations should be made.\n\n// This tile layer both updates the quadtree and outputs tiles on every frame\n// (throttled to some amount)\n//\n// This is because the computational complexity of image tiles is generally low\n// and so there isn't much jank when running these calculations and outputs in\n// realtime\n//\n// The benefit to doing this is that the underlying map layer continues to\n// refresh and update during movement, which is an arguably better experience\n\nclass ImageTileLayer extends TileLayer {\n constructor(path, options) {\n var defaults = {\n distance: 40000\n };\n\n options = extend({}, defaults, options);\n\n super(options);\n\n this._path = path;\n }\n\n _onAdd(world) {\n super._onAdd(world);\n\n // Add base layer\n var geom = new THREE.PlaneBufferGeometry(200000, 200000, 1);\n\n var baseMaterial;\n if (this._world._environment._skybox) {\n baseMaterial = ImageTileLayerBaseMaterial('#f5f5f3', this._world._environment._skybox.getRenderTarget());\n } else {\n baseMaterial = ImageTileLayerBaseMaterial('#f5f5f3');\n }\n\n var mesh = new THREE.Mesh(geom, baseMaterial);\n mesh.renderOrder = 0;\n mesh.rotation.x = -90 * Math.PI / 180;\n\n // TODO: It might be overkill to receive a shadow on the base layer as it's\n // rarely seen (good to have if performance difference is negligible)\n mesh.receiveShadow = true;\n\n this._baseLayer = mesh;\n this.add(mesh);\n\n // Trigger initial quadtree calculation on the next frame\n //\n // TODO: This is a hack to ensure the camera is all set up - a better\n // solution should be found\n setTimeout(() => {\n this._calculateLOD();\n this._initEvents();\n }, 0);\n }\n\n _initEvents() {\n // Run LOD calculations based on render calls\n //\n // Throttled to 1 LOD calculation per 100ms\n this._throttledWorldUpdate = throttle(this._onWorldUpdate, 100);\n\n this._world.on('preUpdate', this._throttledWorldUpdate, this);\n this._world.on('move', this._onWorldMove, this);\n }\n\n _onWorldUpdate() {\n this._calculateLOD();\n this._outputTiles();\n }\n\n _onWorldMove(latlon, point) {\n this._moveBaseLayer(point);\n }\n\n _moveBaseLayer(point) {\n this._baseLayer.position.x = point.x;\n this._baseLayer.position.z = point.y;\n }\n\n _createTile(quadcode, layer) {\n return new ImageTile(quadcode, this._path, layer);\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n this._world.off('preUpdate', this._throttledWorldUpdate);\n this._world.off('move', this._onWorldMove);\n\n this._throttledWorldUpdate = null;\n\n // Dispose of mesh and materials\n this._baseLayer.geometry.dispose();\n this._baseLayer.geometry = null;\n\n if (this._baseLayer.material.map) {\n this._baseLayer.material.map.dispose();\n this._baseLayer.material.map = null;\n }\n\n this._baseLayer.material.dispose();\n this._baseLayer.material = null;\n\n this._baseLayer = null;\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default ImageTileLayer;\n\nvar noNew = function(path, options) {\n return new ImageTileLayer(path, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as imageTileLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/ImageTileLayer.js\n **/","import Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport TileCache from './TileCache';\nimport THREE from 'three';\n\n// TODO: Consider removing picking from TileLayer instances as there aren't\n// (m)any situations where it would be practical\n//\n// For example, how would you even know what picking IDs to listen to and what\n// to do with them?\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Consider keeping a single TileLayer / LOD instance running by default\n// that keeps a standard LOD grid for other layers to utilise, rather than\n// having to create their own, unique LOD grid and duplicate calculations when\n// they're going to use the same grid setup anyway\n//\n// It still makes sense to be able to have a custom LOD grid for some layers as\n// they may want to customise things, maybe not even using a quadtree at all!\n//\n// Perhaps it makes sense to split out the quadtree stuff into a singleton and\n// pass in the necessary parameters each time for the calculation step.\n//\n// Either way, it seems silly to force layers to have to create a new LOD grid\n// each time and create extra, duplicated processing every frame.\n\n// TODO: Allow passing in of options to define min/max LOD and a distance to use\n// for culling tiles beyond that distance.\n\n// DONE: Prevent tiles from being loaded if they are further than a certain\n// distance from the camera and are unlikely to be seen anyway\n\n// TODO: Avoid performing LOD calculation when it isn't required. For example,\n// when nothing has changed since the last frame and there are no tiles to be\n// loaded or in need of rendering\n\n// TODO: Only remove tiles from the layer that aren't to be rendered in the\n// current frame – it seems excessive to remove all tiles and re-add them on\n// every single frame, even if it's just array manipulation\n\n// TODO: Fix LOD calculation so min and max LOD can be changed without causing\n// problems (eg. making min above 5 causes all sorts of issues)\n\n// TODO: Reuse THREE objects where possible instead of creating new instances\n// on every LOD calculation\n\n// TODO: Consider not using THREE or LatLon / Point objects in LOD calculations\n// to avoid creating unnecessary memory for garbage collection\n\n// TODO: Prioritise loading of tiles at highest level in the quadtree (those\n// closest to the camera) so visual inconsistancies during loading are minimised\n\nclass TileLayer extends Layer {\n constructor(options) {\n var defaults = {\n picking: false,\n maxCache: 1000,\n maxLOD: 18\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n this._tileCache = new TileCache(this._options.maxCache, tile => {\n this._destroyTile(tile);\n });\n\n // List of tiles from the previous LOD calculation\n this._tileList = [];\n\n // TODO: Work out why changing the minLOD causes loads of issues\n this._minLOD = 3;\n this._maxLOD = this._options.maxLOD;\n\n this._frustum = new THREE.Frustum();\n this._tiles = new THREE.Object3D();\n this._tilesPicking = new THREE.Object3D();\n }\n\n _onAdd(world) {\n this.addToPicking(this._tilesPicking);\n this.add(this._tiles);\n }\n\n _updateFrustum() {\n var camera = this._world.getCamera();\n var projScreenMatrix = new THREE.Matrix4();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n\n this._frustum.setFromMatrix(camera.projectionMatrix);\n this._frustum.setFromMatrix(new THREE.Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse));\n }\n\n _tileInFrustum(tile) {\n var bounds = tile.getBounds();\n return this._frustum.intersectsBox(new THREE.Box3(new THREE.Vector3(bounds[0], 0, bounds[3]), new THREE.Vector3(bounds[2], 0, bounds[1])));\n }\n\n // Update and output tiles from the previous LOD checklist\n _outputTiles() {\n if (!this._tiles) {\n return;\n }\n\n // Remove all tiles from layer\n this._removeTiles();\n\n // Add / re-add tiles\n this._tileList.forEach(tile => {\n // Are the mesh and texture ready?\n //\n // If yes, continue\n // If no, skip\n if (!tile.isReady()) {\n return;\n }\n\n // Add tile to layer (and to scene) if not already there\n this._tiles.add(tile.getMesh());\n\n if (tile.getPickingMesh()) {\n this._tilesPicking.add(tile.getPickingMesh());\n }\n });\n }\n\n // Works out tiles in the view frustum and stores them in an array\n //\n // Does not output the tiles, deferring this to _outputTiles()\n _calculateLOD() {\n if (this._stop || !this._world) {\n return;\n }\n\n // var start = performance.now();\n\n var camera = this._world.getCamera();\n\n // 1. Update and retrieve camera frustum\n this._updateFrustum(this._frustum, camera);\n\n // 2. Add the four root items of the quadtree to a check list\n var checkList = this._checklist;\n checkList = [];\n checkList.push(this._requestTile('0', this));\n checkList.push(this._requestTile('1', this));\n checkList.push(this._requestTile('2', this));\n checkList.push(this._requestTile('3', this));\n\n // 3. Call Divide, passing in the check list\n this._divide(checkList);\n\n // // 4. Remove all tiles from layer\n //\n // Moved to _outputTiles() for now\n // this._removeTiles();\n\n // 5. Filter the tiles remaining in the check list\n this._tileList = checkList.filter((tile, index) => {\n // Skip tile if it's not in the current view frustum\n if (!this._tileInFrustum(tile)) {\n return false;\n }\n\n if (this._options.distance && this._options.distance > 0) {\n // TODO: Can probably speed this up\n var center = tile.getCenter();\n var dist = (new THREE.Vector3(center[0], 0, center[1])).sub(camera.position).length();\n\n // Manual distance limit to cut down on tiles so far away\n if (dist > this._options.distance) {\n return false;\n }\n }\n\n // Does the tile have a mesh?\n //\n // If yes, continue\n // If no, generate tile mesh, request texture and skip\n if (!tile.getMesh()) {\n tile.requestTileAsync();\n }\n\n return true;\n\n // Are the mesh and texture ready?\n //\n // If yes, continue\n // If no, skip\n // if (!tile.isReady()) {\n // return;\n // }\n //\n // // Add tile to layer (and to scene)\n // this._tiles.add(tile.getMesh());\n });\n\n // console.log(performance.now() - start);\n }\n\n _divide(checkList) {\n var count = 0;\n var currentItem;\n var quadcode;\n\n // 1. Loop until count equals check list length\n while (count != checkList.length) {\n currentItem = checkList[count];\n quadcode = currentItem.getQuadcode();\n\n // 2. Increase count and continue loop if quadcode equals max LOD / zoom\n if (currentItem.length === this._maxLOD) {\n count++;\n continue;\n }\n\n // 3. Else, calculate screen-space error metric for quadcode\n if (this._screenSpaceError(currentItem)) {\n // 4. If error is sufficient...\n\n // 4a. Remove parent item from the check list\n checkList.splice(count, 1);\n\n // 4b. Add 4 child items to the check list\n checkList.push(this._requestTile(quadcode + '0', this));\n checkList.push(this._requestTile(quadcode + '1', this));\n checkList.push(this._requestTile(quadcode + '2', this));\n checkList.push(this._requestTile(quadcode + '3', this));\n\n // 4d. Continue the loop without increasing count\n continue;\n } else {\n // 5. Else, increase count and continue loop\n count++;\n }\n }\n }\n\n _screenSpaceError(tile) {\n var minDepth = this._minLOD;\n var maxDepth = this._maxLOD;\n\n var quadcode = tile.getQuadcode();\n\n var camera = this._world.getCamera();\n\n // Tweak this value to refine specific point that each quad is subdivided\n //\n // It's used to multiple the dimensions of the tile sides before\n // comparing against the tile distance from camera\n var quality = 3.0;\n\n // 1. Return false if quadcode length equals maxDepth (stop dividing)\n if (quadcode.length === maxDepth) {\n return false;\n }\n\n // 2. Return true if quadcode length is less than minDepth\n if (quadcode.length < minDepth) {\n return true;\n }\n\n // 3. Return false if quadcode bounds are not in view frustum\n if (!this._tileInFrustum(tile)) {\n return false;\n }\n\n var center = tile.getCenter();\n\n // 4. Calculate screen-space error metric\n // TODO: Use closest distance to one of the 4 tile corners\n var dist = (new THREE.Vector3(center[0], 0, center[1])).sub(camera.position).length();\n\n var error = quality * tile.getSide() / dist;\n\n // 5. Return true if error is greater than 1.0, else return false\n return (error > 1.0);\n }\n\n _removeTiles() {\n if (!this._tiles || !this._tiles.children) {\n return;\n }\n\n for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n this._tiles.remove(this._tiles.children[i]);\n }\n\n if (!this._tilesPicking || !this._tilesPicking.children) {\n return;\n }\n\n for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n this._tilesPicking.remove(this._tilesPicking.children[i]);\n }\n }\n\n // Return a new tile instance\n _createTile(quadcode, layer) {}\n\n // Get a cached tile or request a new one if not in cache\n _requestTile(quadcode, layer) {\n var tile = this._tileCache.getTile(quadcode);\n\n if (!tile) {\n // Set up a brand new tile\n tile = this._createTile(quadcode, layer);\n\n // Add tile to cache, though it won't be ready yet as the data is being\n // requested from various places asynchronously\n this._tileCache.setTile(quadcode, tile);\n }\n\n return tile;\n }\n\n _destroyTile(tile) {\n // Remove tile from scene\n this._tiles.remove(tile.getMesh());\n\n // Delete any references to the tile within this component\n\n // Call destory on tile instance\n tile.destroy();\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n if (this._tiles.children) {\n // Remove all tiles\n for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n this._tiles.remove(this._tiles.children[i]);\n }\n }\n\n // Remove tile from picking scene\n this.removeFromPicking(this._tilesPicking);\n\n if (this._tilesPicking.children) {\n // Remove all tiles\n for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n this._tilesPicking.remove(this._tilesPicking.children[i]);\n }\n }\n\n this._tileCache.destroy();\n this._tileCache = null;\n\n this._tiles = null;\n this._tilesPicking = null;\n this._frustum = null;\n\n super.destroy();\n }\n}\n\nexport default TileLayer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/TileLayer.js\n **/","import LRUCache from 'lru-cache';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// This process is based on a similar approach taken by OpenWebGlobe\n// See: https://github.com/OpenWebGlobe/WebViewer/blob/master/source/core/globecache.js\n\nclass TileCache {\n constructor(cacheLimit, onDestroyTile) {\n this._cache = LRUCache({\n max: cacheLimit,\n dispose: (key, tile) => {\n onDestroyTile(tile);\n }\n });\n }\n\n // Returns true if all specified tile providers are ready to be used\n // Otherwise, returns false\n isReady() {\n return false;\n }\n\n // Get a cached tile without requesting a new one\n getTile(quadcode) {\n return this._cache.get(quadcode);\n }\n\n // Add tile to cache\n setTile(quadcode, tile) {\n this._cache.set(quadcode, tile);\n }\n\n // Destroy the cache and remove it from memory\n //\n // TODO: Call destroy method on items in cache\n destroy() {\n this._cache.reset();\n this._cache = null;\n }\n}\n\nexport default TileCache;\n\nvar noNew = function(cacheLimit, onDestroyTile) {\n return new TileCache(cacheLimit, onDestroyTile);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as tileCache};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/TileCache.js\n **/","module.exports = LRUCache\n\n// This will be a proper iterable 'Map' in engines that support it,\n// or a fakey-fake PseudoMap in older versions.\nvar Map = require('pseudomap')\nvar util = require('util')\n\n// A linked list to keep track of recently-used-ness\nvar Yallist = require('yallist')\n\n// use symbols if possible, otherwise just _props\nvar symbols = {}\nvar hasSymbol = typeof Symbol === 'function'\nvar makeSymbol\nif (hasSymbol) {\n makeSymbol = function (key) {\n return Symbol.for(key)\n }\n} else {\n makeSymbol = function (key) {\n return '_' + key\n }\n}\n\nfunction priv (obj, key, val) {\n var sym\n if (symbols[key]) {\n sym = symbols[key]\n } else {\n sym = makeSymbol(key)\n symbols[key] = sym\n }\n if (arguments.length === 2) {\n return obj[sym]\n } else {\n obj[sym] = val\n return val\n }\n}\n\nfunction naiveLength () { return 1 }\n\n// lruList is a yallist where the head is the youngest\n// item, and the tail is the oldest. the list contains the Hit\n// objects as the entries.\n// Each Hit object has a reference to its Yallist.Node. This\n// never changes.\n//\n// cache is a Map (or PseudoMap) that matches the keys to\n// the Yallist.Node object.\nfunction LRUCache (options) {\n if (!(this instanceof LRUCache)) {\n return new LRUCache(options)\n }\n\n if (typeof options === 'number') {\n options = { max: options }\n }\n\n if (!options) {\n options = {}\n }\n\n var max = priv(this, 'max', options.max)\n // Kind of weird to have a default max of Infinity, but oh well.\n if (!max ||\n !(typeof max === 'number') ||\n max <= 0) {\n priv(this, 'max', Infinity)\n }\n\n var lc = options.length || naiveLength\n if (typeof lc !== 'function') {\n lc = naiveLength\n }\n priv(this, 'lengthCalculator', lc)\n\n priv(this, 'allowStale', options.stale || false)\n priv(this, 'maxAge', options.maxAge || 0)\n priv(this, 'dispose', options.dispose)\n this.reset()\n}\n\n// resize the cache when the max changes.\nObject.defineProperty(LRUCache.prototype, 'max', {\n set: function (mL) {\n if (!mL || !(typeof mL === 'number') || mL <= 0) {\n mL = Infinity\n }\n priv(this, 'max', mL)\n trim(this)\n },\n get: function () {\n return priv(this, 'max')\n },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'allowStale', {\n set: function (allowStale) {\n priv(this, 'allowStale', !!allowStale)\n },\n get: function () {\n return priv(this, 'allowStale')\n },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'maxAge', {\n set: function (mA) {\n if (!mA || !(typeof mA === 'number') || mA < 0) {\n mA = 0\n }\n priv(this, 'maxAge', mA)\n trim(this)\n },\n get: function () {\n return priv(this, 'maxAge')\n },\n enumerable: true\n})\n\n// resize the cache when the lengthCalculator changes.\nObject.defineProperty(LRUCache.prototype, 'lengthCalculator', {\n set: function (lC) {\n if (typeof lC !== 'function') {\n lC = naiveLength\n }\n if (lC !== priv(this, 'lengthCalculator')) {\n priv(this, 'lengthCalculator', lC)\n priv(this, 'length', 0)\n priv(this, 'lruList').forEach(function (hit) {\n hit.length = priv(this, 'lengthCalculator').call(this, hit.value, hit.key)\n priv(this, 'length', priv(this, 'length') + hit.length)\n }, this)\n }\n trim(this)\n },\n get: function () { return priv(this, 'lengthCalculator') },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'length', {\n get: function () { return priv(this, 'length') },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'itemCount', {\n get: function () { return priv(this, 'lruList').length },\n enumerable: true\n})\n\nLRUCache.prototype.rforEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = priv(this, 'lruList').tail; walker !== null;) {\n var prev = walker.prev\n forEachStep(this, fn, walker, thisp)\n walker = prev\n }\n}\n\nfunction forEachStep (self, fn, node, thisp) {\n var hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!priv(self, 'allowStale')) {\n hit = undefined\n }\n }\n if (hit) {\n fn.call(thisp, hit.value, hit.key, self)\n }\n}\n\nLRUCache.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = priv(this, 'lruList').head; walker !== null;) {\n var next = walker.next\n forEachStep(this, fn, walker, thisp)\n walker = next\n }\n}\n\nLRUCache.prototype.keys = function () {\n return priv(this, 'lruList').toArray().map(function (k) {\n return k.key\n }, this)\n}\n\nLRUCache.prototype.values = function () {\n return priv(this, 'lruList').toArray().map(function (k) {\n return k.value\n }, this)\n}\n\nLRUCache.prototype.reset = function () {\n if (priv(this, 'dispose') &&\n priv(this, 'lruList') &&\n priv(this, 'lruList').length) {\n priv(this, 'lruList').forEach(function (hit) {\n priv(this, 'dispose').call(this, hit.key, hit.value)\n }, this)\n }\n\n priv(this, 'cache', new Map()) // hash of items by key\n priv(this, 'lruList', new Yallist()) // list of items in order of use recency\n priv(this, 'length', 0) // length of items in the list\n}\n\nLRUCache.prototype.dump = function () {\n return priv(this, 'lruList').map(function (hit) {\n if (!isStale(this, hit)) {\n return {\n k: hit.key,\n v: hit.value,\n e: hit.now + (hit.maxAge || 0)\n }\n }\n }, this).toArray().filter(function (h) {\n return h\n })\n}\n\nLRUCache.prototype.dumpLru = function () {\n return priv(this, 'lruList')\n}\n\nLRUCache.prototype.inspect = function (n, opts) {\n var str = 'LRUCache {'\n var extras = false\n\n var as = priv(this, 'allowStale')\n if (as) {\n str += '\\n allowStale: true'\n extras = true\n }\n\n var max = priv(this, 'max')\n if (max && max !== Infinity) {\n if (extras) {\n str += ','\n }\n str += '\\n max: ' + util.inspect(max, opts)\n extras = true\n }\n\n var maxAge = priv(this, 'maxAge')\n if (maxAge) {\n if (extras) {\n str += ','\n }\n str += '\\n maxAge: ' + util.inspect(maxAge, opts)\n extras = true\n }\n\n var lc = priv(this, 'lengthCalculator')\n if (lc && lc !== naiveLength) {\n if (extras) {\n str += ','\n }\n str += '\\n length: ' + util.inspect(priv(this, 'length'), opts)\n extras = true\n }\n\n var didFirst = false\n priv(this, 'lruList').forEach(function (item) {\n if (didFirst) {\n str += ',\\n '\n } else {\n if (extras) {\n str += ',\\n'\n }\n didFirst = true\n str += '\\n '\n }\n var key = util.inspect(item.key).split('\\n').join('\\n ')\n var val = { value: item.value }\n if (item.maxAge !== maxAge) {\n val.maxAge = item.maxAge\n }\n if (lc !== naiveLength) {\n val.length = item.length\n }\n if (isStale(this, item)) {\n val.stale = true\n }\n\n val = util.inspect(val, opts).split('\\n').join('\\n ')\n str += key + ' => ' + val\n })\n\n if (didFirst || extras) {\n str += '\\n'\n }\n str += '}'\n\n return str\n}\n\nLRUCache.prototype.set = function (key, value, maxAge) {\n maxAge = maxAge || priv(this, 'maxAge')\n\n var now = maxAge ? Date.now() : 0\n var len = priv(this, 'lengthCalculator').call(this, value, key)\n\n if (priv(this, 'cache').has(key)) {\n if (len > priv(this, 'max')) {\n del(this, priv(this, 'cache').get(key))\n return false\n }\n\n var node = priv(this, 'cache').get(key)\n var item = node.value\n\n // dispose of the old one before overwriting\n if (priv(this, 'dispose')) {\n priv(this, 'dispose').call(this, key, item.value)\n }\n\n item.now = now\n item.maxAge = maxAge\n item.value = value\n priv(this, 'length', priv(this, 'length') + (len - item.length))\n item.length = len\n this.get(key)\n trim(this)\n return true\n }\n\n var hit = new Entry(key, value, len, now, maxAge)\n\n // oversized objects fall out of cache automatically.\n if (hit.length > priv(this, 'max')) {\n if (priv(this, 'dispose')) {\n priv(this, 'dispose').call(this, key, value)\n }\n return false\n }\n\n priv(this, 'length', priv(this, 'length') + hit.length)\n priv(this, 'lruList').unshift(hit)\n priv(this, 'cache').set(key, priv(this, 'lruList').head)\n trim(this)\n return true\n}\n\nLRUCache.prototype.has = function (key) {\n if (!priv(this, 'cache').has(key)) return false\n var hit = priv(this, 'cache').get(key).value\n if (isStale(this, hit)) {\n return false\n }\n return true\n}\n\nLRUCache.prototype.get = function (key) {\n return get(this, key, true)\n}\n\nLRUCache.prototype.peek = function (key) {\n return get(this, key, false)\n}\n\nLRUCache.prototype.pop = function () {\n var node = priv(this, 'lruList').tail\n if (!node) return null\n del(this, node)\n return node.value\n}\n\nLRUCache.prototype.del = function (key) {\n del(this, priv(this, 'cache').get(key))\n}\n\nLRUCache.prototype.load = function (arr) {\n // reset the cache\n this.reset()\n\n var now = Date.now()\n // A previous serialized cache has the most recent items first\n for (var l = arr.length - 1; l >= 0; l--) {\n var hit = arr[l]\n var expiresAt = hit.e || 0\n if (expiresAt === 0) {\n // the item was created without expiration in a non aged cache\n this.set(hit.k, hit.v)\n } else {\n var maxAge = expiresAt - now\n // dont add already expired items\n if (maxAge > 0) {\n this.set(hit.k, hit.v, maxAge)\n }\n }\n }\n}\n\nLRUCache.prototype.prune = function () {\n var self = this\n priv(this, 'cache').forEach(function (value, key) {\n get(self, key, false)\n })\n}\n\nfunction get (self, key, doUse) {\n var node = priv(self, 'cache').get(key)\n if (node) {\n var hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!priv(self, 'allowStale')) hit = undefined\n } else {\n if (doUse) {\n priv(self, 'lruList').unshiftNode(node)\n }\n }\n if (hit) hit = hit.value\n }\n return hit\n}\n\nfunction isStale (self, hit) {\n if (!hit || (!hit.maxAge && !priv(self, 'maxAge'))) {\n return false\n }\n var stale = false\n var diff = Date.now() - hit.now\n if (hit.maxAge) {\n stale = diff > hit.maxAge\n } else {\n stale = priv(self, 'maxAge') && (diff > priv(self, 'maxAge'))\n }\n return stale\n}\n\nfunction trim (self) {\n if (priv(self, 'length') > priv(self, 'max')) {\n for (var walker = priv(self, 'lruList').tail;\n priv(self, 'length') > priv(self, 'max') && walker !== null;) {\n // We know that we're about to delete this one, and also\n // what the next least recently used key will be, so just\n // go ahead and set it now.\n var prev = walker.prev\n del(self, walker)\n walker = prev\n }\n }\n}\n\nfunction del (self, node) {\n if (node) {\n var hit = node.value\n if (priv(self, 'dispose')) {\n priv(self, 'dispose').call(this, hit.key, hit.value)\n }\n priv(self, 'length', priv(self, 'length') - hit.length)\n priv(self, 'cache').delete(hit.key)\n priv(self, 'lruList').removeNode(node)\n }\n}\n\n// classy, since V8 prefers predictable objects.\nfunction Entry (key, value, length, now, maxAge) {\n this.key = key\n this.value = value\n this.length = length\n this.now = now\n this.maxAge = maxAge || 0\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lru-cache/lib/lru-cache.js\n ** module id = 58\n ** module chunks = 0\n **/","if (process.env.npm_package_name === 'pseudomap' &&\n process.env.npm_lifecycle_script === 'test')\n process.env.TEST_PSEUDOMAP = 'true'\n\nif (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) {\n module.exports = Map\n} else {\n module.exports = require('./pseudomap')\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/pseudomap/map.js\n ** module id = 59\n ** module chunks = 0\n **/","// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = setTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/process/browser.js\n ** module id = 60\n ** module chunks = 0\n **/","var hasOwnProperty = Object.prototype.hasOwnProperty\n\nmodule.exports = PseudoMap\n\nfunction PseudoMap (set) {\n if (!(this instanceof PseudoMap)) // whyyyyyyy\n throw new TypeError(\"Constructor PseudoMap requires 'new'\")\n\n this.clear()\n\n if (set) {\n if ((set instanceof PseudoMap) ||\n (typeof Map === 'function' && set instanceof Map))\n set.forEach(function (value, key) {\n this.set(key, value)\n }, this)\n else if (Array.isArray(set))\n set.forEach(function (kv) {\n this.set(kv[0], kv[1])\n }, this)\n else\n throw new TypeError('invalid argument')\n }\n}\n\nPseudoMap.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n Object.keys(this._data).forEach(function (k) {\n if (k !== 'size')\n fn.call(thisp, this._data[k].value, this._data[k].key)\n }, this)\n}\n\nPseudoMap.prototype.has = function (k) {\n return !!find(this._data, k)\n}\n\nPseudoMap.prototype.get = function (k) {\n var res = find(this._data, k)\n return res && res.value\n}\n\nPseudoMap.prototype.set = function (k, v) {\n set(this._data, k, v)\n}\n\nPseudoMap.prototype.delete = function (k) {\n var res = find(this._data, k)\n if (res) {\n delete this._data[res._index]\n this._data.size--\n }\n}\n\nPseudoMap.prototype.clear = function () {\n var data = Object.create(null)\n data.size = 0\n\n Object.defineProperty(this, '_data', {\n value: data,\n enumerable: false,\n configurable: true,\n writable: false\n })\n}\n\nObject.defineProperty(PseudoMap.prototype, 'size', {\n get: function () {\n return this._data.size\n },\n set: function (n) {},\n enumerable: true,\n configurable: true\n})\n\nPseudoMap.prototype.values =\nPseudoMap.prototype.keys =\nPseudoMap.prototype.entries = function () {\n throw new Error('iterators are not implemented in this version')\n}\n\n// Either identical, or both NaN\nfunction same (a, b) {\n return a === b || a !== a && b !== b\n}\n\nfunction Entry (k, v, i) {\n this.key = k\n this.value = v\n this._index = i\n}\n\nfunction find (data, k) {\n for (var i = 0, s = '_' + k, key = s;\n hasOwnProperty.call(data, key);\n key = s + i++) {\n if (same(data[key].key, k))\n return data[key]\n }\n}\n\nfunction set (data, k, v) {\n for (var i = 0, s = '_' + k, key = s;\n hasOwnProperty.call(data, key);\n key = s + i++) {\n if (same(data[key].key, k)) {\n data[key].value = v\n return\n }\n }\n data.size++\n data[key] = new Entry(k, v, key)\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/pseudomap/pseudomap.js\n ** module id = 61\n ** module chunks = 0\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/util/util.js\n ** module id = 62\n ** module chunks = 0\n **/","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/util/support/isBufferBrowser.js\n ** module id = 63\n ** module chunks = 0\n **/","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/inherits/inherits_browser.js\n ** module id = 64\n ** module chunks = 0\n **/","module.exports = Yallist\n\nYallist.Node = Node\nYallist.create = Yallist\n\nfunction Yallist (list) {\n var self = this\n if (!(self instanceof Yallist)) {\n self = new Yallist()\n }\n\n self.tail = null\n self.head = null\n self.length = 0\n\n if (list && typeof list.forEach === 'function') {\n list.forEach(function (item) {\n self.push(item)\n })\n } else if (arguments.length > 0) {\n for (var i = 0, l = arguments.length; i < l; i++) {\n self.push(arguments[i])\n }\n }\n\n return self\n}\n\nYallist.prototype.removeNode = function (node) {\n if (node.list !== this) {\n throw new Error('removing node which does not belong to this list')\n }\n\n var next = node.next\n var prev = node.prev\n\n if (next) {\n next.prev = prev\n }\n\n if (prev) {\n prev.next = next\n }\n\n if (node === this.head) {\n this.head = next\n }\n if (node === this.tail) {\n this.tail = prev\n }\n\n node.list.length --\n node.next = null\n node.prev = null\n node.list = null\n}\n\nYallist.prototype.unshiftNode = function (node) {\n if (node === this.head) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var head = this.head\n node.list = this\n node.next = head\n if (head) {\n head.prev = node\n }\n\n this.head = node\n if (!this.tail) {\n this.tail = node\n }\n this.length ++\n}\n\nYallist.prototype.pushNode = function (node) {\n if (node === this.tail) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var tail = this.tail\n node.list = this\n node.prev = tail\n if (tail) {\n tail.next = node\n }\n\n this.tail = node\n if (!this.head) {\n this.head = node\n }\n this.length ++\n}\n\nYallist.prototype.push = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n push(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.unshift = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n unshift(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.pop = function () {\n if (!this.tail)\n return undefined\n\n var res = this.tail.value\n this.tail = this.tail.prev\n this.tail.next = null\n this.length --\n return res\n}\n\nYallist.prototype.shift = function () {\n if (!this.head)\n return undefined\n\n var res = this.head.value\n this.head = this.head.next\n this.head.prev = null\n this.length --\n return res\n}\n\nYallist.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.head, i = 0; walker !== null; i++) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.next\n }\n}\n\nYallist.prototype.forEachReverse = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.prev\n }\n}\n\nYallist.prototype.get = function (n) {\n for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.next\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.getReverse = function (n) {\n for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.map = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.head; walker !== null; ) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.next\n }\n return res\n}\n\nYallist.prototype.mapReverse = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.tail; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.prev\n }\n return res\n}\n\nYallist.prototype.reduce = function (fn, initial) {\n var acc\n var walker = this.head\n if (arguments.length > 1) {\n acc = initial\n } else if (this.head) {\n walker = this.head.next\n acc = this.head.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = 0; walker !== null; i++) {\n acc = fn(acc, walker.value, i)\n walker = walker.next\n }\n\n return acc\n}\n\nYallist.prototype.reduceReverse = function (fn, initial) {\n var acc\n var walker = this.tail\n if (arguments.length > 1) {\n acc = initial\n } else if (this.tail) {\n walker = this.tail.prev\n acc = this.tail.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = this.length - 1; walker !== null; i--) {\n acc = fn(acc, walker.value, i)\n walker = walker.prev\n }\n\n return acc\n}\n\nYallist.prototype.toArray = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.head; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.next\n }\n return arr\n}\n\nYallist.prototype.toArrayReverse = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.tail; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.prev\n }\n return arr\n}\n\nYallist.prototype.slice = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n walker = walker.next\n }\n for (; walker !== null && i < to; i++, walker = walker.next) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.sliceReverse = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n walker = walker.prev\n }\n for (; walker !== null && i > from; i--, walker = walker.prev) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.reverse = function () {\n var head = this.head\n var tail = this.tail\n for (var walker = head; walker !== null; walker = walker.prev) {\n var p = walker.prev\n walker.prev = walker.next\n walker.next = p\n }\n this.head = tail\n this.tail = head\n return this\n}\n\nfunction push (self, item) {\n self.tail = new Node(item, self.tail, null, self)\n if (!self.head) {\n self.head = self.tail\n }\n self.length ++\n}\n\nfunction unshift (self, item) {\n self.head = new Node(item, null, self.head, self)\n if (!self.tail) {\n self.tail = self.head\n }\n self.length ++\n}\n\nfunction Node (value, prev, next, list) {\n if (!(this instanceof Node)) {\n return new Node(value, prev, next, list)\n }\n\n this.list = list\n this.value = value\n\n if (prev) {\n prev.next = this\n this.prev = prev\n } else {\n this.prev = null\n }\n\n if (next) {\n next.prev = this\n this.next = next\n } else {\n this.next = null\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/yallist/yallist.js\n ** module id = 65\n ** module chunks = 0\n **/","import Tile from './Tile';\nimport BoxHelper from '../../vendor/BoxHelper';\nimport THREE from 'three';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\nclass ImageTile extends Tile {\n constructor(quadcode, path, layer) {\n super(quadcode, path, layer);\n }\n\n // Request data for the tile\n requestTileAsync() {\n // Making this asynchronous really speeds up the LOD framerate\n setTimeout(() => {\n if (!this._mesh) {\n this._mesh = this._createMesh();\n this._requestTile();\n }\n }, 0);\n }\n\n destroy() {\n // Cancel any pending requests\n this._abortRequest();\n\n // Clear image reference\n this._image = null;\n\n super.destroy();\n }\n\n _createMesh() {\n // Something went wrong and the tile\n //\n // Possibly removed by the cache before loaded\n if (!this._center) {\n return;\n }\n\n var mesh = new THREE.Object3D();\n var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n\n var material;\n if (!this._world._environment._skybox) {\n material = new THREE.MeshBasicMaterial({\n depthWrite: false\n });\n\n // var material = new THREE.MeshPhongMaterial({\n // depthWrite: false\n // });\n } else {\n // Other MeshStandardMaterial settings\n //\n // material.envMapIntensity will change the amount of colour reflected(?)\n // from the environment map – can be greater than 1 for more intensity\n\n material = new THREE.MeshStandardMaterial({\n depthWrite: false\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var localMesh = new THREE.Mesh(geom, material);\n localMesh.rotation.x = -90 * Math.PI / 180;\n\n localMesh.receiveShadow = true;\n\n mesh.add(localMesh);\n mesh.renderOrder = 0.1;\n\n mesh.position.x = this._center[0];\n mesh.position.z = this._center[1];\n\n // var box = new BoxHelper(localMesh);\n // mesh.add(box);\n //\n // mesh.add(this._createDebugMesh());\n\n return mesh;\n }\n\n _createDebugMesh() {\n var canvas = document.createElement('canvas');\n canvas.width = 256;\n canvas.height = 256;\n\n var context = canvas.getContext('2d');\n context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n context.fillStyle = '#ff0000';\n context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\n var texture = new THREE.Texture(canvas);\n\n // Silky smooth images when tilted\n texture.magFilter = THREE.LinearFilter;\n texture.minFilter = THREE.LinearMipMapLinearFilter;\n\n // TODO: Set this to renderer.getMaxAnisotropy() / 4\n texture.anisotropy = 4;\n\n texture.needsUpdate = true;\n\n var material = new THREE.MeshBasicMaterial({\n map: texture,\n transparent: true,\n depthWrite: false\n });\n\n var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n var mesh = new THREE.Mesh(geom, material);\n\n mesh.rotation.x = -90 * Math.PI / 180;\n mesh.position.y = 0.1;\n\n return mesh;\n }\n\n _requestTile() {\n var urlParams = {\n x: this._tile[0],\n y: this._tile[1],\n z: this._tile[2]\n };\n\n var url = this._getTileURL(urlParams);\n\n var image = document.createElement('img');\n\n image.addEventListener('load', event => {\n var texture = new THREE.Texture();\n\n texture.image = image;\n texture.needsUpdate = true;\n\n // Silky smooth images when tilted\n texture.magFilter = THREE.LinearFilter;\n texture.minFilter = THREE.LinearMipMapLinearFilter;\n\n // TODO: Set this to renderer.getMaxAnisotropy() / 4\n texture.anisotropy = 4;\n\n texture.needsUpdate = true;\n\n // Something went wrong and the tile or its material is missing\n //\n // Possibly removed by the cache before the image loaded\n if (!this._mesh || !this._mesh.children[0] || !this._mesh.children[0].material) {\n return;\n }\n\n this._mesh.children[0].material.map = texture;\n this._mesh.children[0].material.needsUpdate = true;\n\n this._texture = texture;\n this._ready = true;\n }, false);\n\n // image.addEventListener('progress', event => {}, false);\n // image.addEventListener('error', event => {}, false);\n\n image.crossOrigin = '';\n\n // Load image\n image.src = url;\n\n this._image = image;\n }\n\n _abortRequest() {\n if (!this._image) {\n return;\n }\n\n this._image.src = '';\n }\n}\n\nexport default ImageTile;\n\nvar noNew = function(quadcode, path, layer) {\n return new ImageTile(quadcode, path, layer);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as imageTile};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/ImageTile.js\n **/","import {point as Point} from '../../geo/Point';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport THREE from 'three';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// Manages a single tile and its layers\n\nvar r2d = 180 / Math.PI;\n\nvar tileURLRegex = /\\{([szxy])\\}/g;\n\nclass Tile {\n constructor(quadcode, path, layer) {\n this._layer = layer;\n this._world = layer._world;\n this._quadcode = quadcode;\n this._path = path;\n\n this._ready = false;\n\n this._tile = this._quadcodeToTile(quadcode);\n\n // Bottom-left and top-right bounds in WGS84 coordinates\n this._boundsLatLon = this._tileBoundsWGS84(this._tile);\n\n // Bottom-left and top-right bounds in world coordinates\n this._boundsWorld = this._tileBoundsFromWGS84(this._boundsLatLon);\n\n // Tile center in world coordinates\n this._center = this._boundsToCenter(this._boundsWorld);\n\n // Tile center in projected coordinates\n this._centerLatlon = this._world.pointToLatLon(Point(this._center[0], this._center[1]));\n\n // Length of a tile side in world coorindates\n this._side = this._getSide(this._boundsWorld);\n\n // Point scale for tile (for unit conversion)\n this._pointScale = this._world.pointScale(this._centerLatlon);\n }\n\n // Returns true if the tile mesh and texture are ready to be used\n // Otherwise, returns false\n isReady() {\n return this._ready;\n }\n\n // Request data for the tile\n requestTileAsync() {}\n\n getQuadcode() {\n return this._quadcode;\n }\n\n getBounds() {\n return this._boundsWorld;\n }\n\n getCenter() {\n return this._center;\n }\n\n getSide() {\n return this._side;\n }\n\n getMesh() {\n return this._mesh;\n }\n\n getPickingMesh() {\n return this._pickingMesh;\n }\n\n // Destroys the tile and removes it from the layer and memory\n //\n // Ensure that this leaves no trace of the tile – no textures, no meshes,\n // nothing in memory or the GPU\n destroy() {\n // Delete reference to layer and world\n this._layer = null;\n this._world = null;\n\n // Delete location references\n this._boundsLatLon = null;\n this._boundsWorld = null;\n this._center = null;\n\n // Done if no mesh\n if (!this._mesh) {\n return;\n }\n\n if (this._mesh.children) {\n // Dispose of mesh and materials\n this._mesh.children.forEach(child => {\n child.geometry.dispose();\n child.geometry = null;\n\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n });\n } else {\n this._mesh.geometry.dispose();\n this._mesh.geometry = null;\n\n if (this._mesh.material.map) {\n this._mesh.material.map.dispose();\n this._mesh.material.map = null;\n }\n\n this._mesh.material.dispose();\n this._mesh.material = null;\n }\n }\n\n _createMesh() {}\n _createDebugMesh() {}\n\n _getTileURL(urlParams) {\n if (!urlParams.s) {\n // Default to a random choice of a, b or c\n urlParams.s = String.fromCharCode(97 + Math.floor(Math.random() * 3));\n }\n\n tileURLRegex.lastIndex = 0;\n return this._path.replace(tileURLRegex, function(value, key) {\n // Replace with paramter, otherwise keep existing value\n return urlParams[key];\n });\n }\n\n // Convert from quadcode to TMS tile coordinates\n _quadcodeToTile(quadcode) {\n var x = 0;\n var y = 0;\n var z = quadcode.length;\n\n for (var i = z; i > 0; i--) {\n var mask = 1 << (i - 1);\n var q = +quadcode[z - i];\n if (q === 1) {\n x |= mask;\n }\n if (q === 2) {\n y |= mask;\n }\n if (q === 3) {\n x |= mask;\n y |= mask;\n }\n }\n\n return [x, y, z];\n }\n\n // Convert WGS84 tile bounds to world coordinates\n _tileBoundsFromWGS84(boundsWGS84) {\n var sw = this._layer._world.latLonToPoint(LatLon(boundsWGS84[1], boundsWGS84[0]));\n var ne = this._layer._world.latLonToPoint(LatLon(boundsWGS84[3], boundsWGS84[2]));\n\n return [sw.x, sw.y, ne.x, ne.y];\n }\n\n // Get tile bounds in WGS84 coordinates\n _tileBoundsWGS84(tile) {\n var e = this._tile2lon(tile[0] + 1, tile[2]);\n var w = this._tile2lon(tile[0], tile[2]);\n var s = this._tile2lat(tile[1] + 1, tile[2]);\n var n = this._tile2lat(tile[1], tile[2]);\n return [w, s, e, n];\n }\n\n _tile2lon(x, z) {\n return x / Math.pow(2, z) * 360 - 180;\n }\n\n _tile2lat(y, z) {\n var n = Math.PI - 2 * Math.PI * y / Math.pow(2, z);\n return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));\n }\n\n _boundsToCenter(bounds) {\n var x = bounds[0] + (bounds[2] - bounds[0]) / 2;\n var y = bounds[1] + (bounds[3] - bounds[1]) / 2;\n\n return [x, y];\n }\n\n _getSide(bounds) {\n return (new THREE.Vector3(bounds[0], 0, bounds[3])).sub(new THREE.Vector3(bounds[0], 0, bounds[1])).length();\n }\n}\n\nexport default Tile;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/Tile.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nBoxHelper = function ( object ) {\n\n\tvar indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\tvar positions = new Float32Array( 8 * 3 );\n\n\tvar geometry = new THREE.BufferGeometry();\n\tgeometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );\n\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );\n\n\tTHREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { linewidth: 2, color: 0xff0000 } ) );\n\n\tif ( object !== undefined ) {\n\n\t\tthis.update( object );\n\n\t}\n\n};\n\nBoxHelper.prototype = Object.create( THREE.LineSegments.prototype );\nBoxHelper.prototype.constructor = BoxHelper;\n\nBoxHelper.prototype.update = ( function () {\n\n\tvar box = new THREE.Box3();\n\n\treturn function ( object ) {\n\n\t\tbox.setFromObject( object );\n\n\t\tif ( box.isEmpty() ) return;\n\n\t\tvar min = box.min;\n\t\tvar max = box.max;\n\n\t\t/*\n\t\t 5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/\n\n\t\tvar position = this.geometry.attributes.position;\n\t\tvar array = position.array;\n\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\t\tposition.needsUpdate = true;\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t};\n\n} )();\n\nexport default BoxHelper;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/BoxHelper.js\n **/","import THREE from 'three';\n\nexport default function(colour, skyboxTarget) {\n var canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n\n var context = canvas.getContext('2d');\n context.fillStyle = colour;\n context.fillRect(0, 0, canvas.width, canvas.height);\n // context.strokeStyle = '#D0D0CF';\n // context.strokeRect(0, 0, canvas.width, canvas.height);\n\n var texture = new THREE.Texture(canvas);\n\n // // Silky smooth images when tilted\n // texture.magFilter = THREE.LinearFilter;\n // texture.minFilter = THREE.LinearMipMapLinearFilter;\n // //\n // // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n // texture.anisotropy = 4;\n\n // texture.wrapS = THREE.RepeatWrapping;\n // texture.wrapT = THREE.RepeatWrapping;\n // texture.repeat.set(segments, segments);\n\n texture.needsUpdate = true;\n\n var material;\n\n if (!skyboxTarget) {\n material = new THREE.MeshBasicMaterial({\n map: texture,\n depthWrite: false\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n depthWrite: false\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMap = skyboxTarget;\n }\n\n return material;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/ImageTileLayerBaseMaterial.js\n **/","import TileLayer from './TileLayer';\nimport extend from 'lodash.assign';\nimport GeoJSONTile from './GeoJSONTile';\nimport throttle from 'lodash.throttle';\nimport THREE from 'three';\n\n// TODO: Offer on-the-fly slicing of static, non-tile-based GeoJSON files into a\n// tile grid using geojson-vt\n//\n// See: https://github.com/mapbox/geojson-vt\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Consider pausing per-frame output during movement so there's little to\n// no jank caused by previous tiles still processing\n\n// This tile layer only updates the quadtree after world movement has occurred\n//\n// Tiles from previous quadtree updates are updated and outputted every frame\n// (or at least every frame, throttled to some amount)\n//\n// This is because the complexity of TopoJSON tiles requires a lot of processing\n// and so makes movement janky if updates occur every frame – only updating\n// after movement means frame drops are less obvious due to heavy processing\n// occurring while the view is generally stationary\n//\n// The downside is that until new tiles are requested and outputted you will\n// see blank spaces as you orbit and move around\n//\n// An added benefit is that it dramatically reduces the number of tiles being\n// requested over a period of time and the time it takes to go from request to\n// screen output\n//\n// It may be possible to perform these updates per-frame once Web Worker\n// processing is added\n\nclass GeoJSONTileLayer extends TileLayer {\n constructor(path, options) {\n var defaults = {\n maxLOD: 14,\n distance: 2000\n };\n\n options = extend({}, defaults, options);\n\n super(options);\n\n this._path = path;\n }\n\n _onAdd(world) {\n super._onAdd(world);\n\n // Trigger initial quadtree calculation on the next frame\n //\n // TODO: This is a hack to ensure the camera is all set up - a better\n // solution should be found\n setTimeout(() => {\n this._calculateLOD();\n this._initEvents();\n }, 0);\n }\n\n _initEvents() {\n // Run LOD calculations based on render calls\n //\n // Throttled to 1 LOD calculation per 100ms\n this._throttledWorldUpdate = throttle(this._onWorldUpdate, 100);\n\n this._world.on('preUpdate', this._throttledWorldUpdate, this);\n this._world.on('move', this._onWorldMove, this);\n this._world.on('controlsMove', this._onControlsMove, this);\n }\n\n // Update and output tiles each frame (throttled)\n _onWorldUpdate() {\n if (this._pauseOutput) {\n return;\n }\n\n this._outputTiles();\n }\n\n // Update tiles grid after world move, but don't output them\n _onWorldMove(latlon, point) {\n this._pauseOutput = false;\n this._calculateLOD();\n }\n\n // Pause updates during control movement for less visual jank\n _onControlsMove() {\n this._pauseOutput = true;\n }\n\n _createTile(quadcode, layer) {\n var options = {};\n\n // if (this._options.filter) {\n // options.filter = this._options.filter;\n // }\n //\n // if (this._options.style) {\n // options.style = this._options.style;\n // }\n //\n // if (this._options.topojson) {\n // options.topojson = true;\n // }\n //\n // if (this._options.interactive) {\n // options.interactive = true;\n // }\n //\n // if (this._options.onClick) {\n // options.onClick = this._options.onClick;\n // }\n\n return new GeoJSONTile(quadcode, this._path, layer, this._options);\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n this._world.off('preUpdate', this._throttledWorldUpdate);\n this._world.off('move', this._onWorldMove);\n\n this._throttledWorldUpdate = null;\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default GeoJSONTileLayer;\n\nvar noNew = function(path, options) {\n return new GeoJSONTileLayer(path, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as geoJSONTileLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/GeoJSONTileLayer.js\n **/","import Tile from './Tile';\nimport {geoJSONLayer as GeoJSONLayer} from '../GeoJSONLayer';\nimport BoxHelper from '../../vendor/BoxHelper';\nimport THREE from 'three';\nimport reqwest from 'reqwest';\nimport {point as Point} from '../../geo/Point';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport extend from 'lodash.assign';\n// import Offset from 'polygon-offset';\nimport GeoJSON from '../../util/GeoJSON';\nimport Buffer from '../../util/Buffer';\nimport PickingMaterial from '../../engine/PickingMaterial';\n\n// TODO: Map picking IDs to some reference within the tile data / geometry so\n// that something useful can be done when an object is picked / clicked on\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Perform tile request and processing in a Web Worker\n//\n// Use Operative (https://github.com/padolsey/operative)\n//\n// Would it make sense to have the worker functionality defined in a static\n// method so it only gets initialised once and not on every tile instance?\n//\n// Otherwise, worker processing logic would have to go in the tile layer so not\n// to waste loads of time setting up a brand new worker with three.js for each\n// tile every single time.\n//\n// Unsure of the best way to get three.js and VIZI into the worker\n//\n// Would need to set up a CRS / projection identical to the world instance\n//\n// Is it possible to bypass requirements on external script by having multiple\n// simple worker methods that each take enough inputs to perform a single task\n// without requiring VIZI or three.js? So long as the heaviest logic is done in\n// the worker and transferrable objects are used then it should be better than\n// nothing. Would probably still need things like earcut...\n//\n// After all, the three.js logic and object creation will still need to be\n// done on the main thread regardless so the worker should try to do as much as\n// possible with as few dependencies as possible.\n//\n// Have a look at how this is done in Tangram before implementing anything as\n// the approach there is pretty similar and robust.\n\nclass GeoJSONTile extends Tile {\n constructor(quadcode, path, layer, options) {\n super(quadcode, path, layer);\n\n this._defaultStyle = GeoJSON.defaultStyle;\n\n var defaults = {\n output: true,\n outputToScene: false,\n interactive: false,\n topojson: false,\n filter: null,\n onEachFeature: null,\n polygonMaterial: null,\n onPolygonMesh: null,\n onPolygonBufferAttributes: null,\n polylineMaterial: null,\n onPolylineMesh: null,\n onPolylineBufferAttributes: null,\n pointGeometry: null,\n pointMaterial: null,\n onPointMesh: null,\n style: GeoJSON.defaultStyle,\n keepFeatures: false\n };\n\n var _options = extend({}, defaults, options);\n\n if (typeof options.style === 'function') {\n _options.style = options.style;\n } else {\n _options.style = extend({}, defaults.style, options.style);\n }\n\n this._options = _options;\n }\n\n // Request data for the tile\n requestTileAsync() {\n // Making this asynchronous really speeds up the LOD framerate\n setTimeout(() => {\n if (!this._mesh) {\n this._mesh = this._createMesh();\n\n // this._shadowCanvas = this._createShadowCanvas();\n\n this._requestTile();\n }\n }, 0);\n }\n\n // TODO: Destroy GeoJSONLayer\n destroy() {\n // Cancel any pending requests\n this._abortRequest();\n\n // Clear request reference\n this._request = null;\n\n if (this._geojsonLayer) {\n this._geojsonLayer.destroy();\n this._geojsonLayer = null;\n }\n\n this._mesh = null;\n\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n\n super.destroy();\n }\n\n _createMesh() {\n // Something went wrong and the tile\n //\n // Possibly removed by the cache before loaded\n if (!this._center) {\n return;\n }\n\n var mesh = new THREE.Object3D();\n // mesh.add(this._createDebugMesh());\n\n return mesh;\n }\n\n _createDebugMesh() {\n var canvas = document.createElement('canvas');\n canvas.width = 256;\n canvas.height = 256;\n\n var context = canvas.getContext('2d');\n context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n context.fillStyle = '#ff0000';\n context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\n var texture = new THREE.Texture(canvas);\n\n // Silky smooth images when tilted\n texture.magFilter = THREE.LinearFilter;\n texture.minFilter = THREE.LinearMipMapLinearFilter;\n\n // TODO: Set this to renderer.getMaxAnisotropy() / 4\n texture.anisotropy = 4;\n\n texture.needsUpdate = true;\n\n var material = new THREE.MeshBasicMaterial({\n map: texture,\n transparent: true,\n depthWrite: false\n });\n\n var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n var mesh = new THREE.Mesh(geom, material);\n\n mesh.rotation.x = -90 * Math.PI / 180;\n mesh.position.y = 0.1;\n\n return mesh;\n }\n\n // _createShadowCanvas() {\n // var canvas = document.createElement('canvas');\n //\n // // Rendered at a low resolution and later scaled up for a low-quality blur\n // canvas.width = 512;\n // canvas.height = 512;\n //\n // return canvas;\n // }\n\n // _addShadow(coordinates) {\n // var ctx = this._shadowCanvas.getContext('2d');\n // var width = this._shadowCanvas.width;\n // var height = this._shadowCanvas.height;\n //\n // var _coords;\n // var _offset;\n // var offset = new Offset();\n //\n // // Transform coordinates to shadowCanvas space and draw on canvas\n // coordinates.forEach((ring, index) => {\n // ctx.beginPath();\n //\n // _coords = ring.map(coord => {\n // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n // return [xFrac * width, yFrac * height];\n // });\n //\n // if (index > 0) {\n // _offset = _coords;\n // } else {\n // _offset = offset.data(_coords).padding(1.3);\n // }\n //\n // // TODO: This is super flaky and crashes the browser if run on anything\n // // put the outer ring (potentially due to winding)\n // _offset.forEach((coord, index) => {\n // // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n // // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n //\n // if (index === 0) {\n // ctx.moveTo(coord[0], coord[1]);\n // } else {\n // ctx.lineTo(coord[0], coord[1]);\n // }\n // });\n //\n // ctx.closePath();\n // });\n //\n // ctx.fillStyle = 'rgba(80, 80, 80, 0.7)';\n // ctx.fill();\n // }\n\n _requestTile() {\n var urlParams = {\n x: this._tile[0],\n y: this._tile[1],\n z: this._tile[2]\n };\n\n var url = this._getTileURL(urlParams);\n\n this._request = reqwest({\n url: url,\n type: 'json',\n crossOrigin: true\n }).then(res => {\n // Clear request reference\n this._request = null;\n this._processTileData(res);\n }).catch(err => {\n console.error(err);\n\n // Clear request reference\n this._request = null;\n });\n }\n\n _processTileData(data) {\n console.time(this._tile);\n\n // Using this creates a huge amount of memory due to the quantity of tiles\n this._geojsonLayer = GeoJSONLayer(data, this._options).addTo(this._world);\n\n this._mesh = this._geojsonLayer._object3D;\n this._pickingMesh = this._geojsonLayer._pickingMesh;\n\n // Free the GeoJSON memory as we don't need it\n //\n // TODO: This should probably be a method within GeoJSONLayer\n this._geojsonLayer._geojson = null;\n\n // TODO: Fix or store shadow canvas stuff and get rid of this code\n // Draw footprint on shadow canvas\n //\n // TODO: Disabled for the time-being until it can be sped up / moved to\n // a worker\n // this._addShadow(coordinates);\n\n // Output shadow canvas\n\n // TODO: Disabled for the time-being until it can be sped up / moved to\n // a worker\n\n // var texture = new THREE.Texture(this._shadowCanvas);\n //\n // // Silky smooth images when tilted\n // texture.magFilter = THREE.LinearFilter;\n // texture.minFilter = THREE.LinearMipMapLinearFilter;\n //\n // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n // texture.anisotropy = 4;\n //\n // texture.needsUpdate = true;\n //\n // var material;\n // if (!this._world._environment._skybox) {\n // material = new THREE.MeshBasicMaterial({\n // map: texture,\n // transparent: true,\n // depthWrite: false\n // });\n // } else {\n // material = new THREE.MeshStandardMaterial({\n // map: texture,\n // transparent: true,\n // depthWrite: false\n // });\n // material.roughness = 1;\n // material.metalness = 0.1;\n // material.envMap = this._world._environment._skybox.getRenderTarget();\n // }\n //\n // var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n // var mesh = new THREE.Mesh(geom, material);\n //\n // mesh.castShadow = false;\n // mesh.receiveShadow = false;\n // mesh.renderOrder = 1;\n //\n // mesh.rotation.x = -90 * Math.PI / 180;\n //\n // this._mesh.add(mesh);\n\n this._ready = true;\n console.timeEnd(this._tile);\n }\n\n _abortRequest() {\n if (!this._request) {\n return;\n }\n\n this._request.abort();\n }\n}\n\nexport default GeoJSONTile;\n\nvar noNew = function(quadcode, path, layer, options) {\n return new GeoJSONTile(quadcode, path, layer, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as geoJSONTile};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/GeoJSONTile.js\n **/","// TODO: Consider adopting GeoJSON CSS\n// http://wiki.openstreetmap.org/wiki/Geojson_CSS\n\n// TODO: Allow interaction to be defined per-layer to save on resources\n//\n// For example, only allow polygons to be interactive via a polygonInteractive\n// option\n\nimport LayerGroup from './LayerGroup';\nimport extend from 'lodash.assign';\nimport reqwest from 'reqwest';\nimport GeoJSON from '../util/GeoJSON';\nimport Buffer from '../util/Buffer';\nimport PickingMaterial from '../engine/PickingMaterial';\nimport PolygonLayer from './geometry/PolygonLayer';\nimport PolylineLayer from './geometry/PolylineLayer';\nimport PointLayer from './geometry/PointLayer';\n\nclass GeoJSONLayer extends LayerGroup {\n constructor(geojson, options) {\n var defaults = {\n output: false,\n interactive: false,\n topojson: false,\n filter: null,\n onEachFeature: null,\n polygonMaterial: null,\n onPolygonMesh: null,\n onPolygonBufferAttributes: null,\n polylineMaterial: null,\n onPolylineMesh: null,\n onPolylineBufferAttributes: null,\n pointGeometry: null,\n pointMaterial: null,\n onPointMesh: null,\n style: GeoJSON.defaultStyle,\n keepFeatures: true\n };\n\n var _options = extend({}, defaults, options);\n\n if (typeof options.style === 'function') {\n _options.style = options.style;\n } else {\n _options.style = extend({}, defaults.style, options.style);\n }\n\n super(_options);\n\n this._geojson = geojson;\n }\n\n _onAdd(world) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n // Request data from URL if needed\n if (typeof this._geojson === 'string') {\n this._requestData(this._geojson);\n } else {\n // Process and add GeoJSON to layer\n this._processData(this._geojson);\n }\n }\n\n _requestData(url) {\n this._request = reqwest({\n url: url,\n type: 'json',\n crossOrigin: true\n }).then(res => {\n // Clear request reference\n this._request = null;\n this._processData(res);\n }).catch(err => {\n console.error(err);\n\n // Clear request reference\n this._request = null;\n });\n }\n\n // TODO: Wrap into a helper method so this isn't duplicated in the tiled\n // GeoJSON output layer\n //\n // Need to be careful as to not make it impossible to fork this off into a\n // worker script at a later stage\n _processData(data) {\n // Collects features into a single FeatureCollection\n //\n // Also converts TopoJSON to GeoJSON if instructed\n this._geojson = GeoJSON.collectFeatures(data, this._options.topojson);\n\n // TODO: Check that GeoJSON is valid / usable\n\n var features = this._geojson.features;\n\n // Run filter, if provided\n if (this._options.filter) {\n features = this._geojson.features.filter(this._options.filter);\n }\n\n var defaults = {};\n\n // Assume that a style won't be set per feature\n var style = this._options.style;\n\n var options;\n features.forEach(feature => {\n // Get per-feature style object, if provided\n if (typeof this._options.style === 'function') {\n style = extend({}, GeoJSON.defaultStyle, this._options.style(feature));\n }\n\n options = extend({}, defaults, {\n // If merging feature layers, stop them outputting themselves\n // If not, let feature layers output themselves to the world\n output: !this.isOutput(),\n interactive: this._options.interactive,\n style: style\n });\n\n var layer = this._featureToLayer(feature, options);\n\n if (!layer) {\n return;\n }\n\n // Sometimes you don't want to store a reference to the feature\n //\n // For example, to save memory when being used by tile layers\n if (this._options.keepFeatures) {\n layer.feature = feature;\n }\n\n // If defined, call a function for each feature\n //\n // This is commonly used for adding event listeners from the user script\n if (this._options.onEachFeature) {\n this._options.onEachFeature(feature, layer);\n }\n\n this.addLayer(layer);\n });\n\n // If merging layers do that now, otherwise skip as the geometry layers\n // should have already outputted themselves\n if (!this.isOutput()) {\n return;\n }\n\n // From here on we can assume that we want to merge the layers\n\n var polygonAttributes = [];\n var polygonFlat = true;\n\n var polylineAttributes = [];\n var pointAttributes = [];\n\n this._layers.forEach(layer => {\n if (layer instanceof PolygonLayer) {\n polygonAttributes.push(layer.getBufferAttributes());\n\n if (polygonFlat && !layer.isFlat()) {\n polygonFlat = false;\n }\n } else if (layer instanceof PolylineLayer) {\n polylineAttributes.push(layer.getBufferAttributes());\n } else if (layer instanceof PointLayer) {\n pointAttributes.push(layer.getBufferAttributes());\n }\n });\n\n if (polygonAttributes.length > 0) {\n var mergedPolygonAttributes = Buffer.mergeAttributes(polygonAttributes);\n this._setPolygonMesh(mergedPolygonAttributes, polygonFlat);\n this.add(this._polygonMesh);\n }\n\n if (polylineAttributes.length > 0) {\n var mergedPolylineAttributes = Buffer.mergeAttributes(polylineAttributes);\n this._setPolylineMesh(mergedPolylineAttributes);\n this.add(this._polylineMesh);\n }\n\n if (pointAttributes.length > 0) {\n var mergedPointAttributes = Buffer.mergeAttributes(pointAttributes);\n this._setPointMesh(mergedPointAttributes);\n this.add(this._pointMesh);\n }\n\n // Clean up layers\n //\n // TODO: Are there ever situations where the unmerged buffer attributes\n // and coordinates would still be required?\n this._layers.forEach(layer => {\n layer.clearBufferAttributes();\n layer.clearCoordinates();\n });\n }\n\n // Create and store mesh from buffer attributes\n //\n // TODO: De-dupe this from the individual mesh creation logic within each\n // geometry layer (materials, settings, etc)\n //\n // Could make this an abstract method for each geometry layer\n _setPolygonMesh(attributes, flat) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n // TODO: Make this work when style is a function per feature\n var style = (typeof this._options.style === 'function') ? this._options.style(this._geojson.features[0]) : this._options.style;\n style = extend({}, GeoJSON.defaultStyle, style);\n\n var material;\n if (this._options.polygonMaterial && this._options.polygonMaterial instanceof THREE.Material) {\n material = this._options.polygonMaterial;\n } else if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide,\n transparent: style.transparent,\n opacity: style.opacity,\n blending: style.blending\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide,\n transparent: style.transparent,\n opacity: style.opacity,\n blending: style.blending\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var mesh;\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onPolygonMesh === 'function') {\n mesh = this._options.onPolygonMesh(geometry, material);\n } else {\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n }\n\n if (flat) {\n material.depthWrite = false;\n mesh.renderOrder = 1;\n }\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._polygonMesh = mesh;\n }\n\n _setPolylineMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\n if (attributes.normals) {\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n }\n\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n // TODO: Make this work when style is a function per feature\n var style = (typeof this._options.style === 'function') ? this._options.style(this._geojson.features[0]) : this._options.style;\n style = extend({}, GeoJSON.defaultStyle, style);\n\n var material;\n if (this._options.polylineMaterial && this._options.polylineMaterial instanceof THREE.Material) {\n material = this._options.polylineMaterial;\n } else {\n material = new THREE.LineBasicMaterial({\n vertexColors: THREE.VertexColors,\n linewidth: style.lineWidth,\n transparent: style.lineTransparent,\n opacity: style.lineOpacity,\n blending: style.lineBlending\n });\n }\n\n var mesh;\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onPolylineMesh === 'function') {\n mesh = this._options.onPolylineMesh(geometry, material);\n } else {\n mesh = new THREE.LineSegments(geometry, material);\n\n if (style.lineRenderOrder !== undefined) {\n material.depthWrite = false;\n mesh.renderOrder = style.lineRenderOrder;\n }\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n }\n\n // TODO: Allow this to be overridden, or copy mesh instead of creating a new\n // one just for picking\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n // Make the line wider / easier to pick\n material.linewidth = style.lineWidth + material.linePadding;\n\n var pickingMesh = new THREE.LineSegments(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._polylineMesh = mesh;\n }\n\n _setPointMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n if (this._options.pointMaterial && this._options.pointMaterial instanceof THREE.Material) {\n material = this._options.pointMaterial;\n } else if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var mesh;\n\n // Pass mesh callback, if defined\n if (typeof this._options.onPointMesh === 'function') {\n mesh = this._options.onPointMesh(geometry, material);\n } else {\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n }\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._pointMesh = mesh;\n }\n\n // TODO: Support all GeoJSON geometry types\n _featureToLayer(feature, options) {\n var geometry = feature.geometry;\n var coordinates = (geometry.coordinates) ? geometry.coordinates : null;\n\n if (!coordinates || !geometry) {\n return;\n }\n\n if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {\n // Get material instance to use for polygon, if provided\n if (typeof this._options.polygonMaterial === 'function') {\n options.geometry = this._options.polygonMaterial(feature);\n }\n\n if (typeof this._options.onPolygonMesh === 'function') {\n options.onMesh = this._options.onPolygonMesh;\n }\n\n // Pass onBufferAttributes callback, if defined\n if (typeof this._options.onPolygonBufferAttributes === 'function') {\n options.onBufferAttributes = this._options.onPolygonBufferAttributes;\n }\n\n return new PolygonLayer(coordinates, options);\n }\n\n if (geometry.type === 'LineString' || geometry.type === 'MultiLineString') {\n // Get material instance to use for line, if provided\n if (typeof this._options.lineMaterial === 'function') {\n options.geometry = this._options.lineMaterial(feature);\n }\n\n if (typeof this._options.onPolylineMesh === 'function') {\n options.onMesh = this._options.onPolylineMesh;\n }\n\n // Pass onBufferAttributes callback, if defined\n if (typeof this._options.onPolylineBufferAttributes === 'function') {\n options.onBufferAttributes = this._options.onPolylineBufferAttributes;\n }\n\n return new PolylineLayer(coordinates, options);\n }\n\n if (geometry.type === 'Point' || geometry.type === 'MultiPoint') {\n // Get geometry object to use for point, if provided\n if (typeof this._options.pointGeometry === 'function') {\n options.geometry = this._options.pointGeometry(feature);\n }\n\n // Get material instance to use for point, if provided\n if (typeof this._options.pointMaterial === 'function') {\n options.geometry = this._options.pointMaterial(feature);\n }\n\n if (typeof this._options.onPointMesh === 'function') {\n options.onMesh = this._options.onPointMesh;\n }\n\n return new PointLayer(coordinates, options);\n }\n }\n\n _abortRequest() {\n if (!this._request) {\n return;\n }\n\n this._request.abort();\n }\n\n // Destroy the layers and remove them from the scene and memory\n destroy() {\n // Cancel any pending requests\n this._abortRequest();\n\n // Clear request reference\n this._request = null;\n\n this._geojson = null;\n\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default GeoJSONLayer;\n\nvar noNew = function(geojson, options) {\n return new GeoJSONLayer(geojson, options);\n};\n\nexport {noNew as geoJSONLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/GeoJSONLayer.js\n **/","import Layer from './Layer';\nimport extend from 'lodash.assign';\n\nclass LayerGroup extends Layer {\n constructor(options) {\n var defaults = {\n output: false\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n this._layers = [];\n }\n\n addLayer(layer) {\n this._layers.push(layer);\n this._world.addLayer(layer);\n }\n\n removeLayer(layer) {\n var layerIndex = this._layers.indexOf(layer);\n\n if (layerIndex > -1) {\n // Remove from this._layers\n this._layers.splice(layerIndex, 1);\n };\n\n this._world.removeLayer(layer);\n }\n\n _onAdd(world) {}\n\n // Destroy the layers and remove them from the scene and memory\n destroy() {\n for (var i = 0; i < this._layers.length; i++) {\n this._layers[i].destroy();\n }\n\n this._layers = null;\n\n super.destroy();\n }\n}\n\nexport default LayerGroup;\n\nvar noNew = function(options) {\n return new LayerGroup(options);\n};\n\nexport {noNew as layerGroup};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/LayerGroup.js\n **/","/*!\n * Reqwest! A general purpose XHR connection manager\n * license MIT (c) Dustin Diaz 2015\n * https://github.com/ded/reqwest\n */\n\n!function (name, context, definition) {\n if (typeof module != 'undefined' && module.exports) module.exports = definition()\n else if (typeof define == 'function' && define.amd) define(definition)\n else context[name] = definition()\n}('reqwest', this, function () {\n\n var context = this\n\n if ('window' in context) {\n var doc = document\n , byTag = 'getElementsByTagName'\n , head = doc[byTag]('head')[0]\n } else {\n var XHR2\n try {\n XHR2 = require('xhr2')\n } catch (ex) {\n throw new Error('Peer dependency `xhr2` required! Please npm install xhr2')\n }\n }\n\n\n var httpsRe = /^http/\n , protocolRe = /(^\\w+):\\/\\//\n , twoHundo = /^(20\\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n , readyState = 'readyState'\n , contentType = 'Content-Type'\n , requestedWith = 'X-Requested-With'\n , uniqid = 0\n , callbackPrefix = 'reqwest_' + (+new Date())\n , lastValue // data stored by the most recent JSONP callback\n , xmlHttpRequest = 'XMLHttpRequest'\n , xDomainRequest = 'XDomainRequest'\n , noop = function () {}\n\n , isArray = typeof Array.isArray == 'function'\n ? Array.isArray\n : function (a) {\n return a instanceof Array\n }\n\n , defaultHeaders = {\n 'contentType': 'application/x-www-form-urlencoded'\n , 'requestedWith': xmlHttpRequest\n , 'accept': {\n '*': 'text/javascript, text/html, application/xml, text/xml, */*'\n , 'xml': 'application/xml, text/xml'\n , 'html': 'text/html'\n , 'text': 'text/plain'\n , 'json': 'application/json, text/javascript'\n , 'js': 'application/javascript, text/javascript'\n }\n }\n\n , xhr = function(o) {\n // is it x-domain\n if (o['crossOrigin'] === true) {\n var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null\n if (xhr && 'withCredentials' in xhr) {\n return xhr\n } else if (context[xDomainRequest]) {\n return new XDomainRequest()\n } else {\n throw new Error('Browser does not support cross-origin requests')\n }\n } else if (context[xmlHttpRequest]) {\n return new XMLHttpRequest()\n } else if (XHR2) {\n return new XHR2()\n } else {\n return new ActiveXObject('Microsoft.XMLHTTP')\n }\n }\n , globalSetupOptions = {\n dataFilter: function (data) {\n return data\n }\n }\n\n function succeed(r) {\n var protocol = protocolRe.exec(r.url)\n protocol = (protocol && protocol[1]) || context.location.protocol\n return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response\n }\n\n function handleReadyState(r, success, error) {\n return function () {\n // use _aborted to mitigate against IE err c00c023f\n // (can't read props on aborted request objects)\n if (r._aborted) return error(r.request)\n if (r._timedOut) return error(r.request, 'Request is aborted: timeout')\n if (r.request && r.request[readyState] == 4) {\n r.request.onreadystatechange = noop\n if (succeed(r)) success(r.request)\n else\n error(r.request)\n }\n }\n }\n\n function setHeaders(http, o) {\n var headers = o['headers'] || {}\n , h\n\n headers['Accept'] = headers['Accept']\n || defaultHeaders['accept'][o['type']]\n || defaultHeaders['accept']['*']\n\n var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData);\n // breaks cross-origin requests with legacy browsers\n if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith']\n if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType']\n for (h in headers)\n headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h])\n }\n\n function setCredentials(http, o) {\n if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') {\n http.withCredentials = !!o['withCredentials']\n }\n }\n\n function generalCallback(data) {\n lastValue = data\n }\n\n function urlappend (url, s) {\n return url + (/\\?/.test(url) ? '&' : '?') + s\n }\n\n function handleJsonp(o, fn, err, url) {\n var reqId = uniqid++\n , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key\n , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId)\n , cbreg = new RegExp('((^|\\\\?|&)' + cbkey + ')=([^&]+)')\n , match = url.match(cbreg)\n , script = doc.createElement('script')\n , loaded = 0\n , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1\n\n if (match) {\n if (match[3] === '?') {\n url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name\n } else {\n cbval = match[3] // provided callback func name\n }\n } else {\n url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em\n }\n\n context[cbval] = generalCallback\n\n script.type = 'text/javascript'\n script.src = url\n script.async = true\n if (typeof script.onreadystatechange !== 'undefined' && !isIE10) {\n // need this for IE due to out-of-order onreadystatechange(), binding script\n // execution to an event listener gives us control over when the script\n // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html\n script.htmlFor = script.id = '_reqwest_' + reqId\n }\n\n script.onload = script.onreadystatechange = function () {\n if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) {\n return false\n }\n script.onload = script.onreadystatechange = null\n script.onclick && script.onclick()\n // Call the user callback with the last value stored and clean up values and scripts.\n fn(lastValue)\n lastValue = undefined\n head.removeChild(script)\n loaded = 1\n }\n\n // Add the script to the DOM head\n head.appendChild(script)\n\n // Enable JSONP timeout\n return {\n abort: function () {\n script.onload = script.onreadystatechange = null\n err({}, 'Request is aborted: timeout', {})\n lastValue = undefined\n head.removeChild(script)\n loaded = 1\n }\n }\n }\n\n function getRequest(fn, err) {\n var o = this.o\n , method = (o['method'] || 'GET').toUpperCase()\n , url = typeof o === 'string' ? o : o['url']\n // convert non-string objects to query-string form unless o['processData'] is false\n , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string')\n ? reqwest.toQueryString(o['data'])\n : (o['data'] || null)\n , http\n , sendWait = false\n\n // if we're working on a GET request and we have data then we should append\n // query string to end of URL and not post data\n if ((o['type'] == 'jsonp' || method == 'GET') && data) {\n url = urlappend(url, data)\n data = null\n }\n\n if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url)\n\n // get the xhr from the factory if passed\n // if the factory returns null, fall-back to ours\n http = (o.xhr && o.xhr(o)) || xhr(o)\n\n http.open(method, url, o['async'] === false ? false : true)\n setHeaders(http, o)\n setCredentials(http, o)\n if (context[xDomainRequest] && http instanceof context[xDomainRequest]) {\n http.onload = fn\n http.onerror = err\n // NOTE: see\n // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e\n http.onprogress = function() {}\n sendWait = true\n } else {\n http.onreadystatechange = handleReadyState(this, fn, err)\n }\n o['before'] && o['before'](http)\n if (sendWait) {\n setTimeout(function () {\n http.send(data)\n }, 200)\n } else {\n http.send(data)\n }\n return http\n }\n\n function Reqwest(o, fn) {\n this.o = o\n this.fn = fn\n\n init.apply(this, arguments)\n }\n\n function setType(header) {\n // json, javascript, text/plain, text/html, xml\n if (header === null) return undefined; //In case of no content-type.\n if (header.match('json')) return 'json'\n if (header.match('javascript')) return 'js'\n if (header.match('text')) return 'html'\n if (header.match('xml')) return 'xml'\n }\n\n function init(o, fn) {\n\n this.url = typeof o == 'string' ? o : o['url']\n this.timeout = null\n\n // whether request has been fulfilled for purpose\n // of tracking the Promises\n this._fulfilled = false\n // success handlers\n this._successHandler = function(){}\n this._fulfillmentHandlers = []\n // error handlers\n this._errorHandlers = []\n // complete (both success and fail) handlers\n this._completeHandlers = []\n this._erred = false\n this._responseArgs = {}\n\n var self = this\n\n fn = fn || function () {}\n\n if (o['timeout']) {\n this.timeout = setTimeout(function () {\n timedOut()\n }, o['timeout'])\n }\n\n if (o['success']) {\n this._successHandler = function () {\n o['success'].apply(o, arguments)\n }\n }\n\n if (o['error']) {\n this._errorHandlers.push(function () {\n o['error'].apply(o, arguments)\n })\n }\n\n if (o['complete']) {\n this._completeHandlers.push(function () {\n o['complete'].apply(o, arguments)\n })\n }\n\n function complete (resp) {\n o['timeout'] && clearTimeout(self.timeout)\n self.timeout = null\n while (self._completeHandlers.length > 0) {\n self._completeHandlers.shift()(resp)\n }\n }\n\n function success (resp) {\n var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE\n resp = (type !== 'jsonp') ? self.request : resp\n // use global data filter on response text\n var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type)\n , r = filteredResponse\n try {\n resp.responseText = r\n } catch (e) {\n // can't assign this in IE<=8, just ignore\n }\n if (r) {\n switch (type) {\n case 'json':\n try {\n resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')')\n } catch (err) {\n return error(resp, 'Could not parse JSON in response', err)\n }\n break\n case 'js':\n resp = eval(r)\n break\n case 'html':\n resp = r\n break\n case 'xml':\n resp = resp.responseXML\n && resp.responseXML.parseError // IE trololo\n && resp.responseXML.parseError.errorCode\n && resp.responseXML.parseError.reason\n ? null\n : resp.responseXML\n break\n }\n }\n\n self._responseArgs.resp = resp\n self._fulfilled = true\n fn(resp)\n self._successHandler(resp)\n while (self._fulfillmentHandlers.length > 0) {\n resp = self._fulfillmentHandlers.shift()(resp)\n }\n\n complete(resp)\n }\n\n function timedOut() {\n self._timedOut = true\n self.request.abort()\n }\n\n function error(resp, msg, t) {\n resp = self.request\n self._responseArgs.resp = resp\n self._responseArgs.msg = msg\n self._responseArgs.t = t\n self._erred = true\n while (self._errorHandlers.length > 0) {\n self._errorHandlers.shift()(resp, msg, t)\n }\n complete(resp)\n }\n\n this.request = getRequest.call(this, success, error)\n }\n\n Reqwest.prototype = {\n abort: function () {\n this._aborted = true\n this.request.abort()\n }\n\n , retry: function () {\n init.call(this, this.o, this.fn)\n }\n\n /**\n * Small deviation from the Promises A CommonJs specification\n * http://wiki.commonjs.org/wiki/Promises/A\n */\n\n /**\n * `then` will execute upon successful requests\n */\n , then: function (success, fail) {\n success = success || function () {}\n fail = fail || function () {}\n if (this._fulfilled) {\n this._responseArgs.resp = success(this._responseArgs.resp)\n } else if (this._erred) {\n fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n } else {\n this._fulfillmentHandlers.push(success)\n this._errorHandlers.push(fail)\n }\n return this\n }\n\n /**\n * `always` will execute whether the request succeeds or fails\n */\n , always: function (fn) {\n if (this._fulfilled || this._erred) {\n fn(this._responseArgs.resp)\n } else {\n this._completeHandlers.push(fn)\n }\n return this\n }\n\n /**\n * `fail` will execute when the request fails\n */\n , fail: function (fn) {\n if (this._erred) {\n fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n } else {\n this._errorHandlers.push(fn)\n }\n return this\n }\n , 'catch': function (fn) {\n return this.fail(fn)\n }\n }\n\n function reqwest(o, fn) {\n return new Reqwest(o, fn)\n }\n\n // normalize newline variants according to spec -> CRLF\n function normalize(s) {\n return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n }\n\n function serial(el, cb) {\n var n = el.name\n , t = el.tagName.toLowerCase()\n , optCb = function (o) {\n // IE gives value=\"\" even where there is no value attribute\n // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273\n if (o && !o['disabled'])\n cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text']))\n }\n , ch, ra, val, i\n\n // don't serialize elements that are disabled or without a name\n if (el.disabled || !n) return\n\n switch (t) {\n case 'input':\n if (!/reset|button|image|file/i.test(el.type)) {\n ch = /checkbox/i.test(el.type)\n ra = /radio/i.test(el.type)\n val = el.value\n // WebKit gives us \"\" instead of \"on\" if a checkbox has no value, so correct it here\n ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val))\n }\n break\n case 'textarea':\n cb(n, normalize(el.value))\n break\n case 'select':\n if (el.type.toLowerCase() === 'select-one') {\n optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null)\n } else {\n for (i = 0; el.length && i < el.length; i++) {\n el.options[i].selected && optCb(el.options[i])\n }\n }\n break\n }\n }\n\n // collect up all form elements found from the passed argument elements all\n // the way down to child elements; pass a '' or form fields.\n // called with 'this'=callback to use for serial() on each element\n function eachFormElement() {\n var cb = this\n , e, i\n , serializeSubtags = function (e, tags) {\n var i, j, fa\n for (i = 0; i < tags.length; i++) {\n fa = e[byTag](tags[i])\n for (j = 0; j < fa.length; j++) serial(fa[j], cb)\n }\n }\n\n for (i = 0; i < arguments.length; i++) {\n e = arguments[i]\n if (/input|select|textarea/i.test(e.tagName)) serial(e, cb)\n serializeSubtags(e, [ 'input', 'select', 'textarea' ])\n }\n }\n\n // standard query string style serialization\n function serializeQueryString() {\n return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments))\n }\n\n // { 'name': 'value', ... } style serialization\n function serializeHash() {\n var hash = {}\n eachFormElement.apply(function (name, value) {\n if (name in hash) {\n hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])\n hash[name].push(value)\n } else hash[name] = value\n }, arguments)\n return hash\n }\n\n // [ { name: 'name', value: 'value' }, ... ] style serialization\n reqwest.serializeArray = function () {\n var arr = []\n eachFormElement.apply(function (name, value) {\n arr.push({name: name, value: value})\n }, arguments)\n return arr\n }\n\n reqwest.serialize = function () {\n if (arguments.length === 0) return ''\n var opt, fn\n , args = Array.prototype.slice.call(arguments, 0)\n\n opt = args.pop()\n opt && opt.nodeType && args.push(opt) && (opt = null)\n opt && (opt = opt.type)\n\n if (opt == 'map') fn = serializeHash\n else if (opt == 'array') fn = reqwest.serializeArray\n else fn = serializeQueryString\n\n return fn.apply(null, args)\n }\n\n reqwest.toQueryString = function (o, trad) {\n var prefix, i\n , traditional = trad || false\n , s = []\n , enc = encodeURIComponent\n , add = function (key, value) {\n // If value is a function, invoke it and return its value\n value = ('function' === typeof value) ? value() : (value == null ? '' : value)\n s[s.length] = enc(key) + '=' + enc(value)\n }\n // If an array was passed in, assume that it is an array of form elements.\n if (isArray(o)) {\n for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value'])\n } else {\n // If traditional, encode the \"old\" way (the way 1.3.2 or older\n // did it), otherwise encode params recursively.\n for (prefix in o) {\n if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add)\n }\n }\n\n // spaces should be + according to spec\n return s.join('&').replace(/%20/g, '+')\n }\n\n function buildParams(prefix, obj, traditional, add) {\n var name, i, v\n , rbracket = /\\[\\]$/\n\n if (isArray(obj)) {\n // Serialize array item.\n for (i = 0; obj && i < obj.length; i++) {\n v = obj[i]\n if (traditional || rbracket.test(prefix)) {\n // Treat each array item as a scalar.\n add(prefix, v)\n } else {\n buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add)\n }\n }\n } else if (obj && obj.toString() === '[object Object]') {\n // Serialize object item.\n for (name in obj) {\n buildParams(prefix + '[' + name + ']', obj[name], traditional, add)\n }\n\n } else {\n // Serialize scalar item.\n add(prefix, obj)\n }\n }\n\n reqwest.getcallbackPrefix = function () {\n return callbackPrefix\n }\n\n // jQuery and Zepto compatibility, differences can be remapped here so you can call\n // .ajax.compat(options, callback)\n reqwest.compat = function (o, fn) {\n if (o) {\n o['type'] && (o['method'] = o['type']) && delete o['type']\n o['dataType'] && (o['type'] = o['dataType'])\n o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback']\n o['jsonp'] && (o['jsonpCallback'] = o['jsonp'])\n }\n return new Reqwest(o, fn)\n }\n\n reqwest.ajaxSetup = function (options) {\n options = options || {}\n for (var k in options) {\n globalSetupOptions[k] = options[k]\n }\n }\n\n return reqwest\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/reqwest/reqwest.js\n ** module id = 74\n ** module chunks = 0\n **/","/*\n * GeoJSON helpers for handling data and generating objects\n */\n\nimport THREE from 'three';\nimport topojson from 'topojson';\nimport geojsonMerge from 'geojson-merge';\nimport earcut from 'earcut';\nimport extrudePolygon from './extrudePolygon';\n\n// TODO: Make it so height can be per-coordinate / point but connected together\n// as a linestring (eg. GPS points with an elevation at each point)\n//\n// This isn't really valid GeoJSON so perhaps something best left to an external\n// component for now, until a better approach can be considered\n//\n// See: http://lists.geojson.org/pipermail/geojson-geojson.org/2009-June/000489.html\n\n// Light and dark colours used for poor-mans AO gradient on object sides\nvar light = new THREE.Color(0xffffff);\nvar shadow = new THREE.Color(0x666666);\n\nvar GeoJSON = (function() {\n var defaultStyle = {\n color: '#ffffff',\n transparent: false,\n opacity: 1,\n blending: THREE.NormalBlending,\n height: 0,\n lineOpacity: 1,\n lineTransparent: false,\n lineColor: '#ffffff',\n lineWidth: 1,\n lineBlending: THREE.NormalBlending\n };\n\n // Attempts to merge together multiple GeoJSON Features or FeatureCollections\n // into a single FeatureCollection\n var collectFeatures = function(data, _topojson) {\n var collections = [];\n\n if (_topojson) {\n // TODO: Allow TopoJSON objects to be overridden as an option\n\n // If not overridden, merge all features from all objects\n for (var tk in data.objects) {\n collections.push(topojson.feature(data, data.objects[tk]));\n }\n\n return geojsonMerge(collections);\n } else {\n // If root doesn't have a type then let's see if there are features in the\n // next step down\n if (!data.type) {\n // TODO: Allow GeoJSON objects to be overridden as an option\n\n // If not overridden, merge all features from all objects\n for (var gk in data) {\n if (!data[gk].type) {\n continue;\n }\n\n collections.push(data[gk]);\n }\n\n return geojsonMerge(collections);\n } else if (Array.isArray(data)) {\n return geojsonMerge(data);\n } else {\n return data;\n }\n }\n };\n\n // TODO: This is only used by GeoJSONTile so either roll it into that or\n // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n var lineStringAttributes = function(coordinates, colour, height) {\n var _coords = [];\n var _colours = [];\n\n var nextCoord;\n\n // Connect coordinate with the next to make a pair\n //\n // LineSegments requires pairs of vertices so repeat the last point if\n // there's an odd number of vertices\n coordinates.forEach((coordinate, index) => {\n _colours.push([colour.r, colour.g, colour.b]);\n _coords.push([coordinate[0], height, coordinate[1]]);\n\n nextCoord = (coordinates[index + 1]) ? coordinates[index + 1] : coordinate;\n\n _colours.push([colour.r, colour.g, colour.b]);\n _coords.push([nextCoord[0], height, nextCoord[1]]);\n });\n\n return {\n vertices: _coords,\n colours: _colours\n };\n };\n\n // TODO: This is only used by GeoJSONTile so either roll it into that or\n // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n var multiLineStringAttributes = function(coordinates, colour, height) {\n var _coords = [];\n var _colours = [];\n\n var result;\n coordinates.forEach(coordinate => {\n result = lineStringAttributes(coordinate, colour, height);\n\n result.vertices.forEach(coord => {\n _coords.push(coord);\n });\n\n result.colours.forEach(colour => {\n _colours.push(colour);\n });\n });\n\n return {\n vertices: _coords,\n colours: _colours\n };\n };\n\n // TODO: This is only used by GeoJSONTile so either roll it into that or\n // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n var polygonAttributes = function(coordinates, colour, height) {\n var earcutData = _toEarcut(coordinates);\n\n var faces = _triangulate(earcutData.vertices, earcutData.holes, earcutData.dimensions);\n\n var groupedVertices = [];\n for (i = 0, il = earcutData.vertices.length; i < il; i += earcutData.dimensions) {\n groupedVertices.push(earcutData.vertices.slice(i, i + earcutData.dimensions));\n }\n\n var extruded = extrudePolygon(groupedVertices, faces, {\n bottom: 0,\n top: height\n });\n\n var topColor = colour.clone().multiply(light);\n var bottomColor = colour.clone().multiply(shadow);\n\n var _vertices = extruded.positions;\n var _faces = [];\n var _colours = [];\n\n var _colour;\n extruded.top.forEach((face, fi) => {\n _colour = [];\n\n _colour.push([colour.r, colour.g, colour.b]);\n _colour.push([colour.r, colour.g, colour.b]);\n _colour.push([colour.r, colour.g, colour.b]);\n\n _faces.push(face);\n _colours.push(_colour);\n });\n\n var allFlat = true;\n\n if (extruded.sides) {\n if (allFlat) {\n allFlat = false;\n }\n\n // Set up colours for every vertex with poor-mans AO on the sides\n extruded.sides.forEach((face, fi) => {\n _colour = [];\n\n // First face is always bottom-bottom-top\n if (fi % 2 === 0) {\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n _colour.push([topColor.r, topColor.g, topColor.b]);\n // Reverse winding for the second face\n // top-top-bottom\n } else {\n _colour.push([topColor.r, topColor.g, topColor.b]);\n _colour.push([topColor.r, topColor.g, topColor.b]);\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n }\n\n _faces.push(face);\n _colours.push(_colour);\n });\n }\n\n // Skip bottom as there's no point rendering it\n // allFaces.push(extruded.faces);\n\n return {\n vertices: _vertices,\n faces: _faces,\n colours: _colours,\n flat: allFlat\n };\n };\n\n // TODO: This is only used by GeoJSONTile so either roll it into that or\n // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n var _toEarcut = function(data) {\n var dim = data[0][0].length;\n var result = {vertices: [], holes: [], dimensions: dim};\n var holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) {\n result.vertices.push(data[i][j][d]);\n }\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n\n return result;\n };\n\n // TODO: This is only used by GeoJSONTile so either roll it into that or\n // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n var _triangulate = function(contour, holes, dim) {\n // console.time('earcut');\n\n var faces = earcut(contour, holes, dim);\n var result = [];\n\n for (i = 0, il = faces.length; i < il; i += 3) {\n result.push(faces.slice(i, i + 3));\n }\n\n // console.timeEnd('earcut');\n\n return result;\n };\n\n return {\n defaultStyle: defaultStyle,\n collectFeatures: collectFeatures,\n lineStringAttributes: lineStringAttributes,\n multiLineStringAttributes: multiLineStringAttributes,\n polygonAttributes: polygonAttributes\n };\n})();\n\nexport default GeoJSON;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/GeoJSON.js\n **/","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (factory((global.topojson = {})));\n}(this, function (exports) { 'use strict';\n\n function noop() {}\n\n function absolute(transform) {\n if (!transform) return noop;\n var x0,\n y0,\n kx = transform.scale[0],\n ky = transform.scale[1],\n dx = transform.translate[0],\n dy = transform.translate[1];\n return function(point, i) {\n if (!i) x0 = y0 = 0;\n point[0] = (x0 += point[0]) * kx + dx;\n point[1] = (y0 += point[1]) * ky + dy;\n };\n }\n\n function relative(transform) {\n if (!transform) return noop;\n var x0,\n y0,\n kx = transform.scale[0],\n ky = transform.scale[1],\n dx = transform.translate[0],\n dy = transform.translate[1];\n return function(point, i) {\n if (!i) x0 = y0 = 0;\n var x1 = (point[0] - dx) / kx | 0,\n y1 = (point[1] - dy) / ky | 0;\n point[0] = x1 - x0;\n point[1] = y1 - y0;\n x0 = x1;\n y0 = y1;\n };\n }\n\n function reverse(array, n) {\n var t, j = array.length, i = j - n;\n while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;\n }\n\n function bisect(a, x) {\n var lo = 0, hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (a[mid] < x) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n function feature(topology, o) {\n return o.type === \"GeometryCollection\" ? {\n type: \"FeatureCollection\",\n features: o.geometries.map(function(o) { return feature$1(topology, o); })\n } : feature$1(topology, o);\n }\n\n function feature$1(topology, o) {\n var f = {\n type: \"Feature\",\n id: o.id,\n properties: o.properties || {},\n geometry: object(topology, o)\n };\n if (o.id == null) delete f.id;\n return f;\n }\n\n function object(topology, o) {\n var absolute$$ = absolute(topology.transform),\n arcs = topology.arcs;\n\n function arc(i, points) {\n if (points.length) points.pop();\n for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) {\n points.push(p = a[k].slice());\n absolute$$(p, k);\n }\n if (i < 0) reverse(points, n);\n }\n\n function point(p) {\n p = p.slice();\n absolute$$(p, 0);\n return p;\n }\n\n function line(arcs) {\n var points = [];\n for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);\n if (points.length < 2) points.push(points[0].slice());\n return points;\n }\n\n function ring(arcs) {\n var points = line(arcs);\n while (points.length < 4) points.push(points[0].slice());\n return points;\n }\n\n function polygon(arcs) {\n return arcs.map(ring);\n }\n\n function geometry(o) {\n var t = o.type;\n return t === \"GeometryCollection\" ? {type: t, geometries: o.geometries.map(geometry)}\n : t in geometryType ? {type: t, coordinates: geometryType[t](o)}\n : null;\n }\n\n var geometryType = {\n Point: function(o) { return point(o.coordinates); },\n MultiPoint: function(o) { return o.coordinates.map(point); },\n LineString: function(o) { return line(o.arcs); },\n MultiLineString: function(o) { return o.arcs.map(line); },\n Polygon: function(o) { return polygon(o.arcs); },\n MultiPolygon: function(o) { return o.arcs.map(polygon); }\n };\n\n return geometry(o);\n }\n\n function stitchArcs(topology, arcs) {\n var stitchedArcs = {},\n fragmentByStart = {},\n fragmentByEnd = {},\n fragments = [],\n emptyIndex = -1;\n\n // Stitch empty arcs first, since they may be subsumed by other arcs.\n arcs.forEach(function(i, j) {\n var arc = topology.arcs[i < 0 ? ~i : i], t;\n if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {\n t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;\n }\n });\n\n arcs.forEach(function(i) {\n var e = ends(i),\n start = e[0],\n end = e[1],\n f, g;\n\n if (f = fragmentByEnd[start]) {\n delete fragmentByEnd[f.end];\n f.push(i);\n f.end = end;\n if (g = fragmentByStart[end]) {\n delete fragmentByStart[g.start];\n var fg = g === f ? f : f.concat(g);\n fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else if (f = fragmentByStart[end]) {\n delete fragmentByStart[f.start];\n f.unshift(i);\n f.start = start;\n if (g = fragmentByEnd[start]) {\n delete fragmentByEnd[g.end];\n var gf = g === f ? f : g.concat(f);\n fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else {\n f = [i];\n fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;\n }\n });\n\n function ends(i) {\n var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;\n if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; });\n else p1 = arc[arc.length - 1];\n return i < 0 ? [p1, p0] : [p0, p1];\n }\n\n function flush(fragmentByEnd, fragmentByStart) {\n for (var k in fragmentByEnd) {\n var f = fragmentByEnd[k];\n delete fragmentByStart[f.start];\n delete f.start;\n delete f.end;\n f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });\n fragments.push(f);\n }\n }\n\n flush(fragmentByEnd, fragmentByStart);\n flush(fragmentByStart, fragmentByEnd);\n arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });\n\n return fragments;\n }\n\n function mesh(topology) {\n return object(topology, meshArcs.apply(this, arguments));\n }\n\n function meshArcs(topology, o, filter) {\n var arcs = [];\n\n function arc(i) {\n var j = i < 0 ? ~i : i;\n (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom});\n }\n\n function line(arcs) {\n arcs.forEach(arc);\n }\n\n function polygon(arcs) {\n arcs.forEach(line);\n }\n\n function geometry(o) {\n if (o.type === \"GeometryCollection\") o.geometries.forEach(geometry);\n else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs);\n }\n\n if (arguments.length > 1) {\n var geomsByArc = [],\n geom;\n\n var geometryType = {\n LineString: line,\n MultiLineString: polygon,\n Polygon: polygon,\n MultiPolygon: function(arcs) { arcs.forEach(polygon); }\n };\n\n geometry(o);\n\n geomsByArc.forEach(arguments.length < 3\n ? function(geoms) { arcs.push(geoms[0].i); }\n : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });\n } else {\n for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i);\n }\n\n return {type: \"MultiLineString\", arcs: stitchArcs(topology, arcs)};\n }\n\n function triangle(triangle) {\n var a = triangle[0], b = triangle[1], c = triangle[2];\n return Math.abs((a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]));\n }\n\n function ring(ring) {\n var i = -1,\n n = ring.length,\n a,\n b = ring[n - 1],\n area = 0;\n\n while (++i < n) {\n a = b;\n b = ring[i];\n area += a[0] * b[1] - a[1] * b[0];\n }\n\n return area / 2;\n }\n\n function merge(topology) {\n return object(topology, mergeArcs.apply(this, arguments));\n }\n\n function mergeArcs(topology, objects) {\n var polygonsByArc = {},\n polygons = [],\n components = [];\n\n objects.forEach(function(o) {\n if (o.type === \"Polygon\") register(o.arcs);\n else if (o.type === \"MultiPolygon\") o.arcs.forEach(register);\n });\n\n function register(polygon) {\n polygon.forEach(function(ring$$) {\n ring$$.forEach(function(arc) {\n (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);\n });\n });\n polygons.push(polygon);\n }\n\n function exterior(ring$$) {\n return ring(object(topology, {type: \"Polygon\", arcs: [ring$$]}).coordinates[0]) > 0; // TODO allow spherical?\n }\n\n polygons.forEach(function(polygon) {\n if (!polygon._) {\n var component = [],\n neighbors = [polygon];\n polygon._ = 1;\n components.push(component);\n while (polygon = neighbors.pop()) {\n component.push(polygon);\n polygon.forEach(function(ring$$) {\n ring$$.forEach(function(arc) {\n polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) {\n if (!polygon._) {\n polygon._ = 1;\n neighbors.push(polygon);\n }\n });\n });\n });\n }\n }\n });\n\n polygons.forEach(function(polygon) {\n delete polygon._;\n });\n\n return {\n type: \"MultiPolygon\",\n arcs: components.map(function(polygons) {\n var arcs = [], n;\n\n // Extract the exterior (unique) arcs.\n polygons.forEach(function(polygon) {\n polygon.forEach(function(ring$$) {\n ring$$.forEach(function(arc) {\n if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {\n arcs.push(arc);\n }\n });\n });\n });\n\n // Stitch the arcs into one or more rings.\n arcs = stitchArcs(topology, arcs);\n\n // If more than one ring is returned,\n // at most one of these rings can be the exterior;\n // this exterior ring has the same winding order\n // as any exterior ring in the original polygons.\n if ((n = arcs.length) > 1) {\n var sgn = exterior(polygons[0][0]);\n for (var i = 0, t; i < n; ++i) {\n if (sgn === exterior(arcs[i])) {\n t = arcs[0], arcs[0] = arcs[i], arcs[i] = t;\n break;\n }\n }\n }\n\n return arcs;\n })\n };\n }\n\n function neighbors(objects) {\n var indexesByArc = {}, // arc index -> array of object indexes\n neighbors = objects.map(function() { return []; });\n\n function line(arcs, i) {\n arcs.forEach(function(a) {\n if (a < 0) a = ~a;\n var o = indexesByArc[a];\n if (o) o.push(i);\n else indexesByArc[a] = [i];\n });\n }\n\n function polygon(arcs, i) {\n arcs.forEach(function(arc) { line(arc, i); });\n }\n\n function geometry(o, i) {\n if (o.type === \"GeometryCollection\") o.geometries.forEach(function(o) { geometry(o, i); });\n else if (o.type in geometryType) geometryType[o.type](o.arcs, i);\n }\n\n var geometryType = {\n LineString: line,\n MultiLineString: polygon,\n Polygon: polygon,\n MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); }\n };\n\n objects.forEach(geometry);\n\n for (var i in indexesByArc) {\n for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) {\n for (var k = j + 1; k < m; ++k) {\n var ij = indexes[j], ik = indexes[k], n;\n if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik);\n if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij);\n }\n }\n }\n\n return neighbors;\n }\n\n function compareArea(a, b) {\n return a[1][2] - b[1][2];\n }\n\n function minAreaHeap() {\n var heap = {},\n array = [],\n size = 0;\n\n heap.push = function(object) {\n up(array[object._ = size] = object, size++);\n return size;\n };\n\n heap.pop = function() {\n if (size <= 0) return;\n var removed = array[0], object;\n if (--size > 0) object = array[size], down(array[object._ = 0] = object, 0);\n return removed;\n };\n\n heap.remove = function(removed) {\n var i = removed._, object;\n if (array[i] !== removed) return; // invalid request\n if (i !== --size) object = array[size], (compareArea(object, removed) < 0 ? up : down)(array[object._ = i] = object, i);\n return i;\n };\n\n function up(object, i) {\n while (i > 0) {\n var j = ((i + 1) >> 1) - 1,\n parent = array[j];\n if (compareArea(object, parent) >= 0) break;\n array[parent._ = i] = parent;\n array[object._ = i = j] = object;\n }\n }\n\n function down(object, i) {\n while (true) {\n var r = (i + 1) << 1,\n l = r - 1,\n j = i,\n child = array[j];\n if (l < size && compareArea(array[l], child) < 0) child = array[j = l];\n if (r < size && compareArea(array[r], child) < 0) child = array[j = r];\n if (j === i) break;\n array[child._ = i] = child;\n array[object._ = i = j] = object;\n }\n }\n\n return heap;\n }\n\n function presimplify(topology, triangleArea) {\n var absolute$$ = absolute(topology.transform),\n relative$$ = relative(topology.transform),\n heap = minAreaHeap();\n\n if (!triangleArea) triangleArea = triangle;\n\n topology.arcs.forEach(function(arc) {\n var triangles = [],\n maxArea = 0,\n triangle,\n i,\n n,\n p;\n\n // To store each point’s effective area, we create a new array rather than\n // extending the passed-in point to workaround a Chrome/V8 bug (getting\n // stuck in smi mode). For midpoints, the initial effective area of\n // Infinity will be computed in the next step.\n for (i = 0, n = arc.length; i < n; ++i) {\n p = arc[i];\n absolute$$(arc[i] = [p[0], p[1], Infinity], i);\n }\n\n for (i = 1, n = arc.length - 1; i < n; ++i) {\n triangle = arc.slice(i - 1, i + 2);\n triangle[1][2] = triangleArea(triangle);\n triangles.push(triangle);\n heap.push(triangle);\n }\n\n for (i = 0, n = triangles.length; i < n; ++i) {\n triangle = triangles[i];\n triangle.previous = triangles[i - 1];\n triangle.next = triangles[i + 1];\n }\n\n while (triangle = heap.pop()) {\n var previous = triangle.previous,\n next = triangle.next;\n\n // If the area of the current point is less than that of the previous point\n // to be eliminated, use the latter's area instead. This ensures that the\n // current point cannot be eliminated without eliminating previously-\n // eliminated points.\n if (triangle[1][2] < maxArea) triangle[1][2] = maxArea;\n else maxArea = triangle[1][2];\n\n if (previous) {\n previous.next = next;\n previous[2] = triangle[2];\n update(previous);\n }\n\n if (next) {\n next.previous = previous;\n next[0] = triangle[0];\n update(next);\n }\n }\n\n arc.forEach(relative$$);\n });\n\n function update(triangle) {\n heap.remove(triangle);\n triangle[1][2] = triangleArea(triangle);\n heap.push(triangle);\n }\n\n return topology;\n }\n\n var version = \"1.6.24\";\n\n exports.version = version;\n exports.mesh = mesh;\n exports.meshArcs = meshArcs;\n exports.merge = merge;\n exports.mergeArcs = mergeArcs;\n exports.feature = feature;\n exports.neighbors = neighbors;\n exports.presimplify = presimplify;\n\n}));\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/topojson/build/topojson.js\n ** module id = 77\n ** module chunks = 0\n **/","var normalize = require('geojson-normalize');\n\nmodule.exports = function(inputs) {\n return {\n type: 'FeatureCollection',\n features: inputs.reduce(function(memo, input) {\n return memo.concat(normalize(input).features);\n }, [])\n };\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/geojson-merge/index.js\n ** module id = 78\n ** module chunks = 0\n **/","module.exports = normalize;\n\nvar types = {\n Point: 'geometry',\n MultiPoint: 'geometry',\n LineString: 'geometry',\n MultiLineString: 'geometry',\n Polygon: 'geometry',\n MultiPolygon: 'geometry',\n GeometryCollection: 'geometry',\n Feature: 'feature',\n FeatureCollection: 'featurecollection'\n};\n\n/**\n * Normalize a GeoJSON feature into a FeatureCollection.\n *\n * @param {object} gj geojson data\n * @returns {object} normalized geojson data\n */\nfunction normalize(gj) {\n if (!gj || !gj.type) return null;\n var type = types[gj.type];\n if (!type) return null;\n\n if (type === 'geometry') {\n return {\n type: 'FeatureCollection',\n features: [{\n type: 'Feature',\n properties: {},\n geometry: gj\n }]\n };\n } else if (type === 'feature') {\n return {\n type: 'FeatureCollection',\n features: [gj]\n };\n } else if (type === 'featurecollection') {\n return gj;\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/geojson-merge/~/geojson-normalize/index.js\n ** module id = 79\n ** module chunks = 0\n **/","'use strict';\n\nmodule.exports = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode) return triangles;\n\n var minX, minY, maxX, maxY, x, y, size;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and size are later used to transform coords into integers for z-order calculation\n size = Math.max(maxX - minX, maxY - minY);\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, size);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var sum = 0,\n i, j, last;\n\n // calculate original winding order of a polygon ring\n for (i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n\n // link points into circular doubly-linked list in the specified winding order\n if (clockwise === (sum > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, size, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && size) indexCurve(ear, minX, minY, size);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertice leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(ear, triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, size, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, size);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, size) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, size),\n maxZ = zOrder(maxTX, maxTY, minX, minY, size);\n\n // first look for points inside the triangle in increasing z-order\n var p = ear.nextZ;\n\n while (p && p.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.nextZ;\n }\n\n // then look for points in decreasing z-order\n p = ear.prevZ;\n\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])\n if (intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, size) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, size);\n earcutLinked(c, triangles, dim, minX, minY, size);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hole.x === m.x) return m.prev; // hole touches outer segment; pick lower endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n tanMin = Infinity,\n tan;\n\n p = m.next;\n\n while (p !== stop) {\n if (hx >= p.x && p.x >= m.x &&\n pointInTriangle(hy < m.y ? hx : qx, hy, m.x, m.y, hy < m.y ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n }\n\n return m;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, size) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize === 0) {\n e = q;\n q = q.nextZ;\n qSize--;\n } else if (qSize === 0 || !q) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else if (p.z <= q.z) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and size of the data bounding box\nfunction zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return equals(a, b) || a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertice index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertice nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/earcut/src/earcut.js\n ** module id = 80\n ** module chunks = 0\n **/","/*\n * Extrude a polygon given its vertices and triangulated faces\n *\n * Based on:\n * https://github.com/freeman-lab/extrude\n */\n\nimport extend from 'lodash.assign';\n\nvar extrudePolygon = function(points, faces, _options) {\n var defaults = {\n top: 1,\n bottom: 0,\n closed: true\n };\n\n var options = extend({}, defaults, _options);\n\n var n = points.length;\n var positions;\n var cells;\n var topCells;\n var bottomCells;\n var sideCells;\n\n // If bottom and top values are identical then return the flat shape\n (options.top === options.bottom) ? flat() : full();\n\n function flat() {\n positions = points.map(function(p) { return [p[0], options.top, p[1]]; });\n cells = faces;\n topCells = faces;\n }\n\n function full() {\n positions = [];\n points.forEach(function(p) { positions.push([p[0], options.top, p[1]]); });\n points.forEach(function(p) { positions.push([p[0], options.bottom, p[1]]); });\n\n cells = [];\n for (var i = 0; i < n; i++) {\n if (i === (n - 1)) {\n cells.push([i + n, n, i]);\n cells.push([0, i, n]);\n } else {\n cells.push([i + n, i + n + 1, i]);\n cells.push([i + 1, i, i + n + 1]);\n }\n }\n\n sideCells = [].concat(cells);\n\n if (options.closed) {\n var top = faces;\n var bottom = top.map(function(p) { return p.map(function(v) { return v + n; }); });\n bottom = bottom.map(function(p) { return [p[0], p[2], p[1]]; });\n cells = cells.concat(top).concat(bottom);\n\n topCells = top;\n bottomCells = bottom;\n }\n }\n\n return {\n positions: positions,\n faces: cells,\n top: topCells,\n bottom: bottomCells,\n sides: sideCells\n };\n};\n\nexport default extrudePolygon;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/extrudePolygon.js\n **/","/*\n * BufferGeometry helpers\n */\n\nimport THREE from 'three';\n\nvar Buffer = (function() {\n // Merge multiple attribute objects into a single attribute object\n //\n // Attribute objects must all use the same attribute keys\n var mergeAttributes = function(attributes) {\n var lengths = {};\n\n // Find array lengths\n attributes.forEach(_attributes => {\n for (var k in _attributes) {\n if (!lengths[k]) {\n lengths[k] = 0;\n }\n\n lengths[k] += _attributes[k].length;\n }\n });\n\n var mergedAttributes = {};\n\n // Set up arrays to merge into\n for (var k in lengths) {\n mergedAttributes[k] = new Float32Array(lengths[k]);\n }\n\n var lastLengths = {};\n\n attributes.forEach(_attributes => {\n for (var k in _attributes) {\n if (!lastLengths[k]) {\n lastLengths[k] = 0;\n }\n\n mergedAttributes[k].set(_attributes[k], lastLengths[k]);\n\n lastLengths[k] += _attributes[k].length;\n }\n });\n\n return mergedAttributes;\n };\n\n var createLineGeometry = function(lines, offset) {\n var geometry = new THREE.BufferGeometry();\n\n var vertices = new Float32Array(lines.verticesCount * 3);\n var colours = new Float32Array(lines.verticesCount * 3);\n\n var pickingIds;\n if (lines.pickingIds) {\n // One component per vertex (1)\n pickingIds = new Float32Array(lines.verticesCount);\n }\n\n var _vertices;\n var _colour;\n var _pickingId;\n\n var lastIndex = 0;\n\n for (var i = 0; i < lines.vertices.length; i++) {\n _vertices = lines.vertices[i];\n _colour = lines.colours[i];\n\n if (pickingIds) {\n _pickingId = lines.pickingIds[i];\n }\n\n for (var j = 0; j < _vertices.length; j++) {\n var ax = _vertices[j][0] + offset.x;\n var ay = _vertices[j][1];\n var az = _vertices[j][2] + offset.y;\n\n var c1 = _colour[j];\n\n vertices[lastIndex * 3 + 0] = ax;\n vertices[lastIndex * 3 + 1] = ay;\n vertices[lastIndex * 3 + 2] = az;\n\n colours[lastIndex * 3 + 0] = c1[0];\n colours[lastIndex * 3 + 1] = c1[1];\n colours[lastIndex * 3 + 2] = c1[2];\n\n if (pickingIds) {\n pickingIds[lastIndex] = _pickingId;\n }\n\n lastIndex++;\n }\n }\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(colours, 3));\n\n if (pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n return geometry;\n };\n\n // TODO: Make picking IDs optional\n var createGeometry = function(attributes, offset) {\n var geometry = new THREE.BufferGeometry();\n\n // Three components per vertex per face (3 x 3 = 9)\n var vertices = new Float32Array(attributes.facesCount * 9);\n var normals = new Float32Array(attributes.facesCount * 9);\n var colours = new Float32Array(attributes.facesCount * 9);\n\n var pickingIds;\n if (attributes.pickingIds) {\n // One component per vertex per face (1 x 3 = 3)\n pickingIds = new Float32Array(attributes.facesCount * 3);\n }\n\n var pA = new THREE.Vector3();\n var pB = new THREE.Vector3();\n var pC = new THREE.Vector3();\n\n var cb = new THREE.Vector3();\n var ab = new THREE.Vector3();\n\n var index;\n var _faces;\n var _vertices;\n var _colour;\n var _pickingId;\n var lastIndex = 0;\n for (var i = 0; i < attributes.faces.length; i++) {\n _faces = attributes.faces[i];\n _vertices = attributes.vertices[i];\n _colour = attributes.colours[i];\n\n if (pickingIds) {\n _pickingId = attributes.pickingIds[i];\n }\n\n for (var j = 0; j < _faces.length; j++) {\n // Array of vertex indexes for the face\n index = _faces[j][0];\n\n var ax = _vertices[index][0] + offset.x;\n var ay = _vertices[index][1];\n var az = _vertices[index][2] + offset.y;\n\n var c1 = _colour[j][0];\n\n index = _faces[j][1];\n\n var bx = _vertices[index][0] + offset.x;\n var by = _vertices[index][1];\n var bz = _vertices[index][2] + offset.y;\n\n var c2 = _colour[j][1];\n\n index = _faces[j][2];\n\n var cx = _vertices[index][0] + offset.x;\n var cy = _vertices[index][1];\n var cz = _vertices[index][2] + offset.y;\n\n var c3 = _colour[j][2];\n\n // Flat face normals\n // From: http://threejs.org/examples/webgl_buffergeometry.html\n pA.set(ax, ay, az);\n pB.set(bx, by, bz);\n pC.set(cx, cy, cz);\n\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n\n cb.normalize();\n\n var nx = cb.x;\n var ny = cb.y;\n var nz = cb.z;\n\n vertices[lastIndex * 9 + 0] = ax;\n vertices[lastIndex * 9 + 1] = ay;\n vertices[lastIndex * 9 + 2] = az;\n\n normals[lastIndex * 9 + 0] = nx;\n normals[lastIndex * 9 + 1] = ny;\n normals[lastIndex * 9 + 2] = nz;\n\n colours[lastIndex * 9 + 0] = c1[0];\n colours[lastIndex * 9 + 1] = c1[1];\n colours[lastIndex * 9 + 2] = c1[2];\n\n vertices[lastIndex * 9 + 3] = bx;\n vertices[lastIndex * 9 + 4] = by;\n vertices[lastIndex * 9 + 5] = bz;\n\n normals[lastIndex * 9 + 3] = nx;\n normals[lastIndex * 9 + 4] = ny;\n normals[lastIndex * 9 + 5] = nz;\n\n colours[lastIndex * 9 + 3] = c2[0];\n colours[lastIndex * 9 + 4] = c2[1];\n colours[lastIndex * 9 + 5] = c2[2];\n\n vertices[lastIndex * 9 + 6] = cx;\n vertices[lastIndex * 9 + 7] = cy;\n vertices[lastIndex * 9 + 8] = cz;\n\n normals[lastIndex * 9 + 6] = nx;\n normals[lastIndex * 9 + 7] = ny;\n normals[lastIndex * 9 + 8] = nz;\n\n colours[lastIndex * 9 + 6] = c3[0];\n colours[lastIndex * 9 + 7] = c3[1];\n colours[lastIndex * 9 + 8] = c3[2];\n\n if (pickingIds) {\n pickingIds[lastIndex * 3 + 0] = _pickingId;\n pickingIds[lastIndex * 3 + 1] = _pickingId;\n pickingIds[lastIndex * 3 + 2] = _pickingId;\n }\n\n lastIndex++;\n }\n }\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(colours, 3));\n\n if (pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n return geometry;\n };\n\n return {\n mergeAttributes: mergeAttributes,\n createLineGeometry: createLineGeometry,\n createGeometry: createGeometry\n };\n})();\n\nexport default Buffer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/Buffer.js\n **/","import THREE from 'three';\nimport PickingShader from './PickingShader';\n\n// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\nvar PickingMaterial = function() {\n THREE.ShaderMaterial.call(this, {\n uniforms: {\n size: {\n type: 'f',\n value: 0.01,\n },\n scale: {\n type: 'f',\n value: 400,\n }\n },\n // attributes: ['position', 'id'],\n vertexShader: PickingShader.vertexShader,\n fragmentShader: PickingShader.fragmentShader\n });\n\n this.linePadding = 2;\n};\n\nPickingMaterial.prototype = Object.create(THREE.ShaderMaterial.prototype);\n\nPickingMaterial.prototype.constructor = PickingMaterial;\n\nPickingMaterial.prototype.setPointSize = function(size) {\n this.uniforms.size.value = size;\n};\n\nPickingMaterial.prototype.setPointScale = function(scale) {\n this.uniforms.scale.value = scale;\n};\n\nexport default PickingMaterial;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/PickingMaterial.js\n **/","// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\nvar PickingShader = {\n vertexShader: [\n\t\t'attribute float pickingId;',\n\t\t// '',\n\t\t// 'uniform float size;',\n\t\t// 'uniform float scale;',\n\t\t'',\n\t\t'varying vec4 worldId;',\n\t\t'',\n\t\t'void main() {',\n\t\t' vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n\t\t// ' gl_PointSize = size * ( scale / length( mvPosition.xyz ) );',\n\t\t' vec3 a = fract(vec3(1.0/255.0, 1.0/(255.0*255.0), 1.0/(255.0*255.0*255.0)) * pickingId);',\n\t\t' a -= a.xxy * vec3(0.0, 1.0/255.0, 1.0/255.0);',\n\t\t' worldId = vec4(a,1);',\n\t\t' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\t\t'}'\n\t].join('\\n'),\n\n fragmentShader: [\n\t\t'#ifdef GL_ES\\n',\n\t\t'precision highp float;\\n',\n\t\t'#endif\\n',\n\t\t'',\n\t\t'varying vec4 worldId;',\n\t\t'',\n\t\t'void main() {',\n\t\t' gl_FragColor = worldId;',\n\t\t'}'\n\t].join('\\n')\n};\n\nexport default PickingShader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/PickingShader.js\n **/","// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\n// TODO: Look at ways to drop unneeded references to array buffers, etc to\n// reduce memory footprint\n\n// TODO: Support dynamic updating / hiding / animation of geometry\n//\n// This could be pretty hard as it's all packed away within BufferGeometry and\n// may even be merged by another layer (eg. GeoJSONLayer)\n//\n// How much control should this layer support? Perhaps a different or custom\n// layer would be better suited for animation, for example.\n\n// TODO: Allow _setBufferAttributes to use a custom function passed in to\n// generate a custom mesh\n\nimport Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport {point as Point} from '../../geo/Point';\nimport earcut from 'earcut';\nimport extrudePolygon from '../../util/extrudePolygon';\nimport PickingMaterial from '../../engine/PickingMaterial';\nimport Buffer from '../../util/Buffer';\n\nclass PolygonLayer extends Layer {\n constructor(coordinates, options) {\n var defaults = {\n output: true,\n interactive: false,\n // Custom material override\n //\n // TODO: Should this be in the style object?\n material: null,\n onMesh: null,\n onBufferAttributes: null,\n // This default style is separate to Util.GeoJSON.defaultStyle\n style: {\n color: '#ffffff',\n transparent: false,\n opacity: 1,\n blending: THREE.NormalBlending,\n height: 0\n }\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n // Return coordinates as array of polygons so it's easy to support\n // MultiPolygon features (a single polygon would be a MultiPolygon with a\n // single polygon in the array)\n this._coordinates = (PolygonLayer.isSingle(coordinates)) ? [coordinates] : coordinates;\n }\n\n _onAdd(world) {\n this._setCoordinates();\n\n if (this._options.interactive) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n this._setPickingId();\n this._addPickingEvents();\n }\n\n // Store geometry representation as instances of THREE.BufferAttribute\n this._setBufferAttributes();\n\n if (this.isOutput()) {\n // Set mesh if not merging elsewhere\n this._setMesh(this._bufferAttributes);\n\n // Output mesh\n this.add(this._mesh);\n }\n }\n\n // Return center of polygon as a LatLon\n //\n // This is used for things like placing popups / UI elements on the layer\n //\n // TODO: Find proper center position instead of returning first coordinate\n // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polygon.js#L15\n getCenter() {\n return this._center;\n }\n\n // Return polygon bounds in geographic coordinates\n //\n // TODO: Implement getBounds()\n getBounds() {}\n\n // Get unique ID for picking interaction\n _setPickingId() {\n this._pickingId = this.getPickingId();\n }\n\n // Set up and re-emit interaction events\n _addPickingEvents() {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {\n // Re-emit click event from the layer\n this.emit('click', this, point2d, point3d, intersects);\n });\n }\n\n // Create and store reference to THREE.BufferAttribute data for this layer\n _setBufferAttributes() {\n var attributes;\n\n // Only use this if you know what you're doing\n if (typeof this._options.onBufferAttributes === 'function') {\n // TODO: Probably want to pass something less general as arguments,\n // though passing the instance will do for now (it's everything)\n attributes = this._options.onBufferAttributes(this);\n } else {\n var height = 0;\n\n // Convert height into world units\n if (this._options.style.height && this._options.style.height !== 0) {\n height = this._world.metresToWorld(this._options.style.height, this._pointScale);\n }\n\n var colour = new THREE.Color();\n colour.set(this._options.style.color);\n\n // Light and dark colours used for poor-mans AO gradient on object sides\n var light = new THREE.Color(0xffffff);\n var shadow = new THREE.Color(0x666666);\n\n // For each polygon\n attributes = this._projectedCoordinates.map(_projectedCoordinates => {\n // Convert coordinates to earcut format\n var _earcut = this._toEarcut(_projectedCoordinates);\n\n // Triangulate faces using earcut\n var faces = this._triangulate(_earcut.vertices, _earcut.holes, _earcut.dimensions);\n\n var groupedVertices = [];\n for (i = 0, il = _earcut.vertices.length; i < il; i += _earcut.dimensions) {\n groupedVertices.push(_earcut.vertices.slice(i, i + _earcut.dimensions));\n }\n\n var extruded = extrudePolygon(groupedVertices, faces, {\n bottom: 0,\n top: height\n });\n\n var topColor = colour.clone().multiply(light);\n var bottomColor = colour.clone().multiply(shadow);\n\n var _vertices = extruded.positions;\n var _faces = [];\n var _colours = [];\n\n var _colour;\n extruded.top.forEach((face, fi) => {\n _colour = [];\n\n _colour.push([colour.r, colour.g, colour.b]);\n _colour.push([colour.r, colour.g, colour.b]);\n _colour.push([colour.r, colour.g, colour.b]);\n\n _faces.push(face);\n _colours.push(_colour);\n });\n\n this._flat = true;\n\n if (extruded.sides) {\n this._flat = false;\n\n // Set up colours for every vertex with poor-mans AO on the sides\n extruded.sides.forEach((face, fi) => {\n _colour = [];\n\n // First face is always bottom-bottom-top\n if (fi % 2 === 0) {\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n _colour.push([topColor.r, topColor.g, topColor.b]);\n // Reverse winding for the second face\n // top-top-bottom\n } else {\n _colour.push([topColor.r, topColor.g, topColor.b]);\n _colour.push([topColor.r, topColor.g, topColor.b]);\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n }\n\n _faces.push(face);\n _colours.push(_colour);\n });\n }\n\n // Skip bottom as there's no point rendering it\n // allFaces.push(extruded.faces);\n\n var polygon = {\n vertices: _vertices,\n faces: _faces,\n colours: _colours,\n facesCount: _faces.length\n };\n\n if (this._options.interactive && this._pickingId) {\n // Inject picking ID\n polygon.pickingId = this._pickingId;\n }\n\n // Convert polygon representation to proper attribute arrays\n return this._toAttributes(polygon);\n });\n }\n\n this._bufferAttributes = Buffer.mergeAttributes(attributes);\n\n // Original attributes are no longer required so free the memory\n attributes = null;\n }\n\n getBufferAttributes() {\n return this._bufferAttributes;\n }\n\n // Used by external components to clear some memory when the attributes\n // are no longer required to be stored in this layer\n //\n // For example, you would want to clear the attributes here after merging them\n // using something like the GeoJSONLayer\n clearBufferAttributes() {\n this._bufferAttributes = null;\n }\n\n // Used by external components to clear some memory when the coordinates\n // are no longer required to be stored in this layer\n //\n // For example, you would want to clear the coordinates here after this\n // layer is merged in something like the GeoJSONLayer\n clearCoordinates() {\n this._coordinates = null;\n this._projectedCoordinates = null;\n }\n\n // Create and store mesh from buffer attributes\n //\n // This is only called if the layer is controlling its own output\n _setMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n if (this._options.material && this._options.material instanceof THREE.Material) {\n material = this._options.material;\n } else if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide,\n transparent: this._options.style.transparent,\n opacity: this._options.style.opacity,\n blending: this._options.style.blending\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide,\n transparent: this._options.style.transparent,\n opacity: this._options.style.opacity,\n blending: this._options.style.blending\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var mesh;\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onMesh === 'function') {\n mesh = this._options.onMesh(geometry, material);\n } else {\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n }\n\n if (this.isFlat()) {\n material.depthWrite = false;\n mesh.renderOrder = 1;\n }\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._mesh = mesh;\n }\n\n // Convert and project coordinates\n //\n // TODO: Calculate bounds\n _setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n\n this._center = this._coordinates[0][0][0];\n }\n\n // Recursively convert input coordinates into LatLon objects\n //\n // Calculate geographic bounds at the same time\n //\n // TODO: Calculate geographic bounds\n _convertCoordinates(coordinates) {\n return coordinates.map(_coordinates => {\n return _coordinates.map(ring => {\n return ring.map(coordinate => {\n return LatLon(coordinate[1], coordinate[0]);\n });\n });\n });\n }\n\n // Recursively project coordinates into world positions\n //\n // Calculate world bounds, offset and pointScale at the same time\n //\n // TODO: Calculate world bounds\n _projectCoordinates() {\n var point;\n return this._coordinates.map(_coordinates => {\n return _coordinates.map(ring => {\n return ring.map(latlon => {\n point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * point.x;\n this._offset.y = -1 * point.y;\n\n this._pointScale = this._world.pointScale(latlon);\n }\n\n return point;\n });\n });\n });\n }\n\n // Convert coordinates array to something earcut can understand\n _toEarcut(coordinates) {\n var dim = 2;\n var result = {vertices: [], holes: [], dimensions: dim};\n var holeIndex = 0;\n\n for (var i = 0; i < coordinates.length; i++) {\n for (var j = 0; j < coordinates[i].length; j++) {\n // for (var d = 0; d < dim; d++) {\n result.vertices.push(coordinates[i][j].x);\n result.vertices.push(coordinates[i][j].y);\n // }\n }\n if (i > 0) {\n holeIndex += coordinates[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n\n return result;\n }\n\n // Triangulate earcut-based input using earcut\n _triangulate(contour, holes, dim) {\n // console.time('earcut');\n\n var faces = earcut(contour, holes, dim);\n var result = [];\n\n for (i = 0, il = faces.length; i < il; i += 3) {\n result.push(faces.slice(i, i + 3));\n }\n\n // console.timeEnd('earcut');\n\n return result;\n }\n\n // Transform polygon representation into attribute arrays that can be used by\n // THREE.BufferGeometry\n //\n // TODO: Can this be simplified? It's messy and huge\n _toAttributes(polygon) {\n // Three components per vertex per face (3 x 3 = 9)\n var vertices = new Float32Array(polygon.facesCount * 9);\n var normals = new Float32Array(polygon.facesCount * 9);\n var colours = new Float32Array(polygon.facesCount * 9);\n\n var pickingIds;\n if (polygon.pickingId) {\n // One component per vertex per face (1 x 3 = 3)\n pickingIds = new Float32Array(polygon.facesCount * 3);\n }\n\n var pA = new THREE.Vector3();\n var pB = new THREE.Vector3();\n var pC = new THREE.Vector3();\n\n var cb = new THREE.Vector3();\n var ab = new THREE.Vector3();\n\n var index;\n\n var _faces = polygon.faces;\n var _vertices = polygon.vertices;\n var _colour = polygon.colours;\n\n var _pickingId;\n if (pickingIds) {\n _pickingId = polygon.pickingId;\n }\n\n var lastIndex = 0;\n\n for (var i = 0; i < _faces.length; i++) {\n // Array of vertex indexes for the face\n index = _faces[i][0];\n\n var ax = _vertices[index][0];\n var ay = _vertices[index][1];\n var az = _vertices[index][2];\n\n var c1 = _colour[i][0];\n\n index = _faces[i][1];\n\n var bx = _vertices[index][0];\n var by = _vertices[index][1];\n var bz = _vertices[index][2];\n\n var c2 = _colour[i][1];\n\n index = _faces[i][2];\n\n var cx = _vertices[index][0];\n var cy = _vertices[index][1];\n var cz = _vertices[index][2];\n\n var c3 = _colour[i][2];\n\n // Flat face normals\n // From: http://threejs.org/examples/webgl_buffergeometry.html\n pA.set(ax, ay, az);\n pB.set(bx, by, bz);\n pC.set(cx, cy, cz);\n\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n\n cb.normalize();\n\n var nx = cb.x;\n var ny = cb.y;\n var nz = cb.z;\n\n vertices[lastIndex * 9 + 0] = ax;\n vertices[lastIndex * 9 + 1] = ay;\n vertices[lastIndex * 9 + 2] = az;\n\n normals[lastIndex * 9 + 0] = nx;\n normals[lastIndex * 9 + 1] = ny;\n normals[lastIndex * 9 + 2] = nz;\n\n colours[lastIndex * 9 + 0] = c1[0];\n colours[lastIndex * 9 + 1] = c1[1];\n colours[lastIndex * 9 + 2] = c1[2];\n\n vertices[lastIndex * 9 + 3] = bx;\n vertices[lastIndex * 9 + 4] = by;\n vertices[lastIndex * 9 + 5] = bz;\n\n normals[lastIndex * 9 + 3] = nx;\n normals[lastIndex * 9 + 4] = ny;\n normals[lastIndex * 9 + 5] = nz;\n\n colours[lastIndex * 9 + 3] = c2[0];\n colours[lastIndex * 9 + 4] = c2[1];\n colours[lastIndex * 9 + 5] = c2[2];\n\n vertices[lastIndex * 9 + 6] = cx;\n vertices[lastIndex * 9 + 7] = cy;\n vertices[lastIndex * 9 + 8] = cz;\n\n normals[lastIndex * 9 + 6] = nx;\n normals[lastIndex * 9 + 7] = ny;\n normals[lastIndex * 9 + 8] = nz;\n\n colours[lastIndex * 9 + 6] = c3[0];\n colours[lastIndex * 9 + 7] = c3[1];\n colours[lastIndex * 9 + 8] = c3[2];\n\n if (pickingIds) {\n pickingIds[lastIndex * 3 + 0] = _pickingId;\n pickingIds[lastIndex * 3 + 1] = _pickingId;\n pickingIds[lastIndex * 3 + 2] = _pickingId;\n }\n\n lastIndex++;\n }\n\n var attributes = {\n vertices: vertices,\n normals: normals,\n colours: colours\n };\n\n if (pickingIds) {\n attributes.pickingIds = pickingIds;\n }\n\n return attributes;\n }\n\n // Returns true if the polygon is flat (has no height)\n isFlat() {\n return this._flat;\n }\n\n // Returns true if coordinates refer to a single geometry\n //\n // For example, not coordinates for a MultiPolygon GeoJSON feature\n static isSingle(coordinates) {\n return !Array.isArray(coordinates[0][0][0]);\n }\n\n // TODO: Make sure this is cleaning everything\n destroy() {\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n this.clearCoordinates();\n this.clearBufferAttributes();\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default PolygonLayer;\n\nvar noNew = function(coordinates, options) {\n return new PolygonLayer(coordinates, options);\n};\n\nexport {noNew as polygonLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/geometry/PolygonLayer.js\n **/","// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\n// TODO: Look at ways to drop unneeded references to array buffers, etc to\n// reduce memory footprint\n\n// TODO: Provide alternative output using tubes and splines / curves\n\n// TODO: Support dynamic updating / hiding / animation of geometry\n//\n// This could be pretty hard as it's all packed away within BufferGeometry and\n// may even be merged by another layer (eg. GeoJSONLayer)\n//\n// How much control should this layer support? Perhaps a different or custom\n// layer would be better suited for animation, for example.\n\n// TODO: Allow _setBufferAttributes to use a custom function passed in to\n// generate a custom mesh\n\nimport Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport {point as Point} from '../../geo/Point';\nimport PickingMaterial from '../../engine/PickingMaterial';\nimport Buffer from '../../util/Buffer';\n\nclass PolylineLayer extends Layer {\n constructor(coordinates, options) {\n var defaults = {\n output: true,\n interactive: false,\n // Custom material override\n //\n // TODO: Should this be in the style object?\n material: null,\n onMesh: null,\n onBufferAttributes: null,\n // This default style is separate to Util.GeoJSON.defaultStyle\n style: {\n lineOpacity: 1,\n lineTransparent: false,\n lineColor: '#ffffff',\n lineWidth: 1,\n lineBlending: THREE.NormalBlending\n }\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n // Return coordinates as array of lines so it's easy to support\n // MultiLineString features (a single line would be a MultiLineString with a\n // single line in the array)\n this._coordinates = (PolylineLayer.isSingle(coordinates)) ? [coordinates] : coordinates;\n\n // Polyline features are always flat (for now at least)\n this._flat = true;\n }\n\n _onAdd(world) {\n this._setCoordinates();\n\n if (this._options.interactive) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n this._setPickingId();\n this._addPickingEvents();\n }\n\n // Store geometry representation as instances of THREE.BufferAttribute\n this._setBufferAttributes();\n\n if (this.isOutput()) {\n // Set mesh if not merging elsewhere\n this._setMesh(this._bufferAttributes);\n\n // Output mesh\n this.add(this._mesh);\n }\n }\n\n // Return center of polyline as a LatLon\n //\n // This is used for things like placing popups / UI elements on the layer\n //\n // TODO: Find proper center position instead of returning first coordinate\n // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polyline.js#L59\n getCenter() {\n return this._center;\n }\n\n // Return line bounds in geographic coordinates\n //\n // TODO: Implement getBounds()\n getBounds() {}\n\n // Get unique ID for picking interaction\n _setPickingId() {\n this._pickingId = this.getPickingId();\n }\n\n // Set up and re-emit interaction events\n _addPickingEvents() {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {\n // Re-emit click event from the layer\n this.emit('click', this, point2d, point3d, intersects);\n });\n }\n\n // Create and store reference to THREE.BufferAttribute data for this layer\n _setBufferAttributes() {\n var attributes;\n\n // Only use this if you know what you're doing\n if (typeof this._options.onBufferAttributes === 'function') {\n // TODO: Probably want to pass something less general as arguments,\n // though passing the instance will do for now (it's everything)\n attributes = this._options.onBufferAttributes(this);\n } else {\n var height = 0;\n\n // Convert height into world units\n if (this._options.style.lineHeight) {\n height = this._world.metresToWorld(this._options.style.lineHeight, this._pointScale);\n }\n\n var colour = new THREE.Color();\n colour.set(this._options.style.lineColor);\n\n // For each line\n attributes = this._projectedCoordinates.map(_projectedCoordinates => {\n var _vertices = [];\n var _colours = [];\n\n // Connect coordinate with the next to make a pair\n //\n // LineSegments requires pairs of vertices so repeat the last point if\n // there's an odd number of vertices\n var nextCoord;\n _projectedCoordinates.forEach((coordinate, index) => {\n _colours.push([colour.r, colour.g, colour.b]);\n _vertices.push([coordinate.x, height, coordinate.y]);\n\n nextCoord = (_projectedCoordinates[index + 1]) ? _projectedCoordinates[index + 1] : coordinate;\n\n _colours.push([colour.r, colour.g, colour.b]);\n _vertices.push([nextCoord.x, height, nextCoord.y]);\n });\n\n var line = {\n vertices: _vertices,\n colours: _colours,\n verticesCount: _vertices.length\n };\n\n if (this._options.interactive && this._pickingId) {\n // Inject picking ID\n line.pickingId = this._pickingId;\n }\n\n // Convert line representation to proper attribute arrays\n return this._toAttributes(line);\n });\n }\n\n this._bufferAttributes = Buffer.mergeAttributes(attributes);\n\n // Original attributes are no longer required so free the memory\n attributes = null;\n }\n\n getBufferAttributes() {\n return this._bufferAttributes;\n }\n\n // Used by external components to clear some memory when the attributes\n // are no longer required to be stored in this layer\n //\n // For example, you would want to clear the attributes here after merging them\n // using something like the GeoJSONLayer\n clearBufferAttributes() {\n this._bufferAttributes = null;\n }\n\n // Used by external components to clear some memory when the coordinates\n // are no longer required to be stored in this layer\n //\n // For example, you would want to clear the coordinates here after this\n // layer is merged in something like the GeoJSONLayer\n clearCoordinates() {\n this._coordinates = null;\n this._projectedCoordinates = null;\n }\n\n // Create and store mesh from buffer attributes\n //\n // This is only called if the layer is controlling its own output\n _setMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\n if (attributes.normals) {\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n }\n\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var style = this._options.style;\n var material;\n\n if (this._options.material && this._options.material instanceof THREE.Material) {\n material = this._options.material;\n } else {\n material = new THREE.LineBasicMaterial({\n vertexColors: THREE.VertexColors,\n linewidth: style.lineWidth,\n transparent: style.lineTransparent,\n opacity: style.lineOpacity,\n blending: style.lineBlending\n });\n }\n\n var mesh;\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onMesh === 'function') {\n mesh = this._options.onMesh(geometry, material);\n } else {\n mesh = new THREE.LineSegments(geometry, material);\n\n if (style.lineRenderOrder !== undefined) {\n material.depthWrite = false;\n mesh.renderOrder = style.lineRenderOrder;\n }\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n }\n\n // TODO: Allow this to be overridden, or copy mesh instead of creating a new\n // one just for picking\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n // Make the line wider / easier to pick\n material.linewidth = style.lineWidth + material.linePadding;\n\n var pickingMesh = new THREE.LineSegments(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._mesh = mesh;\n }\n\n // Convert and project coordinates\n //\n // TODO: Calculate bounds\n _setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n\n this._center = this._coordinates[0][0];\n }\n\n // Recursively convert input coordinates into LatLon objects\n //\n // Calculate geographic bounds at the same time\n //\n // TODO: Calculate geographic bounds\n _convertCoordinates(coordinates) {\n return coordinates.map(_coordinates => {\n return _coordinates.map(coordinate => {\n return LatLon(coordinate[1], coordinate[0]);\n });\n });\n }\n\n // Recursively project coordinates into world positions\n //\n // Calculate world bounds, offset and pointScale at the same time\n //\n // TODO: Calculate world bounds\n _projectCoordinates() {\n var point;\n return this._coordinates.map(_coordinates => {\n return _coordinates.map(latlon => {\n point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * point.x;\n this._offset.y = -1 * point.y;\n\n this._pointScale = this._world.pointScale(latlon);\n }\n\n return point;\n });\n });\n }\n\n // Transform line representation into attribute arrays that can be used by\n // THREE.BufferGeometry\n //\n // TODO: Can this be simplified? It's messy and huge\n _toAttributes(line) {\n // Three components per vertex\n var vertices = new Float32Array(line.verticesCount * 3);\n var colours = new Float32Array(line.verticesCount * 3);\n\n var pickingIds;\n if (line.pickingId) {\n // One component per vertex\n pickingIds = new Float32Array(line.verticesCount);\n }\n\n var _vertices = line.vertices;\n var _colour = line.colours;\n\n var normals;\n var _normals;\n if (line.normals) {\n normals = new Float32Array(line.verticesCount * 3);\n _normals = line.normals;\n }\n\n var _pickingId;\n if (pickingIds) {\n _pickingId = line.pickingId;\n }\n\n var lastIndex = 0;\n\n for (var i = 0; i < _vertices.length; i++) {\n var ax = _vertices[i][0];\n var ay = _vertices[i][1];\n var az = _vertices[i][2];\n\n var nx;\n var ny;\n var nz;\n if (_normals) {\n nx = _normals[i][0];\n ny = _normals[i][1];\n nz = _normals[i][2];\n }\n\n var c1 = _colour[i];\n\n vertices[lastIndex * 3 + 0] = ax;\n vertices[lastIndex * 3 + 1] = ay;\n vertices[lastIndex * 3 + 2] = az;\n\n if (normals) {\n normals[lastIndex * 3 + 0] = nx;\n normals[lastIndex * 3 + 1] = ny;\n normals[lastIndex * 3 + 2] = nz;\n }\n\n colours[lastIndex * 3 + 0] = c1[0];\n colours[lastIndex * 3 + 1] = c1[1];\n colours[lastIndex * 3 + 2] = c1[2];\n\n if (pickingIds) {\n pickingIds[lastIndex] = _pickingId;\n }\n\n lastIndex++;\n }\n\n var attributes = {\n vertices: vertices,\n colours: colours\n };\n\n if (normals) {\n attributes.normals = normals;\n }\n\n if (pickingIds) {\n attributes.pickingIds = pickingIds;\n }\n\n return attributes;\n }\n\n // Returns true if the line is flat (has no height)\n isFlat() {\n return this._flat;\n }\n\n // Returns true if coordinates refer to a single geometry\n //\n // For example, not coordinates for a MultiLineString GeoJSON feature\n static isSingle(coordinates) {\n return !Array.isArray(coordinates[0][0]);\n }\n\n destroy() {\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n this.clearCoordinates();\n this.clearBufferAttributes();\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default PolylineLayer;\n\nvar noNew = function(coordinates, options) {\n return new PolylineLayer(coordinates, options);\n};\n\nexport {noNew as polylineLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/geometry/PolylineLayer.js\n **/","// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\n// TODO: Look at ways to drop unneeded references to array buffers, etc to\n// reduce memory footprint\n\n// TODO: Point features may be using custom models / meshes and so an approach\n// needs to be found to allow these to be brokwn down into buffer attributes for\n// merging\n//\n// Can probably use fromGeometry() or setFromObject() from THREE.BufferGeometry\n// and pull out the attributes\n\n// TODO: Support sprite objects using textures\n\n// TODO: Provide option to billboard geometry so it always faces the camera\n\n// TODO: Support dynamic updating / hiding / animation of geometry\n//\n// This could be pretty hard as it's all packed away within BufferGeometry and\n// may even be merged by another layer (eg. GeoJSONLayer)\n//\n// How much control should this layer support? Perhaps a different or custom\n// layer would be better suited for animation, for example.\n\nimport Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport {point as Point} from '../../geo/Point';\nimport PickingMaterial from '../../engine/PickingMaterial';\nimport Buffer from '../../util/Buffer';\n\nclass PointLayer extends Layer {\n constructor(coordinates, options) {\n var defaults = {\n output: true,\n interactive: false,\n // THREE.Geometry or THREE.BufferGeometry to use for point output\n geometry: null,\n // Custom material override\n //\n // TODO: Should this be in the style object?\n material: null,\n onMesh: null,\n // This default style is separate to Util.GeoJSON.defaultStyle\n style: {\n pointColor: '#ff0000'\n }\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n // Return coordinates as array of points so it's easy to support\n // MultiPoint features (a single point would be a MultiPoint with a\n // single point in the array)\n this._coordinates = (PointLayer.isSingle(coordinates)) ? [coordinates] : coordinates;\n\n // Point features are always flat (for now at least)\n //\n // This won't always be the case once custom point objects / meshes are\n // added\n this._flat = true;\n }\n\n _onAdd(world) {\n this._setCoordinates();\n\n if (this._options.interactive) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n this._setPickingId();\n this._addPickingEvents();\n }\n\n // Store geometry representation as instances of THREE.BufferAttribute\n this._setBufferAttributes();\n\n if (this.isOutput()) {\n // Set mesh if not merging elsewhere\n this._setMesh(this._bufferAttributes);\n\n // Output mesh\n this.add(this._mesh);\n }\n }\n\n // Return center of point as a LatLon\n //\n // This is used for things like placing popups / UI elements on the layer\n getCenter() {\n return this._center;\n }\n\n // Return point bounds in geographic coordinates\n //\n // While not useful for single points, it could be useful for MultiPoint\n //\n // TODO: Implement getBounds()\n getBounds() {}\n\n // Get unique ID for picking interaction\n _setPickingId() {\n this._pickingId = this.getPickingId();\n }\n\n // Set up and re-emit interaction events\n _addPickingEvents() {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {\n // Re-emit click event from the layer\n this.emit('click', this, point2d, point3d, intersects);\n });\n }\n\n // Create and store reference to THREE.BufferAttribute data for this layer\n _setBufferAttributes() {\n var height = 0;\n\n // Convert height into world units\n if (this._options.style.pointHeight) {\n height = this._world.metresToWorld(this._options.style.pointHeight, this._pointScale);\n }\n\n var colour = new THREE.Color();\n colour.set(this._options.style.pointColor);\n\n var geometry;\n\n // Use default geometry if none has been provided or the provided geometry\n // isn't valid\n if (!this._options.geometry || (!this._options.geometry instanceof THREE.Geometry || !this._options.geometry instanceof THREE.BufferGeometry)) {\n // Debug geometry for points is a thin bar\n //\n // TODO: Allow point geometry to be customised / overridden\n var geometryWidth = this._world.metresToWorld(25, this._pointScale);\n var geometryHeight = this._world.metresToWorld(200, this._pointScale);\n var _geometry = new THREE.BoxGeometry(geometryWidth, geometryHeight, geometryWidth);\n\n // Shift geometry up so it sits on the ground\n _geometry.translate(0, geometryHeight * 0.5, 0);\n\n // Pull attributes out of debug geometry\n geometry = new THREE.BufferGeometry().fromGeometry(_geometry);\n } else {\n if (this._options.geometry instanceof THREE.BufferGeometry) {\n geometry = this._options.geometry;\n } else {\n geometry = new THREE.BufferGeometry().fromGeometry(this._options.geometry);\n }\n }\n\n // For each point\n var attributes = this._projectedCoordinates.map(coordinate => {\n var _vertices = [];\n var _normals = [];\n var _colours = [];\n\n var _geometry = geometry.clone();\n\n _geometry.translate(coordinate.x, height, coordinate.y);\n\n var _vertices = _geometry.attributes.position.clone().array;\n var _normals = _geometry.attributes.normal.clone().array;\n var _colours = _geometry.attributes.color.clone().array;\n\n for (var i = 0; i < _colours.length; i += 3) {\n _colours[i] = colour.r;\n _colours[i + 1] = colour.g;\n _colours[i + 2] = colour.b;\n }\n\n var _point = {\n vertices: _vertices,\n normals: _normals,\n colours: _colours\n };\n\n if (this._options.interactive && this._pickingId) {\n // Inject picking ID\n // point.pickingId = this._pickingId;\n _point.pickingIds = new Float32Array(_vertices.length / 3);\n for (var i = 0; i < _point.pickingIds.length; i++) {\n _point.pickingIds[i] = this._pickingId;\n }\n }\n\n // Convert point representation to proper attribute arrays\n // return this._toAttributes(_point);\n return _point;\n });\n\n this._bufferAttributes = Buffer.mergeAttributes(attributes);\n\n // Original attributes are no longer required so free the memory\n attributes = null;\n }\n\n getBufferAttributes() {\n return this._bufferAttributes;\n }\n\n // Used by external components to clear some memory when the attributes\n // are no longer required to be stored in this layer\n //\n // For example, you would want to clear the attributes here after merging them\n // using something like the GeoJSONLayer\n clearBufferAttributes() {\n this._bufferAttributes = null;\n }\n\n // Used by external components to clear some memory when the coordinates\n // are no longer required to be stored in this layer\n //\n // For example, you would want to clear the coordinates here after this\n // layer is merged in something like the GeoJSONLayer\n clearCoordinates() {\n this._coordinates = null;\n this._projectedCoordinates = null;\n }\n\n // Create and store mesh from buffer attributes\n //\n // This is only called if the layer is controlling its own output\n _setMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n\n if (this._options.material && this._options.material instanceof THREE.Material) {\n material = this._options.material;\n } else if (!this._world._environment._skybox) {\n material = new THREE.MeshBasicMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var mesh;\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onMesh === 'function') {\n mesh = this._options.onMesh(geometry, material);\n } else {\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n }\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._mesh = mesh;\n }\n\n // Convert and project coordinates\n //\n // TODO: Calculate bounds\n _setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n\n this._center = this._coordinates;\n }\n\n // Recursively convert input coordinates into LatLon objects\n //\n // Calculate geographic bounds at the same time\n //\n // TODO: Calculate geographic bounds\n _convertCoordinates(coordinates) {\n return coordinates.map(coordinate => {\n return LatLon(coordinate[1], coordinate[0]);\n });\n }\n\n // Recursively project coordinates into world positions\n //\n // Calculate world bounds, offset and pointScale at the same time\n //\n // TODO: Calculate world bounds\n _projectCoordinates() {\n var _point;\n return this._coordinates.map(latlon => {\n _point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * _point.x;\n this._offset.y = -1 * _point.y;\n\n this._pointScale = this._world.pointScale(latlon);\n }\n\n return _point;\n });\n }\n\n // Transform line representation into attribute arrays that can be used by\n // THREE.BufferGeometry\n //\n // TODO: Can this be simplified? It's messy and huge\n _toAttributes(line) {\n // Three components per vertex\n var vertices = new Float32Array(line.verticesCount * 3);\n var colours = new Float32Array(line.verticesCount * 3);\n\n var pickingIds;\n if (line.pickingId) {\n // One component per vertex\n pickingIds = new Float32Array(line.verticesCount);\n }\n\n var _vertices = line.vertices;\n var _colour = line.colours;\n\n var _pickingId;\n if (pickingIds) {\n _pickingId = line.pickingId;\n }\n\n var lastIndex = 0;\n\n for (var i = 0; i < _vertices.length; i++) {\n var ax = _vertices[i][0];\n var ay = _vertices[i][1];\n var az = _vertices[i][2];\n\n var c1 = _colour[i];\n\n vertices[lastIndex * 3 + 0] = ax;\n vertices[lastIndex * 3 + 1] = ay;\n vertices[lastIndex * 3 + 2] = az;\n\n colours[lastIndex * 3 + 0] = c1[0];\n colours[lastIndex * 3 + 1] = c1[1];\n colours[lastIndex * 3 + 2] = c1[2];\n\n if (pickingIds) {\n pickingIds[lastIndex] = _pickingId;\n }\n\n lastIndex++;\n }\n\n var attributes = {\n vertices: vertices,\n colours: colours\n };\n\n if (pickingIds) {\n attributes.pickingIds = pickingIds;\n }\n\n return attributes;\n }\n\n // Returns true if the line is flat (has no height)\n isFlat() {\n return this._flat;\n }\n\n // Returns true if coordinates refer to a single geometry\n //\n // For example, not coordinates for a MultiPoint GeoJSON feature\n static isSingle(coordinates) {\n return !Array.isArray(coordinates[0]);\n }\n\n destroy() {\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n this.clearCoordinates();\n this.clearBufferAttributes();\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default PointLayer;\n\nvar noNew = function(coordinates, options) {\n return new PointLayer(coordinates, options);\n};\n\nexport {noNew as pointLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/geometry/PointLayer.js\n **/","import GeoJSONTileLayer from './GeoJSONTileLayer';\nimport extend from 'lodash.assign';\n\nclass TopoJSONTileLayer extends GeoJSONTileLayer {\n constructor(path, options) {\n var defaults = {\n topojson: true\n };\n\n options = extend({}, defaults, options);\n\n super(path, options);\n }\n}\n\nexport default TopoJSONTileLayer;\n\nvar noNew = function(path, options) {\n return new TopoJSONTileLayer(path, options);\n};\n\nexport {noNew as topoJSONTileLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/TopoJSONTileLayer.js\n **/","import GeoJSONLayer from './GeoJSONLayer';\nimport extend from 'lodash.assign';\n\nclass TopoJSONLayer extends GeoJSONLayer {\n constructor(topojson, options) {\n var defaults = {\n topojson: true\n };\n\n options = extend({}, defaults, options);\n\n super(topojson, options);\n }\n}\n\nexport default TopoJSONLayer;\n\nvar noNew = function(topojson, options) {\n return new TopoJSONLayer(topojson, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as topoJSONLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/TopoJSONLayer.js\n **/","// TODO: A lot of these utils don't need to be in separate, tiny files\n\nimport Transformation from './Transformation';\nimport wrapNum from './wrapNum';\nimport extrudePolygon from './extrudePolygon';\nimport GeoJSON from './GeoJSON';\nimport Buffer from './Buffer';\n\nconst Util = {};\n\nUtil.Transformation = Transformation;\nUtil.wrapNum = wrapNum;\nUtil.extrudePolygon = extrudePolygon;\nUtil.GeoJSON = GeoJSON;\nUtil.Buffer = Buffer;\n\nexport default Util;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/index.js\n **/"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","vizicities.min.js","webpack:/webpack/bootstrap 336199aca5474e84dce3","webpack:///src/vizicities.js","webpack:///src/World.js","webpack:///~/eventemitter3/index.js","webpack:///~/lodash.assign/index.js","webpack:///~/lodash.keys/index.js","webpack:///~/lodash.rest/index.js","webpack:///src/geo/crs/index.js","webpack:///src/geo/crs/CRS.EPSG3857.js","webpack:///src/geo/crs/CRS.Earth.js","webpack:///src/geo/crs/CRS.js","webpack:///src/geo/LatLon.js","webpack:///src/geo/Point.js","webpack:///src/util/wrapNum.js","webpack:///src/geo/projection/Projection.SphericalMercator.js","webpack:///src/util/Transformation.js","webpack:///src/geo/crs/CRS.EPSG3395.js","webpack:///src/geo/projection/Projection.Mercator.js","webpack:///src/geo/crs/CRS.EPSG4326.js","webpack:///src/geo/projection/Projection.LatLon.js","webpack:///src/geo/crs/CRS.Simple.js","webpack:///src/geo/crs/CRS.Proj4.js","webpack:///src/geo/projection/Projection.Proj4.js","webpack:/external \"proj4\"","webpack:///src/engine/Engine.js","webpack:/external \"THREE\"","webpack:///src/engine/Scene.js","webpack:///src/engine/DOMScene3D.js","webpack:///src/engine/DOMScene2D.js","webpack:///src/engine/Renderer.js","webpack:///src/engine/DOMRenderer3D.js","webpack:///src/vendor/CSS3DRenderer.js","webpack:///src/engine/DOMRenderer2D.js","webpack:///src/vendor/CSS2DRenderer.js","webpack:///src/engine/Camera.js","webpack:///src/engine/Picking.js","webpack:///src/engine/PickingScene.js","webpack:///src/engine/EffectComposer.js","webpack:///src/vendor/EffectComposer.js","webpack:///src/vendor/CopyShader.js","webpack:///src/vendor/ShaderPass.js","webpack:///src/vendor/MaskPass.js","webpack:///src/vendor/RenderPass.js","webpack:///src/vendor/HorizontalTiltShiftShader.js","webpack:///src/vendor/VerticalTiltShiftShader.js","webpack:///src/vendor/FXAAShader.js","webpack:///src/layer/environment/EnvironmentLayer.js","webpack:///src/layer/Layer.js","webpack:///src/layer/environment/Skybox.js","webpack:///src/layer/environment/Sky.js","webpack:///~/lodash.throttle/index.js","webpack:///~/lodash.throttle/~/lodash.debounce/index.js","webpack:///src/controls/index.js","webpack:///src/controls/Controls.Orbit.js","webpack:///src/vendor/OrbitControls.js","webpack:///~/hammerjs/hammer.js","webpack:///src/layer/tile/ImageTileLayer.js","webpack:///src/layer/tile/TileLayer.js","webpack:///src/layer/tile/TileCache.js","webpack:///~/lru-cache/lib/lru-cache.js","webpack:///~/pseudomap/map.js","webpack:///~/process/browser.js","webpack:///~/pseudomap/pseudomap.js","webpack:///~/util/util.js","webpack:///~/util/support/isBufferBrowser.js","webpack:///~/inherits/inherits_browser.js","webpack:///~/yallist/yallist.js","webpack:///src/layer/tile/ImageTile.js","webpack:///src/layer/tile/Tile.js","webpack:///src/vendor/BoxHelper.js","webpack:///src/layer/tile/ImageTileLayerBaseMaterial.js","webpack:///src/layer/tile/GeoJSONTileLayer.js","webpack:///src/layer/tile/GeoJSONTile.js","webpack:///src/layer/GeoJSONLayer.js","webpack:///src/layer/LayerGroup.js","webpack:///~/reqwest/reqwest.js","webpack:///src/util/GeoJSON.js","webpack:///~/topojson/build/topojson.js","webpack:///~/geojson-merge/index.js","webpack:///~/geojson-merge/~/geojson-normalize/index.js","webpack:///~/earcut/src/earcut.js","webpack:///src/util/extrudePolygon.js","webpack:///src/util/Buffer.js","webpack:///src/engine/PickingMaterial.js","webpack:///src/engine/PickingShader.js","webpack:///src/layer/geometry/PolygonLayer.js","webpack:///src/layer/geometry/PolylineLayer.js","webpack:///src/layer/geometry/PointLayer.js","webpack:///src/layer/tile/TopoJSONTileLayer.js","webpack:///src/layer/TopoJSONLayer.js","webpack:///src/util/index.js"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_22__","__WEBPACK_EXTERNAL_MODULE_24__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","Object","defineProperty","value","_World","_World2","_controlsIndex","_controlsIndex2","_layerLayer","_layerLayer2","_layerEnvironmentEnvironmentLayer","_layerEnvironmentEnvironmentLayer2","_layerTileImageTileLayer","_layerTileImageTileLayer2","_layerTileGeoJSONTileLayer","_layerTileGeoJSONTileLayer2","_layerTileTopoJSONTileLayer","_layerTileTopoJSONTileLayer2","_layerGeoJSONLayer","_layerGeoJSONLayer2","_layerTopoJSONLayer","_layerTopoJSONLayer2","_layerGeometryPolygonLayer","_layerGeometryPolygonLayer2","_layerGeometryPolylineLayer","_layerGeometryPolylineLayer2","_layerGeometryPointLayer","_layerGeometryPointLayer2","_geoPoint","_geoPoint2","_geoLatLon","_geoLatLon2","_utilIndex","_utilIndex2","VIZI","version","World","world","Controls","Layer","layer","EnvironmentLayer","environmentLayer","ImageTileLayer","imageTileLayer","GeoJSONTileLayer","geoJSONTileLayer","TopoJSONTileLayer","topoJSONTileLayer","GeoJSONLayer","geoJSONLayer","TopoJSONLayer","topoJSONLayer","PolygonLayer","polygonLayer","PolylineLayer","polylineLayer","PointLayer","pointLayer","Point","point","LatLon","latLon","Util","_classCallCheck","instance","Constructor","TypeError","_inherits","subClass","superClass","prototype","create","constructor","enumerable","writable","configurable","setPrototypeOf","__proto__","_createClass","defineProperties","target","props","i","length","descriptor","key","protoProps","staticProps","_get","_x","_x2","_x3","_again","object","property","receiver","Function","desc","getOwnPropertyDescriptor","undefined","getter","get","parent","getPrototypeOf","_eventemitter3","_eventemitter32","_lodashAssign","_lodashAssign2","_geoCrsIndex","_geoCrsIndex2","_engineEngine","_engineEngine2","_EventEmitter","domId","options","defaults","crs","EPSG3857","skybox","postProcessing","_layers","_controls","_initContainer","_initEngine","_initEnvironment","_initEvents","_pause","_update","_container","document","getElementById","_engine","_environment","addTo","on","_onControlsMoveEnd","_point","x","z","_resetView","pointToLatLon","latlon","emit","_moveStart","_move","_moveEnd","_lastPosition","delta","clock","getDelta","window","requestAnimationFrame","bind","forEach","controls","update","_originLatlon","_originPoint","project","latLonToPoint","projectedPoint","_subtract","add","unproject","accurate","pointScale","metres","zoom","metresToWorld","worldUnits","worldToMetres","_camera","_addToWorld","push","isOutput","isOutputToScene","_scene","_object3D","_domScene3D","_domObject3D","_domScene2D","_domObject2D","layerIndex","indexOf","splice","remove","controlsIndex","stop","off","removeControls","destroy","removeLayer","noNew","EE","fn","context","once","EventEmitter","prefix","_events","listeners","event","exists","evt","available","l","ee","Array","a1","a2","a3","a4","a5","args","len","arguments","removeListener","apply","j","listener","events","removeAllListeners","addListener","setMaxListeners","prefixed","isIndex","reIsUint","test","MAX_SAFE_INTEGER","assignValue","objValue","eq","objectProto","hasOwnProperty","baseProperty","copyObject","source","copyObjectWith","customizer","index","newValue","createAssigner","assigner","rest","sources","guard","isIterateeCall","isObject","type","isArrayLike","other","isFunction","isLength","getLength","tag","objectToString","funcTag","genTag","keys","toString","assign","baseTimes","n","iteratee","result","baseHas","baseKeys","nativeKeys","indexKeys","isArray","isString","isArguments","String","isPrototype","Ctor","proto","isArrayLikeObject","propertyIsEnumerable","argsTag","isObjectLike","stringTag","isProto","indexes","skipIndexes","func","thisArg","start","FUNC_ERROR_TEXT","nativeMax","toInteger","array","otherArgs","toNumber","INFINITY","sign","MAX_INTEGER","remainder","valueOf","replace","reTrim","isBinary","reIsBinary","reIsOctal","freeParseInt","slice","reIsBadHex","NAN","parseInt","Math","max","_CRSEPSG3857","_CRSEPSG38572","_CRSEPSG3395","_CRSEPSG33952","_CRSEPSG4326","_CRSEPSG43262","_CRSSimple","_CRSSimple2","_CRSProj4","_CRSProj42","CRS","EPSG900913","EPSG3395","EPSG4326","Simple","Proj4","_CRSEarth","_CRSEarth2","_projectionProjectionSphericalMercator","_projectionProjectionSphericalMercator2","_utilTransformation","_utilTransformation2","_EPSG3857","code","projection","transformScale","PI","R","transformation","scale","_CRS","_CRS2","Earth","wrapLon","distance","latlon1","latlon2","lat1","lat2","a","rad","lat","lon1","lon","lon2","deltaLat","deltaLon","halfDeltaLat","halfDeltaLon","sin","cos","atan2","sqrt","acos","min","metresToProjected","projectedToMetres","projectedUnits","projectedMetres","scaledMetres","realMetres","_LatLon","_Point","_utilWrapNum","_utilWrapNum2","scaleFactor","_transform","untransformedPoint","untransform","pow","log","LN2","getProjectedBounds","infinite","b","bounds","s","transform","wrapLatLon","wrapLat","alt","isNaN","Error","lng","y","round","clone","_add","wrapNum","range","includeMax","d","SphericalMercator","MAX_LATITUDE","ECC","ECC2","atan","exp","k","sinLat","sinLat2","cosLat","v","h","Transformation","_a","_b","_c","_d","_projectionProjectionMercator","_projectionProjectionMercator2","_EPSG3395","Mercator","R_MINOR","r","tmp","e","con","ts","tan","phi","dphi","abs","_projectionProjectionLatLon","_projectionProjectionLatLon2","_EPSG4326","ProjectionLatLon","m1","m2","m3","m4","p1","p2","p3","latlen","lonlen","_Simple","dx","dy","_projectionProjectionProj4","_projectionProjectionProj42","_Proj4","def","diffX","diffY","halfX","halfY","scaleX","scaleY","offsetX","offsetY","_proj4","_proj42","proj","forward","inverse","bottomLeft","topRight","_three","_three2","_Scene","_Scene2","_DOMScene3D","_DOMScene3D2","_DOMScene2D","_DOMScene2D2","_Renderer","_Renderer2","_DOMRenderer3D","_DOMRenderer3D2","_DOMRenderer2D","_DOMRenderer2D2","_Camera","_Camera2","_Picking","_Picking2","_EffectComposer","_EffectComposer2","_vendorRenderPass","_vendorRenderPass2","_vendorShaderPass","_vendorShaderPass2","_vendorCopyShader","_vendorCopyShader2","_vendorHorizontalTiltShiftShader","_vendorHorizontalTiltShiftShader2","_vendorVerticalTiltShiftShader","_vendorVerticalTiltShiftShader2","_vendorFXAAShader","_vendorFXAAShader2","Engine","container","console","_world","antialias","_renderer","_domRenderer3D","_domRenderer2D","_picking","Clock","_frustum","Frustum","_initPostProcessing","renderPass","fxaaPass","hblurPass","vblurPass","bluriness","uniforms","copyPass","renderToScreen","_composer","addPass","self","updatePostProcessingSize","width","clientWidth","height","clientHeight","pixelRatio","devicePixelRatio","resolution","set","addEventListener","render","child","children","geometry","dispose","material","map","_clock","scene","Scene","renderer","WebGLRenderer","setClearColor","setPixelRatio","gammaInput","gammaOutput","shadowMap","enabled","appendChild","domElement","updateSize","setSize","_vendorCSS3DRenderer","CSS3DRenderer","style","position","top","CSS3DObject","element","Object3D","parentNode","removeChild","CSS3DSprite","REVISION","_width","_height","_widthHalf","_heightHalf","matrix","Matrix4","cache","camera","fov","objects","createElement","overflow","WebkitTransformStyle","MozTransformStyle","oTransformStyle","transformStyle","cameraElement","getSize","epsilon","Number","EPSILON","getCameraCSSMatrix","elements","getObjectCSSMatrix","renderObject","copy","matrixWorldInverse","transpose","copyPosition","matrixWorld","cachedStyle","WebkitTransform","MozTransform","oTransform","degToRad","WebkitPerspective","MozPerspective","oPerspective","perspective","updateMatrixWorld","getInverse","_vendorCSS2DRenderer","CSS2DRenderer","CSS2DObject","vector","Vector3","viewMatrix","viewProjectionMatrix","setFromMatrixPosition","applyProjection","multiplyMatrices","projectionMatrix","PerspectiveCamera","aspect","updateProjectionMatrix","_PickingScene","_PickingScene2","nextId","Picking","_raycaster","Raycaster","linePrecision","_pickingScene","_pickingTexture","WebGLRenderTarget","texture","minFilter","LinearFilter","generateMipmaps","_nextId","_resizeTexture","_onMouseUp","_onWorldMove","button","clientX","clientY","normalisedPoint","_pick","_needUpdate","size","_pixelBuffer","Uint8Array","readRenderTargetPixels","setFromCamera","_point3d","intersects","intersectObjects","_point2d","mesh","removeEventListener","_vendorEffectComposer","_vendorEffectComposer2","composer","_CopyShader","_CopyShader2","_ShaderPass","_ShaderPass2","_MaskPass","_MaskPass2","EffectComposer","renderTarget","getPixelRatio","floor","canvas","parameters","magFilter","format","RGBAFormat","stencilBuffer","renderTarget1","renderTarget2","writeBuffer","readBuffer","passes","error","swapBuffers","pass","insertPass","maskActive","il","needsSwap","stencilFunc","NOTEQUAL","EQUAL","ClearMaskPass","reset","CopyShader","tDiffuse","opacity","vertexShader","join","fragmentShader","ShaderPass","shader","textureID","ShaderMaterial","UniformsUtils","defines","clear","OrthographicCamera","quad","Mesh","PlaneBufferGeometry","MaskPass","colorMask","depthMask","writeValue","clearValue","enable","STENCIL_TEST","stencilOp","REPLACE","ALWAYS","clearStencil","KEEP","disable","RenderPass","overrideMaterial","clearColor","clearAlpha","oldClearColor","Color","oldClearAlpha","getClearColor","getClearAlpha","HorizontalTiltShiftShader","VerticalTiltShiftShader","FXAAShader","Vector2","_Layer2","_Layer3","_Skybox","_Skybox2","_Layer","_options","_initLights","_initSkybox","_skyboxLight","DirectionalLight","castShadow","shadow","left","right","bottom","near","far","mapSize","directionalLight","directionalLight2","_skybox","_mesh","step","gridHelper","GridHelper","_engineScene","output","outputToScene","_dom3D","_dom2D","addLayer","_onAdd","getNextId","removeDOM3D","removeDOM2D","_Sky","_Sky2","_lodashThrottle","_lodashThrottle2","cubemap","Skybox","light","_light","_settings","turbidity","reileigh","mieCoefficient","mieDirectionalG","luminance","inclination","azimuth","_updateUniforms","_throttledWorldUpdate","_cubeCamera","CubeCamera","cubeTarget","_sky","_skyScene","_sunSphere","SphereBufferGeometry","MeshBasicMaterial","color","skyboxUniforms","skyboxMat","side","BackSide","BoxGeometry","_updateSkybox","settings","theta","sunPosition","intensity","updateCubeMap","ShaderLib","Sky","skyShader","skyUniforms","skyMat","skyGeo","skyMesh","throttle","wait","leading","trailing","debounce","maxWait","cancel","timeoutId","clearTimeout","maxTimeoutId","lastCalled","trailingCall","complete","isCalled","now","delayed","remaining","stamp","setTimeout","flush","maxDelayed","debounced","leadingCall","Date","_ControlsOrbit","_ControlsOrbit2","Orbit","orbit","_vendorOrbitControls","_vendorOrbitControls2","_this","animate","pointDelta","metresDelta","angle","angleDelta","noZoom","addControls","maxPolarAngle","_hammerjs","_hammerjs2","OrbitControls","getAutoRotationAngle","scope","autoRotateSpeed","getZoomScale","zoomSpeed","rotateLeft","thetaDelta","rotateUp","phiDelta","dollyIn","dollyScale","minZoom","maxZoom","zoomChanged","warn","enableZoom","dollyOut","handleMouseDownRotate","rotateStart","handleMouseDownDolly","dollyStart","handleMouseDownPan","panStart","handleMouseMoveRotate","rotateEnd","rotateDelta","subVectors","body","rotateSpeed","handleMouseMoveDolly","dollyEnd","dollyDelta","handleMouseMovePan","panEnd","panDelta","pan","handleMouseUp","handleMouseWheel","wheelDelta","detail","handleKeyDown","keyCode","UP","keyPanSpeed","BOTTOM","LEFT","RIGHT","handleTouchStartRotate","pointers","pageX","pageY","handleTouchStartDolly","handleTouchStartPan","deltaX","deltaY","handleTouchMoveRotate","handleTouchMoveDolly","handleTouchMovePan","handleTouchEnd","onMouseDown","preventDefault","mouseButtons","ORBIT","enableRotate","state","STATE","ROTATE","ZOOM","DOLLY","PAN","enablePan","NONE","onMouseMove","onMouseUp","dispatchEvent","startEvent","endEvent","onMouseWheel","stopPropagation","onKeyDown","enableKeys","onTouchStart","touches","TOUCH_ROTATE","TOUCH_DOLLY","TOUCH_PAN","onTouchMove","onTouchEnd","onContextMenu","minDistance","maxDistance","Infinity","minPolarAngle","minAzimuthAngle","maxAzimuthAngle","enableDamping","dampingFactor","autoRotate","MOUSE","MIDDLE","target0","position0","zoom0","getPolarAngle","getAzimuthalAngle","changeEvent","offset","quat","Quaternion","setFromUnitVectors","up","quatInverse","lastPosition","lastQuaternion","sub","applyQuaternion","EPS","radius","panOffset","lookAt","distanceToSquared","dot","quaternion","panLeft","objectMatrix","te","multiplyScalar","panUp","adjDist","targetDistance","hammer","direction","DIRECTION_ALL","threshold","pointerType","EventDispatcher","center","noRotate","noPan","noKeys","staticMoving","constraint","dynamicDampingFactor","__WEBPACK_AMD_DEFINE_RESULT__","exportName","setTimeoutContext","timeout","bindFn","invokeArrayArg","arg","each","iterator","deprecate","method","name","message","deprecationMessage","stack","inherit","base","properties","childP","baseP","_super","boolOrFn","val","TYPE_FUNCTION","ifUndefined","val1","val2","addEventListeners","types","handler","splitStr","removeEventListeners","hasParent","node","inStr","str","find","trim","split","inArray","src","findByKey","toArray","uniqueArray","sort","results","values","prop","camelProp","toUpperCase","VENDOR_PREFIXES","uniqueId","_uniqueId","getWindowForElement","doc","ownerDocument","defaultView","parentWindow","Input","manager","callback","inputTarget","domHandler","ev","init","createInputInstance","Type","inputClass","SUPPORT_POINTER_EVENTS","PointerEventInput","SUPPORT_ONLY_TOUCH","TouchInput","SUPPORT_TOUCH","TouchMouseInput","MouseInput","inputHandler","eventType","input","pointersLen","changedPointersLen","changedPointers","isFirst","INPUT_START","isFinal","INPUT_END","INPUT_CANCEL","session","computeInputData","recognize","prevInput","pointersLength","firstInput","simpleCloneInputData","firstMultiple","offsetCenter","getCenter","timeStamp","deltaTime","getAngle","getDistance","computeDeltaXY","offsetDirection","getDirection","overallVelocity","getVelocity","overallVelocityX","overallVelocityY","getScale","rotation","getRotation","maxPointers","computeIntervalInputData","srcEvent","offsetDelta","prevDelta","velocity","velocityX","velocityY","last","lastInterval","COMPUTE_INTERVAL","DIRECTION_NONE","DIRECTION_LEFT","DIRECTION_RIGHT","DIRECTION_UP","DIRECTION_DOWN","PROPS_XY","end","PROPS_CLIENT_XY","evEl","MOUSE_ELEMENT_EVENTS","evWin","MOUSE_WINDOW_EVENTS","allow","pressed","POINTER_ELEMENT_EVENTS","POINTER_WINDOW_EVENTS","store","pointerEvents","SingleTouchInput","evTarget","SINGLE_TOUCH_TARGET_EVENTS","SINGLE_TOUCH_WINDOW_EVENTS","started","normalizeSingleTouches","all","changed","changedTouches","concat","TOUCH_TARGET_EVENTS","targetIds","getTouches","allTouches","INPUT_MOVE","identifier","targetTouches","changedTargetTouches","filter","touch","mouse","TouchAction","cleanTouchActions","actions","TOUCH_ACTION_NONE","hasPanX","TOUCH_ACTION_PAN_X","hasPanY","TOUCH_ACTION_PAN_Y","TOUCH_ACTION_MANIPULATION","TOUCH_ACTION_AUTO","Recognizer","STATE_POSSIBLE","simultaneous","requireFail","stateStr","STATE_CANCELLED","STATE_ENDED","STATE_CHANGED","STATE_BEGAN","directionStr","getRecognizerByNameIfManager","otherRecognizer","recognizer","AttrRecognizer","PanRecognizer","pX","pY","PinchRecognizer","PressRecognizer","_timer","_input","RotateRecognizer","SwipeRecognizer","TapRecognizer","pTime","pCenter","count","Hammer","recognizers","preset","Manager","handlers","touchAction","toggleCssProps","item","recognizeWith","requireFailure","cssProps","triggerDomEvent","data","gestureEvent","createEvent","initEvent","gesture","TEST_ELEMENT","nextKey","extend","dest","merge","MOBILE_REGEX","navigator","userAgent","INPUT_TYPE_TOUCH","INPUT_TYPE_PEN","INPUT_TYPE_MOUSE","INPUT_TYPE_KINECT","DIRECTION_HORIZONTAL","DIRECTION_VERTICAL","MOUSE_INPUT_MAP","mousedown","mousemove","mouseup","which","POINTER_INPUT_MAP","pointerdown","pointermove","pointerup","pointercancel","pointerout","IE10_POINTER_TYPE_ENUM",2,3,4,5,"MSPointerEvent","PointerEvent","removePointer","eventTypeNormalized","toLowerCase","isTouch","storeIndex","pointerId","SINGLE_TOUCH_INPUT_MAP","touchstart","touchmove","touchend","touchcancel","TOUCH_INPUT_MAP","inputEvent","inputData","isMouse","PREFIXED_TOUCH_ACTION","NATIVE_TOUCH_ACTION","TOUCH_ACTION_COMPUTE","compute","getTouchAction","preventDefaults","prevented","hasNone","isTapPointer","isTapMovement","isTapTouchTime","preventSrc","STATE_RECOGNIZED","STATE_FAILED","dropRecognizeWith","dropRequireFailure","hasRequireFailures","canRecognizeWith","additionalEvent","tryEmit","canEmit","inputDataClone","process","attrTest","optionPointers","isRecognized","isValid","directionTest","hasMoved","inOut","time","validPointers","validMovement","validTime","taps","interval","posThreshold","validTouchTime","failTimeout","validInterval","validMultiTap","tapCount","VERSION","domEvents","userSelect","touchSelect","touchCallout","contentZooming","userDrag","tapHighlightColor","STOP","FORCED_STOP","force","stopped","curRecognizer","existing","Tap","Pan","Swipe","Pinch","Rotate","Press","freeGlobal","_TileLayer2","_TileLayer3","_ImageTile","_ImageTile2","_ImageTileLayerBaseMaterial","_ImageTileLayerBaseMaterial2","_TileLayer","path","_path","baseMaterial","geom","getRenderTarget","renderOrder","receiveShadow","_baseLayer","_calculateLOD","_onWorldUpdate","_outputTiles","_moveBaseLayer","quadcode","_TileCache","_TileCache2","TileLayer","picking","maxCache","maxLOD","_tileCache","tile","_destroyTile","_tileList","_minLOD","_maxLOD","_tiles","_tilesPicking","addToPicking","getCamera","projScreenMatrix","setFromMatrix","getBounds","intersectsBox","Box3","_this2","_removeTiles","isReady","getMesh","getPickingMesh","_this3","_stop","_updateFrustum","checkList","_checklist","_requestTile","_divide","_tileInFrustum","dist","requestTileAsync","currentItem","getQuadcode","_screenSpaceError","minDepth","maxDepth","quality","getSide","getTile","_createTile","setTile","removeFromPicking","_lruCache","_lruCache2","TileCache","cacheLimit","onDestroyTile","_cache","tileCache","priv","sym","symbols","makeSymbol","naiveLength","LRUCache","lc","stale","maxAge","forEachStep","thisp","hit","isStale","del","doUse","unshiftNode","diff","walker","tail","prev","removeNode","Entry","Map","util","Yallist","hasSymbol","Symbol","mL","allowStale","mA","lC","rforEach","head","next","dump","dumpLru","inspect","opts","extras","as","didFirst","has","unshift","peek","pop","load","arr","expiresAt","prune","env","npm_package_name","npm_lifecycle_script","TEST_PSEUDOMAP","cleanUpNextTick","draining","currentQueue","queue","queueIndex","drainQueue","run","Item","fun","noop","nextTick","title","browser","argv","versions","binding","cwd","chdir","dir","umask","PseudoMap","kv","same","_index","_data","res","entries","global","ctx","seen","stylize","stylizeNoColor","depth","colors","isBoolean","showHidden","_extend","isUndefined","customInspect","stylizeWithColor","formatValue","styleType","styles","arrayToHash","hash","idx","recurseTimes","ret","primitive","formatPrimitive","visibleKeys","getOwnPropertyNames","isError","formatError","isRegExp","RegExp","isDate","braces","toUTCString","formatArray","formatProperty","reduceToSingleString","simple","JSON","stringify","isNumber","isNull","match","line","substr","numLinesEst","reduce","cur","ar","isNullOrUndefined","isSymbol","re","isPrimitive","o","pad","timestamp","getHours","getMinutes","getSeconds","getDate","months","getMonth","formatRegExp","f","_","msg","deprecated","warned","throwDeprecation","traceDeprecation","trace","noDeprecation","debugEnviron","debugs","debuglog","NODE_DEBUG","pid","bold","italic","underline","white","grey","black","blue","cyan","green","magenta","red","yellow","special","number","boolean","null","string","date","regexp","isBuffer","inherits","origin","fill","readUInt8","ctor","superCtor","super_","TempCtor","list","Node","pushNode","shift","forEachReverse","getReverse","mapReverse","initial","acc","reduceReverse","toArrayReverse","from","to","sliceReverse","reverse","_Tile2","_Tile3","_vendorBoxHelper","ImageTile","_Tile","_createMesh","_abortRequest","_image","_center","_side","MeshStandardMaterial","depthWrite","roughness","metalness","envMap","localMesh","getContext","font","fillStyle","fillText","_quadcode","_tile","Texture","LinearMipMapLinearFilter","anisotropy","needsUpdate","transparent","urlParams","url","_getTileURL","image","_texture","_ready","crossOrigin","imageTile","r2d","tileURLRegex","Tile","_layer","_quadcodeToTile","_boundsLatLon","_tileBoundsWGS84","_boundsWorld","_tileBoundsFromWGS84","_boundsToCenter","_centerLatlon","_getSide","_pointScale","_pickingMesh","fromCharCode","random","lastIndex","mask","q","boundsWGS84","sw","ne","_tile2lon","w","_tile2lat","BoxHelper","indices","Uint16Array","positions","Float32Array","BufferGeometry","setIndex","BufferAttribute","addAttribute","LineSegments","LineBasicMaterial","linewidth","box","setFromObject","isEmpty","attributes","computeBoundingSphere","colour","skyboxTarget","fillRect","_GeoJSONTile","_GeoJSONTile2","_onControlsMove","_pauseOutput","_GeoJSONLayer","_reqwest","_reqwest2","_utilGeoJSON","_utilGeoJSON2","_utilBuffer","_enginePickingMaterial","GeoJSONTile","_defaultStyle","defaultStyle","interactive","topojson","onEachFeature","polygonMaterial","onPolygonMesh","onPolygonBufferAttributes","polylineMaterial","onPolylineMesh","onPolylineBufferAttributes","pointGeometry","pointMaterial","onPointMesh","keepFeatures","_request","_geojsonLayer","then","_processTileData","err","_geojson","timeEnd","abort","geoJSONTile","_LayerGroup2","_LayerGroup3","_utilBuffer2","_enginePickingMaterial2","_geometryPolygonLayer","_geometryPolygonLayer2","_geometryPolylineLayer","_geometryPolylineLayer2","_geometryPointLayer","_geometryPointLayer2","_LayerGroup","geojson","THREE","_requestData","_processData","collectFeatures","features","feature","_featureToLayer","polygonAttributes","polygonFlat","polylineAttributes","pointAttributes","getBufferAttributes","isFlat","mergedPolygonAttributes","mergeAttributes","_setPolygonMesh","_polygonMesh","mergedPolylineAttributes","_setPolylineMesh","_polylineMesh","mergedPointAttributes","_setPointMesh","_pointMesh","clearBufferAttributes","clearCoordinates","flat","vertices","normals","colours","pickingIds","computeBoundingBox","Material","vertexColors","VertexColors","blending","envMapIntensity","MeshPhongMaterial","pickingMesh","lineWidth","lineTransparent","lineOpacity","lineBlending","lineRenderOrder","linePadding","coordinates","onMesh","onBufferAttributes","lineMaterial","LayerGroup","layerGroup","__WEBPACK_AMD_DEFINE_FACTORY__","definition","succeed","protocol","protocolRe","exec","location","httpsRe","twoHundo","request","status","response","handleReadyState","success","_aborted","_timedOut","readyState","onreadystatechange","setHeaders","http","headers","defaultHeaders","isAFormData","FormData","requestedWith","contentType","setRequestHeader","setCredentials","withCredentials","generalCallback","lastValue","urlappend","handleJsonp","reqId","uniqid","cbkey","cbval","reqwest","getcallbackPrefix","cbreg","script","isIE10","async","htmlFor","onload","onclick","getRequest","toQueryString","sendWait","xhr","open","xDomainRequest","onerror","onprogress","send","Reqwest","setType","header","resp","_completeHandlers","getResponseHeader","filteredResponse","globalSetupOptions","dataFilter","responseText","parse","eval","responseXML","parseError","errorCode","reason","_responseArgs","_fulfilled","_successHandler","_fulfillmentHandlers","timedOut","t","_erred","_errorHandlers","normalize","serial","el","cb","ch","ra","tagName","optCb","disabled","checked","selectedIndex","selected","eachFormElement","serializeSubtags","tags","fa","byTag","serializeQueryString","serializeArray","serializeHash","buildParams","traditional","rbracket","XHR2","ex","callbackPrefix","xmlHttpRequest","accept","*","xml","html","text","json","js","XMLHttpRequest","XDomainRequest","ActiveXObject","retry","fail","always","catch","serialize","opt","nodeType","trad","enc","encodeURIComponent","compat","ajaxSetup","_topojson2","_topojson3","_geojsonMerge","_geojsonMerge2","_earcut","_earcut2","_extrudePolygon","_extrudePolygon2","GeoJSON","NormalBlending","lineColor","_topojson","collections","tk","gk","lineStringAttributes","nextCoord","_coords","_colours","coordinate","g","multiLineStringAttributes","coord","earcutData","_toEarcut","faces","_triangulate","holes","dimensions","groupedVertices","_colour","extruded","topColor","multiply","bottomColor","_vertices","_faces","face","fi","allFlat","sides","dim","holeIndex","contour","absolute","x0","y0","kx","ky","translate","relative","x1","y1","bisect","lo","hi","mid","topology","geometries","feature$1","arc","points","arcs","absolute$$","ring","polygon","geometryType","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","stitchArcs","ends","p0","dp","fragmentByEnd","fragmentByStart","stitchedArcs","fragments","emptyIndex","fg","gf","meshArcs","geomsByArc","geoms","triangle","area","mergeArcs","register","ring$$","polygonsByArc","polygons","exterior","components","component","neighbors","sgn","indexesByArc","ij","ik","compareArea","minAreaHeap","down","heap","removed","presimplify","triangleArea","relative$$","triangles","maxArea","previous","inputs","memo","gj","GeometryCollection","Feature","FeatureCollection","earcut","holeIndices","hasHoles","outerLen","outerNode","linkedList","minX","minY","maxX","maxY","eliminateHoles","earcutLinked","clockwise","sum","insertNode","filterPoints","again","steiner","equals","ear","indexCurve","isEarHashed","isEar","cureLocalIntersections","splitEarcut","pointInTriangle","minTX","minTY","maxTX","maxTY","minZ","zOrder","maxZ","nextZ","prevZ","locallyInside","isValidDiagonal","splitPolygon","getLeftmost","compareX","eliminateHole","hole","findHoleBridge","hx","hy","qx","tanMin","sortLinked","numMerges","pSize","qSize","inSize","leftmost","ax","ay","bx","by","cx","cy","px","py","intersectsPolygon","middleInside","q1","q2","inside","b2","an","bp","extrudePolygon","cells","topCells","full","sideCells","closed","bottomCells","Buffer","lengths","_attributes","mergedAttributes","lastLengths","createLineGeometry","lines","verticesCount","_pickingId","az","c1","createGeometry","facesCount","pA","pB","pC","ab","bz","c2","cz","c3","cross","nx","ny","nz","_PickingShader","_PickingShader2","PickingMaterial","setPointSize","setPointScale","PickingShader","_earcut3","_utilExtrudePolygon","_utilExtrudePolygon2","_coordinates","isSingle","_setCoordinates","_setPickingId","_addPickingEvents","_setBufferAttributes","_setMesh","_bufferAttributes","getPickingId","point2d","point3d","_projectedCoordinates","_flat","pickingId","_toAttributes","_bounds","_convertCoordinates","_projectedBounds","_projectCoordinates","_offset","lineHeight","_normals","pointColor","pointHeight","Geometry","geometryWidth","geometryHeight","_geometry","fromGeometry","normal","_GeoJSONTileLayer2","_GeoJSONTileLayer3","_GeoJSONTileLayer","_GeoJSONLayer2","_GeoJSONLayer3","_Transformation","_Transformation2","_wrapNum","_wrapNum2","_GeoJSON","_GeoJSON2","_Buffer","_Buffer2"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,EAAAG,QAAA,SAAAA,QAAA,UACA,kBAAAC,SAAAA,OAAAC,IACAD,QAAA,QAAA,SAAAJ,GACA,gBAAAC,SACAA,QAAA,KAAAD,EAAAG,QAAA,SAAAA,QAAA,UAEAJ,EAAA,KAAAC,EAAAD,EAAA,MAAAA,EAAA,QACCO,KAAA,SAAAC,+BAAAC,gCACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAV,OAGA,IAAAC,GAAAU,EAAAD,IACAV,WACAY,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAb,EAAAD,QAAAC,EAAAA,EAAAD,QAAAS,GAGAR,EAAAY,QAAA,EAGAZ,EAAAD,QAvBA,GAAAW,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAASR,EAAQD,EAASS,GAM/B,QAASS,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,UAAWF,GAJzFG,OAAOC,eAAevB,EAAS,cAC7BwB,OAAO,GAKT,IAAIC,GAAShB,EE9Da,GFgEtBiB,EAAUR,EAAuBO,GAEjCE,EAAiBlB,EEjED,IFmEhBmB,EAAkBV,EAAuBS,GAEzCE,EAAcpB,EEnEQ,IFqEtBqB,EAAeZ,EAAuBW,GAEtCE,EAAoCtB,EEtEQ,IFwE5CuB,EAAqCd,EAAuBa,GAE5DE,EAA2BxB,EEzEa,IF2ExCyB,EAA4BhB,EAAuBe,GAEnDE,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B,KAAM,IAAKtP,MAAO,IACrCqyB,aAAiB/iB,KAAM,KAAMtP,MAAO,GAAImd,GAAA,WAAMgJ,UAI/CoF,cAEC,+BAEA,gBAEC,4DACA,sCAEA,4EAED,KAECC,KAAM,MAERC,gBAEC,gCACA,4BACA,+BAEA,qCACA,iCACA,sCACA,mCACA,qCACA,yCACA,wCAEA,2BACA,2BACA,0BACA,gCACA,iCAEA,0CACA,2EACA,iEAEA,qDACA,8EACM,gDACN,oEAEA,yDACA,oDAEA,eACA,qCACA,4CACA,uBAEA,4CACA,4CACA,wCACA,uCAEA,2BACA,mGACA,uDAEA,uBACA,qCACA,+BAGA,kCACA,IACC,wIACD,IAGA,8FACA,4BACA,IACC,oCAED,IAEA,sCACA,MACC,yDACD,2DACA,sDACA,IAEA,8CACA,IACC,iCACA,uEACD,IAEA,yCACA,IACC,kGACD,IAEA,2CACA,IACC,sFACD,IAEA,gCACA,OACA,8DACA,OAEA,2DACA,kBACA,kBACA,kBACA,kBACA,kBACA,kBACA,oBAEA,iCACA,IACG,kDACH,IAGA,eACA,IACC,wEAEA,kGAEC,0DAED,+DAEA,8CAEA,oDAEA,+CACA,2BAGA,2DAEA,sBACA,gEAEA,oBACA,8DACA,sFACA,oHACA,+GAIA,iCACA,8CAEA,mBACA,6EAEA,kDACA,oCAEA,qDACA,oCAGA,gGACA,yJAEA,aACA,0DACA,0EACA,kFACA,kEACA,wDACA,6BAEA,8BACA,0CACA,4FACA,sDACA,wCAGA,oDAEA,+BACA,qBACA,0CAEA,+BACA,2CACA,0HAEA,uCAEA,0EACA,gCAEA,4DAGA,+BAEA,wBACD,KAECD,KAAM;CAIT,IAAIiH,GAAM,WAET,GAAIC,GAAYvV,EAAA,WAAMqV,UAAgB,IAClCG,EAAcxV,EAAA,WAAM2O,cAAcpT,MAAOga,EAAUtS,UAEnDwS,EAAS,GAAIzV,GAAA,WAAM0O,gBACtBJ,eAAgBiH,EAAUjH,eAC1BF,aAAcmH,EAAUnH,aACxBnL,SAA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AxF,OAAAuG,eARErD,EAAaoB,WAAA,cAAAvF,MAAAS,KAAAT,KAQT8qD,EAAU3iD,G1FkzkBjB,MAdA/C,G0F5ykBGjB,EAAagmD,GAAbhmD,G1F2zkBFokE,EAAe,WAElB5oE,GAAQ,W0FjzkBMwE,CAEf,IAAI8I,GAAQ,SAAS69C,EAAU3iD,GAC7B,MAAO,IAAIhE,GAAc2mD,EAAU3iD,G1FqzkBpCxI,G0FjzkBgByE,cAAT6I,G1FqzkBF,SAASrN,EAAQD,EAASS,GAM/B,QAASS,GAAuBC,GAAO,MAAOA,IAAOA,EAAIC,WAAaD,GAAQE,UAAWF,GAJzFG,OAAOC,eAAevB,EAAS,cAC7BwB,OAAO,GAOT,IAAIqnE,GAAkBpoE,E2Fn1kBI,I3Fq1kBtBqoE,EAAmB5nE,EAAuB2nE,GAE1CE,EAAWtoE,E2Ft1kBI,I3Fw1kBfuoE,EAAY9nE,EAAuB6nE,GAEnCnQ,EAAkBn4D,E2Fz1kBI,I3F21kBtBo4D,EAAmB33D,EAAuB03D,GAE1CqQ,EAAWxoE,E2F51kBI,I3F81kBfyoE,EAAYhoE,EAAuB+nE,GAEnCE,EAAU1oE,E2F/1kBI,I3Fi2kBd2oE,EAAWloE,EAAuBioE,G2F/1kBjC/jE,IAENA,GAAKgW,eAAc0tD,EAAA,WACnB1jE,EAAKgV,QAAO4uD,EAAA,WACZ5jE,EAAK6+D,eAAcpL,EAAA,WACnBzzD,EAAK0zD,QAAOoQ,EAAA,WACZ9jE,EAAKo/D,OAAM4E,EAAA,W3Fm2kBVppE,EAAQ,W2Fj2kBMoF,E3Fk2kBdnF,EAAOD,QAAUA,EAAQ","file":"vizicities.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"proj4\"), require(\"THREE\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"proj4\", \"THREE\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VIZI\"] = factory(require(\"proj4\"), require(\"THREE\"));\n\telse\n\t\troot[\"VIZI\"] = factory(root[\"proj4\"], root[\"THREE\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_22__, __WEBPACK_EXTERNAL_MODULE_24__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"proj4\"), require(\"THREE\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"proj4\", \"THREE\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"VIZI\"] = factory(require(\"proj4\"), require(\"THREE\"));\n\telse\n\t\troot[\"VIZI\"] = factory(root[\"proj4\"], root[\"THREE\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_22__, __WEBPACK_EXTERNAL_MODULE_24__) {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _World = __webpack_require__(1);\n\t\n\tvar _World2 = _interopRequireDefault(_World);\n\t\n\tvar _controlsIndex = __webpack_require__(51);\n\t\n\tvar _controlsIndex2 = _interopRequireDefault(_controlsIndex);\n\t\n\tvar _layerLayer = __webpack_require__(46);\n\t\n\tvar _layerLayer2 = _interopRequireDefault(_layerLayer);\n\t\n\tvar _layerEnvironmentEnvironmentLayer = __webpack_require__(45);\n\t\n\tvar _layerEnvironmentEnvironmentLayer2 = _interopRequireDefault(_layerEnvironmentEnvironmentLayer);\n\t\n\tvar _layerTileImageTileLayer = __webpack_require__(55);\n\t\n\tvar _layerTileImageTileLayer2 = _interopRequireDefault(_layerTileImageTileLayer);\n\t\n\tvar _layerTileGeoJSONTileLayer = __webpack_require__(70);\n\t\n\tvar _layerTileGeoJSONTileLayer2 = _interopRequireDefault(_layerTileGeoJSONTileLayer);\n\t\n\tvar _layerTileTopoJSONTileLayer = __webpack_require__(88);\n\t\n\tvar _layerTileTopoJSONTileLayer2 = _interopRequireDefault(_layerTileTopoJSONTileLayer);\n\t\n\tvar _layerGeoJSONLayer = __webpack_require__(72);\n\t\n\tvar _layerGeoJSONLayer2 = _interopRequireDefault(_layerGeoJSONLayer);\n\t\n\tvar _layerTopoJSONLayer = __webpack_require__(89);\n\t\n\tvar _layerTopoJSONLayer2 = _interopRequireDefault(_layerTopoJSONLayer);\n\t\n\tvar _layerGeometryPolygonLayer = __webpack_require__(85);\n\t\n\tvar _layerGeometryPolygonLayer2 = _interopRequireDefault(_layerGeometryPolygonLayer);\n\t\n\tvar _layerGeometryPolylineLayer = __webpack_require__(86);\n\t\n\tvar _layerGeometryPolylineLayer2 = _interopRequireDefault(_layerGeometryPolylineLayer);\n\t\n\tvar _layerGeometryPointLayer = __webpack_require__(87);\n\t\n\tvar _layerGeometryPointLayer2 = _interopRequireDefault(_layerGeometryPointLayer);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _geoPoint2 = _interopRequireDefault(_geoPoint);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoLatLon2 = _interopRequireDefault(_geoLatLon);\n\t\n\tvar _utilIndex = __webpack_require__(90);\n\t\n\tvar _utilIndex2 = _interopRequireDefault(_utilIndex);\n\t\n\tvar VIZI = {\n\t version: '0.3',\n\t\n\t // Public API\n\t World: _World2['default'],\n\t world: _World.world,\n\t Controls: _controlsIndex2['default'],\n\t Layer: _layerLayer2['default'],\n\t layer: _layerLayer.layer,\n\t EnvironmentLayer: _layerEnvironmentEnvironmentLayer2['default'],\n\t environmentLayer: _layerEnvironmentEnvironmentLayer.environmentLayer,\n\t ImageTileLayer: _layerTileImageTileLayer2['default'],\n\t imageTileLayer: _layerTileImageTileLayer.imageTileLayer,\n\t GeoJSONTileLayer: _layerTileGeoJSONTileLayer2['default'],\n\t geoJSONTileLayer: _layerTileGeoJSONTileLayer.geoJSONTileLayer,\n\t TopoJSONTileLayer: _layerTileTopoJSONTileLayer2['default'],\n\t topoJSONTileLayer: _layerTileTopoJSONTileLayer.topoJSONTileLayer,\n\t GeoJSONLayer: _layerGeoJSONLayer2['default'],\n\t geoJSONLayer: _layerGeoJSONLayer.geoJSONLayer,\n\t TopoJSONLayer: _layerTopoJSONLayer2['default'],\n\t topoJSONLayer: _layerTopoJSONLayer.topoJSONLayer,\n\t PolygonLayer: _layerGeometryPolygonLayer2['default'],\n\t polygonLayer: _layerGeometryPolygonLayer.polygonLayer,\n\t PolylineLayer: _layerGeometryPolylineLayer2['default'],\n\t polylineLayer: _layerGeometryPolylineLayer.polylineLayer,\n\t PointLayer: _layerGeometryPointLayer2['default'],\n\t pointLayer: _layerGeometryPointLayer.pointLayer,\n\t Point: _geoPoint2['default'],\n\t point: _geoPoint.point,\n\t LatLon: _geoLatLon2['default'],\n\t latLon: _geoLatLon.latLon,\n\t Util: _utilIndex2['default']\n\t};\n\t\n\texports['default'] = VIZI;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 1 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _geoCrsIndex = __webpack_require__(6);\n\t\n\tvar _geoCrsIndex2 = _interopRequireDefault(_geoCrsIndex);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _engineEngine = __webpack_require__(23);\n\t\n\tvar _engineEngine2 = _interopRequireDefault(_engineEngine);\n\t\n\tvar _layerEnvironmentEnvironmentLayer = __webpack_require__(45);\n\t\n\tvar _layerEnvironmentEnvironmentLayer2 = _interopRequireDefault(_layerEnvironmentEnvironmentLayer);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// Pretty much any event someone using ViziCities would need will be emitted or\n\t// proxied by World (eg. render events, etc)\n\t\n\tvar World = (function (_EventEmitter) {\n\t _inherits(World, _EventEmitter);\n\t\n\t function World(domId, options) {\n\t _classCallCheck(this, World);\n\t\n\t _get(Object.getPrototypeOf(World.prototype), 'constructor', this).call(this);\n\t\n\t var defaults = {\n\t crs: _geoCrsIndex2['default'].EPSG3857,\n\t skybox: false,\n\t postProcessing: false\n\t };\n\t\n\t this.options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t this._layers = [];\n\t this._controls = [];\n\t\n\t this._initContainer(domId);\n\t this._initEngine();\n\t this._initEnvironment();\n\t this._initEvents();\n\t\n\t this._pause = false;\n\t\n\t // Kick off the update and render loop\n\t this._update();\n\t }\n\t\n\t _createClass(World, [{\n\t key: '_initContainer',\n\t value: function _initContainer(domId) {\n\t this._container = document.getElementById(domId);\n\t }\n\t }, {\n\t key: '_initEngine',\n\t value: function _initEngine() {\n\t this._engine = new _engineEngine2['default'](this._container, this);\n\t\n\t // Engine events\n\t //\n\t // Consider proxying these through events on World for public access\n\t // this._engine.on('preRender', () => {});\n\t // this._engine.on('postRender', () => {});\n\t }\n\t }, {\n\t key: '_initEnvironment',\n\t value: function _initEnvironment() {\n\t // Not sure if I want to keep this as a private API\n\t //\n\t // Makes sense to allow others to customise their environment so perhaps\n\t // add some method of disable / overriding the environment settings\n\t this._environment = new _layerEnvironmentEnvironmentLayer2['default']({\n\t skybox: this.options.skybox\n\t }).addTo(this);\n\t }\n\t }, {\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t this.on('controlsMoveEnd', this._onControlsMoveEnd);\n\t }\n\t }, {\n\t key: '_onControlsMoveEnd',\n\t value: function _onControlsMoveEnd(point) {\n\t var _point = (0, _geoPoint.point)(point.x, point.z);\n\t this._resetView(this.pointToLatLon(_point), _point);\n\t }\n\t\n\t // Reset world view\n\t }, {\n\t key: '_resetView',\n\t value: function _resetView(latlon, point) {\n\t this.emit('preResetView');\n\t\n\t this._moveStart();\n\t this._move(latlon, point);\n\t this._moveEnd();\n\t\n\t this.emit('postResetView');\n\t }\n\t }, {\n\t key: '_moveStart',\n\t value: function _moveStart() {\n\t this.emit('moveStart');\n\t }\n\t }, {\n\t key: '_move',\n\t value: function _move(latlon, point) {\n\t this._lastPosition = latlon;\n\t this.emit('move', latlon, point);\n\t }\n\t }, {\n\t key: '_moveEnd',\n\t value: function _moveEnd() {\n\t this.emit('moveEnd');\n\t }\n\t }, {\n\t key: '_update',\n\t value: function _update() {\n\t if (this._pause) {\n\t return;\n\t }\n\t\n\t var delta = this._engine.clock.getDelta();\n\t\n\t // Once _update is called it will run forever, for now\n\t window.requestAnimationFrame(this._update.bind(this));\n\t\n\t // Update controls\n\t this._controls.forEach(function (controls) {\n\t controls.update();\n\t });\n\t\n\t this.emit('preUpdate', delta);\n\t this._engine.update(delta);\n\t this.emit('postUpdate', delta);\n\t }\n\t\n\t // Set world view\n\t }, {\n\t key: 'setView',\n\t value: function setView(latlon) {\n\t // Store initial geographic coordinate for the [0,0,0] world position\n\t //\n\t // The origin point doesn't move in three.js / 3D space so only set it once\n\t // here instead of every time _resetView is called\n\t //\n\t // If it was updated every time then coorindates would shift over time and\n\t // would be out of place / context with previously-placed points (0,0 would\n\t // refer to a different point each time)\n\t this._originLatlon = latlon;\n\t this._originPoint = this.project(latlon);\n\t\n\t this._resetView(latlon);\n\t return this;\n\t }\n\t\n\t // Return world geographic position\n\t }, {\n\t key: 'getPosition',\n\t value: function getPosition() {\n\t return this._lastPosition;\n\t }\n\t\n\t // Transform geographic coordinate to world point\n\t //\n\t // This doesn't take into account the origin offset\n\t //\n\t // For example, this takes a geographic coordinate and returns a point\n\t // relative to the origin point of the projection (not the world)\n\t }, {\n\t key: 'project',\n\t value: function project(latlon) {\n\t return this.options.crs.latLonToPoint((0, _geoLatLon.latLon)(latlon));\n\t }\n\t\n\t // Transform world point to geographic coordinate\n\t //\n\t // This doesn't take into account the origin offset\n\t //\n\t // For example, this takes a point relative to the origin point of the\n\t // projection (not the world) and returns a geographic coordinate\n\t }, {\n\t key: 'unproject',\n\t value: function unproject(point) {\n\t return this.options.crs.pointToLatLon((0, _geoPoint.point)(point));\n\t }\n\t\n\t // Takes into account the origin offset\n\t //\n\t // For example, this takes a geographic coordinate and returns a point\n\t // relative to the three.js / 3D origin (0,0)\n\t }, {\n\t key: 'latLonToPoint',\n\t value: function latLonToPoint(latlon) {\n\t var projectedPoint = this.project((0, _geoLatLon.latLon)(latlon));\n\t return projectedPoint._subtract(this._originPoint);\n\t }\n\t\n\t // Takes into account the origin offset\n\t //\n\t // For example, this takes a point relative to the three.js / 3D origin (0,0)\n\t // and returns the exact geographic coordinate at that point\n\t }, {\n\t key: 'pointToLatLon',\n\t value: function pointToLatLon(point) {\n\t var projectedPoint = (0, _geoPoint.point)(point).add(this._originPoint);\n\t return this.unproject(projectedPoint);\n\t }\n\t\n\t // Return pointscale for a given geographic coordinate\n\t }, {\n\t key: 'pointScale',\n\t value: function pointScale(latlon, accurate) {\n\t return this.options.crs.pointScale(latlon, accurate);\n\t }\n\t\n\t // Convert from real meters to world units\n\t //\n\t // TODO: Would be nice not to have to pass in a pointscale here\n\t }, {\n\t key: 'metresToWorld',\n\t value: function metresToWorld(metres, pointScale, zoom) {\n\t return this.options.crs.metresToWorld(metres, pointScale, zoom);\n\t }\n\t\n\t // Convert from real meters to world units\n\t //\n\t // TODO: Would be nice not to have to pass in a pointscale here\n\t }, {\n\t key: 'worldToMetres',\n\t value: function worldToMetres(worldUnits, pointScale, zoom) {\n\t return this.options.crs.worldToMetres(worldUnits, pointScale, zoom);\n\t }\n\t\n\t // Unsure if it's a good idea to expose this here for components like\n\t // GridLayer to use (eg. to keep track of a frustum)\n\t }, {\n\t key: 'getCamera',\n\t value: function getCamera() {\n\t return this._engine._camera;\n\t }\n\t }, {\n\t key: 'addLayer',\n\t value: function addLayer(layer) {\n\t layer._addToWorld(this);\n\t\n\t this._layers.push(layer);\n\t\n\t if (layer.isOutput() && layer.isOutputToScene()) {\n\t // Could move this into Layer but it'll do here for now\n\t this._engine._scene.add(layer._object3D);\n\t this._engine._domScene3D.add(layer._domObject3D);\n\t this._engine._domScene2D.add(layer._domObject2D);\n\t }\n\t\n\t this.emit('layerAdded', layer);\n\t return this;\n\t }\n\t\n\t // Remove layer from world and scene but don't destroy it entirely\n\t }, {\n\t key: 'removeLayer',\n\t value: function removeLayer(layer) {\n\t var layerIndex = this._layers.indexOf(layer);\n\t\n\t if (layerIndex > -1) {\n\t // Remove from this._layers\n\t this._layers.splice(layerIndex, 1);\n\t };\n\t\n\t if (layer.isOutput() && layer.isOutputToScene()) {\n\t this._engine._scene.remove(layer._object3D);\n\t this._engine._domScene3D.remove(layer._domObject3D);\n\t this._engine._domScene2D.remove(layer._domObject2D);\n\t }\n\t\n\t this.emit('layerRemoved');\n\t return this;\n\t }\n\t }, {\n\t key: 'addControls',\n\t value: function addControls(controls) {\n\t controls._addToWorld(this);\n\t\n\t this._controls.push(controls);\n\t\n\t this.emit('controlsAdded', controls);\n\t return this;\n\t }\n\t\n\t // Remove controls from world but don't destroy them entirely\n\t }, {\n\t key: 'removeControls',\n\t value: function removeControls(controls) {\n\t var controlsIndex = this._controls.indexOf(controlsIndex);\n\t\n\t if (controlsIndex > -1) {\n\t this._controls.splice(controlsIndex, 1);\n\t };\n\t\n\t this.emit('controlsRemoved', controls);\n\t return this;\n\t }\n\t }, {\n\t key: 'stop',\n\t value: function stop() {\n\t this._pause = true;\n\t }\n\t }, {\n\t key: 'start',\n\t value: function start() {\n\t this._pause = false;\n\t this._update();\n\t }\n\t\n\t // Destroys the world(!) and removes it from the scene and memory\n\t //\n\t // TODO: World out why so much three.js stuff is left in the heap after this\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this.stop();\n\t\n\t // Remove listeners\n\t this.off('controlsMoveEnd', this._onControlsMoveEnd);\n\t\n\t var i;\n\t\n\t // Remove all controls\n\t var controls;\n\t for (i = this._controls.length - 1; i >= 0; i--) {\n\t controls = this._controls[0];\n\t this.removeControls(controls);\n\t controls.destroy();\n\t };\n\t\n\t // Remove all layers\n\t var layer;\n\t for (i = this._layers.length - 1; i >= 0; i--) {\n\t layer = this._layers[0];\n\t this.removeLayer(layer);\n\t layer.destroy();\n\t };\n\t\n\t // Environment layer is removed with the other layers\n\t this._environment = null;\n\t\n\t this._engine.destroy();\n\t this._engine = null;\n\t\n\t // TODO: Probably should clean the container too / remove the canvas\n\t this._container = null;\n\t }\n\t }]);\n\t\n\t return World;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = World;\n\t\n\tvar noNew = function noNew(domId, options) {\n\t return new World(domId, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.world = noNew;\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\t//\n\t// We store our EE objects in a plain object whose properties are event names.\n\t// If `Object.create(null)` is not supported we prefix the event names with a\n\t// `~` to make sure that the built-in object properties are not overridden or\n\t// used as an attack vector.\n\t// We also assume that `Object.create(null)` is available when the event name\n\t// is an ES6 Symbol.\n\t//\n\tvar prefix = typeof Object.create !== 'function' ? '~' : false;\n\t\n\t/**\n\t * Representation of a single EventEmitter function.\n\t *\n\t * @param {Function} fn Event handler to be called.\n\t * @param {Mixed} context Context for function execution.\n\t * @param {Boolean} once Only emit once\n\t * @api private\n\t */\n\tfunction EE(fn, context, once) {\n\t this.fn = fn;\n\t this.context = context;\n\t this.once = once || false;\n\t}\n\t\n\t/**\n\t * Minimal EventEmitter interface that is molded against the Node.js\n\t * EventEmitter interface.\n\t *\n\t * @constructor\n\t * @api public\n\t */\n\tfunction EventEmitter() { /* Nothing to set */ }\n\t\n\t/**\n\t * Holds the assigned EventEmitters by name.\n\t *\n\t * @type {Object}\n\t * @private\n\t */\n\tEventEmitter.prototype._events = undefined;\n\t\n\t/**\n\t * Return a list of assigned event listeners.\n\t *\n\t * @param {String} event The events that should be listed.\n\t * @param {Boolean} exists We only need to know if there are listeners.\n\t * @returns {Array|Boolean}\n\t * @api public\n\t */\n\tEventEmitter.prototype.listeners = function listeners(event, exists) {\n\t var evt = prefix ? prefix + event : event\n\t , available = this._events && this._events[evt];\n\t\n\t if (exists) return !!available;\n\t if (!available) return [];\n\t if (available.fn) return [available.fn];\n\t\n\t for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n\t ee[i] = available[i].fn;\n\t }\n\t\n\t return ee;\n\t};\n\t\n\t/**\n\t * Emit an event to all registered event listeners.\n\t *\n\t * @param {String} event The name of the event.\n\t * @returns {Boolean} Indication if we've emitted an event.\n\t * @api public\n\t */\n\tEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n\t var evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events || !this._events[evt]) return false;\n\t\n\t var listeners = this._events[evt]\n\t , len = arguments.length\n\t , args\n\t , i;\n\t\n\t if ('function' === typeof listeners.fn) {\n\t if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\t\n\t switch (len) {\n\t case 1: return listeners.fn.call(listeners.context), true;\n\t case 2: return listeners.fn.call(listeners.context, a1), true;\n\t case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n\t case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n\t case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n\t case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n\t }\n\t\n\t for (i = 1, args = new Array(len -1); i < len; i++) {\n\t args[i - 1] = arguments[i];\n\t }\n\t\n\t listeners.fn.apply(listeners.context, args);\n\t } else {\n\t var length = listeners.length\n\t , j;\n\t\n\t for (i = 0; i < length; i++) {\n\t if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\t\n\t switch (len) {\n\t case 1: listeners[i].fn.call(listeners[i].context); break;\n\t case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n\t case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n\t default:\n\t if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n\t args[j - 1] = arguments[j];\n\t }\n\t\n\t listeners[i].fn.apply(listeners[i].context, args);\n\t }\n\t }\n\t }\n\t\n\t return true;\n\t};\n\t\n\t/**\n\t * Register a new EventListener for the given event.\n\t *\n\t * @param {String} event Name of the event.\n\t * @param {Functon} fn Callback function.\n\t * @param {Mixed} context The context of the function.\n\t * @api public\n\t */\n\tEventEmitter.prototype.on = function on(event, fn, context) {\n\t var listener = new EE(fn, context || this)\n\t , evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events) this._events = prefix ? {} : Object.create(null);\n\t if (!this._events[evt]) this._events[evt] = listener;\n\t else {\n\t if (!this._events[evt].fn) this._events[evt].push(listener);\n\t else this._events[evt] = [\n\t this._events[evt], listener\n\t ];\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Add an EventListener that's only called once.\n\t *\n\t * @param {String} event Name of the event.\n\t * @param {Function} fn Callback function.\n\t * @param {Mixed} context The context of the function.\n\t * @api public\n\t */\n\tEventEmitter.prototype.once = function once(event, fn, context) {\n\t var listener = new EE(fn, context || this, true)\n\t , evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events) this._events = prefix ? {} : Object.create(null);\n\t if (!this._events[evt]) this._events[evt] = listener;\n\t else {\n\t if (!this._events[evt].fn) this._events[evt].push(listener);\n\t else this._events[evt] = [\n\t this._events[evt], listener\n\t ];\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Remove event listeners.\n\t *\n\t * @param {String} event The event we want to remove.\n\t * @param {Function} fn The listener that we need to find.\n\t * @param {Mixed} context Only remove listeners matching this context.\n\t * @param {Boolean} once Only remove once listeners.\n\t * @api public\n\t */\n\tEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n\t var evt = prefix ? prefix + event : event;\n\t\n\t if (!this._events || !this._events[evt]) return this;\n\t\n\t var listeners = this._events[evt]\n\t , events = [];\n\t\n\t if (fn) {\n\t if (listeners.fn) {\n\t if (\n\t listeners.fn !== fn\n\t || (once && !listeners.once)\n\t || (context && listeners.context !== context)\n\t ) {\n\t events.push(listeners);\n\t }\n\t } else {\n\t for (var i = 0, length = listeners.length; i < length; i++) {\n\t if (\n\t listeners[i].fn !== fn\n\t || (once && !listeners[i].once)\n\t || (context && listeners[i].context !== context)\n\t ) {\n\t events.push(listeners[i]);\n\t }\n\t }\n\t }\n\t }\n\t\n\t //\n\t // Reset the array, or remove it completely if we have no more listeners.\n\t //\n\t if (events.length) {\n\t this._events[evt] = events.length === 1 ? events[0] : events;\n\t } else {\n\t delete this._events[evt];\n\t }\n\t\n\t return this;\n\t};\n\t\n\t/**\n\t * Remove all listeners or only the listeners for the specified event.\n\t *\n\t * @param {String} event The event want to remove all listeners for.\n\t * @api public\n\t */\n\tEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n\t if (!this._events) return this;\n\t\n\t if (event) delete this._events[prefix ? prefix + event : event];\n\t else this._events = prefix ? {} : Object.create(null);\n\t\n\t return this;\n\t};\n\t\n\t//\n\t// Alias methods names because people roll like that.\n\t//\n\tEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\tEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\t\n\t//\n\t// This function doesn't apply anymore.\n\t//\n\tEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n\t return this;\n\t};\n\t\n\t//\n\t// Expose the prefix.\n\t//\n\tEventEmitter.prefixed = prefix;\n\t\n\t//\n\t// Expose the module.\n\t//\n\tif (true) {\n\t module.exports = EventEmitter;\n\t}\n\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * lodash 4.0.2 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\tvar keys = __webpack_require__(4),\n\t rest = __webpack_require__(5);\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]';\n\t\n\t/** Used to detect unsigned integer values. */\n\tvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\t\n\t/**\n\t * Checks if `value` is a valid array-like index.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n\t * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n\t */\n\tfunction isIndex(value, length) {\n\t value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n\t length = length == null ? MAX_SAFE_INTEGER : length;\n\t return value > -1 && value % 1 == 0 && value < length;\n\t}\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/**\n\t * Assigns `value` to `key` of `object` if the existing value is not equivalent\n\t * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n\t * for equality comparisons.\n\t *\n\t * @private\n\t * @param {Object} object The object to modify.\n\t * @param {string} key The key of the property to assign.\n\t * @param {*} value The value to assign.\n\t */\n\tfunction assignValue(object, key, value) {\n\t var objValue = object[key];\n\t if ((!eq(objValue, value) ||\n\t (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) ||\n\t (value === undefined && !(key in object))) {\n\t object[key] = value;\n\t }\n\t}\n\t\n\t/**\n\t * The base implementation of `_.property` without support for deep paths.\n\t *\n\t * @private\n\t * @param {string} key The key of the property to get.\n\t * @returns {Function} Returns the new function.\n\t */\n\tfunction baseProperty(key) {\n\t return function(object) {\n\t return object == null ? undefined : object[key];\n\t };\n\t}\n\t\n\t/**\n\t * Copies properties of `source` to `object`.\n\t *\n\t * @private\n\t * @param {Object} source The object to copy properties from.\n\t * @param {Array} props The property names to copy.\n\t * @param {Object} [object={}] The object to copy properties to.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction copyObject(source, props, object) {\n\t return copyObjectWith(source, props, object);\n\t}\n\t\n\t/**\n\t * This function is like `copyObject` except that it accepts a function to\n\t * customize copied values.\n\t *\n\t * @private\n\t * @param {Object} source The object to copy properties from.\n\t * @param {Array} props The property names to copy.\n\t * @param {Object} [object={}] The object to copy properties to.\n\t * @param {Function} [customizer] The function to customize copied values.\n\t * @returns {Object} Returns `object`.\n\t */\n\tfunction copyObjectWith(source, props, object, customizer) {\n\t object || (object = {});\n\t\n\t var index = -1,\n\t length = props.length;\n\t\n\t while (++index < length) {\n\t var key = props[index],\n\t newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key];\n\t\n\t assignValue(object, key, newValue);\n\t }\n\t return object;\n\t}\n\t\n\t/**\n\t * Creates a function like `_.assign`.\n\t *\n\t * @private\n\t * @param {Function} assigner The function to assign values.\n\t * @returns {Function} Returns the new assigner function.\n\t */\n\tfunction createAssigner(assigner) {\n\t return rest(function(object, sources) {\n\t var index = -1,\n\t length = sources.length,\n\t customizer = length > 1 ? sources[length - 1] : undefined,\n\t guard = length > 2 ? sources[2] : undefined;\n\t\n\t customizer = typeof customizer == 'function' ? (length--, customizer) : undefined;\n\t if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n\t customizer = length < 3 ? undefined : customizer;\n\t length = 1;\n\t }\n\t object = Object(object);\n\t while (++index < length) {\n\t var source = sources[index];\n\t if (source) {\n\t assigner(object, source, index, customizer);\n\t }\n\t }\n\t return object;\n\t });\n\t}\n\t\n\t/**\n\t * Gets the \"length\" property value of `object`.\n\t *\n\t * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n\t * that affects Safari on at least iOS 8.1-8.3 ARM64.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {*} Returns the \"length\" value.\n\t */\n\tvar getLength = baseProperty('length');\n\t\n\t/**\n\t * Checks if the provided arguments are from an iteratee call.\n\t *\n\t * @private\n\t * @param {*} value The potential iteratee value argument.\n\t * @param {*} index The potential iteratee index or key argument.\n\t * @param {*} object The potential iteratee object argument.\n\t * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n\t */\n\tfunction isIterateeCall(value, index, object) {\n\t if (!isObject(object)) {\n\t return false;\n\t }\n\t var type = typeof index;\n\t if (type == 'number'\n\t ? (isArrayLike(object) && isIndex(index, object.length))\n\t : (type == 'string' && index in object)) {\n\t return eq(object[index], value);\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n\t * comparison between two values to determine if they are equivalent.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to compare.\n\t * @param {*} other The other value to compare.\n\t * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n\t * @example\n\t *\n\t * var object = { 'user': 'fred' };\n\t * var other = { 'user': 'fred' };\n\t *\n\t * _.eq(object, object);\n\t * // => true\n\t *\n\t * _.eq(object, other);\n\t * // => false\n\t *\n\t * _.eq('a', 'a');\n\t * // => true\n\t *\n\t * _.eq('a', Object('a'));\n\t * // => false\n\t *\n\t * _.eq(NaN, NaN);\n\t * // => true\n\t */\n\tfunction eq(value, other) {\n\t return value === other || (value !== value && other !== other);\n\t}\n\t\n\t/**\n\t * Checks if `value` is array-like. A value is considered array-like if it's\n\t * not a function and has a `value.length` that's an integer greater than or\n\t * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n\t * @example\n\t *\n\t * _.isArrayLike([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArrayLike(document.body.children);\n\t * // => true\n\t *\n\t * _.isArrayLike('abc');\n\t * // => true\n\t *\n\t * _.isArrayLike(_.noop);\n\t * // => false\n\t */\n\tfunction isArrayLike(value) {\n\t return value != null &&\n\t !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is a valid array-like length.\n\t *\n\t * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n\t * @example\n\t *\n\t * _.isLength(3);\n\t * // => true\n\t *\n\t * _.isLength(Number.MIN_VALUE);\n\t * // => false\n\t *\n\t * _.isLength(Infinity);\n\t * // => false\n\t *\n\t * _.isLength('3');\n\t * // => false\n\t */\n\tfunction isLength(value) {\n\t return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Assigns own enumerable properties of source objects to the destination\n\t * object. Source objects are applied from left to right. Subsequent sources\n\t * overwrite property assignments of previous sources.\n\t *\n\t * **Note:** This method mutates `object` and is loosely based on\n\t * [`Object.assign`](https://mdn.io/Object/assign).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The destination object.\n\t * @param {...Object} [sources] The source objects.\n\t * @returns {Object} Returns `object`.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.c = 3;\n\t * }\n\t *\n\t * function Bar() {\n\t * this.e = 5;\n\t * }\n\t *\n\t * Foo.prototype.d = 4;\n\t * Bar.prototype.f = 6;\n\t *\n\t * _.assign({ 'a': 1 }, new Foo, new Bar);\n\t * // => { 'a': 1, 'c': 3, 'e': 5 }\n\t */\n\tvar assign = createAssigner(function(object, source) {\n\t copyObject(source, keys(source), object);\n\t});\n\t\n\tmodule.exports = assign;\n\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\t/**\n\t * lodash 4.0.2 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar MAX_SAFE_INTEGER = 9007199254740991;\n\t\n\t/** `Object#toString` result references. */\n\tvar argsTag = '[object Arguments]',\n\t funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]',\n\t stringTag = '[object String]';\n\t\n\t/** Used to detect unsigned integer values. */\n\tvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\t\n\t/**\n\t * The base implementation of `_.times` without support for iteratee shorthands\n\t * or max array length checks.\n\t *\n\t * @private\n\t * @param {number} n The number of times to invoke `iteratee`.\n\t * @param {Function} iteratee The function invoked per iteration.\n\t * @returns {Array} Returns the array of results.\n\t */\n\tfunction baseTimes(n, iteratee) {\n\t var index = -1,\n\t result = Array(n);\n\t\n\t while (++index < n) {\n\t result[index] = iteratee(index);\n\t }\n\t return result;\n\t}\n\t\n\t/**\n\t * Checks if `value` is a valid array-like index.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n\t * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n\t */\n\tfunction isIndex(value, length) {\n\t value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n\t length = length == null ? MAX_SAFE_INTEGER : length;\n\t return value > -1 && value % 1 == 0 && value < length;\n\t}\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/** Used to check objects for own properties. */\n\tvar hasOwnProperty = objectProto.hasOwnProperty;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/** Built-in value references. */\n\tvar getPrototypeOf = Object.getPrototypeOf,\n\t propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\t\n\t/* Built-in method references for those with the same name as other `lodash` methods. */\n\tvar nativeKeys = Object.keys;\n\t\n\t/**\n\t * The base implementation of `_.has` without support for deep paths.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @param {Array|string} key The key to check.\n\t * @returns {boolean} Returns `true` if `key` exists, else `false`.\n\t */\n\tfunction baseHas(object, key) {\n\t // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,\n\t // that are composed entirely of index properties, return `false` for\n\t // `hasOwnProperty` checks of them.\n\t return hasOwnProperty.call(object, key) ||\n\t (typeof object == 'object' && key in object && getPrototypeOf(object) === null);\n\t}\n\t\n\t/**\n\t * The base implementation of `_.keys` which doesn't skip the constructor\n\t * property of prototypes or treat sparse arrays as dense.\n\t *\n\t * @private\n\t * @type Function\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t */\n\tfunction baseKeys(object) {\n\t return nativeKeys(Object(object));\n\t}\n\t\n\t/**\n\t * The base implementation of `_.property` without support for deep paths.\n\t *\n\t * @private\n\t * @param {string} key The key of the property to get.\n\t * @returns {Function} Returns the new function.\n\t */\n\tfunction baseProperty(key) {\n\t return function(object) {\n\t return object == null ? undefined : object[key];\n\t };\n\t}\n\t\n\t/**\n\t * Gets the \"length\" property value of `object`.\n\t *\n\t * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n\t * that affects Safari on at least iOS 8.1-8.3 ARM64.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {*} Returns the \"length\" value.\n\t */\n\tvar getLength = baseProperty('length');\n\t\n\t/**\n\t * Creates an array of index keys for `object` values of arrays,\n\t * `arguments` objects, and strings, otherwise `null` is returned.\n\t *\n\t * @private\n\t * @param {Object} object The object to query.\n\t * @returns {Array|null} Returns index keys, else `null`.\n\t */\n\tfunction indexKeys(object) {\n\t var length = object ? object.length : undefined;\n\t if (isLength(length) &&\n\t (isArray(object) || isString(object) || isArguments(object))) {\n\t return baseTimes(length, String);\n\t }\n\t return null;\n\t}\n\t\n\t/**\n\t * Checks if `value` is likely a prototype object.\n\t *\n\t * @private\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n\t */\n\tfunction isPrototype(value) {\n\t var Ctor = value && value.constructor,\n\t proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\t\n\t return value === proto;\n\t}\n\t\n\t/**\n\t * Checks if `value` is likely an `arguments` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArguments(function() { return arguments; }());\n\t * // => true\n\t *\n\t * _.isArguments([1, 2, 3]);\n\t * // => false\n\t */\n\tfunction isArguments(value) {\n\t // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\n\t return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n\t (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as an `Array` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isArray([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArray(document.body.children);\n\t * // => false\n\t *\n\t * _.isArray('abc');\n\t * // => false\n\t *\n\t * _.isArray(_.noop);\n\t * // => false\n\t */\n\tvar isArray = Array.isArray;\n\t\n\t/**\n\t * Checks if `value` is array-like. A value is considered array-like if it's\n\t * not a function and has a `value.length` that's an integer greater than or\n\t * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n\t * @example\n\t *\n\t * _.isArrayLike([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArrayLike(document.body.children);\n\t * // => true\n\t *\n\t * _.isArrayLike('abc');\n\t * // => true\n\t *\n\t * _.isArrayLike(_.noop);\n\t * // => false\n\t */\n\tfunction isArrayLike(value) {\n\t return value != null &&\n\t !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n\t}\n\t\n\t/**\n\t * This method is like `_.isArrayLike` except that it also checks if `value`\n\t * is an object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.\n\t * @example\n\t *\n\t * _.isArrayLikeObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isArrayLikeObject(document.body.children);\n\t * // => true\n\t *\n\t * _.isArrayLikeObject('abc');\n\t * // => false\n\t *\n\t * _.isArrayLikeObject(_.noop);\n\t * // => false\n\t */\n\tfunction isArrayLikeObject(value) {\n\t return isObjectLike(value) && isArrayLike(value);\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is a valid array-like length.\n\t *\n\t * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n\t * @example\n\t *\n\t * _.isLength(3);\n\t * // => true\n\t *\n\t * _.isLength(Number.MIN_VALUE);\n\t * // => false\n\t *\n\t * _.isLength(Infinity);\n\t * // => false\n\t *\n\t * _.isLength('3');\n\t * // => false\n\t */\n\tfunction isLength(value) {\n\t return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Checks if `value` is object-like. A value is object-like if it's not `null`\n\t * and has a `typeof` result of \"object\".\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n\t * @example\n\t *\n\t * _.isObjectLike({});\n\t * // => true\n\t *\n\t * _.isObjectLike([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObjectLike(_.noop);\n\t * // => false\n\t *\n\t * _.isObjectLike(null);\n\t * // => false\n\t */\n\tfunction isObjectLike(value) {\n\t return !!value && typeof value == 'object';\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `String` primitive or object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isString('abc');\n\t * // => true\n\t *\n\t * _.isString(1);\n\t * // => false\n\t */\n\tfunction isString(value) {\n\t return typeof value == 'string' ||\n\t (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);\n\t}\n\t\n\t/**\n\t * Creates an array of the own enumerable property names of `object`.\n\t *\n\t * **Note:** Non-object values are coerced to objects. See the\n\t * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n\t * for more details.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Object\n\t * @param {Object} object The object to query.\n\t * @returns {Array} Returns the array of property names.\n\t * @example\n\t *\n\t * function Foo() {\n\t * this.a = 1;\n\t * this.b = 2;\n\t * }\n\t *\n\t * Foo.prototype.c = 3;\n\t *\n\t * _.keys(new Foo);\n\t * // => ['a', 'b'] (iteration order is not guaranteed)\n\t *\n\t * _.keys('hi');\n\t * // => ['0', '1']\n\t */\n\tfunction keys(object) {\n\t var isProto = isPrototype(object);\n\t if (!(isProto || isArrayLike(object))) {\n\t return baseKeys(object);\n\t }\n\t var indexes = indexKeys(object),\n\t skipIndexes = !!indexes,\n\t result = indexes || [],\n\t length = result.length;\n\t\n\t for (var key in object) {\n\t if (baseHas(object, key) &&\n\t !(skipIndexes && (key == 'length' || isIndex(key, length))) &&\n\t !(isProto && key == 'constructor')) {\n\t result.push(key);\n\t }\n\t }\n\t return result;\n\t}\n\t\n\tmodule.exports = keys;\n\n\n/***/ },\n/* 5 */\n/***/ function(module, exports) {\n\n\t/**\n\t * lodash 4.0.1 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\t\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar INFINITY = 1 / 0,\n\t MAX_INTEGER = 1.7976931348623157e+308,\n\t NAN = 0 / 0;\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]';\n\t\n\t/** Used to match leading and trailing whitespace. */\n\tvar reTrim = /^\\s+|\\s+$/g;\n\t\n\t/** Used to detect bad signed hexadecimal string values. */\n\tvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\t\n\t/** Used to detect binary string values. */\n\tvar reIsBinary = /^0b[01]+$/i;\n\t\n\t/** Used to detect octal string values. */\n\tvar reIsOctal = /^0o[0-7]+$/i;\n\t\n\t/** Built-in method references without a dependency on `root`. */\n\tvar freeParseInt = parseInt;\n\t\n\t/**\n\t * A faster alternative to `Function#apply`, this function invokes `func`\n\t * with the `this` binding of `thisArg` and the arguments of `args`.\n\t *\n\t * @private\n\t * @param {Function} func The function to invoke.\n\t * @param {*} thisArg The `this` binding of `func`.\n\t * @param {...*} args The arguments to invoke `func` with.\n\t * @returns {*} Returns the result of `func`.\n\t */\n\tfunction apply(func, thisArg, args) {\n\t var length = args.length;\n\t switch (length) {\n\t case 0: return func.call(thisArg);\n\t case 1: return func.call(thisArg, args[0]);\n\t case 2: return func.call(thisArg, args[0], args[1]);\n\t case 3: return func.call(thisArg, args[0], args[1], args[2]);\n\t }\n\t return func.apply(thisArg, args);\n\t}\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/* Built-in method references for those with the same name as other `lodash` methods. */\n\tvar nativeMax = Math.max;\n\t\n\t/**\n\t * Creates a function that invokes `func` with the `this` binding of the\n\t * created function and arguments from `start` and beyond provided as an array.\n\t *\n\t * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to apply a rest parameter to.\n\t * @param {number} [start=func.length-1] The start position of the rest parameter.\n\t * @returns {Function} Returns the new function.\n\t * @example\n\t *\n\t * var say = _.rest(function(what, names) {\n\t * return what + ' ' + _.initial(names).join(', ') +\n\t * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n\t * });\n\t *\n\t * say('hello', 'fred', 'barney', 'pebbles');\n\t * // => 'hello fred, barney, & pebbles'\n\t */\n\tfunction rest(func, start) {\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);\n\t return function() {\n\t var args = arguments,\n\t index = -1,\n\t length = nativeMax(args.length - start, 0),\n\t array = Array(length);\n\t\n\t while (++index < length) {\n\t array[index] = args[start + index];\n\t }\n\t switch (start) {\n\t case 0: return func.call(this, array);\n\t case 1: return func.call(this, args[0], array);\n\t case 2: return func.call(this, args[0], args[1], array);\n\t }\n\t var otherArgs = Array(start + 1);\n\t index = -1;\n\t while (++index < start) {\n\t otherArgs[index] = args[index];\n\t }\n\t otherArgs[start] = array;\n\t return apply(func, this, otherArgs);\n\t };\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Converts `value` to an integer.\n\t *\n\t * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to convert.\n\t * @returns {number} Returns the converted integer.\n\t * @example\n\t *\n\t * _.toInteger(3);\n\t * // => 3\n\t *\n\t * _.toInteger(Number.MIN_VALUE);\n\t * // => 0\n\t *\n\t * _.toInteger(Infinity);\n\t * // => 1.7976931348623157e+308\n\t *\n\t * _.toInteger('3');\n\t * // => 3\n\t */\n\tfunction toInteger(value) {\n\t if (!value) {\n\t return value === 0 ? value : 0;\n\t }\n\t value = toNumber(value);\n\t if (value === INFINITY || value === -INFINITY) {\n\t var sign = (value < 0 ? -1 : 1);\n\t return sign * MAX_INTEGER;\n\t }\n\t var remainder = value % 1;\n\t return value === value ? (remainder ? value - remainder : value) : 0;\n\t}\n\t\n\t/**\n\t * Converts `value` to a number.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to process.\n\t * @returns {number} Returns the number.\n\t * @example\n\t *\n\t * _.toNumber(3);\n\t * // => 3\n\t *\n\t * _.toNumber(Number.MIN_VALUE);\n\t * // => 5e-324\n\t *\n\t * _.toNumber(Infinity);\n\t * // => Infinity\n\t *\n\t * _.toNumber('3');\n\t * // => 3\n\t */\n\tfunction toNumber(value) {\n\t if (isObject(value)) {\n\t var other = isFunction(value.valueOf) ? value.valueOf() : value;\n\t value = isObject(other) ? (other + '') : other;\n\t }\n\t if (typeof value != 'string') {\n\t return value === 0 ? value : +value;\n\t }\n\t value = value.replace(reTrim, '');\n\t var isBinary = reIsBinary.test(value);\n\t return (isBinary || reIsOctal.test(value))\n\t ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n\t : (reIsBadHex.test(value) ? NAN : +value);\n\t}\n\t\n\tmodule.exports = rest;\n\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _CRSEPSG3857 = __webpack_require__(7);\n\t\n\tvar _CRSEPSG38572 = _interopRequireDefault(_CRSEPSG3857);\n\t\n\tvar _CRSEPSG3395 = __webpack_require__(15);\n\t\n\tvar _CRSEPSG33952 = _interopRequireDefault(_CRSEPSG3395);\n\t\n\tvar _CRSEPSG4326 = __webpack_require__(17);\n\t\n\tvar _CRSEPSG43262 = _interopRequireDefault(_CRSEPSG4326);\n\t\n\tvar _CRSSimple = __webpack_require__(19);\n\t\n\tvar _CRSSimple2 = _interopRequireDefault(_CRSSimple);\n\t\n\tvar _CRSProj4 = __webpack_require__(20);\n\t\n\tvar _CRSProj42 = _interopRequireDefault(_CRSProj4);\n\t\n\tvar CRS = {};\n\t\n\tCRS.EPSG3857 = _CRSEPSG38572['default'];\n\tCRS.EPSG900913 = _CRSEPSG3857.EPSG900913;\n\tCRS.EPSG3395 = _CRSEPSG33952['default'];\n\tCRS.EPSG4326 = _CRSEPSG43262['default'];\n\tCRS.Simple = _CRSSimple2['default'];\n\tCRS.Proj4 = _CRSProj42['default'];\n\t\n\texports['default'] = CRS;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 7 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.EPSG3857 (WGS 84 / Pseudo-Mercator) CRS implementation.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3857.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionSphericalMercator = __webpack_require__(13);\n\t\n\tvar _projectionProjectionSphericalMercator2 = _interopRequireDefault(_projectionProjectionSphericalMercator);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _EPSG3857 = {\n\t code: 'EPSG:3857',\n\t projection: _projectionProjectionSphericalMercator2['default'],\n\t\n\t // Work out how to de-dupe this (scoping issue)\n\t transformScale: 1 / (Math.PI * _projectionProjectionSphericalMercator2['default'].R),\n\t\n\t // Scale and transformation inputs changed to account for central origin in\n\t // WebGL, instead of top-left origin used in Leaflet\n\t transformation: (function () {\n\t // TODO: Cannot use this.transformScale due to scope\n\t var scale = 1 / (Math.PI * _projectionProjectionSphericalMercator2['default'].R);\n\t\n\t return new _utilTransformation2['default'](scale, 0, -scale, 0);\n\t })()\n\t};\n\t\n\tvar EPSG3857 = (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _EPSG3857);\n\t\n\tvar EPSG900913 = (0, _lodashAssign2['default'])({}, EPSG3857, {\n\t code: 'EPSG:900913'\n\t});\n\t\n\texports.EPSG900913 = EPSG900913;\n\texports['default'] = EPSG3857;\n\n/***/ },\n/* 8 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.Earth is the base class for all CRS representing Earth.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Earth.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRS = __webpack_require__(9);\n\t\n\tvar _CRS2 = _interopRequireDefault(_CRS);\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar Earth = {\n\t wrapLon: [-180, 180],\n\t\n\t R: 6378137,\n\t\n\t // Distance between two geographical points using spherical law of cosines\n\t // approximation or Haversine\n\t //\n\t // See: http://www.movable-type.co.uk/scripts/latlong.html\n\t distance: function distance(latlon1, latlon2, accurate) {\n\t var rad = Math.PI / 180;\n\t\n\t var lat1;\n\t var lat2;\n\t\n\t var a;\n\t\n\t if (!accurate) {\n\t lat1 = latlon1.lat * rad;\n\t lat2 = latlon2.lat * rad;\n\t\n\t a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((latlon2.lon - latlon1.lon) * rad);\n\t\n\t return this.R * Math.acos(Math.min(a, 1));\n\t } else {\n\t lat1 = latlon1.lat * rad;\n\t lat2 = latlon2.lat * rad;\n\t\n\t var lon1 = latlon1.lon * rad;\n\t var lon2 = latlon2.lon * rad;\n\t\n\t var deltaLat = lat2 - lat1;\n\t var deltaLon = lon2 - lon1;\n\t\n\t var halfDeltaLat = deltaLat / 2;\n\t var halfDeltaLon = deltaLon / 2;\n\t\n\t a = Math.sin(halfDeltaLat) * Math.sin(halfDeltaLat) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(halfDeltaLon) * Math.sin(halfDeltaLon);\n\t\n\t var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\t\n\t return this.R * c;\n\t }\n\t },\n\t\n\t // Scale factor for converting between real metres and projected metres\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t //\n\t // Defaults to a scale factor of 1 if no calculation method exists\n\t //\n\t // Probably need to run this through the CRS transformation or similar so the\n\t // resulting scale is relative to the dimensions of the world space\n\t // Eg. 1 metre in projected space is likly scaled up or down to some other\n\t // number\n\t pointScale: function pointScale(latlon, accurate) {\n\t return this.projection.pointScale ? this.projection.pointScale(latlon, accurate) : [1, 1];\n\t },\n\t\n\t // Convert real metres to projected units\n\t //\n\t // Latitude scale is chosen because it fluctuates more than longitude\n\t metresToProjected: function metresToProjected(metres, pointScale) {\n\t return metres * pointScale[1];\n\t },\n\t\n\t // Convert projected units to real metres\n\t //\n\t // Latitude scale is chosen because it fluctuates more than longitude\n\t projectedToMetres: function projectedToMetres(projectedUnits, pointScale) {\n\t return projectedUnits / pointScale[1];\n\t },\n\t\n\t // Convert real metres to a value in world (WebGL) units\n\t metresToWorld: function metresToWorld(metres, pointScale, zoom) {\n\t // Transform metres to projected metres using the latitude point scale\n\t //\n\t // Latitude scale is chosen because it fluctuates more than longitude\n\t var projectedMetres = this.metresToProjected(metres, pointScale);\n\t\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t // Scale projected metres\n\t var scaledMetres = scale * (this.transformScale * projectedMetres);\n\t\n\t // Not entirely sure why this is neccessary\n\t if (zoom) {\n\t scaledMetres /= pointScale[1];\n\t }\n\t\n\t return scaledMetres;\n\t },\n\t\n\t // Convert world (WebGL) units to a value in real metres\n\t worldToMetres: function worldToMetres(worldUnits, pointScale, zoom) {\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t var projectedUnits = worldUnits / scale / this.transformScale;\n\t var realMetres = this.projectedToMetres(projectedUnits, pointScale);\n\t\n\t // Not entirely sure why this is neccessary\n\t if (zoom) {\n\t realMetres *= pointScale[1];\n\t }\n\t\n\t return realMetres;\n\t }\n\t};\n\t\n\texports['default'] = (0, _lodashAssign2['default'])({}, _CRS2['default'], Earth);\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 9 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS is the base object for all defined CRS (Coordinate Reference Systems)\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar _utilWrapNum = __webpack_require__(12);\n\t\n\tvar _utilWrapNum2 = _interopRequireDefault(_utilWrapNum);\n\t\n\tvar CRS = {\n\t // Scale factor determines final dimensions of world space\n\t //\n\t // Projection transformation in range -1 to 1 is multiplied by scale factor to\n\t // find final world coordinates\n\t //\n\t // Scale factor can be considered as half the amount of the desired dimension\n\t // for the largest side when transformation is equal to 1 or -1, or as the\n\t // distance between 0 and 1 on the largest side\n\t //\n\t // For example, if you want the world dimensions to be between -1000 and 1000\n\t // then the scale factor will be 1000\n\t scaleFactor: 1000000,\n\t\n\t // Converts geo coords to pixel / WebGL ones\n\t latLonToPoint: function latLonToPoint(latlon, zoom) {\n\t var projectedPoint = this.projection.project(latlon);\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t return this.transformation._transform(projectedPoint, scale);\n\t },\n\t\n\t // Converts pixel / WebGL coords to geo coords\n\t pointToLatLon: function pointToLatLon(point, zoom) {\n\t var scale = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t scale /= 2;\n\t }\n\t\n\t var untransformedPoint = this.transformation.untransform(point, scale);\n\t\n\t return this.projection.unproject(untransformedPoint);\n\t },\n\t\n\t // Converts geo coords to projection-specific coords (e.g. in meters)\n\t project: function project(latlon) {\n\t return this.projection.project(latlon);\n\t },\n\t\n\t // Converts projected coords to geo coords\n\t unproject: function unproject(point) {\n\t return this.projection.unproject(point);\n\t },\n\t\n\t // If zoom is provided, returns the map width in pixels for a given zoom\n\t // Else, provides fixed scale value\n\t scale: function scale(zoom) {\n\t // If zoom is provided then return scale based on map tile zoom\n\t if (zoom >= 0) {\n\t return 256 * Math.pow(2, zoom);\n\t // Else, return fixed scale value to expand projected coordinates from\n\t // their 0 to 1 range into something more practical\n\t } else {\n\t return this.scaleFactor;\n\t }\n\t },\n\t\n\t // Returns zoom level for a given scale value\n\t // This only works with a scale value that is based on map pixel width\n\t zoom: function zoom(scale) {\n\t return Math.log(scale / 256) / Math.LN2;\n\t },\n\t\n\t // Returns the bounds of the world in projected coords if applicable\n\t getProjectedBounds: function getProjectedBounds(zoom) {\n\t if (this.infinite) {\n\t return null;\n\t }\n\t\n\t var b = this.projection.bounds;\n\t var s = this.scale(zoom);\n\t\n\t // Half scale if using zoom as WebGL origin is in the centre, not top left\n\t if (zoom) {\n\t s /= 2;\n\t }\n\t\n\t // Bottom left\n\t var min = this.transformation.transform((0, _Point.point)(b[0]), s);\n\t\n\t // Top right\n\t var max = this.transformation.transform((0, _Point.point)(b[1]), s);\n\t\n\t return [min, max];\n\t },\n\t\n\t // Whether a coordinate axis wraps in a given range (e.g. longitude from -180 to 180); depends on CRS\n\t // wrapLon: [min, max],\n\t // wrapLat: [min, max],\n\t\n\t // If true, the coordinate space will be unbounded (infinite in all directions)\n\t // infinite: false,\n\t\n\t // Wraps geo coords in certain ranges if applicable\n\t wrapLatLon: function wrapLatLon(latlon) {\n\t var lat = this.wrapLat ? (0, _utilWrapNum2['default'])(latlon.lat, this.wrapLat, true) : latlon.lat;\n\t var lon = this.wrapLon ? (0, _utilWrapNum2['default'])(latlon.lon, this.wrapLon, true) : latlon.lon;\n\t var alt = latlon.alt;\n\t\n\t return (0, _LatLon.latLon)(lat, lon, alt);\n\t }\n\t};\n\t\n\texports['default'] = CRS;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 10 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\t/*\n\t * LatLon is a helper class for ensuring consistent geographic coordinates.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/LatLng.js\n\t */\n\t\n\tvar LatLon = (function () {\n\t function LatLon(lat, lon, alt) {\n\t _classCallCheck(this, LatLon);\n\t\n\t if (isNaN(lat) || isNaN(lon)) {\n\t throw new Error('Invalid LatLon object: (' + lat + ', ' + lon + ')');\n\t }\n\t\n\t this.lat = +lat;\n\t this.lon = +lon;\n\t\n\t if (alt !== undefined) {\n\t this.alt = +alt;\n\t }\n\t }\n\t\n\t _createClass(LatLon, [{\n\t key: 'clone',\n\t value: function clone() {\n\t return new LatLon(this.lat, this.lon, this.alt);\n\t }\n\t }]);\n\t\n\t return LatLon;\n\t})();\n\t\n\texports['default'] = LatLon;\n\t\n\t// Accepts (LatLon), ([lat, lon, alt]), ([lat, lon]) and (lat, lon, alt)\n\t// Also converts between lng and lon\n\tvar noNew = function noNew(a, b, c) {\n\t if (a instanceof LatLon) {\n\t return a;\n\t }\n\t if (Array.isArray(a) && typeof a[0] !== 'object') {\n\t if (a.length === 3) {\n\t return new LatLon(a[0], a[1], a[2]);\n\t }\n\t if (a.length === 2) {\n\t return new LatLon(a[0], a[1]);\n\t }\n\t return null;\n\t }\n\t if (a === undefined || a === null) {\n\t return a;\n\t }\n\t if (typeof a === 'object' && 'lat' in a) {\n\t return new LatLon(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\n\t }\n\t if (b === undefined) {\n\t return null;\n\t }\n\t return new LatLon(a, b, c);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.latLon = noNew;\n\n/***/ },\n/* 11 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\t\n\t/*\n\t * Point is a helper class for ensuring consistent world positions.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/Point.js\n\t */\n\t\n\tvar Point = (function () {\n\t function Point(x, y, round) {\n\t _classCallCheck(this, Point);\n\t\n\t this.x = round ? Math.round(x) : x;\n\t this.y = round ? Math.round(y) : y;\n\t }\n\t\n\t _createClass(Point, [{\n\t key: \"clone\",\n\t value: function clone() {\n\t return new Point(this.x, this.y);\n\t }\n\t\n\t // Non-destructive\n\t }, {\n\t key: \"add\",\n\t value: function add(point) {\n\t return this.clone()._add(_point(point));\n\t }\n\t\n\t // Destructive\n\t }, {\n\t key: \"_add\",\n\t value: function _add(point) {\n\t this.x += point.x;\n\t this.y += point.y;\n\t return this;\n\t }\n\t\n\t // Non-destructive\n\t }, {\n\t key: \"subtract\",\n\t value: function subtract(point) {\n\t return this.clone()._subtract(_point(point));\n\t }\n\t\n\t // Destructive\n\t }, {\n\t key: \"_subtract\",\n\t value: function _subtract(point) {\n\t this.x -= point.x;\n\t this.y -= point.y;\n\t return this;\n\t }\n\t }]);\n\t\n\t return Point;\n\t})();\n\t\n\texports[\"default\"] = Point;\n\t\n\t// Accepts (point), ([x, y]) and (x, y, round)\n\tvar _point = function _point(x, y, round) {\n\t if (x instanceof Point) {\n\t return x;\n\t }\n\t if (Array.isArray(x)) {\n\t return new Point(x[0], x[1]);\n\t }\n\t if (x === undefined || x === null) {\n\t return x;\n\t }\n\t return new Point(x, y, round);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.point = _point;\n\n/***/ },\n/* 12 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t/*\n\t * Wrap the given number to lie within a certain range (eg. longitude)\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/core/Util.js\n\t */\n\t\n\tvar wrapNum = function wrapNum(x, range, includeMax) {\n\t var max = range[1];\n\t var min = range[0];\n\t var d = max - min;\n\t return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\n\t};\n\t\n\texports[\"default\"] = wrapNum;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 13 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t/*\n\t * Spherical Mercator is the most popular map projection, used by EPSG:3857 CRS\n\t * used by default.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.SphericalMercator.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar SphericalMercator = {\n\t // Radius / WGS84 semi-major axis\n\t R: 6378137,\n\t MAX_LATITUDE: 85.0511287798,\n\t\n\t // WGS84 eccentricity\n\t ECC: 0.081819191,\n\t ECC2: 0.081819191 * 0.081819191,\n\t\n\t project: function project(latlon) {\n\t var d = Math.PI / 180;\n\t var max = this.MAX_LATITUDE;\n\t var lat = Math.max(Math.min(max, latlon.lat), -max);\n\t var sin = Math.sin(lat * d);\n\t\n\t return (0, _Point.point)(this.R * latlon.lon * d, this.R * Math.log((1 + sin) / (1 - sin)) / 2);\n\t },\n\t\n\t unproject: function unproject(point) {\n\t var d = 180 / Math.PI;\n\t\n\t return (0, _LatLon.latLon)((2 * Math.atan(Math.exp(point.y / this.R)) - Math.PI / 2) * d, point.x * d / this.R);\n\t },\n\t\n\t // Scale factor for converting between real metres and projected metres\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t //\n\t // Accurate scale factor uses proper Web Mercator scaling\n\t // See pg.9: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n\t // See: http://jsfiddle.net/robhawkes/yws924cf/\n\t pointScale: function pointScale(latlon, accurate) {\n\t var rad = Math.PI / 180;\n\t\n\t var k;\n\t\n\t if (!accurate) {\n\t k = 1 / Math.cos(latlon.lat * rad);\n\t\n\t // [scaleX, scaleY]\n\t return [k, k];\n\t } else {\n\t var lat = latlon.lat * rad;\n\t var lon = latlon.lon * rad;\n\t\n\t var a = this.R;\n\t\n\t var sinLat = Math.sin(lat);\n\t var sinLat2 = sinLat * sinLat;\n\t\n\t var cosLat = Math.cos(lat);\n\t\n\t // Radius meridian\n\t var p = a * (1 - this.ECC2) / Math.pow(1 - this.ECC2 * sinLat2, 3 / 2);\n\t\n\t // Radius prime meridian\n\t var v = a / Math.sqrt(1 - this.ECC2 * sinLat2);\n\t\n\t // Scale N/S\n\t var h = a / p / cosLat;\n\t\n\t // Scale E/W\n\t k = a / v / cosLat;\n\t\n\t // [scaleX, scaleY]\n\t return [k, h];\n\t }\n\t },\n\t\n\t // Not using this.R due to scoping\n\t bounds: (function () {\n\t var d = 6378137 * Math.PI;\n\t return [[-d, -d], [d, d]];\n\t })()\n\t};\n\t\n\texports['default'] = SphericalMercator;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 14 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\t/*\n\t * Transformation is an utility class to perform simple point transformations\n\t * through a 2d-matrix.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geometry/Transformation.js\n\t */\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar Transformation = (function () {\n\t function Transformation(a, b, c, d) {\n\t _classCallCheck(this, Transformation);\n\t\n\t this._a = a;\n\t this._b = b;\n\t this._c = c;\n\t this._d = d;\n\t }\n\t\n\t _createClass(Transformation, [{\n\t key: 'transform',\n\t value: function transform(point, scale) {\n\t // Copy input point as to not destroy the original data\n\t return this._transform(point.clone(), scale);\n\t }\n\t\n\t // Destructive transform (faster)\n\t }, {\n\t key: '_transform',\n\t value: function _transform(point, scale) {\n\t scale = scale || 1;\n\t\n\t point.x = scale * (this._a * point.x + this._b);\n\t point.y = scale * (this._c * point.y + this._d);\n\t return point;\n\t }\n\t }, {\n\t key: 'untransform',\n\t value: function untransform(point, scale) {\n\t scale = scale || 1;\n\t return (0, _geoPoint.point)((point.x / scale - this._b) / this._a, (point.y / scale - this._d) / this._c);\n\t }\n\t }]);\n\t\n\t return Transformation;\n\t})();\n\t\n\texports['default'] = Transformation;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 15 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.EPSG3395 (WGS 84 / World Mercator) CRS implementation.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3395.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionMercator = __webpack_require__(16);\n\t\n\tvar _projectionProjectionMercator2 = _interopRequireDefault(_projectionProjectionMercator);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _EPSG3395 = {\n\t code: 'EPSG:3395',\n\t projection: _projectionProjectionMercator2['default'],\n\t\n\t // Work out how to de-dupe this (scoping issue)\n\t transformScale: 1 / (Math.PI * _projectionProjectionMercator2['default'].R),\n\t\n\t // Scale and transformation inputs changed to account for central origin in\n\t // WebGL, instead of top-left origin used in Leaflet\n\t transformation: (function () {\n\t // TODO: Cannot use this.transformScale due to scope\n\t var scale = 1 / (Math.PI * _projectionProjectionMercator2['default'].R);\n\t\n\t return new _utilTransformation2['default'](scale, 0, -scale, 0);\n\t })()\n\t};\n\t\n\tvar EPSG3395 = (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _EPSG3395);\n\t\n\texports['default'] = EPSG3395;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t/*\n\t * Mercator projection that takes into account that the Earth is not a perfect\n\t * sphere. Less popular than spherical mercator; used by projections like\n\t * EPSG:3395.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.Mercator.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar Mercator = {\n\t // Radius / WGS84 semi-major axis\n\t R: 6378137,\n\t R_MINOR: 6356752.314245179,\n\t\n\t // WGS84 eccentricity\n\t ECC: 0.081819191,\n\t ECC2: 0.081819191 * 0.081819191,\n\t\n\t project: function project(latlon) {\n\t var d = Math.PI / 180;\n\t var r = this.R;\n\t var y = latlon.lat * d;\n\t var tmp = this.R_MINOR / r;\n\t var e = Math.sqrt(1 - tmp * tmp);\n\t var con = e * Math.sin(y);\n\t\n\t var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);\n\t y = -r * Math.log(Math.max(ts, 1E-10));\n\t\n\t return (0, _Point.point)(latlon.lon * d * r, y);\n\t },\n\t\n\t unproject: function unproject(point) {\n\t var d = 180 / Math.PI;\n\t var r = this.R;\n\t var tmp = this.R_MINOR / r;\n\t var e = Math.sqrt(1 - tmp * tmp);\n\t var ts = Math.exp(-point.y / r);\n\t var phi = Math.PI / 2 - 2 * Math.atan(ts);\n\t\n\t for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {\n\t con = e * Math.sin(phi);\n\t con = Math.pow((1 - con) / (1 + con), e / 2);\n\t dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;\n\t phi += dphi;\n\t }\n\t\n\t return (0, _LatLon.latLon)(phi * d, point.x * d / r);\n\t },\n\t\n\t // Scale factor for converting between real metres and projected metres\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t //\n\t // See pg.8: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n\t pointScale: function pointScale(latlon) {\n\t var rad = Math.PI / 180;\n\t var lat = latlon.lat * rad;\n\t var sinLat = Math.sin(lat);\n\t var sinLat2 = sinLat * sinLat;\n\t var cosLat = Math.cos(lat);\n\t\n\t var k = Math.sqrt(1 - this.ECC2 * sinLat2) / cosLat;\n\t\n\t // [scaleX, scaleY]\n\t return [k, k];\n\t },\n\t\n\t bounds: [[-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]]\n\t};\n\t\n\texports['default'] = Mercator;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 17 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.EPSG4326 is a CRS popular among advanced GIS specialists.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG4326.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionLatLon = __webpack_require__(18);\n\t\n\tvar _projectionProjectionLatLon2 = _interopRequireDefault(_projectionProjectionLatLon);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _EPSG4326 = {\n\t code: 'EPSG:4326',\n\t projection: _projectionProjectionLatLon2['default'],\n\t\n\t // Work out how to de-dupe this (scoping issue)\n\t transformScale: 1 / 180,\n\t\n\t // Scale and transformation inputs changed to account for central origin in\n\t // WebGL, instead of top-left origin used in Leaflet\n\t //\n\t // TODO: Cannot use this.transformScale due to scope\n\t transformation: new _utilTransformation2['default'](1 / 180, 0, -1 / 180, 0)\n\t};\n\t\n\tvar EPSG4326 = (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _EPSG4326);\n\t\n\texports['default'] = EPSG4326;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 18 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t/*\n\t * Simple equirectangular (Plate Carree) projection, used by CRS like EPSG:4326\n\t * and Simple.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.LonLat.js\n\t */\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar ProjectionLatLon = {\n\t project: function project(latlon) {\n\t return (0, _Point.point)(latlon.lon, latlon.lat);\n\t },\n\t\n\t unproject: function unproject(point) {\n\t return (0, _LatLon.latLon)(point.y, point.x);\n\t },\n\t\n\t // Scale factor for converting between real metres and degrees\n\t //\n\t // degrees = realMetres * pointScale\n\t // realMetres = degrees / pointScale\n\t //\n\t // See: http://stackoverflow.com/questions/639695/how-to-convert-latitude-or-longitude-to-meters\n\t // See: http://gis.stackexchange.com/questions/75528/length-of-a-degree-where-do-the-terms-in-this-formula-come-from\n\t pointScale: function pointScale(latlon) {\n\t var m1 = 111132.92;\n\t var m2 = -559.82;\n\t var m3 = 1.175;\n\t var m4 = -0.0023;\n\t var p1 = 111412.84;\n\t var p2 = -93.5;\n\t var p3 = 0.118;\n\t\n\t var rad = Math.PI / 180;\n\t var lat = latlon.lat * rad;\n\t\n\t var latlen = m1 + m2 * Math.cos(2 * lat) + m3 * Math.cos(4 * lat) + m4 * Math.cos(6 * lat);\n\t var lonlen = p1 * Math.cos(lat) + p2 * Math.cos(3 * lat) + p3 * Math.cos(5 * lat);\n\t\n\t return [1 / latlen, 1 / lonlen];\n\t },\n\t\n\t bounds: [[-180, -90], [180, 90]]\n\t};\n\t\n\texports['default'] = ProjectionLatLon;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 19 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * A simple CRS that can be used for flat non-Earth maps like panoramas or game\n\t * maps.\n\t *\n\t * Based on:\n\t * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Simple.js\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRS = __webpack_require__(9);\n\t\n\tvar _CRS2 = _interopRequireDefault(_CRS);\n\t\n\tvar _projectionProjectionLatLon = __webpack_require__(18);\n\t\n\tvar _projectionProjectionLatLon2 = _interopRequireDefault(_projectionProjectionLatLon);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _Simple = {\n\t projection: _projectionProjectionLatLon2['default'],\n\t\n\t // Straight 1:1 mapping (-1, -1 would be top-left)\n\t transformation: new _utilTransformation2['default'](1, 0, 1, 0),\n\t\n\t scale: function scale(zoom) {\n\t // If zoom is provided then return scale based on map tile zoom\n\t if (zoom) {\n\t return Math.pow(2, zoom);\n\t // Else, make no change to scale – may need to increase this or make it a\n\t // user-definable variable\n\t } else {\n\t return 1;\n\t }\n\t },\n\t\n\t zoom: function zoom(scale) {\n\t return Math.log(scale) / Math.LN2;\n\t },\n\t\n\t distance: function distance(latlon1, latlon2) {\n\t var dx = latlon2.lon - latlon1.lon;\n\t var dy = latlon2.lat - latlon1.lat;\n\t\n\t return Math.sqrt(dx * dx + dy * dy);\n\t },\n\t\n\t infinite: true\n\t};\n\t\n\tvar Simple = (0, _lodashAssign2['default'])({}, _CRS2['default'], _Simple);\n\t\n\texports['default'] = Simple;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 20 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * CRS.Proj4 for any Proj4-supported CRS.\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _CRSEarth = __webpack_require__(8);\n\t\n\tvar _CRSEarth2 = _interopRequireDefault(_CRSEarth);\n\t\n\tvar _projectionProjectionProj4 = __webpack_require__(21);\n\t\n\tvar _projectionProjectionProj42 = _interopRequireDefault(_projectionProjectionProj4);\n\t\n\tvar _utilTransformation = __webpack_require__(14);\n\t\n\tvar _utilTransformation2 = _interopRequireDefault(_utilTransformation);\n\t\n\tvar _Proj4 = function _Proj4(code, def, bounds) {\n\t var projection = (0, _projectionProjectionProj42['default'])(def, bounds);\n\t\n\t // Transformation calcuations\n\t var diffX = projection.bounds[1][0] - projection.bounds[0][0];\n\t var diffY = projection.bounds[1][1] - projection.bounds[0][1];\n\t\n\t var halfX = diffX / 2;\n\t var halfY = diffY / 2;\n\t\n\t // This is the raw scale factor\n\t var scaleX = 1 / halfX;\n\t var scaleY = 1 / halfY;\n\t\n\t // Find the minimum scale factor\n\t //\n\t // The minimum scale factor comes from the largest side and is the one\n\t // you want to use for both axis so they stay relative in dimension\n\t var scale = Math.min(scaleX, scaleY);\n\t\n\t // Find amount to offset each axis by to make the central point lie on\n\t // the [0,0] origin\n\t var offsetX = scale * (projection.bounds[0][0] + halfX);\n\t var offsetY = scale * (projection.bounds[0][1] + halfY);\n\t\n\t return {\n\t code: code,\n\t projection: projection,\n\t\n\t transformScale: scale,\n\t\n\t // Map the input to a [-1,1] range with [0,0] in the centre\n\t transformation: new _utilTransformation2['default'](scale, -offsetX, -scale, offsetY)\n\t };\n\t};\n\t\n\tvar Proj4 = function Proj4(code, def, bounds) {\n\t return (0, _lodashAssign2['default'])({}, _CRSEarth2['default'], _Proj4(code, def, bounds));\n\t};\n\t\n\texports['default'] = Proj4;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 21 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * Proj4 support for any projection.\n\t */\n\t\n\tvar _proj4 = __webpack_require__(22);\n\t\n\tvar _proj42 = _interopRequireDefault(_proj4);\n\t\n\tvar _LatLon = __webpack_require__(10);\n\t\n\tvar _Point = __webpack_require__(11);\n\t\n\tvar Proj4 = function Proj4(def, bounds) {\n\t var proj = (0, _proj42['default'])(def);\n\t\n\t var project = function project(latlon) {\n\t return (0, _Point.point)(proj.forward([latlon.lon, latlon.lat]));\n\t };\n\t\n\t var unproject = function unproject(point) {\n\t var inverse = proj.inverse([point.x, point.y]);\n\t return (0, _LatLon.latLon)(inverse[1], inverse[0]);\n\t };\n\t\n\t return {\n\t project: project,\n\t unproject: unproject,\n\t\n\t // Scale factor for converting between real metres and projected metres\\\n\t //\n\t // Need to work out the best way to provide the pointScale calculations\n\t // for custom, unknown projections (if wanting to override default)\n\t //\n\t // For now, user can manually override crs.pointScale or\n\t // crs.projection.pointScale\n\t //\n\t // projectedMetres = realMetres * pointScale\n\t // realMetres = projectedMetres / pointScale\n\t pointScale: function pointScale(latlon, accurate) {\n\t return [1, 1];\n\t },\n\t\n\t // Try and calculate bounds if none are provided\n\t //\n\t // This will provide incorrect bounds for some projections, so perhaps make\n\t // bounds a required input instead\n\t bounds: (function () {\n\t if (bounds) {\n\t return bounds;\n\t } else {\n\t var bottomLeft = project([-90, -180]);\n\t var topRight = project([90, 180]);\n\t\n\t return [bottomLeft, topRight];\n\t }\n\t })()\n\t };\n\t};\n\t\n\texports['default'] = Proj4;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 22 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_22__;\n\n/***/ },\n/* 23 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Scene = __webpack_require__(25);\n\t\n\tvar _Scene2 = _interopRequireDefault(_Scene);\n\t\n\tvar _DOMScene3D = __webpack_require__(26);\n\t\n\tvar _DOMScene3D2 = _interopRequireDefault(_DOMScene3D);\n\t\n\tvar _DOMScene2D = __webpack_require__(27);\n\t\n\tvar _DOMScene2D2 = _interopRequireDefault(_DOMScene2D);\n\t\n\tvar _Renderer = __webpack_require__(28);\n\t\n\tvar _Renderer2 = _interopRequireDefault(_Renderer);\n\t\n\tvar _DOMRenderer3D = __webpack_require__(29);\n\t\n\tvar _DOMRenderer3D2 = _interopRequireDefault(_DOMRenderer3D);\n\t\n\tvar _DOMRenderer2D = __webpack_require__(31);\n\t\n\tvar _DOMRenderer2D2 = _interopRequireDefault(_DOMRenderer2D);\n\t\n\tvar _Camera = __webpack_require__(33);\n\t\n\tvar _Camera2 = _interopRequireDefault(_Camera);\n\t\n\tvar _Picking = __webpack_require__(34);\n\t\n\tvar _Picking2 = _interopRequireDefault(_Picking);\n\t\n\tvar _EffectComposer = __webpack_require__(36);\n\t\n\tvar _EffectComposer2 = _interopRequireDefault(_EffectComposer);\n\t\n\tvar _vendorRenderPass = __webpack_require__(41);\n\t\n\tvar _vendorRenderPass2 = _interopRequireDefault(_vendorRenderPass);\n\t\n\tvar _vendorShaderPass = __webpack_require__(39);\n\t\n\tvar _vendorShaderPass2 = _interopRequireDefault(_vendorShaderPass);\n\t\n\tvar _vendorCopyShader = __webpack_require__(38);\n\t\n\tvar _vendorCopyShader2 = _interopRequireDefault(_vendorCopyShader);\n\t\n\tvar _vendorHorizontalTiltShiftShader = __webpack_require__(42);\n\t\n\tvar _vendorHorizontalTiltShiftShader2 = _interopRequireDefault(_vendorHorizontalTiltShiftShader);\n\t\n\tvar _vendorVerticalTiltShiftShader = __webpack_require__(43);\n\t\n\tvar _vendorVerticalTiltShiftShader2 = _interopRequireDefault(_vendorVerticalTiltShiftShader);\n\t\n\tvar _vendorFXAAShader = __webpack_require__(44);\n\t\n\tvar _vendorFXAAShader2 = _interopRequireDefault(_vendorFXAAShader);\n\t\n\tvar Engine = (function (_EventEmitter) {\n\t _inherits(Engine, _EventEmitter);\n\t\n\t function Engine(container, world) {\n\t _classCallCheck(this, Engine);\n\t\n\t console.log('Init Engine');\n\t\n\t _get(Object.getPrototypeOf(Engine.prototype), 'constructor', this).call(this);\n\t\n\t this._world = world;\n\t\n\t this._scene = _Scene2['default'];\n\t this._domScene3D = _DOMScene3D2['default'];\n\t this._domScene2D = _DOMScene2D2['default'];\n\t\n\t var antialias = this._world.options.postProcessing ? false : true;\n\t this._renderer = (0, _Renderer2['default'])(container, antialias);\n\t this._domRenderer3D = (0, _DOMRenderer3D2['default'])(container);\n\t this._domRenderer2D = (0, _DOMRenderer2D2['default'])(container);\n\t\n\t this._camera = (0, _Camera2['default'])(container);\n\t\n\t this._container = container;\n\t\n\t // TODO: Make this optional\n\t this._picking = (0, _Picking2['default'])(this._world, this._renderer, this._camera);\n\t\n\t this.clock = new _three2['default'].Clock();\n\t\n\t this._frustum = new _three2['default'].Frustum();\n\t\n\t if (this._world.options.postProcessing) {\n\t this._initPostProcessing();\n\t }\n\t }\n\t\n\t // TODO: Set up composer to automatically resize on viewport change\n\t // TODO: Update passes that rely on width / height on resize\n\t // TODO: Merge default passes into a single shader / pass for performance\n\t\n\t _createClass(Engine, [{\n\t key: '_initPostProcessing',\n\t value: function _initPostProcessing() {\n\t var renderPass = new _vendorRenderPass2['default'](this._scene, this._camera);\n\t\n\t // TODO: Look at using @mattdesl's optimised FXAA shader\n\t // https://github.com/mattdesl/three-shader-fxaa\n\t var fxaaPass = new _vendorShaderPass2['default'](_vendorFXAAShader2['default']);\n\t\n\t var hblurPass = new _vendorShaderPass2['default'](_vendorHorizontalTiltShiftShader2['default']);\n\t var vblurPass = new _vendorShaderPass2['default'](_vendorVerticalTiltShiftShader2['default']);\n\t var bluriness = 5;\n\t\n\t hblurPass.uniforms.r.value = vblurPass.uniforms.r.value = 0.6;\n\t\n\t var copyPass = new _vendorShaderPass2['default'](_vendorCopyShader2['default']);\n\t copyPass.renderToScreen = true;\n\t\n\t this._composer = (0, _EffectComposer2['default'])(this._renderer, this._container);\n\t\n\t this._composer.addPass(renderPass);\n\t this._composer.addPass(fxaaPass);\n\t this._composer.addPass(hblurPass);\n\t this._composer.addPass(vblurPass);\n\t this._composer.addPass(copyPass);\n\t\n\t var self = this;\n\t var updatePostProcessingSize = function updatePostProcessingSize() {\n\t var width = self._container.clientWidth;\n\t var height = self._container.clientHeight;\n\t\n\t var pixelRatio = window.devicePixelRatio;\n\t\n\t fxaaPass.uniforms.resolution.value.set(1 / (width * pixelRatio), 1 / (height * pixelRatio));\n\t\n\t hblurPass.uniforms.h.value = bluriness / (width * pixelRatio);\n\t vblurPass.uniforms.v.value = bluriness / (height * pixelRatio);\n\t };\n\t\n\t updatePostProcessingSize();\n\t window.addEventListener('resize', updatePostProcessingSize, false);\n\t }\n\t }, {\n\t key: 'update',\n\t value: function update(delta) {\n\t this.emit('preRender');\n\t\n\t if (this._world.options.postProcessing) {\n\t this._composer.render(delta);\n\t } else {\n\t this._renderer.render(this._scene, this._camera);\n\t }\n\t\n\t // Render picking scene\n\t // this._renderer.render(this._picking._pickingScene, this._camera);\n\t\n\t // Render DOM scenes\n\t this._domRenderer3D.render(this._domScene3D, this._camera);\n\t this._domRenderer2D.render(this._domScene2D, this._camera);\n\t\n\t this.emit('postRender');\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Remove any remaining objects from scene\n\t var child;\n\t for (var i = this._scene.children.length - 1; i >= 0; i--) {\n\t child = this._scene.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._scene.remove(child);\n\t\n\t if (child.geometry) {\n\t // Dispose of mesh and materials\n\t child.geometry.dispose();\n\t child.geometry = null;\n\t }\n\t\n\t if (child.material) {\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t }\n\t };\n\t\n\t for (var i = this._domScene3D.children.length - 1; i >= 0; i--) {\n\t child = this._domScene3D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._domScene3D.remove(child);\n\t };\n\t\n\t for (var i = this._domScene2D.children.length - 1; i >= 0; i--) {\n\t child = this._domScene2D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._domScene2D.remove(child);\n\t };\n\t\n\t this._picking.destroy();\n\t this._picking = null;\n\t\n\t this._world = null;\n\t this._scene = null;\n\t this._domScene3D = null;\n\t this._domScene2D = null;\n\t\n\t this._composer = null;\n\t this._renderer = null;\n\t\n\t this._domRenderer3D = null;\n\t this._domRenderer2D = null;\n\t this._camera = null;\n\t this._clock = null;\n\t this._frustum = null;\n\t }\n\t }]);\n\t\n\t return Engine;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = Engine;\n\t\n\t// // Initialise without requiring new keyword\n\t// export default function(container, world) {\n\t// return new Engine(container, world);\n\t// };\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 24 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_24__;\n\n/***/ },\n/* 25 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.scene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t\n\t // TODO: Re-enable when this works with the skybox\n\t // scene.fog = new THREE.Fog(0xffffff, 1, 15000);\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 26 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.scene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 27 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.scene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 28 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Scene = __webpack_require__(25);\n\t\n\tvar _Scene2 = _interopRequireDefault(_Scene);\n\t\n\t// This can only be accessed from Engine.renderer if you want to reference the\n\t// same scene in multiple places\n\t\n\texports['default'] = function (container, antialias) {\n\t var renderer = new _three2['default'].WebGLRenderer({\n\t antialias: antialias\n\t });\n\t\n\t // TODO: Re-enable when this works with the skybox\n\t // renderer.setClearColor(Scene.fog.color, 1);\n\t\n\t renderer.setClearColor(0xffffff, 1);\n\t renderer.setPixelRatio(window.devicePixelRatio);\n\t\n\t // Gamma settings make things look nicer\n\t renderer.gammaInput = true;\n\t renderer.gammaOutput = true;\n\t\n\t renderer.shadowMap.enabled = true;\n\t\n\t // TODO: Work out which of the shadowmap types is best\n\t // https://github.com/mrdoob/three.js/blob/r56/src/Three.js#L107\n\t // renderer.shadowMap.type = THREE.PCFSoftShadowMap;\n\t\n\t // TODO: Check that leaving this as default (CullFrontFace) is right\n\t // renderer.shadowMap.cullFace = THREE.CullFaceBack;\n\t\n\t container.appendChild(renderer.domElement);\n\t\n\t var updateSize = function updateSize() {\n\t renderer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return renderer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 29 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorCSS3DRenderer = __webpack_require__(30);\n\t\n\tvar _DOMScene3D = __webpack_require__(26);\n\t\n\tvar _DOMScene3D2 = _interopRequireDefault(_DOMScene3D);\n\t\n\t// This can only be accessed from Engine.renderer if you want to reference the\n\t// same scene in multiple places\n\t\n\texports['default'] = function (container) {\n\t var renderer = new _vendorCSS3DRenderer.CSS3DRenderer();\n\t\n\t renderer.domElement.style.position = 'absolute';\n\t renderer.domElement.style.top = 0;\n\t\n\t container.appendChild(renderer.domElement);\n\t\n\t var updateSize = function updateSize() {\n\t renderer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return renderer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 30 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\t/**\n\t * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs\n\t * @author mrdoob / http://mrdoob.com/\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar CSS3DObject = function CSS3DObject(element) {\n\t\n\t\t_three2['default'].Object3D.call(this);\n\t\n\t\tthis.element = element;\n\t\tthis.element.style.position = 'absolute';\n\t\n\t\tthis.addEventListener('removed', function (event) {\n\t\n\t\t\tif (this.element.parentNode !== null) {\n\t\n\t\t\t\tthis.element.parentNode.removeChild(this.element);\n\t\t\t}\n\t\t});\n\t};\n\t\n\tCSS3DObject.prototype = Object.create(_three2['default'].Object3D.prototype);\n\tCSS3DObject.prototype.constructor = CSS3DObject;\n\t\n\tvar CSS3DSprite = function CSS3DSprite(element) {\n\t\n\t\tCSS3DObject.call(this, element);\n\t};\n\t\n\tCSS3DSprite.prototype = Object.create(CSS3DObject.prototype);\n\tCSS3DSprite.prototype.constructor = CSS3DSprite;\n\t\n\t//\n\t\n\tvar CSS3DRenderer = function CSS3DRenderer() {\n\t\n\t\tconsole.log('THREE.CSS3DRenderer', _three2['default'].REVISION);\n\t\n\t\tvar _width, _height;\n\t\tvar _widthHalf, _heightHalf;\n\t\n\t\tvar matrix = new _three2['default'].Matrix4();\n\t\n\t\tvar cache = {\n\t\t\tcamera: { fov: 0, style: '' },\n\t\t\tobjects: {}\n\t\t};\n\t\n\t\tvar domElement = document.createElement('div');\n\t\tdomElement.style.overflow = 'hidden';\n\t\n\t\tdomElement.style.WebkitTransformStyle = 'preserve-3d';\n\t\tdomElement.style.MozTransformStyle = 'preserve-3d';\n\t\tdomElement.style.oTransformStyle = 'preserve-3d';\n\t\tdomElement.style.transformStyle = 'preserve-3d';\n\t\n\t\tthis.domElement = domElement;\n\t\n\t\tvar cameraElement = document.createElement('div');\n\t\n\t\tcameraElement.style.WebkitTransformStyle = 'preserve-3d';\n\t\tcameraElement.style.MozTransformStyle = 'preserve-3d';\n\t\tcameraElement.style.oTransformStyle = 'preserve-3d';\n\t\tcameraElement.style.transformStyle = 'preserve-3d';\n\t\n\t\tdomElement.appendChild(cameraElement);\n\t\n\t\tthis.setClearColor = function () {};\n\t\n\t\tthis.getSize = function () {\n\t\n\t\t\treturn {\n\t\t\t\twidth: _width,\n\t\t\t\theight: _height\n\t\t\t};\n\t\t};\n\t\n\t\tthis.setSize = function (width, height) {\n\t\n\t\t\t_width = width;\n\t\t\t_height = height;\n\t\n\t\t\t_widthHalf = _width / 2;\n\t\t\t_heightHalf = _height / 2;\n\t\n\t\t\tdomElement.style.width = width + 'px';\n\t\t\tdomElement.style.height = height + 'px';\n\t\n\t\t\tcameraElement.style.width = width + 'px';\n\t\t\tcameraElement.style.height = height + 'px';\n\t\t};\n\t\n\t\tvar epsilon = function epsilon(value) {\n\t\n\t\t\treturn Math.abs(value) < Number.EPSILON ? 0 : value;\n\t\t};\n\t\n\t\tvar getCameraCSSMatrix = function getCameraCSSMatrix(matrix) {\n\t\n\t\t\tvar elements = matrix.elements;\n\t\n\t\t\treturn 'matrix3d(' + epsilon(elements[0]) + ',' + epsilon(-elements[1]) + ',' + epsilon(elements[2]) + ',' + epsilon(elements[3]) + ',' + epsilon(elements[4]) + ',' + epsilon(-elements[5]) + ',' + epsilon(elements[6]) + ',' + epsilon(elements[7]) + ',' + epsilon(elements[8]) + ',' + epsilon(-elements[9]) + ',' + epsilon(elements[10]) + ',' + epsilon(elements[11]) + ',' + epsilon(elements[12]) + ',' + epsilon(-elements[13]) + ',' + epsilon(elements[14]) + ',' + epsilon(elements[15]) + ')';\n\t\t};\n\t\n\t\tvar getObjectCSSMatrix = function getObjectCSSMatrix(matrix) {\n\t\n\t\t\tvar elements = matrix.elements;\n\t\n\t\t\treturn 'translate3d(-50%,-50%,0) matrix3d(' + epsilon(elements[0]) + ',' + epsilon(elements[1]) + ',' + epsilon(elements[2]) + ',' + epsilon(elements[3]) + ',' + epsilon(-elements[4]) + ',' + epsilon(-elements[5]) + ',' + epsilon(-elements[6]) + ',' + epsilon(-elements[7]) + ',' + epsilon(elements[8]) + ',' + epsilon(elements[9]) + ',' + epsilon(elements[10]) + ',' + epsilon(elements[11]) + ',' + epsilon(elements[12]) + ',' + epsilon(elements[13]) + ',' + epsilon(elements[14]) + ',' + epsilon(elements[15]) + ')';\n\t\t};\n\t\n\t\tvar renderObject = function renderObject(object, camera) {\n\t\n\t\t\tif (object instanceof CSS3DObject) {\n\t\n\t\t\t\tvar style;\n\t\n\t\t\t\tif (object instanceof CSS3DSprite) {\n\t\n\t\t\t\t\t// http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/\n\t\n\t\t\t\t\tmatrix.copy(camera.matrixWorldInverse);\n\t\t\t\t\tmatrix.transpose();\n\t\t\t\t\tmatrix.copyPosition(object.matrixWorld);\n\t\t\t\t\tmatrix.scale(object.scale);\n\t\n\t\t\t\t\tmatrix.elements[3] = 0;\n\t\t\t\t\tmatrix.elements[7] = 0;\n\t\t\t\t\tmatrix.elements[11] = 0;\n\t\t\t\t\tmatrix.elements[15] = 1;\n\t\n\t\t\t\t\tstyle = getObjectCSSMatrix(matrix);\n\t\t\t\t} else {\n\t\n\t\t\t\t\tstyle = getObjectCSSMatrix(object.matrixWorld);\n\t\t\t\t}\n\t\n\t\t\t\tvar element = object.element;\n\t\t\t\tvar cachedStyle = cache.objects[object.id];\n\t\n\t\t\t\tif (cachedStyle === undefined || cachedStyle !== style) {\n\t\n\t\t\t\t\telement.style.WebkitTransform = style;\n\t\t\t\t\telement.style.MozTransform = style;\n\t\t\t\t\telement.style.oTransform = style;\n\t\t\t\t\telement.style.transform = style;\n\t\n\t\t\t\t\tcache.objects[object.id] = style;\n\t\t\t\t}\n\t\n\t\t\t\tif (element.parentNode !== cameraElement) {\n\t\n\t\t\t\t\tcameraElement.appendChild(element);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tfor (var i = 0, l = object.children.length; i < l; i++) {\n\t\n\t\t\t\trenderObject(object.children[i], camera);\n\t\t\t}\n\t\t};\n\t\n\t\tthis.render = function (scene, camera) {\n\t\n\t\t\tvar fov = 0.5 / Math.tan(_three2['default'].Math.degToRad(camera.fov * 0.5)) * _height;\n\t\n\t\t\tif (cache.camera.fov !== fov) {\n\t\n\t\t\t\tdomElement.style.WebkitPerspective = fov + 'px';\n\t\t\t\tdomElement.style.MozPerspective = fov + 'px';\n\t\t\t\tdomElement.style.oPerspective = fov + 'px';\n\t\t\t\tdomElement.style.perspective = fov + 'px';\n\t\n\t\t\t\tcache.camera.fov = fov;\n\t\t\t}\n\t\n\t\t\tscene.updateMatrixWorld();\n\t\n\t\t\tif (camera.parent === null) camera.updateMatrixWorld();\n\t\n\t\t\tcamera.matrixWorldInverse.getInverse(camera.matrixWorld);\n\t\n\t\t\tvar style = 'translate3d(0,0,' + fov + 'px)' + getCameraCSSMatrix(camera.matrixWorldInverse) + ' translate3d(' + _widthHalf + 'px,' + _heightHalf + 'px, 0)';\n\t\n\t\t\tif (cache.camera.style !== style) {\n\t\n\t\t\t\tcameraElement.style.WebkitTransform = style;\n\t\t\t\tcameraElement.style.MozTransform = style;\n\t\t\t\tcameraElement.style.oTransform = style;\n\t\t\t\tcameraElement.style.transform = style;\n\t\n\t\t\t\tcache.camera.style = style;\n\t\t\t}\n\t\n\t\t\trenderObject(scene, camera);\n\t\t};\n\t};\n\t\n\texports.CSS3DObject = CSS3DObject;\n\texports.CSS3DSprite = CSS3DSprite;\n\texports.CSS3DRenderer = CSS3DRenderer;\n\t\n\t_three2['default'].CSS3DObject = CSS3DObject;\n\t_three2['default'].CSS3DSprite = CSS3DSprite;\n\t_three2['default'].CSS3DRenderer = CSS3DRenderer;\n\n/***/ },\n/* 31 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorCSS2DRenderer = __webpack_require__(32);\n\t\n\tvar _DOMScene2D = __webpack_require__(27);\n\t\n\tvar _DOMScene2D2 = _interopRequireDefault(_DOMScene2D);\n\t\n\t// This can only be accessed from Engine.renderer if you want to reference the\n\t// same scene in multiple places\n\t\n\texports['default'] = function (container) {\n\t var renderer = new _vendorCSS2DRenderer.CSS2DRenderer();\n\t\n\t renderer.domElement.style.position = 'absolute';\n\t renderer.domElement.style.top = 0;\n\t\n\t container.appendChild(renderer.domElement);\n\t\n\t var updateSize = function updateSize() {\n\t renderer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return renderer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 32 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\t/**\n\t * @author mrdoob / http://mrdoob.com/\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar CSS2DObject = function CSS2DObject(element) {\n\t\n\t\t_three2['default'].Object3D.call(this);\n\t\n\t\tthis.element = element;\n\t\tthis.element.style.position = 'absolute';\n\t\n\t\tthis.addEventListener('removed', function (event) {\n\t\n\t\t\tif (this.element.parentNode !== null) {\n\t\n\t\t\t\tthis.element.parentNode.removeChild(this.element);\n\t\t\t}\n\t\t});\n\t};\n\t\n\tCSS2DObject.prototype = Object.create(_three2['default'].Object3D.prototype);\n\tCSS2DObject.prototype.constructor = CSS2DObject;\n\t\n\t//\n\t\n\tvar CSS2DRenderer = function CSS2DRenderer() {\n\t\n\t\tconsole.log('THREE.CSS2DRenderer', _three2['default'].REVISION);\n\t\n\t\tvar _width, _height;\n\t\tvar _widthHalf, _heightHalf;\n\t\n\t\tvar vector = new _three2['default'].Vector3();\n\t\tvar viewMatrix = new _three2['default'].Matrix4();\n\t\tvar viewProjectionMatrix = new _three2['default'].Matrix4();\n\t\n\t\tvar domElement = document.createElement('div');\n\t\tdomElement.style.overflow = 'hidden';\n\t\n\t\tthis.domElement = domElement;\n\t\n\t\tthis.setSize = function (width, height) {\n\t\n\t\t\t_width = width;\n\t\t\t_height = height;\n\t\n\t\t\t_widthHalf = _width / 2;\n\t\t\t_heightHalf = _height / 2;\n\t\n\t\t\tdomElement.style.width = width + 'px';\n\t\t\tdomElement.style.height = height + 'px';\n\t\t};\n\t\n\t\tvar renderObject = function renderObject(object, camera) {\n\t\n\t\t\tif (object instanceof CSS2DObject) {\n\t\n\t\t\t\tvector.setFromMatrixPosition(object.matrixWorld);\n\t\t\t\tvector.applyProjection(viewProjectionMatrix);\n\t\n\t\t\t\tvar element = object.element;\n\t\t\t\tvar style = 'translate(-50%,-50%) translate(' + (vector.x * _widthHalf + _widthHalf) + 'px,' + (-vector.y * _heightHalf + _heightHalf) + 'px)';\n\t\n\t\t\t\telement.style.WebkitTransform = style;\n\t\t\t\telement.style.MozTransform = style;\n\t\t\t\telement.style.oTransform = style;\n\t\t\t\telement.style.transform = style;\n\t\n\t\t\t\tif (element.parentNode !== domElement) {\n\t\n\t\t\t\t\tdomElement.appendChild(element);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tfor (var i = 0, l = object.children.length; i < l; i++) {\n\t\n\t\t\t\trenderObject(object.children[i], camera);\n\t\t\t}\n\t\t};\n\t\n\t\tthis.render = function (scene, camera) {\n\t\n\t\t\tscene.updateMatrixWorld();\n\t\n\t\t\tif (camera.parent === null) camera.updateMatrixWorld();\n\t\n\t\t\tcamera.matrixWorldInverse.getInverse(camera.matrixWorld);\n\t\n\t\t\tviewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld));\n\t\t\tviewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, viewMatrix);\n\t\n\t\t\trenderObject(scene, camera);\n\t\t};\n\t};\n\t\n\texports.CSS2DObject = CSS2DObject;\n\texports.CSS2DRenderer = CSS2DRenderer;\n\t\n\t_three2['default'].CSS2DObject = CSS2DObject;\n\t_three2['default'].CSS2DRenderer = CSS2DRenderer;\n\n/***/ },\n/* 33 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can only be accessed from Engine.camera if you want to reference the\n\t// same scene in multiple places\n\t\n\t// TODO: Ensure that FOV looks natural on all aspect ratios\n\t// http://stackoverflow.com/q/26655930/997339\n\t\n\texports['default'] = function (container) {\n\t var camera = new _three2['default'].PerspectiveCamera(45, 1, 1, 200000);\n\t camera.position.y = 400;\n\t camera.position.z = 400;\n\t\n\t var updateSize = function updateSize() {\n\t camera.aspect = container.clientWidth / container.clientHeight;\n\t camera.updateProjectionMatrix();\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return camera;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 34 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _PickingScene = __webpack_require__(35);\n\t\n\tvar _PickingScene2 = _interopRequireDefault(_PickingScene);\n\t\n\t// TODO: Look into a way of setting this up without passing in a renderer and\n\t// camera from the engine\n\t\n\t// TODO: Add a basic indicator on or around the mouse pointer when it is over\n\t// something pickable / clickable\n\t//\n\t// A simple transparent disc or ring at the mouse point should work to start, or\n\t// even just changing the cursor to the CSS 'pointer' style\n\t//\n\t// Probably want this on mousemove with a throttled update as not to spam the\n\t// picking method\n\t//\n\t// Relies upon the picking method not redrawing the scene every call due to\n\t// the way TileLayer invalidates the picking scene\n\t\n\tvar nextId = 1;\n\t\n\tvar Picking = (function () {\n\t function Picking(world, renderer, camera) {\n\t _classCallCheck(this, Picking);\n\t\n\t this._world = world;\n\t this._renderer = renderer;\n\t this._camera = camera;\n\t\n\t this._raycaster = new _three2['default'].Raycaster();\n\t\n\t // TODO: Match this with the line width used in the picking layers\n\t this._raycaster.linePrecision = 3;\n\t\n\t this._pickingScene = _PickingScene2['default'];\n\t this._pickingTexture = new _three2['default'].WebGLRenderTarget();\n\t this._pickingTexture.texture.minFilter = _three2['default'].LinearFilter;\n\t this._pickingTexture.texture.generateMipmaps = false;\n\t\n\t this._nextId = 1;\n\t\n\t this._resizeTexture();\n\t this._initEvents();\n\t }\n\t\n\t // Initialise without requiring new keyword\n\t\n\t _createClass(Picking, [{\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t window.addEventListener('resize', this._resizeTexture.bind(this), false);\n\t\n\t // this._renderer.domElement.addEventListener('mousemove', this._onMouseMove.bind(this), false);\n\t this._world._container.addEventListener('mouseup', this._onMouseUp.bind(this), false);\n\t\n\t this._world.on('move', this._onWorldMove, this);\n\t }\n\t }, {\n\t key: '_onMouseUp',\n\t value: function _onMouseUp(event) {\n\t // Only react to main button click\n\t if (event.button !== 0) {\n\t return;\n\t }\n\t\n\t var point = (0, _geoPoint.point)(event.clientX, event.clientY);\n\t\n\t var normalisedPoint = (0, _geoPoint.point)(0, 0);\n\t normalisedPoint.x = point.x / this._width * 2 - 1;\n\t normalisedPoint.y = -(point.y / this._height) * 2 + 1;\n\t\n\t this._pick(point, normalisedPoint);\n\t }\n\t }, {\n\t key: '_onWorldMove',\n\t value: function _onWorldMove() {\n\t this._needUpdate = true;\n\t }\n\t\n\t // TODO: Ensure this doesn't get out of sync issue with the renderer resize\n\t }, {\n\t key: '_resizeTexture',\n\t value: function _resizeTexture() {\n\t var size = this._renderer.getSize();\n\t\n\t this._width = size.width;\n\t this._height = size.height;\n\t\n\t this._pickingTexture.setSize(this._width, this._height);\n\t this._pixelBuffer = new Uint8Array(4 * this._width * this._height);\n\t\n\t this._needUpdate = true;\n\t }\n\t\n\t // TODO: Make this only re-draw the scene if both an update is needed and the\n\t // camera has moved since the last update\n\t //\n\t // Otherwise it re-draws the scene on every click due to the way LOD updates\n\t // work in TileLayer – spamming this.add() and this.remove()\n\t //\n\t // TODO: Pause updates during map move / orbit / zoom as this is unlikely to\n\t // be a point in time where the user cares for picking functionality\n\t }, {\n\t key: '_update',\n\t value: function _update() {\n\t if (this._needUpdate) {\n\t var texture = this._pickingTexture;\n\t\n\t this._renderer.render(this._pickingScene, this._camera, this._pickingTexture);\n\t\n\t // Read the rendering texture\n\t this._renderer.readRenderTargetPixels(texture, 0, 0, texture.width, texture.height, this._pixelBuffer);\n\t\n\t this._needUpdate = false;\n\t }\n\t }\n\t }, {\n\t key: '_pick',\n\t value: function _pick(point, normalisedPoint) {\n\t this._update();\n\t\n\t var index = point.x + (this._pickingTexture.height - point.y) * this._pickingTexture.width;\n\t\n\t // Interpret the pixel as an ID\n\t var id = this._pixelBuffer[index * 4 + 2] * 255 * 255 + this._pixelBuffer[index * 4 + 1] * 255 + this._pixelBuffer[index * 4 + 0];\n\t\n\t // Skip if ID is 16646655 (white) as the background returns this\n\t if (id === 16646655) {\n\t return;\n\t }\n\t\n\t this._raycaster.setFromCamera(normalisedPoint, this._camera);\n\t\n\t // Perform ray intersection on picking scene\n\t //\n\t // TODO: Only perform intersection test on the relevant picking mesh\n\t var intersects = this._raycaster.intersectObjects(this._pickingScene.children, true);\n\t\n\t var _point2d = point.clone();\n\t\n\t var _point3d;\n\t if (intersects.length > 0) {\n\t _point3d = intersects[0].point.clone();\n\t }\n\t\n\t // Pass along as much data as possible for now until we know more about how\n\t // people use the picking API and what the returned data should be\n\t //\n\t // TODO: Look into the leak potential for passing so much by reference here\n\t this._world.emit('pick', id, _point2d, _point3d, intersects);\n\t this._world.emit('pick-' + id, _point2d, _point3d, intersects);\n\t }\n\t\n\t // Add mesh to picking scene\n\t //\n\t // Picking ID should already be added as an attribute\n\t }, {\n\t key: 'add',\n\t value: function add(mesh) {\n\t this._pickingScene.add(mesh);\n\t this._needUpdate = true;\n\t }\n\t\n\t // Remove mesh from picking scene\n\t }, {\n\t key: 'remove',\n\t value: function remove(mesh) {\n\t this._pickingScene.remove(mesh);\n\t this._needUpdate = true;\n\t }\n\t\n\t // Returns next ID to use for picking\n\t }, {\n\t key: 'getNextId',\n\t value: function getNextId() {\n\t return nextId++;\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // TODO: Find a way to properly remove these listeners as they stay\n\t // active at the moment\n\t window.removeEventListener('resize', this._resizeTexture, false);\n\t this._renderer.domElement.removeEventListener('mouseup', this._onMouseUp, false);\n\t this._world.off('move', this._onWorldMove);\n\t\n\t if (this._pickingScene.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._pickingScene.children.length - 1; i >= 0; i--) {\n\t child = this._pickingScene.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this._pickingScene.remove(child);\n\t\n\t // Probably not a good idea to dispose of geometry due to it being\n\t // shared with the non-picking scene\n\t // if (child.geometry) {\n\t // // Dispose of mesh and materials\n\t // child.geometry.dispose();\n\t // child.geometry = null;\n\t // }\n\t\n\t if (child.material) {\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t }\n\t }\n\t }\n\t\n\t this._pickingScene = null;\n\t this._pickingTexture = null;\n\t this._pixelBuffer = null;\n\t\n\t this._world = null;\n\t this._renderer = null;\n\t this._camera = null;\n\t }\n\t }]);\n\t\n\t return Picking;\n\t})();\n\t\n\texports['default'] = function (world, renderer, camera) {\n\t return new Picking(world, renderer, camera);\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 35 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// This can be imported from anywhere and will still reference the same scene,\n\t// though there is a helper reference in Engine.pickingScene\n\t\n\texports['default'] = (function () {\n\t var scene = new _three2['default'].Scene();\n\t return scene;\n\t})();\n\t\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 36 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorEffectComposer = __webpack_require__(37);\n\t\n\tvar _vendorEffectComposer2 = _interopRequireDefault(_vendorEffectComposer);\n\t\n\texports['default'] = function (renderer, container) {\n\t var composer = new _vendorEffectComposer2['default'](renderer);\n\t\n\t var updateSize = function updateSize() {\n\t composer.setSize(container.clientWidth, container.clientHeight);\n\t };\n\t\n\t window.addEventListener('resize', updateSize, false);\n\t updateSize();\n\t\n\t return composer;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 37 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _CopyShader = __webpack_require__(38);\n\t\n\tvar _CopyShader2 = _interopRequireDefault(_CopyShader);\n\t\n\tvar _ShaderPass = __webpack_require__(39);\n\t\n\tvar _ShaderPass2 = _interopRequireDefault(_ShaderPass);\n\t\n\tvar _MaskPass = __webpack_require__(40);\n\t\n\tvar _MaskPass2 = _interopRequireDefault(_MaskPass);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t */\n\t\n\tvar EffectComposer = function EffectComposer(renderer, renderTarget) {\n\t\n\t\tthis.renderer = renderer;\n\t\n\t\tif (renderTarget === undefined) {\n\t\n\t\t\tvar pixelRatio = renderer.getPixelRatio();\n\t\n\t\t\tvar width = Math.floor(renderer.context.canvas.width / pixelRatio) || 1;\n\t\t\tvar height = Math.floor(renderer.context.canvas.height / pixelRatio) || 1;\n\t\t\tvar parameters = { minFilter: _three2['default'].LinearFilter, magFilter: _three2['default'].LinearFilter, format: _three2['default'].RGBAFormat, stencilBuffer: false };\n\t\n\t\t\trenderTarget = new _three2['default'].WebGLRenderTarget(width, height, parameters);\n\t\t}\n\t\n\t\tthis.renderTarget1 = renderTarget;\n\t\tthis.renderTarget2 = renderTarget.clone();\n\t\n\t\tthis.writeBuffer = this.renderTarget1;\n\t\tthis.readBuffer = this.renderTarget2;\n\t\n\t\tthis.passes = [];\n\t\n\t\tif (_CopyShader2['default'] === undefined) console.error(\"EffectComposer relies on THREE.CopyShader\");\n\t\n\t\tthis.copyPass = new _ShaderPass2['default'](_CopyShader2['default']);\n\t};\n\t\n\tEffectComposer.prototype = {\n\t\n\t\tswapBuffers: function swapBuffers() {\n\t\n\t\t\tvar tmp = this.readBuffer;\n\t\t\tthis.readBuffer = this.writeBuffer;\n\t\t\tthis.writeBuffer = tmp;\n\t\t},\n\t\n\t\taddPass: function addPass(pass) {\n\t\n\t\t\tthis.passes.push(pass);\n\t\t},\n\t\n\t\tinsertPass: function insertPass(pass, index) {\n\t\n\t\t\tthis.passes.splice(index, 0, pass);\n\t\t},\n\t\n\t\trender: function render(delta) {\n\t\n\t\t\tthis.writeBuffer = this.renderTarget1;\n\t\t\tthis.readBuffer = this.renderTarget2;\n\t\n\t\t\tvar maskActive = false;\n\t\n\t\t\tvar pass,\n\t\t\t i,\n\t\t\t il = this.passes.length;\n\t\n\t\t\tfor (i = 0; i < il; i++) {\n\t\n\t\t\t\tpass = this.passes[i];\n\t\n\t\t\t\tif (!pass.enabled) continue;\n\t\n\t\t\t\tpass.render(this.renderer, this.writeBuffer, this.readBuffer, delta, maskActive);\n\t\n\t\t\t\tif (pass.needsSwap) {\n\t\n\t\t\t\t\tif (maskActive) {\n\t\n\t\t\t\t\t\tvar context = this.renderer.context;\n\t\n\t\t\t\t\t\tcontext.stencilFunc(context.NOTEQUAL, 1, 0xffffffff);\n\t\n\t\t\t\t\t\tthis.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, delta);\n\t\n\t\t\t\t\t\tcontext.stencilFunc(context.EQUAL, 1, 0xffffffff);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tthis.swapBuffers();\n\t\t\t\t}\n\t\n\t\t\t\tif (pass instanceof _MaskPass2['default']) {\n\t\n\t\t\t\t\tmaskActive = true;\n\t\t\t\t} else if (pass instanceof _MaskPass.ClearMaskPass) {\n\t\n\t\t\t\t\tmaskActive = false;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\treset: function reset(renderTarget) {\n\t\n\t\t\tif (renderTarget === undefined) {\n\t\n\t\t\t\trenderTarget = this.renderTarget1.clone();\n\t\n\t\t\t\tvar pixelRatio = this.renderer.getPixelRatio();\n\t\n\t\t\t\trenderTarget.setSize(Math.floor(this.renderer.context.canvas.width / pixelRatio), Math.floor(this.renderer.context.canvas.height / pixelRatio));\n\t\t\t}\n\t\n\t\t\tthis.renderTarget1.dispose();\n\t\t\tthis.renderTarget1 = renderTarget;\n\t\t\tthis.renderTarget2.dispose();\n\t\t\tthis.renderTarget2 = renderTarget.clone();\n\t\n\t\t\tthis.writeBuffer = this.renderTarget1;\n\t\t\tthis.readBuffer = this.renderTarget2;\n\t\t},\n\t\n\t\tsetSize: function setSize(width, height) {\n\t\n\t\t\tthis.renderTarget1.setSize(width, height);\n\t\t\tthis.renderTarget2.setSize(width, height);\n\t\t}\n\t\n\t};\n\t\n\texports['default'] = EffectComposer;\n\t\n\t_three2['default'].EffectComposer = EffectComposer;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 38 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t *\n\t * Full-screen textured quad shader\n\t */\n\t\n\tvar CopyShader = {\n\t\n\t\tuniforms: {\n\t\n\t\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\t\"opacity\": { type: \"f\", value: 1.0 }\n\t\n\t\t},\n\t\n\t\tvertexShader: [\"varying vec2 vUv;\", \"void main() {\", \"vUv = uv;\", \"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\", \"}\"].join(\"\\n\"),\n\t\n\t\tfragmentShader: [\"uniform float opacity;\", \"uniform sampler2D tDiffuse;\", \"varying vec2 vUv;\", \"void main() {\", \"vec4 texel = texture2D( tDiffuse, vUv );\", \"gl_FragColor = opacity * texel;\", \"}\"].join(\"\\n\")\n\t\n\t};\n\t\n\texports[\"default\"] = CopyShader;\n\t\n\t_three2[\"default\"].CopyShader = CopyShader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 39 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t */\n\t\n\tvar ShaderPass = function ShaderPass(shader, textureID) {\n\t\n\t\tthis.textureID = textureID !== undefined ? textureID : \"tDiffuse\";\n\t\n\t\tif (shader instanceof _three2[\"default\"].ShaderMaterial) {\n\t\n\t\t\tthis.uniforms = shader.uniforms;\n\t\n\t\t\tthis.material = shader;\n\t\t} else if (shader) {\n\t\n\t\t\tthis.uniforms = _three2[\"default\"].UniformsUtils.clone(shader.uniforms);\n\t\n\t\t\tthis.material = new _three2[\"default\"].ShaderMaterial({\n\t\n\t\t\t\tdefines: shader.defines || {},\n\t\t\t\tuniforms: this.uniforms,\n\t\t\t\tvertexShader: shader.vertexShader,\n\t\t\t\tfragmentShader: shader.fragmentShader\n\t\n\t\t\t});\n\t\t}\n\t\n\t\tthis.renderToScreen = false;\n\t\n\t\tthis.enabled = true;\n\t\tthis.needsSwap = true;\n\t\tthis.clear = false;\n\t\n\t\tthis.camera = new _three2[\"default\"].OrthographicCamera(-1, 1, 1, -1, 0, 1);\n\t\tthis.scene = new _three2[\"default\"].Scene();\n\t\n\t\tthis.quad = new _three2[\"default\"].Mesh(new _three2[\"default\"].PlaneBufferGeometry(2, 2), null);\n\t\tthis.scene.add(this.quad);\n\t};\n\t\n\tShaderPass.prototype = {\n\t\n\t\trender: function render(renderer, writeBuffer, readBuffer, delta) {\n\t\n\t\t\tif (this.uniforms[this.textureID]) {\n\t\n\t\t\t\tthis.uniforms[this.textureID].value = readBuffer;\n\t\t\t}\n\t\n\t\t\tthis.quad.material = this.material;\n\t\n\t\t\tif (this.renderToScreen) {\n\t\n\t\t\t\trenderer.render(this.scene, this.camera);\n\t\t\t} else {\n\t\n\t\t\t\trenderer.render(this.scene, this.camera, writeBuffer, this.clear);\n\t\t\t}\n\t\t}\n\t\n\t};\n\t\n\texports[\"default\"] = ShaderPass;\n\t\n\t_three2[\"default\"].ShaderPass = ShaderPass;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 40 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t */\n\t\n\tvar MaskPass = function MaskPass(scene, camera) {\n\t\n\t\tthis.scene = scene;\n\t\tthis.camera = camera;\n\t\n\t\tthis.enabled = true;\n\t\tthis.clear = true;\n\t\tthis.needsSwap = false;\n\t\n\t\tthis.inverse = false;\n\t};\n\t\n\tMaskPass.prototype = {\n\t\n\t\trender: function render(renderer, writeBuffer, readBuffer, delta) {\n\t\n\t\t\tvar context = renderer.context;\n\t\n\t\t\t// don't update color or depth\n\t\n\t\t\tcontext.colorMask(false, false, false, false);\n\t\t\tcontext.depthMask(false);\n\t\n\t\t\t// set up stencil\n\t\n\t\t\tvar writeValue, clearValue;\n\t\n\t\t\tif (this.inverse) {\n\t\n\t\t\t\twriteValue = 0;\n\t\t\t\tclearValue = 1;\n\t\t\t} else {\n\t\n\t\t\t\twriteValue = 1;\n\t\t\t\tclearValue = 0;\n\t\t\t}\n\t\n\t\t\tcontext.enable(context.STENCIL_TEST);\n\t\t\tcontext.stencilOp(context.REPLACE, context.REPLACE, context.REPLACE);\n\t\t\tcontext.stencilFunc(context.ALWAYS, writeValue, 0xffffffff);\n\t\t\tcontext.clearStencil(clearValue);\n\t\n\t\t\t// draw into the stencil buffer\n\t\n\t\t\trenderer.render(this.scene, this.camera, readBuffer, this.clear);\n\t\t\trenderer.render(this.scene, this.camera, writeBuffer, this.clear);\n\t\n\t\t\t// re-enable update of color and depth\n\t\n\t\t\tcontext.colorMask(true, true, true, true);\n\t\t\tcontext.depthMask(true);\n\t\n\t\t\t// only render where stencil is set to 1\n\t\n\t\t\tcontext.stencilFunc(context.EQUAL, 1, 0xffffffff); // draw if == 1\n\t\t\tcontext.stencilOp(context.KEEP, context.KEEP, context.KEEP);\n\t\t}\n\t\n\t};\n\t\n\tvar ClearMaskPass = function ClearMaskPass() {\n\t\n\t\tthis.enabled = true;\n\t};\n\t\n\tClearMaskPass.prototype = {\n\t\n\t\trender: function render(renderer, writeBuffer, readBuffer, delta) {\n\t\n\t\t\tvar context = renderer.context;\n\t\n\t\t\tcontext.disable(context.STENCIL_TEST);\n\t\t}\n\t\n\t};\n\t\n\texports['default'] = MaskPass;\n\texports.ClearMaskPass = ClearMaskPass;\n\t\n\t_three2['default'].MaskPass = MaskPass;\n\t_three2['default'].ClearMaskPass = ClearMaskPass;\n\n/***/ },\n/* 41 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t */\n\t\n\tvar RenderPass = function RenderPass(scene, camera, overrideMaterial, clearColor, clearAlpha) {\n\t\n\t\tthis.scene = scene;\n\t\tthis.camera = camera;\n\t\n\t\tthis.overrideMaterial = overrideMaterial;\n\t\n\t\tthis.clearColor = clearColor;\n\t\tthis.clearAlpha = clearAlpha !== undefined ? clearAlpha : 1;\n\t\n\t\tthis.oldClearColor = new _three2['default'].Color();\n\t\tthis.oldClearAlpha = 1;\n\t\n\t\tthis.enabled = true;\n\t\tthis.clear = true;\n\t\tthis.needsSwap = false;\n\t};\n\t\n\tRenderPass.prototype = {\n\t\n\t\trender: function render(renderer, writeBuffer, readBuffer, delta) {\n\t\n\t\t\tthis.scene.overrideMaterial = this.overrideMaterial;\n\t\n\t\t\tif (this.clearColor) {\n\t\n\t\t\t\tthis.oldClearColor.copy(renderer.getClearColor());\n\t\t\t\tthis.oldClearAlpha = renderer.getClearAlpha();\n\t\n\t\t\t\trenderer.setClearColor(this.clearColor, this.clearAlpha);\n\t\t\t}\n\t\n\t\t\trenderer.render(this.scene, this.camera, readBuffer, this.clear);\n\t\n\t\t\tif (this.clearColor) {\n\t\n\t\t\t\trenderer.setClearColor(this.oldClearColor, this.oldClearAlpha);\n\t\t\t}\n\t\n\t\t\tthis.scene.overrideMaterial = null;\n\t\t}\n\t\n\t};\n\t\n\texports['default'] = RenderPass;\n\t\n\t_three2['default'].RenderPass = RenderPass;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 42 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t *\n\t * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position\n\t *\n\t * - 9 samples per pass\n\t * - standard deviation 2.7\n\t * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n\t * - \"r\" parameter control where \"focused\" horizontal line lies\n\t */\n\t\n\tvar HorizontalTiltShiftShader = {\n\t\n\t\tuniforms: {\n\t\n\t\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\t\"h\": { type: \"f\", value: 1.0 / 512.0 },\n\t\t\t\"r\": { type: \"f\", value: 0.35 }\n\t\n\t\t},\n\t\n\t\tvertexShader: [\"varying vec2 vUv;\", \"void main() {\", \"vUv = uv;\", \"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\", \"}\"].join(\"\\n\"),\n\t\n\t\tfragmentShader: [\"uniform sampler2D tDiffuse;\", \"uniform float h;\", \"uniform float r;\", \"varying vec2 vUv;\", \"void main() {\", \"vec4 sum = vec4( 0.0 );\", \"float hh = h * abs( r - vUv.y );\", \"sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;\", \"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;\", \"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;\", \"sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\", \"sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;\", \"sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;\", \"sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;\", \"sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;\", \"gl_FragColor = sum;\", \"}\"].join(\"\\n\")\n\t\n\t};\n\t\n\texports[\"default\"] = HorizontalTiltShiftShader;\n\t\n\t_three2[\"default\"].HorizontalTiltShiftShader = HorizontalTiltShiftShader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 43 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t *\n\t * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position\n\t *\n\t * - 9 samples per pass\n\t * - standard deviation 2.7\n\t * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n\t * - \"r\" parameter control where \"focused\" horizontal line lies\n\t */\n\t\n\tvar VerticalTiltShiftShader = {\n\t\n\t\tuniforms: {\n\t\n\t\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\t\"v\": { type: \"f\", value: 1.0 / 512.0 },\n\t\t\t\"r\": { type: \"f\", value: 0.35 }\n\t\n\t\t},\n\t\n\t\tvertexShader: [\"varying vec2 vUv;\", \"void main() {\", \"vUv = uv;\", \"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\", \"}\"].join(\"\\n\"),\n\t\n\t\tfragmentShader: [\"uniform sampler2D tDiffuse;\", \"uniform float v;\", \"uniform float r;\", \"varying vec2 vUv;\", \"void main() {\", \"vec4 sum = vec4( 0.0 );\", \"float vv = v * abs( r - vUv.y );\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;\", \"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;\", \"gl_FragColor = sum;\", \"}\"].join(\"\\n\")\n\t\n\t};\n\t\n\texports[\"default\"] = VerticalTiltShiftShader;\n\t\n\t_three2[\"default\"].VerticalTiltShiftShader = VerticalTiltShiftShader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 44 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, \"__esModule\", {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author alteredq / http://alteredqualia.com/\n\t * @author davidedc / http://www.sketchpatch.net/\n\t *\n\t * NVIDIA FXAA by Timothy Lottes\n\t * http://timothylottes.blogspot.com/2011/06/fxaa3-source-released.html\n\t * - WebGL port by @supereggbert\n\t * http://www.glge.org/demos/fxaa/\n\t */\n\t\n\tvar FXAAShader = {\n\t\n\t\tuniforms: {\n\t\n\t\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\t\"resolution\": { type: \"v2\", value: new _three2[\"default\"].Vector2(1 / 1024, 1 / 512) }\n\t\n\t\t},\n\t\n\t\tvertexShader: [\"void main() {\", \"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\", \"}\"].join(\"\\n\"),\n\t\n\t\tfragmentShader: [\"uniform sampler2D tDiffuse;\", \"uniform vec2 resolution;\", \"#define FXAA_REDUCE_MIN (1.0/128.0)\", \"#define FXAA_REDUCE_MUL (1.0/8.0)\", \"#define FXAA_SPAN_MAX 8.0\", \"void main() {\", \"vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;\", \"vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;\", \"vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;\", \"vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;\", \"vec4 rgbaM = texture2D( tDiffuse, gl_FragCoord.xy * resolution );\", \"vec3 rgbM = rgbaM.xyz;\", \"vec3 luma = vec3( 0.299, 0.587, 0.114 );\", \"float lumaNW = dot( rgbNW, luma );\", \"float lumaNE = dot( rgbNE, luma );\", \"float lumaSW = dot( rgbSW, luma );\", \"float lumaSE = dot( rgbSE, luma );\", \"float lumaM = dot( rgbM, luma );\", \"float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\", \"float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\", \"vec2 dir;\", \"dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\", \"dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\", \"float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\", \"float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\", \"dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\", \"max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\", \"dir * rcpDirMin)) * resolution;\", \"vec4 rgbA = (1.0/2.0) * (\", \"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (1.0/3.0 - 0.5)) +\", \"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (2.0/3.0 - 0.5)));\", \"vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (\", \"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (0.0/3.0 - 0.5)) +\", \"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (3.0/3.0 - 0.5)));\", \"float lumaB = dot(rgbB, vec4(luma, 0.0));\", \"if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {\", \"gl_FragColor = rgbA;\", \"} else {\", \"gl_FragColor = rgbB;\", \"}\", \"}\"].join(\"\\n\")\n\t\n\t};\n\t\n\texports[\"default\"] = FXAAShader;\n\t\n\t_three2[\"default\"].FXAAShader = FXAAShader;\n\tmodule.exports = exports[\"default\"];\n\n/***/ },\n/* 45 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Layer2 = __webpack_require__(46);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Skybox = __webpack_require__(47);\n\t\n\tvar _Skybox2 = _interopRequireDefault(_Skybox);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\tvar EnvironmentLayer = (function (_Layer) {\n\t _inherits(EnvironmentLayer, _Layer);\n\t\n\t function EnvironmentLayer(options) {\n\t _classCallCheck(this, EnvironmentLayer);\n\t\n\t var defaults = {\n\t skybox: false\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(EnvironmentLayer.prototype), 'constructor', this).call(this, _options);\n\t }\n\t\n\t _createClass(EnvironmentLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd() {\n\t this._initLights();\n\t\n\t if (this._options.skybox) {\n\t this._initSkybox();\n\t }\n\t\n\t // this._initGrid();\n\t }\n\t\n\t // Not fleshed out or thought through yet\n\t //\n\t // Lights could potentially be put it their own 'layer' to keep this class\n\t // much simpler and less messy\n\t }, {\n\t key: '_initLights',\n\t value: function _initLights() {\n\t // Position doesn't really matter (the angle is important), however it's\n\t // used here so the helpers look more natural.\n\t\n\t if (!this._options.skybox) {\n\t var directionalLight = new _three2['default'].DirectionalLight(0xffffff, 1);\n\t directionalLight.position.x = 1000;\n\t directionalLight.position.y = 1000;\n\t directionalLight.position.z = 1000;\n\t\n\t // TODO: Get shadows working in non-PBR scenes\n\t\n\t // directionalLight.castShadow = true;\n\t //\n\t // var d = 100;\n\t // directionalLight.shadow.camera.left = -d;\n\t // directionalLight.shadow.camera.right = d;\n\t // directionalLight.shadow.camera.top = d;\n\t // directionalLight.shadow.camera.bottom = -d;\n\t //\n\t // directionalLight.shadow.camera.near = 10;\n\t // directionalLight.shadow.camera.far = 100;\n\t //\n\t // // TODO: Need to dial in on a good shadowmap size\n\t // directionalLight.shadow.mapSize.width = 2048;\n\t // directionalLight.shadow.mapSize.height = 2048;\n\t //\n\t // // directionalLight.shadowBias = -0.0010;\n\t // // directionalLight.shadow.darkness = 0.15;\n\t\n\t var directionalLight2 = new _three2['default'].DirectionalLight(0xffffff, 0.5);\n\t directionalLight2.position.x = -1000;\n\t directionalLight2.position.y = 1000;\n\t directionalLight2.position.z = -1000;\n\t\n\t // var helper = new THREE.DirectionalLightHelper(directionalLight, 10);\n\t // var helper2 = new THREE.DirectionalLightHelper(directionalLight2, 10);\n\t\n\t this.add(directionalLight);\n\t this.add(directionalLight2);\n\t\n\t // this.add(helper);\n\t // this.add(helper2);\n\t } else {\n\t // Directional light that will be projected from the sun\n\t this._skyboxLight = new _three2['default'].DirectionalLight(0xffffff, 1);\n\t\n\t this._skyboxLight.castShadow = true;\n\t\n\t var d = 1000;\n\t this._skyboxLight.shadow.camera.left = -d;\n\t this._skyboxLight.shadow.camera.right = d;\n\t this._skyboxLight.shadow.camera.top = d;\n\t this._skyboxLight.shadow.camera.bottom = -d;\n\t\n\t this._skyboxLight.shadow.camera.near = 10000;\n\t this._skyboxLight.shadow.camera.far = 70000;\n\t\n\t // TODO: Need to dial in on a good shadowmap size\n\t this._skyboxLight.shadow.mapSize.width = 2048;\n\t this._skyboxLight.shadow.mapSize.height = 2048;\n\t\n\t // this._skyboxLight.shadowBias = -0.0010;\n\t // this._skyboxLight.shadow.darkness = 0.15;\n\t\n\t // this._object3D.add(new THREE.CameraHelper(this._skyboxLight.shadow.camera));\n\t\n\t this.add(this._skyboxLight);\n\t }\n\t }\n\t }, {\n\t key: '_initSkybox',\n\t value: function _initSkybox() {\n\t this._skybox = new _Skybox2['default'](this._world, this._skyboxLight);\n\t this.add(this._skybox._mesh);\n\t }\n\t\n\t // Add grid helper for context during initial development\n\t }, {\n\t key: '_initGrid',\n\t value: function _initGrid() {\n\t var size = 4000;\n\t var step = 100;\n\t\n\t var gridHelper = new _three2['default'].GridHelper(size, step);\n\t this.add(gridHelper);\n\t }\n\t\n\t // Clean up environment\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._skyboxLight = null;\n\t\n\t this.remove(this._skybox._mesh);\n\t this._skybox.destroy();\n\t this._skybox = null;\n\t\n\t _get(Object.getPrototypeOf(EnvironmentLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return EnvironmentLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = EnvironmentLayer;\n\t\n\tvar noNew = function noNew(options) {\n\t return new EnvironmentLayer(options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.environmentLayer = noNew;\n\n/***/ },\n/* 46 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _engineScene = __webpack_require__(25);\n\t\n\tvar _engineScene2 = _interopRequireDefault(_engineScene);\n\t\n\tvar _vendorCSS3DRenderer = __webpack_require__(30);\n\t\n\tvar _vendorCSS2DRenderer = __webpack_require__(32);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Need a single move method that handles moving all the various object\n\t// layers so that the DOM layers stay in sync with the 3D layer\n\t\n\t// TODO: Double check that objects within the _object3D Object3D parent are frustum\n\t// culled even if the layer position stays at the default (0,0,0) and the child\n\t// objects are positioned much further away\n\t//\n\t// Or does the layer being at (0,0,0) prevent the child objects from being\n\t// culled because the layer parent is effectively always in view even if the\n\t// child is actually out of camera\n\t\n\tvar Layer = (function (_EventEmitter) {\n\t _inherits(Layer, _EventEmitter);\n\t\n\t function Layer(options) {\n\t _classCallCheck(this, Layer);\n\t\n\t _get(Object.getPrototypeOf(Layer.prototype), 'constructor', this).call(this);\n\t\n\t var defaults = {\n\t output: true,\n\t outputToScene: true\n\t };\n\t\n\t this._options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t if (this.isOutput()) {\n\t this._object3D = new _three2['default'].Object3D();\n\t\n\t this._dom3D = document.createElement('div');\n\t this._domObject3D = new _vendorCSS3DRenderer.CSS3DObject(this._dom3D);\n\t\n\t this._dom2D = document.createElement('div');\n\t this._domObject2D = new _vendorCSS2DRenderer.CSS2DObject(this._dom2D);\n\t }\n\t }\n\t\n\t // Add THREE object directly to layer\n\t\n\t _createClass(Layer, [{\n\t key: 'add',\n\t value: function add(object) {\n\t this._object3D.add(object);\n\t }\n\t\n\t // Remove THREE object from to layer\n\t }, {\n\t key: 'remove',\n\t value: function remove(object) {\n\t this._object3D.remove(object);\n\t }\n\t }, {\n\t key: 'addDOM3D',\n\t value: function addDOM3D(object) {\n\t this._domObject3D.add(object);\n\t }\n\t }, {\n\t key: 'removeDOM3D',\n\t value: function removeDOM3D(object) {\n\t this._domObject3D.remove(object);\n\t }\n\t }, {\n\t key: 'addDOM2D',\n\t value: function addDOM2D(object) {\n\t this._domObject2D.add(object);\n\t }\n\t }, {\n\t key: 'removeDOM2D',\n\t value: function removeDOM2D(object) {\n\t this._domObject2D.remove(object);\n\t }\n\t\n\t // Add layer to world instance and store world reference\n\t }, {\n\t key: 'addTo',\n\t value: function addTo(world) {\n\t world.addLayer(this);\n\t return this;\n\t }\n\t\n\t // Internal method called by World.addLayer to actually add the layer\n\t }, {\n\t key: '_addToWorld',\n\t value: function _addToWorld(world) {\n\t this._world = world;\n\t this._onAdd(world);\n\t this.emit('added');\n\t }\n\t }, {\n\t key: '_onAdd',\n\t value: function _onAdd(world) {}\n\t }, {\n\t key: 'getPickingId',\n\t value: function getPickingId() {\n\t if (this._world._engine._picking) {\n\t return this._world._engine._picking.getNextId();\n\t }\n\t\n\t return false;\n\t }\n\t\n\t // TODO: Tidy this up and don't access so many private properties to work\n\t }, {\n\t key: 'addToPicking',\n\t value: function addToPicking(object) {\n\t if (!this._world._engine._picking) {\n\t return;\n\t }\n\t\n\t this._world._engine._picking.add(object);\n\t }\n\t }, {\n\t key: 'removeFromPicking',\n\t value: function removeFromPicking(object) {\n\t if (!this._world._engine._picking) {\n\t return;\n\t }\n\t\n\t this._world._engine._picking.remove(object);\n\t }\n\t }, {\n\t key: 'isOutput',\n\t value: function isOutput() {\n\t return this._options.output;\n\t }\n\t }, {\n\t key: 'isOutputToScene',\n\t value: function isOutputToScene() {\n\t return this._options.outputToScene;\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._object3D && this._object3D.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._object3D.children.length - 1; i >= 0; i--) {\n\t child = this._object3D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this.remove(child);\n\t\n\t if (child.geometry) {\n\t // Dispose of mesh and materials\n\t child.geometry.dispose();\n\t child.geometry = null;\n\t }\n\t\n\t if (child.material) {\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t }\n\t }\n\t }\n\t\n\t if (this._domObject3D && this._domObject3D.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._domObject3D.children.length - 1; i >= 0; i--) {\n\t child = this._domObject3D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this.removeDOM3D(child);\n\t }\n\t }\n\t\n\t if (this._domObject2D && this._domObject2D.children) {\n\t // Remove everything else in the layer\n\t var child;\n\t for (var i = this._domObject2D.children.length - 1; i >= 0; i--) {\n\t child = this._domObject2D.children[i];\n\t\n\t if (!child) {\n\t continue;\n\t }\n\t\n\t this.removeDOM2D(child);\n\t }\n\t }\n\t\n\t this._domObject3D = null;\n\t this._domObject2D = null;\n\t\n\t this._world = null;\n\t this._object3D = null;\n\t }\n\t }]);\n\t\n\t return Layer;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = Layer;\n\t\n\tvar noNew = function noNew(options) {\n\t return new Layer(options);\n\t};\n\t\n\texports.layer = noNew;\n\n/***/ },\n/* 47 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _Sky = __webpack_require__(48);\n\t\n\tvar _Sky2 = _interopRequireDefault(_Sky);\n\t\n\tvar _lodashThrottle = __webpack_require__(49);\n\t\n\tvar _lodashThrottle2 = _interopRequireDefault(_lodashThrottle);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\tvar cubemap = {\n\t vertexShader: ['varying vec3 vPosition;', 'void main() {', 'vPosition = position;', 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\\n'),\n\t\n\t fragmentShader: ['uniform samplerCube cubemap;', 'varying vec3 vPosition;', 'void main() {', 'gl_FragColor = textureCube(cubemap, normalize(vPosition));', '}'].join('\\n')\n\t};\n\t\n\tvar Skybox = (function () {\n\t function Skybox(world, light) {\n\t _classCallCheck(this, Skybox);\n\t\n\t this._world = world;\n\t this._light = light;\n\t\n\t this._settings = {\n\t distance: 38000,\n\t turbidity: 10,\n\t reileigh: 2,\n\t mieCoefficient: 0.005,\n\t mieDirectionalG: 0.8,\n\t luminance: 1,\n\t // 0.48 is a cracking dusk / sunset\n\t // 0.4 is a beautiful early-morning / late-afternoon\n\t // 0.2 is a nice day time\n\t inclination: 0.48, // Elevation / inclination\n\t azimuth: 0.25 };\n\t\n\t // Facing front\n\t this._initSkybox();\n\t this._updateUniforms();\n\t this._initEvents();\n\t }\n\t\n\t _createClass(Skybox, [{\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t // Throttled to 1 per 100ms\n\t this._throttledWorldUpdate = (0, _lodashThrottle2['default'])(this._update, 100);\n\t this._world.on('preUpdate', this._throttledWorldUpdate, this);\n\t }\n\t }, {\n\t key: '_initSkybox',\n\t value: function _initSkybox() {\n\t // Cube camera for skybox\n\t this._cubeCamera = new _three2['default'].CubeCamera(1, 2000000, 128);\n\t\n\t // Cube material\n\t var cubeTarget = this._cubeCamera.renderTarget;\n\t\n\t // Add Sky Mesh\n\t this._sky = new _Sky2['default']();\n\t this._skyScene = new _three2['default'].Scene();\n\t this._skyScene.add(this._sky.mesh);\n\t\n\t // Add Sun Helper\n\t this._sunSphere = new _three2['default'].Mesh(new _three2['default'].SphereBufferGeometry(2000, 16, 8), new _three2['default'].MeshBasicMaterial({\n\t color: 0xffffff\n\t }));\n\t\n\t // TODO: This isn't actually visible because it's not added to the layer\n\t // this._sunSphere.visible = true;\n\t\n\t var skyboxUniforms = {\n\t cubemap: { type: 't', value: cubeTarget }\n\t };\n\t\n\t var skyboxMat = new _three2['default'].ShaderMaterial({\n\t uniforms: skyboxUniforms,\n\t vertexShader: cubemap.vertexShader,\n\t fragmentShader: cubemap.fragmentShader,\n\t side: _three2['default'].BackSide\n\t });\n\t\n\t this._mesh = new _three2['default'].Mesh(new _three2['default'].BoxGeometry(190000, 190000, 190000), skyboxMat);\n\t\n\t this._updateSkybox = true;\n\t }\n\t }, {\n\t key: '_updateUniforms',\n\t value: function _updateUniforms() {\n\t var settings = this._settings;\n\t var uniforms = this._sky.uniforms;\n\t uniforms.turbidity.value = settings.turbidity;\n\t uniforms.reileigh.value = settings.reileigh;\n\t uniforms.luminance.value = settings.luminance;\n\t uniforms.mieCoefficient.value = settings.mieCoefficient;\n\t uniforms.mieDirectionalG.value = settings.mieDirectionalG;\n\t\n\t var theta = Math.PI * (settings.inclination - 0.5);\n\t var phi = 2 * Math.PI * (settings.azimuth - 0.5);\n\t\n\t this._sunSphere.position.x = settings.distance * Math.cos(phi);\n\t this._sunSphere.position.y = settings.distance * Math.sin(phi) * Math.sin(theta);\n\t this._sunSphere.position.z = settings.distance * Math.sin(phi) * Math.cos(theta);\n\t\n\t // Move directional light to sun position\n\t this._light.position.copy(this._sunSphere.position);\n\t\n\t this._sky.uniforms.sunPosition.value.copy(this._sunSphere.position);\n\t }\n\t }, {\n\t key: '_update',\n\t value: function _update(delta) {\n\t if (this._updateSkybox) {\n\t this._updateSkybox = false;\n\t } else {\n\t return;\n\t }\n\t\n\t // if (!this._angle) {\n\t // this._angle = 0;\n\t // }\n\t //\n\t // // Animate inclination\n\t // this._angle += Math.PI * delta;\n\t // this._settings.inclination = 0.5 * (Math.sin(this._angle) / 2 + 0.5);\n\t\n\t // Update light intensity depending on elevation of sun (day to night)\n\t this._light.intensity = 1 - 0.95 * (this._settings.inclination / 0.5);\n\t\n\t // // console.log(delta, this._angle, this._settings.inclination);\n\t //\n\t // TODO: Only do this when the uniforms have been changed\n\t this._updateUniforms();\n\t\n\t // TODO: Only do this when the cubemap has actually changed\n\t this._cubeCamera.updateCubeMap(this._world._engine._renderer, this._skyScene);\n\t }\n\t }, {\n\t key: 'getRenderTarget',\n\t value: function getRenderTarget() {\n\t return this._cubeCamera.renderTarget;\n\t }\n\t }, {\n\t key: 'setInclination',\n\t value: function setInclination(inclination) {\n\t this._settings.inclination = inclination;\n\t this._updateSkybox = true;\n\t }\n\t\n\t // Destroy the skybox and remove it from memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._world.off('preUpdate', this._throttledWorldUpdate);\n\t this._throttledWorldUpdate = null;\n\t\n\t this._world = null;\n\t this._light = null;\n\t\n\t this._cubeCamera = null;\n\t\n\t this._sky.mesh.geometry.dispose();\n\t this._sky.mesh.geometry = null;\n\t\n\t if (this._sky.mesh.material.map) {\n\t this._sky.mesh.material.map.dispose();\n\t this._sky.mesh.material.map = null;\n\t }\n\t\n\t this._sky.mesh.material.dispose();\n\t this._sky.mesh.material = null;\n\t\n\t this._sky.mesh = null;\n\t this._sky = null;\n\t\n\t this._skyScene = null;\n\t\n\t this._sunSphere.geometry.dispose();\n\t this._sunSphere.geometry = null;\n\t\n\t if (this._sunSphere.material.map) {\n\t this._sunSphere.material.map.dispose();\n\t this._sunSphere.material.map = null;\n\t }\n\t\n\t this._sunSphere.material.dispose();\n\t this._sunSphere.material = null;\n\t\n\t this._sunSphere = null;\n\t\n\t this._mesh.geometry.dispose();\n\t this._mesh.geometry = null;\n\t\n\t if (this._mesh.material.map) {\n\t this._mesh.material.map.dispose();\n\t this._mesh.material.map = null;\n\t }\n\t\n\t this._mesh.material.dispose();\n\t this._mesh.material = null;\n\t }\n\t }]);\n\t\n\t return Skybox;\n\t})();\n\t\n\texports['default'] = Skybox;\n\t\n\tvar noNew = function noNew(world, light) {\n\t return new Skybox(world, light);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.skybox = noNew;\n\n/***/ },\n/* 48 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/*eslint eqeqeq:0*/\n\t\n\t/**\n\t * @author zz85 / https://github.com/zz85\n\t *\n\t * Based on 'A Practical Analytic Model for Daylight'\n\t * aka The Preetham Model, the de facto standard analytic skydome model\n\t * http://www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf\n\t *\n\t * First implemented by Simon Wallner\n\t * http://www.simonwallner.at/projects/atmospheric-scattering\n\t *\n\t * Improved by Martin Upitis\n\t * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n\t *\n\t * Three.js integration by zz85 http://twitter.com/blurspline\n\t*/\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t_three2['default'].ShaderLib['sky'] = {\n\t\n\t\tuniforms: {\n\t\n\t\t\tluminance: { type: 'f', value: 1 },\n\t\t\tturbidity: { type: 'f', value: 2 },\n\t\t\treileigh: { type: 'f', value: 1 },\n\t\t\tmieCoefficient: { type: 'f', value: 0.005 },\n\t\t\tmieDirectionalG: { type: 'f', value: 0.8 },\n\t\t\tsunPosition: { type: 'v3', value: new _three2['default'].Vector3() }\n\t\n\t\t},\n\t\n\t\tvertexShader: ['varying vec3 vWorldPosition;', 'void main() {', 'vec4 worldPosition = modelMatrix * vec4( position, 1.0 );', 'vWorldPosition = worldPosition.xyz;', 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\\n'),\n\t\n\t\tfragmentShader: ['uniform sampler2D skySampler;', 'uniform vec3 sunPosition;', 'varying vec3 vWorldPosition;', 'vec3 cameraPos = vec3(0., 0., 0.);', '// uniform sampler2D sDiffuse;', '// const float turbidity = 10.0; //', '// const float reileigh = 2.; //', '// const float luminance = 1.0; //', '// const float mieCoefficient = 0.005;', '// const float mieDirectionalG = 0.8;', 'uniform float luminance;', 'uniform float turbidity;', 'uniform float reileigh;', 'uniform float mieCoefficient;', 'uniform float mieDirectionalG;', '// constants for atmospheric scattering', 'const float e = 2.71828182845904523536028747135266249775724709369995957;', 'const float pi = 3.141592653589793238462643383279502884197169;', 'const float n = 1.0003; // refractive index of air', 'const float N = 2.545E25; // number of molecules per unit volume for air at', '// 288.15K and 1013mb (sea level -45 celsius)', 'const float pn = 0.035;\t// depolatization factor for standard air', '// wavelength of used primaries, according to preetham', 'const vec3 lambda = vec3(680E-9, 550E-9, 450E-9);', '// mie stuff', '// K coefficient for the primaries', 'const vec3 K = vec3(0.686, 0.678, 0.666);', 'const float v = 4.0;', '// optical length at zenith for molecules', 'const float rayleighZenithLength = 8.4E3;', 'const float mieZenithLength = 1.25E3;', 'const vec3 up = vec3(0.0, 1.0, 0.0);', 'const float EE = 1000.0;', 'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;', '// 66 arc seconds -> degrees, and the cosine of that', '// earth shadow hack', 'const float cutoffAngle = pi/1.95;', 'const float steepness = 1.5;', 'vec3 totalRayleigh(vec3 lambda)', '{', 'return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));', '}',\n\t\n\t\t// see http://blenderartists.org/forum/showthread.php?321110-Shaders-and-Skybox-madness\n\t\t'// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE', 'vec3 simplifiedRayleigh()', '{', 'return 0.0005 / vec3(94, 40, 18);',\n\t\t// return 0.00054532832366 / (3.0 * 2.545E25 * pow(vec3(680E-9, 550E-9, 450E-9), vec3(4.0)) * 6.245);\n\t\t'}', 'float rayleighPhase(float cosTheta)', '{\t ', 'return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));', '//\treturn (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));', '//\treturn (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));', '}', 'vec3 totalMie(vec3 lambda, vec3 K, float T)', '{', 'float c = (0.2 * T ) * 10E-18;', 'return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;', '}', 'float hgPhase(float cosTheta, float g)', '{', 'return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));', '}', 'float sunIntensity(float zenithAngleCos)', '{', 'return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));', '}', '// float logLuminance(vec3 c)', '// {', '// \treturn log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);', '// }', '// Filmic ToneMapping http://filmicgames.com/archives/75', 'float A = 0.15;', 'float B = 0.50;', 'float C = 0.10;', 'float D = 0.20;', 'float E = 0.02;', 'float F = 0.30;', 'float W = 1000.0;', 'vec3 Uncharted2Tonemap(vec3 x)', '{', 'return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;', '}', 'void main() ', '{', 'float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);', '// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;', '// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);', 'float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));', 'vec3 sunDirection = normalize(sunPosition);', 'float sunE = sunIntensity(dot(sunDirection, up));', '// extinction (absorbtion + out scattering) ', '// rayleigh coefficients',\n\t\n\t\t// 'vec3 betaR = totalRayleigh(lambda) * reileighCoefficient;',\n\t\t'vec3 betaR = simplifiedRayleigh() * reileighCoefficient;', '// mie coefficients', 'vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;', '// optical length', '// cutoff angle at 90 to avoid singularity in next formula.', 'float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));', 'float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));', 'float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));', '// combined extinction factor\t', 'vec3 Fex = exp(-(betaR * sR + betaM * sM));', '// in scattering', 'float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);', 'float rPhase = rayleighPhase(cosTheta*0.5+0.5);', 'vec3 betaRTheta = betaR * rPhase;', 'float mPhase = hgPhase(cosTheta, mieDirectionalG);', 'vec3 betaMTheta = betaM * mPhase;', 'vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));', 'Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));', '//nightsky', 'vec3 direction = normalize(vWorldPosition - cameraPos);', 'float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]', 'float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]', 'vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);', '// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;', 'vec3 L0 = vec3(0.1) * Fex;', '// composition + solar disc', '//if (cosTheta > sunAngularDiameterCos)', 'float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);', '// if (normalize(vWorldPosition - cameraPos).y>0.0)', 'L0 += (sunE * 19000.0 * Fex)*sundisk;', 'vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));', 'vec3 texColor = (Lin+L0); ', 'texColor *= 0.04 ;', 'texColor += vec3(0.0,0.001,0.0025)*0.3;', 'float g_fMaxLuminance = 1.0;', 'float fLumScaled = 0.1 / luminance; ', 'float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ', 'float ExposureBias = fLumCompressed;', 'vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);', 'vec3 color = curr*whiteScale;', 'vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));', 'gl_FragColor.rgb = retColor;', 'gl_FragColor.a = 1.0;', '}'].join('\\n')\n\t\n\t};\n\t\n\tvar Sky = function Sky() {\n\t\n\t\tvar skyShader = _three2['default'].ShaderLib['sky'];\n\t\tvar skyUniforms = _three2['default'].UniformsUtils.clone(skyShader.uniforms);\n\t\n\t\tvar skyMat = new _three2['default'].ShaderMaterial({\n\t\t\tfragmentShader: skyShader.fragmentShader,\n\t\t\tvertexShader: skyShader.vertexShader,\n\t\t\tuniforms: skyUniforms,\n\t\t\tside: _three2['default'].BackSide\n\t\t});\n\t\n\t\tvar skyGeo = new _three2['default'].SphereBufferGeometry(450000, 32, 15);\n\t\tvar skyMesh = new _three2['default'].Mesh(skyGeo, skyMat);\n\t\n\t\t// Expose variables\n\t\tthis.mesh = skyMesh;\n\t\tthis.uniforms = skyUniforms;\n\t};\n\t\n\texports['default'] = Sky;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 49 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * lodash 4.0.0 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\tvar debounce = __webpack_require__(50);\n\t\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/**\n\t * Creates a throttled function that only invokes `func` at most once per\n\t * every `wait` milliseconds. The throttled function comes with a `cancel`\n\t * method to cancel delayed `func` invocations and a `flush` method to\n\t * immediately invoke them. Provide an options object to indicate whether\n\t * `func` should be invoked on the leading and/or trailing edge of the `wait`\n\t * timeout. The `func` is invoked with the last arguments provided to the\n\t * throttled function. Subsequent calls to the throttled function return the\n\t * result of the last `func` invocation.\n\t *\n\t * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n\t * on the trailing edge of the timeout only if the the throttled function is\n\t * invoked more than once during the `wait` timeout.\n\t *\n\t * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n\t * for details over the differences between `_.throttle` and `_.debounce`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to throttle.\n\t * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n\t * @param {Object} [options] The options object.\n\t * @param {boolean} [options.leading=true] Specify invoking on the leading\n\t * edge of the timeout.\n\t * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n\t * edge of the timeout.\n\t * @returns {Function} Returns the new throttled function.\n\t * @example\n\t *\n\t * // avoid excessively updating the position while scrolling\n\t * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n\t *\n\t * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes\n\t * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n\t * jQuery(element).on('click', throttled);\n\t *\n\t * // cancel a trailing throttled invocation\n\t * jQuery(window).on('popstate', throttled.cancel);\n\t */\n\tfunction throttle(func, wait, options) {\n\t var leading = true,\n\t trailing = true;\n\t\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t if (isObject(options)) {\n\t leading = 'leading' in options ? !!options.leading : leading;\n\t trailing = 'trailing' in options ? !!options.trailing : trailing;\n\t }\n\t return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing });\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t // Avoid a V8 JIT bug in Chrome 19-20.\n\t // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\tmodule.exports = throttle;\n\n\n/***/ },\n/* 50 */\n/***/ function(module, exports) {\n\n\t/**\n\t * lodash 4.0.1 (Custom Build) \n\t * Build: `lodash modularize exports=\"npm\" -o ./`\n\t * Copyright 2012-2016 The Dojo Foundation \n\t * Based on Underscore.js 1.8.3 \n\t * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t * Available under MIT license \n\t */\n\t\n\t/** Used as the `TypeError` message for \"Functions\" methods. */\n\tvar FUNC_ERROR_TEXT = 'Expected a function';\n\t\n\t/** Used as references for various `Number` constants. */\n\tvar NAN = 0 / 0;\n\t\n\t/** `Object#toString` result references. */\n\tvar funcTag = '[object Function]',\n\t genTag = '[object GeneratorFunction]';\n\t\n\t/** Used to match leading and trailing whitespace. */\n\tvar reTrim = /^\\s+|\\s+$/g;\n\t\n\t/** Used to detect bad signed hexadecimal string values. */\n\tvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\t\n\t/** Used to detect binary string values. */\n\tvar reIsBinary = /^0b[01]+$/i;\n\t\n\t/** Used to detect octal string values. */\n\tvar reIsOctal = /^0o[0-7]+$/i;\n\t\n\t/** Built-in method references without a dependency on `root`. */\n\tvar freeParseInt = parseInt;\n\t\n\t/** Used for built-in method references. */\n\tvar objectProto = Object.prototype;\n\t\n\t/**\n\t * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n\t * of values.\n\t */\n\tvar objectToString = objectProto.toString;\n\t\n\t/* Built-in method references for those with the same name as other `lodash` methods. */\n\tvar nativeMax = Math.max;\n\t\n\t/**\n\t * Gets the timestamp of the number of milliseconds that have elapsed since\n\t * the Unix epoch (1 January 1970 00:00:00 UTC).\n\t *\n\t * @static\n\t * @memberOf _\n\t * @type Function\n\t * @category Date\n\t * @returns {number} Returns the timestamp.\n\t * @example\n\t *\n\t * _.defer(function(stamp) {\n\t * console.log(_.now() - stamp);\n\t * }, _.now());\n\t * // => logs the number of milliseconds it took for the deferred function to be invoked\n\t */\n\tvar now = Date.now;\n\t\n\t/**\n\t * Creates a debounced function that delays invoking `func` until after `wait`\n\t * milliseconds have elapsed since the last time the debounced function was\n\t * invoked. The debounced function comes with a `cancel` method to cancel\n\t * delayed `func` invocations and a `flush` method to immediately invoke them.\n\t * Provide an options object to indicate whether `func` should be invoked on\n\t * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n\t * with the last arguments provided to the debounced function. Subsequent calls\n\t * to the debounced function return the result of the last `func` invocation.\n\t *\n\t * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n\t * on the trailing edge of the timeout only if the the debounced function is\n\t * invoked more than once during the `wait` timeout.\n\t *\n\t * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n\t * for details over the differences between `_.debounce` and `_.throttle`.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Function\n\t * @param {Function} func The function to debounce.\n\t * @param {number} [wait=0] The number of milliseconds to delay.\n\t * @param {Object} [options] The options object.\n\t * @param {boolean} [options.leading=false] Specify invoking on the leading\n\t * edge of the timeout.\n\t * @param {number} [options.maxWait] The maximum time `func` is allowed to be\n\t * delayed before it's invoked.\n\t * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n\t * edge of the timeout.\n\t * @returns {Function} Returns the new debounced function.\n\t * @example\n\t *\n\t * // Avoid costly calculations while the window size is in flux.\n\t * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n\t *\n\t * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n\t * jQuery(element).on('click', _.debounce(sendMail, 300, {\n\t * 'leading': true,\n\t * 'trailing': false\n\t * }));\n\t *\n\t * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n\t * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n\t * var source = new EventSource('/stream');\n\t * jQuery(source).on('message', debounced);\n\t *\n\t * // Cancel the trailing debounced invocation.\n\t * jQuery(window).on('popstate', debounced.cancel);\n\t */\n\tfunction debounce(func, wait, options) {\n\t var args,\n\t maxTimeoutId,\n\t result,\n\t stamp,\n\t thisArg,\n\t timeoutId,\n\t trailingCall,\n\t lastCalled = 0,\n\t leading = false,\n\t maxWait = false,\n\t trailing = true;\n\t\n\t if (typeof func != 'function') {\n\t throw new TypeError(FUNC_ERROR_TEXT);\n\t }\n\t wait = toNumber(wait) || 0;\n\t if (isObject(options)) {\n\t leading = !!options.leading;\n\t maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait);\n\t trailing = 'trailing' in options ? !!options.trailing : trailing;\n\t }\n\t\n\t function cancel() {\n\t if (timeoutId) {\n\t clearTimeout(timeoutId);\n\t }\n\t if (maxTimeoutId) {\n\t clearTimeout(maxTimeoutId);\n\t }\n\t lastCalled = 0;\n\t args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined;\n\t }\n\t\n\t function complete(isCalled, id) {\n\t if (id) {\n\t clearTimeout(id);\n\t }\n\t maxTimeoutId = timeoutId = trailingCall = undefined;\n\t if (isCalled) {\n\t lastCalled = now();\n\t result = func.apply(thisArg, args);\n\t if (!timeoutId && !maxTimeoutId) {\n\t args = thisArg = undefined;\n\t }\n\t }\n\t }\n\t\n\t function delayed() {\n\t var remaining = wait - (now() - stamp);\n\t if (remaining <= 0 || remaining > wait) {\n\t complete(trailingCall, maxTimeoutId);\n\t } else {\n\t timeoutId = setTimeout(delayed, remaining);\n\t }\n\t }\n\t\n\t function flush() {\n\t if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) {\n\t result = func.apply(thisArg, args);\n\t }\n\t cancel();\n\t return result;\n\t }\n\t\n\t function maxDelayed() {\n\t complete(trailing, timeoutId);\n\t }\n\t\n\t function debounced() {\n\t args = arguments;\n\t stamp = now();\n\t thisArg = this;\n\t trailingCall = trailing && (timeoutId || !leading);\n\t\n\t if (maxWait === false) {\n\t var leadingCall = leading && !timeoutId;\n\t } else {\n\t if (!maxTimeoutId && !leading) {\n\t lastCalled = stamp;\n\t }\n\t var remaining = maxWait - (stamp - lastCalled),\n\t isCalled = remaining <= 0 || remaining > maxWait;\n\t\n\t if (isCalled) {\n\t if (maxTimeoutId) {\n\t maxTimeoutId = clearTimeout(maxTimeoutId);\n\t }\n\t lastCalled = stamp;\n\t result = func.apply(thisArg, args);\n\t }\n\t else if (!maxTimeoutId) {\n\t maxTimeoutId = setTimeout(maxDelayed, remaining);\n\t }\n\t }\n\t if (isCalled && timeoutId) {\n\t timeoutId = clearTimeout(timeoutId);\n\t }\n\t else if (!timeoutId && wait !== maxWait) {\n\t timeoutId = setTimeout(delayed, wait);\n\t }\n\t if (leadingCall) {\n\t isCalled = true;\n\t result = func.apply(thisArg, args);\n\t }\n\t if (isCalled && !timeoutId && !maxTimeoutId) {\n\t args = thisArg = undefined;\n\t }\n\t return result;\n\t }\n\t debounced.cancel = cancel;\n\t debounced.flush = flush;\n\t return debounced;\n\t}\n\t\n\t/**\n\t * Checks if `value` is classified as a `Function` object.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n\t * @example\n\t *\n\t * _.isFunction(_);\n\t * // => true\n\t *\n\t * _.isFunction(/abc/);\n\t * // => false\n\t */\n\tfunction isFunction(value) {\n\t // The use of `Object#toString` avoids issues with the `typeof` operator\n\t // in Safari 8 which returns 'object' for typed array constructors, and\n\t // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n\t var tag = isObject(value) ? objectToString.call(value) : '';\n\t return tag == funcTag || tag == genTag;\n\t}\n\t\n\t/**\n\t * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n\t * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to check.\n\t * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n\t * @example\n\t *\n\t * _.isObject({});\n\t * // => true\n\t *\n\t * _.isObject([1, 2, 3]);\n\t * // => true\n\t *\n\t * _.isObject(_.noop);\n\t * // => true\n\t *\n\t * _.isObject(null);\n\t * // => false\n\t */\n\tfunction isObject(value) {\n\t var type = typeof value;\n\t return !!value && (type == 'object' || type == 'function');\n\t}\n\t\n\t/**\n\t * Converts `value` to a number.\n\t *\n\t * @static\n\t * @memberOf _\n\t * @category Lang\n\t * @param {*} value The value to process.\n\t * @returns {number} Returns the number.\n\t * @example\n\t *\n\t * _.toNumber(3);\n\t * // => 3\n\t *\n\t * _.toNumber(Number.MIN_VALUE);\n\t * // => 5e-324\n\t *\n\t * _.toNumber(Infinity);\n\t * // => Infinity\n\t *\n\t * _.toNumber('3');\n\t * // => 3\n\t */\n\tfunction toNumber(value) {\n\t if (isObject(value)) {\n\t var other = isFunction(value.valueOf) ? value.valueOf() : value;\n\t value = isObject(other) ? (other + '') : other;\n\t }\n\t if (typeof value != 'string') {\n\t return value === 0 ? value : +value;\n\t }\n\t value = value.replace(reTrim, '');\n\t var isBinary = reIsBinary.test(value);\n\t return (isBinary || reIsOctal.test(value))\n\t ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n\t : (reIsBadHex.test(value) ? NAN : +value);\n\t}\n\t\n\tmodule.exports = debounce;\n\n\n/***/ },\n/* 51 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _ControlsOrbit = __webpack_require__(52);\n\t\n\tvar _ControlsOrbit2 = _interopRequireDefault(_ControlsOrbit);\n\t\n\tvar Controls = {\n\t Orbit: _ControlsOrbit2['default'],\n\t orbit: _ControlsOrbit.orbit, orbit: _ControlsOrbit.orbit\n\t};\n\t\n\texports['default'] = Controls;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 52 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _eventemitter3 = __webpack_require__(2);\n\t\n\tvar _eventemitter32 = _interopRequireDefault(_eventemitter3);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _vendorOrbitControls = __webpack_require__(53);\n\t\n\tvar _vendorOrbitControls2 = _interopRequireDefault(_vendorOrbitControls);\n\t\n\tvar Orbit = (function (_EventEmitter) {\n\t _inherits(Orbit, _EventEmitter);\n\t\n\t function Orbit() {\n\t _classCallCheck(this, Orbit);\n\t\n\t _get(Object.getPrototypeOf(Orbit.prototype), 'constructor', this).call(this);\n\t }\n\t\n\t // Proxy control events\n\t //\n\t // There's currently no distinction between pan, orbit and zoom events\n\t\n\t _createClass(Orbit, [{\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t var _this = this;\n\t\n\t this._controls.addEventListener('start', function (event) {\n\t _this._world.emit('controlsMoveStart', event.target.target);\n\t });\n\t\n\t this._controls.addEventListener('change', function (event) {\n\t _this._world.emit('controlsMove', event.target.target);\n\t });\n\t\n\t this._controls.addEventListener('end', function (event) {\n\t _this._world.emit('controlsMoveEnd', event.target.target);\n\t });\n\t }\n\t\n\t // Moving the camera along the [x,y,z] axis based on a target position\n\t }, {\n\t key: '_panTo',\n\t value: function _panTo(point, animate) {}\n\t }, {\n\t key: '_panBy',\n\t value: function _panBy(pointDelta, animate) {}\n\t\n\t // Zooming the camera in and out\n\t }, {\n\t key: '_zoomTo',\n\t value: function _zoomTo(metres, animate) {}\n\t }, {\n\t key: '_zoomBy',\n\t value: function _zoomBy(metresDelta, animate) {}\n\t\n\t // Force camera to look at something other than the target\n\t }, {\n\t key: '_lookAt',\n\t value: function _lookAt(point, animate) {}\n\t\n\t // Make camera look at the target\n\t }, {\n\t key: '_lookAtTarget',\n\t value: function _lookAtTarget() {}\n\t\n\t // Tilt (up and down)\n\t }, {\n\t key: '_tiltTo',\n\t value: function _tiltTo(angle, animate) {}\n\t }, {\n\t key: '_tiltBy',\n\t value: function _tiltBy(angleDelta, animate) {}\n\t\n\t // Rotate (left and right)\n\t }, {\n\t key: '_rotateTo',\n\t value: function _rotateTo(angle, animate) {}\n\t }, {\n\t key: '_rotateBy',\n\t value: function _rotateBy(angleDelta, animate) {}\n\t\n\t // Fly to the given point, animating pan and tilt/rotation to final position\n\t // with nice zoom out and in\n\t //\n\t // Calling flyTo a second time before the previous animation has completed\n\t // will immediately start the new animation from wherever the previous one\n\t // has got to\n\t }, {\n\t key: '_flyTo',\n\t value: function _flyTo(point, noZoom) {}\n\t\n\t // Proxy to OrbitControls.update()\n\t }, {\n\t key: 'update',\n\t value: function update() {\n\t this._controls.update();\n\t }\n\t\n\t // Add controls to world instance and store world reference\n\t }, {\n\t key: 'addTo',\n\t value: function addTo(world) {\n\t world.addControls(this);\n\t return this;\n\t }\n\t\n\t // Internal method called by World.addControls to actually add the controls\n\t }, {\n\t key: '_addToWorld',\n\t value: function _addToWorld(world) {\n\t this._world = world;\n\t\n\t // TODO: Override panLeft and panUp methods to prevent panning on Y axis\n\t // See: http://stackoverflow.com/a/26188674/997339\n\t this._controls = new _vendorOrbitControls2['default'](world._engine._camera, world._container);\n\t\n\t // Disable keys for now as no events are fired for them anyway\n\t this._controls.keys = false;\n\t\n\t // 89 degrees\n\t this._controls.maxPolarAngle = 1.5533;\n\t\n\t // this._controls.enableDamping = true;\n\t // this._controls.dampingFactor = 0.25;\n\t\n\t this._initEvents();\n\t\n\t this.emit('added');\n\t }\n\t\n\t // Destroys the controls and removes them from memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // TODO: Remove event listeners\n\t\n\t this._controls.dispose();\n\t\n\t this._world = null;\n\t this._controls = null;\n\t }\n\t }]);\n\t\n\t return Orbit;\n\t})(_eventemitter32['default']);\n\t\n\texports['default'] = Orbit;\n\t\n\tvar noNew = function noNew() {\n\t return new Orbit();\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.orbit = noNew;\n\n/***/ },\n/* 53 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _hammerjs = __webpack_require__(54);\n\t\n\tvar _hammerjs2 = _interopRequireDefault(_hammerjs);\n\t\n\t/**\n\t * @author qiao / https://github.com/qiao\n\t * @author mrdoob / http://mrdoob.com\n\t * @author alteredq / http://alteredqualia.com/\n\t * @author WestLangley / http://github.com/WestLangley\n\t * @author erich666 / http://erichaines.com\n\t */\n\t\n\t// This set of controls performs orbiting, dollying (zooming), and panning.\n\t// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n\t//\n\t// Orbit - left mouse / touch: one finger move\n\t// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish\n\t// Pan - right mouse, or arrow keys / touch: three finter swipe\n\t\n\tvar OrbitControls = function OrbitControls(object, domElement) {\n\t\n\t\tthis.object = object;\n\t\n\t\tthis.domElement = domElement !== undefined ? domElement : document;\n\t\n\t\t// Set to false to disable this control\n\t\tthis.enabled = true;\n\t\n\t\t// \"target\" sets the location of focus, where the object orbits around\n\t\tthis.target = new _three2['default'].Vector3();\n\t\n\t\t// How far you can dolly in and out ( PerspectiveCamera only )\n\t\tthis.minDistance = 0;\n\t\tthis.maxDistance = Infinity;\n\t\n\t\t// How far you can zoom in and out ( OrthographicCamera only )\n\t\tthis.minZoom = 0;\n\t\tthis.maxZoom = Infinity;\n\t\n\t\t// How far you can orbit vertically, upper and lower limits.\n\t\t// Range is 0 to Math.PI radians.\n\t\tthis.minPolarAngle = 0; // radians\n\t\tthis.maxPolarAngle = Math.PI; // radians\n\t\n\t\t// How far you can orbit horizontally, upper and lower limits.\n\t\t// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].\n\t\tthis.minAzimuthAngle = -Infinity; // radians\n\t\tthis.maxAzimuthAngle = Infinity; // radians\n\t\n\t\t// Set to true to enable damping (inertia)\n\t\t// If damping is enabled, you must call controls.update() in your animation loop\n\t\tthis.enableDamping = false;\n\t\tthis.dampingFactor = 0.25;\n\t\n\t\t// This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n\t\t// Set to false to disable zooming\n\t\tthis.enableZoom = true;\n\t\tthis.zoomSpeed = 1.0;\n\t\n\t\t// Set to false to disable rotating\n\t\tthis.enableRotate = true;\n\t\tthis.rotateSpeed = 1.0;\n\t\n\t\t// Set to false to disable panning\n\t\tthis.enablePan = true;\n\t\tthis.keyPanSpeed = 7.0; // pixels moved per arrow key push\n\t\n\t\t// Set to true to automatically rotate around the target\n\t\t// If auto-rotate is enabled, you must call controls.update() in your animation loop\n\t\tthis.autoRotate = false;\n\t\tthis.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\t\n\t\t// Set to false to disable use of the keys\n\t\tthis.enableKeys = true;\n\t\n\t\t// The four arrow keys\n\t\tthis.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };\n\t\n\t\t// Mouse buttons\n\t\tthis.mouseButtons = { ORBIT: _three2['default'].MOUSE.LEFT, ZOOM: _three2['default'].MOUSE.MIDDLE, PAN: _three2['default'].MOUSE.RIGHT };\n\t\n\t\t// for reset\n\t\tthis.target0 = this.target.clone();\n\t\tthis.position0 = this.object.position.clone();\n\t\tthis.zoom0 = this.object.zoom;\n\t\n\t\t//\n\t\t// public methods\n\t\t//\n\t\n\t\tthis.getPolarAngle = function () {\n\t\n\t\t\treturn phi;\n\t\t};\n\t\n\t\tthis.getAzimuthalAngle = function () {\n\t\n\t\t\treturn theta;\n\t\t};\n\t\n\t\tthis.reset = function () {\n\t\n\t\t\tscope.target.copy(scope.target0);\n\t\t\tscope.object.position.copy(scope.position0);\n\t\t\tscope.object.zoom = scope.zoom0;\n\t\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tscope.dispatchEvent(changeEvent);\n\t\n\t\t\tscope.update();\n\t\n\t\t\tstate = STATE.NONE;\n\t\t};\n\t\n\t\t// this method is exposed, but perhaps it would be better if we can make it private...\n\t\tthis.update = (function () {\n\t\n\t\t\tvar offset = new _three2['default'].Vector3();\n\t\n\t\t\t// so camera.up is the orbit axis\n\t\t\tvar quat = new _three2['default'].Quaternion().setFromUnitVectors(object.up, new _three2['default'].Vector3(0, 1, 0));\n\t\t\tvar quatInverse = quat.clone().inverse();\n\t\n\t\t\tvar lastPosition = new _three2['default'].Vector3();\n\t\t\tvar lastQuaternion = new _three2['default'].Quaternion();\n\t\n\t\t\treturn function () {\n\t\n\t\t\t\tvar position = scope.object.position;\n\t\n\t\t\t\toffset.copy(position).sub(scope.target);\n\t\n\t\t\t\t// rotate offset to \"y-axis-is-up\" space\n\t\t\t\toffset.applyQuaternion(quat);\n\t\n\t\t\t\t// angle from z-axis around y-axis\n\t\n\t\t\t\ttheta = Math.atan2(offset.x, offset.z);\n\t\n\t\t\t\t// angle from y-axis\n\t\n\t\t\t\tphi = Math.atan2(Math.sqrt(offset.x * offset.x + offset.z * offset.z), offset.y);\n\t\n\t\t\t\tif (scope.autoRotate && state === STATE.NONE) {\n\t\n\t\t\t\t\trotateLeft(getAutoRotationAngle());\n\t\t\t\t}\n\t\n\t\t\t\ttheta += thetaDelta;\n\t\t\t\tphi += phiDelta;\n\t\n\t\t\t\t// restrict theta to be between desired limits\n\t\t\t\ttheta = Math.max(scope.minAzimuthAngle, Math.min(scope.maxAzimuthAngle, theta));\n\t\n\t\t\t\t// restrict phi to be between desired limits\n\t\t\t\tphi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, phi));\n\t\n\t\t\t\t// restrict phi to be betwee EPS and PI-EPS\n\t\t\t\tphi = Math.max(EPS, Math.min(Math.PI - EPS, phi));\n\t\n\t\t\t\tvar radius = offset.length() * scale;\n\t\n\t\t\t\t// restrict radius to be between desired limits\n\t\t\t\tradius = Math.max(scope.minDistance, Math.min(scope.maxDistance, radius));\n\t\n\t\t\t\t// move target to panned location\n\t\t\t\tscope.target.add(panOffset);\n\t\n\t\t\t\toffset.x = radius * Math.sin(phi) * Math.sin(theta);\n\t\t\t\toffset.y = radius * Math.cos(phi);\n\t\t\t\toffset.z = radius * Math.sin(phi) * Math.cos(theta);\n\t\n\t\t\t\t// rotate offset back to \"camera-up-vector-is-up\" space\n\t\t\t\toffset.applyQuaternion(quatInverse);\n\t\n\t\t\t\tposition.copy(scope.target).add(offset);\n\t\n\t\t\t\tscope.object.lookAt(scope.target);\n\t\n\t\t\t\tif (scope.enableDamping === true) {\n\t\n\t\t\t\t\tthetaDelta *= 1 - scope.dampingFactor;\n\t\t\t\t\tphiDelta *= 1 - scope.dampingFactor;\n\t\t\t\t} else {\n\t\n\t\t\t\t\tthetaDelta = 0;\n\t\t\t\t\tphiDelta = 0;\n\t\t\t\t}\n\t\n\t\t\t\tscale = 1;\n\t\t\t\tpanOffset.set(0, 0, 0);\n\t\n\t\t\t\t// update condition is:\n\t\t\t\t// min(camera displacement, camera rotation in radians)^2 > EPS\n\t\t\t\t// using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\t\n\t\t\t\tif (zoomChanged || lastPosition.distanceToSquared(scope.object.position) > EPS || 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS) {\n\t\n\t\t\t\t\tscope.dispatchEvent(changeEvent);\n\t\n\t\t\t\t\tlastPosition.copy(scope.object.position);\n\t\t\t\t\tlastQuaternion.copy(scope.object.quaternion);\n\t\t\t\t\tzoomChanged = false;\n\t\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\n\t\t\t\treturn false;\n\t\t\t};\n\t\t})();\n\t\n\t\tthis.dispose = function () {\n\t\n\t\t\tscope.domElement.removeEventListener('contextmenu', onContextMenu, false);\n\t\t\tscope.domElement.removeEventListener('mousedown', onMouseDown, false);\n\t\t\tscope.domElement.removeEventListener('mousewheel', onMouseWheel, false);\n\t\t\tscope.domElement.removeEventListener('MozMousePixelScroll', onMouseWheel, false); // firefox\n\t\n\t\t\tscope.domElement.removeEventListener('touchstart', onTouchStart, false);\n\t\t\tscope.domElement.removeEventListener('touchend', onTouchEnd, false);\n\t\t\tscope.domElement.removeEventListener('touchmove', onTouchMove, false);\n\t\n\t\t\tdocument.removeEventListener('mousemove', onMouseMove, false);\n\t\t\tdocument.removeEventListener('mouseup', onMouseUp, false);\n\t\t\tdocument.removeEventListener('mouseout', onMouseUp, false);\n\t\n\t\t\twindow.removeEventListener('keydown', onKeyDown, false);\n\t\n\t\t\t//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n\t\t};\n\t\n\t\t//\n\t\t// internals\n\t\t//\n\t\n\t\tvar scope = this;\n\t\n\t\tvar changeEvent = { type: 'change' };\n\t\tvar startEvent = { type: 'start' };\n\t\tvar endEvent = { type: 'end' };\n\t\n\t\tvar STATE = { NONE: -1, ROTATE: 0, DOLLY: 1, PAN: 2, TOUCH_ROTATE: 3, TOUCH_DOLLY: 4, TOUCH_PAN: 5 };\n\t\n\t\tvar state = STATE.NONE;\n\t\n\t\tvar EPS = 0.000001;\n\t\n\t\t// current position in spherical coordinates\n\t\tvar theta;\n\t\tvar phi;\n\t\n\t\tvar phiDelta = 0;\n\t\tvar thetaDelta = 0;\n\t\tvar scale = 1;\n\t\tvar panOffset = new _three2['default'].Vector3();\n\t\tvar zoomChanged = false;\n\t\n\t\tvar rotateStart = new _three2['default'].Vector2();\n\t\tvar rotateEnd = new _three2['default'].Vector2();\n\t\tvar rotateDelta = new _three2['default'].Vector2();\n\t\n\t\tvar panStart = new _three2['default'].Vector2();\n\t\tvar panEnd = new _three2['default'].Vector2();\n\t\tvar panDelta = new _three2['default'].Vector2();\n\t\n\t\tvar dollyStart = new _three2['default'].Vector2();\n\t\tvar dollyEnd = new _three2['default'].Vector2();\n\t\tvar dollyDelta = new _three2['default'].Vector2();\n\t\n\t\tfunction getAutoRotationAngle() {\n\t\n\t\t\treturn 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n\t\t}\n\t\n\t\tfunction getZoomScale() {\n\t\n\t\t\treturn Math.pow(0.95, scope.zoomSpeed);\n\t\t}\n\t\n\t\tfunction rotateLeft(angle) {\n\t\n\t\t\tthetaDelta -= angle;\n\t\t}\n\t\n\t\tfunction rotateUp(angle) {\n\t\n\t\t\tphiDelta -= angle;\n\t\t}\n\t\n\t\tvar panLeft = (function () {\n\t\n\t\t\tvar v = new _three2['default'].Vector3();\n\t\n\t\t\t// return function panLeft( distance, objectMatrix ) {\n\t\t\t//\n\t\t\t// \tvar te = objectMatrix.elements;\n\t\t\t//\n\t\t\t// \t// get X column of objectMatrix\n\t\t\t// \tv.set( te[ 0 ], te[ 1 ], te[ 2 ] );\n\t\t\t//\n\t\t\t// \tv.multiplyScalar( - distance );\n\t\t\t//\n\t\t\t// \tpanOffset.add( v );\n\t\t\t//\n\t\t\t// };\n\t\n\t\t\t// Fixed panning to x/y plane\n\t\t\treturn function panLeft(distance, objectMatrix) {\n\t\t\t\tvar te = objectMatrix.elements;\n\t\t\t\t// var adjDist = distance / Math.cos(phi);\n\t\n\t\t\t\tv.set(te[0], 0, te[2]);\n\t\t\t\tv.multiplyScalar(-distance);\n\t\n\t\t\t\tpanOffset.add(v);\n\t\t\t};\n\t\t})();\n\t\n\t\t// Fixed panning to x/y plane\n\t\tvar panUp = (function () {\n\t\n\t\t\tvar v = new _three2['default'].Vector3();\n\t\n\t\t\t// return function panUp( distance, objectMatrix ) {\n\t\t\t//\n\t\t\t// \tvar te = objectMatrix.elements;\n\t\t\t//\n\t\t\t// \t// get Y column of objectMatrix\n\t\t\t// \tv.set( te[ 4 ], te[ 5 ], te[ 6 ] );\n\t\t\t//\n\t\t\t// \tv.multiplyScalar( distance );\n\t\t\t//\n\t\t\t// \tpanOffset.add( v );\n\t\t\t//\n\t\t\t// };\n\t\n\t\t\treturn function panUp(distance, objectMatrix) {\n\t\t\t\tvar te = objectMatrix.elements;\n\t\t\t\tvar adjDist = distance / Math.cos(phi);\n\t\n\t\t\t\tv.set(te[4], 0, te[6]);\n\t\t\t\tv.multiplyScalar(adjDist);\n\t\n\t\t\t\tpanOffset.add(v);\n\t\t\t};\n\t\t})();\n\t\n\t\t// deltaX and deltaY are in pixels; right and down are positive\n\t\tvar pan = (function () {\n\t\n\t\t\tvar offset = new _three2['default'].Vector3();\n\t\n\t\t\treturn function (deltaX, deltaY) {\n\t\n\t\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\t\n\t\t\t\tif (scope.object instanceof _three2['default'].PerspectiveCamera) {\n\t\n\t\t\t\t\t// perspective\n\t\t\t\t\tvar position = scope.object.position;\n\t\t\t\t\toffset.copy(position).sub(scope.target);\n\t\t\t\t\tvar targetDistance = offset.length();\n\t\n\t\t\t\t\t// half of the fov is center to top of screen\n\t\t\t\t\ttargetDistance *= Math.tan(scope.object.fov / 2 * Math.PI / 180.0);\n\t\n\t\t\t\t\t// we actually don't use screenWidth, since perspective camera is fixed to screen height\n\t\t\t\t\tpanLeft(2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix);\n\t\t\t\t\tpanUp(2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix);\n\t\t\t\t} else if (scope.object instanceof _three2['default'].OrthographicCamera) {\n\t\n\t\t\t\t\t// orthographic\n\t\t\t\t\tpanLeft(deltaX * (scope.object.right - scope.object.left) / element.clientWidth, scope.object.matrix);\n\t\t\t\t\tpanUp(deltaY * (scope.object.top - scope.object.bottom) / element.clientHeight, scope.object.matrix);\n\t\t\t\t} else {\n\t\n\t\t\t\t\t// camera neither orthographic nor perspective\n\t\t\t\t\tconsole.warn('WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.');\n\t\t\t\t\tscope.enablePan = false;\n\t\t\t\t}\n\t\t\t};\n\t\t})();\n\t\n\t\tfunction dollyIn(dollyScale) {\n\t\n\t\t\tif (scope.object instanceof _three2['default'].PerspectiveCamera) {\n\t\n\t\t\t\tscale /= dollyScale;\n\t\t\t} else if (scope.object instanceof _three2['default'].OrthographicCamera) {\n\t\n\t\t\t\tscope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom * dollyScale));\n\t\t\t\tscope.object.updateProjectionMatrix();\n\t\t\t\tzoomChanged = true;\n\t\t\t} else {\n\t\n\t\t\t\tconsole.warn('WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.');\n\t\t\t\tscope.enableZoom = false;\n\t\t\t}\n\t\t}\n\t\n\t\tfunction dollyOut(dollyScale) {\n\t\n\t\t\tif (scope.object instanceof _three2['default'].PerspectiveCamera) {\n\t\n\t\t\t\tscale *= dollyScale;\n\t\t\t} else if (scope.object instanceof _three2['default'].OrthographicCamera) {\n\t\n\t\t\t\tscope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / dollyScale));\n\t\t\t\tscope.object.updateProjectionMatrix();\n\t\t\t\tzoomChanged = true;\n\t\t\t} else {\n\t\n\t\t\t\tconsole.warn('WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.');\n\t\t\t\tscope.enableZoom = false;\n\t\t\t}\n\t\t}\n\t\n\t\t//\n\t\t// event callbacks - update the object state\n\t\t//\n\t\n\t\tfunction handleMouseDownRotate(event) {\n\t\n\t\t\t//console.log( 'handleMouseDownRotate' );\n\t\n\t\t\trotateStart.set(event.clientX, event.clientY);\n\t\t}\n\t\n\t\tfunction handleMouseDownDolly(event) {\n\t\n\t\t\t//console.log( 'handleMouseDownDolly' );\n\t\n\t\t\tdollyStart.set(event.clientX, event.clientY);\n\t\t}\n\t\n\t\tfunction handleMouseDownPan(event) {\n\t\n\t\t\t//console.log( 'handleMouseDownPan' );\n\t\n\t\t\tpanStart.set(event.clientX, event.clientY);\n\t\t}\n\t\n\t\tfunction handleMouseMoveRotate(event) {\n\t\n\t\t\t//console.log( 'handleMouseMoveRotate' );\n\t\n\t\t\trotateEnd.set(event.clientX, event.clientY);\n\t\t\trotateDelta.subVectors(rotateEnd, rotateStart);\n\t\n\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\t\n\t\t\t// rotating across whole screen goes 360 degrees around\n\t\t\trotateLeft(2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed);\n\t\n\t\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\t\trotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed);\n\t\n\t\t\trotateStart.copy(rotateEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleMouseMoveDolly(event) {\n\t\n\t\t\t//console.log( 'handleMouseMoveDolly' );\n\t\n\t\t\tdollyEnd.set(event.clientX, event.clientY);\n\t\n\t\t\tdollyDelta.subVectors(dollyEnd, dollyStart);\n\t\n\t\t\tif (dollyDelta.y > 0) {\n\t\n\t\t\t\tdollyIn(getZoomScale());\n\t\t\t} else if (dollyDelta.y < 0) {\n\t\n\t\t\t\tdollyOut(getZoomScale());\n\t\t\t}\n\t\n\t\t\tdollyStart.copy(dollyEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleMouseMovePan(event) {\n\t\n\t\t\t//console.log( 'handleMouseMovePan' );\n\t\n\t\t\tpanEnd.set(event.clientX, event.clientY);\n\t\n\t\t\tpanDelta.subVectors(panEnd, panStart);\n\t\n\t\t\tpan(panDelta.x, panDelta.y);\n\t\n\t\t\tpanStart.copy(panEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleMouseUp(event) {\n\t\n\t\t\t//console.log( 'handleMouseUp' );\n\t\n\t\t}\n\t\n\t\tfunction handleMouseWheel(event) {\n\t\n\t\t\t//console.log( 'handleMouseWheel' );\n\t\n\t\t\tvar delta = 0;\n\t\n\t\t\tif (event.wheelDelta !== undefined) {\n\t\n\t\t\t\t// WebKit / Opera / Explorer 9\n\t\n\t\t\t\tdelta = event.wheelDelta;\n\t\t\t} else if (event.detail !== undefined) {\n\t\n\t\t\t\t// Firefox\n\t\n\t\t\t\tdelta = -event.detail;\n\t\t\t}\n\t\n\t\t\tif (delta > 0) {\n\t\n\t\t\t\tdollyOut(getZoomScale());\n\t\t\t} else if (delta < 0) {\n\t\n\t\t\t\tdollyIn(getZoomScale());\n\t\t\t}\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleKeyDown(event) {\n\t\n\t\t\t//console.log( 'handleKeyDown' );\n\t\n\t\t\tswitch (event.keyCode) {\n\t\n\t\t\t\tcase scope.keys.UP:\n\t\t\t\t\tpan(0, scope.keyPanSpeed);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase scope.keys.BOTTOM:\n\t\t\t\t\tpan(0, -scope.keyPanSpeed);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase scope.keys.LEFT:\n\t\t\t\t\tpan(scope.keyPanSpeed, 0);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase scope.keys.RIGHT:\n\t\t\t\t\tpan(-scope.keyPanSpeed, 0);\n\t\t\t\t\tscope.update();\n\t\t\t\t\tbreak;\n\t\n\t\t\t}\n\t\t}\n\t\n\t\tfunction handleTouchStartRotate(event) {\n\t\n\t\t\t//console.log( 'handleTouchStartRotate' );\n\t\n\t\t\trotateStart.set(event.pointers[0].pageX, event.pointers[0].pageY);\n\t\t}\n\t\n\t\tfunction handleTouchStartDolly(event) {\n\t\n\t\t\t//console.log( 'handleTouchStartDolly' );\n\t\n\t\t\tvar dx = event.pointers[0].pageX - event.pointers[1].pageX;\n\t\t\tvar dy = event.pointers[0].pageY - event.pointers[1].pageY;\n\t\n\t\t\tvar distance = Math.sqrt(dx * dx + dy * dy);\n\t\n\t\t\tdollyStart.set(0, distance);\n\t\t}\n\t\n\t\tfunction handleTouchStartPan(event) {\n\t\n\t\t\t//console.log( 'handleTouchStartPan' );\n\t\n\t\t\tpanStart.set(event.deltaX, event.deltaY);\n\t\t}\n\t\n\t\tfunction handleTouchMoveRotate(event) {\n\t\n\t\t\t//console.log( 'handleTouchMoveRotate' );\n\t\n\t\t\trotateEnd.set(event.pointers[0].pageX, event.pointers[0].pageY);\n\t\t\trotateDelta.subVectors(rotateEnd, rotateStart);\n\t\n\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\t\n\t\t\t// rotating across whole screen goes 360 degrees around\n\t\t\trotateLeft(2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed);\n\t\n\t\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\t\trotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed);\n\t\n\t\t\trotateStart.copy(rotateEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleTouchMoveDolly(event) {\n\t\n\t\t\t//console.log( 'handleTouchMoveDolly' );\n\t\n\t\t\tvar dx = event.pointers[0].pageX - event.pointers[1].pageX;\n\t\t\tvar dy = event.pointers[0].pageY - event.pointers[1].pageY;\n\t\n\t\t\tvar distance = Math.sqrt(dx * dx + dy * dy);\n\t\n\t\t\tdollyEnd.set(0, distance);\n\t\n\t\t\tdollyDelta.subVectors(dollyEnd, dollyStart);\n\t\n\t\t\tif (dollyDelta.y > 0) {\n\t\n\t\t\t\tdollyOut(getZoomScale());\n\t\t\t} else if (dollyDelta.y < 0) {\n\t\n\t\t\t\tdollyIn(getZoomScale());\n\t\t\t}\n\t\n\t\t\tdollyStart.copy(dollyEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleTouchMovePan(event) {\n\t\n\t\t\t//console.log( 'handleTouchMovePan' );\n\t\n\t\t\tpanEnd.set(event.deltaX, event.deltaY);\n\t\n\t\t\tpanDelta.subVectors(panEnd, panStart);\n\t\n\t\t\tpan(panDelta.x, panDelta.y);\n\t\n\t\t\tpanStart.copy(panEnd);\n\t\n\t\t\tscope.update();\n\t\t}\n\t\n\t\tfunction handleTouchEnd(event) {}\n\t\n\t\t//console.log( 'handleTouchEnd' );\n\t\n\t\t//\n\t\t// event handlers - FSM: listen for events and reset state\n\t\t//\n\t\n\t\tfunction onMouseDown(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tevent.preventDefault();\n\t\n\t\t\tif (event.button === scope.mouseButtons.ORBIT) {\n\t\n\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\thandleMouseDownRotate(event);\n\t\n\t\t\t\tstate = STATE.ROTATE;\n\t\t\t} else if (event.button === scope.mouseButtons.ZOOM) {\n\t\n\t\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\t\thandleMouseDownDolly(event);\n\t\n\t\t\t\tstate = STATE.DOLLY;\n\t\t\t} else if (event.button === scope.mouseButtons.PAN) {\n\t\n\t\t\t\tif (scope.enablePan === false) return;\n\t\n\t\t\t\thandleMouseDownPan(event);\n\t\n\t\t\t\tstate = STATE.PAN;\n\t\t\t}\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\n\t\t\t\tdocument.addEventListener('mousemove', onMouseMove, false);\n\t\t\t\tdocument.addEventListener('mouseup', onMouseUp, false);\n\t\t\t\tdocument.addEventListener('mouseout', onMouseUp, false);\n\t\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onMouseMove(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tevent.preventDefault();\n\t\n\t\t\tif (state === STATE.ROTATE) {\n\t\n\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\thandleMouseMoveRotate(event);\n\t\t\t} else if (state === STATE.DOLLY) {\n\t\n\t\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\t\thandleMouseMoveDolly(event);\n\t\t\t} else if (state === STATE.PAN) {\n\t\n\t\t\t\tif (scope.enablePan === false) return;\n\t\n\t\t\t\thandleMouseMovePan(event);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onMouseUp(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\thandleMouseUp(event);\n\t\n\t\t\tdocument.removeEventListener('mousemove', onMouseMove, false);\n\t\t\tdocument.removeEventListener('mouseup', onMouseUp, false);\n\t\t\tdocument.removeEventListener('mouseout', onMouseUp, false);\n\t\n\t\t\tscope.dispatchEvent(endEvent);\n\t\n\t\t\tstate = STATE.NONE;\n\t\t}\n\t\n\t\tfunction onMouseWheel(event) {\n\t\n\t\t\tif (scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE) return;\n\t\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\n\t\t\thandleMouseWheel(event);\n\t\n\t\t\tscope.dispatchEvent(startEvent); // not sure why these are here...\n\t\t\tscope.dispatchEvent(endEvent);\n\t\t}\n\t\n\t\tfunction onKeyDown(event) {\n\t\n\t\t\tif (scope.enabled === false || scope.enableKeys === false || scope.enablePan === false) return;\n\t\n\t\t\thandleKeyDown(event);\n\t\t}\n\t\n\t\tfunction onTouchStart(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tswitch (event.touches.length) {\n\t\n\t\t\t\tcase 1:\n\t\t\t\t\t// one-fingered touch: rotate\n\t\n\t\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\t\thandleTouchStartRotate(event);\n\t\n\t\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 2:\n\t\t\t\t\t// two-fingered touch: dolly\n\t\n\t\t\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\t\t\thandleTouchStartDolly(event);\n\t\n\t\t\t\t\tstate = STATE.TOUCH_DOLLY;\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 3:\n\t\t\t\t\t// three-fingered touch: pan\n\t\n\t\t\t\t\tif (scope.enablePan === false) return;\n\t\n\t\t\t\t\thandleTouchStartPan(event);\n\t\n\t\t\t\t\tstate = STATE.TOUCH_PAN;\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tdefault:\n\t\n\t\t\t\t\tstate = STATE.NONE;\n\t\n\t\t\t}\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onTouchMove(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\n\t\t\tswitch (event.touches.length) {\n\t\n\t\t\t\tcase 1:\n\t\t\t\t\t// one-fingered touch: rotate\n\t\n\t\t\t\t\tif (scope.enableRotate === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_ROTATE) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMoveRotate(event);\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 2:\n\t\t\t\t\t// two-fingered touch: dolly\n\t\n\t\t\t\t\tif (scope.enableZoom === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_DOLLY) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMoveDolly(event);\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tcase 3:\n\t\t\t\t\t// three-fingered touch: pan\n\t\n\t\t\t\t\tif (scope.enablePan === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_PAN) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMovePan(event);\n\t\n\t\t\t\t\tbreak;\n\t\n\t\t\t\tdefault:\n\t\n\t\t\t\t\tstate = STATE.NONE;\n\t\n\t\t\t}\n\t\t}\n\t\n\t\tfunction onTouchEnd(event) {\n\t\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\thandleTouchEnd(event);\n\t\n\t\t\tscope.dispatchEvent(endEvent);\n\t\n\t\t\tstate = STATE.NONE;\n\t\t}\n\t\n\t\tfunction onContextMenu(event) {\n\t\n\t\t\tevent.preventDefault();\n\t\t}\n\t\n\t\t//\n\t\n\t\tscope.domElement.addEventListener('contextmenu', onContextMenu, false);\n\t\n\t\tscope.domElement.addEventListener('mousedown', onMouseDown, false);\n\t\tscope.domElement.addEventListener('mousewheel', onMouseWheel, false);\n\t\tscope.domElement.addEventListener('MozMousePixelScroll', onMouseWheel, false); // firefox\n\t\n\t\t// scope.domElement.addEventListener( 'touchstart', onTouchStart, false );\n\t\t// scope.domElement.addEventListener( 'touchend', onTouchEnd, false );\n\t\t// scope.domElement.addEventListener( 'touchmove', onTouchMove, false );\n\t\n\t\tscope.hammer = new _hammerjs2['default'](scope.domElement);\n\t\n\t\tscope.hammer.get('pan').set({\n\t\t\tpointers: 0,\n\t\t\tdirection: _hammerjs2['default'].DIRECTION_ALL\n\t\t});\n\t\n\t\tscope.hammer.get('pinch').set({\n\t\t\tenable: true,\n\t\t\tthreshold: 0.1\n\t\t});\n\t\n\t\tscope.hammer.on('panstart', function (event) {\n\t\t\tif (scope.enabled === false) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (event.pointers.length === 1) {\n\t\t\t\tif (scope.enablePan === false) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\thandleTouchStartPan(event);\n\t\t\t\t// panStart.set(event.deltaX, event.deltaY);\n\t\n\t\t\t\tstate = STATE.TOUCH_PAN;\n\t\t\t} else if (event.pointers.length === 2) {\n\t\t\t\tif (scope.enableRotate === false) return;\n\t\n\t\t\t\thandleTouchStartRotate(event);\n\t\n\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\t\t\t}\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t});\n\t\n\t\tscope.hammer.on('panend', function (event) {\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tonTouchEnd(event);\n\t\t});\n\t\n\t\tscope.hammer.on('panmove', function (event) {\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// event.preventDefault();\n\t\t\t// event.stopPropagation();\n\t\n\t\t\tif (event.pointers.length === 1) {\n\t\t\t\tif (scope.enablePan === false) return;\n\t\t\t\tif (state !== STATE.TOUCH_PAN) return; // is this needed?...\n\t\n\t\t\t\thandleTouchMovePan(event);\n\t\n\t\t\t\t// panEnd.set( event.deltaX, event.deltaY );\n\t\t\t\t//\n\t\t\t\t// panDelta.subVectors( panEnd, panStart );\n\t\t\t\t//\n\t\t\t\t// pan( panDelta.x, panDelta.y );\n\t\t\t\t//\n\t\t\t\t// panStart.copy( panEnd );\n\t\t\t\t//\n\t\t\t\t// scope.update();\n\t\t\t} else if (event.pointers.length === 2) {\n\t\t\t\t\tif (scope.enableRotate === false) return;\n\t\t\t\t\tif (state !== STATE.TOUCH_ROTATE) return; // is this needed?...\n\t\n\t\t\t\t\thandleTouchMoveRotate(event);\n\t\t\t\t}\n\t\t});\n\t\n\t\tscope.hammer.on('pinchstart', function (event) {\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (scope.enableZoom === false) return;\n\t\n\t\t\thandleTouchStartDolly(event);\n\t\n\t\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t\t//\n\t\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t\t//\n\t\t\t// dollyStart.set( 0, distance );\n\t\t\t//\n\t\t\tstate = STATE.TOUCH_DOLLY;\n\t\n\t\t\tif (state !== STATE.NONE) {\n\t\t\t\tscope.dispatchEvent(startEvent);\n\t\t\t}\n\t\t});\n\t\n\t\tscope.hammer.on('pinchend', function (event) {\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tonTouchEnd(event);\n\t\t});\n\t\n\t\tscope.hammer.on('pinchmove', function (event) {\n\t\t\tif (scope.enabled === false) return;\n\t\n\t\t\tif (event.pointerType === 'mouse') {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// event.preventDefault();\n\t\t\t// event.stopPropagation();\n\t\n\t\t\tif (scope.enableZoom === false) return;\n\t\t\tif (state !== STATE.TOUCH_DOLLY) return; // is this needed?...\n\t\n\t\t\thandleTouchMoveDolly(event);\n\t\n\t\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t\t//\n\t\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t\t//\n\t\t\t// dollyEnd.set( 0, distance );\n\t\t\t//\n\t\t\t// dollyDelta.subVectors( dollyEnd, dollyStart );\n\t\t\t//\n\t\t\t// if ( dollyDelta.y > 0 ) {\n\t\t\t//\n\t\t\t// \tdollyOut( getZoomScale() );\n\t\t\t//\n\t\t\t// } else if ( dollyDelta.y < 0 ) {\n\t\t\t//\n\t\t\t// \tdollyIn( getZoomScale() );\n\t\t\t//\n\t\t\t// }\n\t\t\t//\n\t\t\t// dollyStart.copy( dollyEnd );\n\t\t\t//\n\t\t\t// scope.update();\n\t\t});\n\t\n\t\twindow.addEventListener('keydown', onKeyDown, false);\n\t\n\t\t// force an update at start\n\t\n\t\tthis.update();\n\t};\n\t\n\tOrbitControls.prototype = Object.create(_three2['default'].EventDispatcher.prototype);\n\tOrbitControls.prototype.constructor = _three2['default'].OrbitControls;\n\t\n\tObject.defineProperties(OrbitControls.prototype, {\n\t\n\t\tcenter: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .center has been renamed to .target');\n\t\t\t\treturn this.target;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\t// backward compatibility\n\t\n\t\tnoZoom: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.');\n\t\t\t\treturn !this.enableZoom;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.');\n\t\t\t\tthis.enableZoom = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tnoRotate: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.');\n\t\t\t\treturn !this.enableRotate;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.');\n\t\t\t\tthis.enableRotate = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tnoPan: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.');\n\t\t\t\treturn !this.enablePan;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.');\n\t\t\t\tthis.enablePan = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tnoKeys: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.');\n\t\t\t\treturn !this.enableKeys;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.');\n\t\t\t\tthis.enableKeys = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tstaticMoving: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.');\n\t\t\t\treturn !this.constraint.enableDamping;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.');\n\t\t\t\tthis.constraint.enableDamping = !value;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\tdynamicDampingFactor: {\n\t\n\t\t\tget: function get() {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.');\n\t\t\t\treturn this.constraint.dampingFactor;\n\t\t\t},\n\t\n\t\t\tset: function set(value) {\n\t\n\t\t\t\tconsole.warn('THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.');\n\t\t\t\tthis.constraint.dampingFactor = value;\n\t\t\t}\n\t\n\t\t}\n\t\n\t});\n\t\n\texports['default'] = OrbitControls;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 54 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_RESULT__;/*! Hammer.JS - v2.0.6 - 2015-12-23\n\t * http://hammerjs.github.io/\n\t *\n\t * Copyright (c) 2015 Jorik Tangelder;\n\t * Licensed under the license */\n\t(function(window, document, exportName, undefined) {\n\t 'use strict';\n\t\n\tvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\n\tvar TEST_ELEMENT = document.createElement('div');\n\t\n\tvar TYPE_FUNCTION = 'function';\n\t\n\tvar round = Math.round;\n\tvar abs = Math.abs;\n\tvar now = Date.now;\n\t\n\t/**\n\t * set a timeout with a given scope\n\t * @param {Function} fn\n\t * @param {Number} timeout\n\t * @param {Object} context\n\t * @returns {number}\n\t */\n\tfunction setTimeoutContext(fn, timeout, context) {\n\t return setTimeout(bindFn(fn, context), timeout);\n\t}\n\t\n\t/**\n\t * if the argument is an array, we want to execute the fn on each entry\n\t * if it aint an array we don't want to do a thing.\n\t * this is used by all the methods that accept a single and array argument.\n\t * @param {*|Array} arg\n\t * @param {String} fn\n\t * @param {Object} [context]\n\t * @returns {Boolean}\n\t */\n\tfunction invokeArrayArg(arg, fn, context) {\n\t if (Array.isArray(arg)) {\n\t each(arg, context[fn], context);\n\t return true;\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * walk objects and arrays\n\t * @param {Object} obj\n\t * @param {Function} iterator\n\t * @param {Object} context\n\t */\n\tfunction each(obj, iterator, context) {\n\t var i;\n\t\n\t if (!obj) {\n\t return;\n\t }\n\t\n\t if (obj.forEach) {\n\t obj.forEach(iterator, context);\n\t } else if (obj.length !== undefined) {\n\t i = 0;\n\t while (i < obj.length) {\n\t iterator.call(context, obj[i], i, obj);\n\t i++;\n\t }\n\t } else {\n\t for (i in obj) {\n\t obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n\t }\n\t }\n\t}\n\t\n\t/**\n\t * wrap a method with a deprecation warning and stack trace\n\t * @param {Function} method\n\t * @param {String} name\n\t * @param {String} message\n\t * @returns {Function} A new function wrapping the supplied method.\n\t */\n\tfunction deprecate(method, name, message) {\n\t var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n\t return function() {\n\t var e = new Error('get-stack-trace');\n\t var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '')\n\t .replace(/^\\s+at\\s+/gm, '')\n\t .replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n\t\n\t var log = window.console && (window.console.warn || window.console.log);\n\t if (log) {\n\t log.call(window.console, deprecationMessage, stack);\n\t }\n\t return method.apply(this, arguments);\n\t };\n\t}\n\t\n\t/**\n\t * extend object.\n\t * means that properties in dest will be overwritten by the ones in src.\n\t * @param {Object} target\n\t * @param {...Object} objects_to_assign\n\t * @returns {Object} target\n\t */\n\tvar assign;\n\tif (typeof Object.assign !== 'function') {\n\t assign = function assign(target) {\n\t if (target === undefined || target === null) {\n\t throw new TypeError('Cannot convert undefined or null to object');\n\t }\n\t\n\t var output = Object(target);\n\t for (var index = 1; index < arguments.length; index++) {\n\t var source = arguments[index];\n\t if (source !== undefined && source !== null) {\n\t for (var nextKey in source) {\n\t if (source.hasOwnProperty(nextKey)) {\n\t output[nextKey] = source[nextKey];\n\t }\n\t }\n\t }\n\t }\n\t return output;\n\t };\n\t} else {\n\t assign = Object.assign;\n\t}\n\t\n\t/**\n\t * extend object.\n\t * means that properties in dest will be overwritten by the ones in src.\n\t * @param {Object} dest\n\t * @param {Object} src\n\t * @param {Boolean=false} [merge]\n\t * @returns {Object} dest\n\t */\n\tvar extend = deprecate(function extend(dest, src, merge) {\n\t var keys = Object.keys(src);\n\t var i = 0;\n\t while (i < keys.length) {\n\t if (!merge || (merge && dest[keys[i]] === undefined)) {\n\t dest[keys[i]] = src[keys[i]];\n\t }\n\t i++;\n\t }\n\t return dest;\n\t}, 'extend', 'Use `assign`.');\n\t\n\t/**\n\t * merge the values from src in the dest.\n\t * means that properties that exist in dest will not be overwritten by src\n\t * @param {Object} dest\n\t * @param {Object} src\n\t * @returns {Object} dest\n\t */\n\tvar merge = deprecate(function merge(dest, src) {\n\t return extend(dest, src, true);\n\t}, 'merge', 'Use `assign`.');\n\t\n\t/**\n\t * simple class inheritance\n\t * @param {Function} child\n\t * @param {Function} base\n\t * @param {Object} [properties]\n\t */\n\tfunction inherit(child, base, properties) {\n\t var baseP = base.prototype,\n\t childP;\n\t\n\t childP = child.prototype = Object.create(baseP);\n\t childP.constructor = child;\n\t childP._super = baseP;\n\t\n\t if (properties) {\n\t assign(childP, properties);\n\t }\n\t}\n\t\n\t/**\n\t * simple function bind\n\t * @param {Function} fn\n\t * @param {Object} context\n\t * @returns {Function}\n\t */\n\tfunction bindFn(fn, context) {\n\t return function boundFn() {\n\t return fn.apply(context, arguments);\n\t };\n\t}\n\t\n\t/**\n\t * let a boolean value also be a function that must return a boolean\n\t * this first item in args will be used as the context\n\t * @param {Boolean|Function} val\n\t * @param {Array} [args]\n\t * @returns {Boolean}\n\t */\n\tfunction boolOrFn(val, args) {\n\t if (typeof val == TYPE_FUNCTION) {\n\t return val.apply(args ? args[0] || undefined : undefined, args);\n\t }\n\t return val;\n\t}\n\t\n\t/**\n\t * use the val2 when val1 is undefined\n\t * @param {*} val1\n\t * @param {*} val2\n\t * @returns {*}\n\t */\n\tfunction ifUndefined(val1, val2) {\n\t return (val1 === undefined) ? val2 : val1;\n\t}\n\t\n\t/**\n\t * addEventListener with multiple events at once\n\t * @param {EventTarget} target\n\t * @param {String} types\n\t * @param {Function} handler\n\t */\n\tfunction addEventListeners(target, types, handler) {\n\t each(splitStr(types), function(type) {\n\t target.addEventListener(type, handler, false);\n\t });\n\t}\n\t\n\t/**\n\t * removeEventListener with multiple events at once\n\t * @param {EventTarget} target\n\t * @param {String} types\n\t * @param {Function} handler\n\t */\n\tfunction removeEventListeners(target, types, handler) {\n\t each(splitStr(types), function(type) {\n\t target.removeEventListener(type, handler, false);\n\t });\n\t}\n\t\n\t/**\n\t * find if a node is in the given parent\n\t * @method hasParent\n\t * @param {HTMLElement} node\n\t * @param {HTMLElement} parent\n\t * @return {Boolean} found\n\t */\n\tfunction hasParent(node, parent) {\n\t while (node) {\n\t if (node == parent) {\n\t return true;\n\t }\n\t node = node.parentNode;\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * small indexOf wrapper\n\t * @param {String} str\n\t * @param {String} find\n\t * @returns {Boolean} found\n\t */\n\tfunction inStr(str, find) {\n\t return str.indexOf(find) > -1;\n\t}\n\t\n\t/**\n\t * split string on whitespace\n\t * @param {String} str\n\t * @returns {Array} words\n\t */\n\tfunction splitStr(str) {\n\t return str.trim().split(/\\s+/g);\n\t}\n\t\n\t/**\n\t * find if a array contains the object using indexOf or a simple polyFill\n\t * @param {Array} src\n\t * @param {String} find\n\t * @param {String} [findByKey]\n\t * @return {Boolean|Number} false when not found, or the index\n\t */\n\tfunction inArray(src, find, findByKey) {\n\t if (src.indexOf && !findByKey) {\n\t return src.indexOf(find);\n\t } else {\n\t var i = 0;\n\t while (i < src.length) {\n\t if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n\t return i;\n\t }\n\t i++;\n\t }\n\t return -1;\n\t }\n\t}\n\t\n\t/**\n\t * convert array-like objects to real arrays\n\t * @param {Object} obj\n\t * @returns {Array}\n\t */\n\tfunction toArray(obj) {\n\t return Array.prototype.slice.call(obj, 0);\n\t}\n\t\n\t/**\n\t * unique array with objects based on a key (like 'id') or just by the array's value\n\t * @param {Array} src [{id:1},{id:2},{id:1}]\n\t * @param {String} [key]\n\t * @param {Boolean} [sort=False]\n\t * @returns {Array} [{id:1},{id:2}]\n\t */\n\tfunction uniqueArray(src, key, sort) {\n\t var results = [];\n\t var values = [];\n\t var i = 0;\n\t\n\t while (i < src.length) {\n\t var val = key ? src[i][key] : src[i];\n\t if (inArray(values, val) < 0) {\n\t results.push(src[i]);\n\t }\n\t values[i] = val;\n\t i++;\n\t }\n\t\n\t if (sort) {\n\t if (!key) {\n\t results = results.sort();\n\t } else {\n\t results = results.sort(function sortUniqueArray(a, b) {\n\t return a[key] > b[key];\n\t });\n\t }\n\t }\n\t\n\t return results;\n\t}\n\t\n\t/**\n\t * get the prefixed property\n\t * @param {Object} obj\n\t * @param {String} property\n\t * @returns {String|Undefined} prefixed\n\t */\n\tfunction prefixed(obj, property) {\n\t var prefix, prop;\n\t var camelProp = property[0].toUpperCase() + property.slice(1);\n\t\n\t var i = 0;\n\t while (i < VENDOR_PREFIXES.length) {\n\t prefix = VENDOR_PREFIXES[i];\n\t prop = (prefix) ? prefix + camelProp : property;\n\t\n\t if (prop in obj) {\n\t return prop;\n\t }\n\t i++;\n\t }\n\t return undefined;\n\t}\n\t\n\t/**\n\t * get a unique id\n\t * @returns {number} uniqueId\n\t */\n\tvar _uniqueId = 1;\n\tfunction uniqueId() {\n\t return _uniqueId++;\n\t}\n\t\n\t/**\n\t * get the window object of an element\n\t * @param {HTMLElement} element\n\t * @returns {DocumentView|Window}\n\t */\n\tfunction getWindowForElement(element) {\n\t var doc = element.ownerDocument || element;\n\t return (doc.defaultView || doc.parentWindow || window);\n\t}\n\t\n\tvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n\t\n\tvar SUPPORT_TOUCH = ('ontouchstart' in window);\n\tvar SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\n\tvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n\t\n\tvar INPUT_TYPE_TOUCH = 'touch';\n\tvar INPUT_TYPE_PEN = 'pen';\n\tvar INPUT_TYPE_MOUSE = 'mouse';\n\tvar INPUT_TYPE_KINECT = 'kinect';\n\t\n\tvar COMPUTE_INTERVAL = 25;\n\t\n\tvar INPUT_START = 1;\n\tvar INPUT_MOVE = 2;\n\tvar INPUT_END = 4;\n\tvar INPUT_CANCEL = 8;\n\t\n\tvar DIRECTION_NONE = 1;\n\tvar DIRECTION_LEFT = 2;\n\tvar DIRECTION_RIGHT = 4;\n\tvar DIRECTION_UP = 8;\n\tvar DIRECTION_DOWN = 16;\n\t\n\tvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\n\tvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\n\tvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n\t\n\tvar PROPS_XY = ['x', 'y'];\n\tvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\t\n\t/**\n\t * create new input type manager\n\t * @param {Manager} manager\n\t * @param {Function} callback\n\t * @returns {Input}\n\t * @constructor\n\t */\n\tfunction Input(manager, callback) {\n\t var self = this;\n\t this.manager = manager;\n\t this.callback = callback;\n\t this.element = manager.element;\n\t this.target = manager.options.inputTarget;\n\t\n\t // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n\t // so when disabled the input events are completely bypassed.\n\t this.domHandler = function(ev) {\n\t if (boolOrFn(manager.options.enable, [manager])) {\n\t self.handler(ev);\n\t }\n\t };\n\t\n\t this.init();\n\t\n\t}\n\t\n\tInput.prototype = {\n\t /**\n\t * should handle the inputEvent data and trigger the callback\n\t * @virtual\n\t */\n\t handler: function() { },\n\t\n\t /**\n\t * bind the events\n\t */\n\t init: function() {\n\t this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n\t this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n\t this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n\t },\n\t\n\t /**\n\t * unbind the events\n\t */\n\t destroy: function() {\n\t this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n\t this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n\t this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n\t }\n\t};\n\t\n\t/**\n\t * create new input type manager\n\t * called by the Manager constructor\n\t * @param {Hammer} manager\n\t * @returns {Input}\n\t */\n\tfunction createInputInstance(manager) {\n\t var Type;\n\t var inputClass = manager.options.inputClass;\n\t\n\t if (inputClass) {\n\t Type = inputClass;\n\t } else if (SUPPORT_POINTER_EVENTS) {\n\t Type = PointerEventInput;\n\t } else if (SUPPORT_ONLY_TOUCH) {\n\t Type = TouchInput;\n\t } else if (!SUPPORT_TOUCH) {\n\t Type = MouseInput;\n\t } else {\n\t Type = TouchMouseInput;\n\t }\n\t return new (Type)(manager, inputHandler);\n\t}\n\t\n\t/**\n\t * handle input events\n\t * @param {Manager} manager\n\t * @param {String} eventType\n\t * @param {Object} input\n\t */\n\tfunction inputHandler(manager, eventType, input) {\n\t var pointersLen = input.pointers.length;\n\t var changedPointersLen = input.changedPointers.length;\n\t var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n\t var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n\t\n\t input.isFirst = !!isFirst;\n\t input.isFinal = !!isFinal;\n\t\n\t if (isFirst) {\n\t manager.session = {};\n\t }\n\t\n\t // source event is the normalized value of the domEvents\n\t // like 'touchstart, mouseup, pointerdown'\n\t input.eventType = eventType;\n\t\n\t // compute scale, rotation etc\n\t computeInputData(manager, input);\n\t\n\t // emit secret event\n\t manager.emit('hammer.input', input);\n\t\n\t manager.recognize(input);\n\t manager.session.prevInput = input;\n\t}\n\t\n\t/**\n\t * extend the data with some usable properties like scale, rotate, velocity etc\n\t * @param {Object} manager\n\t * @param {Object} input\n\t */\n\tfunction computeInputData(manager, input) {\n\t var session = manager.session;\n\t var pointers = input.pointers;\n\t var pointersLength = pointers.length;\n\t\n\t // store the first input to calculate the distance and direction\n\t if (!session.firstInput) {\n\t session.firstInput = simpleCloneInputData(input);\n\t }\n\t\n\t // to compute scale and rotation we need to store the multiple touches\n\t if (pointersLength > 1 && !session.firstMultiple) {\n\t session.firstMultiple = simpleCloneInputData(input);\n\t } else if (pointersLength === 1) {\n\t session.firstMultiple = false;\n\t }\n\t\n\t var firstInput = session.firstInput;\n\t var firstMultiple = session.firstMultiple;\n\t var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n\t\n\t var center = input.center = getCenter(pointers);\n\t input.timeStamp = now();\n\t input.deltaTime = input.timeStamp - firstInput.timeStamp;\n\t\n\t input.angle = getAngle(offsetCenter, center);\n\t input.distance = getDistance(offsetCenter, center);\n\t\n\t computeDeltaXY(session, input);\n\t input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n\t\n\t var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n\t input.overallVelocityX = overallVelocity.x;\n\t input.overallVelocityY = overallVelocity.y;\n\t input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n\t\n\t input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n\t input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n\t\n\t input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n\t session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n\t\n\t computeIntervalInputData(session, input);\n\t\n\t // find the correct target\n\t var target = manager.element;\n\t if (hasParent(input.srcEvent.target, target)) {\n\t target = input.srcEvent.target;\n\t }\n\t input.target = target;\n\t}\n\t\n\tfunction computeDeltaXY(session, input) {\n\t var center = input.center;\n\t var offset = session.offsetDelta || {};\n\t var prevDelta = session.prevDelta || {};\n\t var prevInput = session.prevInput || {};\n\t\n\t if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n\t prevDelta = session.prevDelta = {\n\t x: prevInput.deltaX || 0,\n\t y: prevInput.deltaY || 0\n\t };\n\t\n\t offset = session.offsetDelta = {\n\t x: center.x,\n\t y: center.y\n\t };\n\t }\n\t\n\t input.deltaX = prevDelta.x + (center.x - offset.x);\n\t input.deltaY = prevDelta.y + (center.y - offset.y);\n\t}\n\t\n\t/**\n\t * velocity is calculated every x ms\n\t * @param {Object} session\n\t * @param {Object} input\n\t */\n\tfunction computeIntervalInputData(session, input) {\n\t var last = session.lastInterval || input,\n\t deltaTime = input.timeStamp - last.timeStamp,\n\t velocity, velocityX, velocityY, direction;\n\t\n\t if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n\t var deltaX = input.deltaX - last.deltaX;\n\t var deltaY = input.deltaY - last.deltaY;\n\t\n\t var v = getVelocity(deltaTime, deltaX, deltaY);\n\t velocityX = v.x;\n\t velocityY = v.y;\n\t velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n\t direction = getDirection(deltaX, deltaY);\n\t\n\t session.lastInterval = input;\n\t } else {\n\t // use latest velocity info if it doesn't overtake a minimum period\n\t velocity = last.velocity;\n\t velocityX = last.velocityX;\n\t velocityY = last.velocityY;\n\t direction = last.direction;\n\t }\n\t\n\t input.velocity = velocity;\n\t input.velocityX = velocityX;\n\t input.velocityY = velocityY;\n\t input.direction = direction;\n\t}\n\t\n\t/**\n\t * create a simple clone from the input used for storage of firstInput and firstMultiple\n\t * @param {Object} input\n\t * @returns {Object} clonedInputData\n\t */\n\tfunction simpleCloneInputData(input) {\n\t // make a simple copy of the pointers because we will get a reference if we don't\n\t // we only need clientXY for the calculations\n\t var pointers = [];\n\t var i = 0;\n\t while (i < input.pointers.length) {\n\t pointers[i] = {\n\t clientX: round(input.pointers[i].clientX),\n\t clientY: round(input.pointers[i].clientY)\n\t };\n\t i++;\n\t }\n\t\n\t return {\n\t timeStamp: now(),\n\t pointers: pointers,\n\t center: getCenter(pointers),\n\t deltaX: input.deltaX,\n\t deltaY: input.deltaY\n\t };\n\t}\n\t\n\t/**\n\t * get the center of all the pointers\n\t * @param {Array} pointers\n\t * @return {Object} center contains `x` and `y` properties\n\t */\n\tfunction getCenter(pointers) {\n\t var pointersLength = pointers.length;\n\t\n\t // no need to loop when only one touch\n\t if (pointersLength === 1) {\n\t return {\n\t x: round(pointers[0].clientX),\n\t y: round(pointers[0].clientY)\n\t };\n\t }\n\t\n\t var x = 0, y = 0, i = 0;\n\t while (i < pointersLength) {\n\t x += pointers[i].clientX;\n\t y += pointers[i].clientY;\n\t i++;\n\t }\n\t\n\t return {\n\t x: round(x / pointersLength),\n\t y: round(y / pointersLength)\n\t };\n\t}\n\t\n\t/**\n\t * calculate the velocity between two points. unit is in px per ms.\n\t * @param {Number} deltaTime\n\t * @param {Number} x\n\t * @param {Number} y\n\t * @return {Object} velocity `x` and `y`\n\t */\n\tfunction getVelocity(deltaTime, x, y) {\n\t return {\n\t x: x / deltaTime || 0,\n\t y: y / deltaTime || 0\n\t };\n\t}\n\t\n\t/**\n\t * get the direction between two points\n\t * @param {Number} x\n\t * @param {Number} y\n\t * @return {Number} direction\n\t */\n\tfunction getDirection(x, y) {\n\t if (x === y) {\n\t return DIRECTION_NONE;\n\t }\n\t\n\t if (abs(x) >= abs(y)) {\n\t return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n\t }\n\t return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n\t}\n\t\n\t/**\n\t * calculate the absolute distance between two points\n\t * @param {Object} p1 {x, y}\n\t * @param {Object} p2 {x, y}\n\t * @param {Array} [props] containing x and y keys\n\t * @return {Number} distance\n\t */\n\tfunction getDistance(p1, p2, props) {\n\t if (!props) {\n\t props = PROPS_XY;\n\t }\n\t var x = p2[props[0]] - p1[props[0]],\n\t y = p2[props[1]] - p1[props[1]];\n\t\n\t return Math.sqrt((x * x) + (y * y));\n\t}\n\t\n\t/**\n\t * calculate the angle between two coordinates\n\t * @param {Object} p1\n\t * @param {Object} p2\n\t * @param {Array} [props] containing x and y keys\n\t * @return {Number} angle\n\t */\n\tfunction getAngle(p1, p2, props) {\n\t if (!props) {\n\t props = PROPS_XY;\n\t }\n\t var x = p2[props[0]] - p1[props[0]],\n\t y = p2[props[1]] - p1[props[1]];\n\t return Math.atan2(y, x) * 180 / Math.PI;\n\t}\n\t\n\t/**\n\t * calculate the rotation degrees between two pointersets\n\t * @param {Array} start array of pointers\n\t * @param {Array} end array of pointers\n\t * @return {Number} rotation\n\t */\n\tfunction getRotation(start, end) {\n\t return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n\t}\n\t\n\t/**\n\t * calculate the scale factor between two pointersets\n\t * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n\t * @param {Array} start array of pointers\n\t * @param {Array} end array of pointers\n\t * @return {Number} scale\n\t */\n\tfunction getScale(start, end) {\n\t return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n\t}\n\t\n\tvar MOUSE_INPUT_MAP = {\n\t mousedown: INPUT_START,\n\t mousemove: INPUT_MOVE,\n\t mouseup: INPUT_END\n\t};\n\t\n\tvar MOUSE_ELEMENT_EVENTS = 'mousedown';\n\tvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\t\n\t/**\n\t * Mouse events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction MouseInput() {\n\t this.evEl = MOUSE_ELEMENT_EVENTS;\n\t this.evWin = MOUSE_WINDOW_EVENTS;\n\t\n\t this.allow = true; // used by Input.TouchMouse to disable mouse events\n\t this.pressed = false; // mousedown state\n\t\n\t Input.apply(this, arguments);\n\t}\n\t\n\tinherit(MouseInput, Input, {\n\t /**\n\t * handle mouse events\n\t * @param {Object} ev\n\t */\n\t handler: function MEhandler(ev) {\n\t var eventType = MOUSE_INPUT_MAP[ev.type];\n\t\n\t // on start we want to have the left mouse button down\n\t if (eventType & INPUT_START && ev.button === 0) {\n\t this.pressed = true;\n\t }\n\t\n\t if (eventType & INPUT_MOVE && ev.which !== 1) {\n\t eventType = INPUT_END;\n\t }\n\t\n\t // mouse must be down, and mouse events are allowed (see the TouchMouse input)\n\t if (!this.pressed || !this.allow) {\n\t return;\n\t }\n\t\n\t if (eventType & INPUT_END) {\n\t this.pressed = false;\n\t }\n\t\n\t this.callback(this.manager, eventType, {\n\t pointers: [ev],\n\t changedPointers: [ev],\n\t pointerType: INPUT_TYPE_MOUSE,\n\t srcEvent: ev\n\t });\n\t }\n\t});\n\t\n\tvar POINTER_INPUT_MAP = {\n\t pointerdown: INPUT_START,\n\t pointermove: INPUT_MOVE,\n\t pointerup: INPUT_END,\n\t pointercancel: INPUT_CANCEL,\n\t pointerout: INPUT_CANCEL\n\t};\n\t\n\t// in IE10 the pointer types is defined as an enum\n\tvar IE10_POINTER_TYPE_ENUM = {\n\t 2: INPUT_TYPE_TOUCH,\n\t 3: INPUT_TYPE_PEN,\n\t 4: INPUT_TYPE_MOUSE,\n\t 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n\t};\n\t\n\tvar POINTER_ELEMENT_EVENTS = 'pointerdown';\n\tvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\t\n\t// IE10 has prefixed support, and case-sensitive\n\tif (window.MSPointerEvent && !window.PointerEvent) {\n\t POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n\t POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n\t}\n\t\n\t/**\n\t * Pointer events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction PointerEventInput() {\n\t this.evEl = POINTER_ELEMENT_EVENTS;\n\t this.evWin = POINTER_WINDOW_EVENTS;\n\t\n\t Input.apply(this, arguments);\n\t\n\t this.store = (this.manager.session.pointerEvents = []);\n\t}\n\t\n\tinherit(PointerEventInput, Input, {\n\t /**\n\t * handle mouse events\n\t * @param {Object} ev\n\t */\n\t handler: function PEhandler(ev) {\n\t var store = this.store;\n\t var removePointer = false;\n\t\n\t var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n\t var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n\t var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n\t\n\t var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n\t\n\t // get index of the event in the store\n\t var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\t\n\t // start and mouse must be down\n\t if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n\t if (storeIndex < 0) {\n\t store.push(ev);\n\t storeIndex = store.length - 1;\n\t }\n\t } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n\t removePointer = true;\n\t }\n\t\n\t // it not found, so the pointer hasn't been down (so it's probably a hover)\n\t if (storeIndex < 0) {\n\t return;\n\t }\n\t\n\t // update the event in the store\n\t store[storeIndex] = ev;\n\t\n\t this.callback(this.manager, eventType, {\n\t pointers: store,\n\t changedPointers: [ev],\n\t pointerType: pointerType,\n\t srcEvent: ev\n\t });\n\t\n\t if (removePointer) {\n\t // remove from the store\n\t store.splice(storeIndex, 1);\n\t }\n\t }\n\t});\n\t\n\tvar SINGLE_TOUCH_INPUT_MAP = {\n\t touchstart: INPUT_START,\n\t touchmove: INPUT_MOVE,\n\t touchend: INPUT_END,\n\t touchcancel: INPUT_CANCEL\n\t};\n\t\n\tvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\n\tvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\t\n\t/**\n\t * Touch events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction SingleTouchInput() {\n\t this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n\t this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n\t this.started = false;\n\t\n\t Input.apply(this, arguments);\n\t}\n\t\n\tinherit(SingleTouchInput, Input, {\n\t handler: function TEhandler(ev) {\n\t var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\t\n\t // should we handle the touch events?\n\t if (type === INPUT_START) {\n\t this.started = true;\n\t }\n\t\n\t if (!this.started) {\n\t return;\n\t }\n\t\n\t var touches = normalizeSingleTouches.call(this, ev, type);\n\t\n\t // when done, reset the started state\n\t if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n\t this.started = false;\n\t }\n\t\n\t this.callback(this.manager, type, {\n\t pointers: touches[0],\n\t changedPointers: touches[1],\n\t pointerType: INPUT_TYPE_TOUCH,\n\t srcEvent: ev\n\t });\n\t }\n\t});\n\t\n\t/**\n\t * @this {TouchInput}\n\t * @param {Object} ev\n\t * @param {Number} type flag\n\t * @returns {undefined|Array} [all, changed]\n\t */\n\tfunction normalizeSingleTouches(ev, type) {\n\t var all = toArray(ev.touches);\n\t var changed = toArray(ev.changedTouches);\n\t\n\t if (type & (INPUT_END | INPUT_CANCEL)) {\n\t all = uniqueArray(all.concat(changed), 'identifier', true);\n\t }\n\t\n\t return [all, changed];\n\t}\n\t\n\tvar TOUCH_INPUT_MAP = {\n\t touchstart: INPUT_START,\n\t touchmove: INPUT_MOVE,\n\t touchend: INPUT_END,\n\t touchcancel: INPUT_CANCEL\n\t};\n\t\n\tvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\t\n\t/**\n\t * Multi-user touch events input\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction TouchInput() {\n\t this.evTarget = TOUCH_TARGET_EVENTS;\n\t this.targetIds = {};\n\t\n\t Input.apply(this, arguments);\n\t}\n\t\n\tinherit(TouchInput, Input, {\n\t handler: function MTEhandler(ev) {\n\t var type = TOUCH_INPUT_MAP[ev.type];\n\t var touches = getTouches.call(this, ev, type);\n\t if (!touches) {\n\t return;\n\t }\n\t\n\t this.callback(this.manager, type, {\n\t pointers: touches[0],\n\t changedPointers: touches[1],\n\t pointerType: INPUT_TYPE_TOUCH,\n\t srcEvent: ev\n\t });\n\t }\n\t});\n\t\n\t/**\n\t * @this {TouchInput}\n\t * @param {Object} ev\n\t * @param {Number} type flag\n\t * @returns {undefined|Array} [all, changed]\n\t */\n\tfunction getTouches(ev, type) {\n\t var allTouches = toArray(ev.touches);\n\t var targetIds = this.targetIds;\n\t\n\t // when there is only one touch, the process can be simplified\n\t if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n\t targetIds[allTouches[0].identifier] = true;\n\t return [allTouches, allTouches];\n\t }\n\t\n\t var i,\n\t targetTouches,\n\t changedTouches = toArray(ev.changedTouches),\n\t changedTargetTouches = [],\n\t target = this.target;\n\t\n\t // get target touches from touches\n\t targetTouches = allTouches.filter(function(touch) {\n\t return hasParent(touch.target, target);\n\t });\n\t\n\t // collect touches\n\t if (type === INPUT_START) {\n\t i = 0;\n\t while (i < targetTouches.length) {\n\t targetIds[targetTouches[i].identifier] = true;\n\t i++;\n\t }\n\t }\n\t\n\t // filter changed touches to only contain touches that exist in the collected target ids\n\t i = 0;\n\t while (i < changedTouches.length) {\n\t if (targetIds[changedTouches[i].identifier]) {\n\t changedTargetTouches.push(changedTouches[i]);\n\t }\n\t\n\t // cleanup removed touches\n\t if (type & (INPUT_END | INPUT_CANCEL)) {\n\t delete targetIds[changedTouches[i].identifier];\n\t }\n\t i++;\n\t }\n\t\n\t if (!changedTargetTouches.length) {\n\t return;\n\t }\n\t\n\t return [\n\t // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n\t uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n\t changedTargetTouches\n\t ];\n\t}\n\t\n\t/**\n\t * Combined touch and mouse input\n\t *\n\t * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n\t * This because touch devices also emit mouse events while doing a touch.\n\t *\n\t * @constructor\n\t * @extends Input\n\t */\n\tfunction TouchMouseInput() {\n\t Input.apply(this, arguments);\n\t\n\t var handler = bindFn(this.handler, this);\n\t this.touch = new TouchInput(this.manager, handler);\n\t this.mouse = new MouseInput(this.manager, handler);\n\t}\n\t\n\tinherit(TouchMouseInput, Input, {\n\t /**\n\t * handle mouse and touch events\n\t * @param {Hammer} manager\n\t * @param {String} inputEvent\n\t * @param {Object} inputData\n\t */\n\t handler: function TMEhandler(manager, inputEvent, inputData) {\n\t var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),\n\t isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n\t\n\t // when we're in a touch event, so block all upcoming mouse events\n\t // most mobile browser also emit mouseevents, right after touchstart\n\t if (isTouch) {\n\t this.mouse.allow = false;\n\t } else if (isMouse && !this.mouse.allow) {\n\t return;\n\t }\n\t\n\t // reset the allowMouse when we're done\n\t if (inputEvent & (INPUT_END | INPUT_CANCEL)) {\n\t this.mouse.allow = true;\n\t }\n\t\n\t this.callback(manager, inputEvent, inputData);\n\t },\n\t\n\t /**\n\t * remove the event listeners\n\t */\n\t destroy: function destroy() {\n\t this.touch.destroy();\n\t this.mouse.destroy();\n\t }\n\t});\n\t\n\tvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\n\tvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\t\n\t// magical touchAction value\n\tvar TOUCH_ACTION_COMPUTE = 'compute';\n\tvar TOUCH_ACTION_AUTO = 'auto';\n\tvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n\tvar TOUCH_ACTION_NONE = 'none';\n\tvar TOUCH_ACTION_PAN_X = 'pan-x';\n\tvar TOUCH_ACTION_PAN_Y = 'pan-y';\n\t\n\t/**\n\t * Touch Action\n\t * sets the touchAction property or uses the js alternative\n\t * @param {Manager} manager\n\t * @param {String} value\n\t * @constructor\n\t */\n\tfunction TouchAction(manager, value) {\n\t this.manager = manager;\n\t this.set(value);\n\t}\n\t\n\tTouchAction.prototype = {\n\t /**\n\t * set the touchAction value on the element or enable the polyfill\n\t * @param {String} value\n\t */\n\t set: function(value) {\n\t // find out the touch-action by the event handlers\n\t if (value == TOUCH_ACTION_COMPUTE) {\n\t value = this.compute();\n\t }\n\t\n\t if (NATIVE_TOUCH_ACTION && this.manager.element.style) {\n\t this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n\t }\n\t this.actions = value.toLowerCase().trim();\n\t },\n\t\n\t /**\n\t * just re-set the touchAction value\n\t */\n\t update: function() {\n\t this.set(this.manager.options.touchAction);\n\t },\n\t\n\t /**\n\t * compute the value for the touchAction property based on the recognizer's settings\n\t * @returns {String} value\n\t */\n\t compute: function() {\n\t var actions = [];\n\t each(this.manager.recognizers, function(recognizer) {\n\t if (boolOrFn(recognizer.options.enable, [recognizer])) {\n\t actions = actions.concat(recognizer.getTouchAction());\n\t }\n\t });\n\t return cleanTouchActions(actions.join(' '));\n\t },\n\t\n\t /**\n\t * this method is called on each input cycle and provides the preventing of the browser behavior\n\t * @param {Object} input\n\t */\n\t preventDefaults: function(input) {\n\t // not needed with native support for the touchAction property\n\t if (NATIVE_TOUCH_ACTION) {\n\t return;\n\t }\n\t\n\t var srcEvent = input.srcEvent;\n\t var direction = input.offsetDirection;\n\t\n\t // if the touch action did prevented once this session\n\t if (this.manager.session.prevented) {\n\t srcEvent.preventDefault();\n\t return;\n\t }\n\t\n\t var actions = this.actions;\n\t var hasNone = inStr(actions, TOUCH_ACTION_NONE);\n\t var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\t var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\t\n\t if (hasNone) {\n\t //do not prevent defaults if this is a tap gesture\n\t\n\t var isTapPointer = input.pointers.length === 1;\n\t var isTapMovement = input.distance < 2;\n\t var isTapTouchTime = input.deltaTime < 250;\n\t\n\t if (isTapPointer && isTapMovement && isTapTouchTime) {\n\t return;\n\t }\n\t }\n\t\n\t if (hasPanX && hasPanY) {\n\t // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n\t return;\n\t }\n\t\n\t if (hasNone ||\n\t (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n\t (hasPanX && direction & DIRECTION_VERTICAL)) {\n\t return this.preventSrc(srcEvent);\n\t }\n\t },\n\t\n\t /**\n\t * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n\t * @param {Object} srcEvent\n\t */\n\t preventSrc: function(srcEvent) {\n\t this.manager.session.prevented = true;\n\t srcEvent.preventDefault();\n\t }\n\t};\n\t\n\t/**\n\t * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n\t * @param {String} actions\n\t * @returns {*}\n\t */\n\tfunction cleanTouchActions(actions) {\n\t // none\n\t if (inStr(actions, TOUCH_ACTION_NONE)) {\n\t return TOUCH_ACTION_NONE;\n\t }\n\t\n\t var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\t var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\t\n\t // if both pan-x and pan-y are set (different recognizers\n\t // for different directions, e.g. horizontal pan but vertical swipe?)\n\t // we need none (as otherwise with pan-x pan-y combined none of these\n\t // recognizers will work, since the browser would handle all panning\n\t if (hasPanX && hasPanY) {\n\t return TOUCH_ACTION_NONE;\n\t }\n\t\n\t // pan-x OR pan-y\n\t if (hasPanX || hasPanY) {\n\t return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n\t }\n\t\n\t // manipulation\n\t if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n\t return TOUCH_ACTION_MANIPULATION;\n\t }\n\t\n\t return TOUCH_ACTION_AUTO;\n\t}\n\t\n\t/**\n\t * Recognizer flow explained; *\n\t * All recognizers have the initial state of POSSIBLE when a input session starts.\n\t * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n\t * Example session for mouse-input: mousedown -> mousemove -> mouseup\n\t *\n\t * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n\t * which determines with state it should be.\n\t *\n\t * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n\t * POSSIBLE to give it another change on the next cycle.\n\t *\n\t * Possible\n\t * |\n\t * +-----+---------------+\n\t * | |\n\t * +-----+-----+ |\n\t * | | |\n\t * Failed Cancelled |\n\t * +-------+------+\n\t * | |\n\t * Recognized Began\n\t * |\n\t * Changed\n\t * |\n\t * Ended/Recognized\n\t */\n\tvar STATE_POSSIBLE = 1;\n\tvar STATE_BEGAN = 2;\n\tvar STATE_CHANGED = 4;\n\tvar STATE_ENDED = 8;\n\tvar STATE_RECOGNIZED = STATE_ENDED;\n\tvar STATE_CANCELLED = 16;\n\tvar STATE_FAILED = 32;\n\t\n\t/**\n\t * Recognizer\n\t * Every recognizer needs to extend from this class.\n\t * @constructor\n\t * @param {Object} options\n\t */\n\tfunction Recognizer(options) {\n\t this.options = assign({}, this.defaults, options || {});\n\t\n\t this.id = uniqueId();\n\t\n\t this.manager = null;\n\t\n\t // default is enable true\n\t this.options.enable = ifUndefined(this.options.enable, true);\n\t\n\t this.state = STATE_POSSIBLE;\n\t\n\t this.simultaneous = {};\n\t this.requireFail = [];\n\t}\n\t\n\tRecognizer.prototype = {\n\t /**\n\t * @virtual\n\t * @type {Object}\n\t */\n\t defaults: {},\n\t\n\t /**\n\t * set options\n\t * @param {Object} options\n\t * @return {Recognizer}\n\t */\n\t set: function(options) {\n\t assign(this.options, options);\n\t\n\t // also update the touchAction, in case something changed about the directions/enabled state\n\t this.manager && this.manager.touchAction.update();\n\t return this;\n\t },\n\t\n\t /**\n\t * recognize simultaneous with an other recognizer.\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t recognizeWith: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n\t return this;\n\t }\n\t\n\t var simultaneous = this.simultaneous;\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t if (!simultaneous[otherRecognizer.id]) {\n\t simultaneous[otherRecognizer.id] = otherRecognizer;\n\t otherRecognizer.recognizeWith(this);\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t dropRecognizeWith: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n\t return this;\n\t }\n\t\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t delete this.simultaneous[otherRecognizer.id];\n\t return this;\n\t },\n\t\n\t /**\n\t * recognizer can only run when an other is failing\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t requireFailure: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n\t return this;\n\t }\n\t\n\t var requireFail = this.requireFail;\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t if (inArray(requireFail, otherRecognizer) === -1) {\n\t requireFail.push(otherRecognizer);\n\t otherRecognizer.requireFailure(this);\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * drop the requireFailure link. it does not remove the link on the other recognizer.\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Recognizer} this\n\t */\n\t dropRequireFailure: function(otherRecognizer) {\n\t if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n\t return this;\n\t }\n\t\n\t otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\t var index = inArray(this.requireFail, otherRecognizer);\n\t if (index > -1) {\n\t this.requireFail.splice(index, 1);\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * has require failures boolean\n\t * @returns {boolean}\n\t */\n\t hasRequireFailures: function() {\n\t return this.requireFail.length > 0;\n\t },\n\t\n\t /**\n\t * if the recognizer can recognize simultaneous with an other recognizer\n\t * @param {Recognizer} otherRecognizer\n\t * @returns {Boolean}\n\t */\n\t canRecognizeWith: function(otherRecognizer) {\n\t return !!this.simultaneous[otherRecognizer.id];\n\t },\n\t\n\t /**\n\t * You should use `tryEmit` instead of `emit` directly to check\n\t * that all the needed recognizers has failed before emitting.\n\t * @param {Object} input\n\t */\n\t emit: function(input) {\n\t var self = this;\n\t var state = this.state;\n\t\n\t function emit(event) {\n\t self.manager.emit(event, input);\n\t }\n\t\n\t // 'panstart' and 'panmove'\n\t if (state < STATE_ENDED) {\n\t emit(self.options.event + stateStr(state));\n\t }\n\t\n\t emit(self.options.event); // simple 'eventName' events\n\t\n\t if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n\t emit(input.additionalEvent);\n\t }\n\t\n\t // panend and pancancel\n\t if (state >= STATE_ENDED) {\n\t emit(self.options.event + stateStr(state));\n\t }\n\t },\n\t\n\t /**\n\t * Check that all the require failure recognizers has failed,\n\t * if true, it emits a gesture event,\n\t * otherwise, setup the state to FAILED.\n\t * @param {Object} input\n\t */\n\t tryEmit: function(input) {\n\t if (this.canEmit()) {\n\t return this.emit(input);\n\t }\n\t // it's failing anyway\n\t this.state = STATE_FAILED;\n\t },\n\t\n\t /**\n\t * can we emit?\n\t * @returns {boolean}\n\t */\n\t canEmit: function() {\n\t var i = 0;\n\t while (i < this.requireFail.length) {\n\t if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n\t return false;\n\t }\n\t i++;\n\t }\n\t return true;\n\t },\n\t\n\t /**\n\t * update the recognizer\n\t * @param {Object} inputData\n\t */\n\t recognize: function(inputData) {\n\t // make a new copy of the inputData\n\t // so we can change the inputData without messing up the other recognizers\n\t var inputDataClone = assign({}, inputData);\n\t\n\t // is is enabled and allow recognizing?\n\t if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n\t this.reset();\n\t this.state = STATE_FAILED;\n\t return;\n\t }\n\t\n\t // reset when we've reached the end\n\t if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n\t this.state = STATE_POSSIBLE;\n\t }\n\t\n\t this.state = this.process(inputDataClone);\n\t\n\t // the recognizer has recognized a gesture\n\t // so trigger an event\n\t if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n\t this.tryEmit(inputDataClone);\n\t }\n\t },\n\t\n\t /**\n\t * return the state of the recognizer\n\t * the actual recognizing happens in this method\n\t * @virtual\n\t * @param {Object} inputData\n\t * @returns {Const} STATE\n\t */\n\t process: function(inputData) { }, // jshint ignore:line\n\t\n\t /**\n\t * return the preferred touch-action\n\t * @virtual\n\t * @returns {Array}\n\t */\n\t getTouchAction: function() { },\n\t\n\t /**\n\t * called when the gesture isn't allowed to recognize\n\t * like when another is being recognized or it is disabled\n\t * @virtual\n\t */\n\t reset: function() { }\n\t};\n\t\n\t/**\n\t * get a usable string, used as event postfix\n\t * @param {Const} state\n\t * @returns {String} state\n\t */\n\tfunction stateStr(state) {\n\t if (state & STATE_CANCELLED) {\n\t return 'cancel';\n\t } else if (state & STATE_ENDED) {\n\t return 'end';\n\t } else if (state & STATE_CHANGED) {\n\t return 'move';\n\t } else if (state & STATE_BEGAN) {\n\t return 'start';\n\t }\n\t return '';\n\t}\n\t\n\t/**\n\t * direction cons to string\n\t * @param {Const} direction\n\t * @returns {String}\n\t */\n\tfunction directionStr(direction) {\n\t if (direction == DIRECTION_DOWN) {\n\t return 'down';\n\t } else if (direction == DIRECTION_UP) {\n\t return 'up';\n\t } else if (direction == DIRECTION_LEFT) {\n\t return 'left';\n\t } else if (direction == DIRECTION_RIGHT) {\n\t return 'right';\n\t }\n\t return '';\n\t}\n\t\n\t/**\n\t * get a recognizer by name if it is bound to a manager\n\t * @param {Recognizer|String} otherRecognizer\n\t * @param {Recognizer} recognizer\n\t * @returns {Recognizer}\n\t */\n\tfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n\t var manager = recognizer.manager;\n\t if (manager) {\n\t return manager.get(otherRecognizer);\n\t }\n\t return otherRecognizer;\n\t}\n\t\n\t/**\n\t * This recognizer is just used as a base for the simple attribute recognizers.\n\t * @constructor\n\t * @extends Recognizer\n\t */\n\tfunction AttrRecognizer() {\n\t Recognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(AttrRecognizer, Recognizer, {\n\t /**\n\t * @namespace\n\t * @memberof AttrRecognizer\n\t */\n\t defaults: {\n\t /**\n\t * @type {Number}\n\t * @default 1\n\t */\n\t pointers: 1\n\t },\n\t\n\t /**\n\t * Used to check if it the recognizer receives valid input, like input.distance > 10.\n\t * @memberof AttrRecognizer\n\t * @param {Object} input\n\t * @returns {Boolean} recognized\n\t */\n\t attrTest: function(input) {\n\t var optionPointers = this.options.pointers;\n\t return optionPointers === 0 || input.pointers.length === optionPointers;\n\t },\n\t\n\t /**\n\t * Process the input and return the state for the recognizer\n\t * @memberof AttrRecognizer\n\t * @param {Object} input\n\t * @returns {*} State\n\t */\n\t process: function(input) {\n\t var state = this.state;\n\t var eventType = input.eventType;\n\t\n\t var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n\t var isValid = this.attrTest(input);\n\t\n\t // on cancel input and we've recognized before, return STATE_CANCELLED\n\t if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n\t return state | STATE_CANCELLED;\n\t } else if (isRecognized || isValid) {\n\t if (eventType & INPUT_END) {\n\t return state | STATE_ENDED;\n\t } else if (!(state & STATE_BEGAN)) {\n\t return STATE_BEGAN;\n\t }\n\t return state | STATE_CHANGED;\n\t }\n\t return STATE_FAILED;\n\t }\n\t});\n\t\n\t/**\n\t * Pan\n\t * Recognized when the pointer is down and moved in the allowed direction.\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction PanRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t\n\t this.pX = null;\n\t this.pY = null;\n\t}\n\t\n\tinherit(PanRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PanRecognizer\n\t */\n\t defaults: {\n\t event: 'pan',\n\t threshold: 10,\n\t pointers: 1,\n\t direction: DIRECTION_ALL\n\t },\n\t\n\t getTouchAction: function() {\n\t var direction = this.options.direction;\n\t var actions = [];\n\t if (direction & DIRECTION_HORIZONTAL) {\n\t actions.push(TOUCH_ACTION_PAN_Y);\n\t }\n\t if (direction & DIRECTION_VERTICAL) {\n\t actions.push(TOUCH_ACTION_PAN_X);\n\t }\n\t return actions;\n\t },\n\t\n\t directionTest: function(input) {\n\t var options = this.options;\n\t var hasMoved = true;\n\t var distance = input.distance;\n\t var direction = input.direction;\n\t var x = input.deltaX;\n\t var y = input.deltaY;\n\t\n\t // lock to axis?\n\t if (!(direction & options.direction)) {\n\t if (options.direction & DIRECTION_HORIZONTAL) {\n\t direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n\t hasMoved = x != this.pX;\n\t distance = Math.abs(input.deltaX);\n\t } else {\n\t direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n\t hasMoved = y != this.pY;\n\t distance = Math.abs(input.deltaY);\n\t }\n\t }\n\t input.direction = direction;\n\t return hasMoved && distance > options.threshold && direction & options.direction;\n\t },\n\t\n\t attrTest: function(input) {\n\t return AttrRecognizer.prototype.attrTest.call(this, input) &&\n\t (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n\t },\n\t\n\t emit: function(input) {\n\t\n\t this.pX = input.deltaX;\n\t this.pY = input.deltaY;\n\t\n\t var direction = directionStr(input.direction);\n\t\n\t if (direction) {\n\t input.additionalEvent = this.options.event + direction;\n\t }\n\t this._super.emit.call(this, input);\n\t }\n\t});\n\t\n\t/**\n\t * Pinch\n\t * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction PinchRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(PinchRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PinchRecognizer\n\t */\n\t defaults: {\n\t event: 'pinch',\n\t threshold: 0,\n\t pointers: 2\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_NONE];\n\t },\n\t\n\t attrTest: function(input) {\n\t return this._super.attrTest.call(this, input) &&\n\t (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n\t },\n\t\n\t emit: function(input) {\n\t if (input.scale !== 1) {\n\t var inOut = input.scale < 1 ? 'in' : 'out';\n\t input.additionalEvent = this.options.event + inOut;\n\t }\n\t this._super.emit.call(this, input);\n\t }\n\t});\n\t\n\t/**\n\t * Press\n\t * Recognized when the pointer is down for x ms without any movement.\n\t * @constructor\n\t * @extends Recognizer\n\t */\n\tfunction PressRecognizer() {\n\t Recognizer.apply(this, arguments);\n\t\n\t this._timer = null;\n\t this._input = null;\n\t}\n\t\n\tinherit(PressRecognizer, Recognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PressRecognizer\n\t */\n\t defaults: {\n\t event: 'press',\n\t pointers: 1,\n\t time: 251, // minimal time of the pointer to be pressed\n\t threshold: 9 // a minimal movement is ok, but keep it low\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_AUTO];\n\t },\n\t\n\t process: function(input) {\n\t var options = this.options;\n\t var validPointers = input.pointers.length === options.pointers;\n\t var validMovement = input.distance < options.threshold;\n\t var validTime = input.deltaTime > options.time;\n\t\n\t this._input = input;\n\t\n\t // we only allow little movement\n\t // and we've reached an end event, so a tap is possible\n\t if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n\t this.reset();\n\t } else if (input.eventType & INPUT_START) {\n\t this.reset();\n\t this._timer = setTimeoutContext(function() {\n\t this.state = STATE_RECOGNIZED;\n\t this.tryEmit();\n\t }, options.time, this);\n\t } else if (input.eventType & INPUT_END) {\n\t return STATE_RECOGNIZED;\n\t }\n\t return STATE_FAILED;\n\t },\n\t\n\t reset: function() {\n\t clearTimeout(this._timer);\n\t },\n\t\n\t emit: function(input) {\n\t if (this.state !== STATE_RECOGNIZED) {\n\t return;\n\t }\n\t\n\t if (input && (input.eventType & INPUT_END)) {\n\t this.manager.emit(this.options.event + 'up', input);\n\t } else {\n\t this._input.timeStamp = now();\n\t this.manager.emit(this.options.event, this._input);\n\t }\n\t }\n\t});\n\t\n\t/**\n\t * Rotate\n\t * Recognized when two or more pointer are moving in a circular motion.\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction RotateRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(RotateRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof RotateRecognizer\n\t */\n\t defaults: {\n\t event: 'rotate',\n\t threshold: 0,\n\t pointers: 2\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_NONE];\n\t },\n\t\n\t attrTest: function(input) {\n\t return this._super.attrTest.call(this, input) &&\n\t (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n\t }\n\t});\n\t\n\t/**\n\t * Swipe\n\t * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n\t * @constructor\n\t * @extends AttrRecognizer\n\t */\n\tfunction SwipeRecognizer() {\n\t AttrRecognizer.apply(this, arguments);\n\t}\n\t\n\tinherit(SwipeRecognizer, AttrRecognizer, {\n\t /**\n\t * @namespace\n\t * @memberof SwipeRecognizer\n\t */\n\t defaults: {\n\t event: 'swipe',\n\t threshold: 10,\n\t velocity: 0.3,\n\t direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n\t pointers: 1\n\t },\n\t\n\t getTouchAction: function() {\n\t return PanRecognizer.prototype.getTouchAction.call(this);\n\t },\n\t\n\t attrTest: function(input) {\n\t var direction = this.options.direction;\n\t var velocity;\n\t\n\t if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n\t velocity = input.overallVelocity;\n\t } else if (direction & DIRECTION_HORIZONTAL) {\n\t velocity = input.overallVelocityX;\n\t } else if (direction & DIRECTION_VERTICAL) {\n\t velocity = input.overallVelocityY;\n\t }\n\t\n\t return this._super.attrTest.call(this, input) &&\n\t direction & input.offsetDirection &&\n\t input.distance > this.options.threshold &&\n\t input.maxPointers == this.options.pointers &&\n\t abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n\t },\n\t\n\t emit: function(input) {\n\t var direction = directionStr(input.offsetDirection);\n\t if (direction) {\n\t this.manager.emit(this.options.event + direction, input);\n\t }\n\t\n\t this.manager.emit(this.options.event, input);\n\t }\n\t});\n\t\n\t/**\n\t * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n\t * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n\t * a single tap.\n\t *\n\t * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n\t * multi-taps being recognized.\n\t * @constructor\n\t * @extends Recognizer\n\t */\n\tfunction TapRecognizer() {\n\t Recognizer.apply(this, arguments);\n\t\n\t // previous time and center,\n\t // used for tap counting\n\t this.pTime = false;\n\t this.pCenter = false;\n\t\n\t this._timer = null;\n\t this._input = null;\n\t this.count = 0;\n\t}\n\t\n\tinherit(TapRecognizer, Recognizer, {\n\t /**\n\t * @namespace\n\t * @memberof PinchRecognizer\n\t */\n\t defaults: {\n\t event: 'tap',\n\t pointers: 1,\n\t taps: 1,\n\t interval: 300, // max time between the multi-tap taps\n\t time: 250, // max time of the pointer to be down (like finger on the screen)\n\t threshold: 9, // a minimal movement is ok, but keep it low\n\t posThreshold: 10 // a multi-tap can be a bit off the initial position\n\t },\n\t\n\t getTouchAction: function() {\n\t return [TOUCH_ACTION_MANIPULATION];\n\t },\n\t\n\t process: function(input) {\n\t var options = this.options;\n\t\n\t var validPointers = input.pointers.length === options.pointers;\n\t var validMovement = input.distance < options.threshold;\n\t var validTouchTime = input.deltaTime < options.time;\n\t\n\t this.reset();\n\t\n\t if ((input.eventType & INPUT_START) && (this.count === 0)) {\n\t return this.failTimeout();\n\t }\n\t\n\t // we only allow little movement\n\t // and we've reached an end event, so a tap is possible\n\t if (validMovement && validTouchTime && validPointers) {\n\t if (input.eventType != INPUT_END) {\n\t return this.failTimeout();\n\t }\n\t\n\t var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n\t var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n\t\n\t this.pTime = input.timeStamp;\n\t this.pCenter = input.center;\n\t\n\t if (!validMultiTap || !validInterval) {\n\t this.count = 1;\n\t } else {\n\t this.count += 1;\n\t }\n\t\n\t this._input = input;\n\t\n\t // if tap count matches we have recognized it,\n\t // else it has began recognizing...\n\t var tapCount = this.count % options.taps;\n\t if (tapCount === 0) {\n\t // no failing requirements, immediately trigger the tap event\n\t // or wait as long as the multitap interval to trigger\n\t if (!this.hasRequireFailures()) {\n\t return STATE_RECOGNIZED;\n\t } else {\n\t this._timer = setTimeoutContext(function() {\n\t this.state = STATE_RECOGNIZED;\n\t this.tryEmit();\n\t }, options.interval, this);\n\t return STATE_BEGAN;\n\t }\n\t }\n\t }\n\t return STATE_FAILED;\n\t },\n\t\n\t failTimeout: function() {\n\t this._timer = setTimeoutContext(function() {\n\t this.state = STATE_FAILED;\n\t }, this.options.interval, this);\n\t return STATE_FAILED;\n\t },\n\t\n\t reset: function() {\n\t clearTimeout(this._timer);\n\t },\n\t\n\t emit: function() {\n\t if (this.state == STATE_RECOGNIZED) {\n\t this._input.tapCount = this.count;\n\t this.manager.emit(this.options.event, this._input);\n\t }\n\t }\n\t});\n\t\n\t/**\n\t * Simple way to create a manager with a default set of recognizers.\n\t * @param {HTMLElement} element\n\t * @param {Object} [options]\n\t * @constructor\n\t */\n\tfunction Hammer(element, options) {\n\t options = options || {};\n\t options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n\t return new Manager(element, options);\n\t}\n\t\n\t/**\n\t * @const {string}\n\t */\n\tHammer.VERSION = '2.0.6';\n\t\n\t/**\n\t * default settings\n\t * @namespace\n\t */\n\tHammer.defaults = {\n\t /**\n\t * set if DOM events are being triggered.\n\t * But this is slower and unused by simple implementations, so disabled by default.\n\t * @type {Boolean}\n\t * @default false\n\t */\n\t domEvents: false,\n\t\n\t /**\n\t * The value for the touchAction property/fallback.\n\t * When set to `compute` it will magically set the correct value based on the added recognizers.\n\t * @type {String}\n\t * @default compute\n\t */\n\t touchAction: TOUCH_ACTION_COMPUTE,\n\t\n\t /**\n\t * @type {Boolean}\n\t * @default true\n\t */\n\t enable: true,\n\t\n\t /**\n\t * EXPERIMENTAL FEATURE -- can be removed/changed\n\t * Change the parent input target element.\n\t * If Null, then it is being set the to main element.\n\t * @type {Null|EventTarget}\n\t * @default null\n\t */\n\t inputTarget: null,\n\t\n\t /**\n\t * force an input class\n\t * @type {Null|Function}\n\t * @default null\n\t */\n\t inputClass: null,\n\t\n\t /**\n\t * Default recognizer setup when calling `Hammer()`\n\t * When creating a new Manager these will be skipped.\n\t * @type {Array}\n\t */\n\t preset: [\n\t // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n\t [RotateRecognizer, {enable: false}],\n\t [PinchRecognizer, {enable: false}, ['rotate']],\n\t [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],\n\t [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],\n\t [TapRecognizer],\n\t [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],\n\t [PressRecognizer]\n\t ],\n\t\n\t /**\n\t * Some CSS properties can be used to improve the working of Hammer.\n\t * Add them to this method and they will be set when creating a new Manager.\n\t * @namespace\n\t */\n\t cssProps: {\n\t /**\n\t * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t userSelect: 'none',\n\t\n\t /**\n\t * Disable the Windows Phone grippers when pressing an element.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t touchSelect: 'none',\n\t\n\t /**\n\t * Disables the default callout shown when you touch and hold a touch target.\n\t * On iOS, when you touch and hold a touch target such as a link, Safari displays\n\t * a callout containing information about the link. This property allows you to disable that callout.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t touchCallout: 'none',\n\t\n\t /**\n\t * Specifies whether zooming is enabled. Used by IE10>\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t contentZooming: 'none',\n\t\n\t /**\n\t * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n\t * @type {String}\n\t * @default 'none'\n\t */\n\t userDrag: 'none',\n\t\n\t /**\n\t * Overrides the highlight color shown when the user taps a link or a JavaScript\n\t * clickable element in iOS. This property obeys the alpha value, if specified.\n\t * @type {String}\n\t * @default 'rgba(0,0,0,0)'\n\t */\n\t tapHighlightColor: 'rgba(0,0,0,0)'\n\t }\n\t};\n\t\n\tvar STOP = 1;\n\tvar FORCED_STOP = 2;\n\t\n\t/**\n\t * Manager\n\t * @param {HTMLElement} element\n\t * @param {Object} [options]\n\t * @constructor\n\t */\n\tfunction Manager(element, options) {\n\t this.options = assign({}, Hammer.defaults, options || {});\n\t\n\t this.options.inputTarget = this.options.inputTarget || element;\n\t\n\t this.handlers = {};\n\t this.session = {};\n\t this.recognizers = [];\n\t\n\t this.element = element;\n\t this.input = createInputInstance(this);\n\t this.touchAction = new TouchAction(this, this.options.touchAction);\n\t\n\t toggleCssProps(this, true);\n\t\n\t each(this.options.recognizers, function(item) {\n\t var recognizer = this.add(new (item[0])(item[1]));\n\t item[2] && recognizer.recognizeWith(item[2]);\n\t item[3] && recognizer.requireFailure(item[3]);\n\t }, this);\n\t}\n\t\n\tManager.prototype = {\n\t /**\n\t * set options\n\t * @param {Object} options\n\t * @returns {Manager}\n\t */\n\t set: function(options) {\n\t assign(this.options, options);\n\t\n\t // Options that need a little more setup\n\t if (options.touchAction) {\n\t this.touchAction.update();\n\t }\n\t if (options.inputTarget) {\n\t // Clean up existing event listeners and reinitialize\n\t this.input.destroy();\n\t this.input.target = options.inputTarget;\n\t this.input.init();\n\t }\n\t return this;\n\t },\n\t\n\t /**\n\t * stop recognizing for this session.\n\t * This session will be discarded, when a new [input]start event is fired.\n\t * When forced, the recognizer cycle is stopped immediately.\n\t * @param {Boolean} [force]\n\t */\n\t stop: function(force) {\n\t this.session.stopped = force ? FORCED_STOP : STOP;\n\t },\n\t\n\t /**\n\t * run the recognizers!\n\t * called by the inputHandler function on every movement of the pointers (touches)\n\t * it walks through all the recognizers and tries to detect the gesture that is being made\n\t * @param {Object} inputData\n\t */\n\t recognize: function(inputData) {\n\t var session = this.session;\n\t if (session.stopped) {\n\t return;\n\t }\n\t\n\t // run the touch-action polyfill\n\t this.touchAction.preventDefaults(inputData);\n\t\n\t var recognizer;\n\t var recognizers = this.recognizers;\n\t\n\t // this holds the recognizer that is being recognized.\n\t // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n\t // if no recognizer is detecting a thing, it is set to `null`\n\t var curRecognizer = session.curRecognizer;\n\t\n\t // reset when the last recognizer is recognized\n\t // or when we're in a new session\n\t if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n\t curRecognizer = session.curRecognizer = null;\n\t }\n\t\n\t var i = 0;\n\t while (i < recognizers.length) {\n\t recognizer = recognizers[i];\n\t\n\t // find out if we are allowed try to recognize the input for this one.\n\t // 1. allow if the session is NOT forced stopped (see the .stop() method)\n\t // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n\t // that is being recognized.\n\t // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n\t // this can be setup with the `recognizeWith()` method on the recognizer.\n\t if (session.stopped !== FORCED_STOP && ( // 1\n\t !curRecognizer || recognizer == curRecognizer || // 2\n\t recognizer.canRecognizeWith(curRecognizer))) { // 3\n\t recognizer.recognize(inputData);\n\t } else {\n\t recognizer.reset();\n\t }\n\t\n\t // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n\t // current active recognizer. but only if we don't already have an active recognizer\n\t if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n\t curRecognizer = session.curRecognizer = recognizer;\n\t }\n\t i++;\n\t }\n\t },\n\t\n\t /**\n\t * get a recognizer by its event name.\n\t * @param {Recognizer|String} recognizer\n\t * @returns {Recognizer|Null}\n\t */\n\t get: function(recognizer) {\n\t if (recognizer instanceof Recognizer) {\n\t return recognizer;\n\t }\n\t\n\t var recognizers = this.recognizers;\n\t for (var i = 0; i < recognizers.length; i++) {\n\t if (recognizers[i].options.event == recognizer) {\n\t return recognizers[i];\n\t }\n\t }\n\t return null;\n\t },\n\t\n\t /**\n\t * add a recognizer to the manager\n\t * existing recognizers with the same event name will be removed\n\t * @param {Recognizer} recognizer\n\t * @returns {Recognizer|Manager}\n\t */\n\t add: function(recognizer) {\n\t if (invokeArrayArg(recognizer, 'add', this)) {\n\t return this;\n\t }\n\t\n\t // remove existing\n\t var existing = this.get(recognizer.options.event);\n\t if (existing) {\n\t this.remove(existing);\n\t }\n\t\n\t this.recognizers.push(recognizer);\n\t recognizer.manager = this;\n\t\n\t this.touchAction.update();\n\t return recognizer;\n\t },\n\t\n\t /**\n\t * remove a recognizer by name or instance\n\t * @param {Recognizer|String} recognizer\n\t * @returns {Manager}\n\t */\n\t remove: function(recognizer) {\n\t if (invokeArrayArg(recognizer, 'remove', this)) {\n\t return this;\n\t }\n\t\n\t recognizer = this.get(recognizer);\n\t\n\t // let's make sure this recognizer exists\n\t if (recognizer) {\n\t var recognizers = this.recognizers;\n\t var index = inArray(recognizers, recognizer);\n\t\n\t if (index !== -1) {\n\t recognizers.splice(index, 1);\n\t this.touchAction.update();\n\t }\n\t }\n\t\n\t return this;\n\t },\n\t\n\t /**\n\t * bind event\n\t * @param {String} events\n\t * @param {Function} handler\n\t * @returns {EventEmitter} this\n\t */\n\t on: function(events, handler) {\n\t var handlers = this.handlers;\n\t each(splitStr(events), function(event) {\n\t handlers[event] = handlers[event] || [];\n\t handlers[event].push(handler);\n\t });\n\t return this;\n\t },\n\t\n\t /**\n\t * unbind event, leave emit blank to remove all handlers\n\t * @param {String} events\n\t * @param {Function} [handler]\n\t * @returns {EventEmitter} this\n\t */\n\t off: function(events, handler) {\n\t var handlers = this.handlers;\n\t each(splitStr(events), function(event) {\n\t if (!handler) {\n\t delete handlers[event];\n\t } else {\n\t handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n\t }\n\t });\n\t return this;\n\t },\n\t\n\t /**\n\t * emit event to the listeners\n\t * @param {String} event\n\t * @param {Object} data\n\t */\n\t emit: function(event, data) {\n\t // we also want to trigger dom events\n\t if (this.options.domEvents) {\n\t triggerDomEvent(event, data);\n\t }\n\t\n\t // no handlers, so skip it all\n\t var handlers = this.handlers[event] && this.handlers[event].slice();\n\t if (!handlers || !handlers.length) {\n\t return;\n\t }\n\t\n\t data.type = event;\n\t data.preventDefault = function() {\n\t data.srcEvent.preventDefault();\n\t };\n\t\n\t var i = 0;\n\t while (i < handlers.length) {\n\t handlers[i](data);\n\t i++;\n\t }\n\t },\n\t\n\t /**\n\t * destroy the manager and unbinds all events\n\t * it doesn't unbind dom events, that is the user own responsibility\n\t */\n\t destroy: function() {\n\t this.element && toggleCssProps(this, false);\n\t\n\t this.handlers = {};\n\t this.session = {};\n\t this.input.destroy();\n\t this.element = null;\n\t }\n\t};\n\t\n\t/**\n\t * add/remove the css properties as defined in manager.options.cssProps\n\t * @param {Manager} manager\n\t * @param {Boolean} add\n\t */\n\tfunction toggleCssProps(manager, add) {\n\t var element = manager.element;\n\t if (!element.style) {\n\t return;\n\t }\n\t each(manager.options.cssProps, function(value, name) {\n\t element.style[prefixed(element.style, name)] = add ? value : '';\n\t });\n\t}\n\t\n\t/**\n\t * trigger dom event\n\t * @param {String} event\n\t * @param {Object} data\n\t */\n\tfunction triggerDomEvent(event, data) {\n\t var gestureEvent = document.createEvent('Event');\n\t gestureEvent.initEvent(event, true, true);\n\t gestureEvent.gesture = data;\n\t data.target.dispatchEvent(gestureEvent);\n\t}\n\t\n\tassign(Hammer, {\n\t INPUT_START: INPUT_START,\n\t INPUT_MOVE: INPUT_MOVE,\n\t INPUT_END: INPUT_END,\n\t INPUT_CANCEL: INPUT_CANCEL,\n\t\n\t STATE_POSSIBLE: STATE_POSSIBLE,\n\t STATE_BEGAN: STATE_BEGAN,\n\t STATE_CHANGED: STATE_CHANGED,\n\t STATE_ENDED: STATE_ENDED,\n\t STATE_RECOGNIZED: STATE_RECOGNIZED,\n\t STATE_CANCELLED: STATE_CANCELLED,\n\t STATE_FAILED: STATE_FAILED,\n\t\n\t DIRECTION_NONE: DIRECTION_NONE,\n\t DIRECTION_LEFT: DIRECTION_LEFT,\n\t DIRECTION_RIGHT: DIRECTION_RIGHT,\n\t DIRECTION_UP: DIRECTION_UP,\n\t DIRECTION_DOWN: DIRECTION_DOWN,\n\t DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n\t DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n\t DIRECTION_ALL: DIRECTION_ALL,\n\t\n\t Manager: Manager,\n\t Input: Input,\n\t TouchAction: TouchAction,\n\t\n\t TouchInput: TouchInput,\n\t MouseInput: MouseInput,\n\t PointerEventInput: PointerEventInput,\n\t TouchMouseInput: TouchMouseInput,\n\t SingleTouchInput: SingleTouchInput,\n\t\n\t Recognizer: Recognizer,\n\t AttrRecognizer: AttrRecognizer,\n\t Tap: TapRecognizer,\n\t Pan: PanRecognizer,\n\t Swipe: SwipeRecognizer,\n\t Pinch: PinchRecognizer,\n\t Rotate: RotateRecognizer,\n\t Press: PressRecognizer,\n\t\n\t on: addEventListeners,\n\t off: removeEventListeners,\n\t each: each,\n\t merge: merge,\n\t extend: extend,\n\t assign: assign,\n\t inherit: inherit,\n\t bindFn: bindFn,\n\t prefixed: prefixed\n\t});\n\t\n\t// this prevents errors when Hammer is loaded in the presence of an AMD\n\t// style loader but by script tag, not by the loader.\n\tvar freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\n\tfreeGlobal.Hammer = Hammer;\n\t\n\tif (true) {\n\t !(__WEBPACK_AMD_DEFINE_RESULT__ = function() {\n\t return Hammer;\n\t }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else if (typeof module != 'undefined' && module.exports) {\n\t module.exports = Hammer;\n\t} else {\n\t window[exportName] = Hammer;\n\t}\n\t\n\t})(window, document, 'Hammer');\n\n\n/***/ },\n/* 55 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _TileLayer2 = __webpack_require__(56);\n\t\n\tvar _TileLayer3 = _interopRequireDefault(_TileLayer2);\n\t\n\tvar _ImageTile = __webpack_require__(66);\n\t\n\tvar _ImageTile2 = _interopRequireDefault(_ImageTile);\n\t\n\tvar _ImageTileLayerBaseMaterial = __webpack_require__(69);\n\t\n\tvar _ImageTileLayerBaseMaterial2 = _interopRequireDefault(_ImageTileLayerBaseMaterial);\n\t\n\tvar _lodashThrottle = __webpack_require__(49);\n\t\n\tvar _lodashThrottle2 = _interopRequireDefault(_lodashThrottle);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// DONE: Find a way to avoid the flashing caused by the gap between old tiles\n\t// being removed and the new tiles being ready for display\n\t//\n\t// DONE: Simplest first step for MVP would be to give each tile mesh the colour\n\t// of the basemap ground so it blends in a little more, or have a huge ground\n\t// plane underneath all the tiles that shows through between tile updates.\n\t//\n\t// Could keep the old tiles around until the new ones are ready, though they'd\n\t// probably need to be layered in a way so the old tiles don't overlap new ones,\n\t// which is similar to how Leaflet approaches this (it has 2 layers)\n\t//\n\t// Could keep the tile from the previous quadtree level visible until all 4\n\t// tiles at the new / current level have finished loading and are displayed.\n\t// Perhaps by keeping a map of tiles by quadcode and a boolean for each of the\n\t// child quadcodes showing whether they are loaded and in view. If all true then\n\t// remove the parent tile, otherwise keep it on a lower layer.\n\t\n\t// TODO: Load and display a base layer separate to the LOD grid that is at a low\n\t// resolution – used as a backup / background to fill in empty areas / distance\n\t\n\t// DONE: Fix the issue where some tiles just don't load, or at least the texture\n\t// never shows up – tends to happen if you quickly zoom in / out past it while\n\t// it's still loading, leaving a blank space\n\t\n\t// TODO: Optimise the request of many image tiles – look at how Leaflet and\n\t// OpenWebGlobe approach this (eg. batching, queues, etc)\n\t\n\t// TODO: Cancel pending tile requests if they get removed from view before they\n\t// reach a ready state (eg. cancel image requests, etc). Need to ensure that the\n\t// images are re-requested when the tile is next in scene (even if from cache)\n\t\n\t// TODO: Consider not performing an LOD calculation on every frame, instead only\n\t// on move end so panning, orbiting and zooming stays smooth. Otherwise it's\n\t// possible for performance to tank if you pan, orbit or zoom rapidly while all\n\t// the LOD calculations are being made and new tiles requested.\n\t//\n\t// Pending tiles should continue to be requested and output to the scene on each\n\t// frame, but no new LOD calculations should be made.\n\t\n\t// This tile layer both updates the quadtree and outputs tiles on every frame\n\t// (throttled to some amount)\n\t//\n\t// This is because the computational complexity of image tiles is generally low\n\t// and so there isn't much jank when running these calculations and outputs in\n\t// realtime\n\t//\n\t// The benefit to doing this is that the underlying map layer continues to\n\t// refresh and update during movement, which is an arguably better experience\n\t\n\tvar ImageTileLayer = (function (_TileLayer) {\n\t _inherits(ImageTileLayer, _TileLayer);\n\t\n\t function ImageTileLayer(path, options) {\n\t _classCallCheck(this, ImageTileLayer);\n\t\n\t var defaults = {\n\t distance: 40000\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(ImageTileLayer.prototype), 'constructor', this).call(this, options);\n\t\n\t this._path = path;\n\t }\n\t\n\t _createClass(ImageTileLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t var _this = this;\n\t\n\t _get(Object.getPrototypeOf(ImageTileLayer.prototype), '_onAdd', this).call(this, world);\n\t\n\t // Add base layer\n\t var geom = new _three2['default'].PlaneBufferGeometry(200000, 200000, 1);\n\t\n\t var baseMaterial;\n\t if (this._world._environment._skybox) {\n\t baseMaterial = (0, _ImageTileLayerBaseMaterial2['default'])('#f5f5f3', this._world._environment._skybox.getRenderTarget());\n\t } else {\n\t baseMaterial = (0, _ImageTileLayerBaseMaterial2['default'])('#f5f5f3');\n\t }\n\t\n\t var mesh = new _three2['default'].Mesh(geom, baseMaterial);\n\t mesh.renderOrder = 0;\n\t mesh.rotation.x = -90 * Math.PI / 180;\n\t\n\t // TODO: It might be overkill to receive a shadow on the base layer as it's\n\t // rarely seen (good to have if performance difference is negligible)\n\t mesh.receiveShadow = true;\n\t\n\t this._baseLayer = mesh;\n\t this.add(mesh);\n\t\n\t // Trigger initial quadtree calculation on the next frame\n\t //\n\t // TODO: This is a hack to ensure the camera is all set up - a better\n\t // solution should be found\n\t setTimeout(function () {\n\t _this._calculateLOD();\n\t _this._initEvents();\n\t }, 0);\n\t }\n\t }, {\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t // Run LOD calculations based on render calls\n\t //\n\t // Throttled to 1 LOD calculation per 100ms\n\t this._throttledWorldUpdate = (0, _lodashThrottle2['default'])(this._onWorldUpdate, 100);\n\t\n\t this._world.on('preUpdate', this._throttledWorldUpdate, this);\n\t this._world.on('move', this._onWorldMove, this);\n\t }\n\t }, {\n\t key: '_onWorldUpdate',\n\t value: function _onWorldUpdate() {\n\t this._calculateLOD();\n\t this._outputTiles();\n\t }\n\t }, {\n\t key: '_onWorldMove',\n\t value: function _onWorldMove(latlon, point) {\n\t this._moveBaseLayer(point);\n\t }\n\t }, {\n\t key: '_moveBaseLayer',\n\t value: function _moveBaseLayer(point) {\n\t this._baseLayer.position.x = point.x;\n\t this._baseLayer.position.z = point.y;\n\t }\n\t }, {\n\t key: '_createTile',\n\t value: function _createTile(quadcode, layer) {\n\t return new _ImageTile2['default'](quadcode, this._path, layer);\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._world.off('preUpdate', this._throttledWorldUpdate);\n\t this._world.off('move', this._onWorldMove);\n\t\n\t this._throttledWorldUpdate = null;\n\t\n\t // Dispose of mesh and materials\n\t this._baseLayer.geometry.dispose();\n\t this._baseLayer.geometry = null;\n\t\n\t if (this._baseLayer.material.map) {\n\t this._baseLayer.material.map.dispose();\n\t this._baseLayer.material.map = null;\n\t }\n\t\n\t this._baseLayer.material.dispose();\n\t this._baseLayer.material = null;\n\t\n\t this._baseLayer = null;\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(ImageTileLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return ImageTileLayer;\n\t})(_TileLayer3['default']);\n\t\n\texports['default'] = ImageTileLayer;\n\t\n\tvar noNew = function noNew(path, options) {\n\t return new ImageTileLayer(path, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.imageTileLayer = noNew;\n\n/***/ },\n/* 56 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Layer2 = __webpack_require__(46);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _TileCache = __webpack_require__(57);\n\t\n\tvar _TileCache2 = _interopRequireDefault(_TileCache);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Consider removing picking from TileLayer instances as there aren't\n\t// (m)any situations where it would be practical\n\t//\n\t// For example, how would you even know what picking IDs to listen to and what\n\t// to do with them?\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Consider keeping a single TileLayer / LOD instance running by default\n\t// that keeps a standard LOD grid for other layers to utilise, rather than\n\t// having to create their own, unique LOD grid and duplicate calculations when\n\t// they're going to use the same grid setup anyway\n\t//\n\t// It still makes sense to be able to have a custom LOD grid for some layers as\n\t// they may want to customise things, maybe not even using a quadtree at all!\n\t//\n\t// Perhaps it makes sense to split out the quadtree stuff into a singleton and\n\t// pass in the necessary parameters each time for the calculation step.\n\t//\n\t// Either way, it seems silly to force layers to have to create a new LOD grid\n\t// each time and create extra, duplicated processing every frame.\n\t\n\t// TODO: Allow passing in of options to define min/max LOD and a distance to use\n\t// for culling tiles beyond that distance.\n\t\n\t// DONE: Prevent tiles from being loaded if they are further than a certain\n\t// distance from the camera and are unlikely to be seen anyway\n\t\n\t// TODO: Avoid performing LOD calculation when it isn't required. For example,\n\t// when nothing has changed since the last frame and there are no tiles to be\n\t// loaded or in need of rendering\n\t\n\t// TODO: Only remove tiles from the layer that aren't to be rendered in the\n\t// current frame – it seems excessive to remove all tiles and re-add them on\n\t// every single frame, even if it's just array manipulation\n\t\n\t// TODO: Fix LOD calculation so min and max LOD can be changed without causing\n\t// problems (eg. making min above 5 causes all sorts of issues)\n\t\n\t// TODO: Reuse THREE objects where possible instead of creating new instances\n\t// on every LOD calculation\n\t\n\t// TODO: Consider not using THREE or LatLon / Point objects in LOD calculations\n\t// to avoid creating unnecessary memory for garbage collection\n\t\n\t// TODO: Prioritise loading of tiles at highest level in the quadtree (those\n\t// closest to the camera) so visual inconsistancies during loading are minimised\n\t\n\tvar TileLayer = (function (_Layer) {\n\t _inherits(TileLayer, _Layer);\n\t\n\t function TileLayer(options) {\n\t var _this = this;\n\t\n\t _classCallCheck(this, TileLayer);\n\t\n\t var defaults = {\n\t picking: false,\n\t maxCache: 1000,\n\t maxLOD: 18\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(TileLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t this._tileCache = new _TileCache2['default'](this._options.maxCache, function (tile) {\n\t _this._destroyTile(tile);\n\t });\n\t\n\t // List of tiles from the previous LOD calculation\n\t this._tileList = [];\n\t\n\t // TODO: Work out why changing the minLOD causes loads of issues\n\t this._minLOD = 3;\n\t this._maxLOD = this._options.maxLOD;\n\t\n\t this._frustum = new _three2['default'].Frustum();\n\t this._tiles = new _three2['default'].Object3D();\n\t this._tilesPicking = new _three2['default'].Object3D();\n\t }\n\t\n\t _createClass(TileLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this.addToPicking(this._tilesPicking);\n\t this.add(this._tiles);\n\t }\n\t }, {\n\t key: '_updateFrustum',\n\t value: function _updateFrustum() {\n\t var camera = this._world.getCamera();\n\t var projScreenMatrix = new _three2['default'].Matrix4();\n\t projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n\t\n\t this._frustum.setFromMatrix(camera.projectionMatrix);\n\t this._frustum.setFromMatrix(new _three2['default'].Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse));\n\t }\n\t }, {\n\t key: '_tileInFrustum',\n\t value: function _tileInFrustum(tile) {\n\t var bounds = tile.getBounds();\n\t return this._frustum.intersectsBox(new _three2['default'].Box3(new _three2['default'].Vector3(bounds[0], 0, bounds[3]), new _three2['default'].Vector3(bounds[2], 0, bounds[1])));\n\t }\n\t\n\t // Update and output tiles from the previous LOD checklist\n\t }, {\n\t key: '_outputTiles',\n\t value: function _outputTiles() {\n\t var _this2 = this;\n\t\n\t if (!this._tiles) {\n\t return;\n\t }\n\t\n\t // Remove all tiles from layer\n\t this._removeTiles();\n\t\n\t // Add / re-add tiles\n\t this._tileList.forEach(function (tile) {\n\t // Are the mesh and texture ready?\n\t //\n\t // If yes, continue\n\t // If no, skip\n\t if (!tile.isReady()) {\n\t return;\n\t }\n\t\n\t // Add tile to layer (and to scene) if not already there\n\t _this2._tiles.add(tile.getMesh());\n\t\n\t if (tile.getPickingMesh()) {\n\t _this2._tilesPicking.add(tile.getPickingMesh());\n\t }\n\t });\n\t }\n\t\n\t // Works out tiles in the view frustum and stores them in an array\n\t //\n\t // Does not output the tiles, deferring this to _outputTiles()\n\t }, {\n\t key: '_calculateLOD',\n\t value: function _calculateLOD() {\n\t var _this3 = this;\n\t\n\t if (this._stop || !this._world) {\n\t return;\n\t }\n\t\n\t // var start = performance.now();\n\t\n\t var camera = this._world.getCamera();\n\t\n\t // 1. Update and retrieve camera frustum\n\t this._updateFrustum(this._frustum, camera);\n\t\n\t // 2. Add the four root items of the quadtree to a check list\n\t var checkList = this._checklist;\n\t checkList = [];\n\t checkList.push(this._requestTile('0', this));\n\t checkList.push(this._requestTile('1', this));\n\t checkList.push(this._requestTile('2', this));\n\t checkList.push(this._requestTile('3', this));\n\t\n\t // 3. Call Divide, passing in the check list\n\t this._divide(checkList);\n\t\n\t // // 4. Remove all tiles from layer\n\t //\n\t // Moved to _outputTiles() for now\n\t // this._removeTiles();\n\t\n\t // 5. Filter the tiles remaining in the check list\n\t this._tileList = checkList.filter(function (tile, index) {\n\t // Skip tile if it's not in the current view frustum\n\t if (!_this3._tileInFrustum(tile)) {\n\t return false;\n\t }\n\t\n\t if (_this3._options.distance && _this3._options.distance > 0) {\n\t // TODO: Can probably speed this up\n\t var center = tile.getCenter();\n\t var dist = new _three2['default'].Vector3(center[0], 0, center[1]).sub(camera.position).length();\n\t\n\t // Manual distance limit to cut down on tiles so far away\n\t if (dist > _this3._options.distance) {\n\t return false;\n\t }\n\t }\n\t\n\t // Does the tile have a mesh?\n\t //\n\t // If yes, continue\n\t // If no, generate tile mesh, request texture and skip\n\t if (!tile.getMesh()) {\n\t tile.requestTileAsync();\n\t }\n\t\n\t return true;\n\t\n\t // Are the mesh and texture ready?\n\t //\n\t // If yes, continue\n\t // If no, skip\n\t // if (!tile.isReady()) {\n\t // return;\n\t // }\n\t //\n\t // // Add tile to layer (and to scene)\n\t // this._tiles.add(tile.getMesh());\n\t });\n\t\n\t // console.log(performance.now() - start);\n\t }\n\t }, {\n\t key: '_divide',\n\t value: function _divide(checkList) {\n\t var count = 0;\n\t var currentItem;\n\t var quadcode;\n\t\n\t // 1. Loop until count equals check list length\n\t while (count != checkList.length) {\n\t currentItem = checkList[count];\n\t quadcode = currentItem.getQuadcode();\n\t\n\t // 2. Increase count and continue loop if quadcode equals max LOD / zoom\n\t if (currentItem.length === this._maxLOD) {\n\t count++;\n\t continue;\n\t }\n\t\n\t // 3. Else, calculate screen-space error metric for quadcode\n\t if (this._screenSpaceError(currentItem)) {\n\t // 4. If error is sufficient...\n\t\n\t // 4a. Remove parent item from the check list\n\t checkList.splice(count, 1);\n\t\n\t // 4b. Add 4 child items to the check list\n\t checkList.push(this._requestTile(quadcode + '0', this));\n\t checkList.push(this._requestTile(quadcode + '1', this));\n\t checkList.push(this._requestTile(quadcode + '2', this));\n\t checkList.push(this._requestTile(quadcode + '3', this));\n\t\n\t // 4d. Continue the loop without increasing count\n\t continue;\n\t } else {\n\t // 5. Else, increase count and continue loop\n\t count++;\n\t }\n\t }\n\t }\n\t }, {\n\t key: '_screenSpaceError',\n\t value: function _screenSpaceError(tile) {\n\t var minDepth = this._minLOD;\n\t var maxDepth = this._maxLOD;\n\t\n\t var quadcode = tile.getQuadcode();\n\t\n\t var camera = this._world.getCamera();\n\t\n\t // Tweak this value to refine specific point that each quad is subdivided\n\t //\n\t // It's used to multiple the dimensions of the tile sides before\n\t // comparing against the tile distance from camera\n\t var quality = 3.0;\n\t\n\t // 1. Return false if quadcode length equals maxDepth (stop dividing)\n\t if (quadcode.length === maxDepth) {\n\t return false;\n\t }\n\t\n\t // 2. Return true if quadcode length is less than minDepth\n\t if (quadcode.length < minDepth) {\n\t return true;\n\t }\n\t\n\t // 3. Return false if quadcode bounds are not in view frustum\n\t if (!this._tileInFrustum(tile)) {\n\t return false;\n\t }\n\t\n\t var center = tile.getCenter();\n\t\n\t // 4. Calculate screen-space error metric\n\t // TODO: Use closest distance to one of the 4 tile corners\n\t var dist = new _three2['default'].Vector3(center[0], 0, center[1]).sub(camera.position).length();\n\t\n\t var error = quality * tile.getSide() / dist;\n\t\n\t // 5. Return true if error is greater than 1.0, else return false\n\t return error > 1.0;\n\t }\n\t }, {\n\t key: '_removeTiles',\n\t value: function _removeTiles() {\n\t if (!this._tiles || !this._tiles.children) {\n\t return;\n\t }\n\t\n\t for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n\t this._tiles.remove(this._tiles.children[i]);\n\t }\n\t\n\t if (!this._tilesPicking || !this._tilesPicking.children) {\n\t return;\n\t }\n\t\n\t for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n\t this._tilesPicking.remove(this._tilesPicking.children[i]);\n\t }\n\t }\n\t\n\t // Return a new tile instance\n\t }, {\n\t key: '_createTile',\n\t value: function _createTile(quadcode, layer) {}\n\t\n\t // Get a cached tile or request a new one if not in cache\n\t }, {\n\t key: '_requestTile',\n\t value: function _requestTile(quadcode, layer) {\n\t var tile = this._tileCache.getTile(quadcode);\n\t\n\t if (!tile) {\n\t // Set up a brand new tile\n\t tile = this._createTile(quadcode, layer);\n\t\n\t // Add tile to cache, though it won't be ready yet as the data is being\n\t // requested from various places asynchronously\n\t this._tileCache.setTile(quadcode, tile);\n\t }\n\t\n\t return tile;\n\t }\n\t }, {\n\t key: '_destroyTile',\n\t value: function _destroyTile(tile) {\n\t // Remove tile from scene\n\t this._tiles.remove(tile.getMesh());\n\t\n\t // Delete any references to the tile within this component\n\t\n\t // Call destory on tile instance\n\t tile.destroy();\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._tiles.children) {\n\t // Remove all tiles\n\t for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n\t this._tiles.remove(this._tiles.children[i]);\n\t }\n\t }\n\t\n\t // Remove tile from picking scene\n\t this.removeFromPicking(this._tilesPicking);\n\t\n\t if (this._tilesPicking.children) {\n\t // Remove all tiles\n\t for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n\t this._tilesPicking.remove(this._tilesPicking.children[i]);\n\t }\n\t }\n\t\n\t this._tileCache.destroy();\n\t this._tileCache = null;\n\t\n\t this._tiles = null;\n\t this._tilesPicking = null;\n\t this._frustum = null;\n\t\n\t _get(Object.getPrototypeOf(TileLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return TileLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = TileLayer;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 57 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _lruCache = __webpack_require__(58);\n\t\n\tvar _lruCache2 = _interopRequireDefault(_lruCache);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// This process is based on a similar approach taken by OpenWebGlobe\n\t// See: https://github.com/OpenWebGlobe/WebViewer/blob/master/source/core/globecache.js\n\t\n\tvar TileCache = (function () {\n\t function TileCache(cacheLimit, onDestroyTile) {\n\t _classCallCheck(this, TileCache);\n\t\n\t this._cache = (0, _lruCache2['default'])({\n\t max: cacheLimit,\n\t dispose: function dispose(key, tile) {\n\t onDestroyTile(tile);\n\t }\n\t });\n\t }\n\t\n\t // Returns true if all specified tile providers are ready to be used\n\t // Otherwise, returns false\n\t\n\t _createClass(TileCache, [{\n\t key: 'isReady',\n\t value: function isReady() {\n\t return false;\n\t }\n\t\n\t // Get a cached tile without requesting a new one\n\t }, {\n\t key: 'getTile',\n\t value: function getTile(quadcode) {\n\t return this._cache.get(quadcode);\n\t }\n\t\n\t // Add tile to cache\n\t }, {\n\t key: 'setTile',\n\t value: function setTile(quadcode, tile) {\n\t this._cache.set(quadcode, tile);\n\t }\n\t\n\t // Destroy the cache and remove it from memory\n\t //\n\t // TODO: Call destroy method on items in cache\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._cache.reset();\n\t this._cache = null;\n\t }\n\t }]);\n\t\n\t return TileCache;\n\t})();\n\t\n\texports['default'] = TileCache;\n\t\n\tvar noNew = function noNew(cacheLimit, onDestroyTile) {\n\t return new TileCache(cacheLimit, onDestroyTile);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.tileCache = noNew;\n\n/***/ },\n/* 58 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tmodule.exports = LRUCache\n\t\n\t// This will be a proper iterable 'Map' in engines that support it,\n\t// or a fakey-fake PseudoMap in older versions.\n\tvar Map = __webpack_require__(59)\n\tvar util = __webpack_require__(62)\n\t\n\t// A linked list to keep track of recently-used-ness\n\tvar Yallist = __webpack_require__(65)\n\t\n\t// use symbols if possible, otherwise just _props\n\tvar symbols = {}\n\tvar hasSymbol = typeof Symbol === 'function'\n\tvar makeSymbol\n\tif (hasSymbol) {\n\t makeSymbol = function (key) {\n\t return Symbol.for(key)\n\t }\n\t} else {\n\t makeSymbol = function (key) {\n\t return '_' + key\n\t }\n\t}\n\t\n\tfunction priv (obj, key, val) {\n\t var sym\n\t if (symbols[key]) {\n\t sym = symbols[key]\n\t } else {\n\t sym = makeSymbol(key)\n\t symbols[key] = sym\n\t }\n\t if (arguments.length === 2) {\n\t return obj[sym]\n\t } else {\n\t obj[sym] = val\n\t return val\n\t }\n\t}\n\t\n\tfunction naiveLength () { return 1 }\n\t\n\t// lruList is a yallist where the head is the youngest\n\t// item, and the tail is the oldest. the list contains the Hit\n\t// objects as the entries.\n\t// Each Hit object has a reference to its Yallist.Node. This\n\t// never changes.\n\t//\n\t// cache is a Map (or PseudoMap) that matches the keys to\n\t// the Yallist.Node object.\n\tfunction LRUCache (options) {\n\t if (!(this instanceof LRUCache)) {\n\t return new LRUCache(options)\n\t }\n\t\n\t if (typeof options === 'number') {\n\t options = { max: options }\n\t }\n\t\n\t if (!options) {\n\t options = {}\n\t }\n\t\n\t var max = priv(this, 'max', options.max)\n\t // Kind of weird to have a default max of Infinity, but oh well.\n\t if (!max ||\n\t !(typeof max === 'number') ||\n\t max <= 0) {\n\t priv(this, 'max', Infinity)\n\t }\n\t\n\t var lc = options.length || naiveLength\n\t if (typeof lc !== 'function') {\n\t lc = naiveLength\n\t }\n\t priv(this, 'lengthCalculator', lc)\n\t\n\t priv(this, 'allowStale', options.stale || false)\n\t priv(this, 'maxAge', options.maxAge || 0)\n\t priv(this, 'dispose', options.dispose)\n\t this.reset()\n\t}\n\t\n\t// resize the cache when the max changes.\n\tObject.defineProperty(LRUCache.prototype, 'max', {\n\t set: function (mL) {\n\t if (!mL || !(typeof mL === 'number') || mL <= 0) {\n\t mL = Infinity\n\t }\n\t priv(this, 'max', mL)\n\t trim(this)\n\t },\n\t get: function () {\n\t return priv(this, 'max')\n\t },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'allowStale', {\n\t set: function (allowStale) {\n\t priv(this, 'allowStale', !!allowStale)\n\t },\n\t get: function () {\n\t return priv(this, 'allowStale')\n\t },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'maxAge', {\n\t set: function (mA) {\n\t if (!mA || !(typeof mA === 'number') || mA < 0) {\n\t mA = 0\n\t }\n\t priv(this, 'maxAge', mA)\n\t trim(this)\n\t },\n\t get: function () {\n\t return priv(this, 'maxAge')\n\t },\n\t enumerable: true\n\t})\n\t\n\t// resize the cache when the lengthCalculator changes.\n\tObject.defineProperty(LRUCache.prototype, 'lengthCalculator', {\n\t set: function (lC) {\n\t if (typeof lC !== 'function') {\n\t lC = naiveLength\n\t }\n\t if (lC !== priv(this, 'lengthCalculator')) {\n\t priv(this, 'lengthCalculator', lC)\n\t priv(this, 'length', 0)\n\t priv(this, 'lruList').forEach(function (hit) {\n\t hit.length = priv(this, 'lengthCalculator').call(this, hit.value, hit.key)\n\t priv(this, 'length', priv(this, 'length') + hit.length)\n\t }, this)\n\t }\n\t trim(this)\n\t },\n\t get: function () { return priv(this, 'lengthCalculator') },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'length', {\n\t get: function () { return priv(this, 'length') },\n\t enumerable: true\n\t})\n\t\n\tObject.defineProperty(LRUCache.prototype, 'itemCount', {\n\t get: function () { return priv(this, 'lruList').length },\n\t enumerable: true\n\t})\n\t\n\tLRUCache.prototype.rforEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = priv(this, 'lruList').tail; walker !== null;) {\n\t var prev = walker.prev\n\t forEachStep(this, fn, walker, thisp)\n\t walker = prev\n\t }\n\t}\n\t\n\tfunction forEachStep (self, fn, node, thisp) {\n\t var hit = node.value\n\t if (isStale(self, hit)) {\n\t del(self, node)\n\t if (!priv(self, 'allowStale')) {\n\t hit = undefined\n\t }\n\t }\n\t if (hit) {\n\t fn.call(thisp, hit.value, hit.key, self)\n\t }\n\t}\n\t\n\tLRUCache.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = priv(this, 'lruList').head; walker !== null;) {\n\t var next = walker.next\n\t forEachStep(this, fn, walker, thisp)\n\t walker = next\n\t }\n\t}\n\t\n\tLRUCache.prototype.keys = function () {\n\t return priv(this, 'lruList').toArray().map(function (k) {\n\t return k.key\n\t }, this)\n\t}\n\t\n\tLRUCache.prototype.values = function () {\n\t return priv(this, 'lruList').toArray().map(function (k) {\n\t return k.value\n\t }, this)\n\t}\n\t\n\tLRUCache.prototype.reset = function () {\n\t if (priv(this, 'dispose') &&\n\t priv(this, 'lruList') &&\n\t priv(this, 'lruList').length) {\n\t priv(this, 'lruList').forEach(function (hit) {\n\t priv(this, 'dispose').call(this, hit.key, hit.value)\n\t }, this)\n\t }\n\t\n\t priv(this, 'cache', new Map()) // hash of items by key\n\t priv(this, 'lruList', new Yallist()) // list of items in order of use recency\n\t priv(this, 'length', 0) // length of items in the list\n\t}\n\t\n\tLRUCache.prototype.dump = function () {\n\t return priv(this, 'lruList').map(function (hit) {\n\t if (!isStale(this, hit)) {\n\t return {\n\t k: hit.key,\n\t v: hit.value,\n\t e: hit.now + (hit.maxAge || 0)\n\t }\n\t }\n\t }, this).toArray().filter(function (h) {\n\t return h\n\t })\n\t}\n\t\n\tLRUCache.prototype.dumpLru = function () {\n\t return priv(this, 'lruList')\n\t}\n\t\n\tLRUCache.prototype.inspect = function (n, opts) {\n\t var str = 'LRUCache {'\n\t var extras = false\n\t\n\t var as = priv(this, 'allowStale')\n\t if (as) {\n\t str += '\\n allowStale: true'\n\t extras = true\n\t }\n\t\n\t var max = priv(this, 'max')\n\t if (max && max !== Infinity) {\n\t if (extras) {\n\t str += ','\n\t }\n\t str += '\\n max: ' + util.inspect(max, opts)\n\t extras = true\n\t }\n\t\n\t var maxAge = priv(this, 'maxAge')\n\t if (maxAge) {\n\t if (extras) {\n\t str += ','\n\t }\n\t str += '\\n maxAge: ' + util.inspect(maxAge, opts)\n\t extras = true\n\t }\n\t\n\t var lc = priv(this, 'lengthCalculator')\n\t if (lc && lc !== naiveLength) {\n\t if (extras) {\n\t str += ','\n\t }\n\t str += '\\n length: ' + util.inspect(priv(this, 'length'), opts)\n\t extras = true\n\t }\n\t\n\t var didFirst = false\n\t priv(this, 'lruList').forEach(function (item) {\n\t if (didFirst) {\n\t str += ',\\n '\n\t } else {\n\t if (extras) {\n\t str += ',\\n'\n\t }\n\t didFirst = true\n\t str += '\\n '\n\t }\n\t var key = util.inspect(item.key).split('\\n').join('\\n ')\n\t var val = { value: item.value }\n\t if (item.maxAge !== maxAge) {\n\t val.maxAge = item.maxAge\n\t }\n\t if (lc !== naiveLength) {\n\t val.length = item.length\n\t }\n\t if (isStale(this, item)) {\n\t val.stale = true\n\t }\n\t\n\t val = util.inspect(val, opts).split('\\n').join('\\n ')\n\t str += key + ' => ' + val\n\t })\n\t\n\t if (didFirst || extras) {\n\t str += '\\n'\n\t }\n\t str += '}'\n\t\n\t return str\n\t}\n\t\n\tLRUCache.prototype.set = function (key, value, maxAge) {\n\t maxAge = maxAge || priv(this, 'maxAge')\n\t\n\t var now = maxAge ? Date.now() : 0\n\t var len = priv(this, 'lengthCalculator').call(this, value, key)\n\t\n\t if (priv(this, 'cache').has(key)) {\n\t if (len > priv(this, 'max')) {\n\t del(this, priv(this, 'cache').get(key))\n\t return false\n\t }\n\t\n\t var node = priv(this, 'cache').get(key)\n\t var item = node.value\n\t\n\t // dispose of the old one before overwriting\n\t if (priv(this, 'dispose')) {\n\t priv(this, 'dispose').call(this, key, item.value)\n\t }\n\t\n\t item.now = now\n\t item.maxAge = maxAge\n\t item.value = value\n\t priv(this, 'length', priv(this, 'length') + (len - item.length))\n\t item.length = len\n\t this.get(key)\n\t trim(this)\n\t return true\n\t }\n\t\n\t var hit = new Entry(key, value, len, now, maxAge)\n\t\n\t // oversized objects fall out of cache automatically.\n\t if (hit.length > priv(this, 'max')) {\n\t if (priv(this, 'dispose')) {\n\t priv(this, 'dispose').call(this, key, value)\n\t }\n\t return false\n\t }\n\t\n\t priv(this, 'length', priv(this, 'length') + hit.length)\n\t priv(this, 'lruList').unshift(hit)\n\t priv(this, 'cache').set(key, priv(this, 'lruList').head)\n\t trim(this)\n\t return true\n\t}\n\t\n\tLRUCache.prototype.has = function (key) {\n\t if (!priv(this, 'cache').has(key)) return false\n\t var hit = priv(this, 'cache').get(key).value\n\t if (isStale(this, hit)) {\n\t return false\n\t }\n\t return true\n\t}\n\t\n\tLRUCache.prototype.get = function (key) {\n\t return get(this, key, true)\n\t}\n\t\n\tLRUCache.prototype.peek = function (key) {\n\t return get(this, key, false)\n\t}\n\t\n\tLRUCache.prototype.pop = function () {\n\t var node = priv(this, 'lruList').tail\n\t if (!node) return null\n\t del(this, node)\n\t return node.value\n\t}\n\t\n\tLRUCache.prototype.del = function (key) {\n\t del(this, priv(this, 'cache').get(key))\n\t}\n\t\n\tLRUCache.prototype.load = function (arr) {\n\t // reset the cache\n\t this.reset()\n\t\n\t var now = Date.now()\n\t // A previous serialized cache has the most recent items first\n\t for (var l = arr.length - 1; l >= 0; l--) {\n\t var hit = arr[l]\n\t var expiresAt = hit.e || 0\n\t if (expiresAt === 0) {\n\t // the item was created without expiration in a non aged cache\n\t this.set(hit.k, hit.v)\n\t } else {\n\t var maxAge = expiresAt - now\n\t // dont add already expired items\n\t if (maxAge > 0) {\n\t this.set(hit.k, hit.v, maxAge)\n\t }\n\t }\n\t }\n\t}\n\t\n\tLRUCache.prototype.prune = function () {\n\t var self = this\n\t priv(this, 'cache').forEach(function (value, key) {\n\t get(self, key, false)\n\t })\n\t}\n\t\n\tfunction get (self, key, doUse) {\n\t var node = priv(self, 'cache').get(key)\n\t if (node) {\n\t var hit = node.value\n\t if (isStale(self, hit)) {\n\t del(self, node)\n\t if (!priv(self, 'allowStale')) hit = undefined\n\t } else {\n\t if (doUse) {\n\t priv(self, 'lruList').unshiftNode(node)\n\t }\n\t }\n\t if (hit) hit = hit.value\n\t }\n\t return hit\n\t}\n\t\n\tfunction isStale (self, hit) {\n\t if (!hit || (!hit.maxAge && !priv(self, 'maxAge'))) {\n\t return false\n\t }\n\t var stale = false\n\t var diff = Date.now() - hit.now\n\t if (hit.maxAge) {\n\t stale = diff > hit.maxAge\n\t } else {\n\t stale = priv(self, 'maxAge') && (diff > priv(self, 'maxAge'))\n\t }\n\t return stale\n\t}\n\t\n\tfunction trim (self) {\n\t if (priv(self, 'length') > priv(self, 'max')) {\n\t for (var walker = priv(self, 'lruList').tail;\n\t priv(self, 'length') > priv(self, 'max') && walker !== null;) {\n\t // We know that we're about to delete this one, and also\n\t // what the next least recently used key will be, so just\n\t // go ahead and set it now.\n\t var prev = walker.prev\n\t del(self, walker)\n\t walker = prev\n\t }\n\t }\n\t}\n\t\n\tfunction del (self, node) {\n\t if (node) {\n\t var hit = node.value\n\t if (priv(self, 'dispose')) {\n\t priv(self, 'dispose').call(this, hit.key, hit.value)\n\t }\n\t priv(self, 'length', priv(self, 'length') - hit.length)\n\t priv(self, 'cache').delete(hit.key)\n\t priv(self, 'lruList').removeNode(node)\n\t }\n\t}\n\t\n\t// classy, since V8 prefers predictable objects.\n\tfunction Entry (key, value, length, now, maxAge) {\n\t this.key = key\n\t this.value = value\n\t this.length = length\n\t this.now = now\n\t this.maxAge = maxAge || 0\n\t}\n\n\n/***/ },\n/* 59 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(process) {if (process.env.npm_package_name === 'pseudomap' &&\n\t process.env.npm_lifecycle_script === 'test')\n\t process.env.TEST_PSEUDOMAP = 'true'\n\t\n\tif (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) {\n\t module.exports = Map\n\t} else {\n\t module.exports = __webpack_require__(61)\n\t}\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(60)))\n\n/***/ },\n/* 60 */\n/***/ function(module, exports) {\n\n\t// shim for using process in browser\n\t\n\tvar process = module.exports = {};\n\tvar queue = [];\n\tvar draining = false;\n\tvar currentQueue;\n\tvar queueIndex = -1;\n\t\n\tfunction cleanUpNextTick() {\n\t draining = false;\n\t if (currentQueue.length) {\n\t queue = currentQueue.concat(queue);\n\t } else {\n\t queueIndex = -1;\n\t }\n\t if (queue.length) {\n\t drainQueue();\n\t }\n\t}\n\t\n\tfunction drainQueue() {\n\t if (draining) {\n\t return;\n\t }\n\t var timeout = setTimeout(cleanUpNextTick);\n\t draining = true;\n\t\n\t var len = queue.length;\n\t while(len) {\n\t currentQueue = queue;\n\t queue = [];\n\t while (++queueIndex < len) {\n\t if (currentQueue) {\n\t currentQueue[queueIndex].run();\n\t }\n\t }\n\t queueIndex = -1;\n\t len = queue.length;\n\t }\n\t currentQueue = null;\n\t draining = false;\n\t clearTimeout(timeout);\n\t}\n\t\n\tprocess.nextTick = function (fun) {\n\t var args = new Array(arguments.length - 1);\n\t if (arguments.length > 1) {\n\t for (var i = 1; i < arguments.length; i++) {\n\t args[i - 1] = arguments[i];\n\t }\n\t }\n\t queue.push(new Item(fun, args));\n\t if (queue.length === 1 && !draining) {\n\t setTimeout(drainQueue, 0);\n\t }\n\t};\n\t\n\t// v8 likes predictible objects\n\tfunction Item(fun, array) {\n\t this.fun = fun;\n\t this.array = array;\n\t}\n\tItem.prototype.run = function () {\n\t this.fun.apply(null, this.array);\n\t};\n\tprocess.title = 'browser';\n\tprocess.browser = true;\n\tprocess.env = {};\n\tprocess.argv = [];\n\tprocess.version = ''; // empty string to avoid regexp issues\n\tprocess.versions = {};\n\t\n\tfunction noop() {}\n\t\n\tprocess.on = noop;\n\tprocess.addListener = noop;\n\tprocess.once = noop;\n\tprocess.off = noop;\n\tprocess.removeListener = noop;\n\tprocess.removeAllListeners = noop;\n\tprocess.emit = noop;\n\t\n\tprocess.binding = function (name) {\n\t throw new Error('process.binding is not supported');\n\t};\n\t\n\tprocess.cwd = function () { return '/' };\n\tprocess.chdir = function (dir) {\n\t throw new Error('process.chdir is not supported');\n\t};\n\tprocess.umask = function() { return 0; };\n\n\n/***/ },\n/* 61 */\n/***/ function(module, exports) {\n\n\tvar hasOwnProperty = Object.prototype.hasOwnProperty\n\t\n\tmodule.exports = PseudoMap\n\t\n\tfunction PseudoMap (set) {\n\t if (!(this instanceof PseudoMap)) // whyyyyyyy\n\t throw new TypeError(\"Constructor PseudoMap requires 'new'\")\n\t\n\t this.clear()\n\t\n\t if (set) {\n\t if ((set instanceof PseudoMap) ||\n\t (typeof Map === 'function' && set instanceof Map))\n\t set.forEach(function (value, key) {\n\t this.set(key, value)\n\t }, this)\n\t else if (Array.isArray(set))\n\t set.forEach(function (kv) {\n\t this.set(kv[0], kv[1])\n\t }, this)\n\t else\n\t throw new TypeError('invalid argument')\n\t }\n\t}\n\t\n\tPseudoMap.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t Object.keys(this._data).forEach(function (k) {\n\t if (k !== 'size')\n\t fn.call(thisp, this._data[k].value, this._data[k].key)\n\t }, this)\n\t}\n\t\n\tPseudoMap.prototype.has = function (k) {\n\t return !!find(this._data, k)\n\t}\n\t\n\tPseudoMap.prototype.get = function (k) {\n\t var res = find(this._data, k)\n\t return res && res.value\n\t}\n\t\n\tPseudoMap.prototype.set = function (k, v) {\n\t set(this._data, k, v)\n\t}\n\t\n\tPseudoMap.prototype.delete = function (k) {\n\t var res = find(this._data, k)\n\t if (res) {\n\t delete this._data[res._index]\n\t this._data.size--\n\t }\n\t}\n\t\n\tPseudoMap.prototype.clear = function () {\n\t var data = Object.create(null)\n\t data.size = 0\n\t\n\t Object.defineProperty(this, '_data', {\n\t value: data,\n\t enumerable: false,\n\t configurable: true,\n\t writable: false\n\t })\n\t}\n\t\n\tObject.defineProperty(PseudoMap.prototype, 'size', {\n\t get: function () {\n\t return this._data.size\n\t },\n\t set: function (n) {},\n\t enumerable: true,\n\t configurable: true\n\t})\n\t\n\tPseudoMap.prototype.values =\n\tPseudoMap.prototype.keys =\n\tPseudoMap.prototype.entries = function () {\n\t throw new Error('iterators are not implemented in this version')\n\t}\n\t\n\t// Either identical, or both NaN\n\tfunction same (a, b) {\n\t return a === b || a !== a && b !== b\n\t}\n\t\n\tfunction Entry (k, v, i) {\n\t this.key = k\n\t this.value = v\n\t this._index = i\n\t}\n\t\n\tfunction find (data, k) {\n\t for (var i = 0, s = '_' + k, key = s;\n\t hasOwnProperty.call(data, key);\n\t key = s + i++) {\n\t if (same(data[key].key, k))\n\t return data[key]\n\t }\n\t}\n\t\n\tfunction set (data, k, v) {\n\t for (var i = 0, s = '_' + k, key = s;\n\t hasOwnProperty.call(data, key);\n\t key = s + i++) {\n\t if (same(data[key].key, k)) {\n\t data[key].value = v\n\t return\n\t }\n\t }\n\t data.size++\n\t data[key] = new Entry(k, v, key)\n\t}\n\n\n/***/ },\n/* 62 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.\n\t//\n\t// Permission is hereby granted, free of charge, to any person obtaining a\n\t// copy of this software and associated documentation files (the\n\t// \"Software\"), to deal in the Software without restriction, including\n\t// without limitation the rights to use, copy, modify, merge, publish,\n\t// distribute, sublicense, and/or sell copies of the Software, and to permit\n\t// persons to whom the Software is furnished to do so, subject to the\n\t// following conditions:\n\t//\n\t// The above copyright notice and this permission notice shall be included\n\t// in all copies or substantial portions of the Software.\n\t//\n\t// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n\t// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\t// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n\t// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n\t// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n\t// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n\t// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\t\n\tvar formatRegExp = /%[sdj%]/g;\n\texports.format = function(f) {\n\t if (!isString(f)) {\n\t var objects = [];\n\t for (var i = 0; i < arguments.length; i++) {\n\t objects.push(inspect(arguments[i]));\n\t }\n\t return objects.join(' ');\n\t }\n\t\n\t var i = 1;\n\t var args = arguments;\n\t var len = args.length;\n\t var str = String(f).replace(formatRegExp, function(x) {\n\t if (x === '%%') return '%';\n\t if (i >= len) return x;\n\t switch (x) {\n\t case '%s': return String(args[i++]);\n\t case '%d': return Number(args[i++]);\n\t case '%j':\n\t try {\n\t return JSON.stringify(args[i++]);\n\t } catch (_) {\n\t return '[Circular]';\n\t }\n\t default:\n\t return x;\n\t }\n\t });\n\t for (var x = args[i]; i < len; x = args[++i]) {\n\t if (isNull(x) || !isObject(x)) {\n\t str += ' ' + x;\n\t } else {\n\t str += ' ' + inspect(x);\n\t }\n\t }\n\t return str;\n\t};\n\t\n\t\n\t// Mark that a method should not be used.\n\t// Returns a modified function which warns once by default.\n\t// If --no-deprecation is set, then it is a no-op.\n\texports.deprecate = function(fn, msg) {\n\t // Allow for deprecating things in the process of starting up.\n\t if (isUndefined(global.process)) {\n\t return function() {\n\t return exports.deprecate(fn, msg).apply(this, arguments);\n\t };\n\t }\n\t\n\t if (process.noDeprecation === true) {\n\t return fn;\n\t }\n\t\n\t var warned = false;\n\t function deprecated() {\n\t if (!warned) {\n\t if (process.throwDeprecation) {\n\t throw new Error(msg);\n\t } else if (process.traceDeprecation) {\n\t console.trace(msg);\n\t } else {\n\t console.error(msg);\n\t }\n\t warned = true;\n\t }\n\t return fn.apply(this, arguments);\n\t }\n\t\n\t return deprecated;\n\t};\n\t\n\t\n\tvar debugs = {};\n\tvar debugEnviron;\n\texports.debuglog = function(set) {\n\t if (isUndefined(debugEnviron))\n\t debugEnviron = process.env.NODE_DEBUG || '';\n\t set = set.toUpperCase();\n\t if (!debugs[set]) {\n\t if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n\t var pid = process.pid;\n\t debugs[set] = function() {\n\t var msg = exports.format.apply(exports, arguments);\n\t console.error('%s %d: %s', set, pid, msg);\n\t };\n\t } else {\n\t debugs[set] = function() {};\n\t }\n\t }\n\t return debugs[set];\n\t};\n\t\n\t\n\t/**\n\t * Echos the value of a value. Trys to print the value out\n\t * in the best way possible given the different types.\n\t *\n\t * @param {Object} obj The object to print out.\n\t * @param {Object} opts Optional options object that alters the output.\n\t */\n\t/* legacy: obj, showHidden, depth, colors*/\n\tfunction inspect(obj, opts) {\n\t // default options\n\t var ctx = {\n\t seen: [],\n\t stylize: stylizeNoColor\n\t };\n\t // legacy...\n\t if (arguments.length >= 3) ctx.depth = arguments[2];\n\t if (arguments.length >= 4) ctx.colors = arguments[3];\n\t if (isBoolean(opts)) {\n\t // legacy...\n\t ctx.showHidden = opts;\n\t } else if (opts) {\n\t // got an \"options\" object\n\t exports._extend(ctx, opts);\n\t }\n\t // set default options\n\t if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n\t if (isUndefined(ctx.depth)) ctx.depth = 2;\n\t if (isUndefined(ctx.colors)) ctx.colors = false;\n\t if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n\t if (ctx.colors) ctx.stylize = stylizeWithColor;\n\t return formatValue(ctx, obj, ctx.depth);\n\t}\n\texports.inspect = inspect;\n\t\n\t\n\t// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\n\tinspect.colors = {\n\t 'bold' : [1, 22],\n\t 'italic' : [3, 23],\n\t 'underline' : [4, 24],\n\t 'inverse' : [7, 27],\n\t 'white' : [37, 39],\n\t 'grey' : [90, 39],\n\t 'black' : [30, 39],\n\t 'blue' : [34, 39],\n\t 'cyan' : [36, 39],\n\t 'green' : [32, 39],\n\t 'magenta' : [35, 39],\n\t 'red' : [31, 39],\n\t 'yellow' : [33, 39]\n\t};\n\t\n\t// Don't use 'blue' not visible on cmd.exe\n\tinspect.styles = {\n\t 'special': 'cyan',\n\t 'number': 'yellow',\n\t 'boolean': 'yellow',\n\t 'undefined': 'grey',\n\t 'null': 'bold',\n\t 'string': 'green',\n\t 'date': 'magenta',\n\t // \"name\": intentionally not styling\n\t 'regexp': 'red'\n\t};\n\t\n\t\n\tfunction stylizeWithColor(str, styleType) {\n\t var style = inspect.styles[styleType];\n\t\n\t if (style) {\n\t return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n\t '\\u001b[' + inspect.colors[style][1] + 'm';\n\t } else {\n\t return str;\n\t }\n\t}\n\t\n\t\n\tfunction stylizeNoColor(str, styleType) {\n\t return str;\n\t}\n\t\n\t\n\tfunction arrayToHash(array) {\n\t var hash = {};\n\t\n\t array.forEach(function(val, idx) {\n\t hash[val] = true;\n\t });\n\t\n\t return hash;\n\t}\n\t\n\t\n\tfunction formatValue(ctx, value, recurseTimes) {\n\t // Provide a hook for user-specified inspect functions.\n\t // Check that value is an object with an inspect function on it\n\t if (ctx.customInspect &&\n\t value &&\n\t isFunction(value.inspect) &&\n\t // Filter out the util module, it's inspect function is special\n\t value.inspect !== exports.inspect &&\n\t // Also filter out any prototype objects using the circular check.\n\t !(value.constructor && value.constructor.prototype === value)) {\n\t var ret = value.inspect(recurseTimes, ctx);\n\t if (!isString(ret)) {\n\t ret = formatValue(ctx, ret, recurseTimes);\n\t }\n\t return ret;\n\t }\n\t\n\t // Primitive types cannot have properties\n\t var primitive = formatPrimitive(ctx, value);\n\t if (primitive) {\n\t return primitive;\n\t }\n\t\n\t // Look up the keys of the object.\n\t var keys = Object.keys(value);\n\t var visibleKeys = arrayToHash(keys);\n\t\n\t if (ctx.showHidden) {\n\t keys = Object.getOwnPropertyNames(value);\n\t }\n\t\n\t // IE doesn't make error fields non-enumerable\n\t // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n\t if (isError(value)\n\t && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n\t return formatError(value);\n\t }\n\t\n\t // Some type of object without properties can be shortcutted.\n\t if (keys.length === 0) {\n\t if (isFunction(value)) {\n\t var name = value.name ? ': ' + value.name : '';\n\t return ctx.stylize('[Function' + name + ']', 'special');\n\t }\n\t if (isRegExp(value)) {\n\t return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n\t }\n\t if (isDate(value)) {\n\t return ctx.stylize(Date.prototype.toString.call(value), 'date');\n\t }\n\t if (isError(value)) {\n\t return formatError(value);\n\t }\n\t }\n\t\n\t var base = '', array = false, braces = ['{', '}'];\n\t\n\t // Make Array say that they are Array\n\t if (isArray(value)) {\n\t array = true;\n\t braces = ['[', ']'];\n\t }\n\t\n\t // Make functions say that they are functions\n\t if (isFunction(value)) {\n\t var n = value.name ? ': ' + value.name : '';\n\t base = ' [Function' + n + ']';\n\t }\n\t\n\t // Make RegExps say that they are RegExps\n\t if (isRegExp(value)) {\n\t base = ' ' + RegExp.prototype.toString.call(value);\n\t }\n\t\n\t // Make dates with properties first say the date\n\t if (isDate(value)) {\n\t base = ' ' + Date.prototype.toUTCString.call(value);\n\t }\n\t\n\t // Make error with message first say the error\n\t if (isError(value)) {\n\t base = ' ' + formatError(value);\n\t }\n\t\n\t if (keys.length === 0 && (!array || value.length == 0)) {\n\t return braces[0] + base + braces[1];\n\t }\n\t\n\t if (recurseTimes < 0) {\n\t if (isRegExp(value)) {\n\t return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n\t } else {\n\t return ctx.stylize('[Object]', 'special');\n\t }\n\t }\n\t\n\t ctx.seen.push(value);\n\t\n\t var output;\n\t if (array) {\n\t output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n\t } else {\n\t output = keys.map(function(key) {\n\t return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n\t });\n\t }\n\t\n\t ctx.seen.pop();\n\t\n\t return reduceToSingleString(output, base, braces);\n\t}\n\t\n\t\n\tfunction formatPrimitive(ctx, value) {\n\t if (isUndefined(value))\n\t return ctx.stylize('undefined', 'undefined');\n\t if (isString(value)) {\n\t var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n\t .replace(/'/g, \"\\\\'\")\n\t .replace(/\\\\\"/g, '\"') + '\\'';\n\t return ctx.stylize(simple, 'string');\n\t }\n\t if (isNumber(value))\n\t return ctx.stylize('' + value, 'number');\n\t if (isBoolean(value))\n\t return ctx.stylize('' + value, 'boolean');\n\t // For some reason typeof null is \"object\", so special case here.\n\t if (isNull(value))\n\t return ctx.stylize('null', 'null');\n\t}\n\t\n\t\n\tfunction formatError(value) {\n\t return '[' + Error.prototype.toString.call(value) + ']';\n\t}\n\t\n\t\n\tfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n\t var output = [];\n\t for (var i = 0, l = value.length; i < l; ++i) {\n\t if (hasOwnProperty(value, String(i))) {\n\t output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n\t String(i), true));\n\t } else {\n\t output.push('');\n\t }\n\t }\n\t keys.forEach(function(key) {\n\t if (!key.match(/^\\d+$/)) {\n\t output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n\t key, true));\n\t }\n\t });\n\t return output;\n\t}\n\t\n\t\n\tfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n\t var name, str, desc;\n\t desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n\t if (desc.get) {\n\t if (desc.set) {\n\t str = ctx.stylize('[Getter/Setter]', 'special');\n\t } else {\n\t str = ctx.stylize('[Getter]', 'special');\n\t }\n\t } else {\n\t if (desc.set) {\n\t str = ctx.stylize('[Setter]', 'special');\n\t }\n\t }\n\t if (!hasOwnProperty(visibleKeys, key)) {\n\t name = '[' + key + ']';\n\t }\n\t if (!str) {\n\t if (ctx.seen.indexOf(desc.value) < 0) {\n\t if (isNull(recurseTimes)) {\n\t str = formatValue(ctx, desc.value, null);\n\t } else {\n\t str = formatValue(ctx, desc.value, recurseTimes - 1);\n\t }\n\t if (str.indexOf('\\n') > -1) {\n\t if (array) {\n\t str = str.split('\\n').map(function(line) {\n\t return ' ' + line;\n\t }).join('\\n').substr(2);\n\t } else {\n\t str = '\\n' + str.split('\\n').map(function(line) {\n\t return ' ' + line;\n\t }).join('\\n');\n\t }\n\t }\n\t } else {\n\t str = ctx.stylize('[Circular]', 'special');\n\t }\n\t }\n\t if (isUndefined(name)) {\n\t if (array && key.match(/^\\d+$/)) {\n\t return str;\n\t }\n\t name = JSON.stringify('' + key);\n\t if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n\t name = name.substr(1, name.length - 2);\n\t name = ctx.stylize(name, 'name');\n\t } else {\n\t name = name.replace(/'/g, \"\\\\'\")\n\t .replace(/\\\\\"/g, '\"')\n\t .replace(/(^\"|\"$)/g, \"'\");\n\t name = ctx.stylize(name, 'string');\n\t }\n\t }\n\t\n\t return name + ': ' + str;\n\t}\n\t\n\t\n\tfunction reduceToSingleString(output, base, braces) {\n\t var numLinesEst = 0;\n\t var length = output.reduce(function(prev, cur) {\n\t numLinesEst++;\n\t if (cur.indexOf('\\n') >= 0) numLinesEst++;\n\t return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n\t }, 0);\n\t\n\t if (length > 60) {\n\t return braces[0] +\n\t (base === '' ? '' : base + '\\n ') +\n\t ' ' +\n\t output.join(',\\n ') +\n\t ' ' +\n\t braces[1];\n\t }\n\t\n\t return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n\t}\n\t\n\t\n\t// NOTE: These type checking functions intentionally don't use `instanceof`\n\t// because it is fragile and can be easily faked with `Object.create()`.\n\tfunction isArray(ar) {\n\t return Array.isArray(ar);\n\t}\n\texports.isArray = isArray;\n\t\n\tfunction isBoolean(arg) {\n\t return typeof arg === 'boolean';\n\t}\n\texports.isBoolean = isBoolean;\n\t\n\tfunction isNull(arg) {\n\t return arg === null;\n\t}\n\texports.isNull = isNull;\n\t\n\tfunction isNullOrUndefined(arg) {\n\t return arg == null;\n\t}\n\texports.isNullOrUndefined = isNullOrUndefined;\n\t\n\tfunction isNumber(arg) {\n\t return typeof arg === 'number';\n\t}\n\texports.isNumber = isNumber;\n\t\n\tfunction isString(arg) {\n\t return typeof arg === 'string';\n\t}\n\texports.isString = isString;\n\t\n\tfunction isSymbol(arg) {\n\t return typeof arg === 'symbol';\n\t}\n\texports.isSymbol = isSymbol;\n\t\n\tfunction isUndefined(arg) {\n\t return arg === void 0;\n\t}\n\texports.isUndefined = isUndefined;\n\t\n\tfunction isRegExp(re) {\n\t return isObject(re) && objectToString(re) === '[object RegExp]';\n\t}\n\texports.isRegExp = isRegExp;\n\t\n\tfunction isObject(arg) {\n\t return typeof arg === 'object' && arg !== null;\n\t}\n\texports.isObject = isObject;\n\t\n\tfunction isDate(d) {\n\t return isObject(d) && objectToString(d) === '[object Date]';\n\t}\n\texports.isDate = isDate;\n\t\n\tfunction isError(e) {\n\t return isObject(e) &&\n\t (objectToString(e) === '[object Error]' || e instanceof Error);\n\t}\n\texports.isError = isError;\n\t\n\tfunction isFunction(arg) {\n\t return typeof arg === 'function';\n\t}\n\texports.isFunction = isFunction;\n\t\n\tfunction isPrimitive(arg) {\n\t return arg === null ||\n\t typeof arg === 'boolean' ||\n\t typeof arg === 'number' ||\n\t typeof arg === 'string' ||\n\t typeof arg === 'symbol' || // ES6 symbol\n\t typeof arg === 'undefined';\n\t}\n\texports.isPrimitive = isPrimitive;\n\t\n\texports.isBuffer = __webpack_require__(63);\n\t\n\tfunction objectToString(o) {\n\t return Object.prototype.toString.call(o);\n\t}\n\t\n\t\n\tfunction pad(n) {\n\t return n < 10 ? '0' + n.toString(10) : n.toString(10);\n\t}\n\t\n\t\n\tvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n\t 'Oct', 'Nov', 'Dec'];\n\t\n\t// 26 Feb 16:19:34\n\tfunction timestamp() {\n\t var d = new Date();\n\t var time = [pad(d.getHours()),\n\t pad(d.getMinutes()),\n\t pad(d.getSeconds())].join(':');\n\t return [d.getDate(), months[d.getMonth()], time].join(' ');\n\t}\n\t\n\t\n\t// log is just a thin wrapper to console.log that prepends a timestamp\n\texports.log = function() {\n\t console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n\t};\n\t\n\t\n\t/**\n\t * Inherit the prototype methods from one constructor into another.\n\t *\n\t * The Function.prototype.inherits from lang.js rewritten as a standalone\n\t * function (not on Function.prototype). NOTE: If this file is to be loaded\n\t * during bootstrapping this function needs to be rewritten using some native\n\t * functions as prototype setup using normal JavaScript does not work as\n\t * expected during bootstrapping (see mirror.js in r114903).\n\t *\n\t * @param {function} ctor Constructor function which needs to inherit the\n\t * prototype.\n\t * @param {function} superCtor Constructor function to inherit prototype from.\n\t */\n\texports.inherits = __webpack_require__(64);\n\t\n\texports._extend = function(origin, add) {\n\t // Don't do anything if add isn't an object\n\t if (!add || !isObject(add)) return origin;\n\t\n\t var keys = Object.keys(add);\n\t var i = keys.length;\n\t while (i--) {\n\t origin[keys[i]] = add[keys[i]];\n\t }\n\t return origin;\n\t};\n\t\n\tfunction hasOwnProperty(obj, prop) {\n\t return Object.prototype.hasOwnProperty.call(obj, prop);\n\t}\n\t\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(60)))\n\n/***/ },\n/* 63 */\n/***/ function(module, exports) {\n\n\tmodule.exports = function isBuffer(arg) {\n\t return arg && typeof arg === 'object'\n\t && typeof arg.copy === 'function'\n\t && typeof arg.fill === 'function'\n\t && typeof arg.readUInt8 === 'function';\n\t}\n\n/***/ },\n/* 64 */\n/***/ function(module, exports) {\n\n\tif (typeof Object.create === 'function') {\n\t // implementation from standard node.js 'util' module\n\t module.exports = function inherits(ctor, superCtor) {\n\t ctor.super_ = superCtor\n\t ctor.prototype = Object.create(superCtor.prototype, {\n\t constructor: {\n\t value: ctor,\n\t enumerable: false,\n\t writable: true,\n\t configurable: true\n\t }\n\t });\n\t };\n\t} else {\n\t // old school shim for old browsers\n\t module.exports = function inherits(ctor, superCtor) {\n\t ctor.super_ = superCtor\n\t var TempCtor = function () {}\n\t TempCtor.prototype = superCtor.prototype\n\t ctor.prototype = new TempCtor()\n\t ctor.prototype.constructor = ctor\n\t }\n\t}\n\n\n/***/ },\n/* 65 */\n/***/ function(module, exports) {\n\n\tmodule.exports = Yallist\n\t\n\tYallist.Node = Node\n\tYallist.create = Yallist\n\t\n\tfunction Yallist (list) {\n\t var self = this\n\t if (!(self instanceof Yallist)) {\n\t self = new Yallist()\n\t }\n\t\n\t self.tail = null\n\t self.head = null\n\t self.length = 0\n\t\n\t if (list && typeof list.forEach === 'function') {\n\t list.forEach(function (item) {\n\t self.push(item)\n\t })\n\t } else if (arguments.length > 0) {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t self.push(arguments[i])\n\t }\n\t }\n\t\n\t return self\n\t}\n\t\n\tYallist.prototype.removeNode = function (node) {\n\t if (node.list !== this) {\n\t throw new Error('removing node which does not belong to this list')\n\t }\n\t\n\t var next = node.next\n\t var prev = node.prev\n\t\n\t if (next) {\n\t next.prev = prev\n\t }\n\t\n\t if (prev) {\n\t prev.next = next\n\t }\n\t\n\t if (node === this.head) {\n\t this.head = next\n\t }\n\t if (node === this.tail) {\n\t this.tail = prev\n\t }\n\t\n\t node.list.length --\n\t node.next = null\n\t node.prev = null\n\t node.list = null\n\t}\n\t\n\tYallist.prototype.unshiftNode = function (node) {\n\t if (node === this.head) {\n\t return\n\t }\n\t\n\t if (node.list) {\n\t node.list.removeNode(node)\n\t }\n\t\n\t var head = this.head\n\t node.list = this\n\t node.next = head\n\t if (head) {\n\t head.prev = node\n\t }\n\t\n\t this.head = node\n\t if (!this.tail) {\n\t this.tail = node\n\t }\n\t this.length ++\n\t}\n\t\n\tYallist.prototype.pushNode = function (node) {\n\t if (node === this.tail) {\n\t return\n\t }\n\t\n\t if (node.list) {\n\t node.list.removeNode(node)\n\t }\n\t\n\t var tail = this.tail\n\t node.list = this\n\t node.prev = tail\n\t if (tail) {\n\t tail.next = node\n\t }\n\t\n\t this.tail = node\n\t if (!this.head) {\n\t this.head = node\n\t }\n\t this.length ++\n\t}\n\t\n\tYallist.prototype.push = function () {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t push(this, arguments[i])\n\t }\n\t return this.length\n\t}\n\t\n\tYallist.prototype.unshift = function () {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t unshift(this, arguments[i])\n\t }\n\t return this.length\n\t}\n\t\n\tYallist.prototype.pop = function () {\n\t if (!this.tail)\n\t return undefined\n\t\n\t var res = this.tail.value\n\t this.tail = this.tail.prev\n\t this.tail.next = null\n\t this.length --\n\t return res\n\t}\n\t\n\tYallist.prototype.shift = function () {\n\t if (!this.head)\n\t return undefined\n\t\n\t var res = this.head.value\n\t this.head = this.head.next\n\t this.head.prev = null\n\t this.length --\n\t return res\n\t}\n\t\n\tYallist.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = this.head, i = 0; walker !== null; i++) {\n\t fn.call(thisp, walker.value, i, this)\n\t walker = walker.next\n\t }\n\t}\n\t\n\tYallist.prototype.forEachReverse = function (fn, thisp) {\n\t thisp = thisp || this\n\t for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n\t fn.call(thisp, walker.value, i, this)\n\t walker = walker.prev\n\t }\n\t}\n\t\n\tYallist.prototype.get = function (n) {\n\t for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n\t // abort out of the list early if we hit a cycle\n\t walker = walker.next\n\t }\n\t if (i === n && walker !== null) {\n\t return walker.value\n\t }\n\t}\n\t\n\tYallist.prototype.getReverse = function (n) {\n\t for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n\t // abort out of the list early if we hit a cycle\n\t walker = walker.prev\n\t }\n\t if (i === n && walker !== null) {\n\t return walker.value\n\t }\n\t}\n\t\n\tYallist.prototype.map = function (fn, thisp) {\n\t thisp = thisp || this\n\t var res = new Yallist()\n\t for (var walker = this.head; walker !== null; ) {\n\t res.push(fn.call(thisp, walker.value, this))\n\t walker = walker.next\n\t }\n\t return res\n\t}\n\t\n\tYallist.prototype.mapReverse = function (fn, thisp) {\n\t thisp = thisp || this\n\t var res = new Yallist()\n\t for (var walker = this.tail; walker !== null;) {\n\t res.push(fn.call(thisp, walker.value, this))\n\t walker = walker.prev\n\t }\n\t return res\n\t}\n\t\n\tYallist.prototype.reduce = function (fn, initial) {\n\t var acc\n\t var walker = this.head\n\t if (arguments.length > 1) {\n\t acc = initial\n\t } else if (this.head) {\n\t walker = this.head.next\n\t acc = this.head.value\n\t } else {\n\t throw new TypeError('Reduce of empty list with no initial value')\n\t }\n\t\n\t for (var i = 0; walker !== null; i++) {\n\t acc = fn(acc, walker.value, i)\n\t walker = walker.next\n\t }\n\t\n\t return acc\n\t}\n\t\n\tYallist.prototype.reduceReverse = function (fn, initial) {\n\t var acc\n\t var walker = this.tail\n\t if (arguments.length > 1) {\n\t acc = initial\n\t } else if (this.tail) {\n\t walker = this.tail.prev\n\t acc = this.tail.value\n\t } else {\n\t throw new TypeError('Reduce of empty list with no initial value')\n\t }\n\t\n\t for (var i = this.length - 1; walker !== null; i--) {\n\t acc = fn(acc, walker.value, i)\n\t walker = walker.prev\n\t }\n\t\n\t return acc\n\t}\n\t\n\tYallist.prototype.toArray = function () {\n\t var arr = new Array(this.length)\n\t for (var i = 0, walker = this.head; walker !== null; i++) {\n\t arr[i] = walker.value\n\t walker = walker.next\n\t }\n\t return arr\n\t}\n\t\n\tYallist.prototype.toArrayReverse = function () {\n\t var arr = new Array(this.length)\n\t for (var i = 0, walker = this.tail; walker !== null; i++) {\n\t arr[i] = walker.value\n\t walker = walker.prev\n\t }\n\t return arr\n\t}\n\t\n\tYallist.prototype.slice = function (from, to) {\n\t to = to || this.length\n\t if (to < 0) {\n\t to += this.length\n\t }\n\t from = from || 0\n\t if (from < 0) {\n\t from += this.length\n\t }\n\t var ret = new Yallist()\n\t if (to < from || to < 0) {\n\t return ret\n\t }\n\t if (from < 0) {\n\t from = 0\n\t }\n\t if (to > this.length) {\n\t to = this.length\n\t }\n\t for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n\t walker = walker.next\n\t }\n\t for (; walker !== null && i < to; i++, walker = walker.next) {\n\t ret.push(walker.value)\n\t }\n\t return ret\n\t}\n\t\n\tYallist.prototype.sliceReverse = function (from, to) {\n\t to = to || this.length\n\t if (to < 0) {\n\t to += this.length\n\t }\n\t from = from || 0\n\t if (from < 0) {\n\t from += this.length\n\t }\n\t var ret = new Yallist()\n\t if (to < from || to < 0) {\n\t return ret\n\t }\n\t if (from < 0) {\n\t from = 0\n\t }\n\t if (to > this.length) {\n\t to = this.length\n\t }\n\t for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n\t walker = walker.prev\n\t }\n\t for (; walker !== null && i > from; i--, walker = walker.prev) {\n\t ret.push(walker.value)\n\t }\n\t return ret\n\t}\n\t\n\tYallist.prototype.reverse = function () {\n\t var head = this.head\n\t var tail = this.tail\n\t for (var walker = head; walker !== null; walker = walker.prev) {\n\t var p = walker.prev\n\t walker.prev = walker.next\n\t walker.next = p\n\t }\n\t this.head = tail\n\t this.tail = head\n\t return this\n\t}\n\t\n\tfunction push (self, item) {\n\t self.tail = new Node(item, self.tail, null, self)\n\t if (!self.head) {\n\t self.head = self.tail\n\t }\n\t self.length ++\n\t}\n\t\n\tfunction unshift (self, item) {\n\t self.head = new Node(item, null, self.head, self)\n\t if (!self.tail) {\n\t self.tail = self.head\n\t }\n\t self.length ++\n\t}\n\t\n\tfunction Node (value, prev, next, list) {\n\t if (!(this instanceof Node)) {\n\t return new Node(value, prev, next, list)\n\t }\n\t\n\t this.list = list\n\t this.value = value\n\t\n\t if (prev) {\n\t prev.next = this\n\t this.prev = prev\n\t } else {\n\t this.prev = null\n\t }\n\t\n\t if (next) {\n\t next.prev = this\n\t this.next = next\n\t } else {\n\t this.next = null\n\t }\n\t}\n\n\n/***/ },\n/* 66 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Tile2 = __webpack_require__(67);\n\t\n\tvar _Tile3 = _interopRequireDefault(_Tile2);\n\t\n\tvar _vendorBoxHelper = __webpack_require__(68);\n\t\n\tvar _vendorBoxHelper2 = _interopRequireDefault(_vendorBoxHelper);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\tvar ImageTile = (function (_Tile) {\n\t _inherits(ImageTile, _Tile);\n\t\n\t function ImageTile(quadcode, path, layer) {\n\t _classCallCheck(this, ImageTile);\n\t\n\t _get(Object.getPrototypeOf(ImageTile.prototype), 'constructor', this).call(this, quadcode, path, layer);\n\t }\n\t\n\t // Request data for the tile\n\t\n\t _createClass(ImageTile, [{\n\t key: 'requestTileAsync',\n\t value: function requestTileAsync() {\n\t var _this = this;\n\t\n\t // Making this asynchronous really speeds up the LOD framerate\n\t setTimeout(function () {\n\t if (!_this._mesh) {\n\t _this._mesh = _this._createMesh();\n\t _this._requestTile();\n\t }\n\t }, 0);\n\t }\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Cancel any pending requests\n\t this._abortRequest();\n\t\n\t // Clear image reference\n\t this._image = null;\n\t\n\t _get(Object.getPrototypeOf(ImageTile.prototype), 'destroy', this).call(this);\n\t }\n\t }, {\n\t key: '_createMesh',\n\t value: function _createMesh() {\n\t // Something went wrong and the tile\n\t //\n\t // Possibly removed by the cache before loaded\n\t if (!this._center) {\n\t return;\n\t }\n\t\n\t var mesh = new _three2['default'].Object3D();\n\t var geom = new _three2['default'].PlaneBufferGeometry(this._side, this._side, 1);\n\t\n\t var material;\n\t if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshBasicMaterial({\n\t depthWrite: false\n\t });\n\t\n\t // var material = new THREE.MeshPhongMaterial({\n\t // depthWrite: false\n\t // });\n\t } else {\n\t // Other MeshStandardMaterial settings\n\t //\n\t // material.envMapIntensity will change the amount of colour reflected(?)\n\t // from the environment map – can be greater than 1 for more intensity\n\t\n\t material = new _three2['default'].MeshStandardMaterial({\n\t depthWrite: false\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var localMesh = new _three2['default'].Mesh(geom, material);\n\t localMesh.rotation.x = -90 * Math.PI / 180;\n\t\n\t localMesh.receiveShadow = true;\n\t\n\t mesh.add(localMesh);\n\t mesh.renderOrder = 0.1;\n\t\n\t mesh.position.x = this._center[0];\n\t mesh.position.z = this._center[1];\n\t\n\t // var box = new BoxHelper(localMesh);\n\t // mesh.add(box);\n\t //\n\t // mesh.add(this._createDebugMesh());\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_createDebugMesh',\n\t value: function _createDebugMesh() {\n\t var canvas = document.createElement('canvas');\n\t canvas.width = 256;\n\t canvas.height = 256;\n\t\n\t var context = canvas.getContext('2d');\n\t context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n\t context.fillStyle = '#ff0000';\n\t context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n\t context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\t\n\t var texture = new _three2['default'].Texture(canvas);\n\t\n\t // Silky smooth images when tilted\n\t texture.magFilter = _three2['default'].LinearFilter;\n\t texture.minFilter = _three2['default'].LinearMipMapLinearFilter;\n\t\n\t // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t texture.anisotropy = 4;\n\t\n\t texture.needsUpdate = true;\n\t\n\t var material = new _three2['default'].MeshBasicMaterial({\n\t map: texture,\n\t transparent: true,\n\t depthWrite: false\n\t });\n\t\n\t var geom = new _three2['default'].PlaneBufferGeometry(this._side, this._side, 1);\n\t var mesh = new _three2['default'].Mesh(geom, material);\n\t\n\t mesh.rotation.x = -90 * Math.PI / 180;\n\t mesh.position.y = 0.1;\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_requestTile',\n\t value: function _requestTile() {\n\t var _this2 = this;\n\t\n\t var urlParams = {\n\t x: this._tile[0],\n\t y: this._tile[1],\n\t z: this._tile[2]\n\t };\n\t\n\t var url = this._getTileURL(urlParams);\n\t\n\t var image = document.createElement('img');\n\t\n\t image.addEventListener('load', function (event) {\n\t var texture = new _three2['default'].Texture();\n\t\n\t texture.image = image;\n\t texture.needsUpdate = true;\n\t\n\t // Silky smooth images when tilted\n\t texture.magFilter = _three2['default'].LinearFilter;\n\t texture.minFilter = _three2['default'].LinearMipMapLinearFilter;\n\t\n\t // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t texture.anisotropy = 4;\n\t\n\t texture.needsUpdate = true;\n\t\n\t // Something went wrong and the tile or its material is missing\n\t //\n\t // Possibly removed by the cache before the image loaded\n\t if (!_this2._mesh || !_this2._mesh.children[0] || !_this2._mesh.children[0].material) {\n\t return;\n\t }\n\t\n\t _this2._mesh.children[0].material.map = texture;\n\t _this2._mesh.children[0].material.needsUpdate = true;\n\t\n\t _this2._texture = texture;\n\t _this2._ready = true;\n\t }, false);\n\t\n\t // image.addEventListener('progress', event => {}, false);\n\t // image.addEventListener('error', event => {}, false);\n\t\n\t image.crossOrigin = '';\n\t\n\t // Load image\n\t image.src = url;\n\t\n\t this._image = image;\n\t }\n\t }, {\n\t key: '_abortRequest',\n\t value: function _abortRequest() {\n\t if (!this._image) {\n\t return;\n\t }\n\t\n\t this._image.src = '';\n\t }\n\t }]);\n\t\n\t return ImageTile;\n\t})(_Tile3['default']);\n\t\n\texports['default'] = ImageTile;\n\t\n\tvar noNew = function noNew(quadcode, path, layer) {\n\t return new ImageTile(quadcode, path, layer);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.imageTile = noNew;\n\n/***/ },\n/* 67 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// Manages a single tile and its layers\n\t\n\tvar r2d = 180 / Math.PI;\n\t\n\tvar tileURLRegex = /\\{([szxy])\\}/g;\n\t\n\tvar Tile = (function () {\n\t function Tile(quadcode, path, layer) {\n\t _classCallCheck(this, Tile);\n\t\n\t this._layer = layer;\n\t this._world = layer._world;\n\t this._quadcode = quadcode;\n\t this._path = path;\n\t\n\t this._ready = false;\n\t\n\t this._tile = this._quadcodeToTile(quadcode);\n\t\n\t // Bottom-left and top-right bounds in WGS84 coordinates\n\t this._boundsLatLon = this._tileBoundsWGS84(this._tile);\n\t\n\t // Bottom-left and top-right bounds in world coordinates\n\t this._boundsWorld = this._tileBoundsFromWGS84(this._boundsLatLon);\n\t\n\t // Tile center in world coordinates\n\t this._center = this._boundsToCenter(this._boundsWorld);\n\t\n\t // Tile center in projected coordinates\n\t this._centerLatlon = this._world.pointToLatLon((0, _geoPoint.point)(this._center[0], this._center[1]));\n\t\n\t // Length of a tile side in world coorindates\n\t this._side = this._getSide(this._boundsWorld);\n\t\n\t // Point scale for tile (for unit conversion)\n\t this._pointScale = this._world.pointScale(this._centerLatlon);\n\t }\n\t\n\t // Returns true if the tile mesh and texture are ready to be used\n\t // Otherwise, returns false\n\t\n\t _createClass(Tile, [{\n\t key: 'isReady',\n\t value: function isReady() {\n\t return this._ready;\n\t }\n\t\n\t // Request data for the tile\n\t }, {\n\t key: 'requestTileAsync',\n\t value: function requestTileAsync() {}\n\t }, {\n\t key: 'getQuadcode',\n\t value: function getQuadcode() {\n\t return this._quadcode;\n\t }\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {\n\t return this._boundsWorld;\n\t }\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._center;\n\t }\n\t }, {\n\t key: 'getSide',\n\t value: function getSide() {\n\t return this._side;\n\t }\n\t }, {\n\t key: 'getMesh',\n\t value: function getMesh() {\n\t return this._mesh;\n\t }\n\t }, {\n\t key: 'getPickingMesh',\n\t value: function getPickingMesh() {\n\t return this._pickingMesh;\n\t }\n\t\n\t // Destroys the tile and removes it from the layer and memory\n\t //\n\t // Ensure that this leaves no trace of the tile – no textures, no meshes,\n\t // nothing in memory or the GPU\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Delete reference to layer and world\n\t this._layer = null;\n\t this._world = null;\n\t\n\t // Delete location references\n\t this._boundsLatLon = null;\n\t this._boundsWorld = null;\n\t this._center = null;\n\t\n\t // Done if no mesh\n\t if (!this._mesh) {\n\t return;\n\t }\n\t\n\t if (this._mesh.children) {\n\t // Dispose of mesh and materials\n\t this._mesh.children.forEach(function (child) {\n\t child.geometry.dispose();\n\t child.geometry = null;\n\t\n\t if (child.material.map) {\n\t child.material.map.dispose();\n\t child.material.map = null;\n\t }\n\t\n\t child.material.dispose();\n\t child.material = null;\n\t });\n\t } else {\n\t this._mesh.geometry.dispose();\n\t this._mesh.geometry = null;\n\t\n\t if (this._mesh.material.map) {\n\t this._mesh.material.map.dispose();\n\t this._mesh.material.map = null;\n\t }\n\t\n\t this._mesh.material.dispose();\n\t this._mesh.material = null;\n\t }\n\t }\n\t }, {\n\t key: '_createMesh',\n\t value: function _createMesh() {}\n\t }, {\n\t key: '_createDebugMesh',\n\t value: function _createDebugMesh() {}\n\t }, {\n\t key: '_getTileURL',\n\t value: function _getTileURL(urlParams) {\n\t if (!urlParams.s) {\n\t // Default to a random choice of a, b or c\n\t urlParams.s = String.fromCharCode(97 + Math.floor(Math.random() * 3));\n\t }\n\t\n\t tileURLRegex.lastIndex = 0;\n\t return this._path.replace(tileURLRegex, function (value, key) {\n\t // Replace with paramter, otherwise keep existing value\n\t return urlParams[key];\n\t });\n\t }\n\t\n\t // Convert from quadcode to TMS tile coordinates\n\t }, {\n\t key: '_quadcodeToTile',\n\t value: function _quadcodeToTile(quadcode) {\n\t var x = 0;\n\t var y = 0;\n\t var z = quadcode.length;\n\t\n\t for (var i = z; i > 0; i--) {\n\t var mask = 1 << i - 1;\n\t var q = +quadcode[z - i];\n\t if (q === 1) {\n\t x |= mask;\n\t }\n\t if (q === 2) {\n\t y |= mask;\n\t }\n\t if (q === 3) {\n\t x |= mask;\n\t y |= mask;\n\t }\n\t }\n\t\n\t return [x, y, z];\n\t }\n\t\n\t // Convert WGS84 tile bounds to world coordinates\n\t }, {\n\t key: '_tileBoundsFromWGS84',\n\t value: function _tileBoundsFromWGS84(boundsWGS84) {\n\t var sw = this._layer._world.latLonToPoint((0, _geoLatLon.latLon)(boundsWGS84[1], boundsWGS84[0]));\n\t var ne = this._layer._world.latLonToPoint((0, _geoLatLon.latLon)(boundsWGS84[3], boundsWGS84[2]));\n\t\n\t return [sw.x, sw.y, ne.x, ne.y];\n\t }\n\t\n\t // Get tile bounds in WGS84 coordinates\n\t }, {\n\t key: '_tileBoundsWGS84',\n\t value: function _tileBoundsWGS84(tile) {\n\t var e = this._tile2lon(tile[0] + 1, tile[2]);\n\t var w = this._tile2lon(tile[0], tile[2]);\n\t var s = this._tile2lat(tile[1] + 1, tile[2]);\n\t var n = this._tile2lat(tile[1], tile[2]);\n\t return [w, s, e, n];\n\t }\n\t }, {\n\t key: '_tile2lon',\n\t value: function _tile2lon(x, z) {\n\t return x / Math.pow(2, z) * 360 - 180;\n\t }\n\t }, {\n\t key: '_tile2lat',\n\t value: function _tile2lat(y, z) {\n\t var n = Math.PI - 2 * Math.PI * y / Math.pow(2, z);\n\t return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));\n\t }\n\t }, {\n\t key: '_boundsToCenter',\n\t value: function _boundsToCenter(bounds) {\n\t var x = bounds[0] + (bounds[2] - bounds[0]) / 2;\n\t var y = bounds[1] + (bounds[3] - bounds[1]) / 2;\n\t\n\t return [x, y];\n\t }\n\t }, {\n\t key: '_getSide',\n\t value: function _getSide(bounds) {\n\t return new _three2['default'].Vector3(bounds[0], 0, bounds[3]).sub(new _three2['default'].Vector3(bounds[0], 0, bounds[1])).length();\n\t }\n\t }]);\n\t\n\t return Tile;\n\t})();\n\t\n\texports['default'] = Tile;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 68 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// jscs:disable\n\t/* eslint-disable */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t/**\n\t * @author mrdoob / http://mrdoob.com/\n\t */\n\t\n\tBoxHelper = function (object) {\n\t\n\t\tvar indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]);\n\t\tvar positions = new Float32Array(8 * 3);\n\t\n\t\tvar geometry = new _three2['default'].BufferGeometry();\n\t\tgeometry.setIndex(new _three2['default'].BufferAttribute(indices, 1));\n\t\tgeometry.addAttribute('position', new _three2['default'].BufferAttribute(positions, 3));\n\t\n\t\t_three2['default'].LineSegments.call(this, geometry, new _three2['default'].LineBasicMaterial({ linewidth: 2, color: 0xff0000 }));\n\t\n\t\tif (object !== undefined) {\n\t\n\t\t\tthis.update(object);\n\t\t}\n\t};\n\t\n\tBoxHelper.prototype = Object.create(_three2['default'].LineSegments.prototype);\n\tBoxHelper.prototype.constructor = BoxHelper;\n\t\n\tBoxHelper.prototype.update = (function () {\n\t\n\t\tvar box = new _three2['default'].Box3();\n\t\n\t\treturn function (object) {\n\t\n\t\t\tbox.setFromObject(object);\n\t\n\t\t\tif (box.isEmpty()) return;\n\t\n\t\t\tvar min = box.min;\n\t\t\tvar max = box.max;\n\t\n\t\t\t/*\n\t 5____4\n\t 1/___0/|\n\t | 6__|_7\n\t 2/___3/\n\t \t0: max.x, max.y, max.z\n\t 1: min.x, max.y, max.z\n\t 2: min.x, min.y, max.z\n\t 3: max.x, min.y, max.z\n\t 4: max.x, max.y, min.z\n\t 5: min.x, max.y, min.z\n\t 6: min.x, min.y, min.z\n\t 7: max.x, min.y, min.z\n\t */\n\t\n\t\t\tvar position = this.geometry.attributes.position;\n\t\t\tvar array = position.array;\n\t\n\t\t\tarray[0] = max.x;array[1] = max.y;array[2] = max.z;\n\t\t\tarray[3] = min.x;array[4] = max.y;array[5] = max.z;\n\t\t\tarray[6] = min.x;array[7] = min.y;array[8] = max.z;\n\t\t\tarray[9] = max.x;array[10] = min.y;array[11] = max.z;\n\t\t\tarray[12] = max.x;array[13] = max.y;array[14] = min.z;\n\t\t\tarray[15] = min.x;array[16] = max.y;array[17] = min.z;\n\t\t\tarray[18] = min.x;array[19] = min.y;array[20] = min.z;\n\t\t\tarray[21] = max.x;array[22] = min.y;array[23] = min.z;\n\t\n\t\t\tposition.needsUpdate = true;\n\t\n\t\t\tthis.geometry.computeBoundingSphere();\n\t\t};\n\t})();\n\t\n\texports['default'] = BoxHelper;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 69 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\texports['default'] = function (colour, skyboxTarget) {\n\t var canvas = document.createElement('canvas');\n\t canvas.width = 1;\n\t canvas.height = 1;\n\t\n\t var context = canvas.getContext('2d');\n\t context.fillStyle = colour;\n\t context.fillRect(0, 0, canvas.width, canvas.height);\n\t // context.strokeStyle = '#D0D0CF';\n\t // context.strokeRect(0, 0, canvas.width, canvas.height);\n\t\n\t var texture = new _three2['default'].Texture(canvas);\n\t\n\t // // Silky smooth images when tilted\n\t // texture.magFilter = THREE.LinearFilter;\n\t // texture.minFilter = THREE.LinearMipMapLinearFilter;\n\t // //\n\t // // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t // texture.anisotropy = 4;\n\t\n\t // texture.wrapS = THREE.RepeatWrapping;\n\t // texture.wrapT = THREE.RepeatWrapping;\n\t // texture.repeat.set(segments, segments);\n\t\n\t texture.needsUpdate = true;\n\t\n\t var material;\n\t\n\t if (!skyboxTarget) {\n\t material = new _three2['default'].MeshBasicMaterial({\n\t map: texture,\n\t depthWrite: false\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t depthWrite: false\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMap = skyboxTarget;\n\t }\n\t\n\t return material;\n\t};\n\t\n\t;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 70 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _TileLayer2 = __webpack_require__(56);\n\t\n\tvar _TileLayer3 = _interopRequireDefault(_TileLayer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _GeoJSONTile = __webpack_require__(71);\n\t\n\tvar _GeoJSONTile2 = _interopRequireDefault(_GeoJSONTile);\n\t\n\tvar _lodashThrottle = __webpack_require__(49);\n\t\n\tvar _lodashThrottle2 = _interopRequireDefault(_lodashThrottle);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\t// TODO: Offer on-the-fly slicing of static, non-tile-based GeoJSON files into a\n\t// tile grid using geojson-vt\n\t//\n\t// See: https://github.com/mapbox/geojson-vt\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Consider pausing per-frame output during movement so there's little to\n\t// no jank caused by previous tiles still processing\n\t\n\t// This tile layer only updates the quadtree after world movement has occurred\n\t//\n\t// Tiles from previous quadtree updates are updated and outputted every frame\n\t// (or at least every frame, throttled to some amount)\n\t//\n\t// This is because the complexity of TopoJSON tiles requires a lot of processing\n\t// and so makes movement janky if updates occur every frame – only updating\n\t// after movement means frame drops are less obvious due to heavy processing\n\t// occurring while the view is generally stationary\n\t//\n\t// The downside is that until new tiles are requested and outputted you will\n\t// see blank spaces as you orbit and move around\n\t//\n\t// An added benefit is that it dramatically reduces the number of tiles being\n\t// requested over a period of time and the time it takes to go from request to\n\t// screen output\n\t//\n\t// It may be possible to perform these updates per-frame once Web Worker\n\t// processing is added\n\t\n\tvar GeoJSONTileLayer = (function (_TileLayer) {\n\t _inherits(GeoJSONTileLayer, _TileLayer);\n\t\n\t function GeoJSONTileLayer(path, options) {\n\t _classCallCheck(this, GeoJSONTileLayer);\n\t\n\t var defaults = {\n\t maxLOD: 14,\n\t distance: 2000\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTileLayer.prototype), 'constructor', this).call(this, options);\n\t\n\t this._path = path;\n\t }\n\t\n\t _createClass(GeoJSONTileLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t var _this = this;\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTileLayer.prototype), '_onAdd', this).call(this, world);\n\t\n\t // Trigger initial quadtree calculation on the next frame\n\t //\n\t // TODO: This is a hack to ensure the camera is all set up - a better\n\t // solution should be found\n\t setTimeout(function () {\n\t _this._calculateLOD();\n\t _this._initEvents();\n\t }, 0);\n\t }\n\t }, {\n\t key: '_initEvents',\n\t value: function _initEvents() {\n\t // Run LOD calculations based on render calls\n\t //\n\t // Throttled to 1 LOD calculation per 100ms\n\t this._throttledWorldUpdate = (0, _lodashThrottle2['default'])(this._onWorldUpdate, 100);\n\t\n\t this._world.on('preUpdate', this._throttledWorldUpdate, this);\n\t this._world.on('move', this._onWorldMove, this);\n\t this._world.on('controlsMove', this._onControlsMove, this);\n\t }\n\t\n\t // Update and output tiles each frame (throttled)\n\t }, {\n\t key: '_onWorldUpdate',\n\t value: function _onWorldUpdate() {\n\t if (this._pauseOutput) {\n\t return;\n\t }\n\t\n\t this._outputTiles();\n\t }\n\t\n\t // Update tiles grid after world move, but don't output them\n\t }, {\n\t key: '_onWorldMove',\n\t value: function _onWorldMove(latlon, point) {\n\t this._pauseOutput = false;\n\t this._calculateLOD();\n\t }\n\t\n\t // Pause updates during control movement for less visual jank\n\t }, {\n\t key: '_onControlsMove',\n\t value: function _onControlsMove() {\n\t this._pauseOutput = true;\n\t }\n\t }, {\n\t key: '_createTile',\n\t value: function _createTile(quadcode, layer) {\n\t var options = {};\n\t\n\t // if (this._options.filter) {\n\t // options.filter = this._options.filter;\n\t // }\n\t //\n\t // if (this._options.style) {\n\t // options.style = this._options.style;\n\t // }\n\t //\n\t // if (this._options.topojson) {\n\t // options.topojson = true;\n\t // }\n\t //\n\t // if (this._options.interactive) {\n\t // options.interactive = true;\n\t // }\n\t //\n\t // if (this._options.onClick) {\n\t // options.onClick = this._options.onClick;\n\t // }\n\t\n\t return new _GeoJSONTile2['default'](quadcode, this._path, layer, this._options);\n\t }\n\t\n\t // Destroys the layer and removes it from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t this._world.off('preUpdate', this._throttledWorldUpdate);\n\t this._world.off('move', this._onWorldMove);\n\t\n\t this._throttledWorldUpdate = null;\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(GeoJSONTileLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return GeoJSONTileLayer;\n\t})(_TileLayer3['default']);\n\t\n\texports['default'] = GeoJSONTileLayer;\n\t\n\tvar noNew = function noNew(path, options) {\n\t return new GeoJSONTileLayer(path, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.geoJSONTileLayer = noNew;\n\n/***/ },\n/* 71 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Tile2 = __webpack_require__(67);\n\t\n\tvar _Tile3 = _interopRequireDefault(_Tile2);\n\t\n\tvar _GeoJSONLayer = __webpack_require__(72);\n\t\n\tvar _vendorBoxHelper = __webpack_require__(68);\n\t\n\tvar _vendorBoxHelper2 = _interopRequireDefault(_vendorBoxHelper);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _reqwest = __webpack_require__(74);\n\t\n\tvar _reqwest2 = _interopRequireDefault(_reqwest);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\t// import Offset from 'polygon-offset';\n\t\n\tvar _utilGeoJSON = __webpack_require__(76);\n\t\n\tvar _utilGeoJSON2 = _interopRequireDefault(_utilGeoJSON);\n\t\n\tvar _utilBuffer = __webpack_require__(82);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(83);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\t// TODO: Map picking IDs to some reference within the tile data / geometry so\n\t// that something useful can be done when an object is picked / clicked on\n\t\n\t// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\t\n\t// TODO: Perform tile request and processing in a Web Worker\n\t//\n\t// Use Operative (https://github.com/padolsey/operative)\n\t//\n\t// Would it make sense to have the worker functionality defined in a static\n\t// method so it only gets initialised once and not on every tile instance?\n\t//\n\t// Otherwise, worker processing logic would have to go in the tile layer so not\n\t// to waste loads of time setting up a brand new worker with three.js for each\n\t// tile every single time.\n\t//\n\t// Unsure of the best way to get three.js and VIZI into the worker\n\t//\n\t// Would need to set up a CRS / projection identical to the world instance\n\t//\n\t// Is it possible to bypass requirements on external script by having multiple\n\t// simple worker methods that each take enough inputs to perform a single task\n\t// without requiring VIZI or three.js? So long as the heaviest logic is done in\n\t// the worker and transferrable objects are used then it should be better than\n\t// nothing. Would probably still need things like earcut...\n\t//\n\t// After all, the three.js logic and object creation will still need to be\n\t// done on the main thread regardless so the worker should try to do as much as\n\t// possible with as few dependencies as possible.\n\t//\n\t// Have a look at how this is done in Tangram before implementing anything as\n\t// the approach there is pretty similar and robust.\n\t\n\tvar GeoJSONTile = (function (_Tile) {\n\t _inherits(GeoJSONTile, _Tile);\n\t\n\t function GeoJSONTile(quadcode, path, layer, options) {\n\t _classCallCheck(this, GeoJSONTile);\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTile.prototype), 'constructor', this).call(this, quadcode, path, layer);\n\t\n\t this._defaultStyle = _utilGeoJSON2['default'].defaultStyle;\n\t\n\t var defaults = {\n\t output: true,\n\t outputToScene: false,\n\t interactive: false,\n\t topojson: false,\n\t filter: null,\n\t onEachFeature: null,\n\t polygonMaterial: null,\n\t onPolygonMesh: null,\n\t onPolygonBufferAttributes: null,\n\t polylineMaterial: null,\n\t onPolylineMesh: null,\n\t onPolylineBufferAttributes: null,\n\t pointGeometry: null,\n\t pointMaterial: null,\n\t onPointMesh: null,\n\t style: _utilGeoJSON2['default'].defaultStyle,\n\t keepFeatures: false\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t if (typeof options.style === 'function') {\n\t _options.style = options.style;\n\t } else {\n\t _options.style = (0, _lodashAssign2['default'])({}, defaults.style, options.style);\n\t }\n\t\n\t this._options = _options;\n\t }\n\t\n\t // Request data for the tile\n\t\n\t _createClass(GeoJSONTile, [{\n\t key: 'requestTileAsync',\n\t value: function requestTileAsync() {\n\t var _this = this;\n\t\n\t // Making this asynchronous really speeds up the LOD framerate\n\t setTimeout(function () {\n\t if (!_this._mesh) {\n\t _this._mesh = _this._createMesh();\n\t\n\t // this._shadowCanvas = this._createShadowCanvas();\n\t\n\t _this._requestTile();\n\t }\n\t }, 0);\n\t }\n\t\n\t // TODO: Destroy GeoJSONLayer\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Cancel any pending requests\n\t this._abortRequest();\n\t\n\t // Clear request reference\n\t this._request = null;\n\t\n\t if (this._geojsonLayer) {\n\t this._geojsonLayer.destroy();\n\t this._geojsonLayer = null;\n\t }\n\t\n\t this._mesh = null;\n\t\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t\n\t _get(Object.getPrototypeOf(GeoJSONTile.prototype), 'destroy', this).call(this);\n\t }\n\t }, {\n\t key: '_createMesh',\n\t value: function _createMesh() {\n\t // Something went wrong and the tile\n\t //\n\t // Possibly removed by the cache before loaded\n\t if (!this._center) {\n\t return;\n\t }\n\t\n\t var mesh = new _three2['default'].Object3D();\n\t // mesh.add(this._createDebugMesh());\n\t\n\t return mesh;\n\t }\n\t }, {\n\t key: '_createDebugMesh',\n\t value: function _createDebugMesh() {\n\t var canvas = document.createElement('canvas');\n\t canvas.width = 256;\n\t canvas.height = 256;\n\t\n\t var context = canvas.getContext('2d');\n\t context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n\t context.fillStyle = '#ff0000';\n\t context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n\t context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\t\n\t var texture = new _three2['default'].Texture(canvas);\n\t\n\t // Silky smooth images when tilted\n\t texture.magFilter = _three2['default'].LinearFilter;\n\t texture.minFilter = _three2['default'].LinearMipMapLinearFilter;\n\t\n\t // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t texture.anisotropy = 4;\n\t\n\t texture.needsUpdate = true;\n\t\n\t var material = new _three2['default'].MeshBasicMaterial({\n\t map: texture,\n\t transparent: true,\n\t depthWrite: false\n\t });\n\t\n\t var geom = new _three2['default'].PlaneBufferGeometry(this._side, this._side, 1);\n\t var mesh = new _three2['default'].Mesh(geom, material);\n\t\n\t mesh.rotation.x = -90 * Math.PI / 180;\n\t mesh.position.y = 0.1;\n\t\n\t return mesh;\n\t }\n\t\n\t // _createShadowCanvas() {\n\t // var canvas = document.createElement('canvas');\n\t //\n\t // // Rendered at a low resolution and later scaled up for a low-quality blur\n\t // canvas.width = 512;\n\t // canvas.height = 512;\n\t //\n\t // return canvas;\n\t // }\n\t\n\t // _addShadow(coordinates) {\n\t // var ctx = this._shadowCanvas.getContext('2d');\n\t // var width = this._shadowCanvas.width;\n\t // var height = this._shadowCanvas.height;\n\t //\n\t // var _coords;\n\t // var _offset;\n\t // var offset = new Offset();\n\t //\n\t // // Transform coordinates to shadowCanvas space and draw on canvas\n\t // coordinates.forEach((ring, index) => {\n\t // ctx.beginPath();\n\t //\n\t // _coords = ring.map(coord => {\n\t // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n\t // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n\t // return [xFrac * width, yFrac * height];\n\t // });\n\t //\n\t // if (index > 0) {\n\t // _offset = _coords;\n\t // } else {\n\t // _offset = offset.data(_coords).padding(1.3);\n\t // }\n\t //\n\t // // TODO: This is super flaky and crashes the browser if run on anything\n\t // // put the outer ring (potentially due to winding)\n\t // _offset.forEach((coord, index) => {\n\t // // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n\t // // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n\t //\n\t // if (index === 0) {\n\t // ctx.moveTo(coord[0], coord[1]);\n\t // } else {\n\t // ctx.lineTo(coord[0], coord[1]);\n\t // }\n\t // });\n\t //\n\t // ctx.closePath();\n\t // });\n\t //\n\t // ctx.fillStyle = 'rgba(80, 80, 80, 0.7)';\n\t // ctx.fill();\n\t // }\n\t\n\t }, {\n\t key: '_requestTile',\n\t value: function _requestTile() {\n\t var _this2 = this;\n\t\n\t var urlParams = {\n\t x: this._tile[0],\n\t y: this._tile[1],\n\t z: this._tile[2]\n\t };\n\t\n\t var url = this._getTileURL(urlParams);\n\t\n\t this._request = (0, _reqwest2['default'])({\n\t url: url,\n\t type: 'json',\n\t crossOrigin: true\n\t }).then(function (res) {\n\t // Clear request reference\n\t _this2._request = null;\n\t _this2._processTileData(res);\n\t })['catch'](function (err) {\n\t console.error(err);\n\t\n\t // Clear request reference\n\t _this2._request = null;\n\t });\n\t }\n\t }, {\n\t key: '_processTileData',\n\t value: function _processTileData(data) {\n\t console.time(this._tile);\n\t\n\t // Using this creates a huge amount of memory due to the quantity of tiles\n\t this._geojsonLayer = (0, _GeoJSONLayer.geoJSONLayer)(data, this._options).addTo(this._world);\n\t\n\t this._mesh = this._geojsonLayer._object3D;\n\t this._pickingMesh = this._geojsonLayer._pickingMesh;\n\t\n\t // Free the GeoJSON memory as we don't need it\n\t //\n\t // TODO: This should probably be a method within GeoJSONLayer\n\t this._geojsonLayer._geojson = null;\n\t\n\t // TODO: Fix or store shadow canvas stuff and get rid of this code\n\t // Draw footprint on shadow canvas\n\t //\n\t // TODO: Disabled for the time-being until it can be sped up / moved to\n\t // a worker\n\t // this._addShadow(coordinates);\n\t\n\t // Output shadow canvas\n\t\n\t // TODO: Disabled for the time-being until it can be sped up / moved to\n\t // a worker\n\t\n\t // var texture = new THREE.Texture(this._shadowCanvas);\n\t //\n\t // // Silky smooth images when tilted\n\t // texture.magFilter = THREE.LinearFilter;\n\t // texture.minFilter = THREE.LinearMipMapLinearFilter;\n\t //\n\t // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n\t // texture.anisotropy = 4;\n\t //\n\t // texture.needsUpdate = true;\n\t //\n\t // var material;\n\t // if (!this._world._environment._skybox) {\n\t // material = new THREE.MeshBasicMaterial({\n\t // map: texture,\n\t // transparent: true,\n\t // depthWrite: false\n\t // });\n\t // } else {\n\t // material = new THREE.MeshStandardMaterial({\n\t // map: texture,\n\t // transparent: true,\n\t // depthWrite: false\n\t // });\n\t // material.roughness = 1;\n\t // material.metalness = 0.1;\n\t // material.envMap = this._world._environment._skybox.getRenderTarget();\n\t // }\n\t //\n\t // var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n\t // var mesh = new THREE.Mesh(geom, material);\n\t //\n\t // mesh.castShadow = false;\n\t // mesh.receiveShadow = false;\n\t // mesh.renderOrder = 1;\n\t //\n\t // mesh.rotation.x = -90 * Math.PI / 180;\n\t //\n\t // this._mesh.add(mesh);\n\t\n\t this._ready = true;\n\t console.timeEnd(this._tile);\n\t }\n\t }, {\n\t key: '_abortRequest',\n\t value: function _abortRequest() {\n\t if (!this._request) {\n\t return;\n\t }\n\t\n\t this._request.abort();\n\t }\n\t }]);\n\t\n\t return GeoJSONTile;\n\t})(_Tile3['default']);\n\t\n\texports['default'] = GeoJSONTile;\n\t\n\tvar noNew = function noNew(quadcode, path, layer, options) {\n\t return new GeoJSONTile(quadcode, path, layer, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.geoJSONTile = noNew;\n\n/***/ },\n/* 72 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Consider adopting GeoJSON CSS\n\t// http://wiki.openstreetmap.org/wiki/Geojson_CSS\n\t\n\t// TODO: Allow interaction to be defined per-layer to save on resources\n\t//\n\t// For example, only allow polygons to be interactive via a polygonInteractive\n\t// option\n\t\n\tvar _LayerGroup2 = __webpack_require__(73);\n\t\n\tvar _LayerGroup3 = _interopRequireDefault(_LayerGroup2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _reqwest = __webpack_require__(74);\n\t\n\tvar _reqwest2 = _interopRequireDefault(_reqwest);\n\t\n\tvar _utilGeoJSON = __webpack_require__(76);\n\t\n\tvar _utilGeoJSON2 = _interopRequireDefault(_utilGeoJSON);\n\t\n\tvar _utilBuffer = __webpack_require__(82);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(83);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _geometryPolygonLayer = __webpack_require__(85);\n\t\n\tvar _geometryPolygonLayer2 = _interopRequireDefault(_geometryPolygonLayer);\n\t\n\tvar _geometryPolylineLayer = __webpack_require__(86);\n\t\n\tvar _geometryPolylineLayer2 = _interopRequireDefault(_geometryPolylineLayer);\n\t\n\tvar _geometryPointLayer = __webpack_require__(87);\n\t\n\tvar _geometryPointLayer2 = _interopRequireDefault(_geometryPointLayer);\n\t\n\tvar GeoJSONLayer = (function (_LayerGroup) {\n\t _inherits(GeoJSONLayer, _LayerGroup);\n\t\n\t function GeoJSONLayer(geojson, options) {\n\t _classCallCheck(this, GeoJSONLayer);\n\t\n\t var defaults = {\n\t output: false,\n\t interactive: false,\n\t topojson: false,\n\t filter: null,\n\t onEachFeature: null,\n\t polygonMaterial: null,\n\t onPolygonMesh: null,\n\t onPolygonBufferAttributes: null,\n\t polylineMaterial: null,\n\t onPolylineMesh: null,\n\t onPolylineBufferAttributes: null,\n\t pointGeometry: null,\n\t pointMaterial: null,\n\t onPointMesh: null,\n\t style: _utilGeoJSON2['default'].defaultStyle,\n\t keepFeatures: true\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t if (typeof options.style === 'function') {\n\t _options.style = options.style;\n\t } else {\n\t _options.style = (0, _lodashAssign2['default'])({}, defaults.style, options.style);\n\t }\n\t\n\t _get(Object.getPrototypeOf(GeoJSONLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t this._geojson = geojson;\n\t }\n\t\n\t _createClass(GeoJSONLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new THREE.Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t // Request data from URL if needed\n\t if (typeof this._geojson === 'string') {\n\t this._requestData(this._geojson);\n\t } else {\n\t // Process and add GeoJSON to layer\n\t this._processData(this._geojson);\n\t }\n\t }\n\t }, {\n\t key: '_requestData',\n\t value: function _requestData(url) {\n\t var _this = this;\n\t\n\t this._request = (0, _reqwest2['default'])({\n\t url: url,\n\t type: 'json',\n\t crossOrigin: true\n\t }).then(function (res) {\n\t // Clear request reference\n\t _this._request = null;\n\t _this._processData(res);\n\t })['catch'](function (err) {\n\t console.error(err);\n\t\n\t // Clear request reference\n\t _this._request = null;\n\t });\n\t }\n\t\n\t // TODO: Wrap into a helper method so this isn't duplicated in the tiled\n\t // GeoJSON output layer\n\t //\n\t // Need to be careful as to not make it impossible to fork this off into a\n\t // worker script at a later stage\n\t }, {\n\t key: '_processData',\n\t value: function _processData(data) {\n\t var _this2 = this;\n\t\n\t // Collects features into a single FeatureCollection\n\t //\n\t // Also converts TopoJSON to GeoJSON if instructed\n\t this._geojson = _utilGeoJSON2['default'].collectFeatures(data, this._options.topojson);\n\t\n\t // TODO: Check that GeoJSON is valid / usable\n\t\n\t var features = this._geojson.features;\n\t\n\t // Run filter, if provided\n\t if (this._options.filter) {\n\t features = this._geojson.features.filter(this._options.filter);\n\t }\n\t\n\t var defaults = {};\n\t\n\t // Assume that a style won't be set per feature\n\t var style = this._options.style;\n\t\n\t var options;\n\t features.forEach(function (feature) {\n\t // Get per-feature style object, if provided\n\t if (typeof _this2._options.style === 'function') {\n\t style = (0, _lodashAssign2['default'])({}, _utilGeoJSON2['default'].defaultStyle, _this2._options.style(feature));\n\t }\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, {\n\t // If merging feature layers, stop them outputting themselves\n\t // If not, let feature layers output themselves to the world\n\t output: !_this2.isOutput(),\n\t interactive: _this2._options.interactive,\n\t style: style\n\t });\n\t\n\t var layer = _this2._featureToLayer(feature, options);\n\t\n\t if (!layer) {\n\t return;\n\t }\n\t\n\t // Sometimes you don't want to store a reference to the feature\n\t //\n\t // For example, to save memory when being used by tile layers\n\t if (_this2._options.keepFeatures) {\n\t layer.feature = feature;\n\t }\n\t\n\t // If defined, call a function for each feature\n\t //\n\t // This is commonly used for adding event listeners from the user script\n\t if (_this2._options.onEachFeature) {\n\t _this2._options.onEachFeature(feature, layer);\n\t }\n\t\n\t _this2.addLayer(layer);\n\t });\n\t\n\t // If merging layers do that now, otherwise skip as the geometry layers\n\t // should have already outputted themselves\n\t if (!this.isOutput()) {\n\t return;\n\t }\n\t\n\t // From here on we can assume that we want to merge the layers\n\t\n\t var polygonAttributes = [];\n\t var polygonFlat = true;\n\t\n\t var polylineAttributes = [];\n\t var pointAttributes = [];\n\t\n\t this._layers.forEach(function (layer) {\n\t if (layer instanceof _geometryPolygonLayer2['default']) {\n\t polygonAttributes.push(layer.getBufferAttributes());\n\t\n\t if (polygonFlat && !layer.isFlat()) {\n\t polygonFlat = false;\n\t }\n\t } else if (layer instanceof _geometryPolylineLayer2['default']) {\n\t polylineAttributes.push(layer.getBufferAttributes());\n\t } else if (layer instanceof _geometryPointLayer2['default']) {\n\t pointAttributes.push(layer.getBufferAttributes());\n\t }\n\t });\n\t\n\t if (polygonAttributes.length > 0) {\n\t var mergedPolygonAttributes = _utilBuffer2['default'].mergeAttributes(polygonAttributes);\n\t this._setPolygonMesh(mergedPolygonAttributes, polygonFlat);\n\t this.add(this._polygonMesh);\n\t }\n\t\n\t if (polylineAttributes.length > 0) {\n\t var mergedPolylineAttributes = _utilBuffer2['default'].mergeAttributes(polylineAttributes);\n\t this._setPolylineMesh(mergedPolylineAttributes);\n\t this.add(this._polylineMesh);\n\t }\n\t\n\t if (pointAttributes.length > 0) {\n\t var mergedPointAttributes = _utilBuffer2['default'].mergeAttributes(pointAttributes);\n\t this._setPointMesh(mergedPointAttributes);\n\t this.add(this._pointMesh);\n\t }\n\t\n\t // Clean up layers\n\t //\n\t // TODO: Are there ever situations where the unmerged buffer attributes\n\t // and coordinates would still be required?\n\t this._layers.forEach(function (layer) {\n\t layer.clearBufferAttributes();\n\t layer.clearCoordinates();\n\t });\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // TODO: De-dupe this from the individual mesh creation logic within each\n\t // geometry layer (materials, settings, etc)\n\t //\n\t // Could make this an abstract method for each geometry layer\n\t }, {\n\t key: '_setPolygonMesh',\n\t value: function _setPolygonMesh(attributes, flat) {\n\t var geometry = new THREE.BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t // TODO: Make this work when style is a function per feature\n\t var style = typeof this._options.style === 'function' ? this._options.style(this._geojson.features[0]) : this._options.style;\n\t style = (0, _lodashAssign2['default'])({}, _utilGeoJSON2['default'].defaultStyle, style);\n\t\n\t var material;\n\t if (this._options.polygonMaterial && this._options.polygonMaterial instanceof THREE.Material) {\n\t material = this._options.polygonMaterial;\n\t } else if (!this._world._environment._skybox) {\n\t material = new THREE.MeshPhongMaterial({\n\t vertexColors: THREE.VertexColors,\n\t side: THREE.BackSide,\n\t transparent: style.transparent,\n\t opacity: style.opacity,\n\t blending: style.blending\n\t });\n\t } else {\n\t material = new THREE.MeshStandardMaterial({\n\t vertexColors: THREE.VertexColors,\n\t side: THREE.BackSide,\n\t transparent: style.transparent,\n\t opacity: style.opacity,\n\t blending: style.blending\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var mesh;\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onPolygonMesh === 'function') {\n\t mesh = this._options.onPolygonMesh(geometry, material);\n\t } else {\n\t mesh = new THREE.Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t mesh.receiveShadow = true;\n\t }\n\t\n\t if (flat) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = 1;\n\t }\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t material.side = THREE.BackSide;\n\t\n\t var pickingMesh = new THREE.Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._polygonMesh = mesh;\n\t }\n\t }, {\n\t key: '_setPolylineMesh',\n\t value: function _setPolylineMesh(attributes) {\n\t var geometry = new THREE.BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\t\n\t if (attributes.normals) {\n\t geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n\t }\n\t\n\t geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t // TODO: Make this work when style is a function per feature\n\t var style = typeof this._options.style === 'function' ? this._options.style(this._geojson.features[0]) : this._options.style;\n\t style = (0, _lodashAssign2['default'])({}, _utilGeoJSON2['default'].defaultStyle, style);\n\t\n\t var material;\n\t if (this._options.polylineMaterial && this._options.polylineMaterial instanceof THREE.Material) {\n\t material = this._options.polylineMaterial;\n\t } else {\n\t material = new THREE.LineBasicMaterial({\n\t vertexColors: THREE.VertexColors,\n\t linewidth: style.lineWidth,\n\t transparent: style.lineTransparent,\n\t opacity: style.lineOpacity,\n\t blending: style.lineBlending\n\t });\n\t }\n\t\n\t var mesh;\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onPolylineMesh === 'function') {\n\t mesh = this._options.onPolylineMesh(geometry, material);\n\t } else {\n\t mesh = new THREE.LineSegments(geometry, material);\n\t\n\t if (style.lineRenderOrder !== undefined) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = style.lineRenderOrder;\n\t }\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t }\n\t\n\t // TODO: Allow this to be overridden, or copy mesh instead of creating a new\n\t // one just for picking\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t // Make the line wider / easier to pick\n\t material.linewidth = style.lineWidth + material.linePadding;\n\t\n\t var pickingMesh = new THREE.LineSegments(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._polylineMesh = mesh;\n\t }\n\t }, {\n\t key: '_setPointMesh',\n\t value: function _setPointMesh(attributes) {\n\t var geometry = new THREE.BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t if (this._options.pointMaterial && this._options.pointMaterial instanceof THREE.Material) {\n\t material = this._options.pointMaterial;\n\t } else if (!this._world._environment._skybox) {\n\t material = new THREE.MeshPhongMaterial({\n\t vertexColors: THREE.VertexColors\n\t // side: THREE.BackSide\n\t });\n\t } else {\n\t material = new THREE.MeshStandardMaterial({\n\t vertexColors: THREE.VertexColors\n\t // side: THREE.BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var mesh;\n\t\n\t // Pass mesh callback, if defined\n\t if (typeof this._options.onPointMesh === 'function') {\n\t mesh = this._options.onPointMesh(geometry, material);\n\t } else {\n\t mesh = new THREE.Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t }\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t var pickingMesh = new THREE.Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._pointMesh = mesh;\n\t }\n\t\n\t // TODO: Support all GeoJSON geometry types\n\t }, {\n\t key: '_featureToLayer',\n\t value: function _featureToLayer(feature, options) {\n\t var geometry = feature.geometry;\n\t var coordinates = geometry.coordinates ? geometry.coordinates : null;\n\t\n\t if (!coordinates || !geometry) {\n\t return;\n\t }\n\t\n\t if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {\n\t // Get material instance to use for polygon, if provided\n\t if (typeof this._options.polygonMaterial === 'function') {\n\t options.geometry = this._options.polygonMaterial(feature);\n\t }\n\t\n\t if (typeof this._options.onPolygonMesh === 'function') {\n\t options.onMesh = this._options.onPolygonMesh;\n\t }\n\t\n\t // Pass onBufferAttributes callback, if defined\n\t if (typeof this._options.onPolygonBufferAttributes === 'function') {\n\t options.onBufferAttributes = this._options.onPolygonBufferAttributes;\n\t }\n\t\n\t return new _geometryPolygonLayer2['default'](coordinates, options);\n\t }\n\t\n\t if (geometry.type === 'LineString' || geometry.type === 'MultiLineString') {\n\t // Get material instance to use for line, if provided\n\t if (typeof this._options.lineMaterial === 'function') {\n\t options.geometry = this._options.lineMaterial(feature);\n\t }\n\t\n\t if (typeof this._options.onPolylineMesh === 'function') {\n\t options.onMesh = this._options.onPolylineMesh;\n\t }\n\t\n\t // Pass onBufferAttributes callback, if defined\n\t if (typeof this._options.onPolylineBufferAttributes === 'function') {\n\t options.onBufferAttributes = this._options.onPolylineBufferAttributes;\n\t }\n\t\n\t return new _geometryPolylineLayer2['default'](coordinates, options);\n\t }\n\t\n\t if (geometry.type === 'Point' || geometry.type === 'MultiPoint') {\n\t // Get geometry object to use for point, if provided\n\t if (typeof this._options.pointGeometry === 'function') {\n\t options.geometry = this._options.pointGeometry(feature);\n\t }\n\t\n\t // Get material instance to use for point, if provided\n\t if (typeof this._options.pointMaterial === 'function') {\n\t options.geometry = this._options.pointMaterial(feature);\n\t }\n\t\n\t if (typeof this._options.onPointMesh === 'function') {\n\t options.onMesh = this._options.onPointMesh;\n\t }\n\t\n\t return new _geometryPointLayer2['default'](coordinates, options);\n\t }\n\t }\n\t }, {\n\t key: '_abortRequest',\n\t value: function _abortRequest() {\n\t if (!this._request) {\n\t return;\n\t }\n\t\n\t this._request.abort();\n\t }\n\t\n\t // Destroy the layers and remove them from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // Cancel any pending requests\n\t this._abortRequest();\n\t\n\t // Clear request reference\n\t this._request = null;\n\t\n\t this._geojson = null;\n\t\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t if (this._polygonMesh) {\n\t this._polygonMesh = null;\n\t }\n\t\n\t if (this._polylineMesh) {\n\t this._polylineMesh = null;\n\t }\n\t\n\t if (this._pointMesh) {\n\t this._pointMesh = null;\n\t }\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(GeoJSONLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return GeoJSONLayer;\n\t})(_LayerGroup3['default']);\n\t\n\texports['default'] = GeoJSONLayer;\n\t\n\tvar noNew = function noNew(geojson, options) {\n\t return new GeoJSONLayer(geojson, options);\n\t};\n\t\n\texports.geoJSONLayer = noNew;\n\n/***/ },\n/* 73 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _Layer2 = __webpack_require__(46);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar LayerGroup = (function (_Layer) {\n\t _inherits(LayerGroup, _Layer);\n\t\n\t function LayerGroup(options) {\n\t _classCallCheck(this, LayerGroup);\n\t\n\t var defaults = {\n\t output: false\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(LayerGroup.prototype), 'constructor', this).call(this, _options);\n\t\n\t this._layers = [];\n\t }\n\t\n\t _createClass(LayerGroup, [{\n\t key: 'addLayer',\n\t value: function addLayer(layer) {\n\t this._layers.push(layer);\n\t this._world.addLayer(layer);\n\t }\n\t }, {\n\t key: 'removeLayer',\n\t value: function removeLayer(layer) {\n\t var layerIndex = this._layers.indexOf(layer);\n\t\n\t if (layerIndex > -1) {\n\t // Remove from this._layers\n\t this._layers.splice(layerIndex, 1);\n\t };\n\t\n\t this._world.removeLayer(layer);\n\t }\n\t }, {\n\t key: '_onAdd',\n\t value: function _onAdd(world) {}\n\t\n\t // Destroy the layers and remove them from the scene and memory\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t // TODO: Sometimes this is already null, find out why\n\t if (this._layers) {\n\t for (var i = 0; i < this._layers.length; i++) {\n\t this._layers[i].destroy();\n\t }\n\t\n\t this._layers = null;\n\t }\n\t\n\t _get(Object.getPrototypeOf(LayerGroup.prototype), 'destroy', this).call(this);\n\t }\n\t }]);\n\t\n\t return LayerGroup;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = LayerGroup;\n\t\n\tvar noNew = function noNew(options) {\n\t return new LayerGroup(options);\n\t};\n\t\n\texports.layerGroup = noNew;\n\n/***/ },\n/* 74 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n\t * Reqwest! A general purpose XHR connection manager\n\t * license MIT (c) Dustin Diaz 2015\n\t * https://github.com/ded/reqwest\n\t */\n\t\n\t!function (name, context, definition) {\n\t if (typeof module != 'undefined' && module.exports) module.exports = definition()\n\t else if (true) !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))\n\t else context[name] = definition()\n\t}('reqwest', this, function () {\n\t\n\t var context = this\n\t\n\t if ('window' in context) {\n\t var doc = document\n\t , byTag = 'getElementsByTagName'\n\t , head = doc[byTag]('head')[0]\n\t } else {\n\t var XHR2\n\t try {\n\t XHR2 = __webpack_require__(75)\n\t } catch (ex) {\n\t throw new Error('Peer dependency `xhr2` required! Please npm install xhr2')\n\t }\n\t }\n\t\n\t\n\t var httpsRe = /^http/\n\t , protocolRe = /(^\\w+):\\/\\//\n\t , twoHundo = /^(20\\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n\t , readyState = 'readyState'\n\t , contentType = 'Content-Type'\n\t , requestedWith = 'X-Requested-With'\n\t , uniqid = 0\n\t , callbackPrefix = 'reqwest_' + (+new Date())\n\t , lastValue // data stored by the most recent JSONP callback\n\t , xmlHttpRequest = 'XMLHttpRequest'\n\t , xDomainRequest = 'XDomainRequest'\n\t , noop = function () {}\n\t\n\t , isArray = typeof Array.isArray == 'function'\n\t ? Array.isArray\n\t : function (a) {\n\t return a instanceof Array\n\t }\n\t\n\t , defaultHeaders = {\n\t 'contentType': 'application/x-www-form-urlencoded'\n\t , 'requestedWith': xmlHttpRequest\n\t , 'accept': {\n\t '*': 'text/javascript, text/html, application/xml, text/xml, */*'\n\t , 'xml': 'application/xml, text/xml'\n\t , 'html': 'text/html'\n\t , 'text': 'text/plain'\n\t , 'json': 'application/json, text/javascript'\n\t , 'js': 'application/javascript, text/javascript'\n\t }\n\t }\n\t\n\t , xhr = function(o) {\n\t // is it x-domain\n\t if (o['crossOrigin'] === true) {\n\t var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null\n\t if (xhr && 'withCredentials' in xhr) {\n\t return xhr\n\t } else if (context[xDomainRequest]) {\n\t return new XDomainRequest()\n\t } else {\n\t throw new Error('Browser does not support cross-origin requests')\n\t }\n\t } else if (context[xmlHttpRequest]) {\n\t return new XMLHttpRequest()\n\t } else if (XHR2) {\n\t return new XHR2()\n\t } else {\n\t return new ActiveXObject('Microsoft.XMLHTTP')\n\t }\n\t }\n\t , globalSetupOptions = {\n\t dataFilter: function (data) {\n\t return data\n\t }\n\t }\n\t\n\t function succeed(r) {\n\t var protocol = protocolRe.exec(r.url)\n\t protocol = (protocol && protocol[1]) || context.location.protocol\n\t return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response\n\t }\n\t\n\t function handleReadyState(r, success, error) {\n\t return function () {\n\t // use _aborted to mitigate against IE err c00c023f\n\t // (can't read props on aborted request objects)\n\t if (r._aborted) return error(r.request)\n\t if (r._timedOut) return error(r.request, 'Request is aborted: timeout')\n\t if (r.request && r.request[readyState] == 4) {\n\t r.request.onreadystatechange = noop\n\t if (succeed(r)) success(r.request)\n\t else\n\t error(r.request)\n\t }\n\t }\n\t }\n\t\n\t function setHeaders(http, o) {\n\t var headers = o['headers'] || {}\n\t , h\n\t\n\t headers['Accept'] = headers['Accept']\n\t || defaultHeaders['accept'][o['type']]\n\t || defaultHeaders['accept']['*']\n\t\n\t var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData);\n\t // breaks cross-origin requests with legacy browsers\n\t if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith']\n\t if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType']\n\t for (h in headers)\n\t headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h])\n\t }\n\t\n\t function setCredentials(http, o) {\n\t if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') {\n\t http.withCredentials = !!o['withCredentials']\n\t }\n\t }\n\t\n\t function generalCallback(data) {\n\t lastValue = data\n\t }\n\t\n\t function urlappend (url, s) {\n\t return url + (/\\?/.test(url) ? '&' : '?') + s\n\t }\n\t\n\t function handleJsonp(o, fn, err, url) {\n\t var reqId = uniqid++\n\t , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key\n\t , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId)\n\t , cbreg = new RegExp('((^|\\\\?|&)' + cbkey + ')=([^&]+)')\n\t , match = url.match(cbreg)\n\t , script = doc.createElement('script')\n\t , loaded = 0\n\t , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1\n\t\n\t if (match) {\n\t if (match[3] === '?') {\n\t url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name\n\t } else {\n\t cbval = match[3] // provided callback func name\n\t }\n\t } else {\n\t url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em\n\t }\n\t\n\t context[cbval] = generalCallback\n\t\n\t script.type = 'text/javascript'\n\t script.src = url\n\t script.async = true\n\t if (typeof script.onreadystatechange !== 'undefined' && !isIE10) {\n\t // need this for IE due to out-of-order onreadystatechange(), binding script\n\t // execution to an event listener gives us control over when the script\n\t // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html\n\t script.htmlFor = script.id = '_reqwest_' + reqId\n\t }\n\t\n\t script.onload = script.onreadystatechange = function () {\n\t if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) {\n\t return false\n\t }\n\t script.onload = script.onreadystatechange = null\n\t script.onclick && script.onclick()\n\t // Call the user callback with the last value stored and clean up values and scripts.\n\t fn(lastValue)\n\t lastValue = undefined\n\t head.removeChild(script)\n\t loaded = 1\n\t }\n\t\n\t // Add the script to the DOM head\n\t head.appendChild(script)\n\t\n\t // Enable JSONP timeout\n\t return {\n\t abort: function () {\n\t script.onload = script.onreadystatechange = null\n\t err({}, 'Request is aborted: timeout', {})\n\t lastValue = undefined\n\t head.removeChild(script)\n\t loaded = 1\n\t }\n\t }\n\t }\n\t\n\t function getRequest(fn, err) {\n\t var o = this.o\n\t , method = (o['method'] || 'GET').toUpperCase()\n\t , url = typeof o === 'string' ? o : o['url']\n\t // convert non-string objects to query-string form unless o['processData'] is false\n\t , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string')\n\t ? reqwest.toQueryString(o['data'])\n\t : (o['data'] || null)\n\t , http\n\t , sendWait = false\n\t\n\t // if we're working on a GET request and we have data then we should append\n\t // query string to end of URL and not post data\n\t if ((o['type'] == 'jsonp' || method == 'GET') && data) {\n\t url = urlappend(url, data)\n\t data = null\n\t }\n\t\n\t if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url)\n\t\n\t // get the xhr from the factory if passed\n\t // if the factory returns null, fall-back to ours\n\t http = (o.xhr && o.xhr(o)) || xhr(o)\n\t\n\t http.open(method, url, o['async'] === false ? false : true)\n\t setHeaders(http, o)\n\t setCredentials(http, o)\n\t if (context[xDomainRequest] && http instanceof context[xDomainRequest]) {\n\t http.onload = fn\n\t http.onerror = err\n\t // NOTE: see\n\t // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e\n\t http.onprogress = function() {}\n\t sendWait = true\n\t } else {\n\t http.onreadystatechange = handleReadyState(this, fn, err)\n\t }\n\t o['before'] && o['before'](http)\n\t if (sendWait) {\n\t setTimeout(function () {\n\t http.send(data)\n\t }, 200)\n\t } else {\n\t http.send(data)\n\t }\n\t return http\n\t }\n\t\n\t function Reqwest(o, fn) {\n\t this.o = o\n\t this.fn = fn\n\t\n\t init.apply(this, arguments)\n\t }\n\t\n\t function setType(header) {\n\t // json, javascript, text/plain, text/html, xml\n\t if (header === null) return undefined; //In case of no content-type.\n\t if (header.match('json')) return 'json'\n\t if (header.match('javascript')) return 'js'\n\t if (header.match('text')) return 'html'\n\t if (header.match('xml')) return 'xml'\n\t }\n\t\n\t function init(o, fn) {\n\t\n\t this.url = typeof o == 'string' ? o : o['url']\n\t this.timeout = null\n\t\n\t // whether request has been fulfilled for purpose\n\t // of tracking the Promises\n\t this._fulfilled = false\n\t // success handlers\n\t this._successHandler = function(){}\n\t this._fulfillmentHandlers = []\n\t // error handlers\n\t this._errorHandlers = []\n\t // complete (both success and fail) handlers\n\t this._completeHandlers = []\n\t this._erred = false\n\t this._responseArgs = {}\n\t\n\t var self = this\n\t\n\t fn = fn || function () {}\n\t\n\t if (o['timeout']) {\n\t this.timeout = setTimeout(function () {\n\t timedOut()\n\t }, o['timeout'])\n\t }\n\t\n\t if (o['success']) {\n\t this._successHandler = function () {\n\t o['success'].apply(o, arguments)\n\t }\n\t }\n\t\n\t if (o['error']) {\n\t this._errorHandlers.push(function () {\n\t o['error'].apply(o, arguments)\n\t })\n\t }\n\t\n\t if (o['complete']) {\n\t this._completeHandlers.push(function () {\n\t o['complete'].apply(o, arguments)\n\t })\n\t }\n\t\n\t function complete (resp) {\n\t o['timeout'] && clearTimeout(self.timeout)\n\t self.timeout = null\n\t while (self._completeHandlers.length > 0) {\n\t self._completeHandlers.shift()(resp)\n\t }\n\t }\n\t\n\t function success (resp) {\n\t var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE\n\t resp = (type !== 'jsonp') ? self.request : resp\n\t // use global data filter on response text\n\t var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type)\n\t , r = filteredResponse\n\t try {\n\t resp.responseText = r\n\t } catch (e) {\n\t // can't assign this in IE<=8, just ignore\n\t }\n\t if (r) {\n\t switch (type) {\n\t case 'json':\n\t try {\n\t resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')')\n\t } catch (err) {\n\t return error(resp, 'Could not parse JSON in response', err)\n\t }\n\t break\n\t case 'js':\n\t resp = eval(r)\n\t break\n\t case 'html':\n\t resp = r\n\t break\n\t case 'xml':\n\t resp = resp.responseXML\n\t && resp.responseXML.parseError // IE trololo\n\t && resp.responseXML.parseError.errorCode\n\t && resp.responseXML.parseError.reason\n\t ? null\n\t : resp.responseXML\n\t break\n\t }\n\t }\n\t\n\t self._responseArgs.resp = resp\n\t self._fulfilled = true\n\t fn(resp)\n\t self._successHandler(resp)\n\t while (self._fulfillmentHandlers.length > 0) {\n\t resp = self._fulfillmentHandlers.shift()(resp)\n\t }\n\t\n\t complete(resp)\n\t }\n\t\n\t function timedOut() {\n\t self._timedOut = true\n\t self.request.abort()\n\t }\n\t\n\t function error(resp, msg, t) {\n\t resp = self.request\n\t self._responseArgs.resp = resp\n\t self._responseArgs.msg = msg\n\t self._responseArgs.t = t\n\t self._erred = true\n\t while (self._errorHandlers.length > 0) {\n\t self._errorHandlers.shift()(resp, msg, t)\n\t }\n\t complete(resp)\n\t }\n\t\n\t this.request = getRequest.call(this, success, error)\n\t }\n\t\n\t Reqwest.prototype = {\n\t abort: function () {\n\t this._aborted = true\n\t this.request.abort()\n\t }\n\t\n\t , retry: function () {\n\t init.call(this, this.o, this.fn)\n\t }\n\t\n\t /**\n\t * Small deviation from the Promises A CommonJs specification\n\t * http://wiki.commonjs.org/wiki/Promises/A\n\t */\n\t\n\t /**\n\t * `then` will execute upon successful requests\n\t */\n\t , then: function (success, fail) {\n\t success = success || function () {}\n\t fail = fail || function () {}\n\t if (this._fulfilled) {\n\t this._responseArgs.resp = success(this._responseArgs.resp)\n\t } else if (this._erred) {\n\t fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n\t } else {\n\t this._fulfillmentHandlers.push(success)\n\t this._errorHandlers.push(fail)\n\t }\n\t return this\n\t }\n\t\n\t /**\n\t * `always` will execute whether the request succeeds or fails\n\t */\n\t , always: function (fn) {\n\t if (this._fulfilled || this._erred) {\n\t fn(this._responseArgs.resp)\n\t } else {\n\t this._completeHandlers.push(fn)\n\t }\n\t return this\n\t }\n\t\n\t /**\n\t * `fail` will execute when the request fails\n\t */\n\t , fail: function (fn) {\n\t if (this._erred) {\n\t fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n\t } else {\n\t this._errorHandlers.push(fn)\n\t }\n\t return this\n\t }\n\t , 'catch': function (fn) {\n\t return this.fail(fn)\n\t }\n\t }\n\t\n\t function reqwest(o, fn) {\n\t return new Reqwest(o, fn)\n\t }\n\t\n\t // normalize newline variants according to spec -> CRLF\n\t function normalize(s) {\n\t return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n\t }\n\t\n\t function serial(el, cb) {\n\t var n = el.name\n\t , t = el.tagName.toLowerCase()\n\t , optCb = function (o) {\n\t // IE gives value=\"\" even where there is no value attribute\n\t // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273\n\t if (o && !o['disabled'])\n\t cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text']))\n\t }\n\t , ch, ra, val, i\n\t\n\t // don't serialize elements that are disabled or without a name\n\t if (el.disabled || !n) return\n\t\n\t switch (t) {\n\t case 'input':\n\t if (!/reset|button|image|file/i.test(el.type)) {\n\t ch = /checkbox/i.test(el.type)\n\t ra = /radio/i.test(el.type)\n\t val = el.value\n\t // WebKit gives us \"\" instead of \"on\" if a checkbox has no value, so correct it here\n\t ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val))\n\t }\n\t break\n\t case 'textarea':\n\t cb(n, normalize(el.value))\n\t break\n\t case 'select':\n\t if (el.type.toLowerCase() === 'select-one') {\n\t optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null)\n\t } else {\n\t for (i = 0; el.length && i < el.length; i++) {\n\t el.options[i].selected && optCb(el.options[i])\n\t }\n\t }\n\t break\n\t }\n\t }\n\t\n\t // collect up all form elements found from the passed argument elements all\n\t // the way down to child elements; pass a '' or form fields.\n\t // called with 'this'=callback to use for serial() on each element\n\t function eachFormElement() {\n\t var cb = this\n\t , e, i\n\t , serializeSubtags = function (e, tags) {\n\t var i, j, fa\n\t for (i = 0; i < tags.length; i++) {\n\t fa = e[byTag](tags[i])\n\t for (j = 0; j < fa.length; j++) serial(fa[j], cb)\n\t }\n\t }\n\t\n\t for (i = 0; i < arguments.length; i++) {\n\t e = arguments[i]\n\t if (/input|select|textarea/i.test(e.tagName)) serial(e, cb)\n\t serializeSubtags(e, [ 'input', 'select', 'textarea' ])\n\t }\n\t }\n\t\n\t // standard query string style serialization\n\t function serializeQueryString() {\n\t return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments))\n\t }\n\t\n\t // { 'name': 'value', ... } style serialization\n\t function serializeHash() {\n\t var hash = {}\n\t eachFormElement.apply(function (name, value) {\n\t if (name in hash) {\n\t hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])\n\t hash[name].push(value)\n\t } else hash[name] = value\n\t }, arguments)\n\t return hash\n\t }\n\t\n\t // [ { name: 'name', value: 'value' }, ... ] style serialization\n\t reqwest.serializeArray = function () {\n\t var arr = []\n\t eachFormElement.apply(function (name, value) {\n\t arr.push({name: name, value: value})\n\t }, arguments)\n\t return arr\n\t }\n\t\n\t reqwest.serialize = function () {\n\t if (arguments.length === 0) return ''\n\t var opt, fn\n\t , args = Array.prototype.slice.call(arguments, 0)\n\t\n\t opt = args.pop()\n\t opt && opt.nodeType && args.push(opt) && (opt = null)\n\t opt && (opt = opt.type)\n\t\n\t if (opt == 'map') fn = serializeHash\n\t else if (opt == 'array') fn = reqwest.serializeArray\n\t else fn = serializeQueryString\n\t\n\t return fn.apply(null, args)\n\t }\n\t\n\t reqwest.toQueryString = function (o, trad) {\n\t var prefix, i\n\t , traditional = trad || false\n\t , s = []\n\t , enc = encodeURIComponent\n\t , add = function (key, value) {\n\t // If value is a function, invoke it and return its value\n\t value = ('function' === typeof value) ? value() : (value == null ? '' : value)\n\t s[s.length] = enc(key) + '=' + enc(value)\n\t }\n\t // If an array was passed in, assume that it is an array of form elements.\n\t if (isArray(o)) {\n\t for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value'])\n\t } else {\n\t // If traditional, encode the \"old\" way (the way 1.3.2 or older\n\t // did it), otherwise encode params recursively.\n\t for (prefix in o) {\n\t if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add)\n\t }\n\t }\n\t\n\t // spaces should be + according to spec\n\t return s.join('&').replace(/%20/g, '+')\n\t }\n\t\n\t function buildParams(prefix, obj, traditional, add) {\n\t var name, i, v\n\t , rbracket = /\\[\\]$/\n\t\n\t if (isArray(obj)) {\n\t // Serialize array item.\n\t for (i = 0; obj && i < obj.length; i++) {\n\t v = obj[i]\n\t if (traditional || rbracket.test(prefix)) {\n\t // Treat each array item as a scalar.\n\t add(prefix, v)\n\t } else {\n\t buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add)\n\t }\n\t }\n\t } else if (obj && obj.toString() === '[object Object]') {\n\t // Serialize object item.\n\t for (name in obj) {\n\t buildParams(prefix + '[' + name + ']', obj[name], traditional, add)\n\t }\n\t\n\t } else {\n\t // Serialize scalar item.\n\t add(prefix, obj)\n\t }\n\t }\n\t\n\t reqwest.getcallbackPrefix = function () {\n\t return callbackPrefix\n\t }\n\t\n\t // jQuery and Zepto compatibility, differences can be remapped here so you can call\n\t // .ajax.compat(options, callback)\n\t reqwest.compat = function (o, fn) {\n\t if (o) {\n\t o['type'] && (o['method'] = o['type']) && delete o['type']\n\t o['dataType'] && (o['type'] = o['dataType'])\n\t o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback']\n\t o['jsonp'] && (o['jsonpCallback'] = o['jsonp'])\n\t }\n\t return new Reqwest(o, fn)\n\t }\n\t\n\t reqwest.ajaxSetup = function (options) {\n\t options = options || {}\n\t for (var k in options) {\n\t globalSetupOptions[k] = options[k]\n\t }\n\t }\n\t\n\t return reqwest\n\t});\n\n\n/***/ },\n/* 75 */\n/***/ function(module, exports) {\n\n\t/* (ignored) */\n\n/***/ },\n/* 76 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * GeoJSON helpers for handling data and generating objects\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _topojson2 = __webpack_require__(77);\n\t\n\tvar _topojson3 = _interopRequireDefault(_topojson2);\n\t\n\tvar _geojsonMerge = __webpack_require__(78);\n\t\n\tvar _geojsonMerge2 = _interopRequireDefault(_geojsonMerge);\n\t\n\tvar _earcut = __webpack_require__(80);\n\t\n\tvar _earcut2 = _interopRequireDefault(_earcut);\n\t\n\tvar _extrudePolygon = __webpack_require__(81);\n\t\n\tvar _extrudePolygon2 = _interopRequireDefault(_extrudePolygon);\n\t\n\t// TODO: Make it so height can be per-coordinate / point but connected together\n\t// as a linestring (eg. GPS points with an elevation at each point)\n\t//\n\t// This isn't really valid GeoJSON so perhaps something best left to an external\n\t// component for now, until a better approach can be considered\n\t//\n\t// See: http://lists.geojson.org/pipermail/geojson-geojson.org/2009-June/000489.html\n\t\n\t// Light and dark colours used for poor-mans AO gradient on object sides\n\tvar light = new _three2['default'].Color(0xffffff);\n\tvar shadow = new _three2['default'].Color(0x666666);\n\t\n\tvar GeoJSON = (function () {\n\t var defaultStyle = {\n\t color: '#ffffff',\n\t transparent: false,\n\t opacity: 1,\n\t blending: _three2['default'].NormalBlending,\n\t height: 0,\n\t lineOpacity: 1,\n\t lineTransparent: false,\n\t lineColor: '#ffffff',\n\t lineWidth: 1,\n\t lineBlending: _three2['default'].NormalBlending\n\t };\n\t\n\t // Attempts to merge together multiple GeoJSON Features or FeatureCollections\n\t // into a single FeatureCollection\n\t var collectFeatures = function collectFeatures(data, _topojson) {\n\t var collections = [];\n\t\n\t if (_topojson) {\n\t // TODO: Allow TopoJSON objects to be overridden as an option\n\t\n\t // If not overridden, merge all features from all objects\n\t for (var tk in data.objects) {\n\t collections.push(_topojson3['default'].feature(data, data.objects[tk]));\n\t }\n\t\n\t return (0, _geojsonMerge2['default'])(collections);\n\t } else {\n\t // If root doesn't have a type then let's see if there are features in the\n\t // next step down\n\t if (!data.type) {\n\t // TODO: Allow GeoJSON objects to be overridden as an option\n\t\n\t // If not overridden, merge all features from all objects\n\t for (var gk in data) {\n\t if (!data[gk].type) {\n\t continue;\n\t }\n\t\n\t collections.push(data[gk]);\n\t }\n\t\n\t return (0, _geojsonMerge2['default'])(collections);\n\t } else if (Array.isArray(data)) {\n\t return (0, _geojsonMerge2['default'])(data);\n\t } else {\n\t return data;\n\t }\n\t }\n\t };\n\t\n\t // TODO: This is only used by GeoJSONTile so either roll it into that or\n\t // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n\t var lineStringAttributes = function lineStringAttributes(coordinates, colour, height) {\n\t var _coords = [];\n\t var _colours = [];\n\t\n\t var nextCoord;\n\t\n\t // Connect coordinate with the next to make a pair\n\t //\n\t // LineSegments requires pairs of vertices so repeat the last point if\n\t // there's an odd number of vertices\n\t coordinates.forEach(function (coordinate, index) {\n\t _colours.push([colour.r, colour.g, colour.b]);\n\t _coords.push([coordinate[0], height, coordinate[1]]);\n\t\n\t nextCoord = coordinates[index + 1] ? coordinates[index + 1] : coordinate;\n\t\n\t _colours.push([colour.r, colour.g, colour.b]);\n\t _coords.push([nextCoord[0], height, nextCoord[1]]);\n\t });\n\t\n\t return {\n\t vertices: _coords,\n\t colours: _colours\n\t };\n\t };\n\t\n\t // TODO: This is only used by GeoJSONTile so either roll it into that or\n\t // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n\t var multiLineStringAttributes = function multiLineStringAttributes(coordinates, colour, height) {\n\t var _coords = [];\n\t var _colours = [];\n\t\n\t var result;\n\t coordinates.forEach(function (coordinate) {\n\t result = lineStringAttributes(coordinate, colour, height);\n\t\n\t result.vertices.forEach(function (coord) {\n\t _coords.push(coord);\n\t });\n\t\n\t result.colours.forEach(function (colour) {\n\t _colours.push(colour);\n\t });\n\t });\n\t\n\t return {\n\t vertices: _coords,\n\t colours: _colours\n\t };\n\t };\n\t\n\t // TODO: This is only used by GeoJSONTile so either roll it into that or\n\t // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n\t var polygonAttributes = function polygonAttributes(coordinates, colour, height) {\n\t var earcutData = _toEarcut(coordinates);\n\t\n\t var faces = _triangulate(earcutData.vertices, earcutData.holes, earcutData.dimensions);\n\t\n\t var groupedVertices = [];\n\t for (i = 0, il = earcutData.vertices.length; i < il; i += earcutData.dimensions) {\n\t groupedVertices.push(earcutData.vertices.slice(i, i + earcutData.dimensions));\n\t }\n\t\n\t var extruded = (0, _extrudePolygon2['default'])(groupedVertices, faces, {\n\t bottom: 0,\n\t top: height\n\t });\n\t\n\t var topColor = colour.clone().multiply(light);\n\t var bottomColor = colour.clone().multiply(shadow);\n\t\n\t var _vertices = extruded.positions;\n\t var _faces = [];\n\t var _colours = [];\n\t\n\t var _colour;\n\t extruded.top.forEach(function (face, fi) {\n\t _colour = [];\n\t\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t\n\t _faces.push(face);\n\t _colours.push(_colour);\n\t });\n\t\n\t var allFlat = true;\n\t\n\t if (extruded.sides) {\n\t if (allFlat) {\n\t allFlat = false;\n\t }\n\t\n\t // Set up colours for every vertex with poor-mans AO on the sides\n\t extruded.sides.forEach(function (face, fi) {\n\t _colour = [];\n\t\n\t // First face is always bottom-bottom-top\n\t if (fi % 2 === 0) {\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t // Reverse winding for the second face\n\t // top-top-bottom\n\t } else {\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t }\n\t\n\t _faces.push(face);\n\t _colours.push(_colour);\n\t });\n\t }\n\t\n\t // Skip bottom as there's no point rendering it\n\t // allFaces.push(extruded.faces);\n\t\n\t return {\n\t vertices: _vertices,\n\t faces: _faces,\n\t colours: _colours,\n\t flat: allFlat\n\t };\n\t };\n\t\n\t // TODO: This is only used by GeoJSONTile so either roll it into that or\n\t // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n\t var _toEarcut = function _toEarcut(data) {\n\t var dim = data[0][0].length;\n\t var result = { vertices: [], holes: [], dimensions: dim };\n\t var holeIndex = 0;\n\t\n\t for (var i = 0; i < data.length; i++) {\n\t for (var j = 0; j < data[i].length; j++) {\n\t for (var d = 0; d < dim; d++) {\n\t result.vertices.push(data[i][j][d]);\n\t }\n\t }\n\t if (i > 0) {\n\t holeIndex += data[i - 1].length;\n\t result.holes.push(holeIndex);\n\t }\n\t }\n\t\n\t return result;\n\t };\n\t\n\t // TODO: This is only used by GeoJSONTile so either roll it into that or\n\t // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n\t var _triangulate = function _triangulate(contour, holes, dim) {\n\t // console.time('earcut');\n\t\n\t var faces = (0, _earcut2['default'])(contour, holes, dim);\n\t var result = [];\n\t\n\t for (i = 0, il = faces.length; i < il; i += 3) {\n\t result.push(faces.slice(i, i + 3));\n\t }\n\t\n\t // console.timeEnd('earcut');\n\t\n\t return result;\n\t };\n\t\n\t return {\n\t defaultStyle: defaultStyle,\n\t collectFeatures: collectFeatures,\n\t lineStringAttributes: lineStringAttributes,\n\t multiLineStringAttributes: multiLineStringAttributes,\n\t polygonAttributes: polygonAttributes\n\t };\n\t})();\n\t\n\texports['default'] = GeoJSON;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 77 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t(function (global, factory) {\n\t true ? factory(exports) :\n\t typeof define === 'function' && define.amd ? define(['exports'], factory) :\n\t (factory((global.topojson = {})));\n\t}(this, function (exports) { 'use strict';\n\t\n\t function noop() {}\n\t\n\t function absolute(transform) {\n\t if (!transform) return noop;\n\t var x0,\n\t y0,\n\t kx = transform.scale[0],\n\t ky = transform.scale[1],\n\t dx = transform.translate[0],\n\t dy = transform.translate[1];\n\t return function(point, i) {\n\t if (!i) x0 = y0 = 0;\n\t point[0] = (x0 += point[0]) * kx + dx;\n\t point[1] = (y0 += point[1]) * ky + dy;\n\t };\n\t }\n\t\n\t function relative(transform) {\n\t if (!transform) return noop;\n\t var x0,\n\t y0,\n\t kx = transform.scale[0],\n\t ky = transform.scale[1],\n\t dx = transform.translate[0],\n\t dy = transform.translate[1];\n\t return function(point, i) {\n\t if (!i) x0 = y0 = 0;\n\t var x1 = (point[0] - dx) / kx | 0,\n\t y1 = (point[1] - dy) / ky | 0;\n\t point[0] = x1 - x0;\n\t point[1] = y1 - y0;\n\t x0 = x1;\n\t y0 = y1;\n\t };\n\t }\n\t\n\t function reverse(array, n) {\n\t var t, j = array.length, i = j - n;\n\t while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;\n\t }\n\t\n\t function bisect(a, x) {\n\t var lo = 0, hi = a.length;\n\t while (lo < hi) {\n\t var mid = lo + hi >>> 1;\n\t if (a[mid] < x) lo = mid + 1;\n\t else hi = mid;\n\t }\n\t return lo;\n\t }\n\t\n\t function feature(topology, o) {\n\t return o.type === \"GeometryCollection\" ? {\n\t type: \"FeatureCollection\",\n\t features: o.geometries.map(function(o) { return feature$1(topology, o); })\n\t } : feature$1(topology, o);\n\t }\n\t\n\t function feature$1(topology, o) {\n\t var f = {\n\t type: \"Feature\",\n\t id: o.id,\n\t properties: o.properties || {},\n\t geometry: object(topology, o)\n\t };\n\t if (o.id == null) delete f.id;\n\t return f;\n\t }\n\t\n\t function object(topology, o) {\n\t var absolute$$ = absolute(topology.transform),\n\t arcs = topology.arcs;\n\t\n\t function arc(i, points) {\n\t if (points.length) points.pop();\n\t for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) {\n\t points.push(p = a[k].slice());\n\t absolute$$(p, k);\n\t }\n\t if (i < 0) reverse(points, n);\n\t }\n\t\n\t function point(p) {\n\t p = p.slice();\n\t absolute$$(p, 0);\n\t return p;\n\t }\n\t\n\t function line(arcs) {\n\t var points = [];\n\t for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);\n\t if (points.length < 2) points.push(points[0].slice());\n\t return points;\n\t }\n\t\n\t function ring(arcs) {\n\t var points = line(arcs);\n\t while (points.length < 4) points.push(points[0].slice());\n\t return points;\n\t }\n\t\n\t function polygon(arcs) {\n\t return arcs.map(ring);\n\t }\n\t\n\t function geometry(o) {\n\t var t = o.type;\n\t return t === \"GeometryCollection\" ? {type: t, geometries: o.geometries.map(geometry)}\n\t : t in geometryType ? {type: t, coordinates: geometryType[t](o)}\n\t : null;\n\t }\n\t\n\t var geometryType = {\n\t Point: function(o) { return point(o.coordinates); },\n\t MultiPoint: function(o) { return o.coordinates.map(point); },\n\t LineString: function(o) { return line(o.arcs); },\n\t MultiLineString: function(o) { return o.arcs.map(line); },\n\t Polygon: function(o) { return polygon(o.arcs); },\n\t MultiPolygon: function(o) { return o.arcs.map(polygon); }\n\t };\n\t\n\t return geometry(o);\n\t }\n\t\n\t function stitchArcs(topology, arcs) {\n\t var stitchedArcs = {},\n\t fragmentByStart = {},\n\t fragmentByEnd = {},\n\t fragments = [],\n\t emptyIndex = -1;\n\t\n\t // Stitch empty arcs first, since they may be subsumed by other arcs.\n\t arcs.forEach(function(i, j) {\n\t var arc = topology.arcs[i < 0 ? ~i : i], t;\n\t if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {\n\t t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;\n\t }\n\t });\n\t\n\t arcs.forEach(function(i) {\n\t var e = ends(i),\n\t start = e[0],\n\t end = e[1],\n\t f, g;\n\t\n\t if (f = fragmentByEnd[start]) {\n\t delete fragmentByEnd[f.end];\n\t f.push(i);\n\t f.end = end;\n\t if (g = fragmentByStart[end]) {\n\t delete fragmentByStart[g.start];\n\t var fg = g === f ? f : f.concat(g);\n\t fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;\n\t } else {\n\t fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n\t }\n\t } else if (f = fragmentByStart[end]) {\n\t delete fragmentByStart[f.start];\n\t f.unshift(i);\n\t f.start = start;\n\t if (g = fragmentByEnd[start]) {\n\t delete fragmentByEnd[g.end];\n\t var gf = g === f ? f : g.concat(f);\n\t fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;\n\t } else {\n\t fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n\t }\n\t } else {\n\t f = [i];\n\t fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;\n\t }\n\t });\n\t\n\t function ends(i) {\n\t var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;\n\t if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; });\n\t else p1 = arc[arc.length - 1];\n\t return i < 0 ? [p1, p0] : [p0, p1];\n\t }\n\t\n\t function flush(fragmentByEnd, fragmentByStart) {\n\t for (var k in fragmentByEnd) {\n\t var f = fragmentByEnd[k];\n\t delete fragmentByStart[f.start];\n\t delete f.start;\n\t delete f.end;\n\t f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });\n\t fragments.push(f);\n\t }\n\t }\n\t\n\t flush(fragmentByEnd, fragmentByStart);\n\t flush(fragmentByStart, fragmentByEnd);\n\t arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });\n\t\n\t return fragments;\n\t }\n\t\n\t function mesh(topology) {\n\t return object(topology, meshArcs.apply(this, arguments));\n\t }\n\t\n\t function meshArcs(topology, o, filter) {\n\t var arcs = [];\n\t\n\t function arc(i) {\n\t var j = i < 0 ? ~i : i;\n\t (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom});\n\t }\n\t\n\t function line(arcs) {\n\t arcs.forEach(arc);\n\t }\n\t\n\t function polygon(arcs) {\n\t arcs.forEach(line);\n\t }\n\t\n\t function geometry(o) {\n\t if (o.type === \"GeometryCollection\") o.geometries.forEach(geometry);\n\t else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs);\n\t }\n\t\n\t if (arguments.length > 1) {\n\t var geomsByArc = [],\n\t geom;\n\t\n\t var geometryType = {\n\t LineString: line,\n\t MultiLineString: polygon,\n\t Polygon: polygon,\n\t MultiPolygon: function(arcs) { arcs.forEach(polygon); }\n\t };\n\t\n\t geometry(o);\n\t\n\t geomsByArc.forEach(arguments.length < 3\n\t ? function(geoms) { arcs.push(geoms[0].i); }\n\t : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });\n\t } else {\n\t for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i);\n\t }\n\t\n\t return {type: \"MultiLineString\", arcs: stitchArcs(topology, arcs)};\n\t }\n\t\n\t function triangle(triangle) {\n\t var a = triangle[0], b = triangle[1], c = triangle[2];\n\t return Math.abs((a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]));\n\t }\n\t\n\t function ring(ring) {\n\t var i = -1,\n\t n = ring.length,\n\t a,\n\t b = ring[n - 1],\n\t area = 0;\n\t\n\t while (++i < n) {\n\t a = b;\n\t b = ring[i];\n\t area += a[0] * b[1] - a[1] * b[0];\n\t }\n\t\n\t return area / 2;\n\t }\n\t\n\t function merge(topology) {\n\t return object(topology, mergeArcs.apply(this, arguments));\n\t }\n\t\n\t function mergeArcs(topology, objects) {\n\t var polygonsByArc = {},\n\t polygons = [],\n\t components = [];\n\t\n\t objects.forEach(function(o) {\n\t if (o.type === \"Polygon\") register(o.arcs);\n\t else if (o.type === \"MultiPolygon\") o.arcs.forEach(register);\n\t });\n\t\n\t function register(polygon) {\n\t polygon.forEach(function(ring$$) {\n\t ring$$.forEach(function(arc) {\n\t (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);\n\t });\n\t });\n\t polygons.push(polygon);\n\t }\n\t\n\t function exterior(ring$$) {\n\t return ring(object(topology, {type: \"Polygon\", arcs: [ring$$]}).coordinates[0]) > 0; // TODO allow spherical?\n\t }\n\t\n\t polygons.forEach(function(polygon) {\n\t if (!polygon._) {\n\t var component = [],\n\t neighbors = [polygon];\n\t polygon._ = 1;\n\t components.push(component);\n\t while (polygon = neighbors.pop()) {\n\t component.push(polygon);\n\t polygon.forEach(function(ring$$) {\n\t ring$$.forEach(function(arc) {\n\t polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) {\n\t if (!polygon._) {\n\t polygon._ = 1;\n\t neighbors.push(polygon);\n\t }\n\t });\n\t });\n\t });\n\t }\n\t }\n\t });\n\t\n\t polygons.forEach(function(polygon) {\n\t delete polygon._;\n\t });\n\t\n\t return {\n\t type: \"MultiPolygon\",\n\t arcs: components.map(function(polygons) {\n\t var arcs = [], n;\n\t\n\t // Extract the exterior (unique) arcs.\n\t polygons.forEach(function(polygon) {\n\t polygon.forEach(function(ring$$) {\n\t ring$$.forEach(function(arc) {\n\t if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {\n\t arcs.push(arc);\n\t }\n\t });\n\t });\n\t });\n\t\n\t // Stitch the arcs into one or more rings.\n\t arcs = stitchArcs(topology, arcs);\n\t\n\t // If more than one ring is returned,\n\t // at most one of these rings can be the exterior;\n\t // this exterior ring has the same winding order\n\t // as any exterior ring in the original polygons.\n\t if ((n = arcs.length) > 1) {\n\t var sgn = exterior(polygons[0][0]);\n\t for (var i = 0, t; i < n; ++i) {\n\t if (sgn === exterior(arcs[i])) {\n\t t = arcs[0], arcs[0] = arcs[i], arcs[i] = t;\n\t break;\n\t }\n\t }\n\t }\n\t\n\t return arcs;\n\t })\n\t };\n\t }\n\t\n\t function neighbors(objects) {\n\t var indexesByArc = {}, // arc index -> array of object indexes\n\t neighbors = objects.map(function() { return []; });\n\t\n\t function line(arcs, i) {\n\t arcs.forEach(function(a) {\n\t if (a < 0) a = ~a;\n\t var o = indexesByArc[a];\n\t if (o) o.push(i);\n\t else indexesByArc[a] = [i];\n\t });\n\t }\n\t\n\t function polygon(arcs, i) {\n\t arcs.forEach(function(arc) { line(arc, i); });\n\t }\n\t\n\t function geometry(o, i) {\n\t if (o.type === \"GeometryCollection\") o.geometries.forEach(function(o) { geometry(o, i); });\n\t else if (o.type in geometryType) geometryType[o.type](o.arcs, i);\n\t }\n\t\n\t var geometryType = {\n\t LineString: line,\n\t MultiLineString: polygon,\n\t Polygon: polygon,\n\t MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); }\n\t };\n\t\n\t objects.forEach(geometry);\n\t\n\t for (var i in indexesByArc) {\n\t for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) {\n\t for (var k = j + 1; k < m; ++k) {\n\t var ij = indexes[j], ik = indexes[k], n;\n\t if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik);\n\t if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij);\n\t }\n\t }\n\t }\n\t\n\t return neighbors;\n\t }\n\t\n\t function compareArea(a, b) {\n\t return a[1][2] - b[1][2];\n\t }\n\t\n\t function minAreaHeap() {\n\t var heap = {},\n\t array = [],\n\t size = 0;\n\t\n\t heap.push = function(object) {\n\t up(array[object._ = size] = object, size++);\n\t return size;\n\t };\n\t\n\t heap.pop = function() {\n\t if (size <= 0) return;\n\t var removed = array[0], object;\n\t if (--size > 0) object = array[size], down(array[object._ = 0] = object, 0);\n\t return removed;\n\t };\n\t\n\t heap.remove = function(removed) {\n\t var i = removed._, object;\n\t if (array[i] !== removed) return; // invalid request\n\t if (i !== --size) object = array[size], (compareArea(object, removed) < 0 ? up : down)(array[object._ = i] = object, i);\n\t return i;\n\t };\n\t\n\t function up(object, i) {\n\t while (i > 0) {\n\t var j = ((i + 1) >> 1) - 1,\n\t parent = array[j];\n\t if (compareArea(object, parent) >= 0) break;\n\t array[parent._ = i] = parent;\n\t array[object._ = i = j] = object;\n\t }\n\t }\n\t\n\t function down(object, i) {\n\t while (true) {\n\t var r = (i + 1) << 1,\n\t l = r - 1,\n\t j = i,\n\t child = array[j];\n\t if (l < size && compareArea(array[l], child) < 0) child = array[j = l];\n\t if (r < size && compareArea(array[r], child) < 0) child = array[j = r];\n\t if (j === i) break;\n\t array[child._ = i] = child;\n\t array[object._ = i = j] = object;\n\t }\n\t }\n\t\n\t return heap;\n\t }\n\t\n\t function presimplify(topology, triangleArea) {\n\t var absolute$$ = absolute(topology.transform),\n\t relative$$ = relative(topology.transform),\n\t heap = minAreaHeap();\n\t\n\t if (!triangleArea) triangleArea = triangle;\n\t\n\t topology.arcs.forEach(function(arc) {\n\t var triangles = [],\n\t maxArea = 0,\n\t triangle,\n\t i,\n\t n,\n\t p;\n\t\n\t // To store each point’s effective area, we create a new array rather than\n\t // extending the passed-in point to workaround a Chrome/V8 bug (getting\n\t // stuck in smi mode). For midpoints, the initial effective area of\n\t // Infinity will be computed in the next step.\n\t for (i = 0, n = arc.length; i < n; ++i) {\n\t p = arc[i];\n\t absolute$$(arc[i] = [p[0], p[1], Infinity], i);\n\t }\n\t\n\t for (i = 1, n = arc.length - 1; i < n; ++i) {\n\t triangle = arc.slice(i - 1, i + 2);\n\t triangle[1][2] = triangleArea(triangle);\n\t triangles.push(triangle);\n\t heap.push(triangle);\n\t }\n\t\n\t for (i = 0, n = triangles.length; i < n; ++i) {\n\t triangle = triangles[i];\n\t triangle.previous = triangles[i - 1];\n\t triangle.next = triangles[i + 1];\n\t }\n\t\n\t while (triangle = heap.pop()) {\n\t var previous = triangle.previous,\n\t next = triangle.next;\n\t\n\t // If the area of the current point is less than that of the previous point\n\t // to be eliminated, use the latter's area instead. This ensures that the\n\t // current point cannot be eliminated without eliminating previously-\n\t // eliminated points.\n\t if (triangle[1][2] < maxArea) triangle[1][2] = maxArea;\n\t else maxArea = triangle[1][2];\n\t\n\t if (previous) {\n\t previous.next = next;\n\t previous[2] = triangle[2];\n\t update(previous);\n\t }\n\t\n\t if (next) {\n\t next.previous = previous;\n\t next[0] = triangle[0];\n\t update(next);\n\t }\n\t }\n\t\n\t arc.forEach(relative$$);\n\t });\n\t\n\t function update(triangle) {\n\t heap.remove(triangle);\n\t triangle[1][2] = triangleArea(triangle);\n\t heap.push(triangle);\n\t }\n\t\n\t return topology;\n\t }\n\t\n\t var version = \"1.6.24\";\n\t\n\t exports.version = version;\n\t exports.mesh = mesh;\n\t exports.meshArcs = meshArcs;\n\t exports.merge = merge;\n\t exports.mergeArcs = mergeArcs;\n\t exports.feature = feature;\n\t exports.neighbors = neighbors;\n\t exports.presimplify = presimplify;\n\t\n\t}));\n\n/***/ },\n/* 78 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar normalize = __webpack_require__(79);\n\t\n\tmodule.exports = function(inputs) {\n\t return {\n\t type: 'FeatureCollection',\n\t features: inputs.reduce(function(memo, input) {\n\t return memo.concat(normalize(input).features);\n\t }, [])\n\t };\n\t};\n\n\n/***/ },\n/* 79 */\n/***/ function(module, exports) {\n\n\tmodule.exports = normalize;\n\t\n\tvar types = {\n\t Point: 'geometry',\n\t MultiPoint: 'geometry',\n\t LineString: 'geometry',\n\t MultiLineString: 'geometry',\n\t Polygon: 'geometry',\n\t MultiPolygon: 'geometry',\n\t GeometryCollection: 'geometry',\n\t Feature: 'feature',\n\t FeatureCollection: 'featurecollection'\n\t};\n\t\n\t/**\n\t * Normalize a GeoJSON feature into a FeatureCollection.\n\t *\n\t * @param {object} gj geojson data\n\t * @returns {object} normalized geojson data\n\t */\n\tfunction normalize(gj) {\n\t if (!gj || !gj.type) return null;\n\t var type = types[gj.type];\n\t if (!type) return null;\n\t\n\t if (type === 'geometry') {\n\t return {\n\t type: 'FeatureCollection',\n\t features: [{\n\t type: 'Feature',\n\t properties: {},\n\t geometry: gj\n\t }]\n\t };\n\t } else if (type === 'feature') {\n\t return {\n\t type: 'FeatureCollection',\n\t features: [gj]\n\t };\n\t } else if (type === 'featurecollection') {\n\t return gj;\n\t }\n\t}\n\n\n/***/ },\n/* 80 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tmodule.exports = earcut;\n\t\n\tfunction earcut(data, holeIndices, dim) {\n\t\n\t dim = dim || 2;\n\t\n\t var hasHoles = holeIndices && holeIndices.length,\n\t outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n\t outerNode = linkedList(data, 0, outerLen, dim, true),\n\t triangles = [];\n\t\n\t if (!outerNode) return triangles;\n\t\n\t var minX, minY, maxX, maxY, x, y, size;\n\t\n\t if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\t\n\t // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n\t if (data.length > 80 * dim) {\n\t minX = maxX = data[0];\n\t minY = maxY = data[1];\n\t\n\t for (var i = dim; i < outerLen; i += dim) {\n\t x = data[i];\n\t y = data[i + 1];\n\t if (x < minX) minX = x;\n\t if (y < minY) minY = y;\n\t if (x > maxX) maxX = x;\n\t if (y > maxY) maxY = y;\n\t }\n\t\n\t // minX, minY and size are later used to transform coords into integers for z-order calculation\n\t size = Math.max(maxX - minX, maxY - minY);\n\t }\n\t\n\t earcutLinked(outerNode, triangles, dim, minX, minY, size);\n\t\n\t return triangles;\n\t}\n\t\n\t// create a circular doubly linked list from polygon points in the specified winding order\n\tfunction linkedList(data, start, end, dim, clockwise) {\n\t var sum = 0,\n\t i, j, last;\n\t\n\t // calculate original winding order of a polygon ring\n\t for (i = start, j = end - dim; i < end; i += dim) {\n\t sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n\t j = i;\n\t }\n\t\n\t // link points into circular doubly-linked list in the specified winding order\n\t if (clockwise === (sum > 0)) {\n\t for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n\t } else {\n\t for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n\t }\n\t\n\t return last;\n\t}\n\t\n\t// eliminate colinear or duplicate points\n\tfunction filterPoints(start, end) {\n\t if (!start) return start;\n\t if (!end) end = start;\n\t\n\t var p = start,\n\t again;\n\t do {\n\t again = false;\n\t\n\t if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n\t removeNode(p);\n\t p = end = p.prev;\n\t if (p === p.next) return null;\n\t again = true;\n\t\n\t } else {\n\t p = p.next;\n\t }\n\t } while (again || p !== end);\n\t\n\t return end;\n\t}\n\t\n\t// main ear slicing loop which triangulates a polygon (given as a linked list)\n\tfunction earcutLinked(ear, triangles, dim, minX, minY, size, pass) {\n\t if (!ear) return;\n\t\n\t // interlink polygon nodes in z-order\n\t if (!pass && size) indexCurve(ear, minX, minY, size);\n\t\n\t var stop = ear,\n\t prev, next;\n\t\n\t // iterate through ears, slicing them one by one\n\t while (ear.prev !== ear.next) {\n\t prev = ear.prev;\n\t next = ear.next;\n\t\n\t if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {\n\t // cut off the triangle\n\t triangles.push(prev.i / dim);\n\t triangles.push(ear.i / dim);\n\t triangles.push(next.i / dim);\n\t\n\t removeNode(ear);\n\t\n\t // skipping the next vertice leads to less sliver triangles\n\t ear = next.next;\n\t stop = next.next;\n\t\n\t continue;\n\t }\n\t\n\t ear = next;\n\t\n\t // if we looped through the whole remaining polygon and can't find any more ears\n\t if (ear === stop) {\n\t // try filtering points and slicing again\n\t if (!pass) {\n\t earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1);\n\t\n\t // if this didn't work, try curing all small self-intersections locally\n\t } else if (pass === 1) {\n\t ear = cureLocalIntersections(ear, triangles, dim);\n\t earcutLinked(ear, triangles, dim, minX, minY, size, 2);\n\t\n\t // as a last resort, try splitting the remaining polygon into two\n\t } else if (pass === 2) {\n\t splitEarcut(ear, triangles, dim, minX, minY, size);\n\t }\n\t\n\t break;\n\t }\n\t }\n\t}\n\t\n\t// check whether a polygon node forms a valid ear with adjacent nodes\n\tfunction isEar(ear) {\n\t var a = ear.prev,\n\t b = ear,\n\t c = ear.next;\n\t\n\t if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\t\n\t // now make sure we don't have other points inside the potential ear\n\t var p = ear.next.next;\n\t\n\t while (p !== ear.prev) {\n\t if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n\t area(p.prev, p, p.next) >= 0) return false;\n\t p = p.next;\n\t }\n\t\n\t return true;\n\t}\n\t\n\tfunction isEarHashed(ear, minX, minY, size) {\n\t var a = ear.prev,\n\t b = ear,\n\t c = ear.next;\n\t\n\t if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\t\n\t // triangle bbox; min & max are calculated like this for speed\n\t var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n\t minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n\t maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n\t maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\t\n\t // z-order range for the current triangle bbox;\n\t var minZ = zOrder(minTX, minTY, minX, minY, size),\n\t maxZ = zOrder(maxTX, maxTY, minX, minY, size);\n\t\n\t // first look for points inside the triangle in increasing z-order\n\t var p = ear.nextZ;\n\t\n\t while (p && p.z <= maxZ) {\n\t if (p !== ear.prev && p !== ear.next &&\n\t pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n\t area(p.prev, p, p.next) >= 0) return false;\n\t p = p.nextZ;\n\t }\n\t\n\t // then look for points in decreasing z-order\n\t p = ear.prevZ;\n\t\n\t while (p && p.z >= minZ) {\n\t if (p !== ear.prev && p !== ear.next &&\n\t pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n\t area(p.prev, p, p.next) >= 0) return false;\n\t p = p.prevZ;\n\t }\n\t\n\t return true;\n\t}\n\t\n\t// go through all polygon nodes and cure small local self-intersections\n\tfunction cureLocalIntersections(start, triangles, dim) {\n\t var p = start;\n\t do {\n\t var a = p.prev,\n\t b = p.next.next;\n\t\n\t // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])\n\t if (intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\t\n\t triangles.push(a.i / dim);\n\t triangles.push(p.i / dim);\n\t triangles.push(b.i / dim);\n\t\n\t // remove two nodes involved\n\t removeNode(p);\n\t removeNode(p.next);\n\t\n\t p = start = b;\n\t }\n\t p = p.next;\n\t } while (p !== start);\n\t\n\t return p;\n\t}\n\t\n\t// try splitting polygon into two and triangulate them independently\n\tfunction splitEarcut(start, triangles, dim, minX, minY, size) {\n\t // look for a valid diagonal that divides the polygon into two\n\t var a = start;\n\t do {\n\t var b = a.next.next;\n\t while (b !== a.prev) {\n\t if (a.i !== b.i && isValidDiagonal(a, b)) {\n\t // split the polygon in two by the diagonal\n\t var c = splitPolygon(a, b);\n\t\n\t // filter colinear points around the cuts\n\t a = filterPoints(a, a.next);\n\t c = filterPoints(c, c.next);\n\t\n\t // run earcut on each half\n\t earcutLinked(a, triangles, dim, minX, minY, size);\n\t earcutLinked(c, triangles, dim, minX, minY, size);\n\t return;\n\t }\n\t b = b.next;\n\t }\n\t a = a.next;\n\t } while (a !== start);\n\t}\n\t\n\t// link every hole into the outer loop, producing a single-ring polygon without holes\n\tfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n\t var queue = [],\n\t i, len, start, end, list;\n\t\n\t for (i = 0, len = holeIndices.length; i < len; i++) {\n\t start = holeIndices[i] * dim;\n\t end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n\t list = linkedList(data, start, end, dim, false);\n\t if (list === list.next) list.steiner = true;\n\t queue.push(getLeftmost(list));\n\t }\n\t\n\t queue.sort(compareX);\n\t\n\t // process holes from left to right\n\t for (i = 0; i < queue.length; i++) {\n\t eliminateHole(queue[i], outerNode);\n\t outerNode = filterPoints(outerNode, outerNode.next);\n\t }\n\t\n\t return outerNode;\n\t}\n\t\n\tfunction compareX(a, b) {\n\t return a.x - b.x;\n\t}\n\t\n\t// find a bridge between vertices that connects hole with an outer ring and and link it\n\tfunction eliminateHole(hole, outerNode) {\n\t outerNode = findHoleBridge(hole, outerNode);\n\t if (outerNode) {\n\t var b = splitPolygon(outerNode, hole);\n\t filterPoints(b, b.next);\n\t }\n\t}\n\t\n\t// David Eberly's algorithm for finding a bridge between hole and outer polygon\n\tfunction findHoleBridge(hole, outerNode) {\n\t var p = outerNode,\n\t hx = hole.x,\n\t hy = hole.y,\n\t qx = -Infinity,\n\t m;\n\t\n\t // find a segment intersected by a ray from the hole's leftmost point to the left;\n\t // segment's endpoint with lesser x will be potential connection point\n\t do {\n\t if (hy <= p.y && hy >= p.next.y) {\n\t var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n\t if (x <= hx && x > qx) {\n\t qx = x;\n\t m = p.x < p.next.x ? p : p.next;\n\t }\n\t }\n\t p = p.next;\n\t } while (p !== outerNode);\n\t\n\t if (!m) return null;\n\t\n\t if (hole.x === m.x) return m.prev; // hole touches outer segment; pick lower endpoint\n\t\n\t // look for points inside the triangle of hole point, segment intersection and endpoint;\n\t // if there are no points found, we have a valid connection;\n\t // otherwise choose the point of the minimum angle with the ray as connection point\n\t\n\t var stop = m,\n\t tanMin = Infinity,\n\t tan;\n\t\n\t p = m.next;\n\t\n\t while (p !== stop) {\n\t if (hx >= p.x && p.x >= m.x &&\n\t pointInTriangle(hy < m.y ? hx : qx, hy, m.x, m.y, hy < m.y ? qx : hx, hy, p.x, p.y)) {\n\t\n\t tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\t\n\t if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n\t m = p;\n\t tanMin = tan;\n\t }\n\t }\n\t\n\t p = p.next;\n\t }\n\t\n\t return m;\n\t}\n\t\n\t// interlink polygon nodes in z-order\n\tfunction indexCurve(start, minX, minY, size) {\n\t var p = start;\n\t do {\n\t if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);\n\t p.prevZ = p.prev;\n\t p.nextZ = p.next;\n\t p = p.next;\n\t } while (p !== start);\n\t\n\t p.prevZ.nextZ = null;\n\t p.prevZ = null;\n\t\n\t sortLinked(p);\n\t}\n\t\n\t// Simon Tatham's linked list merge sort algorithm\n\t// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\n\tfunction sortLinked(list) {\n\t var i, p, q, e, tail, numMerges, pSize, qSize,\n\t inSize = 1;\n\t\n\t do {\n\t p = list;\n\t list = null;\n\t tail = null;\n\t numMerges = 0;\n\t\n\t while (p) {\n\t numMerges++;\n\t q = p;\n\t pSize = 0;\n\t for (i = 0; i < inSize; i++) {\n\t pSize++;\n\t q = q.nextZ;\n\t if (!q) break;\n\t }\n\t\n\t qSize = inSize;\n\t\n\t while (pSize > 0 || (qSize > 0 && q)) {\n\t\n\t if (pSize === 0) {\n\t e = q;\n\t q = q.nextZ;\n\t qSize--;\n\t } else if (qSize === 0 || !q) {\n\t e = p;\n\t p = p.nextZ;\n\t pSize--;\n\t } else if (p.z <= q.z) {\n\t e = p;\n\t p = p.nextZ;\n\t pSize--;\n\t } else {\n\t e = q;\n\t q = q.nextZ;\n\t qSize--;\n\t }\n\t\n\t if (tail) tail.nextZ = e;\n\t else list = e;\n\t\n\t e.prevZ = tail;\n\t tail = e;\n\t }\n\t\n\t p = q;\n\t }\n\t\n\t tail.nextZ = null;\n\t inSize *= 2;\n\t\n\t } while (numMerges > 1);\n\t\n\t return list;\n\t}\n\t\n\t// z-order of a point given coords and size of the data bounding box\n\tfunction zOrder(x, y, minX, minY, size) {\n\t // coords are transformed into non-negative 15-bit integer range\n\t x = 32767 * (x - minX) / size;\n\t y = 32767 * (y - minY) / size;\n\t\n\t x = (x | (x << 8)) & 0x00FF00FF;\n\t x = (x | (x << 4)) & 0x0F0F0F0F;\n\t x = (x | (x << 2)) & 0x33333333;\n\t x = (x | (x << 1)) & 0x55555555;\n\t\n\t y = (y | (y << 8)) & 0x00FF00FF;\n\t y = (y | (y << 4)) & 0x0F0F0F0F;\n\t y = (y | (y << 2)) & 0x33333333;\n\t y = (y | (y << 1)) & 0x55555555;\n\t\n\t return x | (y << 1);\n\t}\n\t\n\t// find the leftmost node of a polygon ring\n\tfunction getLeftmost(start) {\n\t var p = start,\n\t leftmost = start;\n\t do {\n\t if (p.x < leftmost.x) leftmost = p;\n\t p = p.next;\n\t } while (p !== start);\n\t\n\t return leftmost;\n\t}\n\t\n\t// check if a point lies within a convex triangle\n\tfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n\t return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n\t (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n\t (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n\t}\n\t\n\t// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\n\tfunction isValidDiagonal(a, b) {\n\t return equals(a, b) || a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n\t locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n\t}\n\t\n\t// signed area of a triangle\n\tfunction area(p, q, r) {\n\t return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n\t}\n\t\n\t// check if two points are equal\n\tfunction equals(p1, p2) {\n\t return p1.x === p2.x && p1.y === p2.y;\n\t}\n\t\n\t// check if two segments intersect\n\tfunction intersects(p1, q1, p2, q2) {\n\t return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n\t area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n\t}\n\t\n\t// check if a polygon diagonal intersects any polygon segments\n\tfunction intersectsPolygon(a, b) {\n\t var p = a;\n\t do {\n\t if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n\t intersects(p, p.next, a, b)) return true;\n\t p = p.next;\n\t } while (p !== a);\n\t\n\t return false;\n\t}\n\t\n\t// check if a polygon diagonal is locally inside the polygon\n\tfunction locallyInside(a, b) {\n\t return area(a.prev, a, a.next) < 0 ?\n\t area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n\t area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n\t}\n\t\n\t// check if the middle point of a polygon diagonal is inside the polygon\n\tfunction middleInside(a, b) {\n\t var p = a,\n\t inside = false,\n\t px = (a.x + b.x) / 2,\n\t py = (a.y + b.y) / 2;\n\t do {\n\t if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n\t inside = !inside;\n\t p = p.next;\n\t } while (p !== a);\n\t\n\t return inside;\n\t}\n\t\n\t// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n\t// if one belongs to the outer ring and another to a hole, it merges it into a single ring\n\tfunction splitPolygon(a, b) {\n\t var a2 = new Node(a.i, a.x, a.y),\n\t b2 = new Node(b.i, b.x, b.y),\n\t an = a.next,\n\t bp = b.prev;\n\t\n\t a.next = b;\n\t b.prev = a;\n\t\n\t a2.next = an;\n\t an.prev = a2;\n\t\n\t b2.next = a2;\n\t a2.prev = b2;\n\t\n\t bp.next = b2;\n\t b2.prev = bp;\n\t\n\t return b2;\n\t}\n\t\n\t// create a node and optionally link it with previous one (in a circular doubly linked list)\n\tfunction insertNode(i, x, y, last) {\n\t var p = new Node(i, x, y);\n\t\n\t if (!last) {\n\t p.prev = p;\n\t p.next = p;\n\t\n\t } else {\n\t p.next = last.next;\n\t p.prev = last;\n\t last.next.prev = p;\n\t last.next = p;\n\t }\n\t return p;\n\t}\n\t\n\tfunction removeNode(p) {\n\t p.next.prev = p.prev;\n\t p.prev.next = p.next;\n\t\n\t if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n\t if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n\t}\n\t\n\tfunction Node(i, x, y) {\n\t // vertice index in coordinates array\n\t this.i = i;\n\t\n\t // vertex coordinates\n\t this.x = x;\n\t this.y = y;\n\t\n\t // previous and next vertice nodes in a polygon ring\n\t this.prev = null;\n\t this.next = null;\n\t\n\t // z-order curve value\n\t this.z = null;\n\t\n\t // previous and next nodes in z-order\n\t this.prevZ = null;\n\t this.nextZ = null;\n\t\n\t // indicates whether this is a steiner point\n\t this.steiner = false;\n\t}\n\n\n/***/ },\n/* 81 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * Extrude a polygon given its vertices and triangulated faces\n\t *\n\t * Based on:\n\t * https://github.com/freeman-lab/extrude\n\t */\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar extrudePolygon = function extrudePolygon(points, faces, _options) {\n\t var defaults = {\n\t top: 1,\n\t bottom: 0,\n\t closed: true\n\t };\n\t\n\t var options = (0, _lodashAssign2['default'])({}, defaults, _options);\n\t\n\t var n = points.length;\n\t var positions;\n\t var cells;\n\t var topCells;\n\t var bottomCells;\n\t var sideCells;\n\t\n\t // If bottom and top values are identical then return the flat shape\n\t options.top === options.bottom ? flat() : full();\n\t\n\t function flat() {\n\t positions = points.map(function (p) {\n\t return [p[0], options.top, p[1]];\n\t });\n\t cells = faces;\n\t topCells = faces;\n\t }\n\t\n\t function full() {\n\t positions = [];\n\t points.forEach(function (p) {\n\t positions.push([p[0], options.top, p[1]]);\n\t });\n\t points.forEach(function (p) {\n\t positions.push([p[0], options.bottom, p[1]]);\n\t });\n\t\n\t cells = [];\n\t for (var i = 0; i < n; i++) {\n\t if (i === n - 1) {\n\t cells.push([i + n, n, i]);\n\t cells.push([0, i, n]);\n\t } else {\n\t cells.push([i + n, i + n + 1, i]);\n\t cells.push([i + 1, i, i + n + 1]);\n\t }\n\t }\n\t\n\t sideCells = [].concat(cells);\n\t\n\t if (options.closed) {\n\t var top = faces;\n\t var bottom = top.map(function (p) {\n\t return p.map(function (v) {\n\t return v + n;\n\t });\n\t });\n\t bottom = bottom.map(function (p) {\n\t return [p[0], p[2], p[1]];\n\t });\n\t cells = cells.concat(top).concat(bottom);\n\t\n\t topCells = top;\n\t bottomCells = bottom;\n\t }\n\t }\n\t\n\t return {\n\t positions: positions,\n\t faces: cells,\n\t top: topCells,\n\t bottom: bottomCells,\n\t sides: sideCells\n\t };\n\t};\n\t\n\texports['default'] = extrudePolygon;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 82 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t/*\n\t * BufferGeometry helpers\n\t */\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar Buffer = (function () {\n\t // Merge multiple attribute objects into a single attribute object\n\t //\n\t // Attribute objects must all use the same attribute keys\n\t var mergeAttributes = function mergeAttributes(attributes) {\n\t var lengths = {};\n\t\n\t // Find array lengths\n\t attributes.forEach(function (_attributes) {\n\t for (var k in _attributes) {\n\t if (!lengths[k]) {\n\t lengths[k] = 0;\n\t }\n\t\n\t lengths[k] += _attributes[k].length;\n\t }\n\t });\n\t\n\t var mergedAttributes = {};\n\t\n\t // Set up arrays to merge into\n\t for (var k in lengths) {\n\t mergedAttributes[k] = new Float32Array(lengths[k]);\n\t }\n\t\n\t var lastLengths = {};\n\t\n\t attributes.forEach(function (_attributes) {\n\t for (var k in _attributes) {\n\t if (!lastLengths[k]) {\n\t lastLengths[k] = 0;\n\t }\n\t\n\t mergedAttributes[k].set(_attributes[k], lastLengths[k]);\n\t\n\t lastLengths[k] += _attributes[k].length;\n\t }\n\t });\n\t\n\t return mergedAttributes;\n\t };\n\t\n\t var createLineGeometry = function createLineGeometry(lines, offset) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t var vertices = new Float32Array(lines.verticesCount * 3);\n\t var colours = new Float32Array(lines.verticesCount * 3);\n\t\n\t var pickingIds;\n\t if (lines.pickingIds) {\n\t // One component per vertex (1)\n\t pickingIds = new Float32Array(lines.verticesCount);\n\t }\n\t\n\t var _vertices;\n\t var _colour;\n\t var _pickingId;\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < lines.vertices.length; i++) {\n\t _vertices = lines.vertices[i];\n\t _colour = lines.colours[i];\n\t\n\t if (pickingIds) {\n\t _pickingId = lines.pickingIds[i];\n\t }\n\t\n\t for (var j = 0; j < _vertices.length; j++) {\n\t var ax = _vertices[j][0] + offset.x;\n\t var ay = _vertices[j][1];\n\t var az = _vertices[j][2] + offset.y;\n\t\n\t var c1 = _colour[j];\n\t\n\t vertices[lastIndex * 3 + 0] = ax;\n\t vertices[lastIndex * 3 + 1] = ay;\n\t vertices[lastIndex * 3 + 2] = az;\n\t\n\t colours[lastIndex * 3 + 0] = c1[0];\n\t colours[lastIndex * 3 + 1] = c1[1];\n\t colours[lastIndex * 3 + 2] = c1[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t }\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(vertices, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(colours, 3));\n\t\n\t if (pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t return geometry;\n\t };\n\t\n\t // TODO: Make picking IDs optional\n\t var createGeometry = function createGeometry(attributes, offset) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // Three components per vertex per face (3 x 3 = 9)\n\t var vertices = new Float32Array(attributes.facesCount * 9);\n\t var normals = new Float32Array(attributes.facesCount * 9);\n\t var colours = new Float32Array(attributes.facesCount * 9);\n\t\n\t var pickingIds;\n\t if (attributes.pickingIds) {\n\t // One component per vertex per face (1 x 3 = 3)\n\t pickingIds = new Float32Array(attributes.facesCount * 3);\n\t }\n\t\n\t var pA = new _three2['default'].Vector3();\n\t var pB = new _three2['default'].Vector3();\n\t var pC = new _three2['default'].Vector3();\n\t\n\t var cb = new _three2['default'].Vector3();\n\t var ab = new _three2['default'].Vector3();\n\t\n\t var index;\n\t var _faces;\n\t var _vertices;\n\t var _colour;\n\t var _pickingId;\n\t var lastIndex = 0;\n\t for (var i = 0; i < attributes.faces.length; i++) {\n\t _faces = attributes.faces[i];\n\t _vertices = attributes.vertices[i];\n\t _colour = attributes.colours[i];\n\t\n\t if (pickingIds) {\n\t _pickingId = attributes.pickingIds[i];\n\t }\n\t\n\t for (var j = 0; j < _faces.length; j++) {\n\t // Array of vertex indexes for the face\n\t index = _faces[j][0];\n\t\n\t var ax = _vertices[index][0] + offset.x;\n\t var ay = _vertices[index][1];\n\t var az = _vertices[index][2] + offset.y;\n\t\n\t var c1 = _colour[j][0];\n\t\n\t index = _faces[j][1];\n\t\n\t var bx = _vertices[index][0] + offset.x;\n\t var by = _vertices[index][1];\n\t var bz = _vertices[index][2] + offset.y;\n\t\n\t var c2 = _colour[j][1];\n\t\n\t index = _faces[j][2];\n\t\n\t var cx = _vertices[index][0] + offset.x;\n\t var cy = _vertices[index][1];\n\t var cz = _vertices[index][2] + offset.y;\n\t\n\t var c3 = _colour[j][2];\n\t\n\t // Flat face normals\n\t // From: http://threejs.org/examples/webgl_buffergeometry.html\n\t pA.set(ax, ay, az);\n\t pB.set(bx, by, bz);\n\t pC.set(cx, cy, cz);\n\t\n\t cb.subVectors(pC, pB);\n\t ab.subVectors(pA, pB);\n\t cb.cross(ab);\n\t\n\t cb.normalize();\n\t\n\t var nx = cb.x;\n\t var ny = cb.y;\n\t var nz = cb.z;\n\t\n\t vertices[lastIndex * 9 + 0] = ax;\n\t vertices[lastIndex * 9 + 1] = ay;\n\t vertices[lastIndex * 9 + 2] = az;\n\t\n\t normals[lastIndex * 9 + 0] = nx;\n\t normals[lastIndex * 9 + 1] = ny;\n\t normals[lastIndex * 9 + 2] = nz;\n\t\n\t colours[lastIndex * 9 + 0] = c1[0];\n\t colours[lastIndex * 9 + 1] = c1[1];\n\t colours[lastIndex * 9 + 2] = c1[2];\n\t\n\t vertices[lastIndex * 9 + 3] = bx;\n\t vertices[lastIndex * 9 + 4] = by;\n\t vertices[lastIndex * 9 + 5] = bz;\n\t\n\t normals[lastIndex * 9 + 3] = nx;\n\t normals[lastIndex * 9 + 4] = ny;\n\t normals[lastIndex * 9 + 5] = nz;\n\t\n\t colours[lastIndex * 9 + 3] = c2[0];\n\t colours[lastIndex * 9 + 4] = c2[1];\n\t colours[lastIndex * 9 + 5] = c2[2];\n\t\n\t vertices[lastIndex * 9 + 6] = cx;\n\t vertices[lastIndex * 9 + 7] = cy;\n\t vertices[lastIndex * 9 + 8] = cz;\n\t\n\t normals[lastIndex * 9 + 6] = nx;\n\t normals[lastIndex * 9 + 7] = ny;\n\t normals[lastIndex * 9 + 8] = nz;\n\t\n\t colours[lastIndex * 9 + 6] = c3[0];\n\t colours[lastIndex * 9 + 7] = c3[1];\n\t colours[lastIndex * 9 + 8] = c3[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex * 3 + 0] = _pickingId;\n\t pickingIds[lastIndex * 3 + 1] = _pickingId;\n\t pickingIds[lastIndex * 3 + 2] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t }\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(vertices, 3));\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(normals, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(colours, 3));\n\t\n\t if (pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t return geometry;\n\t };\n\t\n\t return {\n\t mergeAttributes: mergeAttributes,\n\t createLineGeometry: createLineGeometry,\n\t createGeometry: createGeometry\n\t };\n\t})();\n\t\n\texports['default'] = Buffer;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 83 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _PickingShader = __webpack_require__(84);\n\t\n\tvar _PickingShader2 = _interopRequireDefault(_PickingShader);\n\t\n\t// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\t\n\tvar PickingMaterial = function PickingMaterial() {\n\t _three2['default'].ShaderMaterial.call(this, {\n\t uniforms: {\n\t size: {\n\t type: 'f',\n\t value: 0.01\n\t },\n\t scale: {\n\t type: 'f',\n\t value: 400\n\t }\n\t },\n\t // attributes: ['position', 'id'],\n\t vertexShader: _PickingShader2['default'].vertexShader,\n\t fragmentShader: _PickingShader2['default'].fragmentShader\n\t });\n\t\n\t this.linePadding = 2;\n\t};\n\t\n\tPickingMaterial.prototype = Object.create(_three2['default'].ShaderMaterial.prototype);\n\t\n\tPickingMaterial.prototype.constructor = PickingMaterial;\n\t\n\tPickingMaterial.prototype.setPointSize = function (size) {\n\t this.uniforms.size.value = size;\n\t};\n\t\n\tPickingMaterial.prototype.setPointScale = function (scale) {\n\t this.uniforms.scale.value = scale;\n\t};\n\t\n\texports['default'] = PickingMaterial;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 84 */\n/***/ function(module, exports) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t\tvalue: true\n\t});\n\t// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\t\n\tvar PickingShader = {\n\t\tvertexShader: ['attribute float pickingId;',\n\t\t// '',\n\t\t// 'uniform float size;',\n\t\t// 'uniform float scale;',\n\t\t'', 'varying vec4 worldId;', '', 'void main() {', ' vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n\t\t// ' gl_PointSize = size * ( scale / length( mvPosition.xyz ) );',\n\t\t' vec3 a = fract(vec3(1.0/255.0, 1.0/(255.0*255.0), 1.0/(255.0*255.0*255.0)) * pickingId);', ' a -= a.xxy * vec3(0.0, 1.0/255.0, 1.0/255.0);', ' worldId = vec4(a,1);', ' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}'].join('\\n'),\n\t\n\t\tfragmentShader: ['#ifdef GL_ES\\n', 'precision highp float;\\n', '#endif\\n', '', 'varying vec4 worldId;', '', 'void main() {', ' gl_FragColor = worldId;', '}'].join('\\n')\n\t};\n\t\n\texports['default'] = PickingShader;\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 85 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\t\n\t// TODO: Look at ways to drop unneeded references to array buffers, etc to\n\t// reduce memory footprint\n\t\n\t// TODO: Support dynamic updating / hiding / animation of geometry\n\t//\n\t// This could be pretty hard as it's all packed away within BufferGeometry and\n\t// may even be merged by another layer (eg. GeoJSONLayer)\n\t//\n\t// How much control should this layer support? Perhaps a different or custom\n\t// layer would be better suited for animation, for example.\n\t\n\t// TODO: Allow _setBufferAttributes to use a custom function passed in to\n\t// generate a custom mesh\n\t\n\tvar _Layer2 = __webpack_require__(46);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _earcut2 = __webpack_require__(80);\n\t\n\tvar _earcut3 = _interopRequireDefault(_earcut2);\n\t\n\tvar _utilExtrudePolygon = __webpack_require__(81);\n\t\n\tvar _utilExtrudePolygon2 = _interopRequireDefault(_utilExtrudePolygon);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(83);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _utilBuffer = __webpack_require__(82);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar PolygonLayer = (function (_Layer) {\n\t _inherits(PolygonLayer, _Layer);\n\t\n\t function PolygonLayer(coordinates, options) {\n\t _classCallCheck(this, PolygonLayer);\n\t\n\t var defaults = {\n\t output: true,\n\t interactive: false,\n\t // Custom material override\n\t //\n\t // TODO: Should this be in the style object?\n\t material: null,\n\t onMesh: null,\n\t onBufferAttributes: null,\n\t // This default style is separate to Util.GeoJSON.defaultStyle\n\t style: {\n\t color: '#ffffff',\n\t transparent: false,\n\t opacity: 1,\n\t blending: _three2['default'].NormalBlending,\n\t height: 0\n\t }\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(PolygonLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t // Return coordinates as array of polygons so it's easy to support\n\t // MultiPolygon features (a single polygon would be a MultiPolygon with a\n\t // single polygon in the array)\n\t this._coordinates = PolygonLayer.isSingle(coordinates) ? [coordinates] : coordinates;\n\t }\n\t\n\t _createClass(PolygonLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this._setCoordinates();\n\t\n\t if (this._options.interactive) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new _three2['default'].Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t this._setPickingId();\n\t this._addPickingEvents();\n\t }\n\t\n\t // Store geometry representation as instances of THREE.BufferAttribute\n\t this._setBufferAttributes();\n\t\n\t if (this.isOutput()) {\n\t // Set mesh if not merging elsewhere\n\t this._setMesh(this._bufferAttributes);\n\t\n\t // Output mesh\n\t this.add(this._mesh);\n\t }\n\t }\n\t\n\t // Return center of polygon as a LatLon\n\t //\n\t // This is used for things like placing popups / UI elements on the layer\n\t //\n\t // TODO: Find proper center position instead of returning first coordinate\n\t // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polygon.js#L15\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._center;\n\t }\n\t\n\t // Return polygon bounds in geographic coordinates\n\t //\n\t // TODO: Implement getBounds()\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {}\n\t\n\t // Get unique ID for picking interaction\n\t }, {\n\t key: '_setPickingId',\n\t value: function _setPickingId() {\n\t this._pickingId = this.getPickingId();\n\t }\n\t\n\t // Set up and re-emit interaction events\n\t }, {\n\t key: '_addPickingEvents',\n\t value: function _addPickingEvents() {\n\t var _this = this;\n\t\n\t // TODO: Find a way to properly remove this listener on destroy\n\t this._world.on('pick-' + this._pickingId, function (point2d, point3d, intersects) {\n\t // Re-emit click event from the layer\n\t _this.emit('click', _this, point2d, point3d, intersects);\n\t });\n\t }\n\t\n\t // Create and store reference to THREE.BufferAttribute data for this layer\n\t }, {\n\t key: '_setBufferAttributes',\n\t value: function _setBufferAttributes() {\n\t var _this2 = this;\n\t\n\t var attributes;\n\t\n\t // Only use this if you know what you're doing\n\t if (typeof this._options.onBufferAttributes === 'function') {\n\t // TODO: Probably want to pass something less general as arguments,\n\t // though passing the instance will do for now (it's everything)\n\t attributes = this._options.onBufferAttributes(this);\n\t } else {\n\t var height = 0;\n\t\n\t // Convert height into world units\n\t if (this._options.style.height && this._options.style.height !== 0) {\n\t height = this._world.metresToWorld(this._options.style.height, this._pointScale);\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t colour.set(this._options.style.color);\n\t\n\t // Light and dark colours used for poor-mans AO gradient on object sides\n\t var light = new _three2['default'].Color(0xffffff);\n\t var shadow = new _three2['default'].Color(0x666666);\n\t\n\t // For each polygon\n\t attributes = this._projectedCoordinates.map(function (_projectedCoordinates) {\n\t // Convert coordinates to earcut format\n\t var _earcut = _this2._toEarcut(_projectedCoordinates);\n\t\n\t // Triangulate faces using earcut\n\t var faces = _this2._triangulate(_earcut.vertices, _earcut.holes, _earcut.dimensions);\n\t\n\t var groupedVertices = [];\n\t for (i = 0, il = _earcut.vertices.length; i < il; i += _earcut.dimensions) {\n\t groupedVertices.push(_earcut.vertices.slice(i, i + _earcut.dimensions));\n\t }\n\t\n\t var extruded = (0, _utilExtrudePolygon2['default'])(groupedVertices, faces, {\n\t bottom: 0,\n\t top: height\n\t });\n\t\n\t var topColor = colour.clone().multiply(light);\n\t var bottomColor = colour.clone().multiply(shadow);\n\t\n\t var _vertices = extruded.positions;\n\t var _faces = [];\n\t var _colours = [];\n\t\n\t var _colour;\n\t extruded.top.forEach(function (face, fi) {\n\t _colour = [];\n\t\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t _colour.push([colour.r, colour.g, colour.b]);\n\t\n\t _faces.push(face);\n\t _colours.push(_colour);\n\t });\n\t\n\t _this2._flat = true;\n\t\n\t if (extruded.sides) {\n\t _this2._flat = false;\n\t\n\t // Set up colours for every vertex with poor-mans AO on the sides\n\t extruded.sides.forEach(function (face, fi) {\n\t _colour = [];\n\t\n\t // First face is always bottom-bottom-top\n\t if (fi % 2 === 0) {\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t // Reverse winding for the second face\n\t // top-top-bottom\n\t } else {\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t _colour.push([topColor.r, topColor.g, topColor.b]);\n\t _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n\t }\n\t\n\t _faces.push(face);\n\t _colours.push(_colour);\n\t });\n\t }\n\t\n\t // Skip bottom as there's no point rendering it\n\t // allFaces.push(extruded.faces);\n\t\n\t var polygon = {\n\t vertices: _vertices,\n\t faces: _faces,\n\t colours: _colours,\n\t facesCount: _faces.length\n\t };\n\t\n\t if (_this2._options.interactive && _this2._pickingId) {\n\t // Inject picking ID\n\t polygon.pickingId = _this2._pickingId;\n\t }\n\t\n\t // Convert polygon representation to proper attribute arrays\n\t return _this2._toAttributes(polygon);\n\t });\n\t }\n\t\n\t this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes);\n\t\n\t // Original attributes are no longer required so free the memory\n\t attributes = null;\n\t }\n\t }, {\n\t key: 'getBufferAttributes',\n\t value: function getBufferAttributes() {\n\t return this._bufferAttributes;\n\t }\n\t\n\t // Used by external components to clear some memory when the attributes\n\t // are no longer required to be stored in this layer\n\t //\n\t // For example, you would want to clear the attributes here after merging them\n\t // using something like the GeoJSONLayer\n\t }, {\n\t key: 'clearBufferAttributes',\n\t value: function clearBufferAttributes() {\n\t this._bufferAttributes = null;\n\t }\n\t\n\t // Used by external components to clear some memory when the coordinates\n\t // are no longer required to be stored in this layer\n\t //\n\t // For example, you would want to clear the coordinates here after this\n\t // layer is merged in something like the GeoJSONLayer\n\t }, {\n\t key: 'clearCoordinates',\n\t value: function clearCoordinates() {\n\t this._coordinates = null;\n\t this._projectedCoordinates = null;\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // This is only called if the layer is controlling its own output\n\t }, {\n\t key: '_setMesh',\n\t value: function _setMesh(attributes) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t if (this._options.material && this._options.material instanceof _three2['default'].Material) {\n\t material = this._options.material;\n\t } else if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshPhongMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t side: _three2['default'].BackSide,\n\t transparent: this._options.style.transparent,\n\t opacity: this._options.style.opacity,\n\t blending: this._options.style.blending\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t side: _three2['default'].BackSide,\n\t transparent: this._options.style.transparent,\n\t opacity: this._options.style.opacity,\n\t blending: this._options.style.blending\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var mesh;\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onMesh === 'function') {\n\t mesh = this._options.onMesh(geometry, material);\n\t } else {\n\t mesh = new _three2['default'].Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t mesh.receiveShadow = true;\n\t }\n\t\n\t if (this.isFlat()) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = 1;\n\t }\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t material.side = _three2['default'].BackSide;\n\t\n\t var pickingMesh = new _three2['default'].Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._mesh = mesh;\n\t }\n\t\n\t // Convert and project coordinates\n\t //\n\t // TODO: Calculate bounds\n\t }, {\n\t key: '_setCoordinates',\n\t value: function _setCoordinates() {\n\t this._bounds = [];\n\t this._coordinates = this._convertCoordinates(this._coordinates);\n\t\n\t this._projectedBounds = [];\n\t this._projectedCoordinates = this._projectCoordinates();\n\t\n\t this._center = this._coordinates[0][0][0];\n\t }\n\t\n\t // Recursively convert input coordinates into LatLon objects\n\t //\n\t // Calculate geographic bounds at the same time\n\t //\n\t // TODO: Calculate geographic bounds\n\t }, {\n\t key: '_convertCoordinates',\n\t value: function _convertCoordinates(coordinates) {\n\t return coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (ring) {\n\t return ring.map(function (coordinate) {\n\t return (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t });\n\t });\n\t });\n\t }\n\t\n\t // Recursively project coordinates into world positions\n\t //\n\t // Calculate world bounds, offset and pointScale at the same time\n\t //\n\t // TODO: Calculate world bounds\n\t }, {\n\t key: '_projectCoordinates',\n\t value: function _projectCoordinates() {\n\t var _this3 = this;\n\t\n\t var point;\n\t return this._coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (ring) {\n\t return ring.map(function (latlon) {\n\t point = _this3._world.latLonToPoint(latlon);\n\t\n\t // TODO: Is offset ever being used or needed?\n\t if (!_this3._offset) {\n\t _this3._offset = (0, _geoPoint.point)(0, 0);\n\t _this3._offset.x = -1 * point.x;\n\t _this3._offset.y = -1 * point.y;\n\t\n\t _this3._pointScale = _this3._world.pointScale(latlon);\n\t }\n\t\n\t return point;\n\t });\n\t });\n\t });\n\t }\n\t\n\t // Convert coordinates array to something earcut can understand\n\t }, {\n\t key: '_toEarcut',\n\t value: function _toEarcut(coordinates) {\n\t var dim = 2;\n\t var result = { vertices: [], holes: [], dimensions: dim };\n\t var holeIndex = 0;\n\t\n\t for (var i = 0; i < coordinates.length; i++) {\n\t for (var j = 0; j < coordinates[i].length; j++) {\n\t // for (var d = 0; d < dim; d++) {\n\t result.vertices.push(coordinates[i][j].x);\n\t result.vertices.push(coordinates[i][j].y);\n\t // }\n\t }\n\t if (i > 0) {\n\t holeIndex += coordinates[i - 1].length;\n\t result.holes.push(holeIndex);\n\t }\n\t }\n\t\n\t return result;\n\t }\n\t\n\t // Triangulate earcut-based input using earcut\n\t }, {\n\t key: '_triangulate',\n\t value: function _triangulate(contour, holes, dim) {\n\t // console.time('earcut');\n\t\n\t var faces = (0, _earcut3['default'])(contour, holes, dim);\n\t var result = [];\n\t\n\t for (i = 0, il = faces.length; i < il; i += 3) {\n\t result.push(faces.slice(i, i + 3));\n\t }\n\t\n\t // console.timeEnd('earcut');\n\t\n\t return result;\n\t }\n\t\n\t // Transform polygon representation into attribute arrays that can be used by\n\t // THREE.BufferGeometry\n\t //\n\t // TODO: Can this be simplified? It's messy and huge\n\t }, {\n\t key: '_toAttributes',\n\t value: function _toAttributes(polygon) {\n\t // Three components per vertex per face (3 x 3 = 9)\n\t var vertices = new Float32Array(polygon.facesCount * 9);\n\t var normals = new Float32Array(polygon.facesCount * 9);\n\t var colours = new Float32Array(polygon.facesCount * 9);\n\t\n\t var pickingIds;\n\t if (polygon.pickingId) {\n\t // One component per vertex per face (1 x 3 = 3)\n\t pickingIds = new Float32Array(polygon.facesCount * 3);\n\t }\n\t\n\t var pA = new _three2['default'].Vector3();\n\t var pB = new _three2['default'].Vector3();\n\t var pC = new _three2['default'].Vector3();\n\t\n\t var cb = new _three2['default'].Vector3();\n\t var ab = new _three2['default'].Vector3();\n\t\n\t var index;\n\t\n\t var _faces = polygon.faces;\n\t var _vertices = polygon.vertices;\n\t var _colour = polygon.colours;\n\t\n\t var _pickingId;\n\t if (pickingIds) {\n\t _pickingId = polygon.pickingId;\n\t }\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < _faces.length; i++) {\n\t // Array of vertex indexes for the face\n\t index = _faces[i][0];\n\t\n\t var ax = _vertices[index][0];\n\t var ay = _vertices[index][1];\n\t var az = _vertices[index][2];\n\t\n\t var c1 = _colour[i][0];\n\t\n\t index = _faces[i][1];\n\t\n\t var bx = _vertices[index][0];\n\t var by = _vertices[index][1];\n\t var bz = _vertices[index][2];\n\t\n\t var c2 = _colour[i][1];\n\t\n\t index = _faces[i][2];\n\t\n\t var cx = _vertices[index][0];\n\t var cy = _vertices[index][1];\n\t var cz = _vertices[index][2];\n\t\n\t var c3 = _colour[i][2];\n\t\n\t // Flat face normals\n\t // From: http://threejs.org/examples/webgl_buffergeometry.html\n\t pA.set(ax, ay, az);\n\t pB.set(bx, by, bz);\n\t pC.set(cx, cy, cz);\n\t\n\t cb.subVectors(pC, pB);\n\t ab.subVectors(pA, pB);\n\t cb.cross(ab);\n\t\n\t cb.normalize();\n\t\n\t var nx = cb.x;\n\t var ny = cb.y;\n\t var nz = cb.z;\n\t\n\t vertices[lastIndex * 9 + 0] = ax;\n\t vertices[lastIndex * 9 + 1] = ay;\n\t vertices[lastIndex * 9 + 2] = az;\n\t\n\t normals[lastIndex * 9 + 0] = nx;\n\t normals[lastIndex * 9 + 1] = ny;\n\t normals[lastIndex * 9 + 2] = nz;\n\t\n\t colours[lastIndex * 9 + 0] = c1[0];\n\t colours[lastIndex * 9 + 1] = c1[1];\n\t colours[lastIndex * 9 + 2] = c1[2];\n\t\n\t vertices[lastIndex * 9 + 3] = bx;\n\t vertices[lastIndex * 9 + 4] = by;\n\t vertices[lastIndex * 9 + 5] = bz;\n\t\n\t normals[lastIndex * 9 + 3] = nx;\n\t normals[lastIndex * 9 + 4] = ny;\n\t normals[lastIndex * 9 + 5] = nz;\n\t\n\t colours[lastIndex * 9 + 3] = c2[0];\n\t colours[lastIndex * 9 + 4] = c2[1];\n\t colours[lastIndex * 9 + 5] = c2[2];\n\t\n\t vertices[lastIndex * 9 + 6] = cx;\n\t vertices[lastIndex * 9 + 7] = cy;\n\t vertices[lastIndex * 9 + 8] = cz;\n\t\n\t normals[lastIndex * 9 + 6] = nx;\n\t normals[lastIndex * 9 + 7] = ny;\n\t normals[lastIndex * 9 + 8] = nz;\n\t\n\t colours[lastIndex * 9 + 6] = c3[0];\n\t colours[lastIndex * 9 + 7] = c3[1];\n\t colours[lastIndex * 9 + 8] = c3[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex * 3 + 0] = _pickingId;\n\t pickingIds[lastIndex * 3 + 1] = _pickingId;\n\t pickingIds[lastIndex * 3 + 2] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t\n\t var attributes = {\n\t vertices: vertices,\n\t normals: normals,\n\t colours: colours\n\t };\n\t\n\t if (pickingIds) {\n\t attributes.pickingIds = pickingIds;\n\t }\n\t\n\t return attributes;\n\t }\n\t\n\t // Returns true if the polygon is flat (has no height)\n\t }, {\n\t key: 'isFlat',\n\t value: function isFlat() {\n\t return this._flat;\n\t }\n\t\n\t // Returns true if coordinates refer to a single geometry\n\t //\n\t // For example, not coordinates for a MultiPolygon GeoJSON feature\n\t }, {\n\t key: 'destroy',\n\t\n\t // TODO: Make sure this is cleaning everything\n\t value: function destroy() {\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t this.clearCoordinates();\n\t this.clearBufferAttributes();\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(PolygonLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }], [{\n\t key: 'isSingle',\n\t value: function isSingle(coordinates) {\n\t return !Array.isArray(coordinates[0][0][0]);\n\t }\n\t }]);\n\t\n\t return PolygonLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = PolygonLayer;\n\t\n\tvar noNew = function noNew(coordinates, options) {\n\t return new PolygonLayer(coordinates, options);\n\t};\n\t\n\texports.polygonLayer = noNew;\n\n/***/ },\n/* 86 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\t\n\t// TODO: Look at ways to drop unneeded references to array buffers, etc to\n\t// reduce memory footprint\n\t\n\t// TODO: Provide alternative output using tubes and splines / curves\n\t\n\t// TODO: Support dynamic updating / hiding / animation of geometry\n\t//\n\t// This could be pretty hard as it's all packed away within BufferGeometry and\n\t// may even be merged by another layer (eg. GeoJSONLayer)\n\t//\n\t// How much control should this layer support? Perhaps a different or custom\n\t// layer would be better suited for animation, for example.\n\t\n\t// TODO: Allow _setBufferAttributes to use a custom function passed in to\n\t// generate a custom mesh\n\t\n\tvar _Layer2 = __webpack_require__(46);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(83);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _utilBuffer = __webpack_require__(82);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar PolylineLayer = (function (_Layer) {\n\t _inherits(PolylineLayer, _Layer);\n\t\n\t function PolylineLayer(coordinates, options) {\n\t _classCallCheck(this, PolylineLayer);\n\t\n\t var defaults = {\n\t output: true,\n\t interactive: false,\n\t // Custom material override\n\t //\n\t // TODO: Should this be in the style object?\n\t material: null,\n\t onMesh: null,\n\t onBufferAttributes: null,\n\t // This default style is separate to Util.GeoJSON.defaultStyle\n\t style: {\n\t lineOpacity: 1,\n\t lineTransparent: false,\n\t lineColor: '#ffffff',\n\t lineWidth: 1,\n\t lineBlending: _three2['default'].NormalBlending\n\t }\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(PolylineLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t // Return coordinates as array of lines so it's easy to support\n\t // MultiLineString features (a single line would be a MultiLineString with a\n\t // single line in the array)\n\t this._coordinates = PolylineLayer.isSingle(coordinates) ? [coordinates] : coordinates;\n\t\n\t // Polyline features are always flat (for now at least)\n\t this._flat = true;\n\t }\n\t\n\t _createClass(PolylineLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this._setCoordinates();\n\t\n\t if (this._options.interactive) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new _three2['default'].Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t this._setPickingId();\n\t this._addPickingEvents();\n\t }\n\t\n\t // Store geometry representation as instances of THREE.BufferAttribute\n\t this._setBufferAttributes();\n\t\n\t if (this.isOutput()) {\n\t // Set mesh if not merging elsewhere\n\t this._setMesh(this._bufferAttributes);\n\t\n\t // Output mesh\n\t this.add(this._mesh);\n\t }\n\t }\n\t\n\t // Return center of polyline as a LatLon\n\t //\n\t // This is used for things like placing popups / UI elements on the layer\n\t //\n\t // TODO: Find proper center position instead of returning first coordinate\n\t // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polyline.js#L59\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._center;\n\t }\n\t\n\t // Return line bounds in geographic coordinates\n\t //\n\t // TODO: Implement getBounds()\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {}\n\t\n\t // Get unique ID for picking interaction\n\t }, {\n\t key: '_setPickingId',\n\t value: function _setPickingId() {\n\t this._pickingId = this.getPickingId();\n\t }\n\t\n\t // Set up and re-emit interaction events\n\t }, {\n\t key: '_addPickingEvents',\n\t value: function _addPickingEvents() {\n\t var _this = this;\n\t\n\t // TODO: Find a way to properly remove this listener on destroy\n\t this._world.on('pick-' + this._pickingId, function (point2d, point3d, intersects) {\n\t // Re-emit click event from the layer\n\t _this.emit('click', _this, point2d, point3d, intersects);\n\t });\n\t }\n\t\n\t // Create and store reference to THREE.BufferAttribute data for this layer\n\t }, {\n\t key: '_setBufferAttributes',\n\t value: function _setBufferAttributes() {\n\t var _this2 = this;\n\t\n\t var attributes;\n\t\n\t // Only use this if you know what you're doing\n\t if (typeof this._options.onBufferAttributes === 'function') {\n\t // TODO: Probably want to pass something less general as arguments,\n\t // though passing the instance will do for now (it's everything)\n\t attributes = this._options.onBufferAttributes(this);\n\t } else {\n\t var height = 0;\n\t\n\t // Convert height into world units\n\t if (this._options.style.lineHeight) {\n\t height = this._world.metresToWorld(this._options.style.lineHeight, this._pointScale);\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t colour.set(this._options.style.lineColor);\n\t\n\t // For each line\n\t attributes = this._projectedCoordinates.map(function (_projectedCoordinates) {\n\t var _vertices = [];\n\t var _colours = [];\n\t\n\t // Connect coordinate with the next to make a pair\n\t //\n\t // LineSegments requires pairs of vertices so repeat the last point if\n\t // there's an odd number of vertices\n\t var nextCoord;\n\t _projectedCoordinates.forEach(function (coordinate, index) {\n\t _colours.push([colour.r, colour.g, colour.b]);\n\t _vertices.push([coordinate.x, height, coordinate.y]);\n\t\n\t nextCoord = _projectedCoordinates[index + 1] ? _projectedCoordinates[index + 1] : coordinate;\n\t\n\t _colours.push([colour.r, colour.g, colour.b]);\n\t _vertices.push([nextCoord.x, height, nextCoord.y]);\n\t });\n\t\n\t var line = {\n\t vertices: _vertices,\n\t colours: _colours,\n\t verticesCount: _vertices.length\n\t };\n\t\n\t if (_this2._options.interactive && _this2._pickingId) {\n\t // Inject picking ID\n\t line.pickingId = _this2._pickingId;\n\t }\n\t\n\t // Convert line representation to proper attribute arrays\n\t return _this2._toAttributes(line);\n\t });\n\t }\n\t\n\t this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes);\n\t\n\t // Original attributes are no longer required so free the memory\n\t attributes = null;\n\t }\n\t }, {\n\t key: 'getBufferAttributes',\n\t value: function getBufferAttributes() {\n\t return this._bufferAttributes;\n\t }\n\t\n\t // Used by external components to clear some memory when the attributes\n\t // are no longer required to be stored in this layer\n\t //\n\t // For example, you would want to clear the attributes here after merging them\n\t // using something like the GeoJSONLayer\n\t }, {\n\t key: 'clearBufferAttributes',\n\t value: function clearBufferAttributes() {\n\t this._bufferAttributes = null;\n\t }\n\t\n\t // Used by external components to clear some memory when the coordinates\n\t // are no longer required to be stored in this layer\n\t //\n\t // For example, you would want to clear the coordinates here after this\n\t // layer is merged in something like the GeoJSONLayer\n\t }, {\n\t key: 'clearCoordinates',\n\t value: function clearCoordinates() {\n\t this._coordinates = null;\n\t this._projectedCoordinates = null;\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // This is only called if the layer is controlling its own output\n\t }, {\n\t key: '_setMesh',\n\t value: function _setMesh(attributes) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(attributes.vertices, 3));\n\t\n\t if (attributes.normals) {\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(attributes.normals, 3));\n\t }\n\t\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var style = this._options.style;\n\t var material;\n\t\n\t if (this._options.material && this._options.material instanceof _three2['default'].Material) {\n\t material = this._options.material;\n\t } else {\n\t material = new _three2['default'].LineBasicMaterial({\n\t vertexColors: _three2['default'].VertexColors,\n\t linewidth: style.lineWidth,\n\t transparent: style.lineTransparent,\n\t opacity: style.lineOpacity,\n\t blending: style.lineBlending\n\t });\n\t }\n\t\n\t var mesh;\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onMesh === 'function') {\n\t mesh = this._options.onMesh(geometry, material);\n\t } else {\n\t mesh = new _three2['default'].LineSegments(geometry, material);\n\t\n\t if (style.lineRenderOrder !== undefined) {\n\t material.depthWrite = false;\n\t mesh.renderOrder = style.lineRenderOrder;\n\t }\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t }\n\t\n\t // TODO: Allow this to be overridden, or copy mesh instead of creating a new\n\t // one just for picking\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t // Make the line wider / easier to pick\n\t material.linewidth = style.lineWidth + material.linePadding;\n\t\n\t var pickingMesh = new _three2['default'].LineSegments(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._mesh = mesh;\n\t }\n\t\n\t // Convert and project coordinates\n\t //\n\t // TODO: Calculate bounds\n\t }, {\n\t key: '_setCoordinates',\n\t value: function _setCoordinates() {\n\t this._bounds = [];\n\t this._coordinates = this._convertCoordinates(this._coordinates);\n\t\n\t this._projectedBounds = [];\n\t this._projectedCoordinates = this._projectCoordinates();\n\t\n\t this._center = this._coordinates[0][0];\n\t }\n\t\n\t // Recursively convert input coordinates into LatLon objects\n\t //\n\t // Calculate geographic bounds at the same time\n\t //\n\t // TODO: Calculate geographic bounds\n\t }, {\n\t key: '_convertCoordinates',\n\t value: function _convertCoordinates(coordinates) {\n\t return coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (coordinate) {\n\t return (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t });\n\t });\n\t }\n\t\n\t // Recursively project coordinates into world positions\n\t //\n\t // Calculate world bounds, offset and pointScale at the same time\n\t //\n\t // TODO: Calculate world bounds\n\t }, {\n\t key: '_projectCoordinates',\n\t value: function _projectCoordinates() {\n\t var _this3 = this;\n\t\n\t var point;\n\t return this._coordinates.map(function (_coordinates) {\n\t return _coordinates.map(function (latlon) {\n\t point = _this3._world.latLonToPoint(latlon);\n\t\n\t // TODO: Is offset ever being used or needed?\n\t if (!_this3._offset) {\n\t _this3._offset = (0, _geoPoint.point)(0, 0);\n\t _this3._offset.x = -1 * point.x;\n\t _this3._offset.y = -1 * point.y;\n\t\n\t _this3._pointScale = _this3._world.pointScale(latlon);\n\t }\n\t\n\t return point;\n\t });\n\t });\n\t }\n\t\n\t // Transform line representation into attribute arrays that can be used by\n\t // THREE.BufferGeometry\n\t //\n\t // TODO: Can this be simplified? It's messy and huge\n\t }, {\n\t key: '_toAttributes',\n\t value: function _toAttributes(line) {\n\t // Three components per vertex\n\t var vertices = new Float32Array(line.verticesCount * 3);\n\t var colours = new Float32Array(line.verticesCount * 3);\n\t\n\t var pickingIds;\n\t if (line.pickingId) {\n\t // One component per vertex\n\t pickingIds = new Float32Array(line.verticesCount);\n\t }\n\t\n\t var _vertices = line.vertices;\n\t var _colour = line.colours;\n\t\n\t var normals;\n\t var _normals;\n\t if (line.normals) {\n\t normals = new Float32Array(line.verticesCount * 3);\n\t _normals = line.normals;\n\t }\n\t\n\t var _pickingId;\n\t if (pickingIds) {\n\t _pickingId = line.pickingId;\n\t }\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < _vertices.length; i++) {\n\t var ax = _vertices[i][0];\n\t var ay = _vertices[i][1];\n\t var az = _vertices[i][2];\n\t\n\t var nx;\n\t var ny;\n\t var nz;\n\t if (_normals) {\n\t nx = _normals[i][0];\n\t ny = _normals[i][1];\n\t nz = _normals[i][2];\n\t }\n\t\n\t var c1 = _colour[i];\n\t\n\t vertices[lastIndex * 3 + 0] = ax;\n\t vertices[lastIndex * 3 + 1] = ay;\n\t vertices[lastIndex * 3 + 2] = az;\n\t\n\t if (normals) {\n\t normals[lastIndex * 3 + 0] = nx;\n\t normals[lastIndex * 3 + 1] = ny;\n\t normals[lastIndex * 3 + 2] = nz;\n\t }\n\t\n\t colours[lastIndex * 3 + 0] = c1[0];\n\t colours[lastIndex * 3 + 1] = c1[1];\n\t colours[lastIndex * 3 + 2] = c1[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t\n\t var attributes = {\n\t vertices: vertices,\n\t colours: colours\n\t };\n\t\n\t if (normals) {\n\t attributes.normals = normals;\n\t }\n\t\n\t if (pickingIds) {\n\t attributes.pickingIds = pickingIds;\n\t }\n\t\n\t return attributes;\n\t }\n\t\n\t // Returns true if the line is flat (has no height)\n\t }, {\n\t key: 'isFlat',\n\t value: function isFlat() {\n\t return this._flat;\n\t }\n\t\n\t // Returns true if coordinates refer to a single geometry\n\t //\n\t // For example, not coordinates for a MultiLineString GeoJSON feature\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t this.clearCoordinates();\n\t this.clearBufferAttributes();\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(PolylineLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }], [{\n\t key: 'isSingle',\n\t value: function isSingle(coordinates) {\n\t return !Array.isArray(coordinates[0][0]);\n\t }\n\t }]);\n\t\n\t return PolylineLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = PolylineLayer;\n\t\n\tvar noNew = function noNew(coordinates, options) {\n\t return new PolylineLayer(coordinates, options);\n\t};\n\t\n\texports.polylineLayer = noNew;\n\n/***/ },\n/* 87 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\t// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\t\n\t// TODO: Look at ways to drop unneeded references to array buffers, etc to\n\t// reduce memory footprint\n\t\n\t// TODO: Point features may be using custom models / meshes and so an approach\n\t// needs to be found to allow these to be brokwn down into buffer attributes for\n\t// merging\n\t//\n\t// Can probably use fromGeometry() or setFromObject() from THREE.BufferGeometry\n\t// and pull out the attributes\n\t\n\t// TODO: Support sprite objects using textures\n\t\n\t// TODO: Provide option to billboard geometry so it always faces the camera\n\t\n\t// TODO: Support dynamic updating / hiding / animation of geometry\n\t//\n\t// This could be pretty hard as it's all packed away within BufferGeometry and\n\t// may even be merged by another layer (eg. GeoJSONLayer)\n\t//\n\t// How much control should this layer support? Perhaps a different or custom\n\t// layer would be better suited for animation, for example.\n\t\n\tvar _Layer2 = __webpack_require__(46);\n\t\n\tvar _Layer3 = _interopRequireDefault(_Layer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar _three = __webpack_require__(24);\n\t\n\tvar _three2 = _interopRequireDefault(_three);\n\t\n\tvar _geoLatLon = __webpack_require__(10);\n\t\n\tvar _geoPoint = __webpack_require__(11);\n\t\n\tvar _enginePickingMaterial = __webpack_require__(83);\n\t\n\tvar _enginePickingMaterial2 = _interopRequireDefault(_enginePickingMaterial);\n\t\n\tvar _utilBuffer = __webpack_require__(82);\n\t\n\tvar _utilBuffer2 = _interopRequireDefault(_utilBuffer);\n\t\n\tvar PointLayer = (function (_Layer) {\n\t _inherits(PointLayer, _Layer);\n\t\n\t function PointLayer(coordinates, options) {\n\t _classCallCheck(this, PointLayer);\n\t\n\t var defaults = {\n\t output: true,\n\t interactive: false,\n\t // THREE.Geometry or THREE.BufferGeometry to use for point output\n\t geometry: null,\n\t // Custom material override\n\t //\n\t // TODO: Should this be in the style object?\n\t material: null,\n\t onMesh: null,\n\t // This default style is separate to Util.GeoJSON.defaultStyle\n\t style: {\n\t pointColor: '#ff0000'\n\t }\n\t };\n\t\n\t var _options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(PointLayer.prototype), 'constructor', this).call(this, _options);\n\t\n\t // Return coordinates as array of points so it's easy to support\n\t // MultiPoint features (a single point would be a MultiPoint with a\n\t // single point in the array)\n\t this._coordinates = PointLayer.isSingle(coordinates) ? [coordinates] : coordinates;\n\t\n\t // Point features are always flat (for now at least)\n\t //\n\t // This won't always be the case once custom point objects / meshes are\n\t // added\n\t this._flat = true;\n\t }\n\t\n\t _createClass(PointLayer, [{\n\t key: '_onAdd',\n\t value: function _onAdd(world) {\n\t this._setCoordinates();\n\t\n\t if (this._options.interactive) {\n\t // Only add to picking mesh if this layer is controlling output\n\t //\n\t // Otherwise, assume another component will eventually add a mesh to\n\t // the picking scene\n\t if (this.isOutput()) {\n\t this._pickingMesh = new _three2['default'].Object3D();\n\t this.addToPicking(this._pickingMesh);\n\t }\n\t\n\t this._setPickingId();\n\t this._addPickingEvents();\n\t }\n\t\n\t // Store geometry representation as instances of THREE.BufferAttribute\n\t this._setBufferAttributes();\n\t\n\t if (this.isOutput()) {\n\t // Set mesh if not merging elsewhere\n\t this._setMesh(this._bufferAttributes);\n\t\n\t // Output mesh\n\t this.add(this._mesh);\n\t }\n\t }\n\t\n\t // Return center of point as a LatLon\n\t //\n\t // This is used for things like placing popups / UI elements on the layer\n\t }, {\n\t key: 'getCenter',\n\t value: function getCenter() {\n\t return this._center;\n\t }\n\t\n\t // Return point bounds in geographic coordinates\n\t //\n\t // While not useful for single points, it could be useful for MultiPoint\n\t //\n\t // TODO: Implement getBounds()\n\t }, {\n\t key: 'getBounds',\n\t value: function getBounds() {}\n\t\n\t // Get unique ID for picking interaction\n\t }, {\n\t key: '_setPickingId',\n\t value: function _setPickingId() {\n\t this._pickingId = this.getPickingId();\n\t }\n\t\n\t // Set up and re-emit interaction events\n\t }, {\n\t key: '_addPickingEvents',\n\t value: function _addPickingEvents() {\n\t var _this = this;\n\t\n\t // TODO: Find a way to properly remove this listener on destroy\n\t this._world.on('pick-' + this._pickingId, function (point2d, point3d, intersects) {\n\t // Re-emit click event from the layer\n\t _this.emit('click', _this, point2d, point3d, intersects);\n\t });\n\t }\n\t\n\t // Create and store reference to THREE.BufferAttribute data for this layer\n\t }, {\n\t key: '_setBufferAttributes',\n\t value: function _setBufferAttributes() {\n\t var _this2 = this;\n\t\n\t var height = 0;\n\t\n\t // Convert height into world units\n\t if (this._options.style.pointHeight) {\n\t height = this._world.metresToWorld(this._options.style.pointHeight, this._pointScale);\n\t }\n\t\n\t var colour = new _three2['default'].Color();\n\t colour.set(this._options.style.pointColor);\n\t\n\t var geometry;\n\t\n\t // Use default geometry if none has been provided or the provided geometry\n\t // isn't valid\n\t if (!this._options.geometry || !this._options.geometry instanceof _three2['default'].Geometry || !this._options.geometry instanceof _three2['default'].BufferGeometry) {\n\t // Debug geometry for points is a thin bar\n\t //\n\t // TODO: Allow point geometry to be customised / overridden\n\t var geometryWidth = this._world.metresToWorld(25, this._pointScale);\n\t var geometryHeight = this._world.metresToWorld(200, this._pointScale);\n\t var _geometry = new _three2['default'].BoxGeometry(geometryWidth, geometryHeight, geometryWidth);\n\t\n\t // Shift geometry up so it sits on the ground\n\t _geometry.translate(0, geometryHeight * 0.5, 0);\n\t\n\t // Pull attributes out of debug geometry\n\t geometry = new _three2['default'].BufferGeometry().fromGeometry(_geometry);\n\t } else {\n\t if (this._options.geometry instanceof _three2['default'].BufferGeometry) {\n\t geometry = this._options.geometry;\n\t } else {\n\t geometry = new _three2['default'].BufferGeometry().fromGeometry(this._options.geometry);\n\t }\n\t }\n\t\n\t // For each point\n\t var attributes = this._projectedCoordinates.map(function (coordinate) {\n\t var _vertices = [];\n\t var _normals = [];\n\t var _colours = [];\n\t\n\t var _geometry = geometry.clone();\n\t\n\t _geometry.translate(coordinate.x, height, coordinate.y);\n\t\n\t var _vertices = _geometry.attributes.position.clone().array;\n\t var _normals = _geometry.attributes.normal.clone().array;\n\t var _colours = _geometry.attributes.color.clone().array;\n\t\n\t for (var i = 0; i < _colours.length; i += 3) {\n\t _colours[i] = colour.r;\n\t _colours[i + 1] = colour.g;\n\t _colours[i + 2] = colour.b;\n\t }\n\t\n\t var _point = {\n\t vertices: _vertices,\n\t normals: _normals,\n\t colours: _colours\n\t };\n\t\n\t if (_this2._options.interactive && _this2._pickingId) {\n\t // Inject picking ID\n\t // point.pickingId = this._pickingId;\n\t _point.pickingIds = new Float32Array(_vertices.length / 3);\n\t for (var i = 0; i < _point.pickingIds.length; i++) {\n\t _point.pickingIds[i] = _this2._pickingId;\n\t }\n\t }\n\t\n\t // Convert point representation to proper attribute arrays\n\t // return this._toAttributes(_point);\n\t return _point;\n\t });\n\t\n\t this._bufferAttributes = _utilBuffer2['default'].mergeAttributes(attributes);\n\t\n\t // Original attributes are no longer required so free the memory\n\t attributes = null;\n\t }\n\t }, {\n\t key: 'getBufferAttributes',\n\t value: function getBufferAttributes() {\n\t return this._bufferAttributes;\n\t }\n\t\n\t // Used by external components to clear some memory when the attributes\n\t // are no longer required to be stored in this layer\n\t //\n\t // For example, you would want to clear the attributes here after merging them\n\t // using something like the GeoJSONLayer\n\t }, {\n\t key: 'clearBufferAttributes',\n\t value: function clearBufferAttributes() {\n\t this._bufferAttributes = null;\n\t }\n\t\n\t // Used by external components to clear some memory when the coordinates\n\t // are no longer required to be stored in this layer\n\t //\n\t // For example, you would want to clear the coordinates here after this\n\t // layer is merged in something like the GeoJSONLayer\n\t }, {\n\t key: 'clearCoordinates',\n\t value: function clearCoordinates() {\n\t this._coordinates = null;\n\t this._projectedCoordinates = null;\n\t }\n\t\n\t // Create and store mesh from buffer attributes\n\t //\n\t // This is only called if the layer is controlling its own output\n\t }, {\n\t key: '_setMesh',\n\t value: function _setMesh(attributes) {\n\t var geometry = new _three2['default'].BufferGeometry();\n\t\n\t // itemSize = 3 because there are 3 values (components) per vertex\n\t geometry.addAttribute('position', new _three2['default'].BufferAttribute(attributes.vertices, 3));\n\t geometry.addAttribute('normal', new _three2['default'].BufferAttribute(attributes.normals, 3));\n\t geometry.addAttribute('color', new _three2['default'].BufferAttribute(attributes.colours, 3));\n\t\n\t if (attributes.pickingIds) {\n\t geometry.addAttribute('pickingId', new _three2['default'].BufferAttribute(attributes.pickingIds, 1));\n\t }\n\t\n\t geometry.computeBoundingBox();\n\t\n\t var material;\n\t\n\t if (this._options.material && this._options.material instanceof _three2['default'].Material) {\n\t material = this._options.material;\n\t } else if (!this._world._environment._skybox) {\n\t material = new _three2['default'].MeshBasicMaterial({\n\t vertexColors: _three2['default'].VertexColors\n\t // side: THREE.BackSide\n\t });\n\t } else {\n\t material = new _three2['default'].MeshStandardMaterial({\n\t vertexColors: _three2['default'].VertexColors\n\t // side: THREE.BackSide\n\t });\n\t material.roughness = 1;\n\t material.metalness = 0.1;\n\t material.envMapIntensity = 3;\n\t material.envMap = this._world._environment._skybox.getRenderTarget();\n\t }\n\t\n\t var mesh;\n\t\n\t // Pass mesh through callback, if defined\n\t if (typeof this._options.onMesh === 'function') {\n\t mesh = this._options.onMesh(geometry, material);\n\t } else {\n\t mesh = new _three2['default'].Mesh(geometry, material);\n\t\n\t mesh.castShadow = true;\n\t // mesh.receiveShadow = true;\n\t }\n\t\n\t if (this._options.interactive && this._pickingMesh) {\n\t material = new _enginePickingMaterial2['default']();\n\t // material.side = THREE.BackSide;\n\t\n\t var pickingMesh = new _three2['default'].Mesh(geometry, material);\n\t this._pickingMesh.add(pickingMesh);\n\t }\n\t\n\t this._mesh = mesh;\n\t }\n\t\n\t // Convert and project coordinates\n\t //\n\t // TODO: Calculate bounds\n\t }, {\n\t key: '_setCoordinates',\n\t value: function _setCoordinates() {\n\t this._bounds = [];\n\t this._coordinates = this._convertCoordinates(this._coordinates);\n\t\n\t this._projectedBounds = [];\n\t this._projectedCoordinates = this._projectCoordinates();\n\t\n\t this._center = this._coordinates;\n\t }\n\t\n\t // Recursively convert input coordinates into LatLon objects\n\t //\n\t // Calculate geographic bounds at the same time\n\t //\n\t // TODO: Calculate geographic bounds\n\t }, {\n\t key: '_convertCoordinates',\n\t value: function _convertCoordinates(coordinates) {\n\t return coordinates.map(function (coordinate) {\n\t return (0, _geoLatLon.latLon)(coordinate[1], coordinate[0]);\n\t });\n\t }\n\t\n\t // Recursively project coordinates into world positions\n\t //\n\t // Calculate world bounds, offset and pointScale at the same time\n\t //\n\t // TODO: Calculate world bounds\n\t }, {\n\t key: '_projectCoordinates',\n\t value: function _projectCoordinates() {\n\t var _this3 = this;\n\t\n\t var _point;\n\t return this._coordinates.map(function (latlon) {\n\t _point = _this3._world.latLonToPoint(latlon);\n\t\n\t // TODO: Is offset ever being used or needed?\n\t if (!_this3._offset) {\n\t _this3._offset = (0, _geoPoint.point)(0, 0);\n\t _this3._offset.x = -1 * _point.x;\n\t _this3._offset.y = -1 * _point.y;\n\t\n\t _this3._pointScale = _this3._world.pointScale(latlon);\n\t }\n\t\n\t return _point;\n\t });\n\t }\n\t\n\t // Transform line representation into attribute arrays that can be used by\n\t // THREE.BufferGeometry\n\t //\n\t // TODO: Can this be simplified? It's messy and huge\n\t }, {\n\t key: '_toAttributes',\n\t value: function _toAttributes(line) {\n\t // Three components per vertex\n\t var vertices = new Float32Array(line.verticesCount * 3);\n\t var colours = new Float32Array(line.verticesCount * 3);\n\t\n\t var pickingIds;\n\t if (line.pickingId) {\n\t // One component per vertex\n\t pickingIds = new Float32Array(line.verticesCount);\n\t }\n\t\n\t var _vertices = line.vertices;\n\t var _colour = line.colours;\n\t\n\t var _pickingId;\n\t if (pickingIds) {\n\t _pickingId = line.pickingId;\n\t }\n\t\n\t var lastIndex = 0;\n\t\n\t for (var i = 0; i < _vertices.length; i++) {\n\t var ax = _vertices[i][0];\n\t var ay = _vertices[i][1];\n\t var az = _vertices[i][2];\n\t\n\t var c1 = _colour[i];\n\t\n\t vertices[lastIndex * 3 + 0] = ax;\n\t vertices[lastIndex * 3 + 1] = ay;\n\t vertices[lastIndex * 3 + 2] = az;\n\t\n\t colours[lastIndex * 3 + 0] = c1[0];\n\t colours[lastIndex * 3 + 1] = c1[1];\n\t colours[lastIndex * 3 + 2] = c1[2];\n\t\n\t if (pickingIds) {\n\t pickingIds[lastIndex] = _pickingId;\n\t }\n\t\n\t lastIndex++;\n\t }\n\t\n\t var attributes = {\n\t vertices: vertices,\n\t colours: colours\n\t };\n\t\n\t if (pickingIds) {\n\t attributes.pickingIds = pickingIds;\n\t }\n\t\n\t return attributes;\n\t }\n\t\n\t // Returns true if the line is flat (has no height)\n\t }, {\n\t key: 'isFlat',\n\t value: function isFlat() {\n\t return this._flat;\n\t }\n\t\n\t // Returns true if coordinates refer to a single geometry\n\t //\n\t // For example, not coordinates for a MultiPoint GeoJSON feature\n\t }, {\n\t key: 'destroy',\n\t value: function destroy() {\n\t if (this._pickingMesh) {\n\t // TODO: Properly dispose of picking mesh\n\t this._pickingMesh = null;\n\t }\n\t\n\t this.clearCoordinates();\n\t this.clearBufferAttributes();\n\t\n\t // Run common destruction logic from parent\n\t _get(Object.getPrototypeOf(PointLayer.prototype), 'destroy', this).call(this);\n\t }\n\t }], [{\n\t key: 'isSingle',\n\t value: function isSingle(coordinates) {\n\t return !Array.isArray(coordinates[0]);\n\t }\n\t }]);\n\t\n\t return PointLayer;\n\t})(_Layer3['default']);\n\t\n\texports['default'] = PointLayer;\n\t\n\tvar noNew = function noNew(coordinates, options) {\n\t return new PointLayer(coordinates, options);\n\t};\n\t\n\texports.pointLayer = noNew;\n\n/***/ },\n/* 88 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _GeoJSONTileLayer2 = __webpack_require__(70);\n\t\n\tvar _GeoJSONTileLayer3 = _interopRequireDefault(_GeoJSONTileLayer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar TopoJSONTileLayer = (function (_GeoJSONTileLayer) {\n\t _inherits(TopoJSONTileLayer, _GeoJSONTileLayer);\n\t\n\t function TopoJSONTileLayer(path, options) {\n\t _classCallCheck(this, TopoJSONTileLayer);\n\t\n\t var defaults = {\n\t topojson: true\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(TopoJSONTileLayer.prototype), 'constructor', this).call(this, path, options);\n\t }\n\t\n\t return TopoJSONTileLayer;\n\t})(_GeoJSONTileLayer3['default']);\n\t\n\texports['default'] = TopoJSONTileLayer;\n\t\n\tvar noNew = function noNew(path, options) {\n\t return new TopoJSONTileLayer(path, options);\n\t};\n\t\n\texports.topoJSONTileLayer = noNew;\n\n/***/ },\n/* 89 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\t\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\t\n\tvar _GeoJSONLayer2 = __webpack_require__(72);\n\t\n\tvar _GeoJSONLayer3 = _interopRequireDefault(_GeoJSONLayer2);\n\t\n\tvar _lodashAssign = __webpack_require__(3);\n\t\n\tvar _lodashAssign2 = _interopRequireDefault(_lodashAssign);\n\t\n\tvar TopoJSONLayer = (function (_GeoJSONLayer) {\n\t _inherits(TopoJSONLayer, _GeoJSONLayer);\n\t\n\t function TopoJSONLayer(topojson, options) {\n\t _classCallCheck(this, TopoJSONLayer);\n\t\n\t var defaults = {\n\t topojson: true\n\t };\n\t\n\t options = (0, _lodashAssign2['default'])({}, defaults, options);\n\t\n\t _get(Object.getPrototypeOf(TopoJSONLayer.prototype), 'constructor', this).call(this, topojson, options);\n\t }\n\t\n\t return TopoJSONLayer;\n\t})(_GeoJSONLayer3['default']);\n\t\n\texports['default'] = TopoJSONLayer;\n\t\n\tvar noNew = function noNew(topojson, options) {\n\t return new TopoJSONLayer(topojson, options);\n\t};\n\t\n\t// Initialise without requiring new keyword\n\texports.topoJSONLayer = noNew;\n\n/***/ },\n/* 90 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tObject.defineProperty(exports, '__esModule', {\n\t value: true\n\t});\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\t\n\t// TODO: A lot of these utils don't need to be in separate, tiny files\n\t\n\tvar _Transformation = __webpack_require__(14);\n\t\n\tvar _Transformation2 = _interopRequireDefault(_Transformation);\n\t\n\tvar _wrapNum = __webpack_require__(12);\n\t\n\tvar _wrapNum2 = _interopRequireDefault(_wrapNum);\n\t\n\tvar _extrudePolygon = __webpack_require__(81);\n\t\n\tvar _extrudePolygon2 = _interopRequireDefault(_extrudePolygon);\n\t\n\tvar _GeoJSON = __webpack_require__(76);\n\t\n\tvar _GeoJSON2 = _interopRequireDefault(_GeoJSON);\n\t\n\tvar _Buffer = __webpack_require__(82);\n\t\n\tvar _Buffer2 = _interopRequireDefault(_Buffer);\n\t\n\tvar Util = {};\n\t\n\tUtil.Transformation = _Transformation2['default'];\n\tUtil.wrapNum = _wrapNum2['default'];\n\tUtil.extrudePolygon = _extrudePolygon2['default'];\n\tUtil.GeoJSON = _GeoJSON2['default'];\n\tUtil.Buffer = _Buffer2['default'];\n\t\n\texports['default'] = Util;\n\tmodule.exports = exports['default'];\n\n/***/ }\n/******/ ])\n});\n;"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 336199aca5474e84dce3\n **/","import World, {world} from './World';\nimport Controls from './controls/index';\n\nimport Layer, {layer} from './layer/Layer';\nimport EnvironmentLayer, {environmentLayer} from './layer/environment/EnvironmentLayer';\nimport ImageTileLayer, {imageTileLayer} from './layer/tile/ImageTileLayer';\nimport GeoJSONTileLayer, {geoJSONTileLayer} from './layer/tile/GeoJSONTileLayer';\nimport TopoJSONTileLayer, {topoJSONTileLayer} from './layer/tile/TopoJSONTileLayer';\nimport GeoJSONLayer, {geoJSONLayer} from './layer/GeoJSONLayer';\nimport TopoJSONLayer, {topoJSONLayer} from './layer/TopoJSONLayer';\nimport PolygonLayer, {polygonLayer} from './layer/geometry/PolygonLayer';\nimport PolylineLayer, {polylineLayer} from './layer/geometry/PolylineLayer';\nimport PointLayer, {pointLayer} from './layer/geometry/PointLayer';\n\nimport Point, {point} from './geo/Point';\nimport LatLon, {latLon} from './geo/LatLon';\n\nimport Util from './util/index';\n\nconst VIZI = {\n version: '0.3',\n\n // Public API\n World: World,\n world: world,\n Controls: Controls,\n Layer: Layer,\n layer: layer,\n EnvironmentLayer: EnvironmentLayer,\n environmentLayer: environmentLayer,\n ImageTileLayer: ImageTileLayer,\n imageTileLayer: imageTileLayer,\n GeoJSONTileLayer: GeoJSONTileLayer,\n geoJSONTileLayer: geoJSONTileLayer,\n TopoJSONTileLayer: TopoJSONTileLayer,\n topoJSONTileLayer: topoJSONTileLayer,\n GeoJSONLayer: GeoJSONLayer,\n geoJSONLayer: geoJSONLayer,\n TopoJSONLayer: TopoJSONLayer,\n topoJSONLayer: topoJSONLayer,\n PolygonLayer: PolygonLayer,\n polygonLayer: polygonLayer,\n PolylineLayer: PolylineLayer,\n polylineLayer: polylineLayer,\n PointLayer: PointLayer,\n pointLayer: pointLayer,\n Point: Point,\n point: point,\n LatLon: LatLon,\n latLon: latLon,\n Util: Util\n};\n\nexport default VIZI;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vizicities.js\n **/","import EventEmitter from 'eventemitter3';\nimport extend from 'lodash.assign';\nimport CRS from './geo/crs/index';\nimport {point as Point} from './geo/Point';\nimport {latLon as LatLon} from './geo/LatLon';\nimport Engine from './engine/Engine';\nimport EnvironmentLayer from './layer/environment/EnvironmentLayer';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// Pretty much any event someone using ViziCities would need will be emitted or\n// proxied by World (eg. render events, etc)\n\nclass World extends EventEmitter {\n constructor(domId, options) {\n super();\n\n var defaults = {\n crs: CRS.EPSG3857,\n skybox: false,\n postProcessing: false\n };\n\n this.options = extend({}, defaults, options);\n\n this._layers = [];\n this._controls = [];\n\n this._initContainer(domId);\n this._initEngine();\n this._initEnvironment();\n this._initEvents();\n\n this._pause = false;\n\n // Kick off the update and render loop\n this._update();\n }\n\n _initContainer(domId) {\n this._container = document.getElementById(domId);\n }\n\n _initEngine() {\n this._engine = new Engine(this._container, this);\n\n // Engine events\n //\n // Consider proxying these through events on World for public access\n // this._engine.on('preRender', () => {});\n // this._engine.on('postRender', () => {});\n }\n\n _initEnvironment() {\n // Not sure if I want to keep this as a private API\n //\n // Makes sense to allow others to customise their environment so perhaps\n // add some method of disable / overriding the environment settings\n this._environment = new EnvironmentLayer({\n skybox: this.options.skybox\n }).addTo(this);\n }\n\n _initEvents() {\n this.on('controlsMoveEnd', this._onControlsMoveEnd);\n }\n\n _onControlsMoveEnd(point) {\n var _point = Point(point.x, point.z);\n this._resetView(this.pointToLatLon(_point), _point);\n }\n\n // Reset world view\n _resetView(latlon, point) {\n this.emit('preResetView');\n\n this._moveStart();\n this._move(latlon, point);\n this._moveEnd();\n\n this.emit('postResetView');\n }\n\n _moveStart() {\n this.emit('moveStart');\n }\n\n _move(latlon, point) {\n this._lastPosition = latlon;\n this.emit('move', latlon, point);\n }\n _moveEnd() {\n this.emit('moveEnd');\n }\n\n _update() {\n if (this._pause) {\n return;\n }\n\n var delta = this._engine.clock.getDelta();\n\n // Once _update is called it will run forever, for now\n window.requestAnimationFrame(this._update.bind(this));\n\n // Update controls\n this._controls.forEach(controls => {\n controls.update();\n });\n\n this.emit('preUpdate', delta);\n this._engine.update(delta);\n this.emit('postUpdate', delta);\n }\n\n // Set world view\n setView(latlon) {\n // Store initial geographic coordinate for the [0,0,0] world position\n //\n // The origin point doesn't move in three.js / 3D space so only set it once\n // here instead of every time _resetView is called\n //\n // If it was updated every time then coorindates would shift over time and\n // would be out of place / context with previously-placed points (0,0 would\n // refer to a different point each time)\n this._originLatlon = latlon;\n this._originPoint = this.project(latlon);\n\n this._resetView(latlon);\n return this;\n }\n\n // Return world geographic position\n getPosition() {\n return this._lastPosition;\n }\n\n // Transform geographic coordinate to world point\n //\n // This doesn't take into account the origin offset\n //\n // For example, this takes a geographic coordinate and returns a point\n // relative to the origin point of the projection (not the world)\n project(latlon) {\n return this.options.crs.latLonToPoint(LatLon(latlon));\n }\n\n // Transform world point to geographic coordinate\n //\n // This doesn't take into account the origin offset\n //\n // For example, this takes a point relative to the origin point of the\n // projection (not the world) and returns a geographic coordinate\n unproject(point) {\n return this.options.crs.pointToLatLon(Point(point));\n }\n\n // Takes into account the origin offset\n //\n // For example, this takes a geographic coordinate and returns a point\n // relative to the three.js / 3D origin (0,0)\n latLonToPoint(latlon) {\n var projectedPoint = this.project(LatLon(latlon));\n return projectedPoint._subtract(this._originPoint);\n }\n\n // Takes into account the origin offset\n //\n // For example, this takes a point relative to the three.js / 3D origin (0,0)\n // and returns the exact geographic coordinate at that point\n pointToLatLon(point) {\n var projectedPoint = Point(point).add(this._originPoint);\n return this.unproject(projectedPoint);\n }\n\n // Return pointscale for a given geographic coordinate\n pointScale(latlon, accurate) {\n return this.options.crs.pointScale(latlon, accurate);\n }\n\n // Convert from real meters to world units\n //\n // TODO: Would be nice not to have to pass in a pointscale here\n metresToWorld(metres, pointScale, zoom) {\n return this.options.crs.metresToWorld(metres, pointScale, zoom);\n }\n\n // Convert from real meters to world units\n //\n // TODO: Would be nice not to have to pass in a pointscale here\n worldToMetres(worldUnits, pointScale, zoom) {\n return this.options.crs.worldToMetres(worldUnits, pointScale, zoom);\n }\n\n // Unsure if it's a good idea to expose this here for components like\n // GridLayer to use (eg. to keep track of a frustum)\n getCamera() {\n return this._engine._camera;\n }\n\n addLayer(layer) {\n layer._addToWorld(this);\n\n this._layers.push(layer);\n\n if (layer.isOutput() && layer.isOutputToScene()) {\n // Could move this into Layer but it'll do here for now\n this._engine._scene.add(layer._object3D);\n this._engine._domScene3D.add(layer._domObject3D);\n this._engine._domScene2D.add(layer._domObject2D);\n }\n\n this.emit('layerAdded', layer);\n return this;\n }\n\n // Remove layer from world and scene but don't destroy it entirely\n removeLayer(layer) {\n var layerIndex = this._layers.indexOf(layer);\n\n if (layerIndex > -1) {\n // Remove from this._layers\n this._layers.splice(layerIndex, 1);\n };\n\n if (layer.isOutput() && layer.isOutputToScene()) {\n this._engine._scene.remove(layer._object3D);\n this._engine._domScene3D.remove(layer._domObject3D);\n this._engine._domScene2D.remove(layer._domObject2D);\n }\n\n this.emit('layerRemoved');\n return this;\n }\n\n addControls(controls) {\n controls._addToWorld(this);\n\n this._controls.push(controls);\n\n this.emit('controlsAdded', controls);\n return this;\n }\n\n // Remove controls from world but don't destroy them entirely\n removeControls(controls) {\n var controlsIndex = this._controls.indexOf(controlsIndex);\n\n if (controlsIndex > -1) {\n this._controls.splice(controlsIndex, 1);\n };\n\n this.emit('controlsRemoved', controls);\n return this;\n }\n\n stop() {\n this._pause = true;\n }\n\n start() {\n this._pause = false;\n this._update();\n }\n\n // Destroys the world(!) and removes it from the scene and memory\n //\n // TODO: World out why so much three.js stuff is left in the heap after this\n destroy() {\n this.stop();\n\n // Remove listeners\n this.off('controlsMoveEnd', this._onControlsMoveEnd);\n\n var i;\n\n // Remove all controls\n var controls;\n for (i = this._controls.length - 1; i >= 0; i--) {\n controls = this._controls[0];\n this.removeControls(controls);\n controls.destroy();\n };\n\n // Remove all layers\n var layer;\n for (i = this._layers.length - 1; i >= 0; i--) {\n layer = this._layers[0];\n this.removeLayer(layer);\n layer.destroy();\n };\n\n // Environment layer is removed with the other layers\n this._environment = null;\n\n this._engine.destroy();\n this._engine = null;\n\n // TODO: Probably should clean the container too / remove the canvas\n this._container = null;\n }\n}\n\nexport default World;\n\nvar noNew = function(domId, options) {\n return new World(domId, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as world};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/World.js\n **/","'use strict';\n\n//\n// We store our EE objects in a plain object whose properties are event names.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// `~` to make sure that the built-in object properties are not overridden or\n// used as an attack vector.\n// We also assume that `Object.create(null)` is available when the event name\n// is an ES6 Symbol.\n//\nvar prefix = typeof Object.create !== 'function' ? '~' : false;\n\n/**\n * Representation of a single EventEmitter function.\n *\n * @param {Function} fn Event handler to be called.\n * @param {Mixed} context Context for function execution.\n * @param {Boolean} once Only emit once\n * @api private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Minimal EventEmitter interface that is molded against the Node.js\n * EventEmitter interface.\n *\n * @constructor\n * @api public\n */\nfunction EventEmitter() { /* Nothing to set */ }\n\n/**\n * Holds the assigned EventEmitters by name.\n *\n * @type {Object}\n * @private\n */\nEventEmitter.prototype._events = undefined;\n\n/**\n * Return a list of assigned event listeners.\n *\n * @param {String} event The events that should be listed.\n * @param {Boolean} exists We only need to know if there are listeners.\n * @returns {Array|Boolean}\n * @api public\n */\nEventEmitter.prototype.listeners = function listeners(event, exists) {\n var evt = prefix ? prefix + event : event\n , available = this._events && this._events[evt];\n\n if (exists) return !!available;\n if (!available) return [];\n if (available.fn) return [available.fn];\n\n for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {\n ee[i] = available[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Emit an event to all registered event listeners.\n *\n * @param {String} event The name of the event.\n * @returns {Boolean} Indication if we've emitted an event.\n * @api public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events || !this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if ('function' === typeof listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Register a new EventListener for the given event.\n *\n * @param {String} event Name of the event.\n * @param {Functon} fn Callback function.\n * @param {Mixed} context The context of the function.\n * @api public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n var listener = new EE(fn, context || this)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events) this._events = prefix ? {} : Object.create(null);\n if (!this._events[evt]) this._events[evt] = listener;\n else {\n if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [\n this._events[evt], listener\n ];\n }\n\n return this;\n};\n\n/**\n * Add an EventListener that's only called once.\n *\n * @param {String} event Name of the event.\n * @param {Function} fn Callback function.\n * @param {Mixed} context The context of the function.\n * @api public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n var listener = new EE(fn, context || this, true)\n , evt = prefix ? prefix + event : event;\n\n if (!this._events) this._events = prefix ? {} : Object.create(null);\n if (!this._events[evt]) this._events[evt] = listener;\n else {\n if (!this._events[evt].fn) this._events[evt].push(listener);\n else this._events[evt] = [\n this._events[evt], listener\n ];\n }\n\n return this;\n};\n\n/**\n * Remove event listeners.\n *\n * @param {String} event The event we want to remove.\n * @param {Function} fn The listener that we need to find.\n * @param {Mixed} context Only remove listeners matching this context.\n * @param {Boolean} once Only remove once listeners.\n * @api public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events || !this._events[evt]) return this;\n\n var listeners = this._events[evt]\n , events = [];\n\n if (fn) {\n if (listeners.fn) {\n if (\n listeners.fn !== fn\n || (once && !listeners.once)\n || (context && listeners.context !== context)\n ) {\n events.push(listeners);\n }\n } else {\n for (var i = 0, length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn\n || (once && !listeners[i].once)\n || (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) {\n this._events[evt] = events.length === 1 ? events[0] : events;\n } else {\n delete this._events[evt];\n }\n\n return this;\n};\n\n/**\n * Remove all listeners or only the listeners for the specified event.\n *\n * @param {String} event The event want to remove all listeners for.\n * @api public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n if (!this._events) return this;\n\n if (event) delete this._events[prefix ? prefix + event : event];\n else this._events = prefix ? {} : Object.create(null);\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// This function doesn't apply anymore.\n//\nEventEmitter.prototype.setMaxListeners = function setMaxListeners() {\n return this;\n};\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/eventemitter3/index.js\n ** module id = 2\n ** module chunks = 0\n **/","/**\n * lodash 4.0.2 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar keys = require('lodash.keys'),\n rest = require('lodash.rest');\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if ((!eq(objValue, value) ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object) {\n return copyObjectWith(source, props, object);\n}\n\n/**\n * This function is like `copyObject` except that it accepts a function to\n * customize copied values.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObjectWith(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index],\n newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key];\n\n assignValue(object, key, newValue);\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return rest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = typeof customizer == 'function' ? (length--, customizer) : undefined;\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Checks if the provided arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Performs a [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'user': 'fred' };\n * var other = { 'user': 'fred' };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null &&\n !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Assigns own enumerable properties of source objects to the destination\n * object. Source objects are applied from left to right. Subsequent sources\n * overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object` and is loosely based on\n * [`Object.assign`](https://mdn.io/Object/assign).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.c = 3;\n * }\n *\n * function Bar() {\n * this.e = 5;\n * }\n *\n * Foo.prototype.d = 4;\n * Bar.prototype.f = 6;\n *\n * _.assign({ 'a': 1 }, new Foo, new Bar);\n * // => { 'a': 1, 'c': 3, 'e': 5 }\n */\nvar assign = createAssigner(function(object, source) {\n copyObject(source, keys(source), object);\n});\n\nmodule.exports = assign;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.assign/index.js\n ** module id = 3\n ** module chunks = 0\n **/","/**\n * lodash 4.0.2 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n stringTag = '[object String]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar getPrototypeOf = Object.getPrototypeOf,\n propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = Object.keys;\n\n/**\n * The base implementation of `_.has` without support for deep paths.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} key The key to check.\n * @returns {boolean} Returns `true` if `key` exists, else `false`.\n */\nfunction baseHas(object, key) {\n // Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,\n // that are composed entirely of index properties, return `false` for\n // `hasOwnProperty` checks of them.\n return hasOwnProperty.call(object, key) ||\n (typeof object == 'object' && key in object && getPrototypeOf(object) === null);\n}\n\n/**\n * The base implementation of `_.keys` which doesn't skip the constructor\n * property of prototypes or treat sparse arrays as dense.\n *\n * @private\n * @type Function\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n return nativeKeys(Object(object));\n}\n\n/**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\nfunction baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n}\n\n/**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\nvar getLength = baseProperty('length');\n\n/**\n * Creates an array of index keys for `object` values of arrays,\n * `arguments` objects, and strings, otherwise `null` is returned.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array|null} Returns index keys, else `null`.\n */\nfunction indexKeys(object) {\n var length = object ? object.length : undefined;\n if (isLength(length) &&\n (isArray(object) || isString(object) || isArguments(object))) {\n return baseTimes(length, String);\n }\n return null;\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null &&\n !(typeof value == 'function' && isFunction(value)) && isLength(getLength(value));\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\nfunction isString(value) {\n return typeof value == 'string' ||\n (!isArray(value) && isObjectLike(value) && objectToString.call(value) == stringTag);\n}\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n var isProto = isPrototype(object);\n if (!(isProto || isArrayLike(object))) {\n return baseKeys(object);\n }\n var indexes = indexKeys(object),\n skipIndexes = !!indexes,\n result = indexes || [],\n length = result.length;\n\n for (var key in object) {\n if (baseHas(object, key) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length))) &&\n !(isProto && key == 'constructor')) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = keys;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.keys/index.js\n ** module id = 4\n ** module chunks = 0\n **/","/**\n * lodash 4.0.1 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_INTEGER = 1.7976931348623157e+308,\n NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {...*} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n var length = args.length;\n switch (length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as an array.\n *\n * **Note:** This method is based on the [rest parameter](https://mdn.io/rest_parameters).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.rest(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\nfunction rest(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n switch (start) {\n case 0: return func.call(this, array);\n case 1: return func.call(this, args[0], array);\n case 2: return func.call(this, args[0], args[1], array);\n }\n var otherArgs = Array(start + 1);\n index = -1;\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = array;\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Converts `value` to an integer.\n *\n * **Note:** This function is loosely based on [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.toInteger(3);\n * // => 3\n *\n * _.toInteger(Number.MIN_VALUE);\n * // => 0\n *\n * _.toInteger(Infinity);\n * // => 1.7976931348623157e+308\n *\n * _.toInteger('3');\n * // => 3\n */\nfunction toInteger(value) {\n if (!value) {\n return value === 0 ? value : 0;\n }\n value = toNumber(value);\n if (value === INFINITY || value === -INFINITY) {\n var sign = (value < 0 ? -1 : 1);\n return sign * MAX_INTEGER;\n }\n var remainder = value % 1;\n return value === value ? (remainder ? value - remainder : value) : 0;\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3);\n * // => 3\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3');\n * // => 3\n */\nfunction toNumber(value) {\n if (isObject(value)) {\n var other = isFunction(value.valueOf) ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = rest;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.rest/index.js\n ** module id = 5\n ** module chunks = 0\n **/","import EPSG3857 from './CRS.EPSG3857';\nimport {EPSG900913} from './CRS.EPSG3857';\nimport EPSG3395 from './CRS.EPSG3395';\nimport EPSG4326 from './CRS.EPSG4326';\nimport Simple from './CRS.Simple';\nimport Proj4 from './CRS.Proj4';\n\nconst CRS = {};\n\nCRS.EPSG3857 = EPSG3857;\nCRS.EPSG900913 = EPSG900913;\nCRS.EPSG3395 = EPSG3395;\nCRS.EPSG4326 = EPSG4326;\nCRS.Simple = Simple;\nCRS.Proj4 = Proj4;\n\nexport default CRS;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/index.js\n **/","/*\n * CRS.EPSG3857 (WGS 84 / Pseudo-Mercator) CRS implementation.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3857.js\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport SphericalMercator from '../projection/Projection.SphericalMercator';\nimport Transformation from '../../util/Transformation';\n\nvar _EPSG3857 = {\n code: 'EPSG:3857',\n projection: SphericalMercator,\n\n // Work out how to de-dupe this (scoping issue)\n transformScale: 1 / (Math.PI * SphericalMercator.R),\n\n // Scale and transformation inputs changed to account for central origin in\n // WebGL, instead of top-left origin used in Leaflet\n transformation: (function() {\n // TODO: Cannot use this.transformScale due to scope\n var scale = 1 / (Math.PI * SphericalMercator.R);\n\n return new Transformation(scale, 0, -scale, 0);\n }())\n};\n\nconst EPSG3857 = extend({}, Earth, _EPSG3857);\n\nconst EPSG900913 = extend({}, EPSG3857, {\n code: 'EPSG:900913'\n});\n\nexport {EPSG900913};\n\nexport default EPSG3857;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.EPSG3857.js\n **/","/*\n * CRS.Earth is the base class for all CRS representing Earth.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Earth.js\n */\n\nimport extend from 'lodash.assign';\nimport CRS from './CRS';\nimport {latLon as LatLon} from '../LatLon';\n\nconst Earth = {\n wrapLon: [-180, 180],\n\n R: 6378137,\n\n // Distance between two geographical points using spherical law of cosines\n // approximation or Haversine\n //\n // See: http://www.movable-type.co.uk/scripts/latlong.html\n distance: function(latlon1, latlon2, accurate) {\n var rad = Math.PI / 180;\n\n var lat1;\n var lat2;\n\n var a;\n\n if (!accurate) {\n lat1 = latlon1.lat * rad;\n lat2 = latlon2.lat * rad;\n\n a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((latlon2.lon - latlon1.lon) * rad);\n\n return this.R * Math.acos(Math.min(a, 1));\n } else {\n lat1 = latlon1.lat * rad;\n lat2 = latlon2.lat * rad;\n\n var lon1 = latlon1.lon * rad;\n var lon2 = latlon2.lon * rad;\n\n var deltaLat = lat2 - lat1;\n var deltaLon = lon2 - lon1;\n\n var halfDeltaLat = deltaLat / 2;\n var halfDeltaLon = deltaLon / 2;\n\n a = Math.sin(halfDeltaLat) * Math.sin(halfDeltaLat) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(halfDeltaLon) * Math.sin(halfDeltaLon);\n\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n\n return this.R * c;\n }\n },\n\n // Scale factor for converting between real metres and projected metres\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n //\n // Defaults to a scale factor of 1 if no calculation method exists\n //\n // Probably need to run this through the CRS transformation or similar so the\n // resulting scale is relative to the dimensions of the world space\n // Eg. 1 metre in projected space is likly scaled up or down to some other\n // number\n pointScale: function(latlon, accurate) {\n return (this.projection.pointScale) ? this.projection.pointScale(latlon, accurate) : [1, 1];\n },\n\n // Convert real metres to projected units\n //\n // Latitude scale is chosen because it fluctuates more than longitude\n metresToProjected: function(metres, pointScale) {\n return metres * pointScale[1];\n },\n\n // Convert projected units to real metres\n //\n // Latitude scale is chosen because it fluctuates more than longitude\n projectedToMetres: function(projectedUnits, pointScale) {\n return projectedUnits / pointScale[1];\n },\n\n // Convert real metres to a value in world (WebGL) units\n metresToWorld: function(metres, pointScale, zoom) {\n // Transform metres to projected metres using the latitude point scale\n //\n // Latitude scale is chosen because it fluctuates more than longitude\n var projectedMetres = this.metresToProjected(metres, pointScale);\n\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n // Scale projected metres\n var scaledMetres = (scale * (this.transformScale * projectedMetres));\n\n // Not entirely sure why this is neccessary\n if (zoom) {\n scaledMetres /= pointScale[1];\n }\n\n return scaledMetres;\n },\n\n // Convert world (WebGL) units to a value in real metres\n worldToMetres: function(worldUnits, pointScale, zoom) {\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n var projectedUnits = ((worldUnits / scale) / this.transformScale);\n var realMetres = this.projectedToMetres(projectedUnits, pointScale);\n\n // Not entirely sure why this is neccessary\n if (zoom) {\n realMetres *= pointScale[1];\n }\n\n return realMetres;\n }\n};\n\nexport default extend({}, CRS, Earth);\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.Earth.js\n **/","/*\n * CRS is the base object for all defined CRS (Coordinate Reference Systems)\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\nimport wrapNum from '../../util/wrapNum';\n\nconst CRS = {\n // Scale factor determines final dimensions of world space\n //\n // Projection transformation in range -1 to 1 is multiplied by scale factor to\n // find final world coordinates\n //\n // Scale factor can be considered as half the amount of the desired dimension\n // for the largest side when transformation is equal to 1 or -1, or as the\n // distance between 0 and 1 on the largest side\n //\n // For example, if you want the world dimensions to be between -1000 and 1000\n // then the scale factor will be 1000\n scaleFactor: 1000000,\n\n // Converts geo coords to pixel / WebGL ones\n latLonToPoint: function(latlon, zoom) {\n var projectedPoint = this.projection.project(latlon);\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n return this.transformation._transform(projectedPoint, scale);\n },\n\n // Converts pixel / WebGL coords to geo coords\n pointToLatLon: function(point, zoom) {\n var scale = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n scale /= 2;\n }\n\n var untransformedPoint = this.transformation.untransform(point, scale);\n\n return this.projection.unproject(untransformedPoint);\n },\n\n // Converts geo coords to projection-specific coords (e.g. in meters)\n project: function(latlon) {\n return this.projection.project(latlon);\n },\n\n // Converts projected coords to geo coords\n unproject: function(point) {\n return this.projection.unproject(point);\n },\n\n // If zoom is provided, returns the map width in pixels for a given zoom\n // Else, provides fixed scale value\n scale: function(zoom) {\n // If zoom is provided then return scale based on map tile zoom\n if (zoom >= 0) {\n return 256 * Math.pow(2, zoom);\n // Else, return fixed scale value to expand projected coordinates from\n // their 0 to 1 range into something more practical\n } else {\n return this.scaleFactor;\n }\n },\n\n // Returns zoom level for a given scale value\n // This only works with a scale value that is based on map pixel width\n zoom: function(scale) {\n return Math.log(scale / 256) / Math.LN2;\n },\n\n // Returns the bounds of the world in projected coords if applicable\n getProjectedBounds: function(zoom) {\n if (this.infinite) { return null; }\n\n var b = this.projection.bounds;\n var s = this.scale(zoom);\n\n // Half scale if using zoom as WebGL origin is in the centre, not top left\n if (zoom) {\n s /= 2;\n }\n\n // Bottom left\n var min = this.transformation.transform(Point(b[0]), s);\n\n // Top right\n var max = this.transformation.transform(Point(b[1]), s);\n\n return [min, max];\n },\n\n // Whether a coordinate axis wraps in a given range (e.g. longitude from -180 to 180); depends on CRS\n // wrapLon: [min, max],\n // wrapLat: [min, max],\n\n // If true, the coordinate space will be unbounded (infinite in all directions)\n // infinite: false,\n\n // Wraps geo coords in certain ranges if applicable\n wrapLatLon: function(latlon) {\n var lat = this.wrapLat ? wrapNum(latlon.lat, this.wrapLat, true) : latlon.lat;\n var lon = this.wrapLon ? wrapNum(latlon.lon, this.wrapLon, true) : latlon.lon;\n var alt = latlon.alt;\n\n return LatLon(lat, lon, alt);\n }\n};\n\nexport default CRS;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.js\n **/","/*\n * LatLon is a helper class for ensuring consistent geographic coordinates.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/LatLng.js\n */\n\nclass LatLon {\n constructor(lat, lon, alt) {\n if (isNaN(lat) || isNaN(lon)) {\n throw new Error('Invalid LatLon object: (' + lat + ', ' + lon + ')');\n }\n\n this.lat = +lat;\n this.lon = +lon;\n\n if (alt !== undefined) {\n this.alt = +alt;\n }\n }\n\n clone() {\n return new LatLon(this.lat, this.lon, this.alt);\n }\n}\n\nexport default LatLon;\n\n// Accepts (LatLon), ([lat, lon, alt]), ([lat, lon]) and (lat, lon, alt)\n// Also converts between lng and lon\nvar noNew = function(a, b, c) {\n if (a instanceof LatLon) {\n return a;\n }\n if (Array.isArray(a) && typeof a[0] !== 'object') {\n if (a.length === 3) {\n return new LatLon(a[0], a[1], a[2]);\n }\n if (a.length === 2) {\n return new LatLon(a[0], a[1]);\n }\n return null;\n }\n if (a === undefined || a === null) {\n return a;\n }\n if (typeof a === 'object' && 'lat' in a) {\n return new LatLon(a.lat, 'lng' in a ? a.lng : a.lon, a.alt);\n }\n if (b === undefined) {\n return null;\n }\n return new LatLon(a, b, c);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as latLon};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/LatLon.js\n **/","/*\n * Point is a helper class for ensuring consistent world positions.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/Point.js\n */\n\nclass Point {\n constructor(x, y, round) {\n this.x = (round ? Math.round(x) : x);\n this.y = (round ? Math.round(y) : y);\n }\n\n clone() {\n return new Point(this.x, this.y);\n }\n\n // Non-destructive\n add(point) {\n return this.clone()._add(_point(point));\n }\n\n // Destructive\n _add(point) {\n this.x += point.x;\n this.y += point.y;\n return this;\n }\n\n // Non-destructive\n subtract(point) {\n return this.clone()._subtract(_point(point));\n }\n\n // Destructive\n _subtract(point) {\n this.x -= point.x;\n this.y -= point.y;\n return this;\n }\n}\n\nexport default Point;\n\n// Accepts (point), ([x, y]) and (x, y, round)\nvar _point = function(x, y, round) {\n if (x instanceof Point) {\n return x;\n }\n if (Array.isArray(x)) {\n return new Point(x[0], x[1]);\n }\n if (x === undefined || x === null) {\n return x;\n }\n return new Point(x, y, round);\n};\n\n// Initialise without requiring new keyword\nexport {_point as point};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/Point.js\n **/","/*\n * Wrap the given number to lie within a certain range (eg. longitude)\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/core/Util.js\n */\n\nvar wrapNum = function(x, range, includeMax) {\n var max = range[1];\n var min = range[0];\n var d = max - min;\n return x === max && includeMax ? x : ((x - min) % d + d) % d + min;\n};\n\nexport default wrapNum;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/wrapNum.js\n **/","/*\n * Spherical Mercator is the most popular map projection, used by EPSG:3857 CRS\n * used by default.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.SphericalMercator.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst SphericalMercator = {\n // Radius / WGS84 semi-major axis\n R: 6378137,\n MAX_LATITUDE: 85.0511287798,\n\n // WGS84 eccentricity\n ECC: 0.081819191,\n ECC2: 0.081819191 * 0.081819191,\n\n project: function(latlon) {\n var d = Math.PI / 180;\n var max = this.MAX_LATITUDE;\n var lat = Math.max(Math.min(max, latlon.lat), -max);\n var sin = Math.sin(lat * d);\n\n return Point(\n this.R * latlon.lon * d,\n this.R * Math.log((1 + sin) / (1 - sin)) / 2\n );\n },\n\n unproject: function(point) {\n var d = 180 / Math.PI;\n\n return LatLon(\n (2 * Math.atan(Math.exp(point.y / this.R)) - (Math.PI / 2)) * d,\n point.x * d / this.R\n );\n },\n\n // Scale factor for converting between real metres and projected metres\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n //\n // Accurate scale factor uses proper Web Mercator scaling\n // See pg.9: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n // See: http://jsfiddle.net/robhawkes/yws924cf/\n pointScale: function(latlon, accurate) {\n var rad = Math.PI / 180;\n\n var k;\n\n if (!accurate) {\n k = 1 / Math.cos(latlon.lat * rad);\n\n // [scaleX, scaleY]\n return [k, k];\n } else {\n var lat = latlon.lat * rad;\n var lon = latlon.lon * rad;\n\n var a = this.R;\n\n var sinLat = Math.sin(lat);\n var sinLat2 = sinLat * sinLat;\n\n var cosLat = Math.cos(lat);\n\n // Radius meridian\n var p = a * (1 - this.ECC2) / Math.pow(1 - this.ECC2 * sinLat2, 3 / 2);\n\n // Radius prime meridian\n var v = a / Math.sqrt(1 - this.ECC2 * sinLat2);\n\n // Scale N/S\n var h = (a / p) / cosLat;\n\n // Scale E/W\n k = (a / v) / cosLat;\n\n // [scaleX, scaleY]\n return [k, h];\n }\n },\n\n // Not using this.R due to scoping\n bounds: (function() {\n var d = 6378137 * Math.PI;\n return [[-d, -d], [d, d]];\n })()\n};\n\nexport default SphericalMercator;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.SphericalMercator.js\n **/","/*\n * Transformation is an utility class to perform simple point transformations\n * through a 2d-matrix.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geometry/Transformation.js\n */\n\nimport {point as Point} from '../geo/Point';\n\nclass Transformation {\n constructor(a, b, c, d) {\n this._a = a;\n this._b = b;\n this._c = c;\n this._d = d;\n }\n\n transform(point, scale) {\n // Copy input point as to not destroy the original data\n return this._transform(point.clone(), scale);\n }\n\n // Destructive transform (faster)\n _transform(point, scale) {\n scale = scale || 1;\n\n point.x = scale * (this._a * point.x + this._b);\n point.y = scale * (this._c * point.y + this._d);\n return point;\n }\n\n untransform(point, scale) {\n scale = scale || 1;\n return Point(\n (point.x / scale - this._b) / this._a,\n (point.y / scale - this._d) / this._c\n );\n }\n}\n\nexport default Transformation;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/Transformation.js\n **/","/*\n * CRS.EPSG3395 (WGS 84 / World Mercator) CRS implementation.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG3395.js\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport Mercator from '../projection/Projection.Mercator';\nimport Transformation from '../../util/Transformation';\n\nvar _EPSG3395 = {\n code: 'EPSG:3395',\n projection: Mercator,\n\n // Work out how to de-dupe this (scoping issue)\n transformScale: 1 / (Math.PI * Mercator.R),\n\n // Scale and transformation inputs changed to account for central origin in\n // WebGL, instead of top-left origin used in Leaflet\n transformation: (function() {\n // TODO: Cannot use this.transformScale due to scope\n var scale = 1 / (Math.PI * Mercator.R);\n\n return new Transformation(scale, 0, -scale, 0);\n }())\n};\n\nconst EPSG3395 = extend({}, Earth, _EPSG3395);\n\nexport default EPSG3395;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.EPSG3395.js\n **/","/*\n * Mercator projection that takes into account that the Earth is not a perfect\n * sphere. Less popular than spherical mercator; used by projections like\n * EPSG:3395.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.Mercator.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst Mercator = {\n // Radius / WGS84 semi-major axis\n R: 6378137,\n R_MINOR: 6356752.314245179,\n\n // WGS84 eccentricity\n ECC: 0.081819191,\n ECC2: 0.081819191 * 0.081819191,\n\n project: function(latlon) {\n var d = Math.PI / 180;\n var r = this.R;\n var y = latlon.lat * d;\n var tmp = this.R_MINOR / r;\n var e = Math.sqrt(1 - tmp * tmp);\n var con = e * Math.sin(y);\n\n var ts = Math.tan(Math.PI / 4 - y / 2) / Math.pow((1 - con) / (1 + con), e / 2);\n y = -r * Math.log(Math.max(ts, 1E-10));\n\n return Point(latlon.lon * d * r, y);\n },\n\n unproject: function(point) {\n var d = 180 / Math.PI;\n var r = this.R;\n var tmp = this.R_MINOR / r;\n var e = Math.sqrt(1 - tmp * tmp);\n var ts = Math.exp(-point.y / r);\n var phi = Math.PI / 2 - 2 * Math.atan(ts);\n\n for (var i = 0, dphi = 0.1, con; i < 15 && Math.abs(dphi) > 1e-7; i++) {\n con = e * Math.sin(phi);\n con = Math.pow((1 - con) / (1 + con), e / 2);\n dphi = Math.PI / 2 - 2 * Math.atan(ts * con) - phi;\n phi += dphi;\n }\n\n return LatLon(phi * d, point.x * d / r);\n },\n\n // Scale factor for converting between real metres and projected metres\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n //\n // See pg.8: http://www.hydrometronics.com/downloads/Web%20Mercator%20-%20Non-Conformal,%20Non-Mercator%20(notes).pdf\n pointScale: function(latlon) {\n var rad = Math.PI / 180;\n var lat = latlon.lat * rad;\n var sinLat = Math.sin(lat);\n var sinLat2 = sinLat * sinLat;\n var cosLat = Math.cos(lat);\n\n var k = Math.sqrt(1 - this.ECC2 * sinLat2) / cosLat;\n\n // [scaleX, scaleY]\n return [k, k];\n },\n\n bounds: [[-20037508.34279, -15496570.73972], [20037508.34279, 18764656.23138]]\n};\n\nexport default Mercator;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.Mercator.js\n **/","/*\n * CRS.EPSG4326 is a CRS popular among advanced GIS specialists.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.EPSG4326.js\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport LatLonProjection from '../projection/Projection.LatLon';\nimport Transformation from '../../util/Transformation';\n\nvar _EPSG4326 = {\n code: 'EPSG:4326',\n projection: LatLonProjection,\n\n // Work out how to de-dupe this (scoping issue)\n transformScale: 1 / 180,\n\n // Scale and transformation inputs changed to account for central origin in\n // WebGL, instead of top-left origin used in Leaflet\n //\n // TODO: Cannot use this.transformScale due to scope\n transformation: new Transformation(1 / 180, 0, -1 / 180, 0)\n};\n\nconst EPSG4326 = extend({}, Earth, _EPSG4326);\n\nexport default EPSG4326;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.EPSG4326.js\n **/","/*\n * Simple equirectangular (Plate Carree) projection, used by CRS like EPSG:4326\n * and Simple.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/projection/Projection.LonLat.js\n */\n\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst ProjectionLatLon = {\n project: function(latlon) {\n return Point(latlon.lon, latlon.lat);\n },\n\n unproject: function(point) {\n return LatLon(point.y, point.x);\n },\n\n // Scale factor for converting between real metres and degrees\n //\n // degrees = realMetres * pointScale\n // realMetres = degrees / pointScale\n //\n // See: http://stackoverflow.com/questions/639695/how-to-convert-latitude-or-longitude-to-meters\n // See: http://gis.stackexchange.com/questions/75528/length-of-a-degree-where-do-the-terms-in-this-formula-come-from\n pointScale: function(latlon) {\n var m1 = 111132.92;\n var m2 = -559.82;\n var m3 = 1.175;\n var m4 = -0.0023;\n var p1 = 111412.84;\n var p2 = -93.5;\n var p3 = 0.118;\n\n var rad = Math.PI / 180;\n var lat = latlon.lat * rad;\n\n var latlen = m1 + m2 * Math.cos(2 * lat) + m3 * Math.cos(4 * lat) + m4 * Math.cos(6 * lat);\n var lonlen = p1 * Math.cos(lat) + p2 * Math.cos(3 * lat) + p3 * Math.cos(5 * lat);\n\n return [1 / latlen, 1 / lonlen];\n },\n\n bounds: [[-180, -90], [180, 90]]\n};\n\nexport default ProjectionLatLon;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.LatLon.js\n **/","/*\n * A simple CRS that can be used for flat non-Earth maps like panoramas or game\n * maps.\n *\n * Based on:\n * https://github.com/Leaflet/Leaflet/blob/master/src/geo/crs/CRS.Simple.js\n */\n\nimport extend from 'lodash.assign';\nimport CRS from './CRS';\nimport LatLonProjection from '../projection/Projection.LatLon';\nimport Transformation from '../../util/Transformation';\n\nvar _Simple = {\n projection: LatLonProjection,\n\n // Straight 1:1 mapping (-1, -1 would be top-left)\n transformation: new Transformation(1, 0, 1, 0),\n\n scale: function(zoom) {\n // If zoom is provided then return scale based on map tile zoom\n if (zoom) {\n return Math.pow(2, zoom);\n // Else, make no change to scale – may need to increase this or make it a\n // user-definable variable\n } else {\n return 1;\n }\n },\n\n zoom: function(scale) {\n return Math.log(scale) / Math.LN2;\n },\n\n distance: function(latlon1, latlon2) {\n var dx = latlon2.lon - latlon1.lon;\n var dy = latlon2.lat - latlon1.lat;\n\n return Math.sqrt(dx * dx + dy * dy);\n },\n\n infinite: true\n};\n\nconst Simple = extend({}, CRS, _Simple);\n\nexport default Simple;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.Simple.js\n **/","/*\n * CRS.Proj4 for any Proj4-supported CRS.\n */\n\nimport extend from 'lodash.assign';\nimport Earth from './CRS.Earth';\nimport Proj4Projection from '../projection/Projection.Proj4';\nimport Transformation from '../../util/Transformation';\n\nvar _Proj4 = function(code, def, bounds) {\n var projection = Proj4Projection(def, bounds);\n\n // Transformation calcuations\n var diffX = projection.bounds[1][0] - projection.bounds[0][0];\n var diffY = projection.bounds[1][1] - projection.bounds[0][1];\n\n var halfX = diffX / 2;\n var halfY = diffY / 2;\n\n // This is the raw scale factor\n var scaleX = 1 / halfX;\n var scaleY = 1 / halfY;\n\n // Find the minimum scale factor\n //\n // The minimum scale factor comes from the largest side and is the one\n // you want to use for both axis so they stay relative in dimension\n var scale = Math.min(scaleX, scaleY);\n\n // Find amount to offset each axis by to make the central point lie on\n // the [0,0] origin\n var offsetX = scale * (projection.bounds[0][0] + halfX);\n var offsetY = scale * (projection.bounds[0][1] + halfY);\n\n return {\n code: code,\n projection: projection,\n\n transformScale: scale,\n\n // Map the input to a [-1,1] range with [0,0] in the centre\n transformation: new Transformation(scale, -offsetX, -scale, offsetY)\n };\n};\n\nconst Proj4 = function(code, def, bounds) {\n return extend({}, Earth, _Proj4(code, def, bounds));\n};\n\nexport default Proj4;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/crs/CRS.Proj4.js\n **/","/*\n * Proj4 support for any projection.\n */\n\nimport proj4 from 'proj4';\nimport {latLon as LatLon} from '../LatLon';\nimport {point as Point} from '../Point';\n\nconst Proj4 = function(def, bounds) {\n var proj = proj4(def);\n\n var project = function(latlon) {\n return Point(proj.forward([latlon.lon, latlon.lat]));\n };\n\n var unproject = function(point) {\n var inverse = proj.inverse([point.x, point.y]);\n return LatLon(inverse[1], inverse[0]);\n };\n\n return {\n project: project,\n unproject: unproject,\n\n // Scale factor for converting between real metres and projected metres\\\n //\n // Need to work out the best way to provide the pointScale calculations\n // for custom, unknown projections (if wanting to override default)\n //\n // For now, user can manually override crs.pointScale or\n // crs.projection.pointScale\n //\n // projectedMetres = realMetres * pointScale\n // realMetres = projectedMetres / pointScale\n pointScale: function(latlon, accurate) {\n return [1, 1];\n },\n\n // Try and calculate bounds if none are provided\n //\n // This will provide incorrect bounds for some projections, so perhaps make\n // bounds a required input instead\n bounds: (function() {\n if (bounds) {\n return bounds;\n } else {\n var bottomLeft = project([-90, -180]);\n var topRight = project([90, 180]);\n\n return [bottomLeft, topRight];\n }\n })()\n };\n};\n\nexport default Proj4;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/geo/projection/Projection.Proj4.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_22__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"proj4\"\n ** module id = 22\n ** module chunks = 0\n **/","import EventEmitter from 'eventemitter3';\nimport THREE from 'three';\nimport Scene from './Scene';\nimport DOMScene3D from './DOMScene3D';\nimport DOMScene2D from './DOMScene2D';\nimport Renderer from './Renderer';\nimport DOMRenderer3D from './DOMRenderer3D';\nimport DOMRenderer2D from './DOMRenderer2D';\nimport Camera from './Camera';\nimport Picking from './Picking';\nimport EffectComposer from './EffectComposer';\nimport RenderPass from '../vendor/RenderPass';\nimport ShaderPass from '../vendor/ShaderPass';\nimport CopyShader from '../vendor/CopyShader';\nimport HorizontalTiltShiftShader from '../vendor/HorizontalTiltShiftShader';\nimport VerticalTiltShiftShader from '../vendor/VerticalTiltShiftShader';\nimport FXAAShader from '../vendor/FXAAShader';\n\nclass Engine extends EventEmitter {\n constructor(container, world) {\n console.log('Init Engine');\n\n super();\n\n this._world = world;\n\n this._scene = Scene;\n this._domScene3D = DOMScene3D;\n this._domScene2D = DOMScene2D;\n\n var antialias = (this._world.options.postProcessing) ? false : true;\n this._renderer = Renderer(container, antialias);\n this._domRenderer3D = DOMRenderer3D(container);\n this._domRenderer2D = DOMRenderer2D(container);\n\n this._camera = Camera(container);\n\n this._container = container;\n\n // TODO: Make this optional\n this._picking = Picking(this._world, this._renderer, this._camera);\n\n this.clock = new THREE.Clock();\n\n this._frustum = new THREE.Frustum();\n\n if (this._world.options.postProcessing) {\n this._initPostProcessing();\n }\n }\n\n // TODO: Set up composer to automatically resize on viewport change\n // TODO: Update passes that rely on width / height on resize\n // TODO: Merge default passes into a single shader / pass for performance\n _initPostProcessing() {\n var renderPass = new RenderPass(this._scene, this._camera);\n\n // TODO: Look at using @mattdesl's optimised FXAA shader\n // https://github.com/mattdesl/three-shader-fxaa\n var fxaaPass = new ShaderPass(FXAAShader);\n\n var hblurPass = new ShaderPass(HorizontalTiltShiftShader);\n var vblurPass = new ShaderPass(VerticalTiltShiftShader);\n var bluriness = 5;\n\n hblurPass.uniforms.r.value = vblurPass.uniforms.r.value = 0.6;\n\n var copyPass = new ShaderPass(CopyShader);\n copyPass.renderToScreen = true;\n\n this._composer = EffectComposer(this._renderer, this._container);\n\n this._composer.addPass(renderPass);\n this._composer.addPass(fxaaPass);\n this._composer.addPass(hblurPass);\n this._composer.addPass(vblurPass);\n this._composer.addPass(copyPass);\n\n var self = this;\n var updatePostProcessingSize = function() {\n var width = self._container.clientWidth;\n var height = self._container.clientHeight;\n\n var pixelRatio = window.devicePixelRatio;\n\n fxaaPass.uniforms.resolution.value.set(1 / (width * pixelRatio), 1 / (height * pixelRatio));\n\n hblurPass.uniforms.h.value = bluriness / (width * pixelRatio);\n vblurPass.uniforms.v.value = bluriness / (height * pixelRatio);\n };\n\n updatePostProcessingSize();\n window.addEventListener('resize', updatePostProcessingSize, false);\n }\n\n update(delta) {\n this.emit('preRender');\n\n if (this._world.options.postProcessing) {\n this._composer.render(delta);\n } else {\n this._renderer.render(this._scene, this._camera);\n }\n\n // Render picking scene\n // this._renderer.render(this._picking._pickingScene, this._camera);\n\n // Render DOM scenes\n this._domRenderer3D.render(this._domScene3D, this._camera);\n this._domRenderer2D.render(this._domScene2D, this._camera);\n\n this.emit('postRender');\n }\n\n destroy() {\n // Remove any remaining objects from scene\n var child;\n for (var i = this._scene.children.length - 1; i >= 0; i--) {\n child = this._scene.children[i];\n\n if (!child) {\n continue;\n }\n\n this._scene.remove(child);\n\n if (child.geometry) {\n // Dispose of mesh and materials\n child.geometry.dispose();\n child.geometry = null;\n }\n\n if (child.material) {\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n }\n };\n\n for (var i = this._domScene3D.children.length - 1; i >= 0; i--) {\n child = this._domScene3D.children[i];\n\n if (!child) {\n continue;\n }\n\n this._domScene3D.remove(child);\n };\n\n for (var i = this._domScene2D.children.length - 1; i >= 0; i--) {\n child = this._domScene2D.children[i];\n\n if (!child) {\n continue;\n }\n\n this._domScene2D.remove(child);\n };\n\n this._picking.destroy();\n this._picking = null;\n\n this._world = null;\n this._scene = null;\n this._domScene3D = null;\n this._domScene2D = null;\n\n this._composer = null;\n this._renderer = null;\n\n this._domRenderer3D = null;\n this._domRenderer2D = null;\n this._camera = null;\n this._clock = null;\n this._frustum = null;\n }\n}\n\nexport default Engine;\n\n// // Initialise without requiring new keyword\n// export default function(container, world) {\n// return new Engine(container, world);\n// };\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Engine.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_24__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"THREE\"\n ** module id = 24\n ** module chunks = 0\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.scene\n\nexport default (function() {\n var scene = new THREE.Scene();\n\n // TODO: Re-enable when this works with the skybox\n // scene.fog = new THREE.Fog(0xffffff, 1, 15000);\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Scene.js\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.scene\n\nexport default (function() {\n var scene = new THREE.Scene();\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMScene3D.js\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.scene\n\nexport default (function() {\n var scene = new THREE.Scene();\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMScene2D.js\n **/","import THREE from 'three';\nimport Scene from './Scene';\n\n// This can only be accessed from Engine.renderer if you want to reference the\n// same scene in multiple places\n\nexport default function(container, antialias) {\n var renderer = new THREE.WebGLRenderer({\n antialias: antialias\n });\n\n // TODO: Re-enable when this works with the skybox\n // renderer.setClearColor(Scene.fog.color, 1);\n\n renderer.setClearColor(0xffffff, 1);\n renderer.setPixelRatio(window.devicePixelRatio);\n\n // Gamma settings make things look nicer\n renderer.gammaInput = true;\n renderer.gammaOutput = true;\n\n renderer.shadowMap.enabled = true;\n\n // TODO: Work out which of the shadowmap types is best\n // https://github.com/mrdoob/three.js/blob/r56/src/Three.js#L107\n // renderer.shadowMap.type = THREE.PCFSoftShadowMap;\n\n // TODO: Check that leaving this as default (CullFrontFace) is right\n // renderer.shadowMap.cullFace = THREE.CullFaceBack;\n\n container.appendChild(renderer.domElement);\n\n var updateSize = function() {\n renderer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return renderer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Renderer.js\n **/","import THREE from 'three';\nimport {CSS3DRenderer} from '../vendor/CSS3DRenderer';\nimport DOMScene3D from './DOMScene3D';\n\n// This can only be accessed from Engine.renderer if you want to reference the\n// same scene in multiple places\n\nexport default function(container) {\n var renderer = new CSS3DRenderer();\n\n renderer.domElement.style.position = 'absolute';\n renderer.domElement.style.top = 0;\n\n container.appendChild(renderer.domElement);\n\n var updateSize = function() {\n renderer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return renderer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMRenderer3D.js\n **/","// jscs:disable\n/* eslint-disable */\n\n/**\n * Based on http://www.emagix.net/academic/mscs-project/item/camera-sync-with-css3-and-webgl-threejs\n * @author mrdoob / http://mrdoob.com/\n */\n\nimport THREE from 'three';\n\nvar CSS3DObject = function ( element ) {\n\n\tTHREE.Object3D.call( this );\n\n\tthis.element = element;\n\tthis.element.style.position = 'absolute';\n\n\tthis.addEventListener( 'removed', function ( event ) {\n\n\t\tif ( this.element.parentNode !== null ) {\n\n\t\t\tthis.element.parentNode.removeChild( this.element );\n\n\t\t}\n\n\t} );\n\n};\n\nCSS3DObject.prototype = Object.create( THREE.Object3D.prototype );\nCSS3DObject.prototype.constructor = CSS3DObject;\n\nvar CSS3DSprite = function ( element ) {\n\n\tCSS3DObject.call( this, element );\n\n};\n\nCSS3DSprite.prototype = Object.create( CSS3DObject.prototype );\nCSS3DSprite.prototype.constructor = CSS3DSprite;\n\n//\n\nvar CSS3DRenderer = function () {\n\n\tconsole.log( 'THREE.CSS3DRenderer', THREE.REVISION );\n\n\tvar _width, _height;\n\tvar _widthHalf, _heightHalf;\n\n\tvar matrix = new THREE.Matrix4();\n\n\tvar cache = {\n\t\tcamera: { fov: 0, style: '' },\n\t\tobjects: {}\n\t};\n\n\tvar domElement = document.createElement( 'div' );\n\tdomElement.style.overflow = 'hidden';\n\n\tdomElement.style.WebkitTransformStyle = 'preserve-3d';\n\tdomElement.style.MozTransformStyle = 'preserve-3d';\n\tdomElement.style.oTransformStyle = 'preserve-3d';\n\tdomElement.style.transformStyle = 'preserve-3d';\n\n\tthis.domElement = domElement;\n\n\tvar cameraElement = document.createElement( 'div' );\n\n\tcameraElement.style.WebkitTransformStyle = 'preserve-3d';\n\tcameraElement.style.MozTransformStyle = 'preserve-3d';\n\tcameraElement.style.oTransformStyle = 'preserve-3d';\n\tcameraElement.style.transformStyle = 'preserve-3d';\n\n\tdomElement.appendChild( cameraElement );\n\n\tthis.setClearColor = function () {};\n\n\tthis.getSize = function() {\n\n\t\treturn {\n\t\t\twidth: _width,\n\t\t\theight: _height\n\t\t};\n\n\t};\n\n\tthis.setSize = function ( width, height ) {\n\n\t\t_width = width;\n\t\t_height = height;\n\n\t\t_widthHalf = _width / 2;\n\t\t_heightHalf = _height / 2;\n\n\t\tdomElement.style.width = width + 'px';\n\t\tdomElement.style.height = height + 'px';\n\n\t\tcameraElement.style.width = width + 'px';\n\t\tcameraElement.style.height = height + 'px';\n\n\t};\n\n\tvar epsilon = function ( value ) {\n\n\t\treturn Math.abs( value ) < Number.EPSILON ? 0 : value;\n\n\t};\n\n\tvar getCameraCSSMatrix = function ( matrix ) {\n\n\t\tvar elements = matrix.elements;\n\n\t\treturn 'matrix3d(' +\n\t\t\tepsilon( elements[ 0 ] ) + ',' +\n\t\t\tepsilon( - elements[ 1 ] ) + ',' +\n\t\t\tepsilon( elements[ 2 ] ) + ',' +\n\t\t\tepsilon( elements[ 3 ] ) + ',' +\n\t\t\tepsilon( elements[ 4 ] ) + ',' +\n\t\t\tepsilon( - elements[ 5 ] ) + ',' +\n\t\t\tepsilon( elements[ 6 ] ) + ',' +\n\t\t\tepsilon( elements[ 7 ] ) + ',' +\n\t\t\tepsilon( elements[ 8 ] ) + ',' +\n\t\t\tepsilon( - elements[ 9 ] ) + ',' +\n\t\t\tepsilon( elements[ 10 ] ) + ',' +\n\t\t\tepsilon( elements[ 11 ] ) + ',' +\n\t\t\tepsilon( elements[ 12 ] ) + ',' +\n\t\t\tepsilon( - elements[ 13 ] ) + ',' +\n\t\t\tepsilon( elements[ 14 ] ) + ',' +\n\t\t\tepsilon( elements[ 15 ] ) +\n\t\t')';\n\n\t};\n\n\tvar getObjectCSSMatrix = function ( matrix ) {\n\n\t\tvar elements = matrix.elements;\n\n\t\treturn 'translate3d(-50%,-50%,0) matrix3d(' +\n\t\t\tepsilon( elements[ 0 ] ) + ',' +\n\t\t\tepsilon( elements[ 1 ] ) + ',' +\n\t\t\tepsilon( elements[ 2 ] ) + ',' +\n\t\t\tepsilon( elements[ 3 ] ) + ',' +\n\t\t\tepsilon( - elements[ 4 ] ) + ',' +\n\t\t\tepsilon( - elements[ 5 ] ) + ',' +\n\t\t\tepsilon( - elements[ 6 ] ) + ',' +\n\t\t\tepsilon( - elements[ 7 ] ) + ',' +\n\t\t\tepsilon( elements[ 8 ] ) + ',' +\n\t\t\tepsilon( elements[ 9 ] ) + ',' +\n\t\t\tepsilon( elements[ 10 ] ) + ',' +\n\t\t\tepsilon( elements[ 11 ] ) + ',' +\n\t\t\tepsilon( elements[ 12 ] ) + ',' +\n\t\t\tepsilon( elements[ 13 ] ) + ',' +\n\t\t\tepsilon( elements[ 14 ] ) + ',' +\n\t\t\tepsilon( elements[ 15 ] ) +\n\t\t')';\n\n\t};\n\n\tvar renderObject = function ( object, camera ) {\n\n\t\tif ( object instanceof CSS3DObject ) {\n\n\t\t\tvar style;\n\n\t\t\tif ( object instanceof CSS3DSprite ) {\n\n\t\t\t\t// http://swiftcoder.wordpress.com/2008/11/25/constructing-a-billboard-matrix/\n\n\t\t\t\tmatrix.copy( camera.matrixWorldInverse );\n\t\t\t\tmatrix.transpose();\n\t\t\t\tmatrix.copyPosition( object.matrixWorld );\n\t\t\t\tmatrix.scale( object.scale );\n\n\t\t\t\tmatrix.elements[ 3 ] = 0;\n\t\t\t\tmatrix.elements[ 7 ] = 0;\n\t\t\t\tmatrix.elements[ 11 ] = 0;\n\t\t\t\tmatrix.elements[ 15 ] = 1;\n\n\t\t\t\tstyle = getObjectCSSMatrix( matrix );\n\n\t\t\t} else {\n\n\t\t\t\tstyle = getObjectCSSMatrix( object.matrixWorld );\n\n\t\t\t}\n\n\t\t\tvar element = object.element;\n\t\t\tvar cachedStyle = cache.objects[ object.id ];\n\n\t\t\tif ( cachedStyle === undefined || cachedStyle !== style ) {\n\n\t\t\t\telement.style.WebkitTransform = style;\n\t\t\t\telement.style.MozTransform = style;\n\t\t\t\telement.style.oTransform = style;\n\t\t\t\telement.style.transform = style;\n\n\t\t\t\tcache.objects[ object.id ] = style;\n\n\t\t\t}\n\n\t\t\tif ( element.parentNode !== cameraElement ) {\n\n\t\t\t\tcameraElement.appendChild( element );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( var i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( object.children[ i ], camera );\n\n\t\t}\n\n\t};\n\n\tthis.render = function ( scene, camera ) {\n\n\t\tvar fov = 0.5 / Math.tan( THREE.Math.degToRad( camera.fov * 0.5 ) ) * _height;\n\n\t\tif ( cache.camera.fov !== fov ) {\n\n\t\t\tdomElement.style.WebkitPerspective = fov + 'px';\n\t\t\tdomElement.style.MozPerspective = fov + 'px';\n\t\t\tdomElement.style.oPerspective = fov + 'px';\n\t\t\tdomElement.style.perspective = fov + 'px';\n\n\t\t\tcache.camera.fov = fov;\n\n\t\t}\n\n\t\tscene.updateMatrixWorld();\n\n\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\tcamera.matrixWorldInverse.getInverse( camera.matrixWorld );\n\n\t\tvar style = 'translate3d(0,0,' + fov + 'px)' + getCameraCSSMatrix( camera.matrixWorldInverse ) +\n\t\t\t' translate3d(' + _widthHalf + 'px,' + _heightHalf + 'px, 0)';\n\n\t\tif ( cache.camera.style !== style ) {\n\n\t\t\tcameraElement.style.WebkitTransform = style;\n\t\t\tcameraElement.style.MozTransform = style;\n\t\t\tcameraElement.style.oTransform = style;\n\t\t\tcameraElement.style.transform = style;\n\n\t\t\tcache.camera.style = style;\n\n\t\t}\n\n\t\trenderObject( scene, camera );\n\n\t};\n\n};\n\nexport {CSS3DObject as CSS3DObject};\nexport {CSS3DSprite as CSS3DSprite};\nexport {CSS3DRenderer as CSS3DRenderer};\n\nTHREE.CSS3DObject = CSS3DObject;\nTHREE.CSS3DSprite = CSS3DSprite;\nTHREE.CSS3DRenderer = CSS3DRenderer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/CSS3DRenderer.js\n **/","import THREE from 'three';\nimport {CSS2DRenderer} from '../vendor/CSS2DRenderer';\nimport DOMScene2D from './DOMScene2D';\n\n// This can only be accessed from Engine.renderer if you want to reference the\n// same scene in multiple places\n\nexport default function(container) {\n var renderer = new CSS2DRenderer();\n\n renderer.domElement.style.position = 'absolute';\n renderer.domElement.style.top = 0;\n\n container.appendChild(renderer.domElement);\n\n var updateSize = function() {\n renderer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return renderer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/DOMRenderer2D.js\n **/","// jscs:disable\n/* eslint-disable */\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nimport THREE from 'three';\n\nvar CSS2DObject = function ( element ) {\n\n\tTHREE.Object3D.call( this );\n\n\tthis.element = element;\n\tthis.element.style.position = 'absolute';\n\n\tthis.addEventListener( 'removed', function ( event ) {\n\n\t\tif ( this.element.parentNode !== null ) {\n\n\t\t\tthis.element.parentNode.removeChild( this.element );\n\n\t\t}\n\n\t} );\n\n};\n\nCSS2DObject.prototype = Object.create( THREE.Object3D.prototype );\nCSS2DObject.prototype.constructor = CSS2DObject;\n\n//\n\nvar CSS2DRenderer = function () {\n\n\tconsole.log( 'THREE.CSS2DRenderer', THREE.REVISION );\n\n\tvar _width, _height;\n\tvar _widthHalf, _heightHalf;\n\n\tvar vector = new THREE.Vector3();\n\tvar viewMatrix = new THREE.Matrix4();\n\tvar viewProjectionMatrix = new THREE.Matrix4();\n\n\tvar domElement = document.createElement( 'div' );\n\tdomElement.style.overflow = 'hidden';\n\n\tthis.domElement = domElement;\n\n\tthis.setSize = function ( width, height ) {\n\n\t\t_width = width;\n\t\t_height = height;\n\n\t\t_widthHalf = _width / 2;\n\t\t_heightHalf = _height / 2;\n\n\t\tdomElement.style.width = width + 'px';\n\t\tdomElement.style.height = height + 'px';\n\n\t};\n\n\tvar renderObject = function ( object, camera ) {\n\n\t\tif ( object instanceof CSS2DObject ) {\n\n\t\t\tvector.setFromMatrixPosition( object.matrixWorld );\n\t\t\tvector.applyProjection( viewProjectionMatrix );\n\n\t\t\tvar element = object.element;\n\t\t\tvar style = 'translate(-50%,-50%) translate(' + ( vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - vector.y * _heightHalf + _heightHalf ) + 'px)';\n\n\t\t\telement.style.WebkitTransform = style;\n\t\t\telement.style.MozTransform = style;\n\t\t\telement.style.oTransform = style;\n\t\t\telement.style.transform = style;\n\n\t\t\tif ( element.parentNode !== domElement ) {\n\n\t\t\t\tdomElement.appendChild( element );\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor ( var i = 0, l = object.children.length; i < l; i ++ ) {\n\n\t\t\trenderObject( object.children[ i ], camera );\n\n\t\t}\n\n\t};\n\n\tthis.render = function ( scene, camera ) {\n\n\t\tscene.updateMatrixWorld();\n\n\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\tcamera.matrixWorldInverse.getInverse( camera.matrixWorld );\n\n\t\tviewMatrix.copy( camera.matrixWorldInverse.getInverse( camera.matrixWorld ) );\n\t\tviewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, viewMatrix );\n\n\t\trenderObject( scene, camera );\n\n\t};\n\n};\n\nexport {CSS2DObject as CSS2DObject};\nexport {CSS2DRenderer as CSS2DRenderer};\n\nTHREE.CSS2DObject = CSS2DObject;\nTHREE.CSS2DRenderer = CSS2DRenderer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/CSS2DRenderer.js\n **/","import THREE from 'three';\n\n// This can only be accessed from Engine.camera if you want to reference the\n// same scene in multiple places\n\n// TODO: Ensure that FOV looks natural on all aspect ratios\n// http://stackoverflow.com/q/26655930/997339\n\nexport default function(container) {\n var camera = new THREE.PerspectiveCamera(45, 1, 1, 200000);\n camera.position.y = 400;\n camera.position.z = 400;\n\n var updateSize = function() {\n camera.aspect = container.clientWidth / container.clientHeight;\n camera.updateProjectionMatrix();\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return camera;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Camera.js\n **/","import THREE from 'three';\nimport {point as Point} from '../geo/Point';\nimport PickingScene from './PickingScene';\n\n// TODO: Look into a way of setting this up without passing in a renderer and\n// camera from the engine\n\n// TODO: Add a basic indicator on or around the mouse pointer when it is over\n// something pickable / clickable\n//\n// A simple transparent disc or ring at the mouse point should work to start, or\n// even just changing the cursor to the CSS 'pointer' style\n//\n// Probably want this on mousemove with a throttled update as not to spam the\n// picking method\n//\n// Relies upon the picking method not redrawing the scene every call due to\n// the way TileLayer invalidates the picking scene\n\nvar nextId = 1;\n\nclass Picking {\n constructor(world, renderer, camera) {\n this._world = world;\n this._renderer = renderer;\n this._camera = camera;\n\n this._raycaster = new THREE.Raycaster();\n\n // TODO: Match this with the line width used in the picking layers\n this._raycaster.linePrecision = 3;\n\n this._pickingScene = PickingScene;\n this._pickingTexture = new THREE.WebGLRenderTarget();\n this._pickingTexture.texture.minFilter = THREE.LinearFilter;\n this._pickingTexture.texture.generateMipmaps = false;\n\n this._nextId = 1;\n\n this._resizeTexture();\n this._initEvents();\n }\n\n _initEvents() {\n window.addEventListener('resize', this._resizeTexture.bind(this), false);\n\n // this._renderer.domElement.addEventListener('mousemove', this._onMouseMove.bind(this), false);\n this._world._container.addEventListener('mouseup', this._onMouseUp.bind(this), false);\n\n this._world.on('move', this._onWorldMove, this);\n }\n\n _onMouseUp(event) {\n // Only react to main button click\n if (event.button !== 0) {\n return;\n }\n\n var point = Point(event.clientX, event.clientY);\n\n var normalisedPoint = Point(0, 0);\n normalisedPoint.x = (point.x / this._width) * 2 - 1;\n normalisedPoint.y = -(point.y / this._height) * 2 + 1;\n\n this._pick(point, normalisedPoint);\n }\n\n _onWorldMove() {\n this._needUpdate = true;\n }\n\n // TODO: Ensure this doesn't get out of sync issue with the renderer resize\n _resizeTexture() {\n var size = this._renderer.getSize();\n\n this._width = size.width;\n this._height = size.height;\n\n this._pickingTexture.setSize(this._width, this._height);\n this._pixelBuffer = new Uint8Array(4 * this._width * this._height);\n\n this._needUpdate = true;\n }\n\n // TODO: Make this only re-draw the scene if both an update is needed and the\n // camera has moved since the last update\n //\n // Otherwise it re-draws the scene on every click due to the way LOD updates\n // work in TileLayer – spamming this.add() and this.remove()\n //\n // TODO: Pause updates during map move / orbit / zoom as this is unlikely to\n // be a point in time where the user cares for picking functionality\n _update() {\n if (this._needUpdate) {\n var texture = this._pickingTexture;\n\n this._renderer.render(this._pickingScene, this._camera, this._pickingTexture);\n\n // Read the rendering texture\n this._renderer.readRenderTargetPixels(texture, 0, 0, texture.width, texture.height, this._pixelBuffer);\n\n this._needUpdate = false;\n }\n }\n\n _pick(point, normalisedPoint) {\n this._update();\n\n var index = point.x + (this._pickingTexture.height - point.y) * this._pickingTexture.width;\n\n // Interpret the pixel as an ID\n var id = (this._pixelBuffer[index * 4 + 2] * 255 * 255) + (this._pixelBuffer[index * 4 + 1] * 255) + (this._pixelBuffer[index * 4 + 0]);\n\n // Skip if ID is 16646655 (white) as the background returns this\n if (id === 16646655) {\n return;\n }\n\n this._raycaster.setFromCamera(normalisedPoint, this._camera);\n\n // Perform ray intersection on picking scene\n //\n // TODO: Only perform intersection test on the relevant picking mesh\n var intersects = this._raycaster.intersectObjects(this._pickingScene.children, true);\n\n var _point2d = point.clone();\n\n var _point3d;\n if (intersects.length > 0) {\n _point3d = intersects[0].point.clone();\n }\n\n // Pass along as much data as possible for now until we know more about how\n // people use the picking API and what the returned data should be\n //\n // TODO: Look into the leak potential for passing so much by reference here\n this._world.emit('pick', id, _point2d, _point3d, intersects);\n this._world.emit('pick-' + id, _point2d, _point3d, intersects);\n }\n\n // Add mesh to picking scene\n //\n // Picking ID should already be added as an attribute\n add(mesh) {\n this._pickingScene.add(mesh);\n this._needUpdate = true;\n }\n\n // Remove mesh from picking scene\n remove(mesh) {\n this._pickingScene.remove(mesh);\n this._needUpdate = true;\n }\n\n // Returns next ID to use for picking\n getNextId() {\n return nextId++;\n }\n\n destroy() {\n // TODO: Find a way to properly remove these listeners as they stay\n // active at the moment\n window.removeEventListener('resize', this._resizeTexture, false);\n this._renderer.domElement.removeEventListener('mouseup', this._onMouseUp, false);\n this._world.off('move', this._onWorldMove);\n\n if (this._pickingScene.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._pickingScene.children.length - 1; i >= 0; i--) {\n child = this._pickingScene.children[i];\n\n if (!child) {\n continue;\n }\n\n this._pickingScene.remove(child);\n\n // Probably not a good idea to dispose of geometry due to it being\n // shared with the non-picking scene\n // if (child.geometry) {\n // // Dispose of mesh and materials\n // child.geometry.dispose();\n // child.geometry = null;\n // }\n\n if (child.material) {\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n }\n }\n }\n\n this._pickingScene = null;\n this._pickingTexture = null;\n this._pixelBuffer = null;\n\n this._world = null;\n this._renderer = null;\n this._camera = null;\n }\n}\n\n// Initialise without requiring new keyword\nexport default function(world, renderer, camera) {\n return new Picking(world, renderer, camera);\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/Picking.js\n **/","import THREE from 'three';\n\n// This can be imported from anywhere and will still reference the same scene,\n// though there is a helper reference in Engine.pickingScene\n\nexport default (function() {\n var scene = new THREE.Scene();\n return scene;\n})();\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/PickingScene.js\n **/","import THREE from 'three';\nimport EffectComposer from '../vendor/EffectComposer';\n\nexport default function(renderer, container) {\n var composer = new EffectComposer(renderer);\n\n var updateSize = function() {\n composer.setSize(container.clientWidth, container.clientHeight);\n };\n\n window.addEventListener('resize', updateSize, false);\n updateSize();\n\n return composer;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/EffectComposer.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\nimport CopyShader from './CopyShader';\nimport ShaderPass from './ShaderPass';\nimport MaskPass, {ClearMaskPass} from './MaskPass';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nvar EffectComposer = function ( renderer, renderTarget ) {\n\n\tthis.renderer = renderer;\n\n\tif ( renderTarget === undefined ) {\n\n\t\tvar pixelRatio = renderer.getPixelRatio();\n\n\t\tvar width = Math.floor( renderer.context.canvas.width / pixelRatio ) || 1;\n\t\tvar height = Math.floor( renderer.context.canvas.height / pixelRatio ) || 1;\n\t\tvar parameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat, stencilBuffer: false };\n\n\t\trenderTarget = new THREE.WebGLRenderTarget( width, height, parameters );\n\n\t}\n\n\tthis.renderTarget1 = renderTarget;\n\tthis.renderTarget2 = renderTarget.clone();\n\n\tthis.writeBuffer = this.renderTarget1;\n\tthis.readBuffer = this.renderTarget2;\n\n\tthis.passes = [];\n\n\tif ( CopyShader === undefined )\n\t\tconsole.error( \"EffectComposer relies on THREE.CopyShader\" );\n\n\tthis.copyPass = new ShaderPass( CopyShader );\n\n};\n\nEffectComposer.prototype = {\n\n\tswapBuffers: function() {\n\n\t\tvar tmp = this.readBuffer;\n\t\tthis.readBuffer = this.writeBuffer;\n\t\tthis.writeBuffer = tmp;\n\n\t},\n\n\taddPass: function ( pass ) {\n\n\t\tthis.passes.push( pass );\n\n\t},\n\n\tinsertPass: function ( pass, index ) {\n\n\t\tthis.passes.splice( index, 0, pass );\n\n\t},\n\n\trender: function ( delta ) {\n\n\t\tthis.writeBuffer = this.renderTarget1;\n\t\tthis.readBuffer = this.renderTarget2;\n\n\t\tvar maskActive = false;\n\n\t\tvar pass, i, il = this.passes.length;\n\n\t\tfor ( i = 0; i < il; i ++ ) {\n\n\t\t\tpass = this.passes[ i ];\n\n\t\t\tif ( ! pass.enabled ) continue;\n\n\t\t\tpass.render( this.renderer, this.writeBuffer, this.readBuffer, delta, maskActive );\n\n\t\t\tif ( pass.needsSwap ) {\n\n\t\t\t\tif ( maskActive ) {\n\n\t\t\t\t\tvar context = this.renderer.context;\n\n\t\t\t\t\tcontext.stencilFunc( context.NOTEQUAL, 1, 0xffffffff );\n\n\t\t\t\t\tthis.copyPass.render( this.renderer, this.writeBuffer, this.readBuffer, delta );\n\n\t\t\t\t\tcontext.stencilFunc( context.EQUAL, 1, 0xffffffff );\n\n\t\t\t\t}\n\n\t\t\t\tthis.swapBuffers();\n\n\t\t\t}\n\n\t\t\tif ( pass instanceof MaskPass ) {\n\n\t\t\t\tmaskActive = true;\n\n\t\t\t} else if ( pass instanceof ClearMaskPass ) {\n\n\t\t\t\tmaskActive = false;\n\n\t\t\t}\n\n\t\t}\n\n\t},\n\n\treset: function ( renderTarget ) {\n\n\t\tif ( renderTarget === undefined ) {\n\n\t\t\trenderTarget = this.renderTarget1.clone();\n\n\t\t\tvar pixelRatio = this.renderer.getPixelRatio();\n\n\t\t\trenderTarget.setSize(\n\t\t\t\tMath.floor( this.renderer.context.canvas.width / pixelRatio ),\n\t\t\t\tMath.floor( this.renderer.context.canvas.height / pixelRatio )\n\t\t\t);\n\n\t\t}\n\n\t\tthis.renderTarget1.dispose();\n\t\tthis.renderTarget1 = renderTarget;\n\t\tthis.renderTarget2.dispose();\n\t\tthis.renderTarget2 = renderTarget.clone();\n\n\t\tthis.writeBuffer = this.renderTarget1;\n\t\tthis.readBuffer = this.renderTarget2;\n\n\t},\n\n\tsetSize: function ( width, height ) {\n\n\t\tthis.renderTarget1.setSize( width, height );\n\t\tthis.renderTarget2.setSize( width, height );\n\n\t}\n\n};\n\nexport default EffectComposer;\nTHREE.EffectComposer = EffectComposer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/EffectComposer.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * Full-screen textured quad shader\n */\n\nvar CopyShader = {\n\n\tuniforms: {\n\n\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\"opacity\": { type: \"f\", value: 1.0 }\n\n\t},\n\n\tvertexShader: [\n\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vUv = uv;\",\n\t\t\t\"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" ),\n\n\tfragmentShader: [\n\n\t\t\"uniform float opacity;\",\n\n\t\t\"uniform sampler2D tDiffuse;\",\n\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vec4 texel = texture2D( tDiffuse, vUv );\",\n\t\t\t\"gl_FragColor = opacity * texel;\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" )\n\n};\n\nexport default CopyShader;\nTHREE.CopyShader = CopyShader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/CopyShader.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nvar ShaderPass = function( shader, textureID ) {\n\n\tthis.textureID = ( textureID !== undefined ) ? textureID : \"tDiffuse\";\n\n\tif ( shader instanceof THREE.ShaderMaterial ) {\n\n\t\tthis.uniforms = shader.uniforms;\n\n\t\tthis.material = shader;\n\n\t}\n\telse if ( shader ) {\n\n\t\tthis.uniforms = THREE.UniformsUtils.clone( shader.uniforms );\n\n\t\tthis.material = new THREE.ShaderMaterial( {\n\n\t\t\tdefines: shader.defines || {},\n\t\t\tuniforms: this.uniforms,\n\t\t\tvertexShader: shader.vertexShader,\n\t\t\tfragmentShader: shader.fragmentShader\n\n\t\t} );\n\n\t}\n\n\tthis.renderToScreen = false;\n\n\tthis.enabled = true;\n\tthis.needsSwap = true;\n\tthis.clear = false;\n\n\n\tthis.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n\tthis.scene = new THREE.Scene();\n\n\tthis.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );\n\tthis.scene.add( this.quad );\n\n};\n\nShaderPass.prototype = {\n\n\trender: function( renderer, writeBuffer, readBuffer, delta ) {\n\n\t\tif ( this.uniforms[ this.textureID ] ) {\n\n\t\t\tthis.uniforms[ this.textureID ].value = readBuffer;\n\n\t\t}\n\n\t\tthis.quad.material = this.material;\n\n\t\tif ( this.renderToScreen ) {\n\n\t\t\trenderer.render( this.scene, this.camera );\n\n\t\t} else {\n\n\t\t\trenderer.render( this.scene, this.camera, writeBuffer, this.clear );\n\n\t\t}\n\n\t}\n\n};\n\nexport default ShaderPass;\nTHREE.ShaderPass = ShaderPass;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/ShaderPass.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nvar MaskPass = function ( scene, camera ) {\n\n\tthis.scene = scene;\n\tthis.camera = camera;\n\n\tthis.enabled = true;\n\tthis.clear = true;\n\tthis.needsSwap = false;\n\n\tthis.inverse = false;\n\n};\n\nMaskPass.prototype = {\n\n\trender: function ( renderer, writeBuffer, readBuffer, delta ) {\n\n\t\tvar context = renderer.context;\n\n\t\t// don't update color or depth\n\n\t\tcontext.colorMask( false, false, false, false );\n\t\tcontext.depthMask( false );\n\n\t\t// set up stencil\n\n\t\tvar writeValue, clearValue;\n\n\t\tif ( this.inverse ) {\n\n\t\t\twriteValue = 0;\n\t\t\tclearValue = 1;\n\n\t\t} else {\n\n\t\t\twriteValue = 1;\n\t\t\tclearValue = 0;\n\n\t\t}\n\n\t\tcontext.enable( context.STENCIL_TEST );\n\t\tcontext.stencilOp( context.REPLACE, context.REPLACE, context.REPLACE );\n\t\tcontext.stencilFunc( context.ALWAYS, writeValue, 0xffffffff );\n\t\tcontext.clearStencil( clearValue );\n\n\t\t// draw into the stencil buffer\n\n\t\trenderer.render( this.scene, this.camera, readBuffer, this.clear );\n\t\trenderer.render( this.scene, this.camera, writeBuffer, this.clear );\n\n\t\t// re-enable update of color and depth\n\n\t\tcontext.colorMask( true, true, true, true );\n\t\tcontext.depthMask( true );\n\n\t\t// only render where stencil is set to 1\n\n\t\tcontext.stencilFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1\n\t\tcontext.stencilOp( context.KEEP, context.KEEP, context.KEEP );\n\n\t}\n\n};\n\n\nvar ClearMaskPass = function () {\n\n\tthis.enabled = true;\n\n};\n\nClearMaskPass.prototype = {\n\n\trender: function ( renderer, writeBuffer, readBuffer, delta ) {\n\n\t\tvar context = renderer.context;\n\n\t\tcontext.disable( context.STENCIL_TEST );\n\n\t}\n\n};\n\nexport default MaskPass;\nexport {ClearMaskPass as ClearMaskPass};\n\nTHREE.MaskPass = MaskPass;\nTHREE.ClearMaskPass = ClearMaskPass;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/MaskPass.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n */\n\nvar RenderPass = function ( scene, camera, overrideMaterial, clearColor, clearAlpha ) {\n\n\tthis.scene = scene;\n\tthis.camera = camera;\n\n\tthis.overrideMaterial = overrideMaterial;\n\n\tthis.clearColor = clearColor;\n\tthis.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 1;\n\n\tthis.oldClearColor = new THREE.Color();\n\tthis.oldClearAlpha = 1;\n\n\tthis.enabled = true;\n\tthis.clear = true;\n\tthis.needsSwap = false;\n\n};\n\nRenderPass.prototype = {\n\n\trender: function ( renderer, writeBuffer, readBuffer, delta ) {\n\n\t\tthis.scene.overrideMaterial = this.overrideMaterial;\n\n\t\tif ( this.clearColor ) {\n\n\t\t\tthis.oldClearColor.copy( renderer.getClearColor() );\n\t\t\tthis.oldClearAlpha = renderer.getClearAlpha();\n\n\t\t\trenderer.setClearColor( this.clearColor, this.clearAlpha );\n\n\t\t}\n\n\t\trenderer.render( this.scene, this.camera, readBuffer, this.clear );\n\n\t\tif ( this.clearColor ) {\n\n\t\t\trenderer.setClearColor( this.oldClearColor, this.oldClearAlpha );\n\n\t\t}\n\n\t\tthis.scene.overrideMaterial = null;\n\n\t}\n\n};\n\nexport default RenderPass;\nTHREE.RenderPass = RenderPass;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/RenderPass.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n * - \"r\" parameter control where \"focused\" horizontal line lies\n */\n\nvar HorizontalTiltShiftShader = {\n\n\tuniforms: {\n\n\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\"h\": { type: \"f\", value: 1.0 / 512.0 },\n\t\t\"r\": { type: \"f\", value: 0.35 }\n\n\t},\n\n\tvertexShader: [\n\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vUv = uv;\",\n\t\t\t\"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" ),\n\n\tfragmentShader: [\n\n\t\t\"uniform sampler2D tDiffuse;\",\n\t\t\"uniform float h;\",\n\t\t\"uniform float r;\",\n\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vec4 sum = vec4( 0.0 );\",\n\n\t\t\t\"float hh = h * abs( r - vUv.y );\",\n\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;\",\n\n\t\t\t\"gl_FragColor = sum;\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" )\n\n};\n\nexport default HorizontalTiltShiftShader;\nTHREE.HorizontalTiltShiftShader = HorizontalTiltShiftShader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/HorizontalTiltShiftShader.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n *\n * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position\n *\n * - 9 samples per pass\n * - standard deviation 2.7\n * - \"h\" and \"v\" parameters should be set to \"1 / width\" and \"1 / height\"\n * - \"r\" parameter control where \"focused\" horizontal line lies\n */\n\nvar VerticalTiltShiftShader = {\n\n\tuniforms: {\n\n\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\"v\": { type: \"f\", value: 1.0 / 512.0 },\n\t\t\"r\": { type: \"f\", value: 0.35 }\n\n\t},\n\n\tvertexShader: [\n\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vUv = uv;\",\n\t\t\t\"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" ),\n\n\tfragmentShader: [\n\n\t\t\"uniform sampler2D tDiffuse;\",\n\t\t\"uniform float v;\",\n\t\t\"uniform float r;\",\n\n\t\t\"varying vec2 vUv;\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vec4 sum = vec4( 0.0 );\",\n\n\t\t\t\"float vv = v * abs( r - vUv.y );\",\n\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;\",\n\t\t\t\"sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;\",\n\n\t\t\t\"gl_FragColor = sum;\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" )\n\n};\n\nexport default VerticalTiltShiftShader;\nTHREE.VerticalTiltShiftShader = VerticalTiltShiftShader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/VerticalTiltShiftShader.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author alteredq / http://alteredqualia.com/\n * @author davidedc / http://www.sketchpatch.net/\n *\n * NVIDIA FXAA by Timothy Lottes\n * http://timothylottes.blogspot.com/2011/06/fxaa3-source-released.html\n * - WebGL port by @supereggbert\n * http://www.glge.org/demos/fxaa/\n */\n\nvar FXAAShader = {\n\n\tuniforms: {\n\n\t\t\"tDiffuse\": { type: \"t\", value: null },\n\t\t\"resolution\": { type: \"v2\", value: new THREE.Vector2( 1 / 1024, 1 / 512 ) }\n\n\t},\n\n\tvertexShader: [\n\n\t\t\"void main() {\",\n\n\t\t\t\"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" ),\n\n\tfragmentShader: [\n\n\t\t\"uniform sampler2D tDiffuse;\",\n\t\t\"uniform vec2 resolution;\",\n\n\t\t\"#define FXAA_REDUCE_MIN (1.0/128.0)\",\n\t\t\"#define FXAA_REDUCE_MUL (1.0/8.0)\",\n\t\t\"#define FXAA_SPAN_MAX 8.0\",\n\n\t\t\"void main() {\",\n\n\t\t\t\"vec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;\",\n\t\t\t\"vec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;\",\n\t\t\t\"vec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;\",\n\t\t\t\"vec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;\",\n\t\t\t\"vec4 rgbaM = texture2D( tDiffuse, gl_FragCoord.xy * resolution );\",\n\t\t\t\"vec3 rgbM = rgbaM.xyz;\",\n\t\t\t\"vec3 luma = vec3( 0.299, 0.587, 0.114 );\",\n\n\t\t\t\"float lumaNW = dot( rgbNW, luma );\",\n\t\t\t\"float lumaNE = dot( rgbNE, luma );\",\n\t\t\t\"float lumaSW = dot( rgbSW, luma );\",\n\t\t\t\"float lumaSE = dot( rgbSE, luma );\",\n\t\t\t\"float lumaM = dot( rgbM, luma );\",\n\t\t\t\"float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\",\n\t\t\t\"float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\",\n\n\t\t\t\"vec2 dir;\",\n\t\t\t\"dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\",\n\t\t\t\"dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\",\n\n\t\t\t\"float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\",\n\n\t\t\t\"float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\",\n\t\t\t\"dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\",\n\t\t\t\t \"max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\",\n\t\t\t\t\t\t\"dir * rcpDirMin)) * resolution;\",\n\t\t\t\"vec4 rgbA = (1.0/2.0) * (\",\n \t\"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (1.0/3.0 - 0.5)) +\",\n\t\t\t\"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (2.0/3.0 - 0.5)));\",\n \t\t\"vec4 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (\",\n\t\t\t\"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (0.0/3.0 - 0.5)) +\",\n \t\t\"texture2D(tDiffuse, gl_FragCoord.xy * resolution + dir * (3.0/3.0 - 0.5)));\",\n \t\t\"float lumaB = dot(rgbB, vec4(luma, 0.0));\",\n\n\t\t\t\"if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {\",\n\n\t\t\t\t\"gl_FragColor = rgbA;\",\n\n\t\t\t\"} else {\",\n\t\t\t\t\"gl_FragColor = rgbB;\",\n\n\t\t\t\"}\",\n\n\t\t\"}\"\n\n\t].join( \"\\n\" )\n\n};\n\nexport default FXAAShader;\nTHREE.FXAAShader = FXAAShader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/FXAAShader.js\n **/","import Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport Skybox from './Skybox';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\nclass EnvironmentLayer extends Layer {\n constructor(options) {\n var defaults = {\n skybox: false\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n }\n\n _onAdd() {\n this._initLights();\n\n if (this._options.skybox) {\n this._initSkybox();\n }\n\n // this._initGrid();\n }\n\n // Not fleshed out or thought through yet\n //\n // Lights could potentially be put it their own 'layer' to keep this class\n // much simpler and less messy\n _initLights() {\n // Position doesn't really matter (the angle is important), however it's\n // used here so the helpers look more natural.\n\n if (!this._options.skybox) {\n var directionalLight = new THREE.DirectionalLight(0xffffff, 1);\n directionalLight.position.x = 1000;\n directionalLight.position.y = 1000;\n directionalLight.position.z = 1000;\n\n // TODO: Get shadows working in non-PBR scenes\n\n // directionalLight.castShadow = true;\n //\n // var d = 100;\n // directionalLight.shadow.camera.left = -d;\n // directionalLight.shadow.camera.right = d;\n // directionalLight.shadow.camera.top = d;\n // directionalLight.shadow.camera.bottom = -d;\n //\n // directionalLight.shadow.camera.near = 10;\n // directionalLight.shadow.camera.far = 100;\n //\n // // TODO: Need to dial in on a good shadowmap size\n // directionalLight.shadow.mapSize.width = 2048;\n // directionalLight.shadow.mapSize.height = 2048;\n //\n // // directionalLight.shadowBias = -0.0010;\n // // directionalLight.shadow.darkness = 0.15;\n\n var directionalLight2 = new THREE.DirectionalLight(0xffffff, 0.5);\n directionalLight2.position.x = -1000;\n directionalLight2.position.y = 1000;\n directionalLight2.position.z = -1000;\n\n // var helper = new THREE.DirectionalLightHelper(directionalLight, 10);\n // var helper2 = new THREE.DirectionalLightHelper(directionalLight2, 10);\n\n this.add(directionalLight);\n this.add(directionalLight2);\n\n // this.add(helper);\n // this.add(helper2);\n } else {\n // Directional light that will be projected from the sun\n this._skyboxLight = new THREE.DirectionalLight(0xffffff, 1);\n\n this._skyboxLight.castShadow = true;\n\n var d = 1000;\n this._skyboxLight.shadow.camera.left = -d;\n this._skyboxLight.shadow.camera.right = d;\n this._skyboxLight.shadow.camera.top = d;\n this._skyboxLight.shadow.camera.bottom = -d;\n\n this._skyboxLight.shadow.camera.near = 10000;\n this._skyboxLight.shadow.camera.far = 70000;\n\n // TODO: Need to dial in on a good shadowmap size\n this._skyboxLight.shadow.mapSize.width = 2048;\n this._skyboxLight.shadow.mapSize.height = 2048;\n\n // this._skyboxLight.shadowBias = -0.0010;\n // this._skyboxLight.shadow.darkness = 0.15;\n\n // this._object3D.add(new THREE.CameraHelper(this._skyboxLight.shadow.camera));\n\n this.add(this._skyboxLight);\n }\n }\n\n _initSkybox() {\n this._skybox = new Skybox(this._world, this._skyboxLight);\n this.add(this._skybox._mesh);\n }\n\n // Add grid helper for context during initial development\n _initGrid() {\n var size = 4000;\n var step = 100;\n\n var gridHelper = new THREE.GridHelper(size, step);\n this.add(gridHelper);\n }\n\n // Clean up environment\n destroy() {\n this._skyboxLight = null;\n\n this.remove(this._skybox._mesh);\n this._skybox.destroy();\n this._skybox = null;\n\n super.destroy();\n }\n}\n\nexport default EnvironmentLayer;\n\nvar noNew = function(options) {\n return new EnvironmentLayer(options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as environmentLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/environment/EnvironmentLayer.js\n **/","import EventEmitter from 'eventemitter3';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport Scene from '../engine/Scene';\nimport {CSS3DObject} from '../vendor/CSS3DRenderer';\nimport {CSS2DObject} from '../vendor/CSS2DRenderer';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Need a single move method that handles moving all the various object\n// layers so that the DOM layers stay in sync with the 3D layer\n\n// TODO: Double check that objects within the _object3D Object3D parent are frustum\n// culled even if the layer position stays at the default (0,0,0) and the child\n// objects are positioned much further away\n//\n// Or does the layer being at (0,0,0) prevent the child objects from being\n// culled because the layer parent is effectively always in view even if the\n// child is actually out of camera\n\nclass Layer extends EventEmitter {\n constructor(options) {\n super();\n\n var defaults = {\n output: true,\n outputToScene: true\n };\n\n this._options = extend({}, defaults, options);\n\n if (this.isOutput()) {\n this._object3D = new THREE.Object3D();\n\n this._dom3D = document.createElement('div');\n this._domObject3D = new CSS3DObject(this._dom3D);\n\n this._dom2D = document.createElement('div');\n this._domObject2D = new CSS2DObject(this._dom2D);\n }\n }\n\n // Add THREE object directly to layer\n add(object) {\n this._object3D.add(object);\n }\n\n // Remove THREE object from to layer\n remove(object) {\n this._object3D.remove(object);\n }\n\n addDOM3D(object) {\n this._domObject3D.add(object);\n }\n\n removeDOM3D(object) {\n this._domObject3D.remove(object);\n }\n\n addDOM2D(object) {\n this._domObject2D.add(object);\n }\n\n removeDOM2D(object) {\n this._domObject2D.remove(object);\n }\n\n // Add layer to world instance and store world reference\n addTo(world) {\n world.addLayer(this);\n return this;\n }\n\n // Internal method called by World.addLayer to actually add the layer\n _addToWorld(world) {\n this._world = world;\n this._onAdd(world);\n this.emit('added');\n }\n\n _onAdd(world) {}\n\n getPickingId() {\n if (this._world._engine._picking) {\n return this._world._engine._picking.getNextId();\n }\n\n return false;\n }\n\n // TODO: Tidy this up and don't access so many private properties to work\n addToPicking(object) {\n if (!this._world._engine._picking) {\n return;\n }\n\n this._world._engine._picking.add(object);\n }\n\n removeFromPicking(object) {\n if (!this._world._engine._picking) {\n return;\n }\n\n this._world._engine._picking.remove(object);\n }\n\n isOutput() {\n return this._options.output;\n }\n\n isOutputToScene() {\n return this._options.outputToScene;\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n if (this._object3D && this._object3D.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._object3D.children.length - 1; i >= 0; i--) {\n child = this._object3D.children[i];\n\n if (!child) {\n continue;\n }\n\n this.remove(child);\n\n if (child.geometry) {\n // Dispose of mesh and materials\n child.geometry.dispose();\n child.geometry = null;\n }\n\n if (child.material) {\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n }\n }\n }\n\n if (this._domObject3D && this._domObject3D.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._domObject3D.children.length - 1; i >= 0; i--) {\n child = this._domObject3D.children[i];\n\n if (!child) {\n continue;\n }\n\n this.removeDOM3D(child);\n }\n }\n\n if (this._domObject2D && this._domObject2D.children) {\n // Remove everything else in the layer\n var child;\n for (var i = this._domObject2D.children.length - 1; i >= 0; i--) {\n child = this._domObject2D.children[i];\n\n if (!child) {\n continue;\n }\n\n this.removeDOM2D(child);\n }\n }\n\n this._domObject3D = null;\n this._domObject2D = null;\n\n this._world = null;\n this._object3D = null;\n }\n}\n\nexport default Layer;\n\nvar noNew = function(options) {\n return new Layer(options);\n};\n\nexport {noNew as layer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/Layer.js\n **/","import THREE from 'three';\nimport Sky from './Sky';\nimport throttle from 'lodash.throttle';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\nvar cubemap = {\n vertexShader: [\n\t\t'varying vec3 vPosition;',\n\t\t'void main() {',\n\t\t\t'vPosition = position;',\n\t\t\t'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\t\t'}'\n\t].join('\\n'),\n\n fragmentShader: [\n 'uniform samplerCube cubemap;',\n 'varying vec3 vPosition;',\n\n 'void main() {',\n 'gl_FragColor = textureCube(cubemap, normalize(vPosition));',\n '}'\n ].join('\\n')\n};\n\nclass Skybox {\n constructor(world, light) {\n this._world = world;\n this._light = light;\n\n this._settings = {\n distance: 38000,\n turbidity: 10,\n reileigh: 2,\n mieCoefficient: 0.005,\n mieDirectionalG: 0.8,\n luminance: 1,\n // 0.48 is a cracking dusk / sunset\n // 0.4 is a beautiful early-morning / late-afternoon\n // 0.2 is a nice day time\n inclination: 0.48, // Elevation / inclination\n azimuth: 0.25, // Facing front\n };\n\n this._initSkybox();\n this._updateUniforms();\n this._initEvents();\n }\n\n _initEvents() {\n // Throttled to 1 per 100ms\n this._throttledWorldUpdate = throttle(this._update, 100);\n this._world.on('preUpdate', this._throttledWorldUpdate, this);\n }\n\n _initSkybox() {\n // Cube camera for skybox\n this._cubeCamera = new THREE.CubeCamera(1, 2000000, 128);\n\n // Cube material\n var cubeTarget = this._cubeCamera.renderTarget;\n\n // Add Sky Mesh\n this._sky = new Sky();\n this._skyScene = new THREE.Scene();\n this._skyScene.add(this._sky.mesh);\n\n // Add Sun Helper\n this._sunSphere = new THREE.Mesh(\n new THREE.SphereBufferGeometry(2000, 16, 8),\n new THREE.MeshBasicMaterial({\n color: 0xffffff\n })\n );\n\n // TODO: This isn't actually visible because it's not added to the layer\n // this._sunSphere.visible = true;\n\n var skyboxUniforms = {\n cubemap: { type: 't', value: cubeTarget }\n };\n\n var skyboxMat = new THREE.ShaderMaterial({\n uniforms: skyboxUniforms,\n vertexShader: cubemap.vertexShader,\n fragmentShader: cubemap.fragmentShader,\n side: THREE.BackSide\n });\n\n this._mesh = new THREE.Mesh(new THREE.BoxGeometry(190000, 190000, 190000), skyboxMat);\n\n this._updateSkybox = true;\n }\n\n _updateUniforms() {\n var settings = this._settings;\n var uniforms = this._sky.uniforms;\n uniforms.turbidity.value = settings.turbidity;\n uniforms.reileigh.value = settings.reileigh;\n uniforms.luminance.value = settings.luminance;\n uniforms.mieCoefficient.value = settings.mieCoefficient;\n uniforms.mieDirectionalG.value = settings.mieDirectionalG;\n\n var theta = Math.PI * (settings.inclination - 0.5);\n var phi = 2 * Math.PI * (settings.azimuth - 0.5);\n\n this._sunSphere.position.x = settings.distance * Math.cos(phi);\n this._sunSphere.position.y = settings.distance * Math.sin(phi) * Math.sin(theta);\n this._sunSphere.position.z = settings.distance * Math.sin(phi) * Math.cos(theta);\n\n // Move directional light to sun position\n this._light.position.copy(this._sunSphere.position);\n\n this._sky.uniforms.sunPosition.value.copy(this._sunSphere.position);\n }\n\n _update(delta) {\n if (this._updateSkybox) {\n this._updateSkybox = false;\n } else {\n return;\n }\n\n // if (!this._angle) {\n // this._angle = 0;\n // }\n //\n // // Animate inclination\n // this._angle += Math.PI * delta;\n // this._settings.inclination = 0.5 * (Math.sin(this._angle) / 2 + 0.5);\n\n // Update light intensity depending on elevation of sun (day to night)\n this._light.intensity = 1 - 0.95 * (this._settings.inclination / 0.5);\n\n // // console.log(delta, this._angle, this._settings.inclination);\n //\n // TODO: Only do this when the uniforms have been changed\n this._updateUniforms();\n\n // TODO: Only do this when the cubemap has actually changed\n this._cubeCamera.updateCubeMap(this._world._engine._renderer, this._skyScene);\n }\n\n getRenderTarget() {\n return this._cubeCamera.renderTarget;\n }\n\n setInclination(inclination) {\n this._settings.inclination = inclination;\n this._updateSkybox = true;\n }\n\n // Destroy the skybox and remove it from memory\n destroy() {\n this._world.off('preUpdate', this._throttledWorldUpdate);\n this._throttledWorldUpdate = null;\n\n this._world = null;\n this._light = null;\n\n this._cubeCamera = null;\n\n this._sky.mesh.geometry.dispose();\n this._sky.mesh.geometry = null;\n\n if (this._sky.mesh.material.map) {\n this._sky.mesh.material.map.dispose();\n this._sky.mesh.material.map = null;\n }\n\n this._sky.mesh.material.dispose();\n this._sky.mesh.material = null;\n\n this._sky.mesh = null;\n this._sky = null;\n\n this._skyScene = null;\n\n this._sunSphere.geometry.dispose();\n this._sunSphere.geometry = null;\n\n if (this._sunSphere.material.map) {\n this._sunSphere.material.map.dispose();\n this._sunSphere.material.map = null;\n }\n\n this._sunSphere.material.dispose();\n this._sunSphere.material = null;\n\n this._sunSphere = null;\n\n this._mesh.geometry.dispose();\n this._mesh.geometry = null;\n\n if (this._mesh.material.map) {\n this._mesh.material.map.dispose();\n this._mesh.material.map = null;\n }\n\n this._mesh.material.dispose();\n this._mesh.material = null;\n }\n}\n\nexport default Skybox;\n\nvar noNew = function(world, light) {\n return new Skybox(world, light);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as skybox};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/environment/Skybox.js\n **/","// jscs:disable\n/*eslint eqeqeq:0*/\n\n/**\n * @author zz85 / https://github.com/zz85\n *\n * Based on 'A Practical Analytic Model for Daylight'\n * aka The Preetham Model, the de facto standard analytic skydome model\n * http://www.cs.utah.edu/~shirley/papers/sunsky/sunsky.pdf\n *\n * First implemented by Simon Wallner\n * http://www.simonwallner.at/projects/atmospheric-scattering\n *\n * Improved by Martin Upitis\n * http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR\n *\n * Three.js integration by zz85 http://twitter.com/blurspline\n*/\n\nimport THREE from 'three';\n\nTHREE.ShaderLib[ 'sky' ] = {\n\n\tuniforms: {\n\n\t\tluminance:\t { type: 'f', value: 1 },\n\t\tturbidity:\t { type: 'f', value: 2 },\n\t\treileigh:\t { type: 'f', value: 1 },\n\t\tmieCoefficient:\t { type: 'f', value: 0.005 },\n\t\tmieDirectionalG: { type: 'f', value: 0.8 },\n\t\tsunPosition: \t { type: 'v3', value: new THREE.Vector3() }\n\n\t},\n\n\tvertexShader: [\n\n\t\t'varying vec3 vWorldPosition;',\n\n\t\t'void main() {',\n\n\t\t\t'vec4 worldPosition = modelMatrix * vec4( position, 1.0 );',\n\t\t\t'vWorldPosition = worldPosition.xyz;',\n\n\t\t\t'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\n\t\t'}',\n\n\t].join( '\\n' ),\n\n\tfragmentShader: [\n\n\t\t'uniform sampler2D skySampler;',\n\t\t'uniform vec3 sunPosition;',\n\t\t'varying vec3 vWorldPosition;',\n\n\t\t'vec3 cameraPos = vec3(0., 0., 0.);',\n\t\t'// uniform sampler2D sDiffuse;',\n\t\t'// const float turbidity = 10.0; //',\n\t\t'// const float reileigh = 2.; //',\n\t\t'// const float luminance = 1.0; //',\n\t\t'// const float mieCoefficient = 0.005;',\n\t\t'// const float mieDirectionalG = 0.8;',\n\n\t\t'uniform float luminance;',\n\t\t'uniform float turbidity;',\n\t\t'uniform float reileigh;',\n\t\t'uniform float mieCoefficient;',\n\t\t'uniform float mieDirectionalG;',\n\n\t\t'// constants for atmospheric scattering',\n\t\t'const float e = 2.71828182845904523536028747135266249775724709369995957;',\n\t\t'const float pi = 3.141592653589793238462643383279502884197169;',\n\n\t\t'const float n = 1.0003; // refractive index of air',\n\t\t'const float N = 2.545E25; // number of molecules per unit volume for air at',\n\t\t\t\t\t\t\t\t'// 288.15K and 1013mb (sea level -45 celsius)',\n\t\t'const float pn = 0.035;\t// depolatization factor for standard air',\n\n\t\t'// wavelength of used primaries, according to preetham',\n\t\t'const vec3 lambda = vec3(680E-9, 550E-9, 450E-9);',\n\n\t\t'// mie stuff',\n\t\t'// K coefficient for the primaries',\n\t\t'const vec3 K = vec3(0.686, 0.678, 0.666);',\n\t\t'const float v = 4.0;',\n\n\t\t'// optical length at zenith for molecules',\n\t\t'const float rayleighZenithLength = 8.4E3;',\n\t\t'const float mieZenithLength = 1.25E3;',\n\t\t'const vec3 up = vec3(0.0, 1.0, 0.0);',\n\n\t\t'const float EE = 1000.0;',\n\t\t'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;',\n\t\t'// 66 arc seconds -> degrees, and the cosine of that',\n\n\t\t'// earth shadow hack',\n\t\t'const float cutoffAngle = pi/1.95;',\n\t\t'const float steepness = 1.5;',\n\n\n\t\t'vec3 totalRayleigh(vec3 lambda)',\n\t\t'{',\n\t\t\t'return (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn));',\n\t\t'}',\n\n\t\t// see http://blenderartists.org/forum/showthread.php?321110-Shaders-and-Skybox-madness\n\t\t'// A simplied version of the total Reayleigh scattering to works on browsers that use ANGLE',\n\t\t'vec3 simplifiedRayleigh()',\n\t\t'{',\n\t\t\t'return 0.0005 / vec3(94, 40, 18);',\n\t\t\t// return 0.00054532832366 / (3.0 * 2.545E25 * pow(vec3(680E-9, 550E-9, 450E-9), vec3(4.0)) * 6.245);\n\t\t'}',\n\n\t\t'float rayleighPhase(float cosTheta)',\n\t\t'{\t ',\n\t\t\t'return (3.0 / (16.0*pi)) * (1.0 + pow(cosTheta, 2.0));',\n\t\t'//\treturn (1.0 / (3.0*pi)) * (1.0 + pow(cosTheta, 2.0));',\n\t\t'//\treturn (3.0 / 4.0) * (1.0 + pow(cosTheta, 2.0));',\n\t\t'}',\n\n\t\t'vec3 totalMie(vec3 lambda, vec3 K, float T)',\n\t\t'{',\n\t\t\t'float c = (0.2 * T ) * 10E-18;',\n\t\t\t'return 0.434 * c * pi * pow((2.0 * pi) / lambda, vec3(v - 2.0)) * K;',\n\t\t'}',\n\n\t\t'float hgPhase(float cosTheta, float g)',\n\t\t'{',\n\t\t\t'return (1.0 / (4.0*pi)) * ((1.0 - pow(g, 2.0)) / pow(1.0 - 2.0*g*cosTheta + pow(g, 2.0), 1.5));',\n\t\t'}',\n\n\t\t'float sunIntensity(float zenithAngleCos)',\n\t\t'{',\n\t\t\t'return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));',\n\t\t'}',\n\n\t\t'// float logLuminance(vec3 c)',\n\t\t'// {',\n\t\t'// \treturn log(c.r * 0.2126 + c.g * 0.7152 + c.b * 0.0722);',\n\t\t'// }',\n\n\t\t'// Filmic ToneMapping http://filmicgames.com/archives/75',\n\t\t'float A = 0.15;',\n\t\t'float B = 0.50;',\n\t\t'float C = 0.10;',\n\t\t'float D = 0.20;',\n\t\t'float E = 0.02;',\n\t\t'float F = 0.30;',\n\t\t'float W = 1000.0;',\n\n\t\t'vec3 Uncharted2Tonemap(vec3 x)',\n\t\t'{',\n\t\t 'return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;',\n\t\t'}',\n\n\n\t\t'void main() ',\n\t\t'{',\n\t\t\t'float sunfade = 1.0-clamp(1.0-exp((sunPosition.y/450000.0)),0.0,1.0);',\n\n\t\t\t'// luminance = 1.0 ;// vWorldPosition.y / 450000. + 0.5; //sunPosition.y / 450000. * 1. + 0.5;',\n\n\t\t\t '// gl_FragColor = vec4(sunfade, sunfade, sunfade, 1.0);',\n\n\t\t\t'float reileighCoefficient = reileigh - (1.0* (1.0-sunfade));',\n\n\t\t\t'vec3 sunDirection = normalize(sunPosition);',\n\n\t\t\t'float sunE = sunIntensity(dot(sunDirection, up));',\n\n\t\t\t'// extinction (absorbtion + out scattering) ',\n\t\t\t'// rayleigh coefficients',\n\n\t\t\t// 'vec3 betaR = totalRayleigh(lambda) * reileighCoefficient;',\n\t\t\t'vec3 betaR = simplifiedRayleigh() * reileighCoefficient;',\n\n\t\t\t'// mie coefficients',\n\t\t\t'vec3 betaM = totalMie(lambda, K, turbidity) * mieCoefficient;',\n\n\t\t\t'// optical length',\n\t\t\t'// cutoff angle at 90 to avoid singularity in next formula.',\n\t\t\t'float zenithAngle = acos(max(0.0, dot(up, normalize(vWorldPosition - cameraPos))));',\n\t\t\t'float sR = rayleighZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));',\n\t\t\t'float sM = mieZenithLength / (cos(zenithAngle) + 0.15 * pow(93.885 - ((zenithAngle * 180.0) / pi), -1.253));',\n\n\n\n\t\t\t'// combined extinction factor\t',\n\t\t\t'vec3 Fex = exp(-(betaR * sR + betaM * sM));',\n\n\t\t\t'// in scattering',\n\t\t\t'float cosTheta = dot(normalize(vWorldPosition - cameraPos), sunDirection);',\n\n\t\t\t'float rPhase = rayleighPhase(cosTheta*0.5+0.5);',\n\t\t\t'vec3 betaRTheta = betaR * rPhase;',\n\n\t\t\t'float mPhase = hgPhase(cosTheta, mieDirectionalG);',\n\t\t\t'vec3 betaMTheta = betaM * mPhase;',\n\n\n\t\t\t'vec3 Lin = pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * (1.0 - Fex),vec3(1.5));',\n\t\t\t'Lin *= mix(vec3(1.0),pow(sunE * ((betaRTheta + betaMTheta) / (betaR + betaM)) * Fex,vec3(1.0/2.0)),clamp(pow(1.0-dot(up, sunDirection),5.0),0.0,1.0));',\n\n\t\t\t'//nightsky',\n\t\t\t'vec3 direction = normalize(vWorldPosition - cameraPos);',\n\t\t\t'float theta = acos(direction.y); // elevation --> y-axis, [-pi/2, pi/2]',\n\t\t\t'float phi = atan(direction.z, direction.x); // azimuth --> x-axis [-pi/2, pi/2]',\n\t\t\t'vec2 uv = vec2(phi, theta) / vec2(2.0*pi, pi) + vec2(0.5, 0.0);',\n\t\t\t'// vec3 L0 = texture2D(skySampler, uv).rgb+0.1 * Fex;',\n\t\t\t'vec3 L0 = vec3(0.1) * Fex;',\n\n\t\t\t'// composition + solar disc',\n\t\t\t'//if (cosTheta > sunAngularDiameterCos)',\n\t\t\t'float sundisk = smoothstep(sunAngularDiameterCos,sunAngularDiameterCos+0.00002,cosTheta);',\n\t\t\t'// if (normalize(vWorldPosition - cameraPos).y>0.0)',\n\t\t\t'L0 += (sunE * 19000.0 * Fex)*sundisk;',\n\n\n\t\t\t'vec3 whiteScale = 1.0/Uncharted2Tonemap(vec3(W));',\n\n\t\t\t'vec3 texColor = (Lin+L0); ',\n\t\t\t'texColor *= 0.04 ;',\n\t\t\t'texColor += vec3(0.0,0.001,0.0025)*0.3;',\n\n\t\t\t'float g_fMaxLuminance = 1.0;',\n\t\t\t'float fLumScaled = 0.1 / luminance; ',\n\t\t\t'float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (g_fMaxLuminance * g_fMaxLuminance)))) / (1.0 + fLumScaled); ',\n\n\t\t\t'float ExposureBias = fLumCompressed;',\n\n\t\t\t'vec3 curr = Uncharted2Tonemap((log2(2.0/pow(luminance,4.0)))*texColor);',\n\t\t\t'vec3 color = curr*whiteScale;',\n\n\t\t\t'vec3 retColor = pow(color,vec3(1.0/(1.2+(1.2*sunfade))));',\n\n\n\t\t\t'gl_FragColor.rgb = retColor;',\n\n\t\t\t'gl_FragColor.a = 1.0;',\n\t\t'}',\n\n\t].join( '\\n' )\n\n};\n\nvar Sky = function () {\n\n\tvar skyShader = THREE.ShaderLib[ 'sky' ];\n\tvar skyUniforms = THREE.UniformsUtils.clone( skyShader.uniforms );\n\n\tvar skyMat = new THREE.ShaderMaterial( {\n\t\tfragmentShader: skyShader.fragmentShader,\n\t\tvertexShader: skyShader.vertexShader,\n\t\tuniforms: skyUniforms,\n\t\tside: THREE.BackSide\n\t} );\n\n\tvar skyGeo = new THREE.SphereBufferGeometry( 450000, 32, 15 );\n\tvar skyMesh = new THREE.Mesh( skyGeo, skyMat );\n\n\n\t// Expose variables\n\tthis.mesh = skyMesh;\n\tthis.uniforms = skyUniforms;\n\n};\n\nexport default Sky;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/environment/Sky.js\n **/","/**\n * lodash 4.0.0 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\nvar debounce = require('lodash.debounce');\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide an options object to indicate whether\n * `func` should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the throttled function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=true] Specify invoking on the leading\n * edge of the timeout.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // avoid excessively updating the position while scrolling\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // cancel a trailing throttled invocation\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing });\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = throttle;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.throttle/index.js\n ** module id = 49\n ** module chunks = 0\n **/","/**\n * lodash 4.0.1 (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @type Function\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => logs the number of milliseconds it took for the deferred function to be invoked\n */\nvar now = Date.now;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide an options object to indicate whether `func` should be invoked on\n * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent calls\n * to the debounced function return the result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the debounced function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=false] Specify invoking on the leading\n * edge of the timeout.\n * @param {number} [options.maxWait] The maximum time `func` is allowed to be\n * delayed before it's invoked.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var args,\n maxTimeoutId,\n result,\n stamp,\n thisArg,\n timeoutId,\n trailingCall,\n lastCalled = 0,\n leading = false,\n maxWait = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxWait = 'maxWait' in options && nativeMax(toNumber(options.maxWait) || 0, wait);\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (maxTimeoutId) {\n clearTimeout(maxTimeoutId);\n }\n lastCalled = 0;\n args = maxTimeoutId = thisArg = timeoutId = trailingCall = undefined;\n }\n\n function complete(isCalled, id) {\n if (id) {\n clearTimeout(id);\n }\n maxTimeoutId = timeoutId = trailingCall = undefined;\n if (isCalled) {\n lastCalled = now();\n result = func.apply(thisArg, args);\n if (!timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n }\n }\n\n function delayed() {\n var remaining = wait - (now() - stamp);\n if (remaining <= 0 || remaining > wait) {\n complete(trailingCall, maxTimeoutId);\n } else {\n timeoutId = setTimeout(delayed, remaining);\n }\n }\n\n function flush() {\n if ((timeoutId && trailingCall) || (maxTimeoutId && trailing)) {\n result = func.apply(thisArg, args);\n }\n cancel();\n return result;\n }\n\n function maxDelayed() {\n complete(trailing, timeoutId);\n }\n\n function debounced() {\n args = arguments;\n stamp = now();\n thisArg = this;\n trailingCall = trailing && (timeoutId || !leading);\n\n if (maxWait === false) {\n var leadingCall = leading && !timeoutId;\n } else {\n if (!maxTimeoutId && !leading) {\n lastCalled = stamp;\n }\n var remaining = maxWait - (stamp - lastCalled),\n isCalled = remaining <= 0 || remaining > maxWait;\n\n if (isCalled) {\n if (maxTimeoutId) {\n maxTimeoutId = clearTimeout(maxTimeoutId);\n }\n lastCalled = stamp;\n result = func.apply(thisArg, args);\n }\n else if (!maxTimeoutId) {\n maxTimeoutId = setTimeout(maxDelayed, remaining);\n }\n }\n if (isCalled && timeoutId) {\n timeoutId = clearTimeout(timeoutId);\n }\n else if (!timeoutId && wait !== maxWait) {\n timeoutId = setTimeout(delayed, wait);\n }\n if (leadingCall) {\n isCalled = true;\n result = func.apply(thisArg, args);\n }\n if (isCalled && !timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8 which returns 'object' for typed array constructors, and\n // PhantomJS 1.9 which returns 'function' for `NodeList` instances.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3);\n * // => 3\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3');\n * // => 3\n */\nfunction toNumber(value) {\n if (isObject(value)) {\n var other = isFunction(value.valueOf) ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lodash.throttle/~/lodash.debounce/index.js\n ** module id = 50\n ** module chunks = 0\n **/","import Orbit, {orbit} from './Controls.Orbit';\n\nconst Controls = {\n Orbit: Orbit,\n orbit, orbit\n};\n\nexport default Controls;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/controls/index.js\n **/","import EventEmitter from 'eventemitter3';\nimport THREE from 'three';\nimport OrbitControls from '../vendor/OrbitControls';\n\nclass Orbit extends EventEmitter {\n constructor() {\n super();\n }\n\n // Proxy control events\n //\n // There's currently no distinction between pan, orbit and zoom events\n _initEvents() {\n this._controls.addEventListener('start', (event) => {\n this._world.emit('controlsMoveStart', event.target.target);\n });\n\n this._controls.addEventListener('change', (event) => {\n this._world.emit('controlsMove', event.target.target);\n });\n\n this._controls.addEventListener('end', (event) => {\n this._world.emit('controlsMoveEnd', event.target.target);\n });\n }\n\n // Moving the camera along the [x,y,z] axis based on a target position\n _panTo(point, animate) {}\n _panBy(pointDelta, animate) {}\n\n // Zooming the camera in and out\n _zoomTo(metres, animate) {}\n _zoomBy(metresDelta, animate) {}\n\n // Force camera to look at something other than the target\n _lookAt(point, animate) {}\n\n // Make camera look at the target\n _lookAtTarget() {}\n\n // Tilt (up and down)\n _tiltTo(angle, animate) {}\n _tiltBy(angleDelta, animate) {}\n\n // Rotate (left and right)\n _rotateTo(angle, animate) {}\n _rotateBy(angleDelta, animate) {}\n\n // Fly to the given point, animating pan and tilt/rotation to final position\n // with nice zoom out and in\n //\n // Calling flyTo a second time before the previous animation has completed\n // will immediately start the new animation from wherever the previous one\n // has got to\n _flyTo(point, noZoom) {}\n\n // Proxy to OrbitControls.update()\n update() {\n this._controls.update();\n }\n\n // Add controls to world instance and store world reference\n addTo(world) {\n world.addControls(this);\n return this;\n }\n\n // Internal method called by World.addControls to actually add the controls\n _addToWorld(world) {\n this._world = world;\n\n // TODO: Override panLeft and panUp methods to prevent panning on Y axis\n // See: http://stackoverflow.com/a/26188674/997339\n this._controls = new OrbitControls(world._engine._camera, world._container);\n\n // Disable keys for now as no events are fired for them anyway\n this._controls.keys = false;\n\n // 89 degrees\n this._controls.maxPolarAngle = 1.5533;\n\n // this._controls.enableDamping = true;\n // this._controls.dampingFactor = 0.25;\n\n this._initEvents();\n\n this.emit('added');\n }\n\n // Destroys the controls and removes them from memory\n destroy() {\n // TODO: Remove event listeners\n\n this._controls.dispose();\n\n this._world = null;\n this._controls = null;\n }\n}\n\nexport default Orbit;\n\nvar noNew = function() {\n return new Orbit();\n};\n\n// Initialise without requiring new keyword\nexport {noNew as orbit};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/controls/Controls.Orbit.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\nimport Hammer from 'hammerjs';\n\n/**\n * @author qiao / https://github.com/qiao\n * @author mrdoob / http://mrdoob.com\n * @author alteredq / http://alteredqualia.com/\n * @author WestLangley / http://github.com/WestLangley\n * @author erich666 / http://erichaines.com\n */\n\n// This set of controls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - left mouse / touch: one finger move\n// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish\n// Pan - right mouse, or arrow keys / touch: three finter swipe\n\nvar OrbitControls = function ( object, domElement ) {\n\n\tthis.object = object;\n\n\tthis.domElement = ( domElement !== undefined ) ? domElement : document;\n\n\t// Set to false to disable this control\n\tthis.enabled = true;\n\n\t// \"target\" sets the location of focus, where the object orbits around\n\tthis.target = new THREE.Vector3();\n\n\t// How far you can dolly in and out ( PerspectiveCamera only )\n\tthis.minDistance = 0;\n\tthis.maxDistance = Infinity;\n\n\t// How far you can zoom in and out ( OrthographicCamera only )\n\tthis.minZoom = 0;\n\tthis.maxZoom = Infinity;\n\n\t// How far you can orbit vertically, upper and lower limits.\n\t// Range is 0 to Math.PI radians.\n\tthis.minPolarAngle = 0; // radians\n\tthis.maxPolarAngle = Math.PI; // radians\n\n\t// How far you can orbit horizontally, upper and lower limits.\n\t// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].\n\tthis.minAzimuthAngle = - Infinity; // radians\n\tthis.maxAzimuthAngle = Infinity; // radians\n\n\t// Set to true to enable damping (inertia)\n\t// If damping is enabled, you must call controls.update() in your animation loop\n\tthis.enableDamping = false;\n\tthis.dampingFactor = 0.25;\n\n\t// This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n\t// Set to false to disable zooming\n\tthis.enableZoom = true;\n\tthis.zoomSpeed = 1.0;\n\n\t// Set to false to disable rotating\n\tthis.enableRotate = true;\n\tthis.rotateSpeed = 1.0;\n\n\t// Set to false to disable panning\n\tthis.enablePan = true;\n\tthis.keyPanSpeed = 7.0;\t// pixels moved per arrow key push\n\n\t// Set to true to automatically rotate around the target\n\t// If auto-rotate is enabled, you must call controls.update() in your animation loop\n\tthis.autoRotate = false;\n\tthis.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60\n\n\t// Set to false to disable use of the keys\n\tthis.enableKeys = true;\n\n\t// The four arrow keys\n\tthis.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };\n\n\t// Mouse buttons\n\tthis.mouseButtons = { ORBIT: THREE.MOUSE.LEFT, ZOOM: THREE.MOUSE.MIDDLE, PAN: THREE.MOUSE.RIGHT };\n\n\t// for reset\n\tthis.target0 = this.target.clone();\n\tthis.position0 = this.object.position.clone();\n\tthis.zoom0 = this.object.zoom;\n\n\t//\n\t// public methods\n\t//\n\n\tthis.getPolarAngle = function () {\n\n\t\treturn phi;\n\n\t};\n\n\tthis.getAzimuthalAngle = function () {\n\n\t\treturn theta;\n\n\t};\n\n\tthis.reset = function () {\n\n\t\tscope.target.copy( scope.target0 );\n\t\tscope.object.position.copy( scope.position0 );\n\t\tscope.object.zoom = scope.zoom0;\n\n\t\tscope.object.updateProjectionMatrix();\n\t\tscope.dispatchEvent( changeEvent );\n\n\t\tscope.update();\n\n\t\tstate = STATE.NONE;\n\n\t};\n\n\t// this method is exposed, but perhaps it would be better if we can make it private...\n\tthis.update = function() {\n\n\t\tvar offset = new THREE.Vector3();\n\n\t\t// so camera.up is the orbit axis\n\t\tvar quat = new THREE.Quaternion().setFromUnitVectors( object.up, new THREE.Vector3( 0, 1, 0 ) );\n\t\tvar quatInverse = quat.clone().inverse();\n\n\t\tvar lastPosition = new THREE.Vector3();\n\t\tvar lastQuaternion = new THREE.Quaternion();\n\n\t\treturn function () {\n\n\t\t\tvar position = scope.object.position;\n\n\t\t\toffset.copy( position ).sub( scope.target );\n\n\t\t\t// rotate offset to \"y-axis-is-up\" space\n\t\t\toffset.applyQuaternion( quat );\n\n\t\t\t// angle from z-axis around y-axis\n\n\t\t\ttheta = Math.atan2( offset.x, offset.z );\n\n\t\t\t// angle from y-axis\n\n\t\t\tphi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y );\n\n\t\t\tif ( scope.autoRotate && state === STATE.NONE ) {\n\n\t\t\t\trotateLeft( getAutoRotationAngle() );\n\n\t\t\t}\n\n\t\t\ttheta += thetaDelta;\n\t\t\tphi += phiDelta;\n\n\t\t\t// restrict theta to be between desired limits\n\t\t\ttheta = Math.max( scope.minAzimuthAngle, Math.min( scope.maxAzimuthAngle, theta ) );\n\n\t\t\t// restrict phi to be between desired limits\n\t\t\tphi = Math.max( scope.minPolarAngle, Math.min( scope.maxPolarAngle, phi ) );\n\n\t\t\t// restrict phi to be betwee EPS and PI-EPS\n\t\t\tphi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) );\n\n\t\t\tvar radius = offset.length() * scale;\n\n\t\t\t// restrict radius to be between desired limits\n\t\t\tradius = Math.max( scope.minDistance, Math.min( scope.maxDistance, radius ) );\n\n\t\t\t// move target to panned location\n\t\t\tscope.target.add( panOffset );\n\n\t\t\toffset.x = radius * Math.sin( phi ) * Math.sin( theta );\n\t\t\toffset.y = radius * Math.cos( phi );\n\t\t\toffset.z = radius * Math.sin( phi ) * Math.cos( theta );\n\n\t\t\t// rotate offset back to \"camera-up-vector-is-up\" space\n\t\t\toffset.applyQuaternion( quatInverse );\n\n\t\t\tposition.copy( scope.target ).add( offset );\n\n\t\t\tscope.object.lookAt( scope.target );\n\n\t\t\tif ( scope.enableDamping === true ) {\n\n\t\t\t\tthetaDelta *= ( 1 - scope.dampingFactor );\n\t\t\t\tphiDelta *= ( 1 - scope.dampingFactor );\n\n\t\t\t} else {\n\n\t\t\t\tthetaDelta = 0;\n\t\t\t\tphiDelta = 0;\n\n\t\t\t}\n\n\t\t\tscale = 1;\n\t\t\tpanOffset.set( 0, 0, 0 );\n\n\t\t\t// update condition is:\n\t\t\t// min(camera displacement, camera rotation in radians)^2 > EPS\n\t\t\t// using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\n\t\t\tif ( zoomChanged ||\n\t\t\t\tlastPosition.distanceToSquared( scope.object.position ) > EPS ||\n\t\t\t\t8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {\n\n\t\t\t\tscope.dispatchEvent( changeEvent );\n\n\t\t\t\tlastPosition.copy( scope.object.position );\n\t\t\t\tlastQuaternion.copy( scope.object.quaternion );\n\t\t\t\tzoomChanged = false;\n\n\t\t\t\treturn true;\n\n\t\t\t}\n\n\t\t\treturn false;\n\n\t\t};\n\n\t}();\n\n\tthis.dispose = function() {\n\n\t\tscope.domElement.removeEventListener( 'contextmenu', onContextMenu, false );\n\t\tscope.domElement.removeEventListener( 'mousedown', onMouseDown, false );\n\t\tscope.domElement.removeEventListener( 'mousewheel', onMouseWheel, false );\n\t\tscope.domElement.removeEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox\n\n\t\tscope.domElement.removeEventListener( 'touchstart', onTouchStart, false );\n\t\tscope.domElement.removeEventListener( 'touchend', onTouchEnd, false );\n\t\tscope.domElement.removeEventListener( 'touchmove', onTouchMove, false );\n\n\t\tdocument.removeEventListener( 'mousemove', onMouseMove, false );\n\t\tdocument.removeEventListener( 'mouseup', onMouseUp, false );\n\t\tdocument.removeEventListener( 'mouseout', onMouseUp, false );\n\n\t\twindow.removeEventListener( 'keydown', onKeyDown, false );\n\n\t\t//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n\n\t};\n\n\t//\n\t// internals\n\t//\n\n\tvar scope = this;\n\n\tvar changeEvent = { type: 'change' };\n\tvar startEvent = { type: 'start' };\n\tvar endEvent = { type: 'end' };\n\n\tvar STATE = { NONE : - 1, ROTATE : 0, DOLLY : 1, PAN : 2, TOUCH_ROTATE : 3, TOUCH_DOLLY : 4, TOUCH_PAN : 5 };\n\n\tvar state = STATE.NONE;\n\n\tvar EPS = 0.000001;\n\n\t// current position in spherical coordinates\n\tvar theta;\n\tvar phi;\n\n\tvar phiDelta = 0;\n\tvar thetaDelta = 0;\n\tvar scale = 1;\n\tvar panOffset = new THREE.Vector3();\n\tvar zoomChanged = false;\n\n\tvar rotateStart = new THREE.Vector2();\n\tvar rotateEnd = new THREE.Vector2();\n\tvar rotateDelta = new THREE.Vector2();\n\n\tvar panStart = new THREE.Vector2();\n\tvar panEnd = new THREE.Vector2();\n\tvar panDelta = new THREE.Vector2();\n\n\tvar dollyStart = new THREE.Vector2();\n\tvar dollyEnd = new THREE.Vector2();\n\tvar dollyDelta = new THREE.Vector2();\n\n\tfunction getAutoRotationAngle() {\n\n\t\treturn 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n\n\t}\n\n\tfunction getZoomScale() {\n\n\t\treturn Math.pow( 0.95, scope.zoomSpeed );\n\n\t}\n\n\tfunction rotateLeft( angle ) {\n\n\t\tthetaDelta -= angle;\n\n\t}\n\n\tfunction rotateUp( angle ) {\n\n\t\tphiDelta -= angle;\n\n\t}\n\n\tvar panLeft = function() {\n\n\t\tvar v = new THREE.Vector3();\n\n\t\t// return function panLeft( distance, objectMatrix ) {\n //\n\t\t// \tvar te = objectMatrix.elements;\n //\n\t\t// \t// get X column of objectMatrix\n\t\t// \tv.set( te[ 0 ], te[ 1 ], te[ 2 ] );\n //\n\t\t// \tv.multiplyScalar( - distance );\n //\n\t\t// \tpanOffset.add( v );\n //\n\t\t// };\n\n // Fixed panning to x/y plane\n return function panLeft(distance, objectMatrix) {\n\t var te = objectMatrix.elements;\n\t // var adjDist = distance / Math.cos(phi);\n\n\t v.set(te[ 0 ], 0, te[ 2 ]);\n\t v.multiplyScalar(-distance);\n\n\t panOffset.add(v);\n\t };\n\n\t}();\n\n // Fixed panning to x/y plane\n\tvar panUp = function() {\n\n\t\tvar v = new THREE.Vector3();\n\n\t\t// return function panUp( distance, objectMatrix ) {\n //\n\t\t// \tvar te = objectMatrix.elements;\n //\n\t\t// \t// get Y column of objectMatrix\n\t\t// \tv.set( te[ 4 ], te[ 5 ], te[ 6 ] );\n //\n\t\t// \tv.multiplyScalar( distance );\n //\n\t\t// \tpanOffset.add( v );\n //\n\t\t// };\n\n return function panUp(distance, objectMatrix) {\n\t var te = objectMatrix.elements;\n\t var adjDist = distance / Math.cos(phi);\n\n\t v.set(te[ 4 ], 0, te[ 6 ]);\n\t v.multiplyScalar(adjDist);\n\n\t panOffset.add(v);\n\t };\n\n\t}();\n\n\t// deltaX and deltaY are in pixels; right and down are positive\n\tvar pan = function() {\n\n\t\tvar offset = new THREE.Vector3();\n\n\t\treturn function( deltaX, deltaY ) {\n\n\t\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n\t\t\tif ( scope.object instanceof THREE.PerspectiveCamera ) {\n\n\t\t\t\t// perspective\n\t\t\t\tvar position = scope.object.position;\n\t\t\t\toffset.copy( position ).sub( scope.target );\n\t\t\t\tvar targetDistance = offset.length();\n\n\t\t\t\t// half of the fov is center to top of screen\n\t\t\t\ttargetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );\n\n\t\t\t\t// we actually don't use screenWidth, since perspective camera is fixed to screen height\n\t\t\t\tpanLeft( 2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix );\n\t\t\t\tpanUp( 2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix );\n\n\t\t\t} else if ( scope.object instanceof THREE.OrthographicCamera ) {\n\n\t\t\t\t// orthographic\n\t\t\t\tpanLeft( deltaX * ( scope.object.right - scope.object.left ) / element.clientWidth, scope.object.matrix );\n\t\t\t\tpanUp( deltaY * ( scope.object.top - scope.object.bottom ) / element.clientHeight, scope.object.matrix );\n\n\t\t\t} else {\n\n\t\t\t\t// camera neither orthographic nor perspective\n\t\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );\n\t\t\t\tscope.enablePan = false;\n\n\t\t\t}\n\n\t\t};\n\n\t}();\n\n\tfunction dollyIn( dollyScale ) {\n\n\t\tif ( scope.object instanceof THREE.PerspectiveCamera ) {\n\n\t\t\tscale /= dollyScale;\n\n\t\t} else if ( scope.object instanceof THREE.OrthographicCamera ) {\n\n\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom * dollyScale ) );\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tzoomChanged = true;\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\tscope.enableZoom = false;\n\n\t\t}\n\n\t}\n\n\tfunction dollyOut( dollyScale ) {\n\n\t\tif ( scope.object instanceof THREE.PerspectiveCamera ) {\n\n\t\t\tscale *= dollyScale;\n\n\t\t} else if ( scope.object instanceof THREE.OrthographicCamera ) {\n\n\t\t\tscope.object.zoom = Math.max( scope.minZoom, Math.min( scope.maxZoom, scope.object.zoom / dollyScale ) );\n\t\t\tscope.object.updateProjectionMatrix();\n\t\t\tzoomChanged = true;\n\n\t\t} else {\n\n\t\t\tconsole.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.' );\n\t\t\tscope.enableZoom = false;\n\n\t\t}\n\n\t}\n\n\t//\n\t// event callbacks - update the object state\n\t//\n\n\tfunction handleMouseDownRotate( event ) {\n\n\t\t//console.log( 'handleMouseDownRotate' );\n\n\t\trotateStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseDownDolly( event ) {\n\n\t\t//console.log( 'handleMouseDownDolly' );\n\n\t\tdollyStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseDownPan( event ) {\n\n\t\t//console.log( 'handleMouseDownPan' );\n\n\t\tpanStart.set( event.clientX, event.clientY );\n\n\t}\n\n\tfunction handleMouseMoveRotate( event ) {\n\n\t\t//console.log( 'handleMouseMoveRotate' );\n\n\t\trotateEnd.set( event.clientX, event.clientY );\n\t\trotateDelta.subVectors( rotateEnd, rotateStart );\n\n\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n\t\t// rotating across whole screen goes 360 degrees around\n\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );\n\n\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );\n\n\t\trotateStart.copy( rotateEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseMoveDolly( event ) {\n\n\t\t//console.log( 'handleMouseMoveDolly' );\n\n\t\tdollyEnd.set( event.clientX, event.clientY );\n\n\t\tdollyDelta.subVectors( dollyEnd, dollyStart );\n\n\t\tif ( dollyDelta.y > 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t} else if ( dollyDelta.y < 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t}\n\n\t\tdollyStart.copy( dollyEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseMovePan( event ) {\n\n\t\t//console.log( 'handleMouseMovePan' );\n\n\t\tpanEnd.set( event.clientX, event.clientY );\n\n\t\tpanDelta.subVectors( panEnd, panStart );\n\n\t\tpan( panDelta.x, panDelta.y );\n\n\t\tpanStart.copy( panEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleMouseUp( event ) {\n\n\t\t//console.log( 'handleMouseUp' );\n\n\t}\n\n\tfunction handleMouseWheel( event ) {\n\n\t\t//console.log( 'handleMouseWheel' );\n\n\t\tvar delta = 0;\n\n\t\tif ( event.wheelDelta !== undefined ) {\n\n\t\t\t// WebKit / Opera / Explorer 9\n\n\t\t\tdelta = event.wheelDelta;\n\n\t\t} else if ( event.detail !== undefined ) {\n\n\t\t\t// Firefox\n\n\t\t\tdelta = - event.detail;\n\n\t\t}\n\n\t\tif ( delta > 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t} else if ( delta < 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t}\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleKeyDown( event ) {\n\n\t\t//console.log( 'handleKeyDown' );\n\n\t\tswitch ( event.keyCode ) {\n\n\t\t\tcase scope.keys.UP:\n\t\t\t\tpan( 0, scope.keyPanSpeed );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.BOTTOM:\n\t\t\t\tpan( 0, - scope.keyPanSpeed );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.LEFT:\n\t\t\t\tpan( scope.keyPanSpeed, 0 );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t\tcase scope.keys.RIGHT:\n\t\t\t\tpan( - scope.keyPanSpeed, 0 );\n\t\t\t\tscope.update();\n\t\t\t\tbreak;\n\n\t\t}\n\n\t}\n\n\tfunction handleTouchStartRotate( event ) {\n\n\t\t//console.log( 'handleTouchStartRotate' );\n\n\t\trotateStart.set( event.pointers[ 0 ].pageX, event.pointers[ 0 ].pageY );\n\n\t}\n\n\tfunction handleTouchStartDolly( event ) {\n\n\t\t//console.log( 'handleTouchStartDolly' );\n\n\t\tvar dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\tvar dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\n\t\tvar distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\tdollyStart.set( 0, distance );\n\n\t}\n\n\tfunction handleTouchStartPan( event ) {\n\n\t\t//console.log( 'handleTouchStartPan' );\n\n\t\tpanStart.set( event.deltaX, event.deltaY );\n\n\t}\n\n\tfunction handleTouchMoveRotate( event ) {\n\n\t\t//console.log( 'handleTouchMoveRotate' );\n\n\t\trotateEnd.set( event.pointers[ 0 ].pageX, event.pointers[ 0 ].pageY );\n\t\trotateDelta.subVectors( rotateEnd, rotateStart );\n\n\t\tvar element = scope.domElement === document ? scope.domElement.body : scope.domElement;\n\n\t\t// rotating across whole screen goes 360 degrees around\n\t\trotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );\n\n\t\t// rotating up and down along whole screen attempts to go 360, but limited to 180\n\t\trotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );\n\n\t\trotateStart.copy( rotateEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleTouchMoveDolly( event ) {\n\n\t\t//console.log( 'handleTouchMoveDolly' );\n\n\t\tvar dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\tvar dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\n\t\tvar distance = Math.sqrt( dx * dx + dy * dy );\n\n\t\tdollyEnd.set( 0, distance );\n\n\t\tdollyDelta.subVectors( dollyEnd, dollyStart );\n\n\t\tif ( dollyDelta.y > 0 ) {\n\n\t\t\tdollyOut( getZoomScale() );\n\n\t\t} else if ( dollyDelta.y < 0 ) {\n\n\t\t\tdollyIn( getZoomScale() );\n\n\t\t}\n\n\t\tdollyStart.copy( dollyEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleTouchMovePan( event ) {\n\n\t\t//console.log( 'handleTouchMovePan' );\n\n\t\tpanEnd.set( event.deltaX, event.deltaY );\n\n\t\tpanDelta.subVectors( panEnd, panStart );\n\n\t\tpan( panDelta.x, panDelta.y );\n\n\t\tpanStart.copy( panEnd );\n\n\t\tscope.update();\n\n\t}\n\n\tfunction handleTouchEnd( event ) {\n\n\t\t//console.log( 'handleTouchEnd' );\n\n\t}\n\n\t//\n\t// event handlers - FSM: listen for events and reset state\n\t//\n\n\tfunction onMouseDown( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\n\t\tif ( event.button === scope.mouseButtons.ORBIT ) {\n\n\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\thandleMouseDownRotate( event );\n\n\t\t\tstate = STATE.ROTATE;\n\n\t\t} else if ( event.button === scope.mouseButtons.ZOOM ) {\n\n\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\thandleMouseDownDolly( event );\n\n\t\t\tstate = STATE.DOLLY;\n\n\t\t} else if ( event.button === scope.mouseButtons.PAN ) {\n\n\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\thandleMouseDownPan( event );\n\n\t\t\tstate = STATE.PAN;\n\n\t\t}\n\n\t\tif ( state !== STATE.NONE ) {\n\n\t\t\tdocument.addEventListener( 'mousemove', onMouseMove, false );\n\t\t\tdocument.addEventListener( 'mouseup', onMouseUp, false );\n\t\t\tdocument.addEventListener( 'mouseout', onMouseUp, false );\n\n\t\t\tscope.dispatchEvent( startEvent );\n\n\t\t}\n\n\t}\n\n\tfunction onMouseMove( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\n\t\tif ( state === STATE.ROTATE ) {\n\n\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\thandleMouseMoveRotate( event );\n\n\t\t} else if ( state === STATE.DOLLY ) {\n\n\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\thandleMouseMoveDolly( event );\n\n\t\t} else if ( state === STATE.PAN ) {\n\n\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\thandleMouseMovePan( event );\n\n\t\t}\n\n\t}\n\n\tfunction onMouseUp( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\thandleMouseUp( event );\n\n\t\tdocument.removeEventListener( 'mousemove', onMouseMove, false );\n\t\tdocument.removeEventListener( 'mouseup', onMouseUp, false );\n\t\tdocument.removeEventListener( 'mouseout', onMouseUp, false );\n\n\t\tscope.dispatchEvent( endEvent );\n\n\t\tstate = STATE.NONE;\n\n\t}\n\n\tfunction onMouseWheel( event ) {\n\n\t\tif ( scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE ) return;\n\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\thandleMouseWheel( event );\n\n\t\tscope.dispatchEvent( startEvent ); // not sure why these are here...\n\t\tscope.dispatchEvent( endEvent );\n\n\t}\n\n\tfunction onKeyDown( event ) {\n\n\t\tif ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return;\n\n\t\thandleKeyDown( event );\n\n\t}\n\n\tfunction onTouchStart( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tswitch ( event.touches.length ) {\n\n\t\t\tcase 1:\t// one-fingered touch: rotate\n\n\t\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\t\thandleTouchStartRotate( event );\n\n\t\t\t\tstate = STATE.TOUCH_ROTATE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 2:\t// two-fingered touch: dolly\n\n\t\t\t\tif ( scope.enableZoom === false ) return;\n\n\t\t\t\thandleTouchStartDolly( event );\n\n\t\t\t\tstate = STATE.TOUCH_DOLLY;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 3: // three-fingered touch: pan\n\n\t\t\t\tif ( scope.enablePan === false ) return;\n\n\t\t\t\thandleTouchStartPan( event );\n\n\t\t\t\tstate = STATE.TOUCH_PAN;\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tstate = STATE.NONE;\n\n\t\t}\n\n\t\tif ( state !== STATE.NONE ) {\n\n\t\t\tscope.dispatchEvent( startEvent );\n\n\t\t}\n\n\t}\n\n\tfunction onTouchMove( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\n\t\tswitch ( event.touches.length ) {\n\n\t\t\tcase 1: // one-fingered touch: rotate\n\n\t\t\t\tif ( scope.enableRotate === false ) return;\n\t\t\t\tif ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...\n\n\t\t\t\thandleTouchMoveRotate( event );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 2: // two-fingered touch: dolly\n\n\t\t\t\tif ( scope.enableZoom === false ) return;\n\t\t\t\tif ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...\n\n\t\t\t\thandleTouchMoveDolly( event );\n\n\t\t\t\tbreak;\n\n\t\t\tcase 3: // three-fingered touch: pan\n\n\t\t\t\tif ( scope.enablePan === false ) return;\n\t\t\t\tif ( state !== STATE.TOUCH_PAN ) return; // is this needed?...\n\n\t\t\t\thandleTouchMovePan( event );\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t\t\tstate = STATE.NONE;\n\n\t\t}\n\n\t}\n\n\tfunction onTouchEnd( event ) {\n\n\t\tif ( scope.enabled === false ) return;\n\n\t\thandleTouchEnd( event );\n\n\t\tscope.dispatchEvent( endEvent );\n\n\t\tstate = STATE.NONE;\n\n\t}\n\n\tfunction onContextMenu( event ) {\n\n\t\tevent.preventDefault();\n\n\t}\n\n\t//\n\n\tscope.domElement.addEventListener( 'contextmenu', onContextMenu, false );\n\n\tscope.domElement.addEventListener( 'mousedown', onMouseDown, false );\n\tscope.domElement.addEventListener( 'mousewheel', onMouseWheel, false );\n\tscope.domElement.addEventListener( 'MozMousePixelScroll', onMouseWheel, false ); // firefox\n\n\t// scope.domElement.addEventListener( 'touchstart', onTouchStart, false );\n\t// scope.domElement.addEventListener( 'touchend', onTouchEnd, false );\n\t// scope.domElement.addEventListener( 'touchmove', onTouchMove, false );\n\n\tscope.hammer = new Hammer(scope.domElement);\n\n\tscope.hammer.get('pan').set({\n\t\tpointers: 0,\n\t\tdirection: Hammer.DIRECTION_ALL\n\t});\n\n\tscope.hammer.get('pinch').set({\n\t\tenable: true,\n\t\tthreshold: 0.1\n\t});\n\n\tscope.hammer.on('panstart', function(event) {\n\t\tif (scope.enabled === false) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tif (event.pointers.length === 1) {\n\t\t\tif (scope.enablePan === false) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\thandleTouchStartPan(event);\n\t\t\t// panStart.set(event.deltaX, event.deltaY);\n\n\t\t\tstate = STATE.TOUCH_PAN;\n\t\t} else if (event.pointers.length === 2) {\n\t\t\tif ( scope.enableRotate === false ) return;\n\n\t\t\thandleTouchStartRotate( event );\n\n\t\t\tstate = STATE.TOUCH_ROTATE;\n\t\t}\n\n\t\tif (state !== STATE.NONE) {\n\t\t\tscope.dispatchEvent(startEvent);\n\t\t}\n\t});\n\n\tscope.hammer.on('panend', function(event) {\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tonTouchEnd(event);\n\t});\n\n\tscope.hammer.on('panmove', function(event) {\n\t\tif ( scope.enabled === false ) return;\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\t// event.preventDefault();\n\t\t// event.stopPropagation();\n\n\t\tif (event.pointers.length === 1) {\n\t\t\tif ( scope.enablePan === false ) return;\n\t\t\tif ( state !== STATE.TOUCH_PAN ) return; // is this needed?...\n\n\t\t\thandleTouchMovePan( event );\n\n\t\t\t// panEnd.set( event.deltaX, event.deltaY );\n\t\t\t//\n\t\t\t// panDelta.subVectors( panEnd, panStart );\n\t\t\t//\n\t\t\t// pan( panDelta.x, panDelta.y );\n\t\t\t//\n\t\t\t// panStart.copy( panEnd );\n\t\t\t//\n\t\t\t// scope.update();\n\t\t} else if (event.pointers.length === 2) {\n\t\t\tif ( scope.enableRotate === false ) return;\n\t\t\tif ( state !== STATE.TOUCH_ROTATE ) return; // is this needed?...\n\n\t\t\thandleTouchMoveRotate( event );\n\t\t}\n\t});\n\n\tscope.hammer.on('pinchstart', function(event) {\n\t\tif ( scope.enabled === false ) return;\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( scope.enableZoom === false ) return;\n\n\t\thandleTouchStartDolly( event );\n\n\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t//\n\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t//\n\t\t// dollyStart.set( 0, distance );\n\t\t//\n\t\tstate = STATE.TOUCH_DOLLY;\n\n\t\tif (state !== STATE.NONE) {\n\t\t\tscope.dispatchEvent(startEvent);\n\t\t}\n\t});\n\n\tscope.hammer.on('pinchend', function(event) {\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\tonTouchEnd(event);\n\t});\n\n\tscope.hammer.on('pinchmove', function(event) {\n\t\tif ( scope.enabled === false ) return;\n\n\t\tif (event.pointerType === 'mouse') {\n\t\t\treturn;\n\t\t}\n\n\t\t// event.preventDefault();\n\t\t// event.stopPropagation();\n\n\t\tif ( scope.enableZoom === false ) return;\n\t\tif ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...\n\n\t\thandleTouchMoveDolly( event );\n\n\t\t// var dx = event.pointers[ 0 ].pageX - event.pointers[ 1 ].pageX;\n\t\t// var dy = event.pointers[ 0 ].pageY - event.pointers[ 1 ].pageY;\n\t\t//\n\t\t// var distance = Math.sqrt( dx * dx + dy * dy );\n\t\t//\n\t\t// dollyEnd.set( 0, distance );\n\t\t//\n\t\t// dollyDelta.subVectors( dollyEnd, dollyStart );\n\t\t//\n\t\t// if ( dollyDelta.y > 0 ) {\n\t\t//\n\t\t// \tdollyOut( getZoomScale() );\n\t\t//\n\t\t// } else if ( dollyDelta.y < 0 ) {\n\t\t//\n\t\t// \tdollyIn( getZoomScale() );\n\t\t//\n\t\t// }\n\t\t//\n\t\t// dollyStart.copy( dollyEnd );\n\t\t//\n\t\t// scope.update();\n\t});\n\n\twindow.addEventListener( 'keydown', onKeyDown, false );\n\n\t// force an update at start\n\n\tthis.update();\n\n};\n\nOrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );\nOrbitControls.prototype.constructor = THREE.OrbitControls;\n\nObject.defineProperties( OrbitControls.prototype, {\n\n\tcenter: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .center has been renamed to .target' );\n\t\t\treturn this.target;\n\n\t\t}\n\n\t},\n\n\t// backward compatibility\n\n\tnoZoom: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );\n\t\t\treturn ! this.enableZoom;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead.' );\n\t\t\tthis.enableZoom = ! value;\n\n\t\t}\n\n\t},\n\n\tnoRotate: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );\n\t\t\treturn ! this.enableRotate;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead.' );\n\t\t\tthis.enableRotate = ! value;\n\n\t\t}\n\n\t},\n\n\tnoPan: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );\n\t\t\treturn ! this.enablePan;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead.' );\n\t\t\tthis.enablePan = ! value;\n\n\t\t}\n\n\t},\n\n\tnoKeys: {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );\n\t\t\treturn ! this.enableKeys;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead.' );\n\t\t\tthis.enableKeys = ! value;\n\n\t\t}\n\n\t},\n\n\tstaticMoving : {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );\n\t\t\treturn ! this.constraint.enableDamping;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead.' );\n\t\t\tthis.constraint.enableDamping = ! value;\n\n\t\t}\n\n\t},\n\n\tdynamicDampingFactor : {\n\n\t\tget: function () {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );\n\t\t\treturn this.constraint.dampingFactor;\n\n\t\t},\n\n\t\tset: function ( value ) {\n\n\t\t\tconsole.warn( 'THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead.' );\n\t\t\tthis.constraint.dampingFactor = value;\n\n\t\t}\n\n\t}\n\n} );\n\nexport default OrbitControls;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/OrbitControls.js\n **/","/*! Hammer.JS - v2.0.6 - 2015-12-23\n * http://hammerjs.github.io/\n *\n * Copyright (c) 2015 Jorik Tangelder;\n * Licensed under the license */\n(function(window, document, exportName, undefined) {\n 'use strict';\n\nvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\nvar TEST_ELEMENT = document.createElement('div');\n\nvar TYPE_FUNCTION = 'function';\n\nvar round = Math.round;\nvar abs = Math.abs;\nvar now = Date.now;\n\n/**\n * set a timeout with a given scope\n * @param {Function} fn\n * @param {Number} timeout\n * @param {Object} context\n * @returns {number}\n */\nfunction setTimeoutContext(fn, timeout, context) {\n return setTimeout(bindFn(fn, context), timeout);\n}\n\n/**\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\nfunction invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n return false;\n}\n\n/**\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\nfunction each(obj, iterator, context) {\n var i;\n\n if (!obj) {\n return;\n }\n\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n}\n\n/**\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\nfunction deprecate(method, name, message) {\n var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n return function() {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '')\n .replace(/^\\s+at\\s+/gm, '')\n .replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n\n var log = window.console && (window.console.warn || window.console.log);\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n return method.apply(this, arguments);\n };\n}\n\n/**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\nvar assign;\nif (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n} else {\n assign = Object.assign;\n}\n\n/**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean=false} [merge]\n * @returns {Object} dest\n */\nvar extend = deprecate(function extend(dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n while (i < keys.length) {\n if (!merge || (merge && dest[keys[i]] === undefined)) {\n dest[keys[i]] = src[keys[i]];\n }\n i++;\n }\n return dest;\n}, 'extend', 'Use `assign`.');\n\n/**\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\nvar merge = deprecate(function merge(dest, src) {\n return extend(dest, src, true);\n}, 'merge', 'Use `assign`.');\n\n/**\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\nfunction inherit(child, base, properties) {\n var baseP = base.prototype,\n childP;\n\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n\n if (properties) {\n assign(childP, properties);\n }\n}\n\n/**\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\nfunction bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n}\n\n/**\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\nfunction boolOrFn(val, args) {\n if (typeof val == TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n return val;\n}\n\n/**\n * use the val2 when val1 is undefined\n * @param {*} val1\n * @param {*} val2\n * @returns {*}\n */\nfunction ifUndefined(val1, val2) {\n return (val1 === undefined) ? val2 : val1;\n}\n\n/**\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\nfunction addEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.addEventListener(type, handler, false);\n });\n}\n\n/**\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\nfunction removeEventListeners(target, types, handler) {\n each(splitStr(types), function(type) {\n target.removeEventListener(type, handler, false);\n });\n}\n\n/**\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\nfunction hasParent(node, parent) {\n while (node) {\n if (node == parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n}\n\n/**\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\nfunction inStr(str, find) {\n return str.indexOf(find) > -1;\n}\n\n/**\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\nfunction splitStr(str) {\n return str.trim().split(/\\s+/g);\n}\n\n/**\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\nfunction inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n while (i < src.length) {\n if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n return i;\n }\n i++;\n }\n return -1;\n }\n}\n\n/**\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\nfunction toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n}\n\n/**\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\nfunction uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n values[i] = val;\n i++;\n }\n\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function sortUniqueArray(a, b) {\n return a[key] > b[key];\n });\n }\n }\n\n return results;\n}\n\n/**\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\nfunction prefixed(obj, property) {\n var prefix, prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n\n var i = 0;\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = (prefix) ? prefix + camelProp : property;\n\n if (prop in obj) {\n return prop;\n }\n i++;\n }\n return undefined;\n}\n\n/**\n * get a unique id\n * @returns {number} uniqueId\n */\nvar _uniqueId = 1;\nfunction uniqueId() {\n return _uniqueId++;\n}\n\n/**\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\nfunction getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return (doc.defaultView || doc.parentWindow || window);\n}\n\nvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n\nvar SUPPORT_TOUCH = ('ontouchstart' in window);\nvar SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\nvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n\nvar INPUT_TYPE_TOUCH = 'touch';\nvar INPUT_TYPE_PEN = 'pen';\nvar INPUT_TYPE_MOUSE = 'mouse';\nvar INPUT_TYPE_KINECT = 'kinect';\n\nvar COMPUTE_INTERVAL = 25;\n\nvar INPUT_START = 1;\nvar INPUT_MOVE = 2;\nvar INPUT_END = 4;\nvar INPUT_CANCEL = 8;\n\nvar DIRECTION_NONE = 1;\nvar DIRECTION_LEFT = 2;\nvar DIRECTION_RIGHT = 4;\nvar DIRECTION_UP = 8;\nvar DIRECTION_DOWN = 16;\n\nvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\nvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\nvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n\nvar PROPS_XY = ['x', 'y'];\nvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n/**\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\nfunction Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget;\n\n // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n this.domHandler = function(ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n\n this.init();\n\n}\n\nInput.prototype = {\n /**\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n handler: function() { },\n\n /**\n * bind the events\n */\n init: function() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n },\n\n /**\n * unbind the events\n */\n destroy: function() {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n }\n};\n\n/**\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\nfunction createInputInstance(manager) {\n var Type;\n var inputClass = manager.options.inputClass;\n\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n return new (Type)(manager, inputHandler);\n}\n\n/**\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\nfunction inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n\n if (isFirst) {\n manager.session = {};\n }\n\n // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n input.eventType = eventType;\n\n // compute scale, rotation etc\n computeInputData(manager, input);\n\n // emit secret event\n manager.emit('hammer.input', input);\n\n manager.recognize(input);\n manager.session.prevInput = input;\n}\n\n/**\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\nfunction computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length;\n\n // store the first input to calculate the distance and direction\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n }\n\n // to compute scale and rotation we need to store the multiple touches\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n\n var firstInput = session.firstInput;\n var firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n\n input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n\n computeIntervalInputData(session, input);\n\n // find the correct target\n var target = manager.element;\n if (hasParent(input.srcEvent.target, target)) {\n target = input.srcEvent.target;\n }\n input.target = target;\n}\n\nfunction computeDeltaXY(session, input) {\n var center = input.center;\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n}\n\n/**\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\nfunction computeIntervalInputData(session, input) {\n var last = session.lastInterval || input,\n deltaTime = input.timeStamp - last.timeStamp,\n velocity, velocityX, velocityY, direction;\n\n if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n}\n\n/**\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\nfunction simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n}\n\n/**\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\nfunction getCenter(pointers) {\n var pointersLength = pointers.length;\n\n // no need to loop when only one touch\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n\n var x = 0, y = 0, i = 0;\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n}\n\n/**\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\nfunction getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n}\n\n/**\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\nfunction getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n}\n\n/**\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\nfunction getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n\n return Math.sqrt((x * x) + (y * y));\n}\n\n/**\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\nfunction getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]],\n y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n}\n\n/**\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\nfunction getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n}\n\n/**\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\nfunction getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n}\n\nvar MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n};\n\nvar MOUSE_ELEMENT_EVENTS = 'mousedown';\nvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\n/**\n * Mouse events input\n * @constructor\n * @extends Input\n */\nfunction MouseInput() {\n this.evEl = MOUSE_ELEMENT_EVENTS;\n this.evWin = MOUSE_WINDOW_EVENTS;\n\n this.allow = true; // used by Input.TouchMouse to disable mouse events\n this.pressed = false; // mousedown state\n\n Input.apply(this, arguments);\n}\n\ninherit(MouseInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function MEhandler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type];\n\n // on start we want to have the left mouse button down\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n }\n\n // mouse must be down, and mouse events are allowed (see the TouchMouse input)\n if (!this.pressed || !this.allow) {\n return;\n }\n\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n }\n});\n\nvar POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n};\n\n// in IE10 the pointer types is defined as an enum\nvar IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n};\n\nvar POINTER_ELEMENT_EVENTS = 'pointerdown';\nvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\n// IE10 has prefixed support, and case-sensitive\nif (window.MSPointerEvent && !window.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n}\n\n/**\n * Pointer events input\n * @constructor\n * @extends Input\n */\nfunction PointerEventInput() {\n this.evEl = POINTER_ELEMENT_EVENTS;\n this.evWin = POINTER_WINDOW_EVENTS;\n\n Input.apply(this, arguments);\n\n this.store = (this.manager.session.pointerEvents = []);\n}\n\ninherit(PointerEventInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function PEhandler(ev) {\n var store = this.store;\n var removePointer = false;\n\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n\n var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n\n // get index of the event in the store\n var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\n // start and mouse must be down\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n }\n\n // it not found, so the pointer hasn't been down (so it's probably a hover)\n if (storeIndex < 0) {\n return;\n }\n\n // update the event in the store\n store[storeIndex] = ev;\n\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n }\n});\n\nvar SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\n\nvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\nvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n/**\n * Touch events input\n * @constructor\n * @extends Input\n */\nfunction SingleTouchInput() {\n this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n this.started = false;\n\n Input.apply(this, arguments);\n}\n\ninherit(SingleTouchInput, Input, {\n handler: function TEhandler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\n // should we handle the touch events?\n if (type === INPUT_START) {\n this.started = true;\n }\n\n if (!this.started) {\n return;\n }\n\n var touches = normalizeSingleTouches.call(this, ev, type);\n\n // when done, reset the started state\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n});\n\n/**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\nfunction normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n\n return [all, changed];\n}\n\nvar TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\n\nvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n/**\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\nfunction TouchInput() {\n this.evTarget = TOUCH_TARGET_EVENTS;\n this.targetIds = {};\n\n Input.apply(this, arguments);\n}\n\ninherit(TouchInput, Input, {\n handler: function MTEhandler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n if (!touches) {\n return;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n});\n\n/**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\nfunction getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds;\n\n // when there is only one touch, the process can be simplified\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n\n var i,\n targetTouches,\n changedTouches = toArray(ev.changedTouches),\n changedTargetTouches = [],\n target = this.target;\n\n // get target touches from touches\n targetTouches = allTouches.filter(function(touch) {\n return hasParent(touch.target, target);\n });\n\n // collect touches\n if (type === INPUT_START) {\n i = 0;\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n }\n\n // filter changed touches to only contain touches that exist in the collected target ids\n i = 0;\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n }\n\n // cleanup removed touches\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n i++;\n }\n\n if (!changedTargetTouches.length) {\n return;\n }\n\n return [\n // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n changedTargetTouches\n ];\n}\n\n/**\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\nfunction TouchMouseInput() {\n Input.apply(this, arguments);\n\n var handler = bindFn(this.handler, this);\n this.touch = new TouchInput(this.manager, handler);\n this.mouse = new MouseInput(this.manager, handler);\n}\n\ninherit(TouchMouseInput, Input, {\n /**\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n handler: function TMEhandler(manager, inputEvent, inputData) {\n var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),\n isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n\n // when we're in a touch event, so block all upcoming mouse events\n // most mobile browser also emit mouseevents, right after touchstart\n if (isTouch) {\n this.mouse.allow = false;\n } else if (isMouse && !this.mouse.allow) {\n return;\n }\n\n // reset the allowMouse when we're done\n if (inputEvent & (INPUT_END | INPUT_CANCEL)) {\n this.mouse.allow = true;\n }\n\n this.callback(manager, inputEvent, inputData);\n },\n\n /**\n * remove the event listeners\n */\n destroy: function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n }\n});\n\nvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\nvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\n// magical touchAction value\nvar TOUCH_ACTION_COMPUTE = 'compute';\nvar TOUCH_ACTION_AUTO = 'auto';\nvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\nvar TOUCH_ACTION_NONE = 'none';\nvar TOUCH_ACTION_PAN_X = 'pan-x';\nvar TOUCH_ACTION_PAN_Y = 'pan-y';\n\n/**\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\nfunction TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n}\n\nTouchAction.prototype = {\n /**\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n set: function(value) {\n // find out the touch-action by the event handlers\n if (value == TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n\n if (NATIVE_TOUCH_ACTION && this.manager.element.style) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n this.actions = value.toLowerCase().trim();\n },\n\n /**\n * just re-set the touchAction value\n */\n update: function() {\n this.set(this.manager.options.touchAction);\n },\n\n /**\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n compute: function() {\n var actions = [];\n each(this.manager.recognizers, function(recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n },\n\n /**\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n preventDefaults: function(input) {\n // not needed with native support for the touchAction property\n if (NATIVE_TOUCH_ACTION) {\n return;\n }\n\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection;\n\n // if the touch action did prevented once this session\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\n if (hasNone) {\n //do not prevent defaults if this is a tap gesture\n\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n\n if (hasNone ||\n (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n (hasPanX && direction & DIRECTION_VERTICAL)) {\n return this.preventSrc(srcEvent);\n }\n },\n\n /**\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n preventSrc: function(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n }\n};\n\n/**\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\nfunction cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\n // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n }\n\n // pan-x OR pan-y\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n }\n\n // manipulation\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n\n return TOUCH_ACTION_AUTO;\n}\n\n/**\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\nvar STATE_POSSIBLE = 1;\nvar STATE_BEGAN = 2;\nvar STATE_CHANGED = 4;\nvar STATE_ENDED = 8;\nvar STATE_RECOGNIZED = STATE_ENDED;\nvar STATE_CANCELLED = 16;\nvar STATE_FAILED = 32;\n\n/**\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\nfunction Recognizer(options) {\n this.options = assign({}, this.defaults, options || {});\n\n this.id = uniqueId();\n\n this.manager = null;\n\n // default is enable true\n this.options.enable = ifUndefined(this.options.enable, true);\n\n this.state = STATE_POSSIBLE;\n\n this.simultaneous = {};\n this.requireFail = [];\n}\n\nRecognizer.prototype = {\n /**\n * @virtual\n * @type {Object}\n */\n defaults: {},\n\n /**\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n set: function(options) {\n assign(this.options, options);\n\n // also update the touchAction, in case something changed about the directions/enabled state\n this.manager && this.manager.touchAction.update();\n return this;\n },\n\n /**\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n recognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n return this;\n },\n\n /**\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRecognizeWith: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n },\n\n /**\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n requireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n return this;\n },\n\n /**\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRequireFailure: function(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n return this;\n },\n\n /**\n * has require failures boolean\n * @returns {boolean}\n */\n hasRequireFailures: function() {\n return this.requireFail.length > 0;\n },\n\n /**\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n canRecognizeWith: function(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n },\n\n /**\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n emit: function(input) {\n var self = this;\n var state = this.state;\n\n function emit(event) {\n self.manager.emit(event, input);\n }\n\n // 'panstart' and 'panmove'\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n }\n\n // panend and pancancel\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n },\n\n /**\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n tryEmit: function(input) {\n if (this.canEmit()) {\n return this.emit(input);\n }\n // it's failing anyway\n this.state = STATE_FAILED;\n },\n\n /**\n * can we emit?\n * @returns {boolean}\n */\n canEmit: function() {\n var i = 0;\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n i++;\n }\n return true;\n },\n\n /**\n * update the recognizer\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign({}, inputData);\n\n // is is enabled and allow recognizing?\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n }\n\n // reset when we've reached the end\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n\n this.state = this.process(inputDataClone);\n\n // the recognizer has recognized a gesture\n // so trigger an event\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n },\n\n /**\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {Const} STATE\n */\n process: function(inputData) { }, // jshint ignore:line\n\n /**\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n getTouchAction: function() { },\n\n /**\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n reset: function() { }\n};\n\n/**\n * get a usable string, used as event postfix\n * @param {Const} state\n * @returns {String} state\n */\nfunction stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n return '';\n}\n\n/**\n * direction cons to string\n * @param {Const} direction\n * @returns {String}\n */\nfunction directionStr(direction) {\n if (direction == DIRECTION_DOWN) {\n return 'down';\n } else if (direction == DIRECTION_UP) {\n return 'up';\n } else if (direction == DIRECTION_LEFT) {\n return 'left';\n } else if (direction == DIRECTION_RIGHT) {\n return 'right';\n }\n return '';\n}\n\n/**\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\nfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n if (manager) {\n return manager.get(otherRecognizer);\n }\n return otherRecognizer;\n}\n\n/**\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\nfunction AttrRecognizer() {\n Recognizer.apply(this, arguments);\n}\n\ninherit(AttrRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof AttrRecognizer\n */\n defaults: {\n /**\n * @type {Number}\n * @default 1\n */\n pointers: 1\n },\n\n /**\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n attrTest: function(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n },\n\n /**\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n process: function(input) {\n var state = this.state;\n var eventType = input.eventType;\n\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input);\n\n // on cancel input and we've recognized before, return STATE_CANCELLED\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n return state | STATE_CHANGED;\n }\n return STATE_FAILED;\n }\n});\n\n/**\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction PanRecognizer() {\n AttrRecognizer.apply(this, arguments);\n\n this.pX = null;\n this.pY = null;\n}\n\ninherit(PanRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PanRecognizer\n */\n defaults: {\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n },\n\n getTouchAction: function() {\n var direction = this.options.direction;\n var actions = [];\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n return actions;\n },\n\n directionTest: function(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY;\n\n // lock to axis?\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x != this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y != this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n },\n\n attrTest: function(input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) &&\n (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n },\n\n emit: function(input) {\n\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n\n var direction = directionStr(input.direction);\n\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n this._super.emit.call(this, input);\n }\n});\n\n/**\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\nfunction PinchRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(PinchRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'pinch',\n threshold: 0,\n pointers: 2\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n\n attrTest: function(input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n },\n\n emit: function(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n this._super.emit.call(this, input);\n }\n});\n\n/**\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\nfunction PressRecognizer() {\n Recognizer.apply(this, arguments);\n\n this._timer = null;\n this._input = null;\n}\n\ninherit(PressRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PressRecognizer\n */\n defaults: {\n event: 'press',\n pointers: 1,\n time: 251, // minimal time of the pointer to be pressed\n threshold: 9 // a minimal movement is ok, but keep it low\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_AUTO];\n },\n\n process: function(input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n\n this._input = input;\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeoutContext(function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.time, this);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n return STATE_FAILED;\n },\n\n reset: function() {\n clearTimeout(this._timer);\n },\n\n emit: function(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n\n if (input && (input.eventType & INPUT_END)) {\n this.manager.emit(this.options.event + 'up', input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n }\n});\n\n/**\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction RotateRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(RotateRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof RotateRecognizer\n */\n defaults: {\n event: 'rotate',\n threshold: 0,\n pointers: 2\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_NONE];\n },\n\n attrTest: function(input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n }\n});\n\n/**\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\nfunction SwipeRecognizer() {\n AttrRecognizer.apply(this, arguments);\n}\n\ninherit(SwipeRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof SwipeRecognizer\n */\n defaults: {\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n },\n\n getTouchAction: function() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n },\n\n attrTest: function(input) {\n var direction = this.options.direction;\n var velocity;\n\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n\n return this._super.attrTest.call(this, input) &&\n direction & input.offsetDirection &&\n input.distance > this.options.threshold &&\n input.maxPointers == this.options.pointers &&\n abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n },\n\n emit: function(input) {\n var direction = directionStr(input.offsetDirection);\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n\n this.manager.emit(this.options.event, input);\n }\n});\n\n/**\n * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\nfunction TapRecognizer() {\n Recognizer.apply(this, arguments);\n\n // previous time and center,\n // used for tap counting\n this.pTime = false;\n this.pCenter = false;\n\n this._timer = null;\n this._input = null;\n this.count = 0;\n}\n\ninherit(TapRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300, // max time between the multi-tap taps\n time: 250, // max time of the pointer to be down (like finger on the screen)\n threshold: 9, // a minimal movement is ok, but keep it low\n posThreshold: 10 // a multi-tap can be a bit off the initial position\n },\n\n getTouchAction: function() {\n return [TOUCH_ACTION_MANIPULATION];\n },\n\n process: function(input) {\n var options = this.options;\n\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n\n this.reset();\n\n if ((input.eventType & INPUT_START) && (this.count === 0)) {\n return this.failTimeout();\n }\n\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType != INPUT_END) {\n return this.failTimeout();\n }\n\n var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n\n this._input = input;\n\n // if tap count matches we have recognized it,\n // else it has began recognizing...\n var tapCount = this.count % options.taps;\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeoutContext(function() {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.interval, this);\n return STATE_BEGAN;\n }\n }\n }\n return STATE_FAILED;\n },\n\n failTimeout: function() {\n this._timer = setTimeoutContext(function() {\n this.state = STATE_FAILED;\n }, this.options.interval, this);\n return STATE_FAILED;\n },\n\n reset: function() {\n clearTimeout(this._timer);\n },\n\n emit: function() {\n if (this.state == STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n }\n});\n\n/**\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\nfunction Hammer(element, options) {\n options = options || {};\n options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n return new Manager(element, options);\n}\n\n/**\n * @const {string}\n */\nHammer.VERSION = '2.0.6';\n\n/**\n * default settings\n * @namespace\n */\nHammer.defaults = {\n /**\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n\n /**\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n\n /**\n * @type {Boolean}\n * @default true\n */\n enable: true,\n\n /**\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n\n /**\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n\n /**\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * @type {Array}\n */\n preset: [\n // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n [RotateRecognizer, {enable: false}],\n [PinchRecognizer, {enable: false}, ['rotate']],\n [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],\n [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],\n [TapRecognizer],\n [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],\n [PressRecognizer]\n ],\n\n /**\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: 'none',\n\n /**\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: 'none',\n\n /**\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: 'none',\n\n /**\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: 'none',\n\n /**\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: 'none',\n\n /**\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: 'rgba(0,0,0,0)'\n }\n};\n\nvar STOP = 1;\nvar FORCED_STOP = 2;\n\n/**\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\nfunction Manager(element, options) {\n this.options = assign({}, Hammer.defaults, options || {});\n\n this.options.inputTarget = this.options.inputTarget || element;\n\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n\n toggleCssProps(this, true);\n\n each(this.options.recognizers, function(item) {\n var recognizer = this.add(new (item[0])(item[1]));\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n}\n\nManager.prototype = {\n /**\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n set: function(options) {\n assign(this.options, options);\n\n // Options that need a little more setup\n if (options.touchAction) {\n this.touchAction.update();\n }\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n return this;\n },\n\n /**\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n stop: function(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n },\n\n /**\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n recognize: function(inputData) {\n var session = this.session;\n if (session.stopped) {\n return;\n }\n\n // run the touch-action polyfill\n this.touchAction.preventDefaults(inputData);\n\n var recognizer;\n var recognizers = this.recognizers;\n\n // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n var curRecognizer = session.curRecognizer;\n\n // reset when the last recognizer is recognized\n // or when we're in a new session\n if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n curRecognizer = session.curRecognizer = null;\n }\n\n var i = 0;\n while (i < recognizers.length) {\n recognizer = recognizers[i];\n\n // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer == curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) { // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n }\n\n // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n curRecognizer = session.curRecognizer = recognizer;\n }\n i++;\n }\n },\n\n /**\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n get: function(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n\n var recognizers = this.recognizers;\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event == recognizer) {\n return recognizers[i];\n }\n }\n return null;\n },\n\n /**\n * add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n add: function(recognizer) {\n if (invokeArrayArg(recognizer, 'add', this)) {\n return this;\n }\n\n // remove existing\n var existing = this.get(recognizer.options.event);\n if (existing) {\n this.remove(existing);\n }\n\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n\n this.touchAction.update();\n return recognizer;\n },\n\n /**\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n remove: function(recognizer) {\n if (invokeArrayArg(recognizer, 'remove', this)) {\n return this;\n }\n\n recognizer = this.get(recognizer);\n\n // let's make sure this recognizer exists\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, recognizer);\n\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n\n return this;\n },\n\n /**\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n on: function(events, handler) {\n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n },\n\n /**\n * unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n off: function(events, handler) {\n var handlers = this.handlers;\n each(splitStr(events), function(event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n },\n\n /**\n * emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n emit: function(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n }\n\n // no handlers, so skip it all\n var handlers = this.handlers[event] && this.handlers[event].slice();\n if (!handlers || !handlers.length) {\n return;\n }\n\n data.type = event;\n data.preventDefault = function() {\n data.srcEvent.preventDefault();\n };\n\n var i = 0;\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n },\n\n /**\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n destroy: function() {\n this.element && toggleCssProps(this, false);\n\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n }\n};\n\n/**\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\nfunction toggleCssProps(manager, add) {\n var element = manager.element;\n if (!element.style) {\n return;\n }\n each(manager.options.cssProps, function(value, name) {\n element.style[prefixed(element.style, name)] = add ? value : '';\n });\n}\n\n/**\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\nfunction triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent('Event');\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n}\n\nassign(Hammer, {\n INPUT_START: INPUT_START,\n INPUT_MOVE: INPUT_MOVE,\n INPUT_END: INPUT_END,\n INPUT_CANCEL: INPUT_CANCEL,\n\n STATE_POSSIBLE: STATE_POSSIBLE,\n STATE_BEGAN: STATE_BEGAN,\n STATE_CHANGED: STATE_CHANGED,\n STATE_ENDED: STATE_ENDED,\n STATE_RECOGNIZED: STATE_RECOGNIZED,\n STATE_CANCELLED: STATE_CANCELLED,\n STATE_FAILED: STATE_FAILED,\n\n DIRECTION_NONE: DIRECTION_NONE,\n DIRECTION_LEFT: DIRECTION_LEFT,\n DIRECTION_RIGHT: DIRECTION_RIGHT,\n DIRECTION_UP: DIRECTION_UP,\n DIRECTION_DOWN: DIRECTION_DOWN,\n DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n DIRECTION_ALL: DIRECTION_ALL,\n\n Manager: Manager,\n Input: Input,\n TouchAction: TouchAction,\n\n TouchInput: TouchInput,\n MouseInput: MouseInput,\n PointerEventInput: PointerEventInput,\n TouchMouseInput: TouchMouseInput,\n SingleTouchInput: SingleTouchInput,\n\n Recognizer: Recognizer,\n AttrRecognizer: AttrRecognizer,\n Tap: TapRecognizer,\n Pan: PanRecognizer,\n Swipe: SwipeRecognizer,\n Pinch: PinchRecognizer,\n Rotate: RotateRecognizer,\n Press: PressRecognizer,\n\n on: addEventListeners,\n off: removeEventListeners,\n each: each,\n merge: merge,\n extend: extend,\n assign: assign,\n inherit: inherit,\n bindFn: bindFn,\n prefixed: prefixed\n});\n\n// this prevents errors when Hammer is loaded in the presence of an AMD\n// style loader but by script tag, not by the loader.\nvar freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\nfreeGlobal.Hammer = Hammer;\n\nif (typeof define === 'function' && define.amd) {\n define(function() {\n return Hammer;\n });\n} else if (typeof module != 'undefined' && module.exports) {\n module.exports = Hammer;\n} else {\n window[exportName] = Hammer;\n}\n\n})(window, document, 'Hammer');\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/hammerjs/hammer.js\n ** module id = 54\n ** module chunks = 0\n **/","import TileLayer from './TileLayer';\nimport ImageTile from './ImageTile';\nimport ImageTileLayerBaseMaterial from './ImageTileLayerBaseMaterial';\nimport throttle from 'lodash.throttle';\nimport THREE from 'three';\nimport extend from 'lodash.assign';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// DONE: Find a way to avoid the flashing caused by the gap between old tiles\n// being removed and the new tiles being ready for display\n//\n// DONE: Simplest first step for MVP would be to give each tile mesh the colour\n// of the basemap ground so it blends in a little more, or have a huge ground\n// plane underneath all the tiles that shows through between tile updates.\n//\n// Could keep the old tiles around until the new ones are ready, though they'd\n// probably need to be layered in a way so the old tiles don't overlap new ones,\n// which is similar to how Leaflet approaches this (it has 2 layers)\n//\n// Could keep the tile from the previous quadtree level visible until all 4\n// tiles at the new / current level have finished loading and are displayed.\n// Perhaps by keeping a map of tiles by quadcode and a boolean for each of the\n// child quadcodes showing whether they are loaded and in view. If all true then\n// remove the parent tile, otherwise keep it on a lower layer.\n\n// TODO: Load and display a base layer separate to the LOD grid that is at a low\n// resolution – used as a backup / background to fill in empty areas / distance\n\n// DONE: Fix the issue where some tiles just don't load, or at least the texture\n// never shows up – tends to happen if you quickly zoom in / out past it while\n// it's still loading, leaving a blank space\n\n// TODO: Optimise the request of many image tiles – look at how Leaflet and\n// OpenWebGlobe approach this (eg. batching, queues, etc)\n\n// TODO: Cancel pending tile requests if they get removed from view before they\n// reach a ready state (eg. cancel image requests, etc). Need to ensure that the\n// images are re-requested when the tile is next in scene (even if from cache)\n\n// TODO: Consider not performing an LOD calculation on every frame, instead only\n// on move end so panning, orbiting and zooming stays smooth. Otherwise it's\n// possible for performance to tank if you pan, orbit or zoom rapidly while all\n// the LOD calculations are being made and new tiles requested.\n//\n// Pending tiles should continue to be requested and output to the scene on each\n// frame, but no new LOD calculations should be made.\n\n// This tile layer both updates the quadtree and outputs tiles on every frame\n// (throttled to some amount)\n//\n// This is because the computational complexity of image tiles is generally low\n// and so there isn't much jank when running these calculations and outputs in\n// realtime\n//\n// The benefit to doing this is that the underlying map layer continues to\n// refresh and update during movement, which is an arguably better experience\n\nclass ImageTileLayer extends TileLayer {\n constructor(path, options) {\n var defaults = {\n distance: 40000\n };\n\n options = extend({}, defaults, options);\n\n super(options);\n\n this._path = path;\n }\n\n _onAdd(world) {\n super._onAdd(world);\n\n // Add base layer\n var geom = new THREE.PlaneBufferGeometry(200000, 200000, 1);\n\n var baseMaterial;\n if (this._world._environment._skybox) {\n baseMaterial = ImageTileLayerBaseMaterial('#f5f5f3', this._world._environment._skybox.getRenderTarget());\n } else {\n baseMaterial = ImageTileLayerBaseMaterial('#f5f5f3');\n }\n\n var mesh = new THREE.Mesh(geom, baseMaterial);\n mesh.renderOrder = 0;\n mesh.rotation.x = -90 * Math.PI / 180;\n\n // TODO: It might be overkill to receive a shadow on the base layer as it's\n // rarely seen (good to have if performance difference is negligible)\n mesh.receiveShadow = true;\n\n this._baseLayer = mesh;\n this.add(mesh);\n\n // Trigger initial quadtree calculation on the next frame\n //\n // TODO: This is a hack to ensure the camera is all set up - a better\n // solution should be found\n setTimeout(() => {\n this._calculateLOD();\n this._initEvents();\n }, 0);\n }\n\n _initEvents() {\n // Run LOD calculations based on render calls\n //\n // Throttled to 1 LOD calculation per 100ms\n this._throttledWorldUpdate = throttle(this._onWorldUpdate, 100);\n\n this._world.on('preUpdate', this._throttledWorldUpdate, this);\n this._world.on('move', this._onWorldMove, this);\n }\n\n _onWorldUpdate() {\n this._calculateLOD();\n this._outputTiles();\n }\n\n _onWorldMove(latlon, point) {\n this._moveBaseLayer(point);\n }\n\n _moveBaseLayer(point) {\n this._baseLayer.position.x = point.x;\n this._baseLayer.position.z = point.y;\n }\n\n _createTile(quadcode, layer) {\n return new ImageTile(quadcode, this._path, layer);\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n this._world.off('preUpdate', this._throttledWorldUpdate);\n this._world.off('move', this._onWorldMove);\n\n this._throttledWorldUpdate = null;\n\n // Dispose of mesh and materials\n this._baseLayer.geometry.dispose();\n this._baseLayer.geometry = null;\n\n if (this._baseLayer.material.map) {\n this._baseLayer.material.map.dispose();\n this._baseLayer.material.map = null;\n }\n\n this._baseLayer.material.dispose();\n this._baseLayer.material = null;\n\n this._baseLayer = null;\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default ImageTileLayer;\n\nvar noNew = function(path, options) {\n return new ImageTileLayer(path, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as imageTileLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/ImageTileLayer.js\n **/","import Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport TileCache from './TileCache';\nimport THREE from 'three';\n\n// TODO: Consider removing picking from TileLayer instances as there aren't\n// (m)any situations where it would be practical\n//\n// For example, how would you even know what picking IDs to listen to and what\n// to do with them?\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Consider keeping a single TileLayer / LOD instance running by default\n// that keeps a standard LOD grid for other layers to utilise, rather than\n// having to create their own, unique LOD grid and duplicate calculations when\n// they're going to use the same grid setup anyway\n//\n// It still makes sense to be able to have a custom LOD grid for some layers as\n// they may want to customise things, maybe not even using a quadtree at all!\n//\n// Perhaps it makes sense to split out the quadtree stuff into a singleton and\n// pass in the necessary parameters each time for the calculation step.\n//\n// Either way, it seems silly to force layers to have to create a new LOD grid\n// each time and create extra, duplicated processing every frame.\n\n// TODO: Allow passing in of options to define min/max LOD and a distance to use\n// for culling tiles beyond that distance.\n\n// DONE: Prevent tiles from being loaded if they are further than a certain\n// distance from the camera and are unlikely to be seen anyway\n\n// TODO: Avoid performing LOD calculation when it isn't required. For example,\n// when nothing has changed since the last frame and there are no tiles to be\n// loaded or in need of rendering\n\n// TODO: Only remove tiles from the layer that aren't to be rendered in the\n// current frame – it seems excessive to remove all tiles and re-add them on\n// every single frame, even if it's just array manipulation\n\n// TODO: Fix LOD calculation so min and max LOD can be changed without causing\n// problems (eg. making min above 5 causes all sorts of issues)\n\n// TODO: Reuse THREE objects where possible instead of creating new instances\n// on every LOD calculation\n\n// TODO: Consider not using THREE or LatLon / Point objects in LOD calculations\n// to avoid creating unnecessary memory for garbage collection\n\n// TODO: Prioritise loading of tiles at highest level in the quadtree (those\n// closest to the camera) so visual inconsistancies during loading are minimised\n\nclass TileLayer extends Layer {\n constructor(options) {\n var defaults = {\n picking: false,\n maxCache: 1000,\n maxLOD: 18\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n this._tileCache = new TileCache(this._options.maxCache, tile => {\n this._destroyTile(tile);\n });\n\n // List of tiles from the previous LOD calculation\n this._tileList = [];\n\n // TODO: Work out why changing the minLOD causes loads of issues\n this._minLOD = 3;\n this._maxLOD = this._options.maxLOD;\n\n this._frustum = new THREE.Frustum();\n this._tiles = new THREE.Object3D();\n this._tilesPicking = new THREE.Object3D();\n }\n\n _onAdd(world) {\n this.addToPicking(this._tilesPicking);\n this.add(this._tiles);\n }\n\n _updateFrustum() {\n var camera = this._world.getCamera();\n var projScreenMatrix = new THREE.Matrix4();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n\n this._frustum.setFromMatrix(camera.projectionMatrix);\n this._frustum.setFromMatrix(new THREE.Matrix4().multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse));\n }\n\n _tileInFrustum(tile) {\n var bounds = tile.getBounds();\n return this._frustum.intersectsBox(new THREE.Box3(new THREE.Vector3(bounds[0], 0, bounds[3]), new THREE.Vector3(bounds[2], 0, bounds[1])));\n }\n\n // Update and output tiles from the previous LOD checklist\n _outputTiles() {\n if (!this._tiles) {\n return;\n }\n\n // Remove all tiles from layer\n this._removeTiles();\n\n // Add / re-add tiles\n this._tileList.forEach(tile => {\n // Are the mesh and texture ready?\n //\n // If yes, continue\n // If no, skip\n if (!tile.isReady()) {\n return;\n }\n\n // Add tile to layer (and to scene) if not already there\n this._tiles.add(tile.getMesh());\n\n if (tile.getPickingMesh()) {\n this._tilesPicking.add(tile.getPickingMesh());\n }\n });\n }\n\n // Works out tiles in the view frustum and stores them in an array\n //\n // Does not output the tiles, deferring this to _outputTiles()\n _calculateLOD() {\n if (this._stop || !this._world) {\n return;\n }\n\n // var start = performance.now();\n\n var camera = this._world.getCamera();\n\n // 1. Update and retrieve camera frustum\n this._updateFrustum(this._frustum, camera);\n\n // 2. Add the four root items of the quadtree to a check list\n var checkList = this._checklist;\n checkList = [];\n checkList.push(this._requestTile('0', this));\n checkList.push(this._requestTile('1', this));\n checkList.push(this._requestTile('2', this));\n checkList.push(this._requestTile('3', this));\n\n // 3. Call Divide, passing in the check list\n this._divide(checkList);\n\n // // 4. Remove all tiles from layer\n //\n // Moved to _outputTiles() for now\n // this._removeTiles();\n\n // 5. Filter the tiles remaining in the check list\n this._tileList = checkList.filter((tile, index) => {\n // Skip tile if it's not in the current view frustum\n if (!this._tileInFrustum(tile)) {\n return false;\n }\n\n if (this._options.distance && this._options.distance > 0) {\n // TODO: Can probably speed this up\n var center = tile.getCenter();\n var dist = (new THREE.Vector3(center[0], 0, center[1])).sub(camera.position).length();\n\n // Manual distance limit to cut down on tiles so far away\n if (dist > this._options.distance) {\n return false;\n }\n }\n\n // Does the tile have a mesh?\n //\n // If yes, continue\n // If no, generate tile mesh, request texture and skip\n if (!tile.getMesh()) {\n tile.requestTileAsync();\n }\n\n return true;\n\n // Are the mesh and texture ready?\n //\n // If yes, continue\n // If no, skip\n // if (!tile.isReady()) {\n // return;\n // }\n //\n // // Add tile to layer (and to scene)\n // this._tiles.add(tile.getMesh());\n });\n\n // console.log(performance.now() - start);\n }\n\n _divide(checkList) {\n var count = 0;\n var currentItem;\n var quadcode;\n\n // 1. Loop until count equals check list length\n while (count != checkList.length) {\n currentItem = checkList[count];\n quadcode = currentItem.getQuadcode();\n\n // 2. Increase count and continue loop if quadcode equals max LOD / zoom\n if (currentItem.length === this._maxLOD) {\n count++;\n continue;\n }\n\n // 3. Else, calculate screen-space error metric for quadcode\n if (this._screenSpaceError(currentItem)) {\n // 4. If error is sufficient...\n\n // 4a. Remove parent item from the check list\n checkList.splice(count, 1);\n\n // 4b. Add 4 child items to the check list\n checkList.push(this._requestTile(quadcode + '0', this));\n checkList.push(this._requestTile(quadcode + '1', this));\n checkList.push(this._requestTile(quadcode + '2', this));\n checkList.push(this._requestTile(quadcode + '3', this));\n\n // 4d. Continue the loop without increasing count\n continue;\n } else {\n // 5. Else, increase count and continue loop\n count++;\n }\n }\n }\n\n _screenSpaceError(tile) {\n var minDepth = this._minLOD;\n var maxDepth = this._maxLOD;\n\n var quadcode = tile.getQuadcode();\n\n var camera = this._world.getCamera();\n\n // Tweak this value to refine specific point that each quad is subdivided\n //\n // It's used to multiple the dimensions of the tile sides before\n // comparing against the tile distance from camera\n var quality = 3.0;\n\n // 1. Return false if quadcode length equals maxDepth (stop dividing)\n if (quadcode.length === maxDepth) {\n return false;\n }\n\n // 2. Return true if quadcode length is less than minDepth\n if (quadcode.length < minDepth) {\n return true;\n }\n\n // 3. Return false if quadcode bounds are not in view frustum\n if (!this._tileInFrustum(tile)) {\n return false;\n }\n\n var center = tile.getCenter();\n\n // 4. Calculate screen-space error metric\n // TODO: Use closest distance to one of the 4 tile corners\n var dist = (new THREE.Vector3(center[0], 0, center[1])).sub(camera.position).length();\n\n var error = quality * tile.getSide() / dist;\n\n // 5. Return true if error is greater than 1.0, else return false\n return (error > 1.0);\n }\n\n _removeTiles() {\n if (!this._tiles || !this._tiles.children) {\n return;\n }\n\n for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n this._tiles.remove(this._tiles.children[i]);\n }\n\n if (!this._tilesPicking || !this._tilesPicking.children) {\n return;\n }\n\n for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n this._tilesPicking.remove(this._tilesPicking.children[i]);\n }\n }\n\n // Return a new tile instance\n _createTile(quadcode, layer) {}\n\n // Get a cached tile or request a new one if not in cache\n _requestTile(quadcode, layer) {\n var tile = this._tileCache.getTile(quadcode);\n\n if (!tile) {\n // Set up a brand new tile\n tile = this._createTile(quadcode, layer);\n\n // Add tile to cache, though it won't be ready yet as the data is being\n // requested from various places asynchronously\n this._tileCache.setTile(quadcode, tile);\n }\n\n return tile;\n }\n\n _destroyTile(tile) {\n // Remove tile from scene\n this._tiles.remove(tile.getMesh());\n\n // Delete any references to the tile within this component\n\n // Call destory on tile instance\n tile.destroy();\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n if (this._tiles.children) {\n // Remove all tiles\n for (var i = this._tiles.children.length - 1; i >= 0; i--) {\n this._tiles.remove(this._tiles.children[i]);\n }\n }\n\n // Remove tile from picking scene\n this.removeFromPicking(this._tilesPicking);\n\n if (this._tilesPicking.children) {\n // Remove all tiles\n for (var i = this._tilesPicking.children.length - 1; i >= 0; i--) {\n this._tilesPicking.remove(this._tilesPicking.children[i]);\n }\n }\n\n this._tileCache.destroy();\n this._tileCache = null;\n\n this._tiles = null;\n this._tilesPicking = null;\n this._frustum = null;\n\n super.destroy();\n }\n}\n\nexport default TileLayer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/TileLayer.js\n **/","import LRUCache from 'lru-cache';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// This process is based on a similar approach taken by OpenWebGlobe\n// See: https://github.com/OpenWebGlobe/WebViewer/blob/master/source/core/globecache.js\n\nclass TileCache {\n constructor(cacheLimit, onDestroyTile) {\n this._cache = LRUCache({\n max: cacheLimit,\n dispose: (key, tile) => {\n onDestroyTile(tile);\n }\n });\n }\n\n // Returns true if all specified tile providers are ready to be used\n // Otherwise, returns false\n isReady() {\n return false;\n }\n\n // Get a cached tile without requesting a new one\n getTile(quadcode) {\n return this._cache.get(quadcode);\n }\n\n // Add tile to cache\n setTile(quadcode, tile) {\n this._cache.set(quadcode, tile);\n }\n\n // Destroy the cache and remove it from memory\n //\n // TODO: Call destroy method on items in cache\n destroy() {\n this._cache.reset();\n this._cache = null;\n }\n}\n\nexport default TileCache;\n\nvar noNew = function(cacheLimit, onDestroyTile) {\n return new TileCache(cacheLimit, onDestroyTile);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as tileCache};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/TileCache.js\n **/","module.exports = LRUCache\n\n// This will be a proper iterable 'Map' in engines that support it,\n// or a fakey-fake PseudoMap in older versions.\nvar Map = require('pseudomap')\nvar util = require('util')\n\n// A linked list to keep track of recently-used-ness\nvar Yallist = require('yallist')\n\n// use symbols if possible, otherwise just _props\nvar symbols = {}\nvar hasSymbol = typeof Symbol === 'function'\nvar makeSymbol\nif (hasSymbol) {\n makeSymbol = function (key) {\n return Symbol.for(key)\n }\n} else {\n makeSymbol = function (key) {\n return '_' + key\n }\n}\n\nfunction priv (obj, key, val) {\n var sym\n if (symbols[key]) {\n sym = symbols[key]\n } else {\n sym = makeSymbol(key)\n symbols[key] = sym\n }\n if (arguments.length === 2) {\n return obj[sym]\n } else {\n obj[sym] = val\n return val\n }\n}\n\nfunction naiveLength () { return 1 }\n\n// lruList is a yallist where the head is the youngest\n// item, and the tail is the oldest. the list contains the Hit\n// objects as the entries.\n// Each Hit object has a reference to its Yallist.Node. This\n// never changes.\n//\n// cache is a Map (or PseudoMap) that matches the keys to\n// the Yallist.Node object.\nfunction LRUCache (options) {\n if (!(this instanceof LRUCache)) {\n return new LRUCache(options)\n }\n\n if (typeof options === 'number') {\n options = { max: options }\n }\n\n if (!options) {\n options = {}\n }\n\n var max = priv(this, 'max', options.max)\n // Kind of weird to have a default max of Infinity, but oh well.\n if (!max ||\n !(typeof max === 'number') ||\n max <= 0) {\n priv(this, 'max', Infinity)\n }\n\n var lc = options.length || naiveLength\n if (typeof lc !== 'function') {\n lc = naiveLength\n }\n priv(this, 'lengthCalculator', lc)\n\n priv(this, 'allowStale', options.stale || false)\n priv(this, 'maxAge', options.maxAge || 0)\n priv(this, 'dispose', options.dispose)\n this.reset()\n}\n\n// resize the cache when the max changes.\nObject.defineProperty(LRUCache.prototype, 'max', {\n set: function (mL) {\n if (!mL || !(typeof mL === 'number') || mL <= 0) {\n mL = Infinity\n }\n priv(this, 'max', mL)\n trim(this)\n },\n get: function () {\n return priv(this, 'max')\n },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'allowStale', {\n set: function (allowStale) {\n priv(this, 'allowStale', !!allowStale)\n },\n get: function () {\n return priv(this, 'allowStale')\n },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'maxAge', {\n set: function (mA) {\n if (!mA || !(typeof mA === 'number') || mA < 0) {\n mA = 0\n }\n priv(this, 'maxAge', mA)\n trim(this)\n },\n get: function () {\n return priv(this, 'maxAge')\n },\n enumerable: true\n})\n\n// resize the cache when the lengthCalculator changes.\nObject.defineProperty(LRUCache.prototype, 'lengthCalculator', {\n set: function (lC) {\n if (typeof lC !== 'function') {\n lC = naiveLength\n }\n if (lC !== priv(this, 'lengthCalculator')) {\n priv(this, 'lengthCalculator', lC)\n priv(this, 'length', 0)\n priv(this, 'lruList').forEach(function (hit) {\n hit.length = priv(this, 'lengthCalculator').call(this, hit.value, hit.key)\n priv(this, 'length', priv(this, 'length') + hit.length)\n }, this)\n }\n trim(this)\n },\n get: function () { return priv(this, 'lengthCalculator') },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'length', {\n get: function () { return priv(this, 'length') },\n enumerable: true\n})\n\nObject.defineProperty(LRUCache.prototype, 'itemCount', {\n get: function () { return priv(this, 'lruList').length },\n enumerable: true\n})\n\nLRUCache.prototype.rforEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = priv(this, 'lruList').tail; walker !== null;) {\n var prev = walker.prev\n forEachStep(this, fn, walker, thisp)\n walker = prev\n }\n}\n\nfunction forEachStep (self, fn, node, thisp) {\n var hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!priv(self, 'allowStale')) {\n hit = undefined\n }\n }\n if (hit) {\n fn.call(thisp, hit.value, hit.key, self)\n }\n}\n\nLRUCache.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = priv(this, 'lruList').head; walker !== null;) {\n var next = walker.next\n forEachStep(this, fn, walker, thisp)\n walker = next\n }\n}\n\nLRUCache.prototype.keys = function () {\n return priv(this, 'lruList').toArray().map(function (k) {\n return k.key\n }, this)\n}\n\nLRUCache.prototype.values = function () {\n return priv(this, 'lruList').toArray().map(function (k) {\n return k.value\n }, this)\n}\n\nLRUCache.prototype.reset = function () {\n if (priv(this, 'dispose') &&\n priv(this, 'lruList') &&\n priv(this, 'lruList').length) {\n priv(this, 'lruList').forEach(function (hit) {\n priv(this, 'dispose').call(this, hit.key, hit.value)\n }, this)\n }\n\n priv(this, 'cache', new Map()) // hash of items by key\n priv(this, 'lruList', new Yallist()) // list of items in order of use recency\n priv(this, 'length', 0) // length of items in the list\n}\n\nLRUCache.prototype.dump = function () {\n return priv(this, 'lruList').map(function (hit) {\n if (!isStale(this, hit)) {\n return {\n k: hit.key,\n v: hit.value,\n e: hit.now + (hit.maxAge || 0)\n }\n }\n }, this).toArray().filter(function (h) {\n return h\n })\n}\n\nLRUCache.prototype.dumpLru = function () {\n return priv(this, 'lruList')\n}\n\nLRUCache.prototype.inspect = function (n, opts) {\n var str = 'LRUCache {'\n var extras = false\n\n var as = priv(this, 'allowStale')\n if (as) {\n str += '\\n allowStale: true'\n extras = true\n }\n\n var max = priv(this, 'max')\n if (max && max !== Infinity) {\n if (extras) {\n str += ','\n }\n str += '\\n max: ' + util.inspect(max, opts)\n extras = true\n }\n\n var maxAge = priv(this, 'maxAge')\n if (maxAge) {\n if (extras) {\n str += ','\n }\n str += '\\n maxAge: ' + util.inspect(maxAge, opts)\n extras = true\n }\n\n var lc = priv(this, 'lengthCalculator')\n if (lc && lc !== naiveLength) {\n if (extras) {\n str += ','\n }\n str += '\\n length: ' + util.inspect(priv(this, 'length'), opts)\n extras = true\n }\n\n var didFirst = false\n priv(this, 'lruList').forEach(function (item) {\n if (didFirst) {\n str += ',\\n '\n } else {\n if (extras) {\n str += ',\\n'\n }\n didFirst = true\n str += '\\n '\n }\n var key = util.inspect(item.key).split('\\n').join('\\n ')\n var val = { value: item.value }\n if (item.maxAge !== maxAge) {\n val.maxAge = item.maxAge\n }\n if (lc !== naiveLength) {\n val.length = item.length\n }\n if (isStale(this, item)) {\n val.stale = true\n }\n\n val = util.inspect(val, opts).split('\\n').join('\\n ')\n str += key + ' => ' + val\n })\n\n if (didFirst || extras) {\n str += '\\n'\n }\n str += '}'\n\n return str\n}\n\nLRUCache.prototype.set = function (key, value, maxAge) {\n maxAge = maxAge || priv(this, 'maxAge')\n\n var now = maxAge ? Date.now() : 0\n var len = priv(this, 'lengthCalculator').call(this, value, key)\n\n if (priv(this, 'cache').has(key)) {\n if (len > priv(this, 'max')) {\n del(this, priv(this, 'cache').get(key))\n return false\n }\n\n var node = priv(this, 'cache').get(key)\n var item = node.value\n\n // dispose of the old one before overwriting\n if (priv(this, 'dispose')) {\n priv(this, 'dispose').call(this, key, item.value)\n }\n\n item.now = now\n item.maxAge = maxAge\n item.value = value\n priv(this, 'length', priv(this, 'length') + (len - item.length))\n item.length = len\n this.get(key)\n trim(this)\n return true\n }\n\n var hit = new Entry(key, value, len, now, maxAge)\n\n // oversized objects fall out of cache automatically.\n if (hit.length > priv(this, 'max')) {\n if (priv(this, 'dispose')) {\n priv(this, 'dispose').call(this, key, value)\n }\n return false\n }\n\n priv(this, 'length', priv(this, 'length') + hit.length)\n priv(this, 'lruList').unshift(hit)\n priv(this, 'cache').set(key, priv(this, 'lruList').head)\n trim(this)\n return true\n}\n\nLRUCache.prototype.has = function (key) {\n if (!priv(this, 'cache').has(key)) return false\n var hit = priv(this, 'cache').get(key).value\n if (isStale(this, hit)) {\n return false\n }\n return true\n}\n\nLRUCache.prototype.get = function (key) {\n return get(this, key, true)\n}\n\nLRUCache.prototype.peek = function (key) {\n return get(this, key, false)\n}\n\nLRUCache.prototype.pop = function () {\n var node = priv(this, 'lruList').tail\n if (!node) return null\n del(this, node)\n return node.value\n}\n\nLRUCache.prototype.del = function (key) {\n del(this, priv(this, 'cache').get(key))\n}\n\nLRUCache.prototype.load = function (arr) {\n // reset the cache\n this.reset()\n\n var now = Date.now()\n // A previous serialized cache has the most recent items first\n for (var l = arr.length - 1; l >= 0; l--) {\n var hit = arr[l]\n var expiresAt = hit.e || 0\n if (expiresAt === 0) {\n // the item was created without expiration in a non aged cache\n this.set(hit.k, hit.v)\n } else {\n var maxAge = expiresAt - now\n // dont add already expired items\n if (maxAge > 0) {\n this.set(hit.k, hit.v, maxAge)\n }\n }\n }\n}\n\nLRUCache.prototype.prune = function () {\n var self = this\n priv(this, 'cache').forEach(function (value, key) {\n get(self, key, false)\n })\n}\n\nfunction get (self, key, doUse) {\n var node = priv(self, 'cache').get(key)\n if (node) {\n var hit = node.value\n if (isStale(self, hit)) {\n del(self, node)\n if (!priv(self, 'allowStale')) hit = undefined\n } else {\n if (doUse) {\n priv(self, 'lruList').unshiftNode(node)\n }\n }\n if (hit) hit = hit.value\n }\n return hit\n}\n\nfunction isStale (self, hit) {\n if (!hit || (!hit.maxAge && !priv(self, 'maxAge'))) {\n return false\n }\n var stale = false\n var diff = Date.now() - hit.now\n if (hit.maxAge) {\n stale = diff > hit.maxAge\n } else {\n stale = priv(self, 'maxAge') && (diff > priv(self, 'maxAge'))\n }\n return stale\n}\n\nfunction trim (self) {\n if (priv(self, 'length') > priv(self, 'max')) {\n for (var walker = priv(self, 'lruList').tail;\n priv(self, 'length') > priv(self, 'max') && walker !== null;) {\n // We know that we're about to delete this one, and also\n // what the next least recently used key will be, so just\n // go ahead and set it now.\n var prev = walker.prev\n del(self, walker)\n walker = prev\n }\n }\n}\n\nfunction del (self, node) {\n if (node) {\n var hit = node.value\n if (priv(self, 'dispose')) {\n priv(self, 'dispose').call(this, hit.key, hit.value)\n }\n priv(self, 'length', priv(self, 'length') - hit.length)\n priv(self, 'cache').delete(hit.key)\n priv(self, 'lruList').removeNode(node)\n }\n}\n\n// classy, since V8 prefers predictable objects.\nfunction Entry (key, value, length, now, maxAge) {\n this.key = key\n this.value = value\n this.length = length\n this.now = now\n this.maxAge = maxAge || 0\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/lru-cache/lib/lru-cache.js\n ** module id = 58\n ** module chunks = 0\n **/","if (process.env.npm_package_name === 'pseudomap' &&\n process.env.npm_lifecycle_script === 'test')\n process.env.TEST_PSEUDOMAP = 'true'\n\nif (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) {\n module.exports = Map\n} else {\n module.exports = require('./pseudomap')\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/pseudomap/map.js\n ** module id = 59\n ** module chunks = 0\n **/","// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = setTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/process/browser.js\n ** module id = 60\n ** module chunks = 0\n **/","var hasOwnProperty = Object.prototype.hasOwnProperty\n\nmodule.exports = PseudoMap\n\nfunction PseudoMap (set) {\n if (!(this instanceof PseudoMap)) // whyyyyyyy\n throw new TypeError(\"Constructor PseudoMap requires 'new'\")\n\n this.clear()\n\n if (set) {\n if ((set instanceof PseudoMap) ||\n (typeof Map === 'function' && set instanceof Map))\n set.forEach(function (value, key) {\n this.set(key, value)\n }, this)\n else if (Array.isArray(set))\n set.forEach(function (kv) {\n this.set(kv[0], kv[1])\n }, this)\n else\n throw new TypeError('invalid argument')\n }\n}\n\nPseudoMap.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n Object.keys(this._data).forEach(function (k) {\n if (k !== 'size')\n fn.call(thisp, this._data[k].value, this._data[k].key)\n }, this)\n}\n\nPseudoMap.prototype.has = function (k) {\n return !!find(this._data, k)\n}\n\nPseudoMap.prototype.get = function (k) {\n var res = find(this._data, k)\n return res && res.value\n}\n\nPseudoMap.prototype.set = function (k, v) {\n set(this._data, k, v)\n}\n\nPseudoMap.prototype.delete = function (k) {\n var res = find(this._data, k)\n if (res) {\n delete this._data[res._index]\n this._data.size--\n }\n}\n\nPseudoMap.prototype.clear = function () {\n var data = Object.create(null)\n data.size = 0\n\n Object.defineProperty(this, '_data', {\n value: data,\n enumerable: false,\n configurable: true,\n writable: false\n })\n}\n\nObject.defineProperty(PseudoMap.prototype, 'size', {\n get: function () {\n return this._data.size\n },\n set: function (n) {},\n enumerable: true,\n configurable: true\n})\n\nPseudoMap.prototype.values =\nPseudoMap.prototype.keys =\nPseudoMap.prototype.entries = function () {\n throw new Error('iterators are not implemented in this version')\n}\n\n// Either identical, or both NaN\nfunction same (a, b) {\n return a === b || a !== a && b !== b\n}\n\nfunction Entry (k, v, i) {\n this.key = k\n this.value = v\n this._index = i\n}\n\nfunction find (data, k) {\n for (var i = 0, s = '_' + k, key = s;\n hasOwnProperty.call(data, key);\n key = s + i++) {\n if (same(data[key].key, k))\n return data[key]\n }\n}\n\nfunction set (data, k, v) {\n for (var i = 0, s = '_' + k, key = s;\n hasOwnProperty.call(data, key);\n key = s + i++) {\n if (same(data[key].key, k)) {\n data[key].value = v\n return\n }\n }\n data.size++\n data[key] = new Entry(k, v, key)\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/pseudomap/pseudomap.js\n ** module id = 61\n ** module chunks = 0\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/util/util.js\n ** module id = 62\n ** module chunks = 0\n **/","module.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/util/support/isBufferBrowser.js\n ** module id = 63\n ** module chunks = 0\n **/","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/inherits/inherits_browser.js\n ** module id = 64\n ** module chunks = 0\n **/","module.exports = Yallist\n\nYallist.Node = Node\nYallist.create = Yallist\n\nfunction Yallist (list) {\n var self = this\n if (!(self instanceof Yallist)) {\n self = new Yallist()\n }\n\n self.tail = null\n self.head = null\n self.length = 0\n\n if (list && typeof list.forEach === 'function') {\n list.forEach(function (item) {\n self.push(item)\n })\n } else if (arguments.length > 0) {\n for (var i = 0, l = arguments.length; i < l; i++) {\n self.push(arguments[i])\n }\n }\n\n return self\n}\n\nYallist.prototype.removeNode = function (node) {\n if (node.list !== this) {\n throw new Error('removing node which does not belong to this list')\n }\n\n var next = node.next\n var prev = node.prev\n\n if (next) {\n next.prev = prev\n }\n\n if (prev) {\n prev.next = next\n }\n\n if (node === this.head) {\n this.head = next\n }\n if (node === this.tail) {\n this.tail = prev\n }\n\n node.list.length --\n node.next = null\n node.prev = null\n node.list = null\n}\n\nYallist.prototype.unshiftNode = function (node) {\n if (node === this.head) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var head = this.head\n node.list = this\n node.next = head\n if (head) {\n head.prev = node\n }\n\n this.head = node\n if (!this.tail) {\n this.tail = node\n }\n this.length ++\n}\n\nYallist.prototype.pushNode = function (node) {\n if (node === this.tail) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var tail = this.tail\n node.list = this\n node.prev = tail\n if (tail) {\n tail.next = node\n }\n\n this.tail = node\n if (!this.head) {\n this.head = node\n }\n this.length ++\n}\n\nYallist.prototype.push = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n push(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.unshift = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n unshift(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.pop = function () {\n if (!this.tail)\n return undefined\n\n var res = this.tail.value\n this.tail = this.tail.prev\n this.tail.next = null\n this.length --\n return res\n}\n\nYallist.prototype.shift = function () {\n if (!this.head)\n return undefined\n\n var res = this.head.value\n this.head = this.head.next\n this.head.prev = null\n this.length --\n return res\n}\n\nYallist.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.head, i = 0; walker !== null; i++) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.next\n }\n}\n\nYallist.prototype.forEachReverse = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.prev\n }\n}\n\nYallist.prototype.get = function (n) {\n for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.next\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.getReverse = function (n) {\n for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.map = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.head; walker !== null; ) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.next\n }\n return res\n}\n\nYallist.prototype.mapReverse = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.tail; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.prev\n }\n return res\n}\n\nYallist.prototype.reduce = function (fn, initial) {\n var acc\n var walker = this.head\n if (arguments.length > 1) {\n acc = initial\n } else if (this.head) {\n walker = this.head.next\n acc = this.head.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = 0; walker !== null; i++) {\n acc = fn(acc, walker.value, i)\n walker = walker.next\n }\n\n return acc\n}\n\nYallist.prototype.reduceReverse = function (fn, initial) {\n var acc\n var walker = this.tail\n if (arguments.length > 1) {\n acc = initial\n } else if (this.tail) {\n walker = this.tail.prev\n acc = this.tail.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = this.length - 1; walker !== null; i--) {\n acc = fn(acc, walker.value, i)\n walker = walker.prev\n }\n\n return acc\n}\n\nYallist.prototype.toArray = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.head; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.next\n }\n return arr\n}\n\nYallist.prototype.toArrayReverse = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.tail; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.prev\n }\n return arr\n}\n\nYallist.prototype.slice = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n walker = walker.next\n }\n for (; walker !== null && i < to; i++, walker = walker.next) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.sliceReverse = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n walker = walker.prev\n }\n for (; walker !== null && i > from; i--, walker = walker.prev) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.reverse = function () {\n var head = this.head\n var tail = this.tail\n for (var walker = head; walker !== null; walker = walker.prev) {\n var p = walker.prev\n walker.prev = walker.next\n walker.next = p\n }\n this.head = tail\n this.tail = head\n return this\n}\n\nfunction push (self, item) {\n self.tail = new Node(item, self.tail, null, self)\n if (!self.head) {\n self.head = self.tail\n }\n self.length ++\n}\n\nfunction unshift (self, item) {\n self.head = new Node(item, null, self.head, self)\n if (!self.tail) {\n self.tail = self.head\n }\n self.length ++\n}\n\nfunction Node (value, prev, next, list) {\n if (!(this instanceof Node)) {\n return new Node(value, prev, next, list)\n }\n\n this.list = list\n this.value = value\n\n if (prev) {\n prev.next = this\n this.prev = prev\n } else {\n this.prev = null\n }\n\n if (next) {\n next.prev = this\n this.next = next\n } else {\n this.next = null\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/yallist/yallist.js\n ** module id = 65\n ** module chunks = 0\n **/","import Tile from './Tile';\nimport BoxHelper from '../../vendor/BoxHelper';\nimport THREE from 'three';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\nclass ImageTile extends Tile {\n constructor(quadcode, path, layer) {\n super(quadcode, path, layer);\n }\n\n // Request data for the tile\n requestTileAsync() {\n // Making this asynchronous really speeds up the LOD framerate\n setTimeout(() => {\n if (!this._mesh) {\n this._mesh = this._createMesh();\n this._requestTile();\n }\n }, 0);\n }\n\n destroy() {\n // Cancel any pending requests\n this._abortRequest();\n\n // Clear image reference\n this._image = null;\n\n super.destroy();\n }\n\n _createMesh() {\n // Something went wrong and the tile\n //\n // Possibly removed by the cache before loaded\n if (!this._center) {\n return;\n }\n\n var mesh = new THREE.Object3D();\n var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n\n var material;\n if (!this._world._environment._skybox) {\n material = new THREE.MeshBasicMaterial({\n depthWrite: false\n });\n\n // var material = new THREE.MeshPhongMaterial({\n // depthWrite: false\n // });\n } else {\n // Other MeshStandardMaterial settings\n //\n // material.envMapIntensity will change the amount of colour reflected(?)\n // from the environment map – can be greater than 1 for more intensity\n\n material = new THREE.MeshStandardMaterial({\n depthWrite: false\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var localMesh = new THREE.Mesh(geom, material);\n localMesh.rotation.x = -90 * Math.PI / 180;\n\n localMesh.receiveShadow = true;\n\n mesh.add(localMesh);\n mesh.renderOrder = 0.1;\n\n mesh.position.x = this._center[0];\n mesh.position.z = this._center[1];\n\n // var box = new BoxHelper(localMesh);\n // mesh.add(box);\n //\n // mesh.add(this._createDebugMesh());\n\n return mesh;\n }\n\n _createDebugMesh() {\n var canvas = document.createElement('canvas');\n canvas.width = 256;\n canvas.height = 256;\n\n var context = canvas.getContext('2d');\n context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n context.fillStyle = '#ff0000';\n context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\n var texture = new THREE.Texture(canvas);\n\n // Silky smooth images when tilted\n texture.magFilter = THREE.LinearFilter;\n texture.minFilter = THREE.LinearMipMapLinearFilter;\n\n // TODO: Set this to renderer.getMaxAnisotropy() / 4\n texture.anisotropy = 4;\n\n texture.needsUpdate = true;\n\n var material = new THREE.MeshBasicMaterial({\n map: texture,\n transparent: true,\n depthWrite: false\n });\n\n var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n var mesh = new THREE.Mesh(geom, material);\n\n mesh.rotation.x = -90 * Math.PI / 180;\n mesh.position.y = 0.1;\n\n return mesh;\n }\n\n _requestTile() {\n var urlParams = {\n x: this._tile[0],\n y: this._tile[1],\n z: this._tile[2]\n };\n\n var url = this._getTileURL(urlParams);\n\n var image = document.createElement('img');\n\n image.addEventListener('load', event => {\n var texture = new THREE.Texture();\n\n texture.image = image;\n texture.needsUpdate = true;\n\n // Silky smooth images when tilted\n texture.magFilter = THREE.LinearFilter;\n texture.minFilter = THREE.LinearMipMapLinearFilter;\n\n // TODO: Set this to renderer.getMaxAnisotropy() / 4\n texture.anisotropy = 4;\n\n texture.needsUpdate = true;\n\n // Something went wrong and the tile or its material is missing\n //\n // Possibly removed by the cache before the image loaded\n if (!this._mesh || !this._mesh.children[0] || !this._mesh.children[0].material) {\n return;\n }\n\n this._mesh.children[0].material.map = texture;\n this._mesh.children[0].material.needsUpdate = true;\n\n this._texture = texture;\n this._ready = true;\n }, false);\n\n // image.addEventListener('progress', event => {}, false);\n // image.addEventListener('error', event => {}, false);\n\n image.crossOrigin = '';\n\n // Load image\n image.src = url;\n\n this._image = image;\n }\n\n _abortRequest() {\n if (!this._image) {\n return;\n }\n\n this._image.src = '';\n }\n}\n\nexport default ImageTile;\n\nvar noNew = function(quadcode, path, layer) {\n return new ImageTile(quadcode, path, layer);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as imageTile};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/ImageTile.js\n **/","import {point as Point} from '../../geo/Point';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport THREE from 'three';\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// Manages a single tile and its layers\n\nvar r2d = 180 / Math.PI;\n\nvar tileURLRegex = /\\{([szxy])\\}/g;\n\nclass Tile {\n constructor(quadcode, path, layer) {\n this._layer = layer;\n this._world = layer._world;\n this._quadcode = quadcode;\n this._path = path;\n\n this._ready = false;\n\n this._tile = this._quadcodeToTile(quadcode);\n\n // Bottom-left and top-right bounds in WGS84 coordinates\n this._boundsLatLon = this._tileBoundsWGS84(this._tile);\n\n // Bottom-left and top-right bounds in world coordinates\n this._boundsWorld = this._tileBoundsFromWGS84(this._boundsLatLon);\n\n // Tile center in world coordinates\n this._center = this._boundsToCenter(this._boundsWorld);\n\n // Tile center in projected coordinates\n this._centerLatlon = this._world.pointToLatLon(Point(this._center[0], this._center[1]));\n\n // Length of a tile side in world coorindates\n this._side = this._getSide(this._boundsWorld);\n\n // Point scale for tile (for unit conversion)\n this._pointScale = this._world.pointScale(this._centerLatlon);\n }\n\n // Returns true if the tile mesh and texture are ready to be used\n // Otherwise, returns false\n isReady() {\n return this._ready;\n }\n\n // Request data for the tile\n requestTileAsync() {}\n\n getQuadcode() {\n return this._quadcode;\n }\n\n getBounds() {\n return this._boundsWorld;\n }\n\n getCenter() {\n return this._center;\n }\n\n getSide() {\n return this._side;\n }\n\n getMesh() {\n return this._mesh;\n }\n\n getPickingMesh() {\n return this._pickingMesh;\n }\n\n // Destroys the tile and removes it from the layer and memory\n //\n // Ensure that this leaves no trace of the tile – no textures, no meshes,\n // nothing in memory or the GPU\n destroy() {\n // Delete reference to layer and world\n this._layer = null;\n this._world = null;\n\n // Delete location references\n this._boundsLatLon = null;\n this._boundsWorld = null;\n this._center = null;\n\n // Done if no mesh\n if (!this._mesh) {\n return;\n }\n\n if (this._mesh.children) {\n // Dispose of mesh and materials\n this._mesh.children.forEach(child => {\n child.geometry.dispose();\n child.geometry = null;\n\n if (child.material.map) {\n child.material.map.dispose();\n child.material.map = null;\n }\n\n child.material.dispose();\n child.material = null;\n });\n } else {\n this._mesh.geometry.dispose();\n this._mesh.geometry = null;\n\n if (this._mesh.material.map) {\n this._mesh.material.map.dispose();\n this._mesh.material.map = null;\n }\n\n this._mesh.material.dispose();\n this._mesh.material = null;\n }\n }\n\n _createMesh() {}\n _createDebugMesh() {}\n\n _getTileURL(urlParams) {\n if (!urlParams.s) {\n // Default to a random choice of a, b or c\n urlParams.s = String.fromCharCode(97 + Math.floor(Math.random() * 3));\n }\n\n tileURLRegex.lastIndex = 0;\n return this._path.replace(tileURLRegex, function(value, key) {\n // Replace with paramter, otherwise keep existing value\n return urlParams[key];\n });\n }\n\n // Convert from quadcode to TMS tile coordinates\n _quadcodeToTile(quadcode) {\n var x = 0;\n var y = 0;\n var z = quadcode.length;\n\n for (var i = z; i > 0; i--) {\n var mask = 1 << (i - 1);\n var q = +quadcode[z - i];\n if (q === 1) {\n x |= mask;\n }\n if (q === 2) {\n y |= mask;\n }\n if (q === 3) {\n x |= mask;\n y |= mask;\n }\n }\n\n return [x, y, z];\n }\n\n // Convert WGS84 tile bounds to world coordinates\n _tileBoundsFromWGS84(boundsWGS84) {\n var sw = this._layer._world.latLonToPoint(LatLon(boundsWGS84[1], boundsWGS84[0]));\n var ne = this._layer._world.latLonToPoint(LatLon(boundsWGS84[3], boundsWGS84[2]));\n\n return [sw.x, sw.y, ne.x, ne.y];\n }\n\n // Get tile bounds in WGS84 coordinates\n _tileBoundsWGS84(tile) {\n var e = this._tile2lon(tile[0] + 1, tile[2]);\n var w = this._tile2lon(tile[0], tile[2]);\n var s = this._tile2lat(tile[1] + 1, tile[2]);\n var n = this._tile2lat(tile[1], tile[2]);\n return [w, s, e, n];\n }\n\n _tile2lon(x, z) {\n return x / Math.pow(2, z) * 360 - 180;\n }\n\n _tile2lat(y, z) {\n var n = Math.PI - 2 * Math.PI * y / Math.pow(2, z);\n return r2d * Math.atan(0.5 * (Math.exp(n) - Math.exp(-n)));\n }\n\n _boundsToCenter(bounds) {\n var x = bounds[0] + (bounds[2] - bounds[0]) / 2;\n var y = bounds[1] + (bounds[3] - bounds[1]) / 2;\n\n return [x, y];\n }\n\n _getSide(bounds) {\n return (new THREE.Vector3(bounds[0], 0, bounds[3])).sub(new THREE.Vector3(bounds[0], 0, bounds[1])).length();\n }\n}\n\nexport default Tile;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/Tile.js\n **/","// jscs:disable\n/* eslint-disable */\n\nimport THREE from 'three';\n\n/**\n * @author mrdoob / http://mrdoob.com/\n */\n\nBoxHelper = function ( object ) {\n\n\tvar indices = new Uint16Array( [ 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 ] );\n\tvar positions = new Float32Array( 8 * 3 );\n\n\tvar geometry = new THREE.BufferGeometry();\n\tgeometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );\n\tgeometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );\n\n\tTHREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { linewidth: 2, color: 0xff0000 } ) );\n\n\tif ( object !== undefined ) {\n\n\t\tthis.update( object );\n\n\t}\n\n};\n\nBoxHelper.prototype = Object.create( THREE.LineSegments.prototype );\nBoxHelper.prototype.constructor = BoxHelper;\n\nBoxHelper.prototype.update = ( function () {\n\n\tvar box = new THREE.Box3();\n\n\treturn function ( object ) {\n\n\t\tbox.setFromObject( object );\n\n\t\tif ( box.isEmpty() ) return;\n\n\t\tvar min = box.min;\n\t\tvar max = box.max;\n\n\t\t/*\n\t\t 5____4\n\t\t1/___0/|\n\t\t| 6__|_7\n\t\t2/___3/\n\n\t\t0: max.x, max.y, max.z\n\t\t1: min.x, max.y, max.z\n\t\t2: min.x, min.y, max.z\n\t\t3: max.x, min.y, max.z\n\t\t4: max.x, max.y, min.z\n\t\t5: min.x, max.y, min.z\n\t\t6: min.x, min.y, min.z\n\t\t7: max.x, min.y, min.z\n\t\t*/\n\n\t\tvar position = this.geometry.attributes.position;\n\t\tvar array = position.array;\n\n\t\tarray[ 0 ] = max.x; array[ 1 ] = max.y; array[ 2 ] = max.z;\n\t\tarray[ 3 ] = min.x; array[ 4 ] = max.y; array[ 5 ] = max.z;\n\t\tarray[ 6 ] = min.x; array[ 7 ] = min.y; array[ 8 ] = max.z;\n\t\tarray[ 9 ] = max.x; array[ 10 ] = min.y; array[ 11 ] = max.z;\n\t\tarray[ 12 ] = max.x; array[ 13 ] = max.y; array[ 14 ] = min.z;\n\t\tarray[ 15 ] = min.x; array[ 16 ] = max.y; array[ 17 ] = min.z;\n\t\tarray[ 18 ] = min.x; array[ 19 ] = min.y; array[ 20 ] = min.z;\n\t\tarray[ 21 ] = max.x; array[ 22 ] = min.y; array[ 23 ] = min.z;\n\n\t\tposition.needsUpdate = true;\n\n\t\tthis.geometry.computeBoundingSphere();\n\n\t};\n\n} )();\n\nexport default BoxHelper;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/vendor/BoxHelper.js\n **/","import THREE from 'three';\n\nexport default function(colour, skyboxTarget) {\n var canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n\n var context = canvas.getContext('2d');\n context.fillStyle = colour;\n context.fillRect(0, 0, canvas.width, canvas.height);\n // context.strokeStyle = '#D0D0CF';\n // context.strokeRect(0, 0, canvas.width, canvas.height);\n\n var texture = new THREE.Texture(canvas);\n\n // // Silky smooth images when tilted\n // texture.magFilter = THREE.LinearFilter;\n // texture.minFilter = THREE.LinearMipMapLinearFilter;\n // //\n // // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n // texture.anisotropy = 4;\n\n // texture.wrapS = THREE.RepeatWrapping;\n // texture.wrapT = THREE.RepeatWrapping;\n // texture.repeat.set(segments, segments);\n\n texture.needsUpdate = true;\n\n var material;\n\n if (!skyboxTarget) {\n material = new THREE.MeshBasicMaterial({\n map: texture,\n depthWrite: false\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n depthWrite: false\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMap = skyboxTarget;\n }\n\n return material;\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/ImageTileLayerBaseMaterial.js\n **/","import TileLayer from './TileLayer';\nimport extend from 'lodash.assign';\nimport GeoJSONTile from './GeoJSONTile';\nimport throttle from 'lodash.throttle';\nimport THREE from 'three';\n\n// TODO: Offer on-the-fly slicing of static, non-tile-based GeoJSON files into a\n// tile grid using geojson-vt\n//\n// See: https://github.com/mapbox/geojson-vt\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Consider pausing per-frame output during movement so there's little to\n// no jank caused by previous tiles still processing\n\n// This tile layer only updates the quadtree after world movement has occurred\n//\n// Tiles from previous quadtree updates are updated and outputted every frame\n// (or at least every frame, throttled to some amount)\n//\n// This is because the complexity of TopoJSON tiles requires a lot of processing\n// and so makes movement janky if updates occur every frame – only updating\n// after movement means frame drops are less obvious due to heavy processing\n// occurring while the view is generally stationary\n//\n// The downside is that until new tiles are requested and outputted you will\n// see blank spaces as you orbit and move around\n//\n// An added benefit is that it dramatically reduces the number of tiles being\n// requested over a period of time and the time it takes to go from request to\n// screen output\n//\n// It may be possible to perform these updates per-frame once Web Worker\n// processing is added\n\nclass GeoJSONTileLayer extends TileLayer {\n constructor(path, options) {\n var defaults = {\n maxLOD: 14,\n distance: 2000\n };\n\n options = extend({}, defaults, options);\n\n super(options);\n\n this._path = path;\n }\n\n _onAdd(world) {\n super._onAdd(world);\n\n // Trigger initial quadtree calculation on the next frame\n //\n // TODO: This is a hack to ensure the camera is all set up - a better\n // solution should be found\n setTimeout(() => {\n this._calculateLOD();\n this._initEvents();\n }, 0);\n }\n\n _initEvents() {\n // Run LOD calculations based on render calls\n //\n // Throttled to 1 LOD calculation per 100ms\n this._throttledWorldUpdate = throttle(this._onWorldUpdate, 100);\n\n this._world.on('preUpdate', this._throttledWorldUpdate, this);\n this._world.on('move', this._onWorldMove, this);\n this._world.on('controlsMove', this._onControlsMove, this);\n }\n\n // Update and output tiles each frame (throttled)\n _onWorldUpdate() {\n if (this._pauseOutput) {\n return;\n }\n\n this._outputTiles();\n }\n\n // Update tiles grid after world move, but don't output them\n _onWorldMove(latlon, point) {\n this._pauseOutput = false;\n this._calculateLOD();\n }\n\n // Pause updates during control movement for less visual jank\n _onControlsMove() {\n this._pauseOutput = true;\n }\n\n _createTile(quadcode, layer) {\n var options = {};\n\n // if (this._options.filter) {\n // options.filter = this._options.filter;\n // }\n //\n // if (this._options.style) {\n // options.style = this._options.style;\n // }\n //\n // if (this._options.topojson) {\n // options.topojson = true;\n // }\n //\n // if (this._options.interactive) {\n // options.interactive = true;\n // }\n //\n // if (this._options.onClick) {\n // options.onClick = this._options.onClick;\n // }\n\n return new GeoJSONTile(quadcode, this._path, layer, this._options);\n }\n\n // Destroys the layer and removes it from the scene and memory\n destroy() {\n this._world.off('preUpdate', this._throttledWorldUpdate);\n this._world.off('move', this._onWorldMove);\n\n this._throttledWorldUpdate = null;\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default GeoJSONTileLayer;\n\nvar noNew = function(path, options) {\n return new GeoJSONTileLayer(path, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as geoJSONTileLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/GeoJSONTileLayer.js\n **/","import Tile from './Tile';\nimport {geoJSONLayer as GeoJSONLayer} from '../GeoJSONLayer';\nimport BoxHelper from '../../vendor/BoxHelper';\nimport THREE from 'three';\nimport reqwest from 'reqwest';\nimport {point as Point} from '../../geo/Point';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport extend from 'lodash.assign';\n// import Offset from 'polygon-offset';\nimport GeoJSON from '../../util/GeoJSON';\nimport Buffer from '../../util/Buffer';\nimport PickingMaterial from '../../engine/PickingMaterial';\n\n// TODO: Map picking IDs to some reference within the tile data / geometry so\n// that something useful can be done when an object is picked / clicked on\n\n// TODO: Make sure nothing is left behind in the heap after calling destroy()\n\n// TODO: Perform tile request and processing in a Web Worker\n//\n// Use Operative (https://github.com/padolsey/operative)\n//\n// Would it make sense to have the worker functionality defined in a static\n// method so it only gets initialised once and not on every tile instance?\n//\n// Otherwise, worker processing logic would have to go in the tile layer so not\n// to waste loads of time setting up a brand new worker with three.js for each\n// tile every single time.\n//\n// Unsure of the best way to get three.js and VIZI into the worker\n//\n// Would need to set up a CRS / projection identical to the world instance\n//\n// Is it possible to bypass requirements on external script by having multiple\n// simple worker methods that each take enough inputs to perform a single task\n// without requiring VIZI or three.js? So long as the heaviest logic is done in\n// the worker and transferrable objects are used then it should be better than\n// nothing. Would probably still need things like earcut...\n//\n// After all, the three.js logic and object creation will still need to be\n// done on the main thread regardless so the worker should try to do as much as\n// possible with as few dependencies as possible.\n//\n// Have a look at how this is done in Tangram before implementing anything as\n// the approach there is pretty similar and robust.\n\nclass GeoJSONTile extends Tile {\n constructor(quadcode, path, layer, options) {\n super(quadcode, path, layer);\n\n this._defaultStyle = GeoJSON.defaultStyle;\n\n var defaults = {\n output: true,\n outputToScene: false,\n interactive: false,\n topojson: false,\n filter: null,\n onEachFeature: null,\n polygonMaterial: null,\n onPolygonMesh: null,\n onPolygonBufferAttributes: null,\n polylineMaterial: null,\n onPolylineMesh: null,\n onPolylineBufferAttributes: null,\n pointGeometry: null,\n pointMaterial: null,\n onPointMesh: null,\n style: GeoJSON.defaultStyle,\n keepFeatures: false\n };\n\n var _options = extend({}, defaults, options);\n\n if (typeof options.style === 'function') {\n _options.style = options.style;\n } else {\n _options.style = extend({}, defaults.style, options.style);\n }\n\n this._options = _options;\n }\n\n // Request data for the tile\n requestTileAsync() {\n // Making this asynchronous really speeds up the LOD framerate\n setTimeout(() => {\n if (!this._mesh) {\n this._mesh = this._createMesh();\n\n // this._shadowCanvas = this._createShadowCanvas();\n\n this._requestTile();\n }\n }, 0);\n }\n\n // TODO: Destroy GeoJSONLayer\n destroy() {\n // Cancel any pending requests\n this._abortRequest();\n\n // Clear request reference\n this._request = null;\n\n if (this._geojsonLayer) {\n this._geojsonLayer.destroy();\n this._geojsonLayer = null;\n }\n\n this._mesh = null;\n\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n\n super.destroy();\n }\n\n _createMesh() {\n // Something went wrong and the tile\n //\n // Possibly removed by the cache before loaded\n if (!this._center) {\n return;\n }\n\n var mesh = new THREE.Object3D();\n // mesh.add(this._createDebugMesh());\n\n return mesh;\n }\n\n _createDebugMesh() {\n var canvas = document.createElement('canvas');\n canvas.width = 256;\n canvas.height = 256;\n\n var context = canvas.getContext('2d');\n context.font = 'Bold 20px Helvetica Neue, Verdana, Arial';\n context.fillStyle = '#ff0000';\n context.fillText(this._quadcode, 20, canvas.width / 2 - 5);\n context.fillText(this._tile.toString(), 20, canvas.width / 2 + 25);\n\n var texture = new THREE.Texture(canvas);\n\n // Silky smooth images when tilted\n texture.magFilter = THREE.LinearFilter;\n texture.minFilter = THREE.LinearMipMapLinearFilter;\n\n // TODO: Set this to renderer.getMaxAnisotropy() / 4\n texture.anisotropy = 4;\n\n texture.needsUpdate = true;\n\n var material = new THREE.MeshBasicMaterial({\n map: texture,\n transparent: true,\n depthWrite: false\n });\n\n var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n var mesh = new THREE.Mesh(geom, material);\n\n mesh.rotation.x = -90 * Math.PI / 180;\n mesh.position.y = 0.1;\n\n return mesh;\n }\n\n // _createShadowCanvas() {\n // var canvas = document.createElement('canvas');\n //\n // // Rendered at a low resolution and later scaled up for a low-quality blur\n // canvas.width = 512;\n // canvas.height = 512;\n //\n // return canvas;\n // }\n\n // _addShadow(coordinates) {\n // var ctx = this._shadowCanvas.getContext('2d');\n // var width = this._shadowCanvas.width;\n // var height = this._shadowCanvas.height;\n //\n // var _coords;\n // var _offset;\n // var offset = new Offset();\n //\n // // Transform coordinates to shadowCanvas space and draw on canvas\n // coordinates.forEach((ring, index) => {\n // ctx.beginPath();\n //\n // _coords = ring.map(coord => {\n // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n // return [xFrac * width, yFrac * height];\n // });\n //\n // if (index > 0) {\n // _offset = _coords;\n // } else {\n // _offset = offset.data(_coords).padding(1.3);\n // }\n //\n // // TODO: This is super flaky and crashes the browser if run on anything\n // // put the outer ring (potentially due to winding)\n // _offset.forEach((coord, index) => {\n // // var xFrac = (coord[0] - this._boundsWorld[0]) / this._side;\n // // var yFrac = (coord[1] - this._boundsWorld[3]) / this._side;\n //\n // if (index === 0) {\n // ctx.moveTo(coord[0], coord[1]);\n // } else {\n // ctx.lineTo(coord[0], coord[1]);\n // }\n // });\n //\n // ctx.closePath();\n // });\n //\n // ctx.fillStyle = 'rgba(80, 80, 80, 0.7)';\n // ctx.fill();\n // }\n\n _requestTile() {\n var urlParams = {\n x: this._tile[0],\n y: this._tile[1],\n z: this._tile[2]\n };\n\n var url = this._getTileURL(urlParams);\n\n this._request = reqwest({\n url: url,\n type: 'json',\n crossOrigin: true\n }).then(res => {\n // Clear request reference\n this._request = null;\n this._processTileData(res);\n }).catch(err => {\n console.error(err);\n\n // Clear request reference\n this._request = null;\n });\n }\n\n _processTileData(data) {\n console.time(this._tile);\n\n // Using this creates a huge amount of memory due to the quantity of tiles\n this._geojsonLayer = GeoJSONLayer(data, this._options).addTo(this._world);\n\n this._mesh = this._geojsonLayer._object3D;\n this._pickingMesh = this._geojsonLayer._pickingMesh;\n\n // Free the GeoJSON memory as we don't need it\n //\n // TODO: This should probably be a method within GeoJSONLayer\n this._geojsonLayer._geojson = null;\n\n // TODO: Fix or store shadow canvas stuff and get rid of this code\n // Draw footprint on shadow canvas\n //\n // TODO: Disabled for the time-being until it can be sped up / moved to\n // a worker\n // this._addShadow(coordinates);\n\n // Output shadow canvas\n\n // TODO: Disabled for the time-being until it can be sped up / moved to\n // a worker\n\n // var texture = new THREE.Texture(this._shadowCanvas);\n //\n // // Silky smooth images when tilted\n // texture.magFilter = THREE.LinearFilter;\n // texture.minFilter = THREE.LinearMipMapLinearFilter;\n //\n // // TODO: Set this to renderer.getMaxAnisotropy() / 4\n // texture.anisotropy = 4;\n //\n // texture.needsUpdate = true;\n //\n // var material;\n // if (!this._world._environment._skybox) {\n // material = new THREE.MeshBasicMaterial({\n // map: texture,\n // transparent: true,\n // depthWrite: false\n // });\n // } else {\n // material = new THREE.MeshStandardMaterial({\n // map: texture,\n // transparent: true,\n // depthWrite: false\n // });\n // material.roughness = 1;\n // material.metalness = 0.1;\n // material.envMap = this._world._environment._skybox.getRenderTarget();\n // }\n //\n // var geom = new THREE.PlaneBufferGeometry(this._side, this._side, 1);\n // var mesh = new THREE.Mesh(geom, material);\n //\n // mesh.castShadow = false;\n // mesh.receiveShadow = false;\n // mesh.renderOrder = 1;\n //\n // mesh.rotation.x = -90 * Math.PI / 180;\n //\n // this._mesh.add(mesh);\n\n this._ready = true;\n console.timeEnd(this._tile);\n }\n\n _abortRequest() {\n if (!this._request) {\n return;\n }\n\n this._request.abort();\n }\n}\n\nexport default GeoJSONTile;\n\nvar noNew = function(quadcode, path, layer, options) {\n return new GeoJSONTile(quadcode, path, layer, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as geoJSONTile};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/GeoJSONTile.js\n **/","// TODO: Consider adopting GeoJSON CSS\n// http://wiki.openstreetmap.org/wiki/Geojson_CSS\n\n// TODO: Allow interaction to be defined per-layer to save on resources\n//\n// For example, only allow polygons to be interactive via a polygonInteractive\n// option\n\nimport LayerGroup from './LayerGroup';\nimport extend from 'lodash.assign';\nimport reqwest from 'reqwest';\nimport GeoJSON from '../util/GeoJSON';\nimport Buffer from '../util/Buffer';\nimport PickingMaterial from '../engine/PickingMaterial';\nimport PolygonLayer from './geometry/PolygonLayer';\nimport PolylineLayer from './geometry/PolylineLayer';\nimport PointLayer from './geometry/PointLayer';\n\nclass GeoJSONLayer extends LayerGroup {\n constructor(geojson, options) {\n var defaults = {\n output: false,\n interactive: false,\n topojson: false,\n filter: null,\n onEachFeature: null,\n polygonMaterial: null,\n onPolygonMesh: null,\n onPolygonBufferAttributes: null,\n polylineMaterial: null,\n onPolylineMesh: null,\n onPolylineBufferAttributes: null,\n pointGeometry: null,\n pointMaterial: null,\n onPointMesh: null,\n style: GeoJSON.defaultStyle,\n keepFeatures: true\n };\n\n var _options = extend({}, defaults, options);\n\n if (typeof options.style === 'function') {\n _options.style = options.style;\n } else {\n _options.style = extend({}, defaults.style, options.style);\n }\n\n super(_options);\n\n this._geojson = geojson;\n }\n\n _onAdd(world) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n // Request data from URL if needed\n if (typeof this._geojson === 'string') {\n this._requestData(this._geojson);\n } else {\n // Process and add GeoJSON to layer\n this._processData(this._geojson);\n }\n }\n\n _requestData(url) {\n this._request = reqwest({\n url: url,\n type: 'json',\n crossOrigin: true\n }).then(res => {\n // Clear request reference\n this._request = null;\n this._processData(res);\n }).catch(err => {\n console.error(err);\n\n // Clear request reference\n this._request = null;\n });\n }\n\n // TODO: Wrap into a helper method so this isn't duplicated in the tiled\n // GeoJSON output layer\n //\n // Need to be careful as to not make it impossible to fork this off into a\n // worker script at a later stage\n _processData(data) {\n // Collects features into a single FeatureCollection\n //\n // Also converts TopoJSON to GeoJSON if instructed\n this._geojson = GeoJSON.collectFeatures(data, this._options.topojson);\n\n // TODO: Check that GeoJSON is valid / usable\n\n var features = this._geojson.features;\n\n // Run filter, if provided\n if (this._options.filter) {\n features = this._geojson.features.filter(this._options.filter);\n }\n\n var defaults = {};\n\n // Assume that a style won't be set per feature\n var style = this._options.style;\n\n var options;\n features.forEach(feature => {\n // Get per-feature style object, if provided\n if (typeof this._options.style === 'function') {\n style = extend({}, GeoJSON.defaultStyle, this._options.style(feature));\n }\n\n options = extend({}, defaults, {\n // If merging feature layers, stop them outputting themselves\n // If not, let feature layers output themselves to the world\n output: !this.isOutput(),\n interactive: this._options.interactive,\n style: style\n });\n\n var layer = this._featureToLayer(feature, options);\n\n if (!layer) {\n return;\n }\n\n // Sometimes you don't want to store a reference to the feature\n //\n // For example, to save memory when being used by tile layers\n if (this._options.keepFeatures) {\n layer.feature = feature;\n }\n\n // If defined, call a function for each feature\n //\n // This is commonly used for adding event listeners from the user script\n if (this._options.onEachFeature) {\n this._options.onEachFeature(feature, layer);\n }\n\n this.addLayer(layer);\n });\n\n // If merging layers do that now, otherwise skip as the geometry layers\n // should have already outputted themselves\n if (!this.isOutput()) {\n return;\n }\n\n // From here on we can assume that we want to merge the layers\n\n var polygonAttributes = [];\n var polygonFlat = true;\n\n var polylineAttributes = [];\n var pointAttributes = [];\n\n this._layers.forEach(layer => {\n if (layer instanceof PolygonLayer) {\n polygonAttributes.push(layer.getBufferAttributes());\n\n if (polygonFlat && !layer.isFlat()) {\n polygonFlat = false;\n }\n } else if (layer instanceof PolylineLayer) {\n polylineAttributes.push(layer.getBufferAttributes());\n } else if (layer instanceof PointLayer) {\n pointAttributes.push(layer.getBufferAttributes());\n }\n });\n\n if (polygonAttributes.length > 0) {\n var mergedPolygonAttributes = Buffer.mergeAttributes(polygonAttributes);\n this._setPolygonMesh(mergedPolygonAttributes, polygonFlat);\n this.add(this._polygonMesh);\n }\n\n if (polylineAttributes.length > 0) {\n var mergedPolylineAttributes = Buffer.mergeAttributes(polylineAttributes);\n this._setPolylineMesh(mergedPolylineAttributes);\n this.add(this._polylineMesh);\n }\n\n if (pointAttributes.length > 0) {\n var mergedPointAttributes = Buffer.mergeAttributes(pointAttributes);\n this._setPointMesh(mergedPointAttributes);\n this.add(this._pointMesh);\n }\n\n // Clean up layers\n //\n // TODO: Are there ever situations where the unmerged buffer attributes\n // and coordinates would still be required?\n this._layers.forEach(layer => {\n layer.clearBufferAttributes();\n layer.clearCoordinates();\n });\n }\n\n // Create and store mesh from buffer attributes\n //\n // TODO: De-dupe this from the individual mesh creation logic within each\n // geometry layer (materials, settings, etc)\n //\n // Could make this an abstract method for each geometry layer\n _setPolygonMesh(attributes, flat) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n // TODO: Make this work when style is a function per feature\n var style = (typeof this._options.style === 'function') ? this._options.style(this._geojson.features[0]) : this._options.style;\n style = extend({}, GeoJSON.defaultStyle, style);\n\n var material;\n if (this._options.polygonMaterial && this._options.polygonMaterial instanceof THREE.Material) {\n material = this._options.polygonMaterial;\n } else if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide,\n transparent: style.transparent,\n opacity: style.opacity,\n blending: style.blending\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide,\n transparent: style.transparent,\n opacity: style.opacity,\n blending: style.blending\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var mesh;\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onPolygonMesh === 'function') {\n mesh = this._options.onPolygonMesh(geometry, material);\n } else {\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n }\n\n if (flat) {\n material.depthWrite = false;\n mesh.renderOrder = 1;\n }\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._polygonMesh = mesh;\n }\n\n _setPolylineMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\n if (attributes.normals) {\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n }\n\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n // TODO: Make this work when style is a function per feature\n var style = (typeof this._options.style === 'function') ? this._options.style(this._geojson.features[0]) : this._options.style;\n style = extend({}, GeoJSON.defaultStyle, style);\n\n var material;\n if (this._options.polylineMaterial && this._options.polylineMaterial instanceof THREE.Material) {\n material = this._options.polylineMaterial;\n } else {\n material = new THREE.LineBasicMaterial({\n vertexColors: THREE.VertexColors,\n linewidth: style.lineWidth,\n transparent: style.lineTransparent,\n opacity: style.lineOpacity,\n blending: style.lineBlending\n });\n }\n\n var mesh;\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onPolylineMesh === 'function') {\n mesh = this._options.onPolylineMesh(geometry, material);\n } else {\n mesh = new THREE.LineSegments(geometry, material);\n\n if (style.lineRenderOrder !== undefined) {\n material.depthWrite = false;\n mesh.renderOrder = style.lineRenderOrder;\n }\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n }\n\n // TODO: Allow this to be overridden, or copy mesh instead of creating a new\n // one just for picking\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n // Make the line wider / easier to pick\n material.linewidth = style.lineWidth + material.linePadding;\n\n var pickingMesh = new THREE.LineSegments(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._polylineMesh = mesh;\n }\n\n _setPointMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n if (this._options.pointMaterial && this._options.pointMaterial instanceof THREE.Material) {\n material = this._options.pointMaterial;\n } else if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var mesh;\n\n // Pass mesh callback, if defined\n if (typeof this._options.onPointMesh === 'function') {\n mesh = this._options.onPointMesh(geometry, material);\n } else {\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n }\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._pointMesh = mesh;\n }\n\n // TODO: Support all GeoJSON geometry types\n _featureToLayer(feature, options) {\n var geometry = feature.geometry;\n var coordinates = (geometry.coordinates) ? geometry.coordinates : null;\n\n if (!coordinates || !geometry) {\n return;\n }\n\n if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {\n // Get material instance to use for polygon, if provided\n if (typeof this._options.polygonMaterial === 'function') {\n options.geometry = this._options.polygonMaterial(feature);\n }\n\n if (typeof this._options.onPolygonMesh === 'function') {\n options.onMesh = this._options.onPolygonMesh;\n }\n\n // Pass onBufferAttributes callback, if defined\n if (typeof this._options.onPolygonBufferAttributes === 'function') {\n options.onBufferAttributes = this._options.onPolygonBufferAttributes;\n }\n\n return new PolygonLayer(coordinates, options);\n }\n\n if (geometry.type === 'LineString' || geometry.type === 'MultiLineString') {\n // Get material instance to use for line, if provided\n if (typeof this._options.lineMaterial === 'function') {\n options.geometry = this._options.lineMaterial(feature);\n }\n\n if (typeof this._options.onPolylineMesh === 'function') {\n options.onMesh = this._options.onPolylineMesh;\n }\n\n // Pass onBufferAttributes callback, if defined\n if (typeof this._options.onPolylineBufferAttributes === 'function') {\n options.onBufferAttributes = this._options.onPolylineBufferAttributes;\n }\n\n return new PolylineLayer(coordinates, options);\n }\n\n if (geometry.type === 'Point' || geometry.type === 'MultiPoint') {\n // Get geometry object to use for point, if provided\n if (typeof this._options.pointGeometry === 'function') {\n options.geometry = this._options.pointGeometry(feature);\n }\n\n // Get material instance to use for point, if provided\n if (typeof this._options.pointMaterial === 'function') {\n options.geometry = this._options.pointMaterial(feature);\n }\n\n if (typeof this._options.onPointMesh === 'function') {\n options.onMesh = this._options.onPointMesh;\n }\n\n return new PointLayer(coordinates, options);\n }\n }\n\n _abortRequest() {\n if (!this._request) {\n return;\n }\n\n this._request.abort();\n }\n\n // Destroy the layers and remove them from the scene and memory\n destroy() {\n // Cancel any pending requests\n this._abortRequest();\n\n // Clear request reference\n this._request = null;\n\n this._geojson = null;\n\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n if (this._polygonMesh) {\n this._polygonMesh = null;\n }\n\n if (this._polylineMesh) {\n this._polylineMesh = null;\n }\n\n if (this._pointMesh) {\n this._pointMesh = null;\n }\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default GeoJSONLayer;\n\nvar noNew = function(geojson, options) {\n return new GeoJSONLayer(geojson, options);\n};\n\nexport {noNew as geoJSONLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/GeoJSONLayer.js\n **/","import Layer from './Layer';\nimport extend from 'lodash.assign';\n\nclass LayerGroup extends Layer {\n constructor(options) {\n var defaults = {\n output: false\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n this._layers = [];\n }\n\n addLayer(layer) {\n this._layers.push(layer);\n this._world.addLayer(layer);\n }\n\n removeLayer(layer) {\n var layerIndex = this._layers.indexOf(layer);\n\n if (layerIndex > -1) {\n // Remove from this._layers\n this._layers.splice(layerIndex, 1);\n };\n\n this._world.removeLayer(layer);\n }\n\n _onAdd(world) {}\n\n // Destroy the layers and remove them from the scene and memory\n destroy() {\n // TODO: Sometimes this is already null, find out why\n if (this._layers) {\n for (var i = 0; i < this._layers.length; i++) {\n this._layers[i].destroy();\n }\n\n this._layers = null;\n }\n\n super.destroy();\n }\n}\n\nexport default LayerGroup;\n\nvar noNew = function(options) {\n return new LayerGroup(options);\n};\n\nexport {noNew as layerGroup};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/LayerGroup.js\n **/","/*!\n * Reqwest! A general purpose XHR connection manager\n * license MIT (c) Dustin Diaz 2015\n * https://github.com/ded/reqwest\n */\n\n!function (name, context, definition) {\n if (typeof module != 'undefined' && module.exports) module.exports = definition()\n else if (typeof define == 'function' && define.amd) define(definition)\n else context[name] = definition()\n}('reqwest', this, function () {\n\n var context = this\n\n if ('window' in context) {\n var doc = document\n , byTag = 'getElementsByTagName'\n , head = doc[byTag]('head')[0]\n } else {\n var XHR2\n try {\n XHR2 = require('xhr2')\n } catch (ex) {\n throw new Error('Peer dependency `xhr2` required! Please npm install xhr2')\n }\n }\n\n\n var httpsRe = /^http/\n , protocolRe = /(^\\w+):\\/\\//\n , twoHundo = /^(20\\d|1223)$/ //http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n , readyState = 'readyState'\n , contentType = 'Content-Type'\n , requestedWith = 'X-Requested-With'\n , uniqid = 0\n , callbackPrefix = 'reqwest_' + (+new Date())\n , lastValue // data stored by the most recent JSONP callback\n , xmlHttpRequest = 'XMLHttpRequest'\n , xDomainRequest = 'XDomainRequest'\n , noop = function () {}\n\n , isArray = typeof Array.isArray == 'function'\n ? Array.isArray\n : function (a) {\n return a instanceof Array\n }\n\n , defaultHeaders = {\n 'contentType': 'application/x-www-form-urlencoded'\n , 'requestedWith': xmlHttpRequest\n , 'accept': {\n '*': 'text/javascript, text/html, application/xml, text/xml, */*'\n , 'xml': 'application/xml, text/xml'\n , 'html': 'text/html'\n , 'text': 'text/plain'\n , 'json': 'application/json, text/javascript'\n , 'js': 'application/javascript, text/javascript'\n }\n }\n\n , xhr = function(o) {\n // is it x-domain\n if (o['crossOrigin'] === true) {\n var xhr = context[xmlHttpRequest] ? new XMLHttpRequest() : null\n if (xhr && 'withCredentials' in xhr) {\n return xhr\n } else if (context[xDomainRequest]) {\n return new XDomainRequest()\n } else {\n throw new Error('Browser does not support cross-origin requests')\n }\n } else if (context[xmlHttpRequest]) {\n return new XMLHttpRequest()\n } else if (XHR2) {\n return new XHR2()\n } else {\n return new ActiveXObject('Microsoft.XMLHTTP')\n }\n }\n , globalSetupOptions = {\n dataFilter: function (data) {\n return data\n }\n }\n\n function succeed(r) {\n var protocol = protocolRe.exec(r.url)\n protocol = (protocol && protocol[1]) || context.location.protocol\n return httpsRe.test(protocol) ? twoHundo.test(r.request.status) : !!r.request.response\n }\n\n function handleReadyState(r, success, error) {\n return function () {\n // use _aborted to mitigate against IE err c00c023f\n // (can't read props on aborted request objects)\n if (r._aborted) return error(r.request)\n if (r._timedOut) return error(r.request, 'Request is aborted: timeout')\n if (r.request && r.request[readyState] == 4) {\n r.request.onreadystatechange = noop\n if (succeed(r)) success(r.request)\n else\n error(r.request)\n }\n }\n }\n\n function setHeaders(http, o) {\n var headers = o['headers'] || {}\n , h\n\n headers['Accept'] = headers['Accept']\n || defaultHeaders['accept'][o['type']]\n || defaultHeaders['accept']['*']\n\n var isAFormData = typeof FormData !== 'undefined' && (o['data'] instanceof FormData);\n // breaks cross-origin requests with legacy browsers\n if (!o['crossOrigin'] && !headers[requestedWith]) headers[requestedWith] = defaultHeaders['requestedWith']\n if (!headers[contentType] && !isAFormData) headers[contentType] = o['contentType'] || defaultHeaders['contentType']\n for (h in headers)\n headers.hasOwnProperty(h) && 'setRequestHeader' in http && http.setRequestHeader(h, headers[h])\n }\n\n function setCredentials(http, o) {\n if (typeof o['withCredentials'] !== 'undefined' && typeof http.withCredentials !== 'undefined') {\n http.withCredentials = !!o['withCredentials']\n }\n }\n\n function generalCallback(data) {\n lastValue = data\n }\n\n function urlappend (url, s) {\n return url + (/\\?/.test(url) ? '&' : '?') + s\n }\n\n function handleJsonp(o, fn, err, url) {\n var reqId = uniqid++\n , cbkey = o['jsonpCallback'] || 'callback' // the 'callback' key\n , cbval = o['jsonpCallbackName'] || reqwest.getcallbackPrefix(reqId)\n , cbreg = new RegExp('((^|\\\\?|&)' + cbkey + ')=([^&]+)')\n , match = url.match(cbreg)\n , script = doc.createElement('script')\n , loaded = 0\n , isIE10 = navigator.userAgent.indexOf('MSIE 10.0') !== -1\n\n if (match) {\n if (match[3] === '?') {\n url = url.replace(cbreg, '$1=' + cbval) // wildcard callback func name\n } else {\n cbval = match[3] // provided callback func name\n }\n } else {\n url = urlappend(url, cbkey + '=' + cbval) // no callback details, add 'em\n }\n\n context[cbval] = generalCallback\n\n script.type = 'text/javascript'\n script.src = url\n script.async = true\n if (typeof script.onreadystatechange !== 'undefined' && !isIE10) {\n // need this for IE due to out-of-order onreadystatechange(), binding script\n // execution to an event listener gives us control over when the script\n // is executed. See http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html\n script.htmlFor = script.id = '_reqwest_' + reqId\n }\n\n script.onload = script.onreadystatechange = function () {\n if ((script[readyState] && script[readyState] !== 'complete' && script[readyState] !== 'loaded') || loaded) {\n return false\n }\n script.onload = script.onreadystatechange = null\n script.onclick && script.onclick()\n // Call the user callback with the last value stored and clean up values and scripts.\n fn(lastValue)\n lastValue = undefined\n head.removeChild(script)\n loaded = 1\n }\n\n // Add the script to the DOM head\n head.appendChild(script)\n\n // Enable JSONP timeout\n return {\n abort: function () {\n script.onload = script.onreadystatechange = null\n err({}, 'Request is aborted: timeout', {})\n lastValue = undefined\n head.removeChild(script)\n loaded = 1\n }\n }\n }\n\n function getRequest(fn, err) {\n var o = this.o\n , method = (o['method'] || 'GET').toUpperCase()\n , url = typeof o === 'string' ? o : o['url']\n // convert non-string objects to query-string form unless o['processData'] is false\n , data = (o['processData'] !== false && o['data'] && typeof o['data'] !== 'string')\n ? reqwest.toQueryString(o['data'])\n : (o['data'] || null)\n , http\n , sendWait = false\n\n // if we're working on a GET request and we have data then we should append\n // query string to end of URL and not post data\n if ((o['type'] == 'jsonp' || method == 'GET') && data) {\n url = urlappend(url, data)\n data = null\n }\n\n if (o['type'] == 'jsonp') return handleJsonp(o, fn, err, url)\n\n // get the xhr from the factory if passed\n // if the factory returns null, fall-back to ours\n http = (o.xhr && o.xhr(o)) || xhr(o)\n\n http.open(method, url, o['async'] === false ? false : true)\n setHeaders(http, o)\n setCredentials(http, o)\n if (context[xDomainRequest] && http instanceof context[xDomainRequest]) {\n http.onload = fn\n http.onerror = err\n // NOTE: see\n // http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e\n http.onprogress = function() {}\n sendWait = true\n } else {\n http.onreadystatechange = handleReadyState(this, fn, err)\n }\n o['before'] && o['before'](http)\n if (sendWait) {\n setTimeout(function () {\n http.send(data)\n }, 200)\n } else {\n http.send(data)\n }\n return http\n }\n\n function Reqwest(o, fn) {\n this.o = o\n this.fn = fn\n\n init.apply(this, arguments)\n }\n\n function setType(header) {\n // json, javascript, text/plain, text/html, xml\n if (header === null) return undefined; //In case of no content-type.\n if (header.match('json')) return 'json'\n if (header.match('javascript')) return 'js'\n if (header.match('text')) return 'html'\n if (header.match('xml')) return 'xml'\n }\n\n function init(o, fn) {\n\n this.url = typeof o == 'string' ? o : o['url']\n this.timeout = null\n\n // whether request has been fulfilled for purpose\n // of tracking the Promises\n this._fulfilled = false\n // success handlers\n this._successHandler = function(){}\n this._fulfillmentHandlers = []\n // error handlers\n this._errorHandlers = []\n // complete (both success and fail) handlers\n this._completeHandlers = []\n this._erred = false\n this._responseArgs = {}\n\n var self = this\n\n fn = fn || function () {}\n\n if (o['timeout']) {\n this.timeout = setTimeout(function () {\n timedOut()\n }, o['timeout'])\n }\n\n if (o['success']) {\n this._successHandler = function () {\n o['success'].apply(o, arguments)\n }\n }\n\n if (o['error']) {\n this._errorHandlers.push(function () {\n o['error'].apply(o, arguments)\n })\n }\n\n if (o['complete']) {\n this._completeHandlers.push(function () {\n o['complete'].apply(o, arguments)\n })\n }\n\n function complete (resp) {\n o['timeout'] && clearTimeout(self.timeout)\n self.timeout = null\n while (self._completeHandlers.length > 0) {\n self._completeHandlers.shift()(resp)\n }\n }\n\n function success (resp) {\n var type = o['type'] || resp && setType(resp.getResponseHeader('Content-Type')) // resp can be undefined in IE\n resp = (type !== 'jsonp') ? self.request : resp\n // use global data filter on response text\n var filteredResponse = globalSetupOptions.dataFilter(resp.responseText, type)\n , r = filteredResponse\n try {\n resp.responseText = r\n } catch (e) {\n // can't assign this in IE<=8, just ignore\n }\n if (r) {\n switch (type) {\n case 'json':\n try {\n resp = context.JSON ? context.JSON.parse(r) : eval('(' + r + ')')\n } catch (err) {\n return error(resp, 'Could not parse JSON in response', err)\n }\n break\n case 'js':\n resp = eval(r)\n break\n case 'html':\n resp = r\n break\n case 'xml':\n resp = resp.responseXML\n && resp.responseXML.parseError // IE trololo\n && resp.responseXML.parseError.errorCode\n && resp.responseXML.parseError.reason\n ? null\n : resp.responseXML\n break\n }\n }\n\n self._responseArgs.resp = resp\n self._fulfilled = true\n fn(resp)\n self._successHandler(resp)\n while (self._fulfillmentHandlers.length > 0) {\n resp = self._fulfillmentHandlers.shift()(resp)\n }\n\n complete(resp)\n }\n\n function timedOut() {\n self._timedOut = true\n self.request.abort()\n }\n\n function error(resp, msg, t) {\n resp = self.request\n self._responseArgs.resp = resp\n self._responseArgs.msg = msg\n self._responseArgs.t = t\n self._erred = true\n while (self._errorHandlers.length > 0) {\n self._errorHandlers.shift()(resp, msg, t)\n }\n complete(resp)\n }\n\n this.request = getRequest.call(this, success, error)\n }\n\n Reqwest.prototype = {\n abort: function () {\n this._aborted = true\n this.request.abort()\n }\n\n , retry: function () {\n init.call(this, this.o, this.fn)\n }\n\n /**\n * Small deviation from the Promises A CommonJs specification\n * http://wiki.commonjs.org/wiki/Promises/A\n */\n\n /**\n * `then` will execute upon successful requests\n */\n , then: function (success, fail) {\n success = success || function () {}\n fail = fail || function () {}\n if (this._fulfilled) {\n this._responseArgs.resp = success(this._responseArgs.resp)\n } else if (this._erred) {\n fail(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n } else {\n this._fulfillmentHandlers.push(success)\n this._errorHandlers.push(fail)\n }\n return this\n }\n\n /**\n * `always` will execute whether the request succeeds or fails\n */\n , always: function (fn) {\n if (this._fulfilled || this._erred) {\n fn(this._responseArgs.resp)\n } else {\n this._completeHandlers.push(fn)\n }\n return this\n }\n\n /**\n * `fail` will execute when the request fails\n */\n , fail: function (fn) {\n if (this._erred) {\n fn(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t)\n } else {\n this._errorHandlers.push(fn)\n }\n return this\n }\n , 'catch': function (fn) {\n return this.fail(fn)\n }\n }\n\n function reqwest(o, fn) {\n return new Reqwest(o, fn)\n }\n\n // normalize newline variants according to spec -> CRLF\n function normalize(s) {\n return s ? s.replace(/\\r?\\n/g, '\\r\\n') : ''\n }\n\n function serial(el, cb) {\n var n = el.name\n , t = el.tagName.toLowerCase()\n , optCb = function (o) {\n // IE gives value=\"\" even where there is no value attribute\n // 'specified' ref: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-862529273\n if (o && !o['disabled'])\n cb(n, normalize(o['attributes']['value'] && o['attributes']['value']['specified'] ? o['value'] : o['text']))\n }\n , ch, ra, val, i\n\n // don't serialize elements that are disabled or without a name\n if (el.disabled || !n) return\n\n switch (t) {\n case 'input':\n if (!/reset|button|image|file/i.test(el.type)) {\n ch = /checkbox/i.test(el.type)\n ra = /radio/i.test(el.type)\n val = el.value\n // WebKit gives us \"\" instead of \"on\" if a checkbox has no value, so correct it here\n ;(!(ch || ra) || el.checked) && cb(n, normalize(ch && val === '' ? 'on' : val))\n }\n break\n case 'textarea':\n cb(n, normalize(el.value))\n break\n case 'select':\n if (el.type.toLowerCase() === 'select-one') {\n optCb(el.selectedIndex >= 0 ? el.options[el.selectedIndex] : null)\n } else {\n for (i = 0; el.length && i < el.length; i++) {\n el.options[i].selected && optCb(el.options[i])\n }\n }\n break\n }\n }\n\n // collect up all form elements found from the passed argument elements all\n // the way down to child elements; pass a '' or form fields.\n // called with 'this'=callback to use for serial() on each element\n function eachFormElement() {\n var cb = this\n , e, i\n , serializeSubtags = function (e, tags) {\n var i, j, fa\n for (i = 0; i < tags.length; i++) {\n fa = e[byTag](tags[i])\n for (j = 0; j < fa.length; j++) serial(fa[j], cb)\n }\n }\n\n for (i = 0; i < arguments.length; i++) {\n e = arguments[i]\n if (/input|select|textarea/i.test(e.tagName)) serial(e, cb)\n serializeSubtags(e, [ 'input', 'select', 'textarea' ])\n }\n }\n\n // standard query string style serialization\n function serializeQueryString() {\n return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments))\n }\n\n // { 'name': 'value', ... } style serialization\n function serializeHash() {\n var hash = {}\n eachFormElement.apply(function (name, value) {\n if (name in hash) {\n hash[name] && !isArray(hash[name]) && (hash[name] = [hash[name]])\n hash[name].push(value)\n } else hash[name] = value\n }, arguments)\n return hash\n }\n\n // [ { name: 'name', value: 'value' }, ... ] style serialization\n reqwest.serializeArray = function () {\n var arr = []\n eachFormElement.apply(function (name, value) {\n arr.push({name: name, value: value})\n }, arguments)\n return arr\n }\n\n reqwest.serialize = function () {\n if (arguments.length === 0) return ''\n var opt, fn\n , args = Array.prototype.slice.call(arguments, 0)\n\n opt = args.pop()\n opt && opt.nodeType && args.push(opt) && (opt = null)\n opt && (opt = opt.type)\n\n if (opt == 'map') fn = serializeHash\n else if (opt == 'array') fn = reqwest.serializeArray\n else fn = serializeQueryString\n\n return fn.apply(null, args)\n }\n\n reqwest.toQueryString = function (o, trad) {\n var prefix, i\n , traditional = trad || false\n , s = []\n , enc = encodeURIComponent\n , add = function (key, value) {\n // If value is a function, invoke it and return its value\n value = ('function' === typeof value) ? value() : (value == null ? '' : value)\n s[s.length] = enc(key) + '=' + enc(value)\n }\n // If an array was passed in, assume that it is an array of form elements.\n if (isArray(o)) {\n for (i = 0; o && i < o.length; i++) add(o[i]['name'], o[i]['value'])\n } else {\n // If traditional, encode the \"old\" way (the way 1.3.2 or older\n // did it), otherwise encode params recursively.\n for (prefix in o) {\n if (o.hasOwnProperty(prefix)) buildParams(prefix, o[prefix], traditional, add)\n }\n }\n\n // spaces should be + according to spec\n return s.join('&').replace(/%20/g, '+')\n }\n\n function buildParams(prefix, obj, traditional, add) {\n var name, i, v\n , rbracket = /\\[\\]$/\n\n if (isArray(obj)) {\n // Serialize array item.\n for (i = 0; obj && i < obj.length; i++) {\n v = obj[i]\n if (traditional || rbracket.test(prefix)) {\n // Treat each array item as a scalar.\n add(prefix, v)\n } else {\n buildParams(prefix + '[' + (typeof v === 'object' ? i : '') + ']', v, traditional, add)\n }\n }\n } else if (obj && obj.toString() === '[object Object]') {\n // Serialize object item.\n for (name in obj) {\n buildParams(prefix + '[' + name + ']', obj[name], traditional, add)\n }\n\n } else {\n // Serialize scalar item.\n add(prefix, obj)\n }\n }\n\n reqwest.getcallbackPrefix = function () {\n return callbackPrefix\n }\n\n // jQuery and Zepto compatibility, differences can be remapped here so you can call\n // .ajax.compat(options, callback)\n reqwest.compat = function (o, fn) {\n if (o) {\n o['type'] && (o['method'] = o['type']) && delete o['type']\n o['dataType'] && (o['type'] = o['dataType'])\n o['jsonpCallback'] && (o['jsonpCallbackName'] = o['jsonpCallback']) && delete o['jsonpCallback']\n o['jsonp'] && (o['jsonpCallback'] = o['jsonp'])\n }\n return new Reqwest(o, fn)\n }\n\n reqwest.ajaxSetup = function (options) {\n options = options || {}\n for (var k in options) {\n globalSetupOptions[k] = options[k]\n }\n }\n\n return reqwest\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/reqwest/reqwest.js\n ** module id = 74\n ** module chunks = 0\n **/","/*\n * GeoJSON helpers for handling data and generating objects\n */\n\nimport THREE from 'three';\nimport topojson from 'topojson';\nimport geojsonMerge from 'geojson-merge';\nimport earcut from 'earcut';\nimport extrudePolygon from './extrudePolygon';\n\n// TODO: Make it so height can be per-coordinate / point but connected together\n// as a linestring (eg. GPS points with an elevation at each point)\n//\n// This isn't really valid GeoJSON so perhaps something best left to an external\n// component for now, until a better approach can be considered\n//\n// See: http://lists.geojson.org/pipermail/geojson-geojson.org/2009-June/000489.html\n\n// Light and dark colours used for poor-mans AO gradient on object sides\nvar light = new THREE.Color(0xffffff);\nvar shadow = new THREE.Color(0x666666);\n\nvar GeoJSON = (function() {\n var defaultStyle = {\n color: '#ffffff',\n transparent: false,\n opacity: 1,\n blending: THREE.NormalBlending,\n height: 0,\n lineOpacity: 1,\n lineTransparent: false,\n lineColor: '#ffffff',\n lineWidth: 1,\n lineBlending: THREE.NormalBlending\n };\n\n // Attempts to merge together multiple GeoJSON Features or FeatureCollections\n // into a single FeatureCollection\n var collectFeatures = function(data, _topojson) {\n var collections = [];\n\n if (_topojson) {\n // TODO: Allow TopoJSON objects to be overridden as an option\n\n // If not overridden, merge all features from all objects\n for (var tk in data.objects) {\n collections.push(topojson.feature(data, data.objects[tk]));\n }\n\n return geojsonMerge(collections);\n } else {\n // If root doesn't have a type then let's see if there are features in the\n // next step down\n if (!data.type) {\n // TODO: Allow GeoJSON objects to be overridden as an option\n\n // If not overridden, merge all features from all objects\n for (var gk in data) {\n if (!data[gk].type) {\n continue;\n }\n\n collections.push(data[gk]);\n }\n\n return geojsonMerge(collections);\n } else if (Array.isArray(data)) {\n return geojsonMerge(data);\n } else {\n return data;\n }\n }\n };\n\n // TODO: This is only used by GeoJSONTile so either roll it into that or\n // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n var lineStringAttributes = function(coordinates, colour, height) {\n var _coords = [];\n var _colours = [];\n\n var nextCoord;\n\n // Connect coordinate with the next to make a pair\n //\n // LineSegments requires pairs of vertices so repeat the last point if\n // there's an odd number of vertices\n coordinates.forEach((coordinate, index) => {\n _colours.push([colour.r, colour.g, colour.b]);\n _coords.push([coordinate[0], height, coordinate[1]]);\n\n nextCoord = (coordinates[index + 1]) ? coordinates[index + 1] : coordinate;\n\n _colours.push([colour.r, colour.g, colour.b]);\n _coords.push([nextCoord[0], height, nextCoord[1]]);\n });\n\n return {\n vertices: _coords,\n colours: _colours\n };\n };\n\n // TODO: This is only used by GeoJSONTile so either roll it into that or\n // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n var multiLineStringAttributes = function(coordinates, colour, height) {\n var _coords = [];\n var _colours = [];\n\n var result;\n coordinates.forEach(coordinate => {\n result = lineStringAttributes(coordinate, colour, height);\n\n result.vertices.forEach(coord => {\n _coords.push(coord);\n });\n\n result.colours.forEach(colour => {\n _colours.push(colour);\n });\n });\n\n return {\n vertices: _coords,\n colours: _colours\n };\n };\n\n // TODO: This is only used by GeoJSONTile so either roll it into that or\n // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n var polygonAttributes = function(coordinates, colour, height) {\n var earcutData = _toEarcut(coordinates);\n\n var faces = _triangulate(earcutData.vertices, earcutData.holes, earcutData.dimensions);\n\n var groupedVertices = [];\n for (i = 0, il = earcutData.vertices.length; i < il; i += earcutData.dimensions) {\n groupedVertices.push(earcutData.vertices.slice(i, i + earcutData.dimensions));\n }\n\n var extruded = extrudePolygon(groupedVertices, faces, {\n bottom: 0,\n top: height\n });\n\n var topColor = colour.clone().multiply(light);\n var bottomColor = colour.clone().multiply(shadow);\n\n var _vertices = extruded.positions;\n var _faces = [];\n var _colours = [];\n\n var _colour;\n extruded.top.forEach((face, fi) => {\n _colour = [];\n\n _colour.push([colour.r, colour.g, colour.b]);\n _colour.push([colour.r, colour.g, colour.b]);\n _colour.push([colour.r, colour.g, colour.b]);\n\n _faces.push(face);\n _colours.push(_colour);\n });\n\n var allFlat = true;\n\n if (extruded.sides) {\n if (allFlat) {\n allFlat = false;\n }\n\n // Set up colours for every vertex with poor-mans AO on the sides\n extruded.sides.forEach((face, fi) => {\n _colour = [];\n\n // First face is always bottom-bottom-top\n if (fi % 2 === 0) {\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n _colour.push([topColor.r, topColor.g, topColor.b]);\n // Reverse winding for the second face\n // top-top-bottom\n } else {\n _colour.push([topColor.r, topColor.g, topColor.b]);\n _colour.push([topColor.r, topColor.g, topColor.b]);\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n }\n\n _faces.push(face);\n _colours.push(_colour);\n });\n }\n\n // Skip bottom as there's no point rendering it\n // allFaces.push(extruded.faces);\n\n return {\n vertices: _vertices,\n faces: _faces,\n colours: _colours,\n flat: allFlat\n };\n };\n\n // TODO: This is only used by GeoJSONTile so either roll it into that or\n // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n var _toEarcut = function(data) {\n var dim = data[0][0].length;\n var result = {vertices: [], holes: [], dimensions: dim};\n var holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) {\n result.vertices.push(data[i][j][d]);\n }\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n\n return result;\n };\n\n // TODO: This is only used by GeoJSONTile so either roll it into that or\n // update GeoJSONTile to use the new GeoJSONLayer or geometry layers\n var _triangulate = function(contour, holes, dim) {\n // console.time('earcut');\n\n var faces = earcut(contour, holes, dim);\n var result = [];\n\n for (i = 0, il = faces.length; i < il; i += 3) {\n result.push(faces.slice(i, i + 3));\n }\n\n // console.timeEnd('earcut');\n\n return result;\n };\n\n return {\n defaultStyle: defaultStyle,\n collectFeatures: collectFeatures,\n lineStringAttributes: lineStringAttributes,\n multiLineStringAttributes: multiLineStringAttributes,\n polygonAttributes: polygonAttributes\n };\n})();\n\nexport default GeoJSON;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/GeoJSON.js\n **/","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (factory((global.topojson = {})));\n}(this, function (exports) { 'use strict';\n\n function noop() {}\n\n function absolute(transform) {\n if (!transform) return noop;\n var x0,\n y0,\n kx = transform.scale[0],\n ky = transform.scale[1],\n dx = transform.translate[0],\n dy = transform.translate[1];\n return function(point, i) {\n if (!i) x0 = y0 = 0;\n point[0] = (x0 += point[0]) * kx + dx;\n point[1] = (y0 += point[1]) * ky + dy;\n };\n }\n\n function relative(transform) {\n if (!transform) return noop;\n var x0,\n y0,\n kx = transform.scale[0],\n ky = transform.scale[1],\n dx = transform.translate[0],\n dy = transform.translate[1];\n return function(point, i) {\n if (!i) x0 = y0 = 0;\n var x1 = (point[0] - dx) / kx | 0,\n y1 = (point[1] - dy) / ky | 0;\n point[0] = x1 - x0;\n point[1] = y1 - y0;\n x0 = x1;\n y0 = y1;\n };\n }\n\n function reverse(array, n) {\n var t, j = array.length, i = j - n;\n while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;\n }\n\n function bisect(a, x) {\n var lo = 0, hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (a[mid] < x) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n function feature(topology, o) {\n return o.type === \"GeometryCollection\" ? {\n type: \"FeatureCollection\",\n features: o.geometries.map(function(o) { return feature$1(topology, o); })\n } : feature$1(topology, o);\n }\n\n function feature$1(topology, o) {\n var f = {\n type: \"Feature\",\n id: o.id,\n properties: o.properties || {},\n geometry: object(topology, o)\n };\n if (o.id == null) delete f.id;\n return f;\n }\n\n function object(topology, o) {\n var absolute$$ = absolute(topology.transform),\n arcs = topology.arcs;\n\n function arc(i, points) {\n if (points.length) points.pop();\n for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) {\n points.push(p = a[k].slice());\n absolute$$(p, k);\n }\n if (i < 0) reverse(points, n);\n }\n\n function point(p) {\n p = p.slice();\n absolute$$(p, 0);\n return p;\n }\n\n function line(arcs) {\n var points = [];\n for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);\n if (points.length < 2) points.push(points[0].slice());\n return points;\n }\n\n function ring(arcs) {\n var points = line(arcs);\n while (points.length < 4) points.push(points[0].slice());\n return points;\n }\n\n function polygon(arcs) {\n return arcs.map(ring);\n }\n\n function geometry(o) {\n var t = o.type;\n return t === \"GeometryCollection\" ? {type: t, geometries: o.geometries.map(geometry)}\n : t in geometryType ? {type: t, coordinates: geometryType[t](o)}\n : null;\n }\n\n var geometryType = {\n Point: function(o) { return point(o.coordinates); },\n MultiPoint: function(o) { return o.coordinates.map(point); },\n LineString: function(o) { return line(o.arcs); },\n MultiLineString: function(o) { return o.arcs.map(line); },\n Polygon: function(o) { return polygon(o.arcs); },\n MultiPolygon: function(o) { return o.arcs.map(polygon); }\n };\n\n return geometry(o);\n }\n\n function stitchArcs(topology, arcs) {\n var stitchedArcs = {},\n fragmentByStart = {},\n fragmentByEnd = {},\n fragments = [],\n emptyIndex = -1;\n\n // Stitch empty arcs first, since they may be subsumed by other arcs.\n arcs.forEach(function(i, j) {\n var arc = topology.arcs[i < 0 ? ~i : i], t;\n if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {\n t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;\n }\n });\n\n arcs.forEach(function(i) {\n var e = ends(i),\n start = e[0],\n end = e[1],\n f, g;\n\n if (f = fragmentByEnd[start]) {\n delete fragmentByEnd[f.end];\n f.push(i);\n f.end = end;\n if (g = fragmentByStart[end]) {\n delete fragmentByStart[g.start];\n var fg = g === f ? f : f.concat(g);\n fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else if (f = fragmentByStart[end]) {\n delete fragmentByStart[f.start];\n f.unshift(i);\n f.start = start;\n if (g = fragmentByEnd[start]) {\n delete fragmentByEnd[g.end];\n var gf = g === f ? f : g.concat(f);\n fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;\n } else {\n fragmentByStart[f.start] = fragmentByEnd[f.end] = f;\n }\n } else {\n f = [i];\n fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;\n }\n });\n\n function ends(i) {\n var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;\n if (topology.transform) p1 = [0, 0], arc.forEach(function(dp) { p1[0] += dp[0], p1[1] += dp[1]; });\n else p1 = arc[arc.length - 1];\n return i < 0 ? [p1, p0] : [p0, p1];\n }\n\n function flush(fragmentByEnd, fragmentByStart) {\n for (var k in fragmentByEnd) {\n var f = fragmentByEnd[k];\n delete fragmentByStart[f.start];\n delete f.start;\n delete f.end;\n f.forEach(function(i) { stitchedArcs[i < 0 ? ~i : i] = 1; });\n fragments.push(f);\n }\n }\n\n flush(fragmentByEnd, fragmentByStart);\n flush(fragmentByStart, fragmentByEnd);\n arcs.forEach(function(i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });\n\n return fragments;\n }\n\n function mesh(topology) {\n return object(topology, meshArcs.apply(this, arguments));\n }\n\n function meshArcs(topology, o, filter) {\n var arcs = [];\n\n function arc(i) {\n var j = i < 0 ? ~i : i;\n (geomsByArc[j] || (geomsByArc[j] = [])).push({i: i, g: geom});\n }\n\n function line(arcs) {\n arcs.forEach(arc);\n }\n\n function polygon(arcs) {\n arcs.forEach(line);\n }\n\n function geometry(o) {\n if (o.type === \"GeometryCollection\") o.geometries.forEach(geometry);\n else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs);\n }\n\n if (arguments.length > 1) {\n var geomsByArc = [],\n geom;\n\n var geometryType = {\n LineString: line,\n MultiLineString: polygon,\n Polygon: polygon,\n MultiPolygon: function(arcs) { arcs.forEach(polygon); }\n };\n\n geometry(o);\n\n geomsByArc.forEach(arguments.length < 3\n ? function(geoms) { arcs.push(geoms[0].i); }\n : function(geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });\n } else {\n for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i);\n }\n\n return {type: \"MultiLineString\", arcs: stitchArcs(topology, arcs)};\n }\n\n function triangle(triangle) {\n var a = triangle[0], b = triangle[1], c = triangle[2];\n return Math.abs((a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]));\n }\n\n function ring(ring) {\n var i = -1,\n n = ring.length,\n a,\n b = ring[n - 1],\n area = 0;\n\n while (++i < n) {\n a = b;\n b = ring[i];\n area += a[0] * b[1] - a[1] * b[0];\n }\n\n return area / 2;\n }\n\n function merge(topology) {\n return object(topology, mergeArcs.apply(this, arguments));\n }\n\n function mergeArcs(topology, objects) {\n var polygonsByArc = {},\n polygons = [],\n components = [];\n\n objects.forEach(function(o) {\n if (o.type === \"Polygon\") register(o.arcs);\n else if (o.type === \"MultiPolygon\") o.arcs.forEach(register);\n });\n\n function register(polygon) {\n polygon.forEach(function(ring$$) {\n ring$$.forEach(function(arc) {\n (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);\n });\n });\n polygons.push(polygon);\n }\n\n function exterior(ring$$) {\n return ring(object(topology, {type: \"Polygon\", arcs: [ring$$]}).coordinates[0]) > 0; // TODO allow spherical?\n }\n\n polygons.forEach(function(polygon) {\n if (!polygon._) {\n var component = [],\n neighbors = [polygon];\n polygon._ = 1;\n components.push(component);\n while (polygon = neighbors.pop()) {\n component.push(polygon);\n polygon.forEach(function(ring$$) {\n ring$$.forEach(function(arc) {\n polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) {\n if (!polygon._) {\n polygon._ = 1;\n neighbors.push(polygon);\n }\n });\n });\n });\n }\n }\n });\n\n polygons.forEach(function(polygon) {\n delete polygon._;\n });\n\n return {\n type: \"MultiPolygon\",\n arcs: components.map(function(polygons) {\n var arcs = [], n;\n\n // Extract the exterior (unique) arcs.\n polygons.forEach(function(polygon) {\n polygon.forEach(function(ring$$) {\n ring$$.forEach(function(arc) {\n if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {\n arcs.push(arc);\n }\n });\n });\n });\n\n // Stitch the arcs into one or more rings.\n arcs = stitchArcs(topology, arcs);\n\n // If more than one ring is returned,\n // at most one of these rings can be the exterior;\n // this exterior ring has the same winding order\n // as any exterior ring in the original polygons.\n if ((n = arcs.length) > 1) {\n var sgn = exterior(polygons[0][0]);\n for (var i = 0, t; i < n; ++i) {\n if (sgn === exterior(arcs[i])) {\n t = arcs[0], arcs[0] = arcs[i], arcs[i] = t;\n break;\n }\n }\n }\n\n return arcs;\n })\n };\n }\n\n function neighbors(objects) {\n var indexesByArc = {}, // arc index -> array of object indexes\n neighbors = objects.map(function() { return []; });\n\n function line(arcs, i) {\n arcs.forEach(function(a) {\n if (a < 0) a = ~a;\n var o = indexesByArc[a];\n if (o) o.push(i);\n else indexesByArc[a] = [i];\n });\n }\n\n function polygon(arcs, i) {\n arcs.forEach(function(arc) { line(arc, i); });\n }\n\n function geometry(o, i) {\n if (o.type === \"GeometryCollection\") o.geometries.forEach(function(o) { geometry(o, i); });\n else if (o.type in geometryType) geometryType[o.type](o.arcs, i);\n }\n\n var geometryType = {\n LineString: line,\n MultiLineString: polygon,\n Polygon: polygon,\n MultiPolygon: function(arcs, i) { arcs.forEach(function(arc) { polygon(arc, i); }); }\n };\n\n objects.forEach(geometry);\n\n for (var i in indexesByArc) {\n for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) {\n for (var k = j + 1; k < m; ++k) {\n var ij = indexes[j], ik = indexes[k], n;\n if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik);\n if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij);\n }\n }\n }\n\n return neighbors;\n }\n\n function compareArea(a, b) {\n return a[1][2] - b[1][2];\n }\n\n function minAreaHeap() {\n var heap = {},\n array = [],\n size = 0;\n\n heap.push = function(object) {\n up(array[object._ = size] = object, size++);\n return size;\n };\n\n heap.pop = function() {\n if (size <= 0) return;\n var removed = array[0], object;\n if (--size > 0) object = array[size], down(array[object._ = 0] = object, 0);\n return removed;\n };\n\n heap.remove = function(removed) {\n var i = removed._, object;\n if (array[i] !== removed) return; // invalid request\n if (i !== --size) object = array[size], (compareArea(object, removed) < 0 ? up : down)(array[object._ = i] = object, i);\n return i;\n };\n\n function up(object, i) {\n while (i > 0) {\n var j = ((i + 1) >> 1) - 1,\n parent = array[j];\n if (compareArea(object, parent) >= 0) break;\n array[parent._ = i] = parent;\n array[object._ = i = j] = object;\n }\n }\n\n function down(object, i) {\n while (true) {\n var r = (i + 1) << 1,\n l = r - 1,\n j = i,\n child = array[j];\n if (l < size && compareArea(array[l], child) < 0) child = array[j = l];\n if (r < size && compareArea(array[r], child) < 0) child = array[j = r];\n if (j === i) break;\n array[child._ = i] = child;\n array[object._ = i = j] = object;\n }\n }\n\n return heap;\n }\n\n function presimplify(topology, triangleArea) {\n var absolute$$ = absolute(topology.transform),\n relative$$ = relative(topology.transform),\n heap = minAreaHeap();\n\n if (!triangleArea) triangleArea = triangle;\n\n topology.arcs.forEach(function(arc) {\n var triangles = [],\n maxArea = 0,\n triangle,\n i,\n n,\n p;\n\n // To store each point’s effective area, we create a new array rather than\n // extending the passed-in point to workaround a Chrome/V8 bug (getting\n // stuck in smi mode). For midpoints, the initial effective area of\n // Infinity will be computed in the next step.\n for (i = 0, n = arc.length; i < n; ++i) {\n p = arc[i];\n absolute$$(arc[i] = [p[0], p[1], Infinity], i);\n }\n\n for (i = 1, n = arc.length - 1; i < n; ++i) {\n triangle = arc.slice(i - 1, i + 2);\n triangle[1][2] = triangleArea(triangle);\n triangles.push(triangle);\n heap.push(triangle);\n }\n\n for (i = 0, n = triangles.length; i < n; ++i) {\n triangle = triangles[i];\n triangle.previous = triangles[i - 1];\n triangle.next = triangles[i + 1];\n }\n\n while (triangle = heap.pop()) {\n var previous = triangle.previous,\n next = triangle.next;\n\n // If the area of the current point is less than that of the previous point\n // to be eliminated, use the latter's area instead. This ensures that the\n // current point cannot be eliminated without eliminating previously-\n // eliminated points.\n if (triangle[1][2] < maxArea) triangle[1][2] = maxArea;\n else maxArea = triangle[1][2];\n\n if (previous) {\n previous.next = next;\n previous[2] = triangle[2];\n update(previous);\n }\n\n if (next) {\n next.previous = previous;\n next[0] = triangle[0];\n update(next);\n }\n }\n\n arc.forEach(relative$$);\n });\n\n function update(triangle) {\n heap.remove(triangle);\n triangle[1][2] = triangleArea(triangle);\n heap.push(triangle);\n }\n\n return topology;\n }\n\n var version = \"1.6.24\";\n\n exports.version = version;\n exports.mesh = mesh;\n exports.meshArcs = meshArcs;\n exports.merge = merge;\n exports.mergeArcs = mergeArcs;\n exports.feature = feature;\n exports.neighbors = neighbors;\n exports.presimplify = presimplify;\n\n}));\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/topojson/build/topojson.js\n ** module id = 77\n ** module chunks = 0\n **/","var normalize = require('geojson-normalize');\n\nmodule.exports = function(inputs) {\n return {\n type: 'FeatureCollection',\n features: inputs.reduce(function(memo, input) {\n return memo.concat(normalize(input).features);\n }, [])\n };\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/geojson-merge/index.js\n ** module id = 78\n ** module chunks = 0\n **/","module.exports = normalize;\n\nvar types = {\n Point: 'geometry',\n MultiPoint: 'geometry',\n LineString: 'geometry',\n MultiLineString: 'geometry',\n Polygon: 'geometry',\n MultiPolygon: 'geometry',\n GeometryCollection: 'geometry',\n Feature: 'feature',\n FeatureCollection: 'featurecollection'\n};\n\n/**\n * Normalize a GeoJSON feature into a FeatureCollection.\n *\n * @param {object} gj geojson data\n * @returns {object} normalized geojson data\n */\nfunction normalize(gj) {\n if (!gj || !gj.type) return null;\n var type = types[gj.type];\n if (!type) return null;\n\n if (type === 'geometry') {\n return {\n type: 'FeatureCollection',\n features: [{\n type: 'Feature',\n properties: {},\n geometry: gj\n }]\n };\n } else if (type === 'feature') {\n return {\n type: 'FeatureCollection',\n features: [gj]\n };\n } else if (type === 'featurecollection') {\n return gj;\n }\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/geojson-merge/~/geojson-normalize/index.js\n ** module id = 79\n ** module chunks = 0\n **/","'use strict';\n\nmodule.exports = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode) return triangles;\n\n var minX, minY, maxX, maxY, x, y, size;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and size are later used to transform coords into integers for z-order calculation\n size = Math.max(maxX - minX, maxY - minY);\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, size);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var sum = 0,\n i, j, last;\n\n // calculate original winding order of a polygon ring\n for (i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n\n // link points into circular doubly-linked list in the specified winding order\n if (clockwise === (sum > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, size, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && size) indexCurve(ear, minX, minY, size);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertice leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(ear, triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, size, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, size);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, size) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, size),\n maxZ = zOrder(maxTX, maxTY, minX, minY, size);\n\n // first look for points inside the triangle in increasing z-order\n var p = ear.nextZ;\n\n while (p && p.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.nextZ;\n }\n\n // then look for points in decreasing z-order\n p = ear.prevZ;\n\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n // a self-intersection where edge (v[i-1],v[i]) intersects (v[i+1],v[i+2])\n if (intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, size) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, size);\n earcutLinked(c, triangles, dim, minX, minY, size);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hole.x === m.x) return m.prev; // hole touches outer segment; pick lower endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n tanMin = Infinity,\n tan;\n\n p = m.next;\n\n while (p !== stop) {\n if (hx >= p.x && p.x >= m.x &&\n pointInTriangle(hy < m.y ? hx : qx, hy, m.x, m.y, hy < m.y ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n }\n\n return m;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, size) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize === 0) {\n e = q;\n q = q.nextZ;\n qSize--;\n } else if (qSize === 0 || !q) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else if (p.z <= q.z) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and size of the data bounding box\nfunction zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return equals(a, b) || a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertice index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertice nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/earcut/src/earcut.js\n ** module id = 80\n ** module chunks = 0\n **/","/*\n * Extrude a polygon given its vertices and triangulated faces\n *\n * Based on:\n * https://github.com/freeman-lab/extrude\n */\n\nimport extend from 'lodash.assign';\n\nvar extrudePolygon = function(points, faces, _options) {\n var defaults = {\n top: 1,\n bottom: 0,\n closed: true\n };\n\n var options = extend({}, defaults, _options);\n\n var n = points.length;\n var positions;\n var cells;\n var topCells;\n var bottomCells;\n var sideCells;\n\n // If bottom and top values are identical then return the flat shape\n (options.top === options.bottom) ? flat() : full();\n\n function flat() {\n positions = points.map(function(p) { return [p[0], options.top, p[1]]; });\n cells = faces;\n topCells = faces;\n }\n\n function full() {\n positions = [];\n points.forEach(function(p) { positions.push([p[0], options.top, p[1]]); });\n points.forEach(function(p) { positions.push([p[0], options.bottom, p[1]]); });\n\n cells = [];\n for (var i = 0; i < n; i++) {\n if (i === (n - 1)) {\n cells.push([i + n, n, i]);\n cells.push([0, i, n]);\n } else {\n cells.push([i + n, i + n + 1, i]);\n cells.push([i + 1, i, i + n + 1]);\n }\n }\n\n sideCells = [].concat(cells);\n\n if (options.closed) {\n var top = faces;\n var bottom = top.map(function(p) { return p.map(function(v) { return v + n; }); });\n bottom = bottom.map(function(p) { return [p[0], p[2], p[1]]; });\n cells = cells.concat(top).concat(bottom);\n\n topCells = top;\n bottomCells = bottom;\n }\n }\n\n return {\n positions: positions,\n faces: cells,\n top: topCells,\n bottom: bottomCells,\n sides: sideCells\n };\n};\n\nexport default extrudePolygon;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/extrudePolygon.js\n **/","/*\n * BufferGeometry helpers\n */\n\nimport THREE from 'three';\n\nvar Buffer = (function() {\n // Merge multiple attribute objects into a single attribute object\n //\n // Attribute objects must all use the same attribute keys\n var mergeAttributes = function(attributes) {\n var lengths = {};\n\n // Find array lengths\n attributes.forEach(_attributes => {\n for (var k in _attributes) {\n if (!lengths[k]) {\n lengths[k] = 0;\n }\n\n lengths[k] += _attributes[k].length;\n }\n });\n\n var mergedAttributes = {};\n\n // Set up arrays to merge into\n for (var k in lengths) {\n mergedAttributes[k] = new Float32Array(lengths[k]);\n }\n\n var lastLengths = {};\n\n attributes.forEach(_attributes => {\n for (var k in _attributes) {\n if (!lastLengths[k]) {\n lastLengths[k] = 0;\n }\n\n mergedAttributes[k].set(_attributes[k], lastLengths[k]);\n\n lastLengths[k] += _attributes[k].length;\n }\n });\n\n return mergedAttributes;\n };\n\n var createLineGeometry = function(lines, offset) {\n var geometry = new THREE.BufferGeometry();\n\n var vertices = new Float32Array(lines.verticesCount * 3);\n var colours = new Float32Array(lines.verticesCount * 3);\n\n var pickingIds;\n if (lines.pickingIds) {\n // One component per vertex (1)\n pickingIds = new Float32Array(lines.verticesCount);\n }\n\n var _vertices;\n var _colour;\n var _pickingId;\n\n var lastIndex = 0;\n\n for (var i = 0; i < lines.vertices.length; i++) {\n _vertices = lines.vertices[i];\n _colour = lines.colours[i];\n\n if (pickingIds) {\n _pickingId = lines.pickingIds[i];\n }\n\n for (var j = 0; j < _vertices.length; j++) {\n var ax = _vertices[j][0] + offset.x;\n var ay = _vertices[j][1];\n var az = _vertices[j][2] + offset.y;\n\n var c1 = _colour[j];\n\n vertices[lastIndex * 3 + 0] = ax;\n vertices[lastIndex * 3 + 1] = ay;\n vertices[lastIndex * 3 + 2] = az;\n\n colours[lastIndex * 3 + 0] = c1[0];\n colours[lastIndex * 3 + 1] = c1[1];\n colours[lastIndex * 3 + 2] = c1[2];\n\n if (pickingIds) {\n pickingIds[lastIndex] = _pickingId;\n }\n\n lastIndex++;\n }\n }\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(colours, 3));\n\n if (pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n return geometry;\n };\n\n // TODO: Make picking IDs optional\n var createGeometry = function(attributes, offset) {\n var geometry = new THREE.BufferGeometry();\n\n // Three components per vertex per face (3 x 3 = 9)\n var vertices = new Float32Array(attributes.facesCount * 9);\n var normals = new Float32Array(attributes.facesCount * 9);\n var colours = new Float32Array(attributes.facesCount * 9);\n\n var pickingIds;\n if (attributes.pickingIds) {\n // One component per vertex per face (1 x 3 = 3)\n pickingIds = new Float32Array(attributes.facesCount * 3);\n }\n\n var pA = new THREE.Vector3();\n var pB = new THREE.Vector3();\n var pC = new THREE.Vector3();\n\n var cb = new THREE.Vector3();\n var ab = new THREE.Vector3();\n\n var index;\n var _faces;\n var _vertices;\n var _colour;\n var _pickingId;\n var lastIndex = 0;\n for (var i = 0; i < attributes.faces.length; i++) {\n _faces = attributes.faces[i];\n _vertices = attributes.vertices[i];\n _colour = attributes.colours[i];\n\n if (pickingIds) {\n _pickingId = attributes.pickingIds[i];\n }\n\n for (var j = 0; j < _faces.length; j++) {\n // Array of vertex indexes for the face\n index = _faces[j][0];\n\n var ax = _vertices[index][0] + offset.x;\n var ay = _vertices[index][1];\n var az = _vertices[index][2] + offset.y;\n\n var c1 = _colour[j][0];\n\n index = _faces[j][1];\n\n var bx = _vertices[index][0] + offset.x;\n var by = _vertices[index][1];\n var bz = _vertices[index][2] + offset.y;\n\n var c2 = _colour[j][1];\n\n index = _faces[j][2];\n\n var cx = _vertices[index][0] + offset.x;\n var cy = _vertices[index][1];\n var cz = _vertices[index][2] + offset.y;\n\n var c3 = _colour[j][2];\n\n // Flat face normals\n // From: http://threejs.org/examples/webgl_buffergeometry.html\n pA.set(ax, ay, az);\n pB.set(bx, by, bz);\n pC.set(cx, cy, cz);\n\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n\n cb.normalize();\n\n var nx = cb.x;\n var ny = cb.y;\n var nz = cb.z;\n\n vertices[lastIndex * 9 + 0] = ax;\n vertices[lastIndex * 9 + 1] = ay;\n vertices[lastIndex * 9 + 2] = az;\n\n normals[lastIndex * 9 + 0] = nx;\n normals[lastIndex * 9 + 1] = ny;\n normals[lastIndex * 9 + 2] = nz;\n\n colours[lastIndex * 9 + 0] = c1[0];\n colours[lastIndex * 9 + 1] = c1[1];\n colours[lastIndex * 9 + 2] = c1[2];\n\n vertices[lastIndex * 9 + 3] = bx;\n vertices[lastIndex * 9 + 4] = by;\n vertices[lastIndex * 9 + 5] = bz;\n\n normals[lastIndex * 9 + 3] = nx;\n normals[lastIndex * 9 + 4] = ny;\n normals[lastIndex * 9 + 5] = nz;\n\n colours[lastIndex * 9 + 3] = c2[0];\n colours[lastIndex * 9 + 4] = c2[1];\n colours[lastIndex * 9 + 5] = c2[2];\n\n vertices[lastIndex * 9 + 6] = cx;\n vertices[lastIndex * 9 + 7] = cy;\n vertices[lastIndex * 9 + 8] = cz;\n\n normals[lastIndex * 9 + 6] = nx;\n normals[lastIndex * 9 + 7] = ny;\n normals[lastIndex * 9 + 8] = nz;\n\n colours[lastIndex * 9 + 6] = c3[0];\n colours[lastIndex * 9 + 7] = c3[1];\n colours[lastIndex * 9 + 8] = c3[2];\n\n if (pickingIds) {\n pickingIds[lastIndex * 3 + 0] = _pickingId;\n pickingIds[lastIndex * 3 + 1] = _pickingId;\n pickingIds[lastIndex * 3 + 2] = _pickingId;\n }\n\n lastIndex++;\n }\n }\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(colours, 3));\n\n if (pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n return geometry;\n };\n\n return {\n mergeAttributes: mergeAttributes,\n createLineGeometry: createLineGeometry,\n createGeometry: createGeometry\n };\n})();\n\nexport default Buffer;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/Buffer.js\n **/","import THREE from 'three';\nimport PickingShader from './PickingShader';\n\n// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\nvar PickingMaterial = function() {\n THREE.ShaderMaterial.call(this, {\n uniforms: {\n size: {\n type: 'f',\n value: 0.01,\n },\n scale: {\n type: 'f',\n value: 400,\n }\n },\n // attributes: ['position', 'id'],\n vertexShader: PickingShader.vertexShader,\n fragmentShader: PickingShader.fragmentShader\n });\n\n this.linePadding = 2;\n};\n\nPickingMaterial.prototype = Object.create(THREE.ShaderMaterial.prototype);\n\nPickingMaterial.prototype.constructor = PickingMaterial;\n\nPickingMaterial.prototype.setPointSize = function(size) {\n this.uniforms.size.value = size;\n};\n\nPickingMaterial.prototype.setPointScale = function(scale) {\n this.uniforms.scale.value = scale;\n};\n\nexport default PickingMaterial;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/PickingMaterial.js\n **/","// FROM: https://github.com/brianxu/GPUPicker/blob/master/GPUPicker.js\n\nvar PickingShader = {\n vertexShader: [\n\t\t'attribute float pickingId;',\n\t\t// '',\n\t\t// 'uniform float size;',\n\t\t// 'uniform float scale;',\n\t\t'',\n\t\t'varying vec4 worldId;',\n\t\t'',\n\t\t'void main() {',\n\t\t' vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',\n\t\t// ' gl_PointSize = size * ( scale / length( mvPosition.xyz ) );',\n\t\t' vec3 a = fract(vec3(1.0/255.0, 1.0/(255.0*255.0), 1.0/(255.0*255.0*255.0)) * pickingId);',\n\t\t' a -= a.xxy * vec3(0.0, 1.0/255.0, 1.0/255.0);',\n\t\t' worldId = vec4(a,1);',\n\t\t' gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',\n\t\t'}'\n\t].join('\\n'),\n\n fragmentShader: [\n\t\t'#ifdef GL_ES\\n',\n\t\t'precision highp float;\\n',\n\t\t'#endif\\n',\n\t\t'',\n\t\t'varying vec4 worldId;',\n\t\t'',\n\t\t'void main() {',\n\t\t' gl_FragColor = worldId;',\n\t\t'}'\n\t].join('\\n')\n};\n\nexport default PickingShader;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/engine/PickingShader.js\n **/","// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\n// TODO: Look at ways to drop unneeded references to array buffers, etc to\n// reduce memory footprint\n\n// TODO: Support dynamic updating / hiding / animation of geometry\n//\n// This could be pretty hard as it's all packed away within BufferGeometry and\n// may even be merged by another layer (eg. GeoJSONLayer)\n//\n// How much control should this layer support? Perhaps a different or custom\n// layer would be better suited for animation, for example.\n\n// TODO: Allow _setBufferAttributes to use a custom function passed in to\n// generate a custom mesh\n\nimport Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport {point as Point} from '../../geo/Point';\nimport earcut from 'earcut';\nimport extrudePolygon from '../../util/extrudePolygon';\nimport PickingMaterial from '../../engine/PickingMaterial';\nimport Buffer from '../../util/Buffer';\n\nclass PolygonLayer extends Layer {\n constructor(coordinates, options) {\n var defaults = {\n output: true,\n interactive: false,\n // Custom material override\n //\n // TODO: Should this be in the style object?\n material: null,\n onMesh: null,\n onBufferAttributes: null,\n // This default style is separate to Util.GeoJSON.defaultStyle\n style: {\n color: '#ffffff',\n transparent: false,\n opacity: 1,\n blending: THREE.NormalBlending,\n height: 0\n }\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n // Return coordinates as array of polygons so it's easy to support\n // MultiPolygon features (a single polygon would be a MultiPolygon with a\n // single polygon in the array)\n this._coordinates = (PolygonLayer.isSingle(coordinates)) ? [coordinates] : coordinates;\n }\n\n _onAdd(world) {\n this._setCoordinates();\n\n if (this._options.interactive) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n this._setPickingId();\n this._addPickingEvents();\n }\n\n // Store geometry representation as instances of THREE.BufferAttribute\n this._setBufferAttributes();\n\n if (this.isOutput()) {\n // Set mesh if not merging elsewhere\n this._setMesh(this._bufferAttributes);\n\n // Output mesh\n this.add(this._mesh);\n }\n }\n\n // Return center of polygon as a LatLon\n //\n // This is used for things like placing popups / UI elements on the layer\n //\n // TODO: Find proper center position instead of returning first coordinate\n // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polygon.js#L15\n getCenter() {\n return this._center;\n }\n\n // Return polygon bounds in geographic coordinates\n //\n // TODO: Implement getBounds()\n getBounds() {}\n\n // Get unique ID for picking interaction\n _setPickingId() {\n this._pickingId = this.getPickingId();\n }\n\n // Set up and re-emit interaction events\n _addPickingEvents() {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {\n // Re-emit click event from the layer\n this.emit('click', this, point2d, point3d, intersects);\n });\n }\n\n // Create and store reference to THREE.BufferAttribute data for this layer\n _setBufferAttributes() {\n var attributes;\n\n // Only use this if you know what you're doing\n if (typeof this._options.onBufferAttributes === 'function') {\n // TODO: Probably want to pass something less general as arguments,\n // though passing the instance will do for now (it's everything)\n attributes = this._options.onBufferAttributes(this);\n } else {\n var height = 0;\n\n // Convert height into world units\n if (this._options.style.height && this._options.style.height !== 0) {\n height = this._world.metresToWorld(this._options.style.height, this._pointScale);\n }\n\n var colour = new THREE.Color();\n colour.set(this._options.style.color);\n\n // Light and dark colours used for poor-mans AO gradient on object sides\n var light = new THREE.Color(0xffffff);\n var shadow = new THREE.Color(0x666666);\n\n // For each polygon\n attributes = this._projectedCoordinates.map(_projectedCoordinates => {\n // Convert coordinates to earcut format\n var _earcut = this._toEarcut(_projectedCoordinates);\n\n // Triangulate faces using earcut\n var faces = this._triangulate(_earcut.vertices, _earcut.holes, _earcut.dimensions);\n\n var groupedVertices = [];\n for (i = 0, il = _earcut.vertices.length; i < il; i += _earcut.dimensions) {\n groupedVertices.push(_earcut.vertices.slice(i, i + _earcut.dimensions));\n }\n\n var extruded = extrudePolygon(groupedVertices, faces, {\n bottom: 0,\n top: height\n });\n\n var topColor = colour.clone().multiply(light);\n var bottomColor = colour.clone().multiply(shadow);\n\n var _vertices = extruded.positions;\n var _faces = [];\n var _colours = [];\n\n var _colour;\n extruded.top.forEach((face, fi) => {\n _colour = [];\n\n _colour.push([colour.r, colour.g, colour.b]);\n _colour.push([colour.r, colour.g, colour.b]);\n _colour.push([colour.r, colour.g, colour.b]);\n\n _faces.push(face);\n _colours.push(_colour);\n });\n\n this._flat = true;\n\n if (extruded.sides) {\n this._flat = false;\n\n // Set up colours for every vertex with poor-mans AO on the sides\n extruded.sides.forEach((face, fi) => {\n _colour = [];\n\n // First face is always bottom-bottom-top\n if (fi % 2 === 0) {\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n _colour.push([topColor.r, topColor.g, topColor.b]);\n // Reverse winding for the second face\n // top-top-bottom\n } else {\n _colour.push([topColor.r, topColor.g, topColor.b]);\n _colour.push([topColor.r, topColor.g, topColor.b]);\n _colour.push([bottomColor.r, bottomColor.g, bottomColor.b]);\n }\n\n _faces.push(face);\n _colours.push(_colour);\n });\n }\n\n // Skip bottom as there's no point rendering it\n // allFaces.push(extruded.faces);\n\n var polygon = {\n vertices: _vertices,\n faces: _faces,\n colours: _colours,\n facesCount: _faces.length\n };\n\n if (this._options.interactive && this._pickingId) {\n // Inject picking ID\n polygon.pickingId = this._pickingId;\n }\n\n // Convert polygon representation to proper attribute arrays\n return this._toAttributes(polygon);\n });\n }\n\n this._bufferAttributes = Buffer.mergeAttributes(attributes);\n\n // Original attributes are no longer required so free the memory\n attributes = null;\n }\n\n getBufferAttributes() {\n return this._bufferAttributes;\n }\n\n // Used by external components to clear some memory when the attributes\n // are no longer required to be stored in this layer\n //\n // For example, you would want to clear the attributes here after merging them\n // using something like the GeoJSONLayer\n clearBufferAttributes() {\n this._bufferAttributes = null;\n }\n\n // Used by external components to clear some memory when the coordinates\n // are no longer required to be stored in this layer\n //\n // For example, you would want to clear the coordinates here after this\n // layer is merged in something like the GeoJSONLayer\n clearCoordinates() {\n this._coordinates = null;\n this._projectedCoordinates = null;\n }\n\n // Create and store mesh from buffer attributes\n //\n // This is only called if the layer is controlling its own output\n _setMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n if (this._options.material && this._options.material instanceof THREE.Material) {\n material = this._options.material;\n } else if (!this._world._environment._skybox) {\n material = new THREE.MeshPhongMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide,\n transparent: this._options.style.transparent,\n opacity: this._options.style.opacity,\n blending: this._options.style.blending\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors,\n side: THREE.BackSide,\n transparent: this._options.style.transparent,\n opacity: this._options.style.opacity,\n blending: this._options.style.blending\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var mesh;\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onMesh === 'function') {\n mesh = this._options.onMesh(geometry, material);\n } else {\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n }\n\n if (this.isFlat()) {\n material.depthWrite = false;\n mesh.renderOrder = 1;\n }\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._mesh = mesh;\n }\n\n // Convert and project coordinates\n //\n // TODO: Calculate bounds\n _setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n\n this._center = this._coordinates[0][0][0];\n }\n\n // Recursively convert input coordinates into LatLon objects\n //\n // Calculate geographic bounds at the same time\n //\n // TODO: Calculate geographic bounds\n _convertCoordinates(coordinates) {\n return coordinates.map(_coordinates => {\n return _coordinates.map(ring => {\n return ring.map(coordinate => {\n return LatLon(coordinate[1], coordinate[0]);\n });\n });\n });\n }\n\n // Recursively project coordinates into world positions\n //\n // Calculate world bounds, offset and pointScale at the same time\n //\n // TODO: Calculate world bounds\n _projectCoordinates() {\n var point;\n return this._coordinates.map(_coordinates => {\n return _coordinates.map(ring => {\n return ring.map(latlon => {\n point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * point.x;\n this._offset.y = -1 * point.y;\n\n this._pointScale = this._world.pointScale(latlon);\n }\n\n return point;\n });\n });\n });\n }\n\n // Convert coordinates array to something earcut can understand\n _toEarcut(coordinates) {\n var dim = 2;\n var result = {vertices: [], holes: [], dimensions: dim};\n var holeIndex = 0;\n\n for (var i = 0; i < coordinates.length; i++) {\n for (var j = 0; j < coordinates[i].length; j++) {\n // for (var d = 0; d < dim; d++) {\n result.vertices.push(coordinates[i][j].x);\n result.vertices.push(coordinates[i][j].y);\n // }\n }\n if (i > 0) {\n holeIndex += coordinates[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n\n return result;\n }\n\n // Triangulate earcut-based input using earcut\n _triangulate(contour, holes, dim) {\n // console.time('earcut');\n\n var faces = earcut(contour, holes, dim);\n var result = [];\n\n for (i = 0, il = faces.length; i < il; i += 3) {\n result.push(faces.slice(i, i + 3));\n }\n\n // console.timeEnd('earcut');\n\n return result;\n }\n\n // Transform polygon representation into attribute arrays that can be used by\n // THREE.BufferGeometry\n //\n // TODO: Can this be simplified? It's messy and huge\n _toAttributes(polygon) {\n // Three components per vertex per face (3 x 3 = 9)\n var vertices = new Float32Array(polygon.facesCount * 9);\n var normals = new Float32Array(polygon.facesCount * 9);\n var colours = new Float32Array(polygon.facesCount * 9);\n\n var pickingIds;\n if (polygon.pickingId) {\n // One component per vertex per face (1 x 3 = 3)\n pickingIds = new Float32Array(polygon.facesCount * 3);\n }\n\n var pA = new THREE.Vector3();\n var pB = new THREE.Vector3();\n var pC = new THREE.Vector3();\n\n var cb = new THREE.Vector3();\n var ab = new THREE.Vector3();\n\n var index;\n\n var _faces = polygon.faces;\n var _vertices = polygon.vertices;\n var _colour = polygon.colours;\n\n var _pickingId;\n if (pickingIds) {\n _pickingId = polygon.pickingId;\n }\n\n var lastIndex = 0;\n\n for (var i = 0; i < _faces.length; i++) {\n // Array of vertex indexes for the face\n index = _faces[i][0];\n\n var ax = _vertices[index][0];\n var ay = _vertices[index][1];\n var az = _vertices[index][2];\n\n var c1 = _colour[i][0];\n\n index = _faces[i][1];\n\n var bx = _vertices[index][0];\n var by = _vertices[index][1];\n var bz = _vertices[index][2];\n\n var c2 = _colour[i][1];\n\n index = _faces[i][2];\n\n var cx = _vertices[index][0];\n var cy = _vertices[index][1];\n var cz = _vertices[index][2];\n\n var c3 = _colour[i][2];\n\n // Flat face normals\n // From: http://threejs.org/examples/webgl_buffergeometry.html\n pA.set(ax, ay, az);\n pB.set(bx, by, bz);\n pC.set(cx, cy, cz);\n\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n\n cb.normalize();\n\n var nx = cb.x;\n var ny = cb.y;\n var nz = cb.z;\n\n vertices[lastIndex * 9 + 0] = ax;\n vertices[lastIndex * 9 + 1] = ay;\n vertices[lastIndex * 9 + 2] = az;\n\n normals[lastIndex * 9 + 0] = nx;\n normals[lastIndex * 9 + 1] = ny;\n normals[lastIndex * 9 + 2] = nz;\n\n colours[lastIndex * 9 + 0] = c1[0];\n colours[lastIndex * 9 + 1] = c1[1];\n colours[lastIndex * 9 + 2] = c1[2];\n\n vertices[lastIndex * 9 + 3] = bx;\n vertices[lastIndex * 9 + 4] = by;\n vertices[lastIndex * 9 + 5] = bz;\n\n normals[lastIndex * 9 + 3] = nx;\n normals[lastIndex * 9 + 4] = ny;\n normals[lastIndex * 9 + 5] = nz;\n\n colours[lastIndex * 9 + 3] = c2[0];\n colours[lastIndex * 9 + 4] = c2[1];\n colours[lastIndex * 9 + 5] = c2[2];\n\n vertices[lastIndex * 9 + 6] = cx;\n vertices[lastIndex * 9 + 7] = cy;\n vertices[lastIndex * 9 + 8] = cz;\n\n normals[lastIndex * 9 + 6] = nx;\n normals[lastIndex * 9 + 7] = ny;\n normals[lastIndex * 9 + 8] = nz;\n\n colours[lastIndex * 9 + 6] = c3[0];\n colours[lastIndex * 9 + 7] = c3[1];\n colours[lastIndex * 9 + 8] = c3[2];\n\n if (pickingIds) {\n pickingIds[lastIndex * 3 + 0] = _pickingId;\n pickingIds[lastIndex * 3 + 1] = _pickingId;\n pickingIds[lastIndex * 3 + 2] = _pickingId;\n }\n\n lastIndex++;\n }\n\n var attributes = {\n vertices: vertices,\n normals: normals,\n colours: colours\n };\n\n if (pickingIds) {\n attributes.pickingIds = pickingIds;\n }\n\n return attributes;\n }\n\n // Returns true if the polygon is flat (has no height)\n isFlat() {\n return this._flat;\n }\n\n // Returns true if coordinates refer to a single geometry\n //\n // For example, not coordinates for a MultiPolygon GeoJSON feature\n static isSingle(coordinates) {\n return !Array.isArray(coordinates[0][0][0]);\n }\n\n // TODO: Make sure this is cleaning everything\n destroy() {\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n this.clearCoordinates();\n this.clearBufferAttributes();\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default PolygonLayer;\n\nvar noNew = function(coordinates, options) {\n return new PolygonLayer(coordinates, options);\n};\n\nexport {noNew as polygonLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/geometry/PolygonLayer.js\n **/","// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\n// TODO: Look at ways to drop unneeded references to array buffers, etc to\n// reduce memory footprint\n\n// TODO: Provide alternative output using tubes and splines / curves\n\n// TODO: Support dynamic updating / hiding / animation of geometry\n//\n// This could be pretty hard as it's all packed away within BufferGeometry and\n// may even be merged by another layer (eg. GeoJSONLayer)\n//\n// How much control should this layer support? Perhaps a different or custom\n// layer would be better suited for animation, for example.\n\n// TODO: Allow _setBufferAttributes to use a custom function passed in to\n// generate a custom mesh\n\nimport Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport {point as Point} from '../../geo/Point';\nimport PickingMaterial from '../../engine/PickingMaterial';\nimport Buffer from '../../util/Buffer';\n\nclass PolylineLayer extends Layer {\n constructor(coordinates, options) {\n var defaults = {\n output: true,\n interactive: false,\n // Custom material override\n //\n // TODO: Should this be in the style object?\n material: null,\n onMesh: null,\n onBufferAttributes: null,\n // This default style is separate to Util.GeoJSON.defaultStyle\n style: {\n lineOpacity: 1,\n lineTransparent: false,\n lineColor: '#ffffff',\n lineWidth: 1,\n lineBlending: THREE.NormalBlending\n }\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n // Return coordinates as array of lines so it's easy to support\n // MultiLineString features (a single line would be a MultiLineString with a\n // single line in the array)\n this._coordinates = (PolylineLayer.isSingle(coordinates)) ? [coordinates] : coordinates;\n\n // Polyline features are always flat (for now at least)\n this._flat = true;\n }\n\n _onAdd(world) {\n this._setCoordinates();\n\n if (this._options.interactive) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n this._setPickingId();\n this._addPickingEvents();\n }\n\n // Store geometry representation as instances of THREE.BufferAttribute\n this._setBufferAttributes();\n\n if (this.isOutput()) {\n // Set mesh if not merging elsewhere\n this._setMesh(this._bufferAttributes);\n\n // Output mesh\n this.add(this._mesh);\n }\n }\n\n // Return center of polyline as a LatLon\n //\n // This is used for things like placing popups / UI elements on the layer\n //\n // TODO: Find proper center position instead of returning first coordinate\n // SEE: https://github.com/Leaflet/Leaflet/blob/master/src/layer/vector/Polyline.js#L59\n getCenter() {\n return this._center;\n }\n\n // Return line bounds in geographic coordinates\n //\n // TODO: Implement getBounds()\n getBounds() {}\n\n // Get unique ID for picking interaction\n _setPickingId() {\n this._pickingId = this.getPickingId();\n }\n\n // Set up and re-emit interaction events\n _addPickingEvents() {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {\n // Re-emit click event from the layer\n this.emit('click', this, point2d, point3d, intersects);\n });\n }\n\n // Create and store reference to THREE.BufferAttribute data for this layer\n _setBufferAttributes() {\n var attributes;\n\n // Only use this if you know what you're doing\n if (typeof this._options.onBufferAttributes === 'function') {\n // TODO: Probably want to pass something less general as arguments,\n // though passing the instance will do for now (it's everything)\n attributes = this._options.onBufferAttributes(this);\n } else {\n var height = 0;\n\n // Convert height into world units\n if (this._options.style.lineHeight) {\n height = this._world.metresToWorld(this._options.style.lineHeight, this._pointScale);\n }\n\n var colour = new THREE.Color();\n colour.set(this._options.style.lineColor);\n\n // For each line\n attributes = this._projectedCoordinates.map(_projectedCoordinates => {\n var _vertices = [];\n var _colours = [];\n\n // Connect coordinate with the next to make a pair\n //\n // LineSegments requires pairs of vertices so repeat the last point if\n // there's an odd number of vertices\n var nextCoord;\n _projectedCoordinates.forEach((coordinate, index) => {\n _colours.push([colour.r, colour.g, colour.b]);\n _vertices.push([coordinate.x, height, coordinate.y]);\n\n nextCoord = (_projectedCoordinates[index + 1]) ? _projectedCoordinates[index + 1] : coordinate;\n\n _colours.push([colour.r, colour.g, colour.b]);\n _vertices.push([nextCoord.x, height, nextCoord.y]);\n });\n\n var line = {\n vertices: _vertices,\n colours: _colours,\n verticesCount: _vertices.length\n };\n\n if (this._options.interactive && this._pickingId) {\n // Inject picking ID\n line.pickingId = this._pickingId;\n }\n\n // Convert line representation to proper attribute arrays\n return this._toAttributes(line);\n });\n }\n\n this._bufferAttributes = Buffer.mergeAttributes(attributes);\n\n // Original attributes are no longer required so free the memory\n attributes = null;\n }\n\n getBufferAttributes() {\n return this._bufferAttributes;\n }\n\n // Used by external components to clear some memory when the attributes\n // are no longer required to be stored in this layer\n //\n // For example, you would want to clear the attributes here after merging them\n // using something like the GeoJSONLayer\n clearBufferAttributes() {\n this._bufferAttributes = null;\n }\n\n // Used by external components to clear some memory when the coordinates\n // are no longer required to be stored in this layer\n //\n // For example, you would want to clear the coordinates here after this\n // layer is merged in something like the GeoJSONLayer\n clearCoordinates() {\n this._coordinates = null;\n this._projectedCoordinates = null;\n }\n\n // Create and store mesh from buffer attributes\n //\n // This is only called if the layer is controlling its own output\n _setMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n\n if (attributes.normals) {\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n }\n\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var style = this._options.style;\n var material;\n\n if (this._options.material && this._options.material instanceof THREE.Material) {\n material = this._options.material;\n } else {\n material = new THREE.LineBasicMaterial({\n vertexColors: THREE.VertexColors,\n linewidth: style.lineWidth,\n transparent: style.lineTransparent,\n opacity: style.lineOpacity,\n blending: style.lineBlending\n });\n }\n\n var mesh;\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onMesh === 'function') {\n mesh = this._options.onMesh(geometry, material);\n } else {\n mesh = new THREE.LineSegments(geometry, material);\n\n if (style.lineRenderOrder !== undefined) {\n material.depthWrite = false;\n mesh.renderOrder = style.lineRenderOrder;\n }\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n }\n\n // TODO: Allow this to be overridden, or copy mesh instead of creating a new\n // one just for picking\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n // Make the line wider / easier to pick\n material.linewidth = style.lineWidth + material.linePadding;\n\n var pickingMesh = new THREE.LineSegments(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._mesh = mesh;\n }\n\n // Convert and project coordinates\n //\n // TODO: Calculate bounds\n _setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n\n this._center = this._coordinates[0][0];\n }\n\n // Recursively convert input coordinates into LatLon objects\n //\n // Calculate geographic bounds at the same time\n //\n // TODO: Calculate geographic bounds\n _convertCoordinates(coordinates) {\n return coordinates.map(_coordinates => {\n return _coordinates.map(coordinate => {\n return LatLon(coordinate[1], coordinate[0]);\n });\n });\n }\n\n // Recursively project coordinates into world positions\n //\n // Calculate world bounds, offset and pointScale at the same time\n //\n // TODO: Calculate world bounds\n _projectCoordinates() {\n var point;\n return this._coordinates.map(_coordinates => {\n return _coordinates.map(latlon => {\n point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * point.x;\n this._offset.y = -1 * point.y;\n\n this._pointScale = this._world.pointScale(latlon);\n }\n\n return point;\n });\n });\n }\n\n // Transform line representation into attribute arrays that can be used by\n // THREE.BufferGeometry\n //\n // TODO: Can this be simplified? It's messy and huge\n _toAttributes(line) {\n // Three components per vertex\n var vertices = new Float32Array(line.verticesCount * 3);\n var colours = new Float32Array(line.verticesCount * 3);\n\n var pickingIds;\n if (line.pickingId) {\n // One component per vertex\n pickingIds = new Float32Array(line.verticesCount);\n }\n\n var _vertices = line.vertices;\n var _colour = line.colours;\n\n var normals;\n var _normals;\n if (line.normals) {\n normals = new Float32Array(line.verticesCount * 3);\n _normals = line.normals;\n }\n\n var _pickingId;\n if (pickingIds) {\n _pickingId = line.pickingId;\n }\n\n var lastIndex = 0;\n\n for (var i = 0; i < _vertices.length; i++) {\n var ax = _vertices[i][0];\n var ay = _vertices[i][1];\n var az = _vertices[i][2];\n\n var nx;\n var ny;\n var nz;\n if (_normals) {\n nx = _normals[i][0];\n ny = _normals[i][1];\n nz = _normals[i][2];\n }\n\n var c1 = _colour[i];\n\n vertices[lastIndex * 3 + 0] = ax;\n vertices[lastIndex * 3 + 1] = ay;\n vertices[lastIndex * 3 + 2] = az;\n\n if (normals) {\n normals[lastIndex * 3 + 0] = nx;\n normals[lastIndex * 3 + 1] = ny;\n normals[lastIndex * 3 + 2] = nz;\n }\n\n colours[lastIndex * 3 + 0] = c1[0];\n colours[lastIndex * 3 + 1] = c1[1];\n colours[lastIndex * 3 + 2] = c1[2];\n\n if (pickingIds) {\n pickingIds[lastIndex] = _pickingId;\n }\n\n lastIndex++;\n }\n\n var attributes = {\n vertices: vertices,\n colours: colours\n };\n\n if (normals) {\n attributes.normals = normals;\n }\n\n if (pickingIds) {\n attributes.pickingIds = pickingIds;\n }\n\n return attributes;\n }\n\n // Returns true if the line is flat (has no height)\n isFlat() {\n return this._flat;\n }\n\n // Returns true if coordinates refer to a single geometry\n //\n // For example, not coordinates for a MultiLineString GeoJSON feature\n static isSingle(coordinates) {\n return !Array.isArray(coordinates[0][0]);\n }\n\n destroy() {\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n this.clearCoordinates();\n this.clearBufferAttributes();\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default PolylineLayer;\n\nvar noNew = function(coordinates, options) {\n return new PolylineLayer(coordinates, options);\n};\n\nexport {noNew as polylineLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/geometry/PolylineLayer.js\n **/","// TODO: Move duplicated logic between geometry layrs into GeometryLayer\n\n// TODO: Look at ways to drop unneeded references to array buffers, etc to\n// reduce memory footprint\n\n// TODO: Point features may be using custom models / meshes and so an approach\n// needs to be found to allow these to be brokwn down into buffer attributes for\n// merging\n//\n// Can probably use fromGeometry() or setFromObject() from THREE.BufferGeometry\n// and pull out the attributes\n\n// TODO: Support sprite objects using textures\n\n// TODO: Provide option to billboard geometry so it always faces the camera\n\n// TODO: Support dynamic updating / hiding / animation of geometry\n//\n// This could be pretty hard as it's all packed away within BufferGeometry and\n// may even be merged by another layer (eg. GeoJSONLayer)\n//\n// How much control should this layer support? Perhaps a different or custom\n// layer would be better suited for animation, for example.\n\nimport Layer from '../Layer';\nimport extend from 'lodash.assign';\nimport THREE from 'three';\nimport {latLon as LatLon} from '../../geo/LatLon';\nimport {point as Point} from '../../geo/Point';\nimport PickingMaterial from '../../engine/PickingMaterial';\nimport Buffer from '../../util/Buffer';\n\nclass PointLayer extends Layer {\n constructor(coordinates, options) {\n var defaults = {\n output: true,\n interactive: false,\n // THREE.Geometry or THREE.BufferGeometry to use for point output\n geometry: null,\n // Custom material override\n //\n // TODO: Should this be in the style object?\n material: null,\n onMesh: null,\n // This default style is separate to Util.GeoJSON.defaultStyle\n style: {\n pointColor: '#ff0000'\n }\n };\n\n var _options = extend({}, defaults, options);\n\n super(_options);\n\n // Return coordinates as array of points so it's easy to support\n // MultiPoint features (a single point would be a MultiPoint with a\n // single point in the array)\n this._coordinates = (PointLayer.isSingle(coordinates)) ? [coordinates] : coordinates;\n\n // Point features are always flat (for now at least)\n //\n // This won't always be the case once custom point objects / meshes are\n // added\n this._flat = true;\n }\n\n _onAdd(world) {\n this._setCoordinates();\n\n if (this._options.interactive) {\n // Only add to picking mesh if this layer is controlling output\n //\n // Otherwise, assume another component will eventually add a mesh to\n // the picking scene\n if (this.isOutput()) {\n this._pickingMesh = new THREE.Object3D();\n this.addToPicking(this._pickingMesh);\n }\n\n this._setPickingId();\n this._addPickingEvents();\n }\n\n // Store geometry representation as instances of THREE.BufferAttribute\n this._setBufferAttributes();\n\n if (this.isOutput()) {\n // Set mesh if not merging elsewhere\n this._setMesh(this._bufferAttributes);\n\n // Output mesh\n this.add(this._mesh);\n }\n }\n\n // Return center of point as a LatLon\n //\n // This is used for things like placing popups / UI elements on the layer\n getCenter() {\n return this._center;\n }\n\n // Return point bounds in geographic coordinates\n //\n // While not useful for single points, it could be useful for MultiPoint\n //\n // TODO: Implement getBounds()\n getBounds() {}\n\n // Get unique ID for picking interaction\n _setPickingId() {\n this._pickingId = this.getPickingId();\n }\n\n // Set up and re-emit interaction events\n _addPickingEvents() {\n // TODO: Find a way to properly remove this listener on destroy\n this._world.on('pick-' + this._pickingId, (point2d, point3d, intersects) => {\n // Re-emit click event from the layer\n this.emit('click', this, point2d, point3d, intersects);\n });\n }\n\n // Create and store reference to THREE.BufferAttribute data for this layer\n _setBufferAttributes() {\n var height = 0;\n\n // Convert height into world units\n if (this._options.style.pointHeight) {\n height = this._world.metresToWorld(this._options.style.pointHeight, this._pointScale);\n }\n\n var colour = new THREE.Color();\n colour.set(this._options.style.pointColor);\n\n var geometry;\n\n // Use default geometry if none has been provided or the provided geometry\n // isn't valid\n if (!this._options.geometry || (!this._options.geometry instanceof THREE.Geometry || !this._options.geometry instanceof THREE.BufferGeometry)) {\n // Debug geometry for points is a thin bar\n //\n // TODO: Allow point geometry to be customised / overridden\n var geometryWidth = this._world.metresToWorld(25, this._pointScale);\n var geometryHeight = this._world.metresToWorld(200, this._pointScale);\n var _geometry = new THREE.BoxGeometry(geometryWidth, geometryHeight, geometryWidth);\n\n // Shift geometry up so it sits on the ground\n _geometry.translate(0, geometryHeight * 0.5, 0);\n\n // Pull attributes out of debug geometry\n geometry = new THREE.BufferGeometry().fromGeometry(_geometry);\n } else {\n if (this._options.geometry instanceof THREE.BufferGeometry) {\n geometry = this._options.geometry;\n } else {\n geometry = new THREE.BufferGeometry().fromGeometry(this._options.geometry);\n }\n }\n\n // For each point\n var attributes = this._projectedCoordinates.map(coordinate => {\n var _vertices = [];\n var _normals = [];\n var _colours = [];\n\n var _geometry = geometry.clone();\n\n _geometry.translate(coordinate.x, height, coordinate.y);\n\n var _vertices = _geometry.attributes.position.clone().array;\n var _normals = _geometry.attributes.normal.clone().array;\n var _colours = _geometry.attributes.color.clone().array;\n\n for (var i = 0; i < _colours.length; i += 3) {\n _colours[i] = colour.r;\n _colours[i + 1] = colour.g;\n _colours[i + 2] = colour.b;\n }\n\n var _point = {\n vertices: _vertices,\n normals: _normals,\n colours: _colours\n };\n\n if (this._options.interactive && this._pickingId) {\n // Inject picking ID\n // point.pickingId = this._pickingId;\n _point.pickingIds = new Float32Array(_vertices.length / 3);\n for (var i = 0; i < _point.pickingIds.length; i++) {\n _point.pickingIds[i] = this._pickingId;\n }\n }\n\n // Convert point representation to proper attribute arrays\n // return this._toAttributes(_point);\n return _point;\n });\n\n this._bufferAttributes = Buffer.mergeAttributes(attributes);\n\n // Original attributes are no longer required so free the memory\n attributes = null;\n }\n\n getBufferAttributes() {\n return this._bufferAttributes;\n }\n\n // Used by external components to clear some memory when the attributes\n // are no longer required to be stored in this layer\n //\n // For example, you would want to clear the attributes here after merging them\n // using something like the GeoJSONLayer\n clearBufferAttributes() {\n this._bufferAttributes = null;\n }\n\n // Used by external components to clear some memory when the coordinates\n // are no longer required to be stored in this layer\n //\n // For example, you would want to clear the coordinates here after this\n // layer is merged in something like the GeoJSONLayer\n clearCoordinates() {\n this._coordinates = null;\n this._projectedCoordinates = null;\n }\n\n // Create and store mesh from buffer attributes\n //\n // This is only called if the layer is controlling its own output\n _setMesh(attributes) {\n var geometry = new THREE.BufferGeometry();\n\n // itemSize = 3 because there are 3 values (components) per vertex\n geometry.addAttribute('position', new THREE.BufferAttribute(attributes.vertices, 3));\n geometry.addAttribute('normal', new THREE.BufferAttribute(attributes.normals, 3));\n geometry.addAttribute('color', new THREE.BufferAttribute(attributes.colours, 3));\n\n if (attributes.pickingIds) {\n geometry.addAttribute('pickingId', new THREE.BufferAttribute(attributes.pickingIds, 1));\n }\n\n geometry.computeBoundingBox();\n\n var material;\n\n if (this._options.material && this._options.material instanceof THREE.Material) {\n material = this._options.material;\n } else if (!this._world._environment._skybox) {\n material = new THREE.MeshBasicMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n } else {\n material = new THREE.MeshStandardMaterial({\n vertexColors: THREE.VertexColors\n // side: THREE.BackSide\n });\n material.roughness = 1;\n material.metalness = 0.1;\n material.envMapIntensity = 3;\n material.envMap = this._world._environment._skybox.getRenderTarget();\n }\n\n var mesh;\n\n // Pass mesh through callback, if defined\n if (typeof this._options.onMesh === 'function') {\n mesh = this._options.onMesh(geometry, material);\n } else {\n mesh = new THREE.Mesh(geometry, material);\n\n mesh.castShadow = true;\n // mesh.receiveShadow = true;\n }\n\n if (this._options.interactive && this._pickingMesh) {\n material = new PickingMaterial();\n // material.side = THREE.BackSide;\n\n var pickingMesh = new THREE.Mesh(geometry, material);\n this._pickingMesh.add(pickingMesh);\n }\n\n this._mesh = mesh;\n }\n\n // Convert and project coordinates\n //\n // TODO: Calculate bounds\n _setCoordinates() {\n this._bounds = [];\n this._coordinates = this._convertCoordinates(this._coordinates);\n\n this._projectedBounds = [];\n this._projectedCoordinates = this._projectCoordinates();\n\n this._center = this._coordinates;\n }\n\n // Recursively convert input coordinates into LatLon objects\n //\n // Calculate geographic bounds at the same time\n //\n // TODO: Calculate geographic bounds\n _convertCoordinates(coordinates) {\n return coordinates.map(coordinate => {\n return LatLon(coordinate[1], coordinate[0]);\n });\n }\n\n // Recursively project coordinates into world positions\n //\n // Calculate world bounds, offset and pointScale at the same time\n //\n // TODO: Calculate world bounds\n _projectCoordinates() {\n var _point;\n return this._coordinates.map(latlon => {\n _point = this._world.latLonToPoint(latlon);\n\n // TODO: Is offset ever being used or needed?\n if (!this._offset) {\n this._offset = Point(0, 0);\n this._offset.x = -1 * _point.x;\n this._offset.y = -1 * _point.y;\n\n this._pointScale = this._world.pointScale(latlon);\n }\n\n return _point;\n });\n }\n\n // Transform line representation into attribute arrays that can be used by\n // THREE.BufferGeometry\n //\n // TODO: Can this be simplified? It's messy and huge\n _toAttributes(line) {\n // Three components per vertex\n var vertices = new Float32Array(line.verticesCount * 3);\n var colours = new Float32Array(line.verticesCount * 3);\n\n var pickingIds;\n if (line.pickingId) {\n // One component per vertex\n pickingIds = new Float32Array(line.verticesCount);\n }\n\n var _vertices = line.vertices;\n var _colour = line.colours;\n\n var _pickingId;\n if (pickingIds) {\n _pickingId = line.pickingId;\n }\n\n var lastIndex = 0;\n\n for (var i = 0; i < _vertices.length; i++) {\n var ax = _vertices[i][0];\n var ay = _vertices[i][1];\n var az = _vertices[i][2];\n\n var c1 = _colour[i];\n\n vertices[lastIndex * 3 + 0] = ax;\n vertices[lastIndex * 3 + 1] = ay;\n vertices[lastIndex * 3 + 2] = az;\n\n colours[lastIndex * 3 + 0] = c1[0];\n colours[lastIndex * 3 + 1] = c1[1];\n colours[lastIndex * 3 + 2] = c1[2];\n\n if (pickingIds) {\n pickingIds[lastIndex] = _pickingId;\n }\n\n lastIndex++;\n }\n\n var attributes = {\n vertices: vertices,\n colours: colours\n };\n\n if (pickingIds) {\n attributes.pickingIds = pickingIds;\n }\n\n return attributes;\n }\n\n // Returns true if the line is flat (has no height)\n isFlat() {\n return this._flat;\n }\n\n // Returns true if coordinates refer to a single geometry\n //\n // For example, not coordinates for a MultiPoint GeoJSON feature\n static isSingle(coordinates) {\n return !Array.isArray(coordinates[0]);\n }\n\n destroy() {\n if (this._pickingMesh) {\n // TODO: Properly dispose of picking mesh\n this._pickingMesh = null;\n }\n\n this.clearCoordinates();\n this.clearBufferAttributes();\n\n // Run common destruction logic from parent\n super.destroy();\n }\n}\n\nexport default PointLayer;\n\nvar noNew = function(coordinates, options) {\n return new PointLayer(coordinates, options);\n};\n\nexport {noNew as pointLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/geometry/PointLayer.js\n **/","import GeoJSONTileLayer from './GeoJSONTileLayer';\nimport extend from 'lodash.assign';\n\nclass TopoJSONTileLayer extends GeoJSONTileLayer {\n constructor(path, options) {\n var defaults = {\n topojson: true\n };\n\n options = extend({}, defaults, options);\n\n super(path, options);\n }\n}\n\nexport default TopoJSONTileLayer;\n\nvar noNew = function(path, options) {\n return new TopoJSONTileLayer(path, options);\n};\n\nexport {noNew as topoJSONTileLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/tile/TopoJSONTileLayer.js\n **/","import GeoJSONLayer from './GeoJSONLayer';\nimport extend from 'lodash.assign';\n\nclass TopoJSONLayer extends GeoJSONLayer {\n constructor(topojson, options) {\n var defaults = {\n topojson: true\n };\n\n options = extend({}, defaults, options);\n\n super(topojson, options);\n }\n}\n\nexport default TopoJSONLayer;\n\nvar noNew = function(topojson, options) {\n return new TopoJSONLayer(topojson, options);\n};\n\n// Initialise without requiring new keyword\nexport {noNew as topoJSONLayer};\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/layer/TopoJSONLayer.js\n **/","// TODO: A lot of these utils don't need to be in separate, tiny files\n\nimport Transformation from './Transformation';\nimport wrapNum from './wrapNum';\nimport extrudePolygon from './extrudePolygon';\nimport GeoJSON from './GeoJSON';\nimport Buffer from './Buffer';\n\nconst Util = {};\n\nUtil.Transformation = Transformation;\nUtil.wrapNum = wrapNum;\nUtil.extrudePolygon = extrudePolygon;\nUtil.GeoJSON = GeoJSON;\nUtil.Buffer = Buffer;\n\nexport default Util;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/util/index.js\n **/"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/src/layer/GeoJSONLayer.js b/src/layer/GeoJSONLayer.js index dac6b21..adf568b 100644 --- a/src/layer/GeoJSONLayer.js +++ b/src/layer/GeoJSONLayer.js @@ -493,6 +493,18 @@ class GeoJSONLayer extends LayerGroup { this._pickingMesh = null; } + if (this._polygonMesh) { + this._polygonMesh = null; + } + + if (this._polylineMesh) { + this._polylineMesh = null; + } + + if (this._pointMesh) { + this._pointMesh = null; + } + // Run common destruction logic from parent super.destroy(); } diff --git a/src/layer/LayerGroup.js b/src/layer/LayerGroup.js index 2f7f6e3..a7807d1 100644 --- a/src/layer/LayerGroup.js +++ b/src/layer/LayerGroup.js @@ -34,11 +34,14 @@ class LayerGroup extends Layer { // Destroy the layers and remove them from the scene and memory destroy() { - for (var i = 0; i < this._layers.length; i++) { - this._layers[i].destroy(); - } + // TODO: Sometimes this is already null, find out why + if (this._layers) { + for (var i = 0; i < this._layers.length; i++) { + this._layers[i].destroy(); + } - this._layers = null; + this._layers = null; + } super.destroy(); }