Repository: peterqliu/threebox Branch: master Commit: 6e6a1ae3878c Files: 54 Total size: 1.7 MB Directory structure: gitextract_b5dgj9ng/ ├── CHANGELOG.md ├── LICENSE.txt ├── README.md ├── dist/ │ └── threebox.js ├── docs/ │ ├── SymbolLayer3D.md │ └── Threebox.md ├── examples/ │ ├── Object3D.html │ ├── basic.html │ ├── config_template.js │ ├── line.html │ ├── logistics.html │ ├── mercator.html │ ├── models/ │ │ ├── Truck.mtl │ │ └── Truck.obj │ ├── old/ │ │ ├── basic.html │ │ ├── flocking.html │ │ └── orientation.html │ ├── raycaster.html │ └── tube.html ├── exports.js ├── main.js ├── package.json ├── src/ │ ├── Animation/ │ │ └── AnimationManager.js │ ├── Camera/ │ │ └── CameraSync.js │ ├── Threebox.js │ ├── Utils/ │ │ ├── Utils.js │ │ └── ValueGenerator.js │ ├── objects/ │ │ ├── Object3D.js │ │ ├── customLines/ │ │ │ ├── Line2.js │ │ │ ├── LineGeometry.js │ │ │ ├── LineMaterial.js │ │ │ ├── LineSegments2.js │ │ │ ├── LineSegmentsGeometry.js │ │ │ ├── Wireframe.js │ │ │ └── WireframeGeometry2.js │ │ ├── line.js │ │ ├── loadObj.js │ │ ├── loaders/ │ │ │ ├── MTLLoader.js │ │ │ └── OBJLoader.js │ │ ├── objects.js │ │ ├── sphere.js │ │ └── tube.js │ ├── three.js │ └── utils/ │ ├── constants.js │ ├── material.js │ └── validate.js └── tests/ ├── threebox-tests-bundle.js ├── threebox-tests.html ├── threebox-tests.js └── unit/ ├── camera.test.js ├── material.test.js ├── object.test.js ├── utilities.test.js └── validate.test.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: CHANGELOG.md ================================================ ## 0.3.0 #### Enhancements - Add an Object class: convenience methods to produce lines, spheres, tubes, and imported OBJ/MTL meshes, as well as a method to bring in THREE.Object3D's produced elsewhere with vanilla Three.js. Most of these are moveable, and have methods to move/rotate/rescale - No need to call `tb.update()` after putting it in the custom layer's `render()` function. #### Bug fixes - Automatically adjust for viewport size (https://github.com/peterqliu/threebox/issues/43) #### Deprecated (but still functional) - `.setupDefaultLights()` has moved to an optional `defaultLights` parameter, in the third argument for Threebox(). - `tb.addAtCoordinate()` and `tb.moveToCoordinate()` have been deprecated. `tb.add(Object)` and `Object.setCoords()` replace them ================================================ FILE: LICENSE.txt ================================================ MIT License Copyright (c) 2017 Peter Liu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # `threebox` A three.js plugin for Mapbox GL JS, using the custom layer feature. Provides convenient methods to manage objects in lnglat coordinates, and to synchronize the map and scene cameras. threebox ### Compatibility/Dependencies - Mapbox v.0.50.0 and later (for custom layer support) - Three.r94 (already bundled into the Threebox build). If desired, other versions can be swapped in and rebuilt [here](https://github.com/peterqliu/threebox/blob/master/src/three.js), though compatibility is not guaranteed. ### Getting started Download the bundle from [`dist/threebox.js`](dist/threebox.js) and add include it in a `
================================================ FILE: examples/basic.html ================================================ Sphere Example
================================================ FILE: examples/config_template.js ================================================ var config = { accessToken: '' }; ================================================ FILE: examples/line.html ================================================ Line Example
================================================ FILE: examples/logistics.html ================================================ Animated truck
Click on the map to drive the truck there
================================================ FILE: examples/mercator.html ================================================ Mercator projection
================================================ FILE: examples/models/Truck.mtl ================================================ # Blender MTL File: 'Truck.blend' # Material Count: 7 newmtl Black Ns 96.078431 Ka 1.000000 1.000000 1.000000 Kd 0.013347 0.013347 0.013347 Ks 0.500000 0.500000 0.500000 Ke 0.000000 0.000000 0.000000 Ni 1.000000 d 1.000000 illum 2 newmtl Cream Ns 96.078431 Ka 1.000000 1.000000 1.000000 Kd 0.565467 0.640000 0.496259 Ks 0.500000 0.500000 0.500000 Ke 0.000000 0.000000 0.000000 Ni 1.000000 d 1.000000 illum 2 newmtl Silver Ns 96.078431 Ka 1.000000 1.000000 1.000000 Kd 0.385546 0.385546 0.385546 Ks 0.500000 0.500000 0.500000 Ke 0.000000 0.000000 0.000000 Ni 1.000000 d 1.000000 illum 2 newmtl Wheel_Rim Ns 96.078431 Ka 1.000000 1.000000 1.000000 Kd 0.640000 0.640000 0.640000 Ks 0.500000 0.500000 0.500000 Ke 0.000000 0.000000 0.000000 Ni 1.000000 d 1.000000 illum 2 newmtl Wheels Ns 96.078431 Ka 1.000000 1.000000 1.000000 Kd 0.047401 0.047401 0.047401 Ks 0.500000 0.500000 0.500000 Ke 0.000000 0.000000 0.000000 Ni 1.000000 d 1.000000 illum 2 newmtl White Ns 96.078431 Ka 1.000000 1.000000 1.000000 Kd 0.800000 0.800000 0.800000 Ks 0.500000 0.500000 0.500000 Ke 0.000000 0.000000 0.000000 Ni 1.000000 d 1.000000 illum 2 newmtl Window Ns 96.078431 Ka 1.000000 1.000000 1.000000 Kd 0.362586 0.585789 0.640000 Ks 0.500000 0.500000 0.500000 Ke 0.000000 0.000000 0.000000 Ni 1.000000 d 1.000000 illum 2 ================================================ FILE: examples/models/Truck.obj ================================================ # Blender v2.78 (sub 0) OBJ File: 'Truck.blend' # www.blender.org mtllib Truck.mtl o Truck_Cube v 0.298667 0.276472 0.014476 v 0.298667 1.006751 0.014476 v 0.298667 0.276472 -1.584185 v 0.298667 1.006751 -1.584185 v 0.298667 0.100000 0.610000 v 0.284365 0.699252 0.408889 v 0.298667 0.100000 0.020000 v 0.284365 0.700000 0.032540 v 0.298667 0.806751 -1.584185 v 0.298667 0.806751 0.014476 v 0.298667 0.906751 -1.584185 v 0.298667 0.906751 0.014476 v 0.298667 0.849813 0.114476 v 0.298667 0.863689 0.064476 v 0.298667 0.849813 0.624476 v 0.298667 0.863689 0.624476 v 0.291516 0.400000 0.026270 v 0.291516 0.400188 0.610280 v 0.143127 0.700000 0.032540 v 0.143127 0.100000 0.020000 v 0.143127 0.699252 0.408889 v 0.103127 0.100000 0.610000 v 0.143127 0.400188 0.610280 v 0.143127 0.400000 0.026270 v 0.295091 0.266667 0.023135 v 0.295930 0.227554 0.610000 v 0.103127 0.215089 0.610000 v 0.143127 0.266667 0.023135 v 0.143127 0.100000 -1.378433 v 0.143127 0.266667 -1.378433 v 0.261053 0.076899 -1.123101 v 0.261053 0.067330 -1.100000 v 0.261053 0.076899 -1.076899 v 0.261053 0.100000 -1.067330 v 0.261053 0.123101 -1.076899 v 0.261053 0.132670 -1.100000 v 0.261053 0.100000 -1.132670 v 0.261053 0.123101 -1.123101 v 0.281053 0.076899 -1.123101 v 0.281053 0.067330 -1.100000 v 0.281053 0.076899 -1.076899 v 0.281053 0.100000 -1.067330 v 0.281053 0.123101 -1.076899 v 0.281053 0.132670 -1.100000 v 0.281053 0.100000 -1.132670 v 0.281053 0.123101 -1.123101 v 0.157302 0.100000 0.090585 v 0.157302 0.177368 0.122632 v 0.157302 0.209415 0.200000 v 0.157302 0.177368 0.277368 v 0.157302 0.100000 0.309415 v 0.157302 0.022632 0.277368 v 0.157302 -0.009415 0.200000 v 0.157302 0.022632 0.122632 v 0.278021 0.100000 0.090585 v 0.278021 0.177368 0.122632 v 0.278021 0.209415 0.200000 v 0.278021 0.177368 0.277368 v 0.278021 0.100000 0.309415 v 0.278021 0.022632 0.277368 v 0.278021 -0.009415 0.200000 v 0.278021 0.022632 0.122632 v 0.298667 0.849813 0.637553 v 0.298667 0.863689 0.637553 v 0.298667 0.880016 0.624476 v 0.298667 0.880016 0.637553 v 0.103127 0.215089 0.492665 v 0.298667 0.100000 0.327395 v 0.298667 0.100000 0.072364 v 0.143127 0.226797 0.198574 v 0.143127 0.187628 0.293449 v 0.143127 0.100000 0.072364 v 0.143127 0.100000 0.327395 v 0.296787 0.187628 0.293449 v 0.295948 0.226797 0.198574 v 0.296694 0.191980 0.112403 v 0.143127 0.191980 0.112403 v 0.143127 0.100000 0.198574 v 0.284365 0.700000 0.055217 v 0.291516 0.400000 0.051469 v 0.143127 0.700000 0.088920 v 0.295091 0.266667 0.088920 v 0.284907 0.677322 0.077668 v 0.284907 0.677322 0.397832 v 0.290974 0.418120 0.567529 v 0.290974 0.418120 0.074488 v 0.275031 0.677322 0.077668 v 0.275031 0.677322 0.397832 v 0.281098 0.418120 0.567529 v 0.281098 0.418120 0.074488 v 0.261874 0.677753 0.423366 v 0.268114 0.419217 0.597465 v 0.143127 0.419217 0.597465 v 0.143127 0.677753 0.423366 v 0.143127 0.677322 0.412451 v 0.143127 0.418120 0.586999 v 0.261874 0.677322 0.412451 v 0.268114 0.418120 0.586999 v 0.292222 0.373741 0.180184 v 0.293120 0.340169 0.180097 v 0.292220 0.373725 0.089181 v 0.293120 0.340216 0.089187 v 0.280037 0.373415 0.180184 v 0.280935 0.339842 0.180097 v 0.280035 0.373399 0.089181 v 0.280935 0.339890 0.089187 v 0.280205 0.367145 0.173897 v 0.280767 0.346113 0.173843 v 0.280203 0.367132 0.095442 v 0.280768 0.346155 0.095446 v 0.280767 0.346124 0.154165 v 0.280205 0.367142 0.154165 v 0.286854 0.367323 0.173897 v 0.287415 0.346291 0.173843 v 0.287415 0.346301 0.154165 v 0.286853 0.367320 0.154165 v 0.296457 0.367579 0.173897 v 0.297018 0.346547 0.173843 v 0.297018 0.346558 0.154165 v 0.296456 0.367576 0.154165 v 0.287415 0.346302 0.095446 v 0.286853 0.367320 0.095442 v 0.297018 0.346559 0.095446 v 0.296456 0.367577 0.095442 v 0.134539 0.252996 0.007801 v 0.134539 0.293932 0.007801 v 0.134539 0.252996 -1.366103 v 0.134539 0.293932 -1.366103 v 0.280657 0.988741 -1.584185 v 0.280657 0.806751 -1.584185 v 0.280657 0.294482 -1.584185 v 0.280657 0.906751 -1.584185 v 0.231746 0.895578 -1.570077 v 0.231746 0.910831 -1.570077 v 0.231746 0.895578 -1.592661 v 0.231746 0.910831 -1.592661 v 0.291788 0.895578 -1.570077 v 0.291788 0.910831 -1.570077 v 0.291788 0.895578 -1.592661 v 0.291788 0.910831 -1.592661 v 0.231746 0.366770 -1.570077 v 0.231746 0.382023 -1.570077 v 0.231746 0.366770 -1.592661 v 0.231746 0.382023 -1.592661 v 0.291788 0.366770 -1.570077 v 0.291788 0.382023 -1.570077 v 0.291788 0.366770 -1.592661 v 0.291788 0.382023 -1.592661 v 0.006417 1.006751 -1.584185 v 0.006417 0.276472 0.014476 v 0.006417 0.806751 0.014476 v 0.006417 0.906751 0.014476 v 0.006417 0.849813 0.114476 v 0.006417 0.863689 0.064476 v 0.006417 0.849813 0.624476 v 0.006417 0.863689 0.624476 v 0.006417 0.849813 0.637553 v 0.006417 0.863689 0.637553 v 0.006417 0.880016 0.624476 v 0.006417 0.880016 0.637553 v 0.006417 0.276472 -1.584185 v 0.006417 1.006751 0.014476 v 0.006417 0.988741 -1.584185 v 0.006417 0.294482 -1.584185 v 0.006417 0.806751 -1.584185 v 0.006417 0.906751 -1.584185 v 0.006417 0.294482 -1.580206 v 0.006417 0.806751 -1.580206 v 0.006417 0.988741 -1.580206 v 0.006417 0.906751 -1.580206 v 0.006417 0.604103 -1.584185 v 0.006417 0.622964 -1.584185 v 0.006417 0.604103 -1.580206 v 0.006417 0.622964 -1.580206 v 0.055292 0.622964 -1.584184 v 0.055292 0.604103 -1.584184 v 0.007139 0.604825 -1.584185 v 0.007139 0.622242 -1.584185 v 0.054570 0.622242 -1.584184 v 0.054570 0.604825 -1.584184 v 0.007139 0.604825 -1.572059 v 0.007139 0.622242 -1.572059 v 0.054570 0.622242 -1.572058 v 0.054570 0.604825 -1.572058 v 0.040830 0.622242 -1.572058 v 0.040830 0.604825 -1.572058 v 0.041681 0.621391 -1.572058 v 0.053718 0.621391 -1.572058 v 0.053718 0.605676 -1.572058 v 0.041681 0.605676 -1.572058 v 0.041681 0.621391 -1.577313 v 0.053718 0.621391 -1.577312 v 0.053718 0.605676 -1.577312 v 0.041681 0.605676 -1.577313 v 0.041681 0.621391 -1.583780 v 0.053718 0.621391 -1.583780 v 0.053718 0.605676 -1.583780 v 0.041681 0.605676 -1.583780 v 0.009750 0.605677 -1.577313 v 0.009750 0.621391 -1.577313 v 0.009750 0.605677 -1.583780 v 0.009750 0.621391 -1.583780 v 0.223972 0.227554 0.610000 v 0.223972 0.100000 0.610000 v 0.297298 0.163777 0.610000 v 0.249569 0.100000 0.610000 v 0.103127 0.163777 0.610000 v 0.259951 0.227554 0.610000 v 0.183549 0.227554 0.610000 v 0.154931 0.100000 0.610000 v 0.223972 0.189119 0.610000 v 0.160087 0.189119 0.610000 v 0.166959 0.172529 0.610000 v 0.183549 0.212582 0.610000 v 0.200140 0.205710 0.610000 v 0.183549 0.165657 0.610000 v 0.200140 0.172529 0.610000 v 0.207012 0.189119 0.610000 v 0.166959 0.205710 0.610000 v 0.283204 0.188989 0.610000 v 0.276527 0.173058 0.610000 v 0.260540 0.166515 0.610000 v 0.260730 0.211653 0.610000 v 0.276661 0.204976 0.610000 v 0.238066 0.189179 0.610000 v 0.244609 0.173192 0.610000 v 0.244743 0.205110 0.610000 v 0.260635 0.189105 0.600800 v 0.260540 0.166515 0.600800 v 0.260730 0.211653 0.600800 v 0.283204 0.188989 0.600800 v 0.238066 0.189179 0.600800 v 0.183549 0.189119 0.600800 v 0.183549 0.165657 0.600800 v 0.183549 0.212582 0.600800 v 0.207012 0.189119 0.600800 v 0.160087 0.189119 0.600800 v 0.166959 0.172529 0.600800 v 0.200140 0.205710 0.600800 v 0.200140 0.172529 0.600800 v 0.166959 0.205710 0.600800 v 0.276527 0.173058 0.600800 v 0.276661 0.204976 0.600800 v 0.244609 0.173192 0.600800 v 0.244743 0.205110 0.600800 v 0.296248 0.212755 0.492665 v 0.298667 0.100000 0.492665 v 0.103127 0.100000 0.492665 v 0.103127 0.163777 0.492665 v 0.100500 0.102023 0.614248 v 0.100500 0.213065 0.614248 v 0.100500 0.102023 0.488417 v 0.100500 0.213065 0.488417 v 0.094915 0.207480 0.614248 v 0.094915 0.107609 0.614248 v 0.094915 0.207480 0.609985 v 0.094915 0.107609 0.609985 v 0.136002 0.137354 0.610000 v 0.223972 0.137354 0.610000 v 0.103127 0.137354 0.610000 v 0.234504 0.137354 0.610000 v 0.297865 0.137354 0.610000 v 0.154931 0.137354 0.610000 v 0.287347 0.137354 0.610000 v 0.249569 0.137354 0.610000 v 0.211698 0.137354 0.610000 v 0.293858 0.133260 0.610000 v 0.287347 0.133260 0.610000 v 0.253663 0.133260 0.610000 v 0.253663 0.104094 0.610000 v 0.294484 0.104094 0.610000 v 0.234504 0.133260 0.610000 v 0.223972 0.133260 0.610000 v 0.211698 0.133260 0.610000 v 0.159025 0.133260 0.610000 v 0.159025 0.104094 0.610000 v 0.223972 0.104094 0.610000 v 0.245476 0.104094 0.610000 v 0.245476 0.133260 0.610000 v 0.136002 0.133260 0.610000 v 0.107221 0.133260 0.610000 v 0.107221 0.104094 0.610000 v 0.150838 0.104094 0.610000 v 0.150838 0.133260 0.610000 v 0.293858 0.133260 0.600000 v 0.287347 0.133260 0.600000 v 0.294484 0.104094 0.600000 v 0.253663 0.133260 0.600000 v 0.253663 0.104094 0.600000 v 0.234504 0.133260 0.600000 v 0.223972 0.133260 0.600000 v 0.245476 0.133260 0.600000 v 0.211698 0.133260 0.600000 v 0.159025 0.133260 0.600000 v 0.159025 0.104094 0.600000 v 0.223972 0.104094 0.600000 v 0.245476 0.104094 0.600000 v 0.136002 0.133260 0.600000 v 0.107221 0.133260 0.600000 v 0.150838 0.133260 0.600000 v 0.107221 0.104094 0.600000 v 0.150838 0.104094 0.600000 v 0.293064 0.339637 0.610182 v 0.293712 0.314296 0.610141 v 0.293071 0.339637 0.568244 v 0.293719 0.314296 0.568244 v 0.236061 0.314296 0.610139 v 0.236061 0.339637 0.610181 v 0.293080 0.338382 0.610181 v 0.293103 0.338382 0.569500 v 0.293696 0.315551 0.610142 v 0.293687 0.315551 0.569500 v 0.237317 0.315551 0.610141 v 0.237317 0.338382 0.610179 v 0.290275 0.336639 0.608109 v 0.290789 0.317904 0.608076 v 0.290294 0.336640 0.571772 v 0.290789 0.317293 0.571772 v 0.239062 0.317293 0.608075 v 0.239062 0.336639 0.608107 v 0.290283 0.336029 0.608108 v 0.290310 0.336029 0.572382 v 0.290797 0.317293 0.608076 v 0.290773 0.317904 0.572382 v 0.239673 0.317904 0.608076 v 0.239673 0.336029 0.608106 v 0.295945 0.339101 0.612150 v 0.296623 0.314832 0.612107 v 0.295981 0.339102 0.572318 v 0.296602 0.314831 0.572318 v 0.240057 0.314832 0.612107 v 0.240057 0.339101 0.612147 v 0.143127 0.266667 -0.309708 v 0.143127 0.266667 -0.516516 v 0.143127 0.100000 -0.309708 v 0.143127 0.100000 -0.516979 v 0.143127 0.266667 -0.615822 v 0.143127 0.266667 -0.872679 v 0.143127 0.100000 -0.616083 v 0.143127 0.100000 -0.872810 v 0.143127 0.198619 -0.516705 v 0.143127 0.198619 -0.309708 v 0.143127 0.242627 -0.872698 v 0.143127 0.242627 -0.615860 v 0.228681 0.100000 -0.309708 v 0.228681 0.100000 -0.516979 v 0.255569 0.100000 -0.616083 v 0.255569 0.100000 -0.872810 v 0.228681 0.198619 -0.516705 v 0.228681 0.198619 -0.309708 v 0.255569 0.242627 -0.872698 v 0.255569 0.242627 -0.615860 v 0.278021 0.156375 0.143625 v 0.278021 0.100000 0.120274 v 0.278021 0.179726 0.200000 v 0.278021 0.156375 0.256375 v 0.278021 0.100000 0.279726 v 0.278021 0.043625 0.256375 v 0.278021 0.020274 0.200000 v 0.278021 0.043625 0.143625 v 0.278021 0.153714 0.146286 v 0.278021 0.100000 0.124037 v 0.278021 0.175963 0.200000 v 0.278021 0.153714 0.253714 v 0.278021 0.100000 0.275963 v 0.278021 0.046286 0.253714 v 0.278021 0.024037 0.200000 v 0.278021 0.046286 0.146286 v 0.281053 0.155560 0.144440 v 0.281053 0.100000 0.121426 v 0.281053 0.178574 0.200000 v 0.281053 0.155560 0.255560 v 0.281053 0.100000 0.278574 v 0.281053 0.044440 0.255560 v 0.281053 0.021426 0.200000 v 0.281053 0.044440 0.144440 v 0.281053 0.133173 0.166827 v 0.281053 0.100000 0.153086 v 0.281053 0.146914 0.200000 v 0.281053 0.133173 0.233173 v 0.281053 0.100000 0.246914 v 0.281053 0.066827 0.233173 v 0.281053 0.053086 0.200000 v 0.281053 0.066827 0.166827 v 0.281053 0.047990 0.252010 v 0.281053 0.028368 0.204639 v 0.281053 0.049986 0.204639 v 0.281053 0.063276 0.236724 v 0.281053 0.095361 0.250014 v 0.281053 0.095361 0.271632 v 0.281053 0.152010 0.252010 v 0.281053 0.104639 0.271632 v 0.281053 0.104639 0.250014 v 0.281053 0.136724 0.236724 v 0.281053 0.150014 0.204639 v 0.281053 0.171632 0.204639 v 0.281053 0.152010 0.147990 v 0.281053 0.171632 0.195361 v 0.281053 0.150014 0.195361 v 0.281053 0.136724 0.163276 v 0.281053 0.104639 0.149986 v 0.281053 0.104639 0.128368 v 0.281053 0.047990 0.147990 v 0.281053 0.095361 0.128368 v 0.281053 0.095361 0.149986 v 0.281053 0.063276 0.163276 v 0.281053 0.049986 0.195361 v 0.281053 0.028368 0.195361 v 0.261053 0.028368 0.204639 v 0.261053 0.047990 0.252010 v 0.261053 0.095361 0.271632 v 0.261053 0.049986 0.204639 v 0.261053 0.063276 0.236724 v 0.261053 0.095361 0.250014 v 0.261053 0.104639 0.271632 v 0.261053 0.152010 0.252010 v 0.261053 0.171632 0.204639 v 0.261053 0.104639 0.250014 v 0.261053 0.136724 0.236724 v 0.261053 0.150014 0.204639 v 0.261053 0.171632 0.195361 v 0.261053 0.152010 0.147990 v 0.261053 0.104639 0.128368 v 0.261053 0.150014 0.195361 v 0.261053 0.136724 0.163276 v 0.261053 0.104639 0.149986 v 0.261053 0.095361 0.128368 v 0.261053 0.047990 0.147990 v 0.261053 0.028368 0.195361 v 0.261053 0.095361 0.149986 v 0.261053 0.063276 0.163276 v 0.261053 0.049986 0.195361 v 0.281053 0.123101 0.176899 v 0.281053 0.100000 0.167330 v 0.281053 0.132670 0.200000 v 0.281053 0.123101 0.223101 v 0.281053 0.100000 0.232670 v 0.281053 0.076899 0.223101 v 0.281053 0.067330 0.200000 v 0.281053 0.076899 0.176899 v 0.261053 0.123101 0.176899 v 0.261053 0.100000 0.167330 v 0.261053 0.132670 0.200000 v 0.261053 0.123101 0.223101 v 0.261053 0.100000 0.232670 v 0.261053 0.076899 0.223101 v 0.261053 0.067330 0.200000 v 0.261053 0.076899 0.176899 v 0.261053 0.049986 -1.104639 v 0.261053 0.063276 -1.136724 v 0.261053 0.095361 -1.150014 v 0.261053 0.028368 -1.104639 v 0.261053 0.047990 -1.152010 v 0.261053 0.095361 -1.171632 v 0.261053 0.104639 -1.150014 v 0.261053 0.136724 -1.136724 v 0.261053 0.150014 -1.104639 v 0.261053 0.104639 -1.171632 v 0.261053 0.152010 -1.152010 v 0.261053 0.171632 -1.104639 v 0.261053 0.150014 -1.095361 v 0.261053 0.136724 -1.063276 v 0.261053 0.104639 -1.049986 v 0.261053 0.171632 -1.095361 v 0.261053 0.152010 -1.047990 v 0.261053 0.104639 -1.028368 v 0.261053 0.095361 -1.049986 v 0.261053 0.063276 -1.063276 v 0.261053 0.049986 -1.095361 v 0.261053 0.095361 -1.028368 v 0.261053 0.047990 -1.047990 v 0.261053 0.028368 -1.095361 v 0.281053 0.028368 -1.104639 v 0.281053 0.049986 -1.104639 v 0.281053 0.063276 -1.136724 v 0.281053 0.095361 -1.150014 v 0.281053 0.095361 -1.171632 v 0.281053 0.047990 -1.152010 v 0.281053 0.104639 -1.171632 v 0.281053 0.104639 -1.150014 v 0.281053 0.136724 -1.136724 v 0.281053 0.150014 -1.104639 v 0.281053 0.171632 -1.104639 v 0.281053 0.152010 -1.152010 v 0.281053 0.171632 -1.095361 v 0.281053 0.150014 -1.095361 v 0.281053 0.136724 -1.063276 v 0.281053 0.104639 -1.049986 v 0.281053 0.104639 -1.028368 v 0.281053 0.152010 -1.047990 v 0.281053 0.095361 -1.028368 v 0.281053 0.095361 -1.049986 v 0.281053 0.063276 -1.063276 v 0.281053 0.049986 -1.095361 v 0.281053 0.028368 -1.095361 v 0.281053 0.047990 -1.047990 v 0.281053 0.066827 -1.133173 v 0.281053 0.053086 -1.100000 v 0.281053 0.066827 -1.066827 v 0.281053 0.100000 -1.053086 v 0.281053 0.133173 -1.066827 v 0.281053 0.146914 -1.100000 v 0.281053 0.100000 -1.146914 v 0.281053 0.133173 -1.133173 v 0.281053 0.044440 -1.155560 v 0.281053 0.021426 -1.100000 v 0.281053 0.044440 -1.044440 v 0.281053 0.100000 -1.021426 v 0.281053 0.155560 -1.044440 v 0.281053 0.178574 -1.100000 v 0.281053 0.100000 -1.178574 v 0.281053 0.155560 -1.155560 v 0.278021 0.046286 -1.153714 v 0.278021 0.024037 -1.100000 v 0.278021 0.046286 -1.046286 v 0.278021 0.100000 -1.024037 v 0.278021 0.153714 -1.046286 v 0.278021 0.175963 -1.100000 v 0.278021 0.100000 -1.175963 v 0.278021 0.153714 -1.153714 v 0.278021 0.043625 -1.156375 v 0.278021 0.020274 -1.100000 v 0.278021 0.043625 -1.043625 v 0.278021 0.100000 -1.020274 v 0.278021 0.156375 -1.043625 v 0.278021 0.179726 -1.100000 v 0.278021 0.100000 -1.179726 v 0.278021 0.156375 -1.156375 v 0.278021 0.022632 -1.177368 v 0.278021 -0.009415 -1.100000 v 0.278021 0.022632 -1.022632 v 0.278021 0.100000 -0.990585 v 0.278021 0.177368 -1.022632 v 0.278021 0.209415 -1.100000 v 0.278021 0.177368 -1.177368 v 0.278021 0.100000 -1.209415 v 0.157302 0.022632 -1.177368 v 0.157302 -0.009415 -1.100000 v 0.157302 0.022632 -1.022632 v 0.157302 0.100000 -0.990585 v 0.157302 0.177368 -1.022632 v 0.157302 0.209415 -1.100000 v 0.157302 0.177368 -1.177368 v 0.157302 0.100000 -1.209415 v 0.295196 0.256283 0.610047 v 0.295876 0.230064 0.576561 v 0.296021 0.223336 0.576561 v 0.298667 0.100000 0.576561 v 0.295712 0.236314 0.576561 v 0.295213 0.256283 0.500328 v 0.109784 0.256283 0.610047 v 0.295199 0.256282 0.576560 v -0.298667 0.276472 0.014476 v -0.298667 1.006751 0.014476 v -0.298667 0.276472 -1.584185 v -0.298667 1.006751 -1.584185 v -0.298667 0.100000 0.610000 v -0.284365 0.699252 0.408889 v -0.298667 0.100000 0.020000 v -0.284365 0.700000 0.032540 v -0.298667 0.806751 -1.584185 v -0.298667 0.806751 0.014476 v -0.298667 0.906751 -1.584185 v -0.298667 0.906751 0.014476 v -0.298667 0.849813 0.114476 v -0.298667 0.863689 0.064476 v -0.298667 0.849813 0.624476 v -0.298667 0.863689 0.624476 v -0.291516 0.400000 0.026270 v -0.291516 0.400188 0.610280 v -0.143127 0.700000 0.032540 v -0.143127 0.100000 0.020000 v -0.143127 0.699252 0.408889 v -0.103127 0.100000 0.610000 v -0.143127 0.400188 0.610280 v -0.143127 0.400000 0.026270 v -0.295091 0.266667 0.023135 v -0.295930 0.227554 0.610000 v -0.103127 0.215089 0.610000 v -0.143127 0.266667 0.023135 v -0.143127 0.100000 -1.378433 v -0.143127 0.266667 -1.378433 v -0.261053 0.076899 -1.123101 v -0.261053 0.067330 -1.100000 v -0.261053 0.076899 -1.076899 v -0.261053 0.100000 -1.067330 v -0.261053 0.123101 -1.076899 v -0.261053 0.132670 -1.100000 v -0.261053 0.100000 -1.132670 v -0.261053 0.123101 -1.123101 v -0.281053 0.076899 -1.123101 v -0.281053 0.067330 -1.100000 v -0.281053 0.076899 -1.076899 v -0.281053 0.100000 -1.067330 v -0.281053 0.123101 -1.076899 v -0.281053 0.132670 -1.100000 v -0.281053 0.100000 -1.132670 v -0.281053 0.123101 -1.123101 v -0.157302 0.100000 0.090585 v -0.157302 0.177368 0.122632 v -0.157302 0.209415 0.200000 v -0.157302 0.177368 0.277368 v -0.157302 0.100000 0.309415 v -0.157302 0.022632 0.277368 v -0.157302 -0.009415 0.200000 v -0.157302 0.022632 0.122632 v -0.278021 0.100000 0.090585 v -0.278021 0.177368 0.122632 v -0.278021 0.209415 0.200000 v -0.278021 0.177368 0.277368 v -0.278021 0.100000 0.309415 v -0.278021 0.022632 0.277368 v -0.278021 -0.009415 0.200000 v -0.278021 0.022632 0.122632 v -0.298667 0.849813 0.637553 v -0.298667 0.863689 0.637553 v -0.298667 0.880016 0.624476 v -0.298667 0.880016 0.637553 v 0.000000 1.006751 -1.584185 v 0.000000 0.276472 -1.584185 v 0.000000 1.006751 0.014476 v 0.000000 0.276472 0.014476 v 0.000000 0.806751 0.014476 v 0.000000 0.906751 0.014476 v 0.000000 0.849813 0.114476 v 0.000000 0.863689 0.064476 v 0.000000 0.849813 0.624476 v 0.000000 0.863689 0.624476 v 0.000000 0.849813 0.637553 v 0.000000 0.863689 0.637553 v 0.000000 0.880016 0.624476 v 0.000000 0.880016 0.637553 v 0.000000 0.700000 0.032540 v 0.000000 0.100000 0.020000 v 0.000000 0.699252 0.408889 v -0.103127 0.215089 0.492665 v 0.000000 0.400188 0.610280 v 0.000000 0.400000 0.026270 v 0.000000 0.266667 0.023135 v 0.000000 0.215089 0.610000 v 0.000000 0.100000 -1.378433 v 0.000000 0.266667 -1.378433 v -0.298667 0.100000 0.327395 v -0.298667 0.100000 0.072364 v -0.143127 0.226797 0.198574 v -0.143127 0.187628 0.293449 v -0.143127 0.100000 0.072364 v -0.143127 0.100000 0.327395 v -0.296787 0.187628 0.293449 v -0.295948 0.226797 0.198574 v -0.296694 0.191980 0.112403 v -0.143127 0.191980 0.112403 v -0.143127 0.100000 0.198574 v 0.000000 0.100000 0.198574 v -0.284365 0.700000 0.055217 v -0.291516 0.400000 0.051469 v -0.143127 0.700000 0.088920 v -0.295091 0.266667 0.088920 v 0.000000 0.700000 0.088920 v -0.284907 0.677322 0.077668 v -0.284907 0.677322 0.397832 v -0.290974 0.418120 0.567529 v -0.290974 0.418120 0.074488 v -0.275031 0.677322 0.077668 v -0.275031 0.677322 0.397832 v -0.281098 0.418120 0.567529 v -0.281098 0.418120 0.074488 v -0.261874 0.677753 0.423366 v -0.268114 0.419217 0.597465 v -0.143127 0.419217 0.597465 v -0.143127 0.677753 0.423366 v 0.000000 0.419217 0.597465 v 0.000000 0.677753 0.423366 v -0.143127 0.677322 0.412451 v -0.143127 0.418120 0.586999 v 0.000000 0.677322 0.412451 v 0.000000 0.418120 0.586999 v -0.261874 0.677322 0.412451 v -0.268114 0.418120 0.586999 v -0.292222 0.373741 0.180184 v -0.293120 0.340169 0.180097 v -0.292220 0.373725 0.089181 v -0.293120 0.340216 0.089187 v -0.280037 0.373415 0.180184 v -0.280935 0.339842 0.180097 v -0.280035 0.373399 0.089181 v -0.280935 0.339890 0.089187 v -0.280205 0.367145 0.173897 v -0.280767 0.346113 0.173843 v -0.280203 0.367132 0.095442 v -0.280768 0.346155 0.095446 v -0.280767 0.346124 0.154165 v -0.280205 0.367142 0.154165 v -0.286854 0.367323 0.173897 v -0.287415 0.346291 0.173843 v -0.287415 0.346301 0.154165 v -0.286853 0.367320 0.154165 v -0.296457 0.367579 0.173897 v -0.297018 0.346547 0.173843 v -0.297018 0.346558 0.154165 v -0.296456 0.367576 0.154165 v -0.287415 0.346302 0.095446 v -0.286853 0.367320 0.095442 v -0.297018 0.346559 0.095446 v -0.296456 0.367577 0.095442 v 0.000000 0.252996 0.007801 v 0.000000 0.293932 0.007801 v 0.000000 0.252996 -1.366103 v 0.000000 0.293932 -1.366103 v -0.134539 0.252996 0.007801 v -0.134539 0.293932 0.007801 v -0.134539 0.252996 -1.366103 v -0.134539 0.293932 -1.366103 v -0.280657 0.988741 -1.584185 v -0.280657 0.806751 -1.584185 v -0.280657 0.294482 -1.584185 v -0.280657 0.906751 -1.584185 v -0.231746 0.895578 -1.570077 v -0.231746 0.910831 -1.570077 v -0.231746 0.895578 -1.592661 v -0.231746 0.910831 -1.592661 v -0.291788 0.895578 -1.570077 v -0.291788 0.910831 -1.570077 v -0.291788 0.895578 -1.592661 v -0.291788 0.910831 -1.592661 v -0.231746 0.366770 -1.570077 v -0.231746 0.382023 -1.570077 v -0.231746 0.366770 -1.592661 v -0.231746 0.382023 -1.592661 v -0.291788 0.366770 -1.570077 v -0.291788 0.382023 -1.570077 v -0.291788 0.366770 -1.592661 v -0.291788 0.382023 -1.592661 v -0.006417 1.006751 -1.584185 v -0.006417 0.276472 0.014476 v -0.006417 0.806751 0.014476 v -0.006417 0.906751 0.014476 v -0.006417 0.849813 0.114476 v -0.006417 0.863689 0.064476 v -0.006417 0.849813 0.624476 v -0.006417 0.863689 0.624476 v -0.006417 0.849813 0.637553 v -0.006417 0.863689 0.637553 v -0.006417 0.880016 0.624476 v -0.006417 0.880016 0.637553 v -0.006417 0.276472 -1.584185 v -0.006417 1.006751 0.014476 v -0.006417 0.988741 -1.584185 v -0.006417 0.294482 -1.584185 v 0.000000 0.294482 -1.584185 v 0.000000 0.988741 -1.584185 v -0.006417 0.806751 -1.584185 v -0.006417 0.906751 -1.584185 v -0.006417 0.294482 -1.580206 v -0.006417 0.806751 -1.580206 v 0.000000 0.294482 -1.580206 v 0.000000 0.806751 -1.580206 v -0.006417 0.988741 -1.580206 v 0.000000 0.988741 -1.580206 v -0.006417 0.906751 -1.580206 v 0.000000 0.906751 -1.580206 v -0.006417 0.604103 -1.584185 v -0.006417 0.622964 -1.584185 v -0.006417 0.604103 -1.580206 v 0.000000 0.604103 -1.580206 v 0.000000 0.622964 -1.580206 v -0.006417 0.622964 -1.580206 v -0.055292 0.622964 -1.584184 v -0.055292 0.604103 -1.584184 v -0.007139 0.604825 -1.584185 v -0.007139 0.622242 -1.584185 v -0.054570 0.622242 -1.584184 v -0.054570 0.604825 -1.584184 v -0.007139 0.604825 -1.572059 v -0.007139 0.622242 -1.572059 v -0.054570 0.622242 -1.572058 v -0.054570 0.604825 -1.572058 v -0.040830 0.622242 -1.572058 v -0.040830 0.604825 -1.572058 v -0.041681 0.621391 -1.572058 v -0.053718 0.621391 -1.572058 v -0.053718 0.605676 -1.572058 v -0.041681 0.605676 -1.572058 v -0.041681 0.621391 -1.577313 v -0.053718 0.621391 -1.577312 v -0.053718 0.605676 -1.577312 v -0.041681 0.605676 -1.577313 v -0.041681 0.621391 -1.583780 v -0.053718 0.621391 -1.583780 v -0.053718 0.605676 -1.583780 v -0.041681 0.605676 -1.583780 v -0.009750 0.605677 -1.577313 v -0.009750 0.621391 -1.577313 v -0.009750 0.605677 -1.583780 v -0.009750 0.621391 -1.583780 v -0.223972 0.227554 0.610000 v -0.223972 0.100000 0.610000 v -0.297298 0.163777 0.610000 v -0.249569 0.100000 0.610000 v -0.103127 0.163777 0.610000 v -0.259951 0.227554 0.610000 v -0.183549 0.227554 0.610000 v -0.154931 0.100000 0.610000 v -0.223972 0.189119 0.610000 v -0.160087 0.189119 0.610000 v -0.166959 0.172529 0.610000 v -0.183549 0.212582 0.610000 v -0.200140 0.205710 0.610000 v -0.183549 0.165657 0.610000 v -0.200140 0.172529 0.610000 v -0.207012 0.189119 0.610000 v -0.166959 0.205710 0.610000 v -0.283204 0.188989 0.610000 v -0.276527 0.173058 0.610000 v -0.260540 0.166515 0.610000 v -0.260730 0.211653 0.610000 v -0.276661 0.204976 0.610000 v -0.238066 0.189179 0.610000 v -0.244609 0.173192 0.610000 v -0.244743 0.205110 0.610000 v -0.260635 0.189105 0.600800 v -0.260540 0.166515 0.600800 v -0.260730 0.211653 0.600800 v -0.283204 0.188989 0.600800 v -0.238066 0.189179 0.600800 v -0.183549 0.189119 0.600800 v -0.183549 0.165657 0.600800 v -0.183549 0.212582 0.600800 v -0.207012 0.189119 0.600800 v -0.160087 0.189119 0.600800 v -0.166959 0.172529 0.600800 v -0.200140 0.205710 0.600800 v -0.200140 0.172529 0.600800 v -0.166959 0.205710 0.600800 v -0.276527 0.173058 0.600800 v -0.276661 0.204976 0.600800 v -0.244609 0.173192 0.600800 v -0.244743 0.205110 0.600800 v -0.296248 0.212755 0.492665 v -0.298667 0.100000 0.492665 v -0.103127 0.100000 0.492665 v 0.000000 0.100000 0.492665 v 0.000000 0.215089 0.492665 v 0.000000 0.107609 0.614248 v -0.103127 0.163777 0.492665 v 0.000000 0.163777 0.492665 v 0.000000 0.213065 0.614248 v 0.000000 0.102023 0.488417 v 0.000000 0.213065 0.488417 v -0.100500 0.102023 0.614248 v -0.100500 0.213065 0.614248 v -0.100500 0.102023 0.488417 v -0.100500 0.213065 0.488417 v -0.094915 0.207480 0.614248 v -0.094915 0.107609 0.614248 v 0.000000 0.207480 0.614248 v 0.000000 0.102023 0.614248 v 0.000000 0.107609 0.609985 v 0.000000 0.207480 0.609985 v -0.094915 0.207480 0.609985 v -0.094915 0.107609 0.609985 v -0.136002 0.137354 0.610000 v -0.223972 0.137354 0.610000 v -0.103127 0.137354 0.610000 v -0.234504 0.137354 0.610000 v -0.297865 0.137354 0.610000 v -0.154931 0.137354 0.610000 v -0.287347 0.137354 0.610000 v -0.249569 0.137354 0.610000 v -0.211698 0.137354 0.610000 v -0.293858 0.133260 0.610000 v -0.287347 0.133260 0.610000 v -0.253663 0.133260 0.610000 v -0.253663 0.104094 0.610000 v -0.294484 0.104094 0.610000 v -0.234504 0.133260 0.610000 v -0.223972 0.133260 0.610000 v -0.211698 0.133260 0.610000 v -0.159025 0.133260 0.610000 v -0.159025 0.104094 0.610000 v -0.223972 0.104094 0.610000 v -0.245476 0.104094 0.610000 v -0.245476 0.133260 0.610000 v -0.136002 0.133260 0.610000 v -0.107221 0.133260 0.610000 v -0.107221 0.104094 0.610000 v -0.150838 0.104094 0.610000 v -0.150838 0.133260 0.610000 v -0.293858 0.133260 0.600000 v -0.287347 0.133260 0.600000 v -0.294484 0.104094 0.600000 v -0.253663 0.133260 0.600000 v -0.253663 0.104094 0.600000 v -0.234504 0.133260 0.600000 v -0.223972 0.133260 0.600000 v -0.245476 0.133260 0.600000 v -0.211698 0.133260 0.600000 v -0.159025 0.133260 0.600000 v -0.159025 0.104094 0.600000 v -0.223972 0.104094 0.600000 v -0.245476 0.104094 0.600000 v -0.136002 0.133260 0.600000 v -0.107221 0.133260 0.600000 v -0.150838 0.133260 0.600000 v -0.107221 0.104094 0.600000 v -0.150838 0.104094 0.600000 v -0.293064 0.339637 0.610182 v -0.293712 0.314296 0.610141 v -0.293071 0.339637 0.568244 v -0.293719 0.314296 0.568244 v -0.236061 0.314296 0.610139 v -0.236061 0.339637 0.610181 v -0.293080 0.338382 0.610181 v -0.293103 0.338382 0.569500 v -0.293696 0.315551 0.610142 v -0.293687 0.315551 0.569500 v -0.237317 0.315551 0.610141 v -0.237317 0.338382 0.610179 v -0.290275 0.336639 0.608109 v -0.290789 0.317904 0.608076 v -0.290294 0.336640 0.571772 v -0.290789 0.317293 0.571772 v -0.239062 0.317293 0.608075 v -0.239062 0.336639 0.608107 v -0.290283 0.336029 0.608108 v -0.290310 0.336029 0.572382 v -0.290797 0.317293 0.608076 v -0.290773 0.317904 0.572382 v -0.239673 0.317904 0.608076 v -0.239673 0.336029 0.608106 v -0.295945 0.339101 0.612150 v -0.296623 0.314832 0.612107 v -0.295981 0.339102 0.572318 v -0.296602 0.314831 0.572318 v -0.240057 0.314832 0.612107 v -0.240057 0.339101 0.612147 v -0.143127 0.266667 -0.309708 v -0.143127 0.266667 -0.516516 v -0.143127 0.100000 -0.309708 v -0.143127 0.100000 -0.516979 v 0.000000 0.100000 -0.309708 v 0.000000 0.100000 -0.516979 v 0.000000 0.266667 -0.309708 v 0.000000 0.266667 -0.516516 v -0.143127 0.266667 -0.615822 v -0.143127 0.266667 -0.872679 v -0.143127 0.100000 -0.616083 v -0.143127 0.100000 -0.872810 v 0.000000 0.100000 -0.616083 v 0.000000 0.100000 -0.872810 v 0.000000 0.266667 -0.615822 v 0.000000 0.266667 -0.872679 v -0.143127 0.198619 -0.516705 v -0.143127 0.198619 -0.309708 v -0.143127 0.242627 -0.872698 v -0.143127 0.242627 -0.615860 v -0.228681 0.100000 -0.309708 v -0.228681 0.100000 -0.516979 v -0.255569 0.100000 -0.616083 v -0.255569 0.100000 -0.872810 v -0.228681 0.198619 -0.516705 v -0.228681 0.198619 -0.309708 v -0.255569 0.242627 -0.872698 v -0.255569 0.242627 -0.615860 v -0.278021 0.156375 0.143625 v -0.278021 0.100000 0.120274 v -0.278021 0.179726 0.200000 v -0.278021 0.156375 0.256375 v -0.278021 0.100000 0.279726 v -0.278021 0.043625 0.256375 v -0.278021 0.020274 0.200000 v -0.278021 0.043625 0.143625 v -0.278021 0.153714 0.146286 v -0.278021 0.100000 0.124037 v -0.278021 0.175963 0.200000 v -0.278021 0.153714 0.253714 v -0.278021 0.100000 0.275963 v -0.278021 0.046286 0.253714 v -0.278021 0.024037 0.200000 v -0.278021 0.046286 0.146286 v -0.281053 0.155560 0.144440 v -0.281053 0.100000 0.121426 v -0.281053 0.178574 0.200000 v -0.281053 0.155560 0.255560 v -0.281053 0.100000 0.278574 v -0.281053 0.044440 0.255560 v -0.281053 0.021426 0.200000 v -0.281053 0.044440 0.144440 v -0.281053 0.133173 0.166827 v -0.281053 0.100000 0.153086 v -0.281053 0.146914 0.200000 v -0.281053 0.133173 0.233173 v -0.281053 0.100000 0.246914 v -0.281053 0.066827 0.233173 v -0.281053 0.053086 0.200000 v -0.281053 0.066827 0.166827 v -0.281053 0.047990 0.252010 v -0.281053 0.028368 0.204639 v -0.281053 0.049986 0.204639 v -0.281053 0.063276 0.236724 v -0.281053 0.095361 0.250014 v -0.281053 0.095361 0.271632 v -0.281053 0.152010 0.252010 v -0.281053 0.104639 0.271632 v -0.281053 0.104639 0.250014 v -0.281053 0.136724 0.236724 v -0.281053 0.150014 0.204639 v -0.281053 0.171632 0.204639 v -0.281053 0.152010 0.147990 v -0.281053 0.171632 0.195361 v -0.281053 0.150014 0.195361 v -0.281053 0.136724 0.163276 v -0.281053 0.104639 0.149986 v -0.281053 0.104639 0.128368 v -0.281053 0.047990 0.147990 v -0.281053 0.095361 0.128368 v -0.281053 0.095361 0.149986 v -0.281053 0.063276 0.163276 v -0.281053 0.049986 0.195361 v -0.281053 0.028368 0.195361 v -0.261053 0.028368 0.204639 v -0.261053 0.047990 0.252010 v -0.261053 0.095361 0.271632 v -0.261053 0.049986 0.204639 v -0.261053 0.063276 0.236724 v -0.261053 0.095361 0.250014 v -0.261053 0.104639 0.271632 v -0.261053 0.152010 0.252010 v -0.261053 0.171632 0.204639 v -0.261053 0.104639 0.250014 v -0.261053 0.136724 0.236724 v -0.261053 0.150014 0.204639 v -0.261053 0.171632 0.195361 v -0.261053 0.152010 0.147990 v -0.261053 0.104639 0.128368 v -0.261053 0.150014 0.195361 v -0.261053 0.136724 0.163276 v -0.261053 0.104639 0.149986 v -0.261053 0.095361 0.128368 v -0.261053 0.047990 0.147990 v -0.261053 0.028368 0.195361 v -0.261053 0.095361 0.149986 v -0.261053 0.063276 0.163276 v -0.261053 0.049986 0.195361 v -0.281053 0.123101 0.176899 v -0.281053 0.100000 0.167330 v -0.281053 0.132670 0.200000 v -0.281053 0.123101 0.223101 v -0.281053 0.100000 0.232670 v -0.281053 0.076899 0.223101 v -0.281053 0.067330 0.200000 v -0.281053 0.076899 0.176899 v -0.261053 0.123101 0.176899 v -0.261053 0.100000 0.167330 v -0.261053 0.132670 0.200000 v -0.261053 0.123101 0.223101 v -0.261053 0.100000 0.232670 v -0.261053 0.076899 0.223101 v -0.261053 0.067330 0.200000 v -0.261053 0.076899 0.176899 v -0.261053 0.049986 -1.104639 v -0.261053 0.063276 -1.136724 v -0.261053 0.095361 -1.150014 v -0.261053 0.028368 -1.104639 v -0.261053 0.047990 -1.152010 v -0.261053 0.095361 -1.171632 v -0.261053 0.104639 -1.150014 v -0.261053 0.136724 -1.136724 v -0.261053 0.150014 -1.104639 v -0.261053 0.104639 -1.171632 v -0.261053 0.152010 -1.152010 v -0.261053 0.171632 -1.104639 v -0.261053 0.150014 -1.095361 v -0.261053 0.136724 -1.063276 v -0.261053 0.104639 -1.049986 v -0.261053 0.171632 -1.095361 v -0.261053 0.152010 -1.047990 v -0.261053 0.104639 -1.028368 v -0.261053 0.095361 -1.049986 v -0.261053 0.063276 -1.063276 v -0.261053 0.049986 -1.095361 v -0.261053 0.095361 -1.028368 v -0.261053 0.047990 -1.047990 v -0.261053 0.028368 -1.095361 v -0.281053 0.028368 -1.104639 v -0.281053 0.049986 -1.104639 v -0.281053 0.063276 -1.136724 v -0.281053 0.095361 -1.150014 v -0.281053 0.095361 -1.171632 v -0.281053 0.047990 -1.152010 v -0.281053 0.104639 -1.171632 v -0.281053 0.104639 -1.150014 v -0.281053 0.136724 -1.136724 v -0.281053 0.150014 -1.104639 v -0.281053 0.171632 -1.104639 v -0.281053 0.152010 -1.152010 v -0.281053 0.171632 -1.095361 v -0.281053 0.150014 -1.095361 v -0.281053 0.136724 -1.063276 v -0.281053 0.104639 -1.049986 v -0.281053 0.104639 -1.028368 v -0.281053 0.152010 -1.047990 v -0.281053 0.095361 -1.028368 v -0.281053 0.095361 -1.049986 v -0.281053 0.063276 -1.063276 v -0.281053 0.049986 -1.095361 v -0.281053 0.028368 -1.095361 v -0.281053 0.047990 -1.047990 v -0.281053 0.066827 -1.133173 v -0.281053 0.053086 -1.100000 v -0.281053 0.066827 -1.066827 v -0.281053 0.100000 -1.053086 v -0.281053 0.133173 -1.066827 v -0.281053 0.146914 -1.100000 v -0.281053 0.100000 -1.146914 v -0.281053 0.133173 -1.133173 v -0.281053 0.044440 -1.155560 v -0.281053 0.021426 -1.100000 v -0.281053 0.044440 -1.044440 v -0.281053 0.100000 -1.021426 v -0.281053 0.155560 -1.044440 v -0.281053 0.178574 -1.100000 v -0.281053 0.100000 -1.178574 v -0.281053 0.155560 -1.155560 v -0.278021 0.046286 -1.153714 v -0.278021 0.024037 -1.100000 v -0.278021 0.046286 -1.046286 v -0.278021 0.100000 -1.024037 v -0.278021 0.153714 -1.046286 v -0.278021 0.175963 -1.100000 v -0.278021 0.100000 -1.175963 v -0.278021 0.153714 -1.153714 v -0.278021 0.043625 -1.156375 v -0.278021 0.020274 -1.100000 v -0.278021 0.043625 -1.043625 v -0.278021 0.100000 -1.020274 v -0.278021 0.156375 -1.043625 v -0.278021 0.179726 -1.100000 v -0.278021 0.100000 -1.179726 v -0.278021 0.156375 -1.156375 v -0.278021 0.022632 -1.177368 v -0.278021 -0.009415 -1.100000 v -0.278021 0.022632 -1.022632 v -0.278021 0.100000 -0.990585 v -0.278021 0.177368 -1.022632 v -0.278021 0.209415 -1.100000 v -0.278021 0.177368 -1.177368 v -0.278021 0.100000 -1.209415 v -0.157302 0.022632 -1.177368 v -0.157302 -0.009415 -1.100000 v -0.157302 0.022632 -1.022632 v -0.157302 0.100000 -0.990585 v -0.157302 0.177368 -1.022632 v -0.157302 0.209415 -1.100000 v -0.157302 0.177368 -1.177368 v -0.157302 0.100000 -1.209415 v -0.295196 0.256283 0.610047 v -0.295876 0.230064 0.576561 v -0.296021 0.223336 0.576561 v -0.298667 0.100000 0.576561 v -0.295712 0.236314 0.576561 v -0.295213 0.256283 0.500328 v -0.109784 0.256283 0.610047 v 0.000000 0.256283 0.610047 v -0.295199 0.256282 0.576560 vn -0.0000 0.0188 -0.9998 vn 0.0000 -0.0123 0.9999 vn 0.0000 0.0209 -0.9998 vn 0.0000 0.9945 -0.1043 vn 0.0000 1.0000 0.0000 vn -0.9239 0.3827 0.0000 vn -0.0000 0.0235 -0.9997 vn 0.7644 -0.0011 0.6448 vn 0.0000 0.0002 1.0000 vn 0.0000 0.0000 -1.0000 vn 1.0000 0.0000 0.0000 vn 0.0000 -0.0016 1.0000 vn 0.9998 0.0214 0.0000 vn 0.0000 -0.9992 0.0395 vn 0.0000 1.0000 0.0023 vn 0.9996 0.0268 0.0000 vn 0.9997 0.0238 0.0000 vn 0.9998 0.0215 0.0000 vn 0.9997 0.0247 0.0000 vn 0.9998 0.0214 -0.0037 vn 0.9996 0.0299 0.0000 vn 0.9997 0.0238 -0.0001 vn 0.0000 -0.5477 -0.8366 vn 0.0000 -1.0000 0.0000 vn 0.0000 0.5586 0.8295 vn -0.9997 -0.0225 0.0024 vn 0.9997 0.0256 0.0002 vn 0.9996 0.0269 -0.0000 vn 0.9997 0.0264 0.0004 vn -0.0268 0.9996 0.0005 vn 0.0268 -0.9996 0.0002 vn -0.0001 0.0026 -1.0000 vn 0.9996 0.0267 -0.0001 vn 0.9996 0.0269 0.0001 vn -0.0267 0.9996 0.0000 vn -0.0267 0.9996 -0.0002 vn 0.0267 -0.9996 -0.0005 vn 0.0001 -0.0026 1.0000 vn 0.9996 0.0267 0.0000 vn 0.0000 -0.0002 -1.0000 vn 0.0267 -0.9996 -0.0000 vn -0.9996 -0.0267 0.0000 vn 0.0000 0.0000 1.0000 vn -1.0000 0.0000 0.0000 vn -0.9223 0.3866 0.0000 vn 0.3827 -0.9239 0.0000 vn -0.3866 -0.9223 0.0000 vn -0.9239 -0.3827 0.0000 vn -0.9255 -0.3788 0.0000 vn 0.3788 -0.9255 0.0000 vn 0.9239 0.3827 0.0000 vn -0.3827 -0.9239 0.0000 vn 0.9223 -0.3866 0.0000 vn 0.3866 0.9223 0.0000 vn 0.9255 0.3788 0.0000 vn 0.3827 0.9239 0.0000 vn -0.3788 0.9255 0.0000 vn 0.9239 -0.3827 0.0000 vn -0.3827 0.9239 0.0000 vn -0.0000 -0.0017 1.0000 vn -0.0000 -0.7653 0.6437 vn 0.9999 0.0128 0.0006 vn -0.0000 -0.0008 1.0000 vn -0.9955 -0.0002 0.0948 vn -0.0000 0.7644 0.6447 vn 0.6228 0.0159 0.7822 vn 0.5151 0.8571 -0.0001 vn 0.5273 -0.8497 0.0003 vn 0.9999 0.0132 0.0008 vn 0.9996 0.0265 -0.0002 vn 0.9997 0.0255 -0.0006 vn -0.0000 -0.0009 1.0000 vn -0.0112 -0.0003 -0.9999 vn 0.0000 0.0008 -1.0000 vn 0.0000 0.0028 -1.0000 vn 0.9997 0.0256 0.0001 vn -0.7644 -0.0011 0.6448 vn -0.9998 0.0214 0.0000 vn -0.9996 0.0268 0.0000 vn -0.0005 1.0000 0.0021 vn -0.9997 0.0238 0.0000 vn -0.9998 0.0215 0.0000 vn -0.9997 0.0247 0.0000 vn -0.9997 0.0241 0.0011 vn -0.9996 0.0299 0.0000 vn -0.9997 0.0233 0.0052 vn 0.9997 -0.0225 0.0024 vn -0.9997 0.0256 0.0002 vn -0.9996 0.0267 -0.0000 vn -0.9997 0.0263 0.0004 vn -0.9996 0.0269 0.0000 vn 0.0268 0.9996 0.0005 vn -0.0268 -0.9996 0.0002 vn 0.0001 0.0026 -1.0000 vn -0.9996 0.0267 -0.0001 vn -0.9996 0.0269 -0.0001 vn 0.0267 0.9996 0.0000 vn 0.0267 0.9996 -0.0002 vn -0.0267 -0.9996 -0.0005 vn -0.0001 -0.0026 1.0000 vn -0.0267 -0.9996 -0.0000 vn 0.9996 -0.0267 0.0000 vn 0.9223 0.3866 0.0000 vn 0.3866 -0.9223 0.0000 vn 0.9255 -0.3788 0.0000 vn -0.3788 -0.9255 0.0000 vn -0.9223 -0.3866 0.0000 vn -0.3866 0.9223 0.0000 vn -0.9255 0.3788 0.0000 vn 0.3788 0.9255 0.0000 vn -0.9999 0.0128 0.0006 vn -0.9999 0.0128 -0.0002 vn 0.0001 -0.0017 1.0000 vn 0.9955 -0.0002 0.0948 vn -0.6228 0.0159 0.7822 vn -0.5152 0.8571 -0.0001 vn -0.5273 -0.8497 0.0003 vn -0.9999 0.0131 0.0008 vn -0.9999 0.0132 -0.0004 vn -0.9997 0.0255 -0.0006 vn 0.0112 -0.0003 -0.9999 vn -0.9997 0.0256 0.0001 vn 0.7644 -0.0011 0.6447 vn 0.0005 1.0000 0.0021 vn 0.9997 0.0239 0.0001 vn 0.9997 0.0241 0.0011 vn 0.9995 0.0302 -0.0000 vn 0.9997 0.0233 0.0052 vn -0.9997 -0.0234 0.0009 vn 0.9997 0.0263 0.0004 vn 0.9996 0.0268 -0.0001 vn 0.9996 0.0267 0.0001 vn 0.9996 0.0269 -0.0001 vn 0.9999 0.0128 -0.0002 vn 0.5152 0.8571 -0.0001 vn 0.5275 -0.8496 0.0003 vn 0.9996 0.0265 0.0005 vn 0.9999 0.0132 -0.0004 vn 0.9997 0.0256 0.0009 vn 0.9996 0.0267 0.0005 vn 0.9997 0.0255 0.0002 vn -0.7644 -0.0011 0.6447 vn -0.9997 0.0239 0.0001 vn -0.9998 0.0214 -0.0037 vn -0.9995 0.0302 -0.0000 vn -0.9997 0.0238 -0.0001 vn 0.9997 -0.0234 0.0009 vn -0.9997 0.0264 0.0004 vn -0.9996 0.0268 -0.0001 vn -0.9996 0.0267 0.0001 vn -0.9996 0.0269 0.0001 vn -0.0001 -0.0017 1.0000 vn -0.5151 0.8571 -0.0001 vn -0.5274 -0.8496 0.0003 vn -0.9996 0.0266 0.0005 vn -0.9996 0.0265 -0.0002 vn -0.9997 0.0256 0.0009 vn -0.9996 0.0267 0.0005 vn -0.9997 0.0255 0.0002 vn 0.9997 0.0234 0.0000 vn -0.9997 0.0234 0.0000 vn 0.0000 -0.3827 -0.9239 vn 0.0000 -0.9239 -0.3827 vn 0.0000 -0.9239 0.3827 vn 0.0000 -0.3827 0.9239 vn 0.0000 0.3827 0.9239 vn 0.0000 0.9239 0.3827 vn 0.0000 0.9239 -0.3827 vn 0.0000 0.3827 -0.9239 vn -0.6225 -0.2995 -0.7231 vn -0.6225 -0.7230 -0.2995 vn -0.6225 -0.7230 0.2995 vn -0.6225 -0.2995 0.7231 vn -0.6225 0.2995 0.7231 vn -0.6225 0.7231 0.2995 vn -0.6225 0.7231 -0.2995 vn -0.6225 0.2995 -0.7231 vn -0.6225 -0.7231 -0.2995 vn -0.6225 0.2995 -0.7230 vn 0.6225 -0.2995 -0.7231 vn 0.6225 -0.7231 -0.2995 vn 0.6225 -0.7231 0.2995 vn 0.6225 -0.2995 0.7231 vn 0.6225 0.2995 0.7231 vn 0.6225 0.7231 0.2995 vn 0.6225 0.7231 -0.2995 vn 0.6225 0.2995 -0.7231 vn 0.6225 -0.7230 -0.2995 vn 0.6225 0.7230 0.2995 vn 0.6225 -0.2995 -0.7230 vn 0.6225 0.2995 -0.7230 vn 0.6225 0.2995 0.7230 vn -0.6225 -0.7231 0.2995 vn -0.6225 0.7230 0.2995 vn -0.6225 -0.2995 -0.7230 vn -0.6224 0.2995 -0.7231 vn -0.6225 0.2995 0.7230 vn 0.6224 0.2995 -0.7231 vn 0.6225 -0.7230 0.2995 vn 0.0000 -0.9272 0.3746 vn 0.0000 -0.9243 -0.3816 vn 0.0000 -0.3612 -0.9325 vn 0.0000 -0.3991 0.9169 vn -0.9998 -0.0214 0.0000 vn 0.0000 -0.0011 1.0000 vn 0.9998 -0.0214 0.0000 vn 0.0002 -0.0012 1.0000 vn -0.0002 -0.0012 1.0000 vn -0.0000 -0.9185 0.3955 vn 0.0000 0.7577 0.6526 vn -0.0001 0.0000 -1.0000 vn 0.0003 0.0000 -1.0000 vn 0.0001 0.0000 -1.0000 vn 0.0000 0.7960 -0.6052 vn -0.0000 -0.0018 1.0000 vn 0.9996 0.0279 0.0009 vn 0.0000 -0.7953 -0.6063 vn -0.4662 -0.8847 0.0003 vn -0.4764 0.8792 -0.0003 vn -0.0000 0.7960 -0.6053 vn -0.9997 0.0255 -0.0005 vn 0.4664 -0.8846 0.0002 vn 0.4764 0.8792 -0.0003 vn 0.9997 0.0255 -0.0005 vn -0.4664 -0.8846 0.0002 vn -0.4767 0.8791 -0.0004 vn -0.9996 0.0279 0.0009 vn 0.4662 -0.8847 0.0003 vn 0.4767 0.8791 -0.0004 usemtl White s off f 25//1 20//1 28//1 f 83//2 90//2 86//2 f 8//3 24//3 19//3 f 19//3 638//3 633//3 f 93//4 677//4 672//4 f 79//5 19//5 81//5 f 218//6 240//6 217//6 f 338//5 642//5 952//5 f 24//7 639//7 638//7 f 313//8 320//8 314//8 f 101//9 106//9 102//9 f 17//7 28//7 24//7 f 30//10 641//10 642//10 f 343//11 29//11 30//11 f 637//12 551//12 23//12 f 246//13 68//13 74//13 f 19//5 659//5 81//5 f 673//14 95//14 94//14 f 548//13 246//13 547//13 f 253//10 848//10 849//10 f 81//15 635//15 21//15 f 80//16 25//16 17//16 f 6//15 81//15 21//15 f 8//17 80//17 17//17 f 82//18 76//18 25//18 f 7//13 76//13 69//13 f 546//18 246//18 82//18 f 83//19 6//19 84//19 f 85//20 6//20 18//20 f 85//21 80//21 86//21 f 83//22 80//22 79//22 f 86//5 89//5 85//5 f 84//23 89//23 88//23 f 84//24 87//24 83//24 f 91//25 18//25 6//25 f 92//25 23//25 18//25 f 91//25 21//25 94//25 f 672//25 23//25 93//25 f 94//25 635//25 673//25 f 94//14 97//14 91//14 f 92//4 96//4 93//4 f 91//26 98//26 92//26 f 550//27 552//27 549//27 f 99//28 80//28 18//28 f 550//29 546//29 82//29 f 102//28 80//28 101//28 f 112//28 110//28 109//28 f 100//30 106//30 104//30 f 101//31 103//31 105//31 f 100//32 103//32 99//32 f 107//33 104//33 108//33 f 112//16 105//16 103//16 f 111//16 104//16 106//16 f 109//34 106//34 105//34 f 111//10 116//10 115//10 f 116//35 124//35 122//35 f 107//36 116//36 112//36 f 111//37 114//37 108//37 f 107//38 114//38 113//38 f 120//39 118//39 119//39 f 113//36 120//36 116//36 f 115//37 118//37 114//37 f 113//38 118//38 117//38 f 121//40 124//40 123//40 f 115//41 123//41 119//41 f 120//39 123//39 124//39 f 116//42 121//42 115//42 f 128//10 708//10 709//10 f 126//11 127//11 128//11 f 707//43 125//43 126//43 f 708//24 125//24 706//24 f 128//5 707//5 126//5 f 136//44 133//44 134//44 f 140//10 135//10 136//10 f 138//11 139//11 140//11 f 134//43 137//43 138//43 f 135//24 137//24 133//24 f 140//5 134//5 138//5 f 144//44 141//44 142//44 f 148//10 143//10 144//10 f 146//11 147//11 148//11 f 142//43 145//43 146//43 f 143//24 145//24 141//24 f 148//5 142//5 146//5 f 220//45 242//45 221//45 f 219//46 235//46 214//46 f 223//47 243//47 224//47 f 215//48 236//48 218//48 f 224//49 231//49 220//49 f 227//50 230//50 223//50 f 213//51 237//51 212//51 f 214//52 239//52 215//52 f 225//53 245//53 227//53 f 222//54 244//54 226//54 f 226//55 232//55 225//55 f 216//56 238//56 213//56 f 221//57 229//57 222//57 f 212//58 241//58 219//58 f 217//59 234//59 216//59 f 846//43 248//43 249//43 f 843//24 27//24 640//24 f 843//43 249//43 67//43 f 248//44 260//44 249//44 f 249//44 27//44 67//44 f 251//11 252//11 253//11 f 255//5 858//5 844//5 f 848//24 250//24 857//24 f 253//5 847//5 251//5 f 254//43 250//43 251//43 f 254//43 847//43 856//43 f 255//43 857//43 250//43 f 859//43 257//43 256//43 f 856//24 256//24 254//24 f 254//44 257//44 255//44 f 23//60 307//60 308//60 f 314//61 315//61 309//61 f 310//62 303//62 309//62 f 312//27 304//27 306//27 f 312//27 305//27 310//27 f 313//63 304//63 311//63 f 314//60 307//60 313//60 f 314//12 303//12 308//12 f 326//64 331//64 332//64 f 313//65 323//65 319//65 f 310//66 318//66 312//66 f 311//67 318//67 323//67 f 309//68 317//68 310//68 f 322//69 315//69 321//69 f 324//70 323//70 318//70 f 324//71 317//71 322//71 f 325//72 323//72 316//72 f 325//60 320//60 319//60 f 326//60 315//60 320//60 f 324//73 329//73 330//73 f 20//11 342//11 28//11 f 339//12 352//12 344//12 f 28//5 943//5 639//5 f 333//5 944//5 943//5 f 341//11 339//11 344//11 f 344//5 351//5 343//5 f 334//5 951//5 944//5 f 337//5 952//5 951//5 f 342//11 334//11 333//11 f 344//11 338//11 337//11 f 345//11 349//11 350//11 f 347//11 351//11 352//11 f 343//74 348//74 340//74 f 342//5 349//5 341//5 f 335//43 350//43 342//43 f 341//75 346//75 336//75 f 340//24 347//24 339//24 f 336//24 345//24 335//24 f 305//76 306//76 550//76 f 572//1 577//1 580//1 f 667//2 660//2 663//2 f 576//3 560//3 571//3 f 633//3 576//3 571//3 f 677//4 670//4 672//4 f 655//5 571//5 560//5 f 833//51 811//51 810//51 f 642//5 946//5 952//5 f 639//7 576//7 638//7 f 924//77 917//77 918//77 f 687//9 682//9 683//9 f 580//7 569//7 576//7 f 641//10 582//10 642//10 f 581//44 948//44 955//44 f 1163//12 637//12 575//12 f 839//78 643//78 840//78 f 659//5 571//5 657//5 f 674//14 673//14 671//14 f 839//78 1160//78 1159//78 f 848//10 853//10 849//10 f 635//15 657//15 573//15 f 577//79 656//79 569//79 f 558//80 657//80 655//80 f 560//81 656//81 655//81 f 651//82 658//82 577//82 f 559//78 651//78 577//78 f 650//82 839//82 658//82 f 558//83 660//83 661//83 f 662//84 558//84 661//84 f 656//85 662//85 663//85 f 660//86 656//86 663//86 f 666//5 663//5 662//5 f 661//23 666//23 662//23 f 664//24 661//24 660//24 f 668//25 570//25 669//25 f 669//25 575//25 670//25 f 573//25 668//25 671//25 f 575//25 672//25 670//25 f 635//25 671//25 673//25 f 678//14 671//14 668//14 f 675//4 669//4 670//4 f 679//87 668//87 669//87 f 1162//88 1161//88 1165//88 f 680//89 656//89 682//89 f 1158//90 1161//90 1162//90 f 656//91 683//91 682//91 f 691//91 693//91 690//91 f 681//92 687//92 683//92 f 682//93 684//93 680//93 f 684//94 681//94 680//94 f 685//95 688//95 689//95 f 686//89 690//89 693//89 f 685//79 689//79 692//79 f 690//96 687//96 691//96 f 692//10 697//10 693//10 f 697//97 705//97 701//97 f 697//98 688//98 693//98 f 695//99 692//99 689//99 f 688//100 695//100 689//100 f 701//89 699//89 698//89 f 701//98 694//98 697//98 f 699//99 696//99 695//99 f 694//100 699//100 695//100 f 702//40 705//40 703//40 f 704//101 696//101 700//101 f 701//89 704//89 700//89 f 702//102 697//102 696//102 f 708//10 713//10 709//10 f 712//44 711//44 713//44 f 710//43 707//43 711//43 f 710//24 708//24 706//24 f 707//5 713//5 711//5 f 718//11 721//11 719//11 f 720//10 725//10 721//10 f 724//44 723//44 725//44 f 722//43 719//43 723//43 f 722//24 720//24 718//24 f 719//5 725//5 723//5 f 726//11 729//11 727//11 f 728//10 733//10 729//10 f 732//44 731//44 733//44 f 730//43 727//43 731//43 f 730//24 728//24 726//24 f 727//5 733//5 731//5 f 835//103 813//103 814//103 f 828//52 812//52 807//52 f 836//104 816//104 817//104 f 829//58 808//58 811//58 f 824//105 817//105 813//105 f 823//106 820//106 816//106 f 830//6 806//6 805//6 f 832//46 807//46 808//46 f 838//107 818//107 820//107 f 837//108 815//108 819//108 f 825//109 819//109 818//109 f 831//59 809//59 806//59 f 822//110 814//110 815//110 f 834//48 805//48 812//48 f 827//56 810//56 809//56 f 841//43 846//43 845//43 f 579//24 843//24 640//24 f 845//43 843//43 636//43 f 800//11 864//11 845//11 f 579//11 845//11 636//11 f 852//44 851//44 853//44 f 858//5 855//5 844//5 f 850//24 848//24 857//24 f 847//5 853//5 851//5 f 851//43 855//43 854//43 f 847//43 854//43 856//43 f 855//43 857//43 844//43 f 861//43 859//43 860//43 f 860//24 856//24 854//24 f 861//11 854//11 855//11 f 911//12 1163//12 575//12 f 919//61 918//61 913//61 f 907//111 914//111 913//111 f 916//112 908//112 915//112 f 909//88 916//88 914//88 f 908//63 917//63 915//63 f 911//113 918//113 917//113 f 918//63 907//63 913//63 f 930//114 935//114 929//114 f 917//65 927//65 915//65 f 922//115 914//115 916//115 f 915//116 922//116 916//116 f 921//117 913//117 914//117 f 919//118 926//118 925//118 f 928//119 927//119 920//119 f 921//120 928//120 926//120 f 927//72 929//72 920//72 f 929//60 924//60 930//60 f 930//72 919//72 925//72 f 928//121 933//121 926//121 f 937//44 954//44 580//44 f 964//12 947//12 956//12 f 943//5 580//5 639//5 f 944//5 937//5 943//5 f 947//44 940//44 953//44 f 963//5 956//5 955//5 f 951//5 938//5 944//5 f 952//5 945//5 951//5 f 938//44 954//44 937//44 f 946//44 956//44 945//44 f 961//44 957//44 962//44 f 963//44 959//44 964//44 f 960//74 955//74 948//74 f 961//5 954//5 953//5 f 962//43 939//43 954//43 f 958//75 953//75 940//75 f 959//24 948//24 947//24 f 957//24 940//24 939//24 f 1162//122 909//122 680//122 f 25//1 7//1 20//1 f 83//2 87//2 90//2 f 8//3 17//3 24//3 f 19//3 24//3 638//3 f 93//4 96//4 677//4 f 79//5 8//5 19//5 f 218//6 236//6 240//6 f 338//5 30//5 642//5 f 24//7 28//7 639//7 f 313//123 319//123 320//123 f 101//9 105//9 106//9 f 17//7 25//7 28//7 f 30//10 29//10 641//10 f 30//11 338//11 343//11 f 343//11 340//11 29//11 f 637//12 1164//12 551//12 f 246//13 247//13 68//13 f 19//5 633//5 659//5 f 673//14 676//14 95//14 f 548//13 247//13 246//13 f 253//10 252//10 848//10 f 81//15 659//15 635//15 f 80//16 82//16 25//16 f 6//124 79//124 81//124 f 8//17 79//17 80//17 f 82//13 75//13 76//13 f 7//13 25//13 76//13 f 75//18 82//18 246//18 f 546//18 547//18 246//18 f 246//13 74//13 75//13 f 83//125 79//125 6//125 f 85//126 84//126 6//126 f 85//127 18//127 80//127 f 83//128 86//128 80//128 f 86//5 90//5 89//5 f 84//23 85//23 89//23 f 84//24 88//24 87//24 f 91//25 92//25 18//25 f 92//25 93//25 23//25 f 91//25 6//25 21//25 f 672//25 637//25 23//25 f 94//25 21//25 635//25 f 94//14 95//14 97//14 f 92//4 98//4 96//4 f 91//129 97//129 98//129 f 99//39 101//39 80//39 f 82//16 102//16 100//16 f 550//130 549//130 546//130 f 82//29 100//29 550//29 f 102//131 82//131 80//131 f 112//39 111//39 110//39 f 100//30 102//30 106//30 f 101//31 99//31 103//31 f 100//32 104//32 103//32 f 107//132 103//132 104//132 f 103//16 107//16 112//16 f 112//39 109//39 105//39 f 106//16 110//16 111//16 f 111//16 108//16 104//16 f 109//133 110//133 106//133 f 111//10 112//10 116//10 f 116//35 120//35 124//35 f 107//36 113//36 116//36 f 111//37 115//37 114//37 f 107//38 108//38 114//38 f 120//39 117//39 118//39 f 113//36 117//36 120//36 f 115//37 119//37 118//37 f 113//38 114//38 118//38 f 121//40 122//40 124//40 f 115//41 121//41 123//41 f 120//39 119//39 123//39 f 116//42 122//42 121//42 f 128//10 127//10 708//10 f 126//11 125//11 127//11 f 707//43 706//43 125//43 f 708//24 127//24 125//24 f 128//5 709//5 707//5 f 136//44 135//44 133//44 f 140//10 139//10 135//10 f 138//11 137//11 139//11 f 134//43 133//43 137//43 f 135//24 139//24 137//24 f 140//5 136//5 134//5 f 144//44 143//44 141//44 f 148//10 147//10 143//10 f 146//11 145//11 147//11 f 142//43 141//43 145//43 f 143//24 147//24 145//24 f 148//5 144//5 142//5 f 220//45 231//45 242//45 f 219//46 241//46 235//46 f 223//47 230//47 243//47 f 215//48 239//48 236//48 f 224//49 243//49 231//49 f 227//50 245//50 230//50 f 213//51 238//51 237//51 f 214//52 235//52 239//52 f 225//53 232//53 245//53 f 222//54 229//54 244//54 f 226//55 244//55 232//55 f 216//56 234//56 238//56 f 221//57 242//57 229//57 f 212//58 237//58 241//58 f 217//59 240//59 234//59 f 846//43 842//43 248//43 f 843//24 67//24 27//24 f 843//43 846//43 249//43 f 207//44 249//44 260//44 f 248//44 22//44 260//44 f 249//44 207//44 27//44 f 251//11 250//11 252//11 f 255//5 257//5 858//5 f 848//24 252//24 250//24 f 253//5 849//5 847//5 f 254//43 255//43 250//43 f 254//43 251//43 847//43 f 255//43 844//43 857//43 f 859//43 858//43 257//43 f 856//24 859//24 256//24 f 254//44 256//44 257//44 f 303//12 18//12 308//12 f 23//12 551//12 307//12 f 545//12 304//12 307//12 f 308//12 18//12 23//12 f 551//12 545//12 307//12 f 314//61 320//61 315//61 f 310//27 305//27 303//27 f 312//134 311//134 304//134 f 312//76 306//76 305//76 f 313//12 307//12 304//12 f 314//113 308//113 307//113 f 314//63 309//63 303//63 f 326//64 325//64 331//64 f 313//65 311//65 323//65 f 310//66 317//66 318//66 f 311//135 312//135 318//135 f 309//136 315//136 317//136 f 322//137 317//137 315//137 f 324//138 316//138 323//138 f 324//139 318//139 317//139 f 325//12 319//12 323//12 f 325//60 326//60 320//60 f 326//72 321//72 315//72 f 324//73 322//73 329//73 f 333//11 28//11 342//11 f 20//11 335//11 342//11 f 339//12 347//12 352//12 f 28//5 333//5 943//5 f 333//5 334//5 944//5 f 337//11 334//11 344//11 f 341//11 336//11 339//11 f 344//11 334//11 341//11 f 344//5 352//5 351//5 f 334//5 337//5 951//5 f 337//5 338//5 952//5 f 342//11 341//11 334//11 f 344//11 343//11 338//11 f 345//11 346//11 349//11 f 347//11 348//11 351//11 f 343//74 351//74 348//74 f 342//5 350//5 349//5 f 335//43 345//43 350//43 f 341//75 349//75 346//75 f 340//24 348//24 347//24 f 336//24 346//24 345//24 f 550//140 100//140 99//140 f 99//76 18//76 305//76 f 18//27 303//27 305//27 f 552//141 550//141 306//141 f 304//76 545//76 552//76 f 99//76 305//76 550//76 f 306//141 304//141 552//141 f 572//1 559//1 577//1 f 667//2 664//2 660//2 f 576//3 569//3 560//3 f 633//3 638//3 576//3 f 677//4 675//4 670//4 f 655//5 657//5 571//5 f 833//51 829//51 811//51 f 642//5 582//5 946//5 f 639//7 580//7 576//7 f 924//142 923//142 917//142 f 687//9 686//9 682//9 f 580//7 577//7 569//7 f 641//10 581//10 582//10 f 955//44 946//44 582//44 f 582//44 581//44 955//44 f 1163//12 1164//12 637//12 f 839//78 649//78 643//78 f 659//5 633//5 571//5 f 674//14 676//14 673//14 f 839//78 840//78 1160//78 f 848//10 852//10 853//10 f 635//15 659//15 657//15 f 577//79 658//79 656//79 f 558//15 573//15 657//15 f 560//81 569//81 656//81 f 651//78 650//78 658//78 f 559//78 644//78 651//78 f 1158//82 658//82 839//82 f 650//78 649//78 839//78 f 839//82 1159//82 1158//82 f 558//143 655//143 660//143 f 662//144 570//144 558//144 f 656//145 570//145 662//145 f 660//146 655//146 656//146 f 666//5 667//5 663//5 f 661//23 665//23 666//23 f 664//24 665//24 661//24 f 668//25 558//25 570//25 f 669//25 570//25 575//25 f 573//25 558//25 668//25 f 575//25 637//25 672//25 f 635//25 573//25 671//25 f 678//14 674//14 671//14 f 675//4 679//4 669//4 f 679//147 678//147 668//147 f 680//91 570//91 656//91 f 681//79 683//79 658//79 f 658//148 1158//148 1162//148 f 1162//148 681//148 658//148 f 656//149 658//149 683//149 f 691//89 692//89 693//89 f 681//92 685//92 687//92 f 682//93 686//93 684//93 f 684//94 685//94 681//94 f 685//150 684//150 688//150 f 693//79 688//79 684//79 f 684//79 686//79 693//79 f 692//79 691//79 687//79 f 687//79 685//79 692//79 f 690//151 686//151 687//151 f 692//10 696//10 697//10 f 697//97 703//97 705//97 f 697//98 694//98 688//98 f 695//99 696//99 692//99 f 688//100 694//100 695//100 f 701//89 700//89 699//89 f 701//98 698//98 694//98 f 699//99 700//99 696//99 f 694//100 698//100 699//100 f 702//40 704//40 705//40 f 704//101 702//101 696//101 f 701//89 705//89 704//89 f 702//102 703//102 697//102 f 708//10 712//10 713//10 f 712//44 710//44 711//44 f 710//43 706//43 707//43 f 710//24 712//24 708//24 f 707//5 709//5 713//5 f 718//11 720//11 721//11 f 720//10 724//10 725//10 f 724//44 722//44 723//44 f 722//43 718//43 719//43 f 722//24 724//24 720//24 f 719//5 721//5 725//5 f 726//11 728//11 729//11 f 728//10 732//10 733//10 f 732//44 730//44 731//44 f 730//43 726//43 727//43 f 730//24 732//24 728//24 f 727//5 729//5 733//5 f 835//103 824//103 813//103 f 828//52 834//52 812//52 f 836//104 823//104 816//104 f 829//58 832//58 808//58 f 824//105 836//105 817//105 f 823//106 838//106 820//106 f 830//6 831//6 806//6 f 832//46 828//46 807//46 f 838//107 825//107 818//107 f 837//108 822//108 815//108 f 825//109 837//109 819//109 f 831//59 827//59 809//59 f 822//110 835//110 814//110 f 834//48 830//48 805//48 f 827//56 833//56 810//56 f 841//43 842//43 846//43 f 579//24 636//24 843//24 f 845//43 846//43 843//43 f 841//11 845//11 864//11 f 864//11 574//11 841//11 f 579//11 800//11 845//11 f 852//44 850//44 851//44 f 858//5 861//5 855//5 f 850//24 852//24 848//24 f 847//5 849//5 853//5 f 851//43 850//43 855//43 f 847//43 851//43 854//43 f 855//43 850//43 857//43 f 861//43 858//43 859//43 f 860//24 859//24 856//24 f 861//11 860//11 854//11 f 575//12 570//12 912//12 f 570//12 907//12 912//12 f 1157//12 1163//12 911//12 f 911//12 908//12 1157//12 f 575//60 912//60 911//60 f 919//61 924//61 918//61 f 907//88 909//88 914//88 f 916//88 910//88 908//88 f 909//122 910//122 916//122 f 908//12 911//12 917//12 f 911//152 912//152 918//152 f 918//12 912//12 907//12 f 930//114 936//114 935//114 f 917//65 923//65 927//65 f 922//115 921//115 914//115 f 915//153 927//153 922//153 f 921//154 919//154 913//154 f 919//155 921//155 926//155 f 928//156 922//156 927//156 f 921//157 922//157 928//157 f 927//12 923//12 929//12 f 929//60 923//60 924//60 f 930//60 924//60 919//60 f 928//121 934//121 933//121 f 572//44 580//44 954//44 f 954//44 939//44 572//44 f 964//12 959//12 947//12 f 943//5 937//5 580//5 f 944//5 938//5 937//5 f 953//44 938//44 956//44 f 956//44 947//44 953//44 f 938//44 945//44 956//44 f 963//5 964//5 956//5 f 951//5 945//5 938//5 f 952//5 946//5 945//5 f 938//44 953//44 954//44 f 946//44 955//44 956//44 f 961//44 958//44 957//44 f 963//44 960//44 959//44 f 960//74 963//74 955//74 f 961//5 962//5 954//5 f 962//43 957//43 939//43 f 958//75 961//75 953//75 f 959//24 960//24 948//24 f 957//24 958//24 940//24 f 680//158 681//158 1162//158 f 1162//159 1165//159 910//159 f 1157//122 908//122 1165//122 f 909//88 907//88 570//88 f 1165//159 908//159 910//159 f 909//122 570//122 680//122 f 1162//122 910//122 909//122 usemtl Window f 88//160 90//160 87//160 f 97//25 96//25 98//25 f 676//25 96//25 95//25 f 667//161 665//161 664//161 f 678//25 675//25 674//25 f 675//25 676//25 674//25 f 88//160 89//160 90//160 f 97//25 95//25 96//25 f 676//25 677//25 96//25 f 667//161 666//161 665//161 f 678//25 679//25 675//25 f 675//25 677//25 676//25 usemtl Wheels f 55//162 54//162 47//162 f 62//163 53//163 54//163 f 61//164 52//164 53//164 f 52//165 59//165 51//165 f 59//166 50//166 51//166 f 58//167 49//167 50//167 f 57//168 48//168 49//168 f 56//169 47//169 48//169 f 354//11 368//11 360//11 f 53//44 51//44 49//44 f 353//11 55//11 56//11 f 353//11 57//11 355//11 f 356//11 57//11 58//11 f 356//11 59//11 357//11 f 358//11 59//11 60//11 f 358//11 61//11 359//11 f 360//11 61//11 62//11 f 360//11 55//11 354//11 f 360//11 367//11 359//11 f 359//11 366//11 358//11 f 357//11 366//11 365//11 f 357//11 364//11 356//11 f 355//11 364//11 363//11 f 355//11 361//11 353//11 f 353//11 362//11 354//11 f 528//11 519//11 527//11 f 523//11 514//11 515//11 f 523//11 530//11 522//11 f 525//11 532//11 524//11 f 525//11 534//11 533//11 f 528//11 534//11 526//11 f 528//11 536//11 535//11 f 538//44 540//44 542//44 f 521//11 536//11 527//11 f 524//11 517//11 525//11 f 528//11 518//11 520//11 f 523//11 532//11 531//11 f 521//11 514//11 522//11 f 521//11 530//11 529//11 f 524//11 515//11 516//11 f 525//11 518//11 526//11 f 534//168 543//168 542//168 f 536//162 537//162 544//162 f 529//163 538//163 537//163 f 530//164 539//164 538//164 f 539//165 532//165 540//165 f 532//166 541//166 540//166 f 533//167 542//167 541//167 f 535//169 544//169 543//169 f 527//11 513//11 521//11 f 606//162 607//162 599//162 f 605//163 614//163 606//163 f 604//164 613//164 605//164 f 604//165 611//165 612//165 f 602//166 611//166 603//166 f 601//167 610//167 602//167 f 600//168 609//168 601//168 f 599//169 608//169 600//169 f 980//44 966//44 972//44 f 603//11 605//11 599//11 f 965//44 607//44 966//44 f 609//44 965//44 967//44 f 968//44 609//44 967//44 f 611//44 968//44 969//44 f 970//44 611//44 969//44 f 613//44 970//44 971//44 f 972//44 613//44 971//44 f 607//44 972//44 966//44 f 979//44 972//44 971//44 f 978//44 971//44 970//44 f 969//44 978//44 970//44 f 976//44 969//44 968//44 f 967//44 976//44 968//44 f 973//44 967//44 965//44 f 966//44 973//44 965//44 f 1139//44 1132//44 1140//44 f 1127//44 1134//44 1135//44 f 1142//44 1135//44 1134//44 f 1144//44 1137//44 1136//44 f 1137//44 1146//44 1138//44 f 1146//44 1140//44 1138//44 f 1140//44 1148//44 1139//44 f 1152//11 1150//11 1156//11 f 1148//44 1133//44 1139//44 f 1129//44 1136//44 1137//44 f 1140//44 1130//44 1138//44 f 1135//44 1144//44 1136//44 f 1134//44 1125//44 1133//44 f 1133//44 1142//44 1134//44 f 1136//44 1127//44 1135//44 f 1130//44 1137//44 1138//44 f 1155//168 1146//168 1154//168 f 1149//162 1148//162 1156//162 f 1150//163 1141//163 1149//163 f 1151//164 1142//164 1150//164 f 1151//165 1144//165 1143//165 f 1153//166 1144//166 1152//166 f 1154//167 1145//167 1153//167 f 1156//169 1147//169 1155//169 f 1125//44 1139//44 1133//44 f 55//162 62//162 54//162 f 62//163 61//163 53//163 f 61//164 60//164 52//164 f 52//165 60//165 59//165 f 59//166 58//166 50//166 f 58//167 57//167 49//167 f 57//168 56//168 48//168 f 56//169 55//169 47//169 f 354//11 362//11 368//11 f 49//44 48//44 47//44 f 47//44 54//44 53//44 f 53//44 52//44 51//44 f 51//44 50//44 49//44 f 49//44 47//44 53//44 f 353//11 354//11 55//11 f 353//11 56//11 57//11 f 356//11 355//11 57//11 f 356//11 58//11 59//11 f 358//11 357//11 59//11 f 358//11 60//11 61//11 f 360//11 359//11 61//11 f 360//11 62//11 55//11 f 360//11 368//11 367//11 f 359//11 367//11 366//11 f 357//11 358//11 366//11 f 357//11 365//11 364//11 f 355//11 356//11 364//11 f 355//11 363//11 361//11 f 353//11 361//11 362//11 f 528//11 520//11 519//11 f 523//11 522//11 514//11 f 523//11 531//11 530//11 f 525//11 533//11 532//11 f 525//11 526//11 534//11 f 528//11 535//11 534//11 f 528//11 527//11 536//11 f 542//44 543//44 544//44 f 544//44 537//44 538//44 f 538//44 539//44 540//44 f 540//44 541//44 542//44 f 542//44 544//44 538//44 f 521//11 529//11 536//11 f 524//11 516//11 517//11 f 528//11 526//11 518//11 f 523//11 524//11 532//11 f 521//11 513//11 514//11 f 521//11 522//11 530//11 f 524//11 523//11 515//11 f 525//11 517//11 518//11 f 534//168 535//168 543//168 f 536//162 529//162 537//162 f 529//163 530//163 538//163 f 530//164 531//164 539//164 f 539//165 531//165 532//165 f 532//166 533//166 541//166 f 533//167 534//167 542//167 f 535//169 536//169 544//169 f 527//11 519//11 513//11 f 606//162 614//162 607//162 f 605//163 613//163 614//163 f 604//164 612//164 613//164 f 604//165 603//165 611//165 f 602//166 610//166 611//166 f 601//167 609//167 610//167 f 600//168 608//168 609//168 f 599//169 607//169 608//169 f 980//44 974//44 966//44 f 599//11 600//11 601//11 f 601//11 602//11 603//11 f 603//11 604//11 605//11 f 605//11 606//11 599//11 f 599//11 601//11 603//11 f 965//44 608//44 607//44 f 609//44 608//44 965//44 f 968//44 610//44 609//44 f 611//44 610//44 968//44 f 970//44 612//44 611//44 f 613//44 612//44 970//44 f 972//44 614//44 613//44 f 607//44 614//44 972//44 f 979//44 980//44 972//44 f 978//44 979//44 971//44 f 969//44 977//44 978//44 f 976//44 977//44 969//44 f 967//44 975//44 976//44 f 973//44 975//44 967//44 f 966//44 974//44 973//44 f 1139//44 1131//44 1132//44 f 1127//44 1126//44 1134//44 f 1142//44 1143//44 1135//44 f 1144//44 1145//44 1137//44 f 1137//44 1145//44 1146//44 f 1146//44 1147//44 1140//44 f 1140//44 1147//44 1148//44 f 1156//11 1155//11 1154//11 f 1154//11 1153//11 1152//11 f 1152//11 1151//11 1150//11 f 1150//11 1149//11 1156//11 f 1156//11 1154//11 1152//11 f 1148//44 1141//44 1133//44 f 1129//44 1128//44 1136//44 f 1140//44 1132//44 1130//44 f 1135//44 1143//44 1144//44 f 1134//44 1126//44 1125//44 f 1133//44 1141//44 1142//44 f 1136//44 1128//44 1127//44 f 1130//44 1129//44 1137//44 f 1155//168 1147//168 1146//168 f 1149//162 1141//162 1148//162 f 1150//163 1142//163 1141//163 f 1151//164 1143//164 1142//164 f 1151//165 1152//165 1144//165 f 1153//166 1145//166 1144//166 f 1154//167 1146//167 1145//167 f 1156//169 1148//169 1147//169 f 1125//44 1131//44 1139//44 usemtl Wheel_Rim f 489//162 465//162 490//162 f 488//5 466//5 489//5 f 498//11 39//11 40//11 f 499//11 42//11 500//11 f 502//11 43//11 44//11 f 503//11 46//11 45//11 f 39//167 32//167 40//167 f 42//169 33//169 34//169 f 44//164 38//164 46//164 f 45//165 38//165 37//165 f 368//170 370//170 376//170 f 396//43 420//43 395//43 f 368//171 375//171 367//171 f 367//172 374//172 366//172 f 365//173 374//173 373//173 f 364//174 373//174 372//174 f 364//175 371//175 363//175 f 361//176 371//176 369//176 f 361//177 370//177 362//177 f 378//11 440//11 384//11 f 401//169 425//169 400//169 f 405//162 431//162 430//162 f 408//10 432//10 407//10 f 374//11 386//11 385//11 f 383//11 386//11 375//11 f 382//11 387//11 383//11 f 382//11 389//11 388//11 f 381//11 390//11 389//11 f 374//11 390//11 373//11 f 372//11 392//11 391//11 f 381//11 392//11 373//11 f 380//11 393//11 381//11 f 380//11 395//11 394//11 f 379//11 396//11 395//11 f 372//11 396//11 371//11 f 369//11 398//11 397//11 f 379//11 398//11 371//11 f 377//11 399//11 379//11 f 377//11 401//11 400//11 f 378//11 402//11 401//11 f 369//11 402//11 370//11 f 376//11 404//11 403//11 f 378//11 404//11 370//11 f 384//11 405//11 378//11 f 384//11 407//11 406//11 f 383//11 408//11 407//11 f 376//11 408//11 375//11 f 409//11 413//11 410//11 f 415//11 419//11 416//11 f 421//11 425//11 422//11 f 427//11 431//11 428//11 f 403//167 429//167 408//167 f 389//165 413//165 388//165 f 394//166 418//166 393//166 f 399//10 421//10 398//10 f 386//43 412//43 409//43 f 391//163 417//163 396//163 f 398//164 422//164 397//164 f 386//168 410//168 385//168 f 407//163 431//163 406//163 f 402//5 426//5 401//5 f 405//24 427//24 404//24 f 390//24 414//24 389//24 f 395//167 419//167 394//167 f 400//168 424//168 399//168 f 404//166 428//166 403//166 f 388//164 412//164 387//164 f 393//5 415//5 392//5 f 397//165 423//165 402//165 f 390//169 410//169 411//169 f 392//162 416//162 391//162 f 434//166 448//166 440//166 f 383//11 440//11 439//11 f 383//11 438//11 382//11 f 382//11 437//11 381//11 f 381//11 436//11 380//11 f 379//11 436//11 435//11 f 379//11 433//11 377//11 f 378//11 433//11 434//11 f 445//11 447//11 443//11 f 440//167 447//167 439//167 f 439//168 446//168 438//168 f 437//169 446//169 445//169 f 437//162 444//162 436//162 f 436//163 443//163 435//163 f 433//164 443//164 441//164 f 434//165 441//165 442//165 f 45//166 31//166 39//166 f 498//11 41//11 499//11 f 500//11 43//11 501//11 f 502//11 46//11 504//11 f 34//11 32//11 37//11 f 40//168 33//168 41//168 f 42//162 35//162 43//162 f 43//163 36//163 44//163 f 474//163 450//163 475//163 f 491//24 467//24 492//24 f 486//167 462//167 487//167 f 481//168 457//168 482//168 f 477//166 453//166 478//166 f 493//164 469//164 494//164 f 484//165 458//165 479//165 f 496//169 470//169 491//169 f 482//10 460//10 483//10 f 495//43 469//43 472//43 f 490//163 464//163 485//163 f 483//164 459//164 484//164 f 495//168 471//168 496//168 f 479//5 455//5 480//5 f 476//24 454//24 477//24 f 501//11 486//11 487//11 f 505//11 477//11 478//11 f 504//11 480//11 481//11 f 498//11 495//11 506//11 f 499//11 492//11 493//11 f 503//11 477//11 511//11 f 497//11 474//11 475//11 f 498//11 473//11 474//11 f 497//11 476//11 503//11 f 507//11 491//11 508//11 f 500//11 489//11 508//11 f 505//11 473//11 506//11 f 466//11 462//11 465//11 f 492//165 468//165 493//165 f 472//11 468//11 471//11 f 509//11 485//11 510//11 f 502//11 483//11 510//11 f 460//11 456//11 459//11 f 487//166 463//166 488//166 f 478//167 452//167 473//167 f 454//11 450//11 453//11 f 502//11 485//11 486//11 f 473//10 449//10 474//10 f 503//11 479//11 480//11 f 512//11 479//11 511//11 f 518//176 512//176 520//176 f 514//178 505//178 506//178 f 503//11 39//11 497//11 f 516//173 507//173 508//173 f 476//162 450//162 451//162 f 517//175 510//175 518//175 f 485//43 461//43 486//43 f 513//170 511//170 505//170 f 520//179 511//179 519//179 f 515//172 506//172 507//172 f 480//169 456//169 481//169 f 517//174 508//174 509//174 f 507//11 495//11 496//11 f 499//11 494//11 498//11 f 500//11 491//11 492//11 f 509//11 489//11 490//11 f 501//11 488//11 500//11 f 512//11 483//11 484//11 f 504//11 482//11 502//11 f 1077//162 1101//162 1102//162 f 1078//5 1100//5 1101//5 f 1110//44 591//44 1109//44 f 594//44 1111//44 1112//44 f 1114//44 595//44 1113//44 f 1115//44 598//44 1116//44 f 584//167 591//167 592//167 f 594//169 585//169 593//169 f 590//164 596//164 598//164 f 597//165 590//165 598//165 f 980//180 982//180 974//180 f 1032//43 1008//43 1007//43 f 979//181 988//181 980//181 f 978//182 987//182 979//182 f 977//183 986//183 978//183 f 984//184 977//184 976//184 f 983//185 976//185 975//185 f 973//186 983//186 975//186 f 982//187 973//187 974//187 f 1052//44 990//44 996//44 f 1037//169 1013//169 1012//169 f 1017//162 1043//162 1018//162 f 1044//10 1020//10 1019//10 f 986//44 998//44 987//44 f 998//44 995//44 987//44 f 999//44 994//44 995//44 f 994//44 1001//44 993//44 f 993//44 1002//44 985//44 f 1002//44 986//44 985//44 f 984//44 1004//44 985//44 f 1004//44 993//44 985//44 f 1005//44 992//44 993//44 f 992//44 1007//44 991//44 f 991//44 1008//44 983//44 f 1008//44 984//44 983//44 f 981//44 1010//44 983//44 f 1010//44 991//44 983//44 f 1011//44 989//44 991//44 f 989//44 1013//44 990//44 f 990//44 1014//44 982//44 f 1014//44 981//44 982//44 f 988//44 1016//44 982//44 f 1016//44 990//44 982//44 f 1017//44 996//44 990//44 f 996//44 1019//44 995//44 f 995//44 1020//44 987//44 f 1020//44 988//44 987//44 f 1023//44 1025//44 1022//44 f 1029//44 1031//44 1028//44 f 1035//44 1037//44 1034//44 f 1041//44 1043//44 1040//44 f 1041//167 1015//167 1020//167 f 1025//165 1001//165 1000//165 f 1030//166 1006//166 1005//166 f 1033//10 1011//10 1010//10 f 998//43 1024//43 999//43 f 1029//163 1003//163 1008//163 f 1034//164 1010//164 1009//164 f 1022//168 998//168 997//168 f 1043//163 1019//163 1018//163 f 1038//5 1014//5 1013//5 f 1039//24 1017//24 1016//24 f 1026//24 1002//24 1001//24 f 1031//167 1007//167 1006//167 f 1036//168 1012//168 1011//168 f 1040//166 1016//166 1015//166 f 1024//164 1000//164 999//164 f 1027//5 1005//5 1004//5 f 1035//165 1009//165 1014//165 f 1023//169 997//169 1002//169 f 1028//162 1004//162 1003//162 f 1060//166 1046//166 1052//166 f 995//44 1052//44 996//44 f 1050//44 995//44 994//44 f 1049//44 994//44 993//44 f 1048//44 993//44 992//44 f 991//44 1048//44 992//44 f 1045//44 991//44 989//44 f 990//44 1045//44 989//44 f 1059//44 1057//44 1055//44 f 1059//167 1052//167 1051//167 f 1058//168 1051//168 1050//168 f 1049//169 1058//169 1050//169 f 1056//162 1049//162 1048//162 f 1055//163 1048//163 1047//163 f 1053//164 1047//164 1045//164 f 1046//165 1053//165 1045//165 f 583//166 597//166 591//166 f 593//44 1110//44 1111//44 f 595//44 1112//44 1113//44 f 598//44 1114//44 1116//44 f 584//44 586//44 589//44 f 585//168 592//168 593//168 f 587//162 594//162 595//162 f 588//163 595//163 596//163 f 1062//163 1086//163 1087//163 f 1079//24 1103//24 1104//24 f 1074//167 1098//167 1099//167 f 1069//168 1093//168 1094//168 f 1065//166 1089//166 1090//166 f 1081//164 1105//164 1106//164 f 1070//165 1096//165 1091//165 f 1103//169 1083//169 1108//169 f 1072//10 1094//10 1095//10 f 1107//43 1081//43 1106//43 f 1076//163 1102//163 1097//163 f 1071//164 1095//164 1096//164 f 1083//168 1107//168 1108//168 f 1067//5 1091//5 1092//5 f 1066//24 1088//24 1089//24 f 1113//44 1098//44 1114//44 f 1117//44 1089//44 1123//44 f 1116//44 1092//44 1115//44 f 1107//44 1110//44 1118//44 f 1111//44 1104//44 1112//44 f 1089//44 1115//44 1123//44 f 1109//44 1086//44 1110//44 f 1110//44 1085//44 1118//44 f 1088//44 1109//44 1115//44 f 1103//44 1119//44 1120//44 f 1101//44 1112//44 1120//44 f 1085//44 1117//44 1118//44 f 1076//44 1074//44 1077//44 f 1080//165 1104//165 1105//165 f 1082//44 1080//44 1083//44 f 1097//44 1121//44 1122//44 f 1095//44 1114//44 1122//44 f 1070//44 1068//44 1071//44 f 1075//166 1099//166 1100//166 f 1064//167 1090//167 1085//167 f 1064//44 1062//44 1065//44 f 1114//44 1097//44 1122//44 f 1061//10 1085//10 1086//10 f 1115//44 1091//44 1123//44 f 1091//44 1124//44 1123//44 f 1124//186 1130//186 1132//186 f 1126//188 1117//188 1125//188 f 591//44 1115//44 1109//44 f 1128//183 1119//183 1127//183 f 1088//162 1062//162 1087//162 f 1130//189 1121//189 1129//189 f 1073//43 1097//43 1098//43 f 1125//190 1123//190 1131//190 f 1123//191 1132//191 1131//191 f 1127//182 1118//182 1126//182 f 1068//169 1092//169 1093//169 f 1129//192 1120//192 1128//192 f 1119//44 1107//44 1118//44 f 1106//44 1111//44 1110//44 f 1112//44 1103//44 1120//44 f 1121//44 1101//44 1120//44 f 1100//44 1113//44 1112//44 f 1124//44 1095//44 1122//44 f 1094//44 1116//44 1114//44 f 489//162 466//162 465//162 f 488//5 463//5 466//5 f 498//11 497//11 39//11 f 499//11 41//11 42//11 f 502//11 501//11 43//11 f 503//11 504//11 46//11 f 39//167 31//167 32//167 f 42//169 41//169 33//169 f 44//164 36//164 38//164 f 45//165 46//165 38//165 f 368//170 362//170 370//170 f 396//43 417//43 420//43 f 368//178 376//178 375//178 f 367//193 375//193 374//193 f 365//173 366//173 374//173 f 364//174 365//174 373//174 f 364//175 372//175 371//175 f 361//176 363//176 371//176 f 361//177 369//177 370//177 f 378//11 434//11 440//11 f 401//169 426//169 425//169 f 405//162 406//162 431//162 f 408//10 429//10 432//10 f 374//11 375//11 386//11 f 383//11 387//11 386//11 f 382//11 388//11 387//11 f 382//11 381//11 389//11 f 381//11 373//11 390//11 f 374//11 385//11 390//11 f 372//11 373//11 392//11 f 381//11 393//11 392//11 f 380//11 394//11 393//11 f 380//11 379//11 395//11 f 379//11 371//11 396//11 f 372//11 391//11 396//11 f 369//11 371//11 398//11 f 379//11 399//11 398//11 f 377//11 400//11 399//11 f 377//11 378//11 401//11 f 378//11 370//11 402//11 f 369//11 397//11 402//11 f 376//11 370//11 404//11 f 378//11 405//11 404//11 f 384//11 406//11 405//11 f 384//11 383//11 407//11 f 383//11 375//11 408//11 f 376//11 403//11 408//11 f 411//11 410//11 413//11 f 409//11 412//11 413//11 f 413//11 414//11 411//11 f 417//11 416//11 419//11 f 415//11 418//11 419//11 f 419//11 420//11 417//11 f 423//11 422//11 425//11 f 421//11 424//11 425//11 f 425//11 426//11 423//11 f 429//11 428//11 431//11 f 427//11 430//11 431//11 f 431//11 432//11 429//11 f 403//167 428//167 429//167 f 389//165 414//165 413//165 f 394//166 419//166 418//166 f 399//10 424//10 421//10 f 386//43 387//43 412//43 f 391//163 416//163 417//163 f 398//164 421//164 422//164 f 386//168 409//168 410//168 f 407//163 432//163 431//163 f 402//5 423//5 426//5 f 405//24 430//24 427//24 f 390//24 411//24 414//24 f 395//167 420//167 419//167 f 400//168 425//168 424//168 f 404//166 427//166 428//166 f 388//164 413//164 412//164 f 393//5 418//5 415//5 f 397//165 422//165 423//165 f 390//169 385//169 410//169 f 392//162 415//162 416//162 f 434//166 442//166 448//166 f 383//11 384//11 440//11 f 383//11 439//11 438//11 f 382//11 438//11 437//11 f 381//11 437//11 436//11 f 379//11 380//11 436//11 f 379//11 435//11 433//11 f 378//11 377//11 433//11 f 442//11 441//11 443//11 f 443//11 444//11 445//11 f 445//11 446//11 447//11 f 447//11 448//11 442//11 f 442//11 443//11 447//11 f 440//167 448//167 447//167 f 439//168 447//168 446//168 f 437//169 438//169 446//169 f 437//162 445//162 444//162 f 436//163 444//163 443//163 f 433//164 435//164 443//164 f 434//165 433//165 441//165 f 45//166 37//166 31//166 f 498//11 40//11 41//11 f 500//11 42//11 43//11 f 502//11 44//11 46//11 f 37//11 38//11 36//11 f 36//11 35//11 34//11 f 34//11 33//11 32//11 f 32//11 31//11 37//11 f 37//11 36//11 34//11 f 40//168 32//168 33//168 f 42//162 34//162 35//162 f 43//163 35//163 36//163 f 474//163 449//163 450//163 f 491//24 470//24 467//24 f 486//167 461//167 462//167 f 481//168 456//168 457//168 f 477//166 454//166 453//166 f 493//164 468//164 469//164 f 484//165 459//165 458//165 f 496//169 471//169 470//169 f 482//10 457//10 460//10 f 495//43 494//43 469//43 f 490//163 465//163 464//163 f 483//164 460//164 459//164 f 495//168 472//168 471//168 f 479//5 458//5 455//5 f 476//24 451//24 454//24 f 501//11 502//11 486//11 f 505//11 511//11 477//11 f 504//11 503//11 480//11 f 498//11 494//11 495//11 f 499//11 500//11 492//11 f 503//11 476//11 477//11 f 497//11 498//11 474//11 f 498//11 506//11 473//11 f 497//11 475//11 476//11 f 507//11 496//11 491//11 f 500//11 488//11 489//11 f 505//11 478//11 473//11 f 464//11 465//11 462//11 f 466//11 463//11 462//11 f 462//11 461//11 464//11 f 492//165 467//165 468//165 f 470//11 471//11 468//11 f 472//11 469//11 468//11 f 468//11 467//11 470//11 f 509//11 490//11 485//11 f 502//11 482//11 483//11 f 458//11 459//11 456//11 f 460//11 457//11 456//11 f 456//11 455//11 458//11 f 487//166 462//166 463//166 f 478//167 453//167 452//167 f 452//11 453//11 450//11 f 454//11 451//11 450//11 f 450//11 449//11 452//11 f 502//11 510//11 485//11 f 473//10 452//10 449//10 f 503//11 511//11 479//11 f 512//11 484//11 479//11 f 518//176 510//176 512//176 f 514//171 513//171 505//171 f 503//11 45//11 39//11 f 516//173 515//173 507//173 f 476//162 475//162 450//162 f 517//194 509//194 510//194 f 485//43 464//43 461//43 f 513//195 519//195 511//195 f 520//196 512//196 511//196 f 515//193 514//193 506//193 f 480//169 455//169 456//169 f 517//197 516//197 508//197 f 507//11 506//11 495//11 f 499//11 493//11 494//11 f 500//11 508//11 491//11 f 509//11 508//11 489//11 f 501//11 487//11 488//11 f 512//11 510//11 483//11 f 504//11 481//11 482//11 f 1077//162 1078//162 1101//162 f 1078//5 1075//5 1100//5 f 1110//44 592//44 591//44 f 594//44 593//44 1111//44 f 1114//44 596//44 595//44 f 1115//44 597//44 598//44 f 584//167 583//167 591//167 f 594//169 586//169 585//169 f 590//164 588//164 596//164 f 597//165 589//165 590//165 f 980//180 988//180 982//180 f 1032//43 1029//43 1008//43 f 979//181 987//181 988//181 f 978//182 986//182 987//182 f 977//183 985//183 986//183 f 984//184 985//184 977//184 f 983//185 984//185 976//185 f 973//186 981//186 983//186 f 982//187 981//187 973//187 f 1052//44 1046//44 990//44 f 1037//169 1038//169 1013//169 f 1017//162 1042//162 1043//162 f 1044//10 1041//10 1020//10 f 986//44 997//44 998//44 f 998//44 999//44 995//44 f 999//44 1000//44 994//44 f 994//44 1000//44 1001//44 f 993//44 1001//44 1002//44 f 1002//44 997//44 986//44 f 984//44 1003//44 1004//44 f 1004//44 1005//44 993//44 f 1005//44 1006//44 992//44 f 992//44 1006//44 1007//44 f 991//44 1007//44 1008//44 f 1008//44 1003//44 984//44 f 981//44 1009//44 1010//44 f 1010//44 1011//44 991//44 f 1011//44 1012//44 989//44 f 989//44 1012//44 1013//44 f 990//44 1013//44 1014//44 f 1014//44 1009//44 981//44 f 988//44 1015//44 1016//44 f 1016//44 1017//44 990//44 f 1017//44 1018//44 996//44 f 996//44 1018//44 1019//44 f 995//44 1019//44 1020//44 f 1020//44 1015//44 988//44 f 1021//44 1022//44 1025//44 f 1023//44 1026//44 1025//44 f 1025//44 1024//44 1021//44 f 1027//44 1028//44 1031//44 f 1029//44 1032//44 1031//44 f 1031//44 1030//44 1027//44 f 1033//44 1034//44 1037//44 f 1035//44 1038//44 1037//44 f 1037//44 1036//44 1033//44 f 1039//44 1040//44 1043//44 f 1041//44 1044//44 1043//44 f 1043//44 1042//44 1039//44 f 1041//167 1040//167 1015//167 f 1025//165 1026//165 1001//165 f 1030//166 1031//166 1006//166 f 1033//10 1036//10 1011//10 f 998//43 1021//43 1024//43 f 1029//163 1028//163 1003//163 f 1034//164 1033//164 1010//164 f 1022//168 1021//168 998//168 f 1043//163 1044//163 1019//163 f 1038//5 1035//5 1014//5 f 1039//24 1042//24 1017//24 f 1026//24 1023//24 1002//24 f 1031//167 1032//167 1007//167 f 1036//168 1037//168 1012//168 f 1040//166 1039//166 1016//166 f 1024//164 1025//164 1000//164 f 1027//5 1030//5 1005//5 f 1035//165 1034//165 1009//165 f 1023//169 1022//169 997//169 f 1028//162 1027//162 1004//162 f 1060//166 1054//166 1046//166 f 995//44 1051//44 1052//44 f 1050//44 1051//44 995//44 f 1049//44 1050//44 994//44 f 1048//44 1049//44 993//44 f 991//44 1047//44 1048//44 f 1045//44 1047//44 991//44 f 990//44 1046//44 1045//44 f 1055//44 1053//44 1054//44 f 1054//44 1060//44 1059//44 f 1059//44 1058//44 1057//44 f 1057//44 1056//44 1055//44 f 1055//44 1054//44 1059//44 f 1059//167 1060//167 1052//167 f 1058//168 1059//168 1051//168 f 1049//169 1057//169 1058//169 f 1056//162 1057//162 1049//162 f 1055//163 1056//163 1048//163 f 1053//164 1055//164 1047//164 f 1046//165 1054//165 1053//165 f 583//166 589//166 597//166 f 593//44 592//44 1110//44 f 595//44 594//44 1112//44 f 598//44 596//44 1114//44 f 588//44 590//44 589//44 f 589//44 583//44 584//44 f 584//44 585//44 586//44 f 586//44 587//44 588//44 f 588//44 589//44 586//44 f 585//168 584//168 592//168 f 587//162 586//162 594//162 f 588//163 587//163 595//163 f 1062//163 1061//163 1086//163 f 1079//24 1082//24 1103//24 f 1074//167 1073//167 1098//167 f 1069//168 1068//168 1093//168 f 1065//166 1066//166 1089//166 f 1081//164 1080//164 1105//164 f 1070//165 1071//165 1096//165 f 1103//169 1082//169 1083//169 f 1072//10 1069//10 1094//10 f 1107//43 1084//43 1081//43 f 1076//163 1077//163 1102//163 f 1071//164 1072//164 1095//164 f 1083//168 1084//168 1107//168 f 1067//5 1070//5 1091//5 f 1066//24 1063//24 1088//24 f 1113//44 1099//44 1098//44 f 1117//44 1090//44 1089//44 f 1116//44 1093//44 1092//44 f 1107//44 1106//44 1110//44 f 1111//44 1105//44 1104//44 f 1089//44 1088//44 1115//44 f 1109//44 1087//44 1086//44 f 1110//44 1086//44 1085//44 f 1088//44 1087//44 1109//44 f 1103//44 1108//44 1119//44 f 1101//44 1100//44 1112//44 f 1085//44 1090//44 1117//44 f 1078//44 1077//44 1074//44 f 1076//44 1073//44 1074//44 f 1074//44 1075//44 1078//44 f 1080//165 1079//165 1104//165 f 1084//44 1083//44 1080//44 f 1082//44 1079//44 1080//44 f 1080//44 1081//44 1084//44 f 1097//44 1102//44 1121//44 f 1095//44 1094//44 1114//44 f 1072//44 1071//44 1068//44 f 1070//44 1067//44 1068//44 f 1068//44 1069//44 1072//44 f 1075//166 1074//166 1099//166 f 1064//167 1065//167 1090//167 f 1066//44 1065//44 1062//44 f 1064//44 1061//44 1062//44 f 1062//44 1063//44 1066//44 f 1114//44 1098//44 1097//44 f 1061//10 1064//10 1085//10 f 1115//44 1092//44 1091//44 f 1091//44 1096//44 1124//44 f 1124//186 1122//186 1130//186 f 1126//181 1118//181 1117//181 f 591//44 597//44 1115//44 f 1128//183 1120//183 1119//183 f 1088//162 1063//162 1062//162 f 1130//185 1122//185 1121//185 f 1073//43 1076//43 1097//43 f 1125//180 1117//180 1123//180 f 1123//198 1124//198 1132//198 f 1127//199 1119//199 1118//199 f 1068//169 1067//169 1092//169 f 1129//184 1121//184 1120//184 f 1119//44 1108//44 1107//44 f 1106//44 1105//44 1111//44 f 1112//44 1104//44 1103//44 f 1121//44 1102//44 1101//44 f 1100//44 1099//44 1113//44 f 1124//44 1096//44 1095//44 f 1094//44 1093//44 1116//44 usemtl Black f 78//11 71//11 73//11 f 950//24 29//24 340//24 f 247//24 548//24 204//24 f 77//200 75//200 70//200 f 71//201 75//201 74//201 f 74//202 73//202 71//202 f 20//24 69//24 72//24 f 72//203 76//203 77//203 f 634//24 72//24 654//24 f 78//11 77//11 70//11 f 207//43 260//43 258//43 f 215//43 209//43 214//43 f 216//43 266//43 217//43 f 217//43 259//43 211//43 f 212//43 27//43 207//43 f 219//43 209//43 27//43 f 213//43 263//43 216//43 f 215//43 211//43 203//43 f 264//43 262//43 205//43 f 222//43 264//43 221//43 f 224//43 208//43 223//43 f 211//43 259//43 226//43 f 220//43 26//43 224//43 f 226//43 265//43 222//43 f 227//43 208//43 203//43 f 227//43 211//43 225//43 f 73//24 247//24 248//24 f 654//24 73//24 842//24 f 281//24 298//24 280//24 f 277//5 295//5 276//5 f 271//5 289//5 270//5 f 264//43 267//43 262//43 f 264//43 269//43 268//43 f 206//43 269//43 265//43 f 206//43 271//43 270//43 f 262//43 271//43 5//43 f 261//43 273//43 272//43 f 266//43 273//43 259//43 f 266//43 275//43 274//43 f 210//43 275//43 263//43 f 204//43 276//43 210//43 f 204//43 278//43 277//43 f 265//43 278//43 206//43 f 261//43 279//43 265//43 f 258//43 281//43 280//43 f 22//43 281//43 260//43 f 210//43 282//43 22//43 f 210//43 284//43 283//43 f 258//43 284//43 263//43 f 286//43 289//43 287//43 f 291//43 293//43 296//43 f 298//43 302//43 300//43 f 269//24 286//24 268//24 f 275//24 293//24 274//24 f 268//24 285//24 267//24 f 272//24 292//24 279//24 f 283//5 301//5 282//5 f 278//5 296//5 277//5 f 280//24 300//24 284//24 f 270//11 288//11 269//11 f 276//11 294//11 275//11 f 267//204 287//204 271//204 f 274//24 291//24 273//24 f 273//24 290//24 272//24 f 284//44 302//44 283//44 f 279//44 297//44 278//44 f 282//11 299//11 281//11 f 634//24 335//24 20//24 f 941//24 336//24 335//24 f 942//24 339//24 336//24 f 949//24 340//24 339//24 f 546//18 26//18 547//18 f 549//27 545//27 26//27 f 546//29 549//29 26//29 f 262//13 548//13 205//13 f 209//12 203//12 545//12 f 1164//205 27//205 551//205 f 646//44 653//44 648//44 f 581//24 950//24 948//24 f 797//24 840//24 841//24 f 650//200 652//200 645//200 f 650//201 646//201 649//201 f 648//202 649//202 646//202 f 644//24 572//24 647//24 f 651//203 647//203 652//203 f 653//24 647//24 654//24 f 652//44 653//44 645//44 f 862//43 800//43 805//43 f 802//43 808//43 807//43 f 870//43 809//43 810//43 f 863//43 870//43 810//43 f 805//43 579//43 812//43 f 812//43 802//43 807//43 f 867//43 806//43 809//43 f 808//43 804//43 811//43 f 798//43 868//43 814//43 f 868//43 815//43 814//43 f 801//43 817//43 816//43 f 863//43 804//43 819//43 f 578//43 813//43 817//43 f 869//43 819//43 815//43 f 820//43 801//43 816//43 f 804//43 820//43 818//43 f 840//24 648//24 841//24 f 648//24 653//24 654//24 f 902//24 885//24 884//24 f 899//5 881//5 880//5 f 893//5 875//5 874//5 f 871//43 868//43 866//43 f 868//43 873//43 869//43 f 873//43 799//43 869//43 f 799//43 875//43 557//43 f 875//43 866//43 557//43 f 865//43 877//43 863//43 f 877//43 870//43 863//43 f 870//43 879//43 867//43 f 879//43 803//43 867//43 f 880//43 797//43 803//43 f 797//43 882//43 799//43 f 882//43 869//43 799//43 f 883//43 865//43 869//43 f 862//43 885//43 864//43 f 885//43 574//43 864//43 f 886//43 803//43 574//43 f 803//43 888//43 867//43 f 888//43 862//43 867//43 f 893//43 892//43 890//43 f 894//43 900//43 895//43 f 902//43 905//43 903//43 f 890//24 873//24 872//24 f 897//24 879//24 878//24 f 889//24 872//24 871//24 f 896//24 876//24 883//24 f 905//5 887//5 886//5 f 900//5 882//5 881//5 f 904//24 884//24 888//24 f 892//44 874//44 873//44 f 898//44 880//44 879//44 f 891//206 871//206 875//206 f 895//24 878//24 877//24 f 894//24 877//24 876//24 f 906//11 888//11 887//11 f 901//11 883//11 882//11 f 903//44 886//44 885//44 f 939//24 634//24 572//24 f 940//24 941//24 939//24 f 947//24 942//24 940//24 f 948//24 949//24 947//24 f 1158//82 1159//82 578//82 f 1161//122 1157//122 1165//122 f 1158//148 578//148 1161//148 f 1160//78 557//78 866//78 f 796//12 802//12 1157//12 f 579//205 1164//205 1163//205 f 78//11 70//11 71//11 f 950//24 641//24 29//24 f 210//24 22//24 248//24 f 248//24 247//24 204//24 f 548//24 5//24 206//24 f 204//24 210//24 248//24 f 548//24 206//24 204//24 f 77//200 76//200 75//200 f 71//201 70//201 75//201 f 74//202 68//202 73//202 f 20//24 7//24 69//24 f 72//203 69//203 76//203 f 78//24 654//24 72//24 f 634//24 20//24 72//24 f 78//11 72//11 77//11 f 258//43 213//43 212//43 f 212//43 207//43 258//43 f 215//43 203//43 209//43 f 216//43 263//43 266//43 f 211//43 218//43 217//43 f 217//43 266//43 259//43 f 212//43 219//43 27//43 f 219//43 214//43 209//43 f 213//43 258//43 263//43 f 215//43 218//43 211//43 f 205//43 220//43 221//43 f 221//43 264//43 205//43 f 222//43 265//43 264//43 f 224//43 26//43 208//43 f 261//43 226//43 259//43 f 225//43 211//43 226//43 f 220//43 205//43 26//43 f 226//43 261//43 265//43 f 227//43 223//43 208//43 f 227//43 203//43 211//43 f 73//24 68//24 247//24 f 248//24 842//24 73//24 f 654//24 78//24 73//24 f 281//24 299//24 298//24 f 277//5 296//5 295//5 f 271//5 287//5 289//5 f 264//43 268//43 267//43 f 264//43 265//43 269//43 f 206//43 270//43 269//43 f 206//43 5//43 271//43 f 262//43 267//43 271//43 f 261//43 259//43 273//43 f 266//43 274//43 273//43 f 266//43 263//43 275//43 f 210//43 276//43 275//43 f 204//43 277//43 276//43 f 204//43 206//43 278//43 f 265//43 279//43 278//43 f 261//43 272//43 279//43 f 258//43 260//43 281//43 f 22//43 282//43 281//43 f 210//43 283//43 282//43 f 210//43 263//43 284//43 f 258//43 280//43 284//43 f 287//43 285//43 286//43 f 286//43 288//43 289//43 f 290//43 291//43 296//43 f 293//43 294//43 295//43 f 296//43 297//43 290//43 f 293//43 295//43 296//43 f 297//43 292//43 290//43 f 298//43 299//43 301//43 f 301//43 302//43 298//43 f 269//24 288//24 286//24 f 275//24 294//24 293//24 f 268//24 286//24 285//24 f 272//24 290//24 292//24 f 283//5 302//5 301//5 f 278//5 297//5 296//5 f 280//24 298//24 300//24 f 270//11 289//11 288//11 f 276//11 295//11 294//11 f 267//204 285//204 287//204 f 274//24 293//24 291//24 f 273//24 291//24 290//24 f 284//44 300//44 302//44 f 279//44 292//44 297//44 f 282//11 301//11 299//11 f 634//24 941//24 335//24 f 941//24 942//24 336//24 f 942//24 949//24 339//24 f 949//24 950//24 340//24 f 549//76 552//76 545//76 f 547//13 26//13 205//13 f 262//13 5//13 548//13 f 547//13 205//13 548//13 f 26//12 545//12 208//12 f 551//207 27//207 209//207 f 203//12 208//12 545//12 f 551//12 209//12 545//12 f 1164//205 640//205 27//205 f 646//44 645//44 653//44 f 581//24 641//24 950//24 f 841//24 574//24 803//24 f 797//24 799//24 1160//24 f 841//24 803//24 797//24 f 1160//24 840//24 797//24 f 799//24 557//24 1160//24 f 650//200 651//200 652//200 f 650//201 645//201 646//201 f 648//202 643//202 649//202 f 644//24 559//24 572//24 f 651//203 644//203 647//203 f 634//24 654//24 647//24 f 647//24 572//24 634//24 f 652//44 647//44 653//44 f 805//43 806//43 862//43 f 862//43 864//43 800//43 f 802//43 796//43 808//43 f 870//43 867//43 809//43 f 810//43 811//43 804//43 f 804//43 863//43 810//43 f 805//43 800//43 579//43 f 812//43 579//43 802//43 f 867//43 862//43 806//43 f 808//43 796//43 804//43 f 814//43 813//43 798//43 f 798//43 866//43 868//43 f 868//43 869//43 815//43 f 801//43 578//43 817//43 f 818//43 819//43 804//43 f 865//43 863//43 819//43 f 578//43 798//43 813//43 f 869//43 865//43 819//43 f 820//43 796//43 801//43 f 804//43 796//43 820//43 f 840//24 643//24 648//24 f 654//24 842//24 648//24 f 841//24 648//24 842//24 f 902//24 903//24 885//24 f 899//5 900//5 881//5 f 893//5 891//5 875//5 f 871//43 872//43 868//43 f 868//43 872//43 873//43 f 873//43 874//43 799//43 f 799//43 874//43 875//43 f 875//43 871//43 866//43 f 865//43 876//43 877//43 f 877//43 878//43 870//43 f 870//43 878//43 879//43 f 879//43 880//43 803//43 f 880//43 881//43 797//43 f 797//43 881//43 882//43 f 882//43 883//43 869//43 f 883//43 876//43 865//43 f 862//43 884//43 885//43 f 885//43 886//43 574//43 f 886//43 887//43 803//43 f 803//43 887//43 888//43 f 888//43 884//43 862//43 f 890//43 889//43 891//43 f 891//43 893//43 890//43 f 894//43 896//43 901//43 f 900//43 899//43 897//43 f 894//43 901//43 900//43 f 897//43 895//43 900//43 f 899//43 898//43 897//43 f 902//43 904//43 906//43 f 906//43 905//43 902//43 f 890//24 892//24 873//24 f 897//24 898//24 879//24 f 889//24 890//24 872//24 f 896//24 894//24 876//24 f 905//5 906//5 887//5 f 900//5 901//5 882//5 f 904//24 902//24 884//24 f 892//44 893//44 874//44 f 898//44 899//44 880//44 f 891//206 889//206 871//206 f 895//24 897//24 878//24 f 894//24 895//24 877//24 f 906//11 904//11 888//11 f 901//11 896//11 883//11 f 903//44 905//44 886//44 f 939//24 941//24 634//24 f 940//24 942//24 941//24 f 947//24 949//24 942//24 f 948//24 950//24 949//24 f 1161//88 578//88 1157//88 f 798//78 578//78 1159//78 f 1159//78 1160//78 798//78 f 866//78 798//78 1160//78 f 1163//12 1157//12 802//12 f 801//12 796//12 1157//12 f 1157//12 578//12 801//12 f 802//208 579//208 1163//208 f 579//205 640//205 1164//205 usemtl Cream f 10//11 3//11 9//11 f 150//24 3//24 1//24 f 12//11 9//11 11//11 f 2//11 11//11 4//11 f 628//10 159//10 156//10 f 10//209 153//209 151//209 f 10//11 14//11 13//11 f 13//24 155//24 153//24 f 13//11 16//11 15//11 f 15//24 157//24 155//24 f 16//11 63//11 15//11 f 16//11 66//11 64//11 f 64//43 160//43 158//43 f 631//5 160//5 159//5 f 630//43 157//43 158//43 f 626//5 156//5 154//5 f 621//43 152//43 162//43 f 624//210 154//210 152//210 f 149//5 621//5 162//5 f 623//43 150//43 151//43 f 619//10 163//10 751//10 f 131//10 9//10 3//10 f 132//10 9//10 130//10 f 129//10 11//10 132//10 f 131//10 161//10 164//10 f 750//10 161//10 620//10 f 163//24 759//24 751//24 f 129//10 149//10 4//10 f 151//43 1//43 10//43 f 4//5 162//5 2//5 f 152//210 14//210 12//210 f 162//43 12//43 2//43 f 154//5 16//5 14//5 f 158//43 63//43 64//43 f 159//5 66//5 65//5 f 158//43 632//43 630//43 f 627//24 157//24 629//24 f 625//24 155//24 627//24 f 623//209 153//209 625//209 f 156//10 65//10 16//10 f 620//24 150//24 622//24 f 132//10 165//10 166//10 f 165//44 170//44 166//44 f 129//10 166//10 163//10 f 166//44 169//44 163//44 f 176//10 175//10 130//10 f 167//10 765//10 173//10 f 170//10 757//10 761//10 f 169//10 761//10 759//10 f 750//5 167//5 164//5 f 171//44 167//44 173//44 f 174//10 757//10 168//10 f 177//5 186//5 180//5 f 173//10 766//10 174//10 f 172//44 168//44 165//44 f 172//44 173//44 174//44 f 177//211 172//211 178//211 f 178//10 175//10 179//10 f 179//10 176//10 180//10 f 177//10 176//10 171//10 f 182//10 186//10 181//10 f 180//44 183//44 179//44 f 179//24 185//24 178//24 f 178//11 181//11 177//11 f 187//44 194//44 190//44 f 188//10 185//10 183//10 f 188//211 184//211 189//211 f 189//10 186//10 190//10 f 190//10 185//10 187//10 f 191//5 202//5 200//5 f 190//24 193//24 189//24 f 189//11 192//11 188//11 f 187//5 192//5 191//5 f 195//10 197//10 198//10 f 194//24 197//24 193//24 f 193//11 196//11 192//11 f 192//5 195//5 191//5 f 200//44 201//44 199//44 f 194//24 201//24 198//24 f 195//10 201//10 202//10 f 191//43 199//43 194//43 f 555//44 562//44 561//44 f 553//24 746//24 735//24 f 561//44 564//44 563//44 f 563//44 554//44 556//44 f 744//10 628//10 741//10 f 738//209 562//209 736//209 f 562//44 566//44 564//44 f 740//24 565//24 738//24 f 565//44 568//44 566//44 f 742//24 567//24 740//24 f 615//44 568//44 567//44 f 618//44 568//44 616//44 f 745//43 616//43 743//43 f 745//5 631//5 744//5 f 742//43 630//43 743//43 f 741//5 626//5 739//5 f 737//43 621//43 747//43 f 739//210 624//210 737//210 f 747//5 619//5 734//5 f 735//43 623//43 736//43 f 748//10 619//10 751//10 f 716//10 561//10 715//10 f 561//10 717//10 715//10 f 563//10 714//10 717//10 f 746//10 716//10 749//10 f 746//10 750//10 620//10 f 759//24 748//24 751//24 f 714//10 734//10 748//10 f 553//43 736//43 562//43 f 747//5 556//5 554//5 f 566//210 737//210 564//210 f 564//43 747//43 554//43 f 568//5 739//5 566//5 f 615//43 743//43 616//43 f 618//5 744//5 617//5 f 632//43 743//43 630//43 f 627//24 742//24 740//24 f 625//24 740//24 738//24 f 625//209 736//209 623//209 f 617//10 741//10 568//10 f 735//24 620//24 622//24 f 752//10 717//10 753//10 f 760//11 752//11 753//11 f 753//10 714//10 748//10 f 758//11 753//11 748//11 f 768//10 769//10 715//10 f 765//10 754//10 764//10 f 757//10 760//10 761//10 f 761//10 758//10 759//10 f 754//5 750//5 749//5 f 762//11 754//11 749//11 f 757//10 767//10 755//10 f 779//5 774//5 770//5 f 766//10 764//10 767//10 f 755//11 763//11 752//11 f 763//11 764//11 762//11 f 763//10 770//10 771//10 f 768//10 771//10 772//10 f 773//10 768//10 772//10 f 770//10 769//10 773//10 f 775//10 779//10 778//10 f 776//11 773//11 772//11 f 778//24 776//24 772//24 f 774//44 771//44 770//44 f 787//11 780//11 783//11 f 781//10 778//10 780//10 f 777//10 781//10 782//10 f 779//10 782//10 783//10 f 778//10 783//10 780//10 f 784//5 795//5 788//5 f 786//24 783//24 782//24 f 785//44 782//44 781//44 f 780//5 785//5 781//5 f 788//10 790//10 789//10 f 790//24 787//24 786//24 f 789//44 786//44 785//44 f 788//5 785//5 784//5 f 794//11 793//11 792//11 f 794//24 787//24 791//24 f 788//10 794//10 791//10 f 792//43 784//43 787//43 f 10//11 1//11 3//11 f 150//24 161//24 3//24 f 12//11 10//11 9//11 f 2//11 12//11 11//11 f 628//10 631//10 159//10 f 10//209 13//209 153//209 f 10//11 12//11 14//11 f 13//24 15//24 155//24 f 13//11 14//11 16//11 f 15//24 63//24 157//24 f 16//11 64//11 63//11 f 16//11 65//11 66//11 f 64//43 66//43 160//43 f 631//5 632//5 160//5 f 630//43 629//43 157//43 f 626//5 628//5 156//5 f 621//43 624//43 152//43 f 624//210 626//210 154//210 f 149//5 619//5 621//5 f 623//43 622//43 150//43 f 619//10 149//10 163//10 f 131//10 130//10 9//10 f 132//10 11//10 9//10 f 129//10 4//10 11//10 f 131//10 3//10 161//10 f 750//10 164//10 161//10 f 163//24 169//24 759//24 f 129//10 163//10 149//10 f 151//43 150//43 1//43 f 4//5 149//5 162//5 f 152//210 154//210 14//210 f 162//43 152//43 12//43 f 154//5 156//5 16//5 f 158//43 157//43 63//43 f 159//5 160//5 66//5 f 158//43 160//43 632//43 f 627//24 155//24 157//24 f 625//24 153//24 155//24 f 623//209 151//209 153//209 f 156//10 159//10 65//10 f 620//24 161//24 150//24 f 132//10 130//10 165//10 f 165//44 168//44 170//44 f 129//10 132//10 166//10 f 166//44 170//44 169//44 f 165//10 130//10 175//10 f 131//10 164//10 176//10 f 164//10 171//10 176//10 f 175//10 172//10 165//10 f 131//10 176//10 130//10 f 167//10 756//10 765//10 f 170//10 168//10 757//10 f 169//10 170//10 761//10 f 750//5 756//5 167//5 f 171//44 164//44 167//44 f 174//10 766//10 757//10 f 184//5 180//5 186//5 f 177//5 181//5 186//5 f 173//10 765//10 766//10 f 172//44 174//44 168//44 f 172//44 171//44 173//44 f 177//10 171//10 172//10 f 178//10 172//10 175//10 f 179//10 175//10 176//10 f 177//10 180//10 176//10 f 182//10 185//10 186//10 f 180//44 184//44 183//44 f 182//24 178//24 185//24 f 179//24 183//24 185//24 f 178//11 182//11 181//11 f 187//44 191//44 194//44 f 188//10 187//10 185//10 f 188//212 183//212 184//212 f 189//10 184//10 186//10 f 190//10 186//10 185//10 f 191//5 195//5 202//5 f 190//24 194//24 193//24 f 189//11 193//11 192//11 f 187//5 188//5 192//5 f 195//10 196//10 197//10 f 194//24 198//24 197//24 f 193//11 197//11 196//11 f 192//5 196//5 195//5 f 200//44 202//44 201//44 f 194//24 199//24 201//24 f 195//10 198//10 201//10 f 191//43 200//43 199//43 f 555//44 553//44 562//44 f 553//24 555//24 746//24 f 561//44 562//44 564//44 f 563//44 564//44 554//44 f 744//10 631//10 628//10 f 738//209 565//209 562//209 f 562//44 565//44 566//44 f 740//24 567//24 565//24 f 565//44 567//44 568//44 f 742//24 615//24 567//24 f 615//44 616//44 568//44 f 618//44 617//44 568//44 f 745//43 618//43 616//43 f 745//5 632//5 631//5 f 742//43 629//43 630//43 f 741//5 628//5 626//5 f 737//43 624//43 621//43 f 739//210 626//210 624//210 f 747//5 621//5 619//5 f 735//43 622//43 623//43 f 748//10 734//10 619//10 f 716//10 555//10 561//10 f 561//10 563//10 717//10 f 563//10 556//10 714//10 f 746//10 555//10 716//10 f 746//10 749//10 750//10 f 759//24 758//24 748//24 f 714//10 556//10 734//10 f 553//43 735//43 736//43 f 747//5 734//5 556//5 f 566//210 739//210 737//210 f 564//43 737//43 747//43 f 568//5 741//5 739//5 f 615//43 742//43 743//43 f 618//5 745//5 744//5 f 632//43 745//43 743//43 f 627//24 629//24 742//24 f 625//24 627//24 740//24 f 625//209 738//209 736//209 f 617//10 744//10 741//10 f 735//24 746//24 620//24 f 752//10 715//10 717//10 f 760//11 755//11 752//11 f 753//10 717//10 714//10 f 758//11 760//11 753//11 f 716//10 715//10 769//10 f 752//10 763//10 768//10 f 769//10 762//10 749//10 f 715//10 752//10 768//10 f 769//10 749//10 716//10 f 765//10 756//10 754//10 f 757//10 755//10 760//10 f 761//10 760//10 758//10 f 754//5 756//5 750//5 f 762//11 764//11 754//11 f 757//10 766//10 767//10 f 770//5 773//5 779//5 f 777//5 779//5 773//5 f 766//10 765//10 764//10 f 755//11 767//11 763//11 f 763//11 767//11 764//11 f 763//213 762//213 770//213 f 768//10 763//10 771//10 f 773//10 769//10 768//10 f 770//10 762//10 769//10 f 775//10 774//10 779//10 f 776//11 777//11 773//11 f 772//24 771//24 778//24 f 775//24 778//24 771//24 f 774//44 775//44 771//44 f 787//11 784//11 780//11 f 781//10 776//10 778//10 f 777//211 776//211 781//211 f 779//10 777//10 782//10 f 778//10 779//10 783//10 f 784//5 793//5 795//5 f 786//24 787//24 783//24 f 785//44 786//44 782//44 f 780//5 784//5 785//5 f 788//10 791//10 790//10 f 790//24 791//24 787//24 f 789//44 790//44 786//44 f 788//5 789//5 785//5 f 794//11 795//11 793//11 f 794//24 792//24 787//24 f 788//10 795//10 794//10 f 792//43 793//43 784//43 usemtl Silver f 233//43 238//43 234//43 f 228//43 244//43 229//43 f 228//43 242//43 231//43 f 243//43 228//43 231//43 f 245//43 228//43 230//43 f 233//43 240//43 236//43 f 239//43 233//43 236//43 f 241//43 233//43 235//43 f 321//214 332//214 327//214 f 327//215 331//215 328//215 f 328//216 329//216 327//216 f 316//217 331//217 325//217 f 316//218 330//218 328//218 f 321//219 329//219 322//219 f 826//43 831//43 830//43 f 821//43 837//43 825//43 f 835//43 821//43 824//43 f 836//43 821//43 823//43 f 821//43 838//43 823//43 f 833//43 826//43 829//43 f 832//43 826//43 828//43 f 826//43 834//43 828//43 f 925//220 936//220 930//220 f 931//60 935//60 936//60 f 932//221 933//221 934//221 f 935//217 920//217 929//217 f 920//222 934//222 928//222 f 933//223 925//223 926//223 f 233//43 237//43 238//43 f 228//43 232//43 244//43 f 228//43 229//43 242//43 f 243//43 230//43 228//43 f 245//43 232//43 228//43 f 233//43 234//43 240//43 f 239//43 235//43 233//43 f 241//43 237//43 233//43 f 321//220 326//220 332//220 f 327//60 332//60 331//60 f 328//224 330//224 329//224 f 316//217 328//217 331//217 f 316//225 324//225 330//225 f 321//226 327//226 329//226 f 826//43 827//43 831//43 f 821//43 822//43 837//43 f 835//43 822//43 821//43 f 836//43 824//43 821//43 f 821//43 825//43 838//43 f 833//43 827//43 826//43 f 832//43 829//43 826//43 f 826//43 830//43 834//43 f 925//214 931//214 936//214 f 931//215 932//215 935//215 f 932//227 931//227 933//227 f 935//217 932//217 920//217 f 920//228 932//228 934//228 f 933//229 931//229 925//229 ================================================ FILE: examples/old/basic.html ================================================ Threebox Basic Example
================================================ FILE: examples/old/flocking.html ================================================ Flocking Trucks SymbolLayer3D example
================================================ FILE: examples/old/orientation.html ================================================ SymboLayer3D example
================================================ FILE: examples/raycaster.html ================================================ Raycaster
================================================ FILE: examples/tube.html ================================================ Tube Example
================================================ FILE: exports.js ================================================ window.Threebox = require('./src/Threebox.js'), window.THREE = require('./src/three.js') ================================================ FILE: main.js ================================================ module.exports = exports = { Threebox: require('./src/Threebox'), THREE: require('./src/three.js') } ================================================ FILE: package.json ================================================ { "name": "threebox", "version": "0.2.0", "description": "A Mapbox GL JS plugin that combines the power of the Three.js 3D library with Mapbox geospatial tools.", "main": "main.js", "repository": { "type": "git", "url": "git+https://github.com/peterqliu/threebox.git" }, "author": "@peterqliu and @kronick", "license": "MIT", "bugs": { "url": "https://github.com/peterqliu/threebox/issues" }, "dev-dependencies": { "tap-prettify": "0.0.2", "tape": "^4.6.3" }, "scripts": { "build": "browserify -g ./node_modules/uglifyify exports.js > dist/threebox.min.js", "dev": "watchify exports.js --verbose -o dist/threebox.js", "test": "browserify tests/threebox-tests.js > tests/threebox-tests-bundle.js; echo 'Open tests/threebox-tests.html to run tests in the browser.'" }, "dependencies": { "@turf/turf": "^5.1.6", "tape": "^4.10.1", "turf": "^3.0.14", "watchify": "^3.11.1", "uglifyify": "5.0.1" } } ================================================ FILE: src/Animation/AnimationManager.js ================================================ var threebox = require('../Threebox.js'); var utils = require("../utils/utils.js"); var validate = require("../utils/validate.js"); function AnimationManager(map) { this.map = map this.enrolledObjects = []; this.previousFrameTime; }; AnimationManager.prototype = { enroll: function(obj) { /* Extend the provided object with animation-specific properties and track in the animation manager */ this.enrolledObjects.push(obj); // Give this object its own internal animation queue obj.animationQueue = []; obj.set = function(options) { //if duration is set, animate to the new state if (options.duration > 0 ){ var newParams = { start: Date.now(), expiration: Date.now() + options.duration, endState: {} } utils.extend(options, newParams); var translating = options.coords; var rotating = options.rotation; var scaling = options.scale || options.scaleX || options.scaleY || options.scaleZ; if (rotating) { var r = obj.rotation; options.startRotation = [r.x, r.y, r.z]; options.endState.rotation = utils.types.rotation(options.rotation, options.startRotation); options.rotationPerMs = options.endState.rotation .map(function(angle, index){ return (angle-options.startRotation[index])/options.duration; }) } if (scaling) { var s = obj.scale; options.startScale = [s.x, s.y, s.z]; options.endState.scale = utils.types.scale(options.scale, options.startScale); options.scalePerMs = options.endState.scale .map(function(scale, index){ return (scale-options.startScale[index])/options.duration; }) } if (translating) options.pathCurve = new THREE.CatmullRomCurve3(utils.lnglatsToWorld([obj.coordinates, options.coords])); var entry = { type:'set', parameters: options } this.animationQueue .push(entry); map.repaint = true; } //if no duration set, stop object's existing animations and go to that state immediately else { this.stop(); options.rotation = utils.radify(options.rotation); this._setObject(options); } return this }; obj.stop = function(){ this.animationQueue = []; return this; } obj.followPath = function (options, cb){ var entry = { type: 'followPath', parameters: utils._validate(options, defaults.followPath) }; utils.extend( entry.parameters, { pathCurve: new THREE.CatmullRomCurve3( utils.lnglatsToWorld(options.path) ), start: Date.now(), expiration: Date.now() + entry.parameters.duration, cb: cb } ); this.animationQueue .push(entry); map.repaint = true; return this; }; obj._setObject = function (options){ var p = options.position; // lnglat var r = options.rotation; // radians var s = options.scale; // var w = options.worldCoordinates; //Vector3 var q = options.quaternion // [axis, angle] if (p) { this.coordinates = p; var c = utils.projectToWorld(p); this.position.copy(c) } if (r) this.rotation.set(r[0], r[1], r[2]); if (s) this.scale.set(s[0], s[1], s[2]); if (q) this.quaternion.setFromAxisAngle(q[0], q[1]); if (w) this.position.copy(w); map.repaint = true } }, update: function(now) { if (this.previousFrameTime === undefined) this.previousFrameTime = now; var dimensions = ['X','Y','Z']; //iterate through objects in queue. count in reverse so we can cull objects without frame shifting for (var a = this.enrolledObjects.length-1; a>=0; a--){ var object = this.enrolledObjects[a]; if(!object.animationQueue || object.animationQueue.length === 0) continue; //focus on first item in queue var item = object.animationQueue[0]; var options = item.parameters; // if an animation is past its expiration date, cull it if (!options.expiration) { // console.log('culled') object.animationQueue.splice(0,1); // set the start time of the next animation if (object.animationQueue[0]) object.animationQueue[0].parameters.start = now; return } //if finished, jump to end state and flag animation entry for removal next time around. Execute callback if there is one var expiring = now >= options.expiration; if (expiring) { options.expiration = false; if (options.endState) object._setObject(options.endState); options.cb(); } else { var timeProgress = (now - options.start) / options.duration; if (item.type === 'set'){ var objectState = {}; if (options.pathCurve) objectState.worldCoordinates = options.pathCurve.getPoint(timeProgress); if (options.rotationPerMs) { objectState.rotation = options.startRotation.map(function(rad, index){ return rad + options.rotationPerMs[index] * timeProgress * options.duration }) } if (options.scalePerMs) { objectState.scale = options.startScale.map(function(scale, index){ return scale + options.scalePerMs[index]*timeProgress * options.duration }) } object._setObject(objectState); } if (item.type === 'followPath'){ var position = options.pathCurve.getPointAt(timeProgress); objectState = {worldCoordinates: position}; // if we need to track heading if (options.trackHeading){ var tangent = options.pathCurve .getTangentAt(timeProgress) .normalize(); var axis = new THREE.Vector3(0,0,0); var up = new THREE.Vector3(0,1,0); axis .crossVectors(up, tangent) .normalize(); var radians = Math.acos(up.dot(tangent)); objectState.quaternion = [axis, radians]; } object._setObject(objectState); } } } this.previousFrameTime = now; } } const defaults = { followPath: { path: null, duration: 1000, trackHeading: true } } module.exports = exports = AnimationManager; ================================================ FILE: src/Camera/CameraSync.js ================================================ var THREE = require("../three.js"); var utils = require("../utils/utils.js"); var ThreeboxConstants = require("../utils/constants.js"); function CameraSync(map, camera, world) { this.map = map; this.camera = camera; this.active = true; this.camera.matrixAutoUpdate = false; // We're in charge of the camera now! // Postion and configure the world group so we can scale it appropriately when the camera zooms this.world = world || new THREE.Group(); this.world.position.x = this.world.position.y = ThreeboxConstants.WORLD_SIZE/2 this.world.matrixAutoUpdate = false; //set up basic camera state this.state = { fov: 0.6435011087932844, translateCenter: new THREE.Matrix4, worldSizeRatio: 512/ThreeboxConstants.WORLD_SIZE }; this.state.translateCenter.makeTranslation(ThreeboxConstants.WORLD_SIZE/2, -ThreeboxConstants.WORLD_SIZE / 2, 0); // Listen for move events from the map and update the Three.js camera. Some attributes only change when viewport resizes, so update those accordingly var _this = this; this.map .on('move', function() { _this.updateCamera() }) .on('resize', function(){ _this.setupCamera(); }) this.setupCamera(); } CameraSync.prototype = { setupCamera: function() { var t = this.map.transform const halfFov = this.state.fov / 2; var cameraToCenterDistance = 0.5 / Math.tan(halfFov) * t.height; const groundAngle = Math.PI / 2 + t._pitch; this.state.cameraToCenterDistance = cameraToCenterDistance; this.state.cameraTranslateZ = new THREE.Matrix4().makeTranslation(0,0,cameraToCenterDistance); this.state.topHalfSurfaceDistance = Math.sin(halfFov) * cameraToCenterDistance / Math.sin(Math.PI - groundAngle - halfFov); this.updateCamera(); }, updateCamera: function(ev) { if(!this.camera) { console.log('nocamera') return; } var t = this.map.transform // Calculate z distance of the farthest fragment that should be rendered. const furthestDistance = Math.cos(Math.PI / 2 - t._pitch) * this.state.topHalfSurfaceDistance + this.state.cameraToCenterDistance; // Add a bit extra to avoid precision problems when a fragment's distance is exactly `furthestDistance` const farZ = furthestDistance * 1.01; this.camera.projectionMatrix = utils.makePerspectiveMatrix(this.state.fov, t.width / t.height, 1, farZ); var cameraWorldMatrix = new THREE.Matrix4(); var cameraTranslateZ = new THREE.Matrix4().makeTranslation(0,0,this.state.cameraToCenterDistance); var rotatePitch = new THREE.Matrix4().makeRotationX(t._pitch); var rotateBearing = new THREE.Matrix4().makeRotationZ(t.angle); // Unlike the Mapbox GL JS camera, separate camera translation and rotation out into its world matrix // If this is applied directly to the projection matrix, it will work OK but break raycasting cameraWorldMatrix .premultiply(this.state.cameraTranslateZ) .premultiply(rotatePitch) .premultiply(rotateBearing) this.camera.matrixWorld.copy(cameraWorldMatrix); var zoomPow = t.scale * this.state.worldSizeRatio; // Handle scaling and translation of objects in the map in the world's matrix transform, not the camera var scale = new THREE.Matrix4; var translateCenter = new THREE.Matrix4; var translateMap = new THREE.Matrix4; var rotateMap = new THREE.Matrix4; scale .makeScale( zoomPow, zoomPow , zoomPow ); var x = -this.map.transform.x || -this.map.transform.point.x; var y = this.map.transform.y || this.map.transform.point.y; translateMap .makeTranslation(x, y, 0); rotateMap .makeRotationZ(Math.PI); this.world.matrix = new THREE.Matrix4; this.world.matrix .premultiply(rotateMap) .premultiply(this.state.translateCenter) .premultiply(scale) .premultiply(translateMap) // utils.prettyPrintMatrix(this.camera.projectionMatrix.elements); } } module.exports = exports = CameraSync; ================================================ FILE: src/Threebox.js ================================================ var THREE = require("./three.js"); var CameraSync = require("./camera/CameraSync.js"); var utils = require("./utils/utils.js"); var AnimationManager = require("./animation/AnimationManager.js"); var ThreeboxConstants = require("./utils/constants.js"); var Objects = require("./objects/objects.js"); var material = require("./utils/material.js"); var sphere = require("./objects/sphere.js"); var loadObj = require("./objects/loadObj.js"); var Object3D = require("./objects/Object3D.js"); var line = require("./objects/line.js"); var tube = require("./objects/tube.js"); function Threebox(map, glContext, options){ this.init(map, glContext, options); }; Threebox.prototype = { repaint: function(){ this.map.repaint = true; }, init: function (map, glContext, options){ this.map = map; // Set up a THREE.js scene this.renderer = new THREE.WebGLRenderer( { alpha: true, antialias: true, canvas: map.getCanvas(), context: glContext } ); this.renderer.shadowMap.enabled = true; this.renderer.autoClear = false; this.scene = new THREE.Scene(); this.camera = new THREE.PerspectiveCamera( 28, window.innerWidth / window.innerHeight, 0.000000000001, Infinity); // The CameraSync object will keep the Mapbox and THREE.js camera movements in sync. // It requires a world group to scale as we zoom in. Rotation is handled in the camera's // projection matrix itself (as is field of view and near/far clipping) // It automatically registers to listen for move events on the map so we don't need to do that here this.world = new THREE.Group(); this.scene.add(this.world); this.cameraSync = new CameraSync(this.map, this.camera, this.world); //raycaster for mouse events this.raycaster = new THREE.Raycaster(); // apply starter options this.options = utils._validate(options || {}, defaultOptions); if (this.options.defaultLights) this.defaultLights(); }, // Objects objects: new Objects(AnimationManager), sphere: sphere, line: line, tube: function(obj){ return tube(obj, this.world) }, Object3D: function(obj, o) { return Object3D(obj, o) }, loadObj: loadObj, // Material material: function(o){ return material(o) }, utils: utils, projectToWorld: function(coords) { return this.utils.projectToWorld(coords) }, unprojectFromWorld: function(v3) { return this.utils.unprojectFromWorld(v3) }, projectedUnitsPerMeter: function(lat) { return this.utils.projectedUnitsPerMeter(lat) }, queryRenderedFeatures: function(point){ var mouse = new THREE.Vector2(); // // scale mouse pixel position to a percentage of the screen's width and height mouse.x = ( point.x / this.map.transform.width ) * 2 - 1; mouse.y = 1 - ( point.y / this.map.transform.height ) * 2; this.raycaster.setFromCamera(mouse, this.camera); // calculate objects intersecting the picking ray var intersects = this.raycaster.intersectObjects(this.world.children, true); return intersects }, update: function() { if (this.map.repaint) this.map.repaint = false var timestamp = Date.now(); // Update any animations this.objects.animationManager.update(timestamp); this.renderer.state.reset(); // Render the scene and repaint the map this.renderer.render( this.scene, this.camera ); if (this.options.passiveRendering === false) this.map.triggerRepaint(); }, add: function(obj) { this.world.add(obj); }, remove: function(obj) { this.world.remove(obj); }, defaultLights: function(){ this.scene.add( new THREE.AmbientLight( 0xffffff ) ); var sunlight = new THREE.DirectionalLight(0xffffff, 0.25); sunlight.position.set(0,80000000,100000000); sunlight.matrixWorldNeedsUpdate = true; this.world.add(sunlight); }, memory: function (){ return this.renderer.info.memory}, version: '0.3.0', // DEPRECATED METHODS setupDefaultLights: function() { console.warn('.setupDefaultLights() has been moved to a "defaultLights" option inside Threebox()') this.defaultLights(); }, addAtCoordinate: function(obj, lnglat, options) { console.warn('addAtCoordinate() has been deprecated. Check out the and threebox.add() Object.setCoords() methods instead.') obj = this.Object3D({obj:obj}); obj.setCoords(lnglat) this.add(obj); return obj; }, moveToCoordinate: function(obj, lnglat, options) { console.warn('addAtCoordinate() has been deprecated. Check out the Object.setCoords() and threebox.add() methods instead.') if (!obj.setCoords) obj = this.Object3D(obj); obj.setCoords(lnglat, options); return obj; } } var defaultOptions = { defaultLights: false, passiveRendering: true } module.exports = exports = Threebox; ================================================ FILE: src/Utils/Utils.js ================================================ var THREE = require("../three.js"); var Constants = require("./constants.js"); var validate = require("./validate.js"); var utils = { prettyPrintMatrix: function(uglymatrix){ for (var s=0; s<4; s++){ var quartet=[uglymatrix[s], uglymatrix[s+4], uglymatrix[s+8], uglymatrix[s+12]]; console.log(quartet.map(function(num){return num.toFixed(4)})) } }, makePerspectiveMatrix: function(fovy, aspect, near, far) { var out = new THREE.Matrix4(); var f = 1.0 / Math.tan(fovy / 2), nf = 1 / (near - far); var newMatrix = [ f / aspect, 0, 0, 0, 0, f, 0, 0, 0, 0, (far + near) * nf, -1, 0, 0, (2 * far * near) * nf, 0 ] out.elements = newMatrix return out; }, //gimme radians radify: function(deg){ function convert(degrees){ degrees = degrees || 0; return Math.PI*2*degrees/360 } if (typeof deg === 'object'){ //if [x,y,z] array of rotations if (deg.length > 0){ return deg.map(function(degree){ return convert(degree) }) } // if {x: y: z:} rotation object else { return [convert(deg.x), convert(deg.y), convert(deg.z)] } } //if just a number else return convert(deg) }, //gimme degrees degreeify: function(rad){ function convert(radians){ radians = radians || 0; return radians * 360/(Math.PI*2) } if (typeof rad === 'object') { return [convert(rad.x), convert(rad.y), convert(rad.z)] } else return convert(rad) }, projectToWorld: function(coords){ // Spherical mercator forward projection, re-scaling to WORLD_SIZE var projected = [ -Constants.MERCATOR_A * Constants.DEG2RAD* coords[0] * Constants.PROJECTION_WORLD_SIZE, -Constants.MERCATOR_A * Math.log(Math.tan((Math.PI*0.25) + (0.5 * Constants.DEG2RAD * coords[1]) )) * Constants.PROJECTION_WORLD_SIZE ]; //z dimension, defaulting to 0 if not provided if (!coords[2]) projected.push(0) else { var pixelsPerMeter = this.projectedUnitsPerMeter(coords[1]); projected.push( coords[2] * pixelsPerMeter ); } var result = new THREE.Vector3(projected[0], projected[1], projected[2]); return result; }, projectedUnitsPerMeter: function(latitude) { return Math.abs( Constants.WORLD_SIZE / Math.cos( Constants.DEG2RAD * latitude ) / Constants.EARTH_CIRCUMFERENCE ); }, _scaleVerticesToMeters: function(centerLatLng, vertices) { var pixelsPerMeter = this.projectedUnitsPerMeter(centerLatLng[1]); var centerProjected = this.projectToWorld(centerLatLng); for (var i = 0; i < vertices.length; i++) { vertices[i].multiplyScalar(pixelsPerMeter); } return vertices; }, projectToScreen: function(coords) { console.log("WARNING: Projecting to screen coordinates is not yet implemented"); }, unprojectFromScreen: function (pixel) { console.log("WARNING: unproject is not yet implemented"); }, //world units to lnglat unprojectFromWorld: function (worldUnits) { var unprojected = [ -worldUnits.x / (Constants.MERCATOR_A * Constants.DEG2RAD * Constants.PROJECTION_WORLD_SIZE), 2*(Math.atan(Math.exp(worldUnits.y/(Constants.PROJECTION_WORLD_SIZE*(-Constants.MERCATOR_A))))-Math.PI/4)/Constants.DEG2RAD ]; var pixelsPerMeter = this.projectedUnitsPerMeter(unprojected[1]); //z dimension var height = worldUnits.z || 0; unprojected.push( height / pixelsPerMeter ); return unprojected; }, _flipMaterialSides: function(obj) { }, // to improve precision, normalize a series of vector3's to their collective center, and move the resultant mesh to that center normalizeVertices(vertices) { var geometry = new THREE.Geometry(); for (v3 of vertices) { geometry.vertices.push(v3) } geometry.computeBoundingSphere(); var center = geometry.boundingSphere.center; var radius = geometry.boundingSphere.radius; var scaled = vertices.map(function(v3){ var normalized = v3.sub(center); return normalized; }); return {vertices: scaled, position: center} }, //flatten an array of Vector3's into a shallow array of values in x-y-z order, for bufferGeometry flattenVectors(vectors) { var flattenedArray = []; for (vertex of vectors) { flattenedArray.push(vertex.x, vertex.y, vertex.z); } return flattenedArray }, //convert a line/polygon to Vector3's lnglatsToWorld: function(coords){ var vector3 = coords.map( function(pt){ var p = utils.projectToWorld(pt); var v3 = new THREE.Vector3(p.x, p.y, p.z); return v3 } ); return vector3 }, extend: function(original, addition) { for (key in addition) original[key] = addition[key]; }, clone: function(original) { var clone = {}; for (key in original) clone[key] = original[key]; return clone; }, // retrieve object parameters from an options object types: { rotation: function(r, currentRotation){ // if number provided, rotate only in Z by that amount if (typeof r === 'number') r = {z:r}; var degrees = this.applyDefault([r.x, r.y, r.z], currentRotation); var radians = utils.radify(degrees); return radians; }, scale: function(s, currentScale){ if (typeof s === 'number') return s = [s,s,s]; else return this.applyDefault([s.x, s.y, s.z], currentScale); }, applyDefault: function(array, current){ var output = array.map(function(item, index){ item = item || current[index]; return item }) return output } }, _validate: function(userInputs, defaults){ userInputs = userInputs || {}; var validatedOutput = {}; utils.extend(validatedOutput, userInputs); for (key of Object.keys(defaults)){ if (userInputs[key] === undefined) { //make sure required params are present if (defaults[key] === null) { console.error(key + ' is required') return; } else validatedOutput[key] = defaults[key] } else validatedOutput[key] = userInputs[key] } return validatedOutput }, Validator: new validate(), exposedMethods: ['projectToWorld', 'projectedUnitsPerMeter', 'extend', 'unprojectFromWorld'] } module.exports = exports = utils ================================================ FILE: src/Utils/ValueGenerator.js ================================================ const ValueGenerator = function(input) { if(typeof input === 'object' && input.property !== undefined) // Value name comes from a property in each item return (f => f.properties[input.property]); else if(typeof input === 'object' && input.generator !== undefined) // Value name generated by a function run on each item return input.generator; else return (() => input); return undefined; } module.exports = exports = ValueGenerator; ================================================ FILE: src/objects/Object3D.js ================================================ var Objects = require('./objects.js'); var utils = require("../utils/utils.js"); function Object3D(options) { options = utils._validate(options, Objects.prototype._defaults.Object3D); var obj = options.obj; if (options.units === 'meters') obj = Objects.prototype._makeGroup(options.obj, options); obj = Objects.prototype._addMethods(obj); return obj } module.exports = exports = Object3D; ================================================ FILE: src/objects/customLines/Line2.js ================================================ /** * @author WestLangley / http://github.com/WestLangley * */ THREE.Line2 = function ( geometry, material ) { THREE.LineSegments2.call( this ); this.type = 'Line2'; this.geometry = geometry !== undefined ? geometry : new THREE.LineGeometry(); this.material = material !== undefined ? material : new THREE.LineMaterial( { color: Math.random() * 0xffffff } ); }; THREE.Line2.prototype = Object.assign( Object.create( THREE.LineSegments2.prototype ), { constructor: THREE.Line2, isLine2: true, copy: function ( source ) { // todo return this; } } ); ================================================ FILE: src/objects/customLines/LineGeometry.js ================================================ /** * @author WestLangley / http://github.com/WestLangley * */ THREE.LineGeometry = function () { THREE.LineSegmentsGeometry.call( this ); this.type = 'LineGeometry'; }; THREE.LineGeometry.prototype = Object.assign( Object.create( THREE.LineSegmentsGeometry.prototype ), { constructor: THREE.LineGeometry, isLineGeometry: true, setPositions: function ( array ) { // converts [ x1, y1, z1, x2, y2, z2, ... ] to pairs format var length = array.length - 3; var points = new Float32Array( 2 * length ); for ( var i = 0; i < length; i += 3 ) { points[ 2 * i ] = array[ i ]; points[ 2 * i + 1 ] = array[ i + 1 ]; points[ 2 * i + 2 ] = array[ i + 2 ]; points[ 2 * i + 3 ] = array[ i + 3 ]; points[ 2 * i + 4 ] = array[ i + 4 ]; points[ 2 * i + 5 ] = array[ i + 5 ]; } THREE.LineSegmentsGeometry.prototype.setPositions.call( this, points ); return this; }, setColors: function ( array ) { // converts [ r1, g1, b1, r2, g2, b2, ... ] to pairs format var length = array.length - 3; var colors = new Float32Array( 2 * length ); for ( var i = 0; i < length; i += 3 ) { colors[ 2 * i ] = array[ i ]; colors[ 2 * i + 1 ] = array[ i + 1 ]; colors[ 2 * i + 2 ] = array[ i + 2 ]; colors[ 2 * i + 3 ] = array[ i + 3 ]; colors[ 2 * i + 4 ] = array[ i + 4 ]; colors[ 2 * i + 5 ] = array[ i + 5 ]; } THREE.LineSegmentsGeometry.prototype.setColors.call( this, colors ); return this; }, fromLine: function ( line ) { var geometry = line.geometry; if ( geometry.isGeometry ) { this.setPositions( geometry.vertices ); } else if ( geometry.isBufferGeometry ) { this.setPositions( geometry.position.array ); // assumes non-indexed } // set colors, maybe return this; }, copy: function ( source ) { // todo return this; } } ); ================================================ FILE: src/objects/customLines/LineMaterial.js ================================================ /** * @author WestLangley / http://github.com/WestLangley * * parameters = { * color: , * linewidth: , * dashed: , * dashScale: , * dashSize: , * gapSize: , * resolution: , // to be set by renderer * } */ THREE.UniformsLib.line = { linewidth: { value: 1 }, resolution: { value: new THREE.Vector2( 1, 1 ) }, dashScale: { value: 1 }, dashSize: { value: 1 }, gapSize: { value: 1 } // todo FIX - maybe change to totalSize }; THREE.ShaderLib[ 'line' ] = { uniforms: THREE.UniformsUtils.merge( [ THREE.UniformsLib.common, THREE.UniformsLib.fog, THREE.UniformsLib.line ] ), vertexShader: ` #include #include #include #include #include uniform float linewidth; uniform vec2 resolution; attribute vec3 instanceStart; attribute vec3 instanceEnd; attribute vec3 instanceColorStart; attribute vec3 instanceColorEnd; varying vec2 vUv; #ifdef USE_DASH uniform float dashScale; attribute float instanceDistanceStart; attribute float instanceDistanceEnd; varying float vLineDistance; #endif void trimSegment( const in vec4 start, inout vec4 end ) { // trim end segment so it terminates between the camera plane and the near plane // conservative estimate of the near plane float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column float nearEstimate = - 0.5 * b / a; float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); end.xyz = mix( start.xyz, end.xyz, alpha ); } void main() { #ifdef USE_COLOR vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; #endif #ifdef USE_DASH vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; #endif float aspect = resolution.x / resolution.y; vUv = uv; // camera space vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); // special case for perspective projection, and segments that terminate either in, or behind, the camera plane // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space // but we need to perform ndc-space calculations in the shader, so we must address this issue directly // perhaps there is a more elegant solution -- WestLangley bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column if ( perspective ) { if ( start.z < 0.0 && end.z >= 0.0 ) { trimSegment( start, end ); } else if ( end.z < 0.0 && start.z >= 0.0 ) { trimSegment( end, start ); } } // clip space vec4 clipStart = projectionMatrix * start; vec4 clipEnd = projectionMatrix * end; // ndc space vec2 ndcStart = clipStart.xy / clipStart.w; vec2 ndcEnd = clipEnd.xy / clipEnd.w; // direction vec2 dir = ndcEnd - ndcStart; // account for clip-space aspect ratio dir.x *= aspect; dir = normalize( dir ); // perpendicular to dir vec2 offset = vec2( dir.y, - dir.x ); // undo aspect ratio adjustment dir.x /= aspect; offset.x /= aspect; // sign flip if ( position.x < 0.0 ) offset *= - 1.0; // endcaps if ( position.y < 0.0 ) { offset += - dir; } else if ( position.y > 1.0 ) { offset += dir; } // adjust for linewidth offset *= linewidth; // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... offset /= resolution.y; // select end vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; // back to clip space offset *= clip.w; clip.xy += offset; gl_Position = clip; #include #include #include #include } `, fragmentShader: ` uniform vec3 diffuse; uniform float opacity; #ifdef USE_DASH uniform float dashSize; uniform float gapSize; #endif varying float vLineDistance; #include #include #include #include #include varying vec2 vUv; void main() { #include #ifdef USE_DASH if ( vUv.y < 0.5 || vUv.y > 0.5 ) discard; // discard endcaps if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX #endif if ( vUv.y < 0.5 || vUv.y > 0.5 ) { float a = vUv.x - 0.5; float b = vUv.y - 0.5; float len2 = a * a + b * b; if ( len2 > 0.25 ) discard; } vec4 diffuseColor = vec4( diffuse, opacity ); #include #include gl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a ); #include #include #include #include } ` }; THREE.LineMaterial = function ( parameters ) { THREE.ShaderMaterial.call( this, { type: 'LineMaterial', uniforms: THREE.UniformsUtils.clone( THREE.ShaderLib[ 'line' ].uniforms ), vertexShader: THREE.ShaderLib[ 'line' ].vertexShader, fragmentShader: THREE.ShaderLib[ 'line' ].fragmentShader } ); this.dashed = false; Object.defineProperties( this, { color: { enumerable: true, get: function () { return this.uniforms.diffuse.value; }, set: function ( value ) { this.uniforms.diffuse.value = value; } }, linewidth: { enumerable: true, get: function () { return this.uniforms.linewidth.value; }, set: function ( value ) { this.uniforms.linewidth.value = value; } }, dashScale: { enumerable: true, get: function () { return this.uniforms.dashScale.value; }, set: function ( value ) { this.uniforms.dashScale.value = value; } }, dashSize: { enumerable: true, get: function () { return this.uniforms.dashSize.value; }, set: function ( value ) { this.uniforms.dashSize.value = value; } }, gapSize: { enumerable: true, get: function () { return this.uniforms.gapSize.value; }, set: function ( value ) { this.uniforms.gapSize.value = value; } }, resolution: { enumerable: true, get: function () { return this.uniforms.resolution.value; }, set: function ( value ) { this.uniforms.resolution.value.copy( value ); } } } ); this.setValues( parameters ); }; THREE.LineMaterial.prototype = Object.create( THREE.ShaderMaterial.prototype ); THREE.LineMaterial.prototype.constructor = THREE.LineMaterial; THREE.LineMaterial.prototype.isLineMaterial = true; THREE.LineMaterial.prototype.copy = function ( source ) { THREE.ShaderMaterial.prototype.copy.call( this, source ); this.color.copy( source.color ); this.linewidth = source.linewidth; this.resolution = source.resolution; // todo return this; }; ================================================ FILE: src/objects/customLines/LineSegments2.js ================================================ /** * @author WestLangley / http://github.com/WestLangley * */ THREE.LineSegments2 = function ( geometry, material ) { THREE.Mesh.call( this ); this.type = 'LineSegments2'; this.geometry = geometry !== undefined ? geometry : new THREE.LineSegmentsGeometry(); this.material = material !== undefined ? material : new THREE.LineMaterial( { color: Math.random() * 0xffffff } ); }; THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototype ), { constructor: THREE.LineSegments2, isLineSegments2: true, computeLineDistances: ( function () { // for backwards-compatability, but could be a method of LineSegmentsGeometry... var start = new THREE.Vector3(); var end = new THREE.Vector3(); return function computeLineDistances() { var geometry = this.geometry; var instanceStart = geometry.attributes.instanceStart; var instanceEnd = geometry.attributes.instanceEnd; var lineDistances = new Float32Array( 2 * instanceStart.data.count ); for ( var i = 0, j = 0, l = instanceStart.data.count; i < l; i ++, j += 2 ) { start.fromBufferAttribute( instanceStart, i ); end.fromBufferAttribute( instanceEnd, i ); lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ]; lineDistances[ j + 1 ] = lineDistances[ j ] + start.distanceTo( end ); } var instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1 geometry.addAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0 geometry.addAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1 return this; }; }() ), copy: function ( source ) { // todo return this; } } ); ================================================ FILE: src/objects/customLines/LineSegmentsGeometry.js ================================================ /** * @author WestLangley / http://github.com/WestLangley * */ THREE.LineSegmentsGeometry = function () { THREE.InstancedBufferGeometry.call( this ); this.type = 'LineSegmentsGeometry'; var plane = new THREE.BufferGeometry(); var positions = [ - 1, 2, 0, 1, 2, 0, - 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, - 1, - 1, 0, 1, - 1, 0 ]; var uvs = [ 0, 1, 1, 1, 0, .5, 1, .5, 0, .5, 1, .5, 0, 0, 1, 0 ]; var index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ]; this.setIndex( index ); this.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) ); this.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) ); }; THREE.LineSegmentsGeometry.prototype = Object.assign( Object.create( THREE.InstancedBufferGeometry.prototype ), { constructor: THREE.LineSegmentsGeometry, isLineSegmentsGeometry: true, applyMatrix: function ( matrix ) { var start = this.attributes.instanceStart; var end = this.attributes.instanceEnd; if ( start !== undefined ) { matrix.applyToBufferAttribute( start ); matrix.applyToBufferAttribute( end ); start.data.needsUpdate = true; } if ( this.boundingBox !== null ) { this.computeBoundingBox(); } if ( this.boundingSphere !== null ) { this.computeBoundingSphere(); } return this; }, setPositions: function ( array ) { var lineSegments; if ( array instanceof Float32Array ) { lineSegments = array; } else if ( Array.isArray( array ) ) { lineSegments = new Float32Array( array ); } var instanceBuffer = new THREE.InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz this.addAttribute( 'instanceStart', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz this.addAttribute( 'instanceEnd', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz // this.computeBoundingBox(); this.computeBoundingSphere(); return this; }, setColors: function ( array ) { var colors; if ( array instanceof Float32Array ) { colors = array; } else if ( Array.isArray( array ) ) { colors = new Float32Array( array ); } var instanceColorBuffer = new THREE.InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb this.addAttribute( 'instanceColorStart', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb this.addAttribute( 'instanceColorEnd', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb return this; }, fromWireframeGeometry: function ( geometry ) { this.setPositions( geometry.attributes.position.array ); return this; }, fromEdgesGeometry: function ( geometry ) { this.setPositions( geometry.attributes.position.array ); return this; }, fromMesh: function ( mesh ) { this.fromWireframeGeometry( new THREE.WireframeGeometry( mesh.geometry ) ); // set colors, maybe return this; }, fromLineSegements: function ( lineSegments ) { var geometry = lineSegments.geometry; if ( geometry.isGeometry ) { this.setPositions( geometry.vertices ); } else if ( geometry.isBufferGeometry ) { this.setPositions( geometry.position.array ); // assumes non-indexed } // set colors, maybe return this; }, computeBoundingBox: function () { var box = new THREE.Box3(); return function computeBoundingBox() { if ( this.boundingBox === null ) { this.boundingBox = new THREE.Box3(); } var start = this.attributes.instanceStart; var end = this.attributes.instanceEnd; if ( start !== undefined && end !== undefined ) { this.boundingBox.setFromBufferAttribute( start ); box.setFromBufferAttribute( end ); this.boundingBox.union( box ); } }; }(), computeBoundingSphere: function () { var vector = new THREE.Vector3(); return function computeBoundingSphere() { if ( this.boundingSphere === null ) { this.boundingSphere = new THREE.Sphere(); } if ( this.boundingBox === null ) { this.computeBoundingBox(); } var start = this.attributes.instanceStart; var end = this.attributes.instanceEnd; if ( start !== undefined && end !== undefined ) { var center = this.boundingSphere.center; this.boundingBox.getCenter( center ); var maxRadiusSq = 0; for ( var i = 0, il = start.count; i < il; i ++ ) { vector.fromBufferAttribute( start, i ); maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) ); vector.fromBufferAttribute( end, i ); maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) ); } this.boundingSphere.radius = Math.sqrt( maxRadiusSq ); if ( isNaN( this.boundingSphere.radius ) ) { console.error( 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this ); } } }; }(), toJSON: function () { // todo }, clone: function () { // todo }, copy: function ( source ) { // todo return this; } } ); ================================================ FILE: src/objects/customLines/Wireframe.js ================================================ /** * @author WestLangley / http://github.com/WestLangley * */ THREE.Wireframe = function ( geometry, material ) { THREE.Mesh.call( this ); this.type = 'Wireframe'; this.geometry = geometry !== undefined ? geometry : new THREE.LineSegmentsGeometry(); this.material = material !== undefined ? material : new THREE.LineMaterial( { color: Math.random() * 0xffffff } ); }; THREE.Wireframe.prototype = Object.assign( Object.create( THREE.Mesh.prototype ), { constructor: THREE.Wireframe, isWireframe: true, computeLineDistances: ( function () { // for backwards-compatability, but could be a method of LineSegmentsGeometry... var start = new THREE.Vector3(); var end = new THREE.Vector3(); return function computeLineDistances() { var geometry = this.geometry; var instanceStart = geometry.attributes.instanceStart; var instanceEnd = geometry.attributes.instanceEnd; var lineDistances = new Float32Array( 2 * instanceStart.data.count ); for ( var i = 0, j = 0, l = instanceStart.data.count; i < l; i ++, j += 2 ) { start.fromBufferAttribute( instanceStart, i ); end.fromBufferAttribute( instanceEnd, i ); lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ]; lineDistances[ j + 1 ] = lineDistances[ j ] + start.distanceTo( end ); } var instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1 geometry.addAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0 geometry.addAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1 return this; }; }() ), copy: function ( source ) { // todo return this; } } ); ================================================ FILE: src/objects/customLines/WireframeGeometry2.js ================================================ /** * @author WestLangley / http://github.com/WestLangley * */ THREE.WireframeGeometry2 = function ( geometry ) { THREE.LineSegmentsGeometry.call( this ); this.type = 'WireframeGeometry2'; this.fromWireframeGeometry( new THREE.WireframeGeometry( geometry ) ); // set colors, maybe }; THREE.WireframeGeometry2.prototype = Object.assign( Object.create( THREE.LineSegmentsGeometry.prototype ), { constructor: THREE.WireframeGeometry2, isWireframeGeometry2: true, copy: function ( source ) { // todo return this; } } ); ================================================ FILE: src/objects/line.js ================================================ var THREE = require("../three.js"); var utils = require("../utils/utils.js"); var Objects = require('./objects.js'); function line(obj){ obj = utils._validate(obj, Objects.prototype._defaults.line); // Geometry var straightProject = utils.lnglatsToWorld(obj.geometry); var normalized = utils.normalizeVertices(straightProject); var flattenedArray = utils.flattenVectors(normalized.vertices); console.log('line', normalized.vertices) var geometry = new THREE.LineGeometry(); geometry.setPositions( flattenedArray ); // geometry.setColors( colors ); // Material matLine = new THREE.LineMaterial( { color: obj.color, linewidth: obj.width, // in pixels dashed: false, opacity: obj.opacity } ); matLine.resolution.set( window.innerWidth, window.innerHeight ); matLine.isMaterial = true; matLine.transparent = true; matLine.depthWrite = false; // Mesh line = new THREE.Line2( geometry, matLine ); line.position.copy(normalized.position) line.computeLineDistances(); return line } module.exports = exports = line; /** * custom line shader by WestLangley, sourced from https://github.com/mrdoob/three.js/tree/master/examples/js/lines * */ THREE.LineSegmentsGeometry = function () { THREE.InstancedBufferGeometry.call( this ); this.type = 'LineSegmentsGeometry'; var plane = new THREE.BufferGeometry(); var positions = [ - 1, 2, 0, 1, 2, 0, - 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, - 1, - 1, 0, 1, - 1, 0 ]; var uvs = [ 0, 1, 1, 1, 0, .5, 1, .5, 0, .5, 1, .5, 0, 0, 1, 0 ]; var index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ]; this.setIndex( index ); this.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) ); this.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) ); }; THREE.LineSegmentsGeometry.prototype = Object.assign( Object.create( THREE.InstancedBufferGeometry.prototype ), { constructor: THREE.LineSegmentsGeometry, isLineSegmentsGeometry: true, applyMatrix: function ( matrix ) { var start = this.attributes.instanceStart; var end = this.attributes.instanceEnd; if ( start !== undefined ) { matrix.applyToBufferAttribute( start ); matrix.applyToBufferAttribute( end ); start.data.needsUpdate = true; } if ( this.boundingBox !== null ) { this.computeBoundingBox(); } if ( this.boundingSphere !== null ) { this.computeBoundingSphere(); } return this; }, setPositions: function ( array ) { var lineSegments; if ( array instanceof Float32Array ) { lineSegments = array; } else if ( Array.isArray( array ) ) { lineSegments = new Float32Array( array ); } var instanceBuffer = new THREE.InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz this.addAttribute( 'instanceStart', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz this.addAttribute( 'instanceEnd', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz // this.computeBoundingBox(); this.computeBoundingSphere(); return this; }, setColors: function ( array ) { var colors; if ( array instanceof Float32Array ) { colors = array; } else if ( Array.isArray( array ) ) { colors = new Float32Array( array ); } var instanceColorBuffer = new THREE.InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb this.addAttribute( 'instanceColorStart', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb this.addAttribute( 'instanceColorEnd', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb return this; }, fromWireframeGeometry: function ( geometry ) { this.setPositions( geometry.attributes.position.array ); return this; }, fromEdgesGeometry: function ( geometry ) { this.setPositions( geometry.attributes.position.array ); return this; }, fromMesh: function ( mesh ) { this.fromWireframeGeometry( new THREE.WireframeGeometry( mesh.geometry ) ); // set colors, maybe return this; }, fromLineSegements: function ( lineSegments ) { var geometry = lineSegments.geometry; if ( geometry.isGeometry ) { this.setPositions( geometry.vertices ); } else if ( geometry.isBufferGeometry ) { this.setPositions( geometry.position.array ); // assumes non-indexed } // set colors, maybe return this; }, computeBoundingBox: function () { var box = new THREE.Box3(); return function computeBoundingBox() { if ( this.boundingBox === null ) { this.boundingBox = new THREE.Box3(); } var start = this.attributes.instanceStart; var end = this.attributes.instanceEnd; if ( start !== undefined && end !== undefined ) { this.boundingBox.setFromBufferAttribute( start ); box.setFromBufferAttribute( end ); this.boundingBox.union( box ); } }; }(), computeBoundingSphere: function () { var vector = new THREE.Vector3(); return function computeBoundingSphere() { if ( this.boundingSphere === null ) { this.boundingSphere = new THREE.Sphere(); } if ( this.boundingBox === null ) { this.computeBoundingBox(); } var start = this.attributes.instanceStart; var end = this.attributes.instanceEnd; if ( start !== undefined && end !== undefined ) { var center = this.boundingSphere.center; this.boundingBox.getCenter( center ); var maxRadiusSq = 0; for ( var i = 0, il = start.count; i < il; i ++ ) { vector.fromBufferAttribute( start, i ); maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) ); vector.fromBufferAttribute( end, i ); maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) ); } this.boundingSphere.radius = Math.sqrt( maxRadiusSq ); if ( isNaN( this.boundingSphere.radius ) ) { console.error( 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this ); } } }; }(), toJSON: function () { // todo }, clone: function () { // todo }, copy: function ( source ) { // todo return this; } } ); /** * @author WestLangley / http://github.com/WestLangley * */ THREE.LineGeometry = function () { THREE.LineSegmentsGeometry.call( this ); this.type = 'LineGeometry'; }; THREE.LineGeometry.prototype = Object.assign( Object.create( THREE.LineSegmentsGeometry.prototype ), { constructor: THREE.LineGeometry, isLineGeometry: true, setPositions: function ( array ) { // converts [ x1, y1, z1, x2, y2, z2, ... ] to pairs format var length = array.length - 3; var points = new Float32Array( 2 * length ); for ( var i = 0; i < length; i += 3 ) { points[ 2 * i ] = array[ i ]; points[ 2 * i + 1 ] = array[ i + 1 ]; points[ 2 * i + 2 ] = array[ i + 2 ]; points[ 2 * i + 3 ] = array[ i + 3 ]; points[ 2 * i + 4 ] = array[ i + 4 ]; points[ 2 * i + 5 ] = array[ i + 5 ]; } THREE.LineSegmentsGeometry.prototype.setPositions.call( this, points ); return this; }, setColors: function ( array ) { // converts [ r1, g1, b1, r2, g2, b2, ... ] to pairs format var length = array.length - 3; var colors = new Float32Array( 2 * length ); for ( var i = 0; i < length; i += 3 ) { colors[ 2 * i ] = array[ i ]; colors[ 2 * i + 1 ] = array[ i + 1 ]; colors[ 2 * i + 2 ] = array[ i + 2 ]; colors[ 2 * i + 3 ] = array[ i + 3 ]; colors[ 2 * i + 4 ] = array[ i + 4 ]; colors[ 2 * i + 5 ] = array[ i + 5 ]; } THREE.LineSegmentsGeometry.prototype.setColors.call( this, colors ); return this; }, fromLine: function ( line ) { var geometry = line.geometry; if ( geometry.isGeometry ) { this.setPositions( geometry.vertices ); } else if ( geometry.isBufferGeometry ) { this.setPositions( geometry.position.array ); // assumes non-indexed } // set colors, maybe return this; }, copy: function ( source ) { // todo return this; } } ); /** * @author WestLangley / http://github.com/WestLangley * */ THREE.WireframeGeometry2 = function ( geometry ) { THREE.LineSegmentsGeometry.call( this ); this.type = 'WireframeGeometry2'; this.fromWireframeGeometry( new THREE.WireframeGeometry( geometry ) ); // set colors, maybe }; THREE.WireframeGeometry2.prototype = Object.assign( Object.create( THREE.LineSegmentsGeometry.prototype ), { constructor: THREE.WireframeGeometry2, isWireframeGeometry2: true, copy: function ( source ) { // todo return this; } } ); /** * @author WestLangley / http://github.com/WestLangley * * parameters = { * color: , * linewidth: , * dashed: , * dashScale: , * dashSize: , * gapSize: , * resolution: , // to be set by renderer * } */ THREE.UniformsLib.line = { linewidth: { value: 1 }, resolution: { value: new THREE.Vector2( 1, 1 ) }, dashScale: { value: 1 }, dashSize: { value: 1 }, gapSize: { value: 1 } // todo FIX - maybe change to totalSize }; THREE.ShaderLib[ 'line' ] = { uniforms: THREE.UniformsUtils.merge( [ THREE.UniformsLib.common, THREE.UniformsLib.fog, THREE.UniformsLib.line ] ), vertexShader: ` #include #include #include #include #include uniform float linewidth; uniform vec2 resolution; attribute vec3 instanceStart; attribute vec3 instanceEnd; attribute vec3 instanceColorStart; attribute vec3 instanceColorEnd; varying vec2 vUv; #ifdef USE_DASH uniform float dashScale; attribute float instanceDistanceStart; attribute float instanceDistanceEnd; varying float vLineDistance; #endif void trimSegment( const in vec4 start, inout vec4 end ) { // trim end segment so it terminates between the camera plane and the near plane // conservative estimate of the near plane float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column float nearEstimate = - 0.5 * b / a; float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); end.xyz = mix( start.xyz, end.xyz, alpha ); } void main() { #ifdef USE_COLOR vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; #endif #ifdef USE_DASH vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; #endif float aspect = resolution.x / resolution.y; vUv = uv; // camera space vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); // special case for perspective projection, and segments that terminate either in, or behind, the camera plane // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space // but we need to perform ndc-space calculations in the shader, so we must address this issue directly // perhaps there is a more elegant solution -- WestLangley bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column if ( perspective ) { if ( start.z < 0.0 && end.z >= 0.0 ) { trimSegment( start, end ); } else if ( end.z < 0.0 && start.z >= 0.0 ) { trimSegment( end, start ); } } // clip space vec4 clipStart = projectionMatrix * start; vec4 clipEnd = projectionMatrix * end; // ndc space vec2 ndcStart = clipStart.xy / clipStart.w; vec2 ndcEnd = clipEnd.xy / clipEnd.w; // direction vec2 dir = ndcEnd - ndcStart; // account for clip-space aspect ratio dir.x *= aspect; dir = normalize( dir ); // perpendicular to dir vec2 offset = vec2( dir.y, - dir.x ); // undo aspect ratio adjustment dir.x /= aspect; offset.x /= aspect; // sign flip if ( position.x < 0.0 ) offset *= - 1.0; // endcaps if ( position.y < 0.0 ) { offset += - dir; } else if ( position.y > 1.0 ) { offset += dir; } // adjust for linewidth offset *= linewidth; // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... offset /= resolution.y; // select end vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; // back to clip space offset *= clip.w; clip.xy += offset; gl_Position = clip; #include #include #include #include } `, fragmentShader: ` uniform vec3 diffuse; uniform float opacity; #ifdef USE_DASH uniform float dashSize; uniform float gapSize; #endif varying float vLineDistance; #include #include #include #include #include varying vec2 vUv; void main() { #include #ifdef USE_DASH if ( vUv.y < 0.5 || vUv.y > 0.5 ) discard; // discard endcaps if ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX #endif if ( vUv.y < 0.5 || vUv.y > 0.5 ) { float a = vUv.x - 0.5; float b = vUv.y - 0.5; float len2 = a * a + b * b; if ( len2 > 0.25 ) discard; } vec4 diffuseColor = vec4( diffuse, opacity ); #include #include gl_FragColor = vec4( diffuseColor.rgb, opacity ); #include #include #include #include } ` }; THREE.LineMaterial = function ( parameters ) { var lineUniforms = THREE.UniformsUtils.clone( THREE.ShaderLib[ 'line' ].uniforms ); lineUniforms.opacity.value = parameters.opacity; THREE.ShaderMaterial.call( this, { type: 'LineMaterial', uniforms: lineUniforms, vertexShader: THREE.ShaderLib[ 'line' ].vertexShader, fragmentShader: THREE.ShaderLib[ 'line' ].fragmentShader } ); this.dashed = false; Object.defineProperties( this, { color: { enumerable: true, get: function () { return this.uniforms.diffuse.value; }, set: function ( value ) { this.uniforms.diffuse.value = value; } }, linewidth: { enumerable: true, get: function () { return this.uniforms.linewidth.value; }, set: function ( value ) { this.uniforms.linewidth.value = value; } }, dashScale: { enumerable: true, get: function () { return this.uniforms.dashScale.value; }, set: function ( value ) { this.uniforms.dashScale.value = value; } }, dashSize: { enumerable: true, get: function () { return this.uniforms.dashSize.value; }, set: function ( value ) { this.uniforms.dashSize.value = value; } }, gapSize: { enumerable: true, get: function () { return this.uniforms.gapSize.value; }, set: function ( value ) { this.uniforms.gapSize.value = value; } }, resolution: { enumerable: true, get: function () { return this.uniforms.resolution.value; }, set: function ( value ) { this.uniforms.resolution.value.copy( value ); } } } ); this.setValues( parameters ); }; THREE.LineMaterial.prototype = Object.create( THREE.ShaderMaterial.prototype ); THREE.LineMaterial.prototype.constructor = THREE.LineMaterial; THREE.LineMaterial.prototype.isLineMaterial = true; THREE.LineMaterial.prototype.copy = function ( source ) { THREE.ShaderMaterial.prototype.copy.call( this, source ); this.color.copy( source.color ); this.linewidth = source.linewidth; this.resolution = source.resolution; // todo return this; }; /** * @author WestLangley / http://github.com/WestLangley * */ THREE.LineSegments2 = function ( geometry, material ) { THREE.Mesh.call( this ); this.type = 'LineSegments2'; this.geometry = geometry !== undefined ? geometry : new THREE.LineSegmentsGeometry(); this.material = material !== undefined ? material : new THREE.LineMaterial( { color: Math.random() * 0xffffff } ); }; THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototype ), { constructor: THREE.LineSegments2, isLineSegments2: true, computeLineDistances: ( function () { // for backwards-compatability, but could be a method of LineSegmentsGeometry... var start = new THREE.Vector3(); var end = new THREE.Vector3(); return function computeLineDistances() { var geometry = this.geometry; var instanceStart = geometry.attributes.instanceStart; var instanceEnd = geometry.attributes.instanceEnd; var lineDistances = new Float32Array( 2 * instanceStart.data.count ); for ( var i = 0, j = 0, l = instanceStart.data.count; i < l; i ++, j += 2 ) { start.fromBufferAttribute( instanceStart, i ); end.fromBufferAttribute( instanceEnd, i ); lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ]; lineDistances[ j + 1 ] = lineDistances[ j ] + start.distanceTo( end ); } var instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1 geometry.addAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0 geometry.addAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1 return this; }; }() ), copy: function ( source ) { // todo return this; } } ); /** * @author WestLangley / http://github.com/WestLangley * */ THREE.Line2 = function ( geometry, material ) { THREE.LineSegments2.call( this ); this.type = 'Line2'; this.geometry = geometry !== undefined ? geometry : new THREE.LineGeometry(); this.material = material !== undefined ? material : new THREE.LineMaterial( { color: Math.random() * 0xffffff } ); }; THREE.Line2.prototype = Object.assign( Object.create( THREE.LineSegments2.prototype ), { constructor: THREE.Line2, isLine2: true, copy: function ( source ) { // todo return this; } } ); /** * @author WestLangley / http://github.com/WestLangley * */ THREE.Wireframe = function ( geometry, material ) { THREE.Mesh.call( this ); this.type = 'Wireframe'; this.geometry = geometry !== undefined ? geometry : new THREE.LineSegmentsGeometry(); this.material = material !== undefined ? material : new THREE.LineMaterial( { color: Math.random() * 0xffffff } ); }; THREE.Wireframe.prototype = Object.assign( Object.create( THREE.Mesh.prototype ), { constructor: THREE.Wireframe, isWireframe: true, computeLineDistances: ( function () { // for backwards-compatability, but could be a method of LineSegmentsGeometry... var start = new THREE.Vector3(); var end = new THREE.Vector3(); return function computeLineDistances() { var geometry = this.geometry; var instanceStart = geometry.attributes.instanceStart; var instanceEnd = geometry.attributes.instanceEnd; var lineDistances = new Float32Array( 2 * instanceStart.data.count ); for ( var i = 0, j = 0, l = instanceStart.data.count; i < l; i ++, j += 2 ) { start.fromBufferAttribute( instanceStart, i ); end.fromBufferAttribute( instanceEnd, i ); lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ]; lineDistances[ j + 1 ] = lineDistances[ j ] + start.distanceTo( end ); } var instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1 geometry.addAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0 geometry.addAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1 return this; }; }() ), copy: function ( source ) { // todo return this; } } ); ================================================ FILE: src/objects/loadObj.js ================================================ var utils = require("../utils/utils.js"); var Objects = require('./objects.js'); const OBJLoader = require("./loaders/OBJLoader.js"); const MTLLoader = require("./loaders/MTLLoader.js"); function loadObj(options, cb){ if (options === undefined) return console.error("Invalid options provided to loadObj()"); this.loaded = false; const modelComplete = (m) => { console.log("Model complete!", m); if(--remaining === 0) this.loaded = true; } // TODO: Support formats other than OBJ/MTL const objLoader = new OBJLoader(); const materialLoader = new MTLLoader(); materialLoader.load(options.mtl, loadObject, () => (null), error => { console.warn("No material file found for SymbolLayer3D model " + m); }); function loadObject(materials) { if (materials) { materials.preload(); objLoader.setMaterials( materials ); } objLoader.load(options.obj, obj => { var r = utils.types.rotation(options, [0, 0, 0]); var s = utils.types.scale(options, [1, 1, 1]); obj = obj.children[0]; obj.rotation.set(r[0] + Math.PI/2, r[1] + Math.PI, r[2]); obj.scale.set(s[0], s[1], s[2]); var projScaleGroup = new THREE.Group(); projScaleGroup.add(obj) var userScaleGroup = Objects.prototype._makeGroup(projScaleGroup, options); Objects.prototype._addMethods(userScaleGroup); cb(userScaleGroup); }, () => (null), error => { console.error("Could not load model file."); } ); }; } module.exports = exports = loadObj; ================================================ FILE: src/objects/loaders/MTLLoader.js ================================================ /** * Loads a Wavefront .mtl file specifying materials * * @author angelxuanchang */ const THREE = require('../../three.js'); const MTLLoader = function ( manager ) { this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; }; MTLLoader.prototype = { constructor: MTLLoader, /** * Loads and parses a MTL asset from a URL. * * @param {String} url - URL to the MTL file. * @param {Function} [onLoad] - Callback invoked with the loaded object. * @param {Function} [onProgress] - Callback for download progress. * @param {Function} [onError] - Callback for download errors. * * @see setPath setTexturePath * * @note In order for relative texture references to resolve correctly * you must call setPath and/or setTexturePath explicitly prior to load. */ load: function ( url, onLoad, onProgress, onError ) { var scope = this; var loader = new THREE.FileLoader( this.manager ); loader.setPath( this.path ); loader.load( url, function ( text ) { onLoad( scope.parse( text ) ); }, onProgress, onError ); }, /** * Set base path for resolving references. * If set this path will be prepended to each loaded and found reference. * * @see setTexturePath * @param {String} path * * @example * mtlLoader.setPath( 'assets/obj/' ); * mtlLoader.load( 'my.mtl', ... ); */ setPath: function ( path ) { this.path = path; }, /** * Set base path for resolving texture references. * If set this path will be prepended found texture reference. * If not set and setPath is, it will be used as texture base path. * * @see setPath * @param {String} path * * @example * mtlLoader.setPath( 'assets/obj/' ); * mtlLoader.setTexturePath( 'assets/textures/' ); * mtlLoader.load( 'my.mtl', ... ); */ setTexturePath: function ( path ) { this.texturePath = path; }, setBaseUrl: function ( path ) { console.warn( 'THREE.MTLLoader: .setBaseUrl() is deprecated. Use .setTexturePath( path ) for texture path or .setPath( path ) for general base path instead.' ); this.setTexturePath( path ); }, setCrossOrigin: function ( value ) { this.crossOrigin = value; }, setMaterialOptions: function ( value ) { this.materialOptions = value; }, /** * Parses a MTL file. * * @param {String} text - Content of MTL file * @return {THREE.MTLLoader.MaterialCreator} * * @see setPath setTexturePath * * @note In order for relative texture references to resolve correctly * you must call setPath and/or setTexturePath explicitly prior to parse. */ parse: function ( text ) { var lines = text.split( '\n' ); var info = {}; var delimiter_pattern = /\s+/; var materialsInfo = {}; for ( var i = 0; i < lines.length; i ++ ) { var line = lines[ i ]; line = line.trim(); if ( line.length === 0 || line.charAt( 0 ) === '#' ) { // Blank line or comment ignore continue; } var pos = line.indexOf( ' ' ); var key = ( pos >= 0 ) ? line.substring( 0, pos ) : line; key = key.toLowerCase(); var value = ( pos >= 0 ) ? line.substring( pos + 1 ) : ''; value = value.trim(); if ( key === 'newmtl' ) { // New material info = { name: value }; materialsInfo[ value ] = info; } else if ( info ) { if ( key === 'ka' || key === 'kd' || key === 'ks' ) { var ss = value.split( delimiter_pattern, 3 ); info[ key ] = [ parseFloat( ss[ 0 ] ), parseFloat( ss[ 1 ] ), parseFloat( ss[ 2 ] ) ]; } else { info[ key ] = value; } } } var materialCreator = new MTLLoader.MaterialCreator( this.texturePath || this.path, this.materialOptions ); materialCreator.setCrossOrigin( this.crossOrigin ); materialCreator.setManager( this.manager ); materialCreator.setMaterials( materialsInfo ); return materialCreator; } }; /** * Create a new THREE-MTLLoader.MaterialCreator * @param baseUrl - Url relative to which textures are loaded * @param options - Set of options on how to construct the materials * side: Which side to apply the material * THREE.FrontSide (default), THREE.BackSide, THREE.DoubleSide * wrap: What type of wrapping to apply for textures * THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping * normalizeRGB: RGBs need to be normalized to 0-1 from 0-255 * Default: false, assumed to be already normalized * ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's * Default: false * @constructor */ MTLLoader.MaterialCreator = function ( baseUrl, options ) { this.baseUrl = baseUrl || ''; this.options = options; this.materialsInfo = {}; this.materials = {}; this.materialsArray = []; this.nameLookup = {}; this.side = ( this.options && this.options.side ) ? this.options.side : THREE.FrontSide; this.wrap = ( this.options && this.options.wrap ) ? this.options.wrap : THREE.RepeatWrapping; }; MTLLoader.MaterialCreator.prototype = { constructor: MTLLoader.MaterialCreator, setCrossOrigin: function ( value ) { this.crossOrigin = value; }, setManager: function ( value ) { this.manager = value; }, setMaterials: function ( materialsInfo ) { this.materialsInfo = this.convert( materialsInfo ); this.materials = {}; this.materialsArray = []; this.nameLookup = {}; }, convert: function ( materialsInfo ) { if ( ! this.options ) return materialsInfo; var converted = {}; for ( var mn in materialsInfo ) { // Convert materials info into normalized form based on options var mat = materialsInfo[ mn ]; var covmat = {}; converted[ mn ] = covmat; for ( var prop in mat ) { var save = true; var value = mat[ prop ]; var lprop = prop.toLowerCase(); switch ( lprop ) { case 'kd': case 'ka': case 'ks': // Diffuse color (color under white light) using RGB values if ( this.options && this.options.normalizeRGB ) { value = [ value[ 0 ] / 255, value[ 1 ] / 255, value[ 2 ] / 255 ]; } if ( this.options && this.options.ignoreZeroRGBs ) { if ( value[ 0 ] === 0 && value[ 1 ] === 0 && value[ 2 ] === 0 ) { // ignore save = false; } } break; default: break; } if ( save ) { covmat[ lprop ] = value; } } } return converted; }, preload: function () { for ( var mn in this.materialsInfo ) { this.create( mn ); } }, getIndex: function ( materialName ) { return this.nameLookup[ materialName ]; }, getAsArray: function () { var index = 0; for ( var mn in this.materialsInfo ) { this.materialsArray[ index ] = this.create( mn ); this.nameLookup[ mn ] = index; index ++; } return this.materialsArray; }, create: function ( materialName ) { if ( this.materials[ materialName ] === undefined ) { this.createMaterial_( materialName ); } return this.materials[ materialName ]; }, createMaterial_: function ( materialName ) { // Create material var scope = this; var mat = this.materialsInfo[ materialName ]; var params = { name: materialName, side: this.side }; function resolveURL( baseUrl, url ) { if ( typeof url !== 'string' || url === '' ) return ''; // Absolute URL if ( /^https?:\/\//i.test( url ) ) return url; return baseUrl + url; } function setMapForType( mapType, value ) { if ( params[ mapType ] ) return; // Keep the first encountered texture var texParams = scope.getTextureParams( value, params ); var map = scope.loadTexture( resolveURL( scope.baseUrl, texParams.url ) ); map.repeat.copy( texParams.scale ); map.offset.copy( texParams.offset ); map.wrapS = scope.wrap; map.wrapT = scope.wrap; params[ mapType ] = map; } for ( var prop in mat ) { var value = mat[ prop ]; if ( value === '' ) continue; switch ( prop.toLowerCase() ) { // Ns is material specular exponent case 'kd': // Diffuse color (color under white light) using RGB values params.color = new THREE.Color().fromArray( value ); break; case 'ks': // Specular color (color when light is reflected from shiny surface) using RGB values params.specular = new THREE.Color().fromArray( value ); break; case 'map_kd': // Diffuse texture map setMapForType( "map", value ); break; case 'map_ks': // Specular map setMapForType( "specularMap", value ); break; case 'map_bump': case 'bump': // Bump texture map setMapForType( "bumpMap", value ); break; case 'ns': // The specular exponent (defines the focus of the specular highlight) // A high exponent results in a tight, concentrated highlight. Ns values normally range from 0 to 1000. params.shininess = parseFloat( value ); break; case 'd': if ( value < 1 ) { params.opacity = value; params.transparent = true; } break; case 'Tr': if ( value > 0 ) { params.opacity = 1 - value; params.transparent = true; } break; default: break; } } this.materials[ materialName ] = new THREE.MeshPhongMaterial( params ); return this.materials[ materialName ]; }, getTextureParams: function ( value, matParams ) { var texParams = { scale: new THREE.Vector2( 1, 1 ), offset: new THREE.Vector2( 0, 0 ) }; var items = value.split( /\s+/ ); var pos; pos = items.indexOf( '-bm' ); if ( pos >= 0 ) { matParams.bumpScale = parseFloat( items[ pos + 1 ] ); items.splice( pos, 2 ); } pos = items.indexOf( '-s' ); if ( pos >= 0 ) { texParams.scale.set( parseFloat( items[ pos + 1 ] ), parseFloat( items[ pos + 2 ] ) ); items.splice( pos, 4 ); // we expect 3 parameters here! } pos = items.indexOf( '-o' ); if ( pos >= 0 ) { texParams.offset.set( parseFloat( items[ pos + 1 ] ), parseFloat( items[ pos + 2 ] ) ); items.splice( pos, 4 ); // we expect 3 parameters here! } texParams.url = items.join( ' ' ).trim(); return texParams; }, loadTexture: function ( url, mapping, onLoad, onProgress, onError ) { var texture; var loader = THREE.Loader.Handlers.get( url ); var manager = ( this.manager !== undefined ) ? this.manager : THREE.DefaultLoadingManager; if ( loader === null ) { loader = new THREE.TextureLoader( manager ); } if ( loader.setCrossOrigin ) loader.setCrossOrigin( this.crossOrigin ); texture = loader.load( url, onLoad, onProgress, onError ); if ( mapping !== undefined ) texture.mapping = mapping; return texture; } }; module.exports = exports = MTLLoader; ================================================ FILE: src/objects/loaders/OBJLoader.js ================================================ /** * @author mrdoob / http://mrdoob.com/ */ const THREE = require('../../three.js'); const OBJLoader = function ( manager ) { this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; this.materials = null; this.regexp = { // v float float float vertex_pattern : /^v\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/, // vn float float float normal_pattern : /^vn\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/, // vt float float uv_pattern : /^vt\s+([\d|\.|\+|\-|e|E]+)\s+([\d|\.|\+|\-|e|E]+)/, // f vertex vertex vertex face_vertex : /^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/, // f vertex/uv vertex/uv vertex/uv face_vertex_uv : /^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/, // f vertex/uv/normal vertex/uv/normal vertex/uv/normal face_vertex_uv_normal : /^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/, // f vertex//normal vertex//normal vertex//normal face_vertex_normal : /^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/, // o object_name | g group_name object_pattern : /^[og]\s*(.+)?/, // s boolean smoothing_pattern : /^s\s+(\d+|on|off)/, // mtllib file_reference material_library_pattern : /^mtllib /, // usemtl material_name material_use_pattern : /^usemtl / }; }; OBJLoader.prototype = { constructor: OBJLoader, load: function ( url, onLoad, onProgress, onError ) { var scope = this; var loader = new THREE.FileLoader( scope.manager ); loader.setPath( this.path ); loader.load( url, function ( text ) { onLoad( scope.parse( text ) ); }, onProgress, onError ); }, setPath: function ( value ) { this.path = value; }, setMaterials: function ( materials ) { this.materials = materials; }, _createParserState : function () { var state = { objects : [], object : {}, vertices : [], normals : [], uvs : [], materialLibraries : [], startObject: function ( name, fromDeclaration ) { // If the current object (initial from reset) is not from a g/o declaration in the parsed // file. We need to use it for the first parsed g/o to keep things in sync. if ( this.object && this.object.fromDeclaration === false ) { this.object.name = name; this.object.fromDeclaration = ( fromDeclaration !== false ); return; } var previousMaterial = ( this.object && typeof this.object.currentMaterial === 'function' ? this.object.currentMaterial() : undefined ); if ( this.object && typeof this.object._finalize === 'function' ) { this.object._finalize( true ); } this.object = { name : name || '', fromDeclaration : ( fromDeclaration !== false ), geometry : { vertices : [], normals : [], uvs : [] }, materials : [], smooth : true, startMaterial : function( name, libraries ) { var previous = this._finalize( false ); // New usemtl declaration overwrites an inherited material, except if faces were declared // after the material, then it must be preserved for proper MultiMaterial continuation. if ( previous && ( previous.inherited || previous.groupCount <= 0 ) ) { this.materials.splice( previous.index, 1 ); } var material = { index : this.materials.length, name : name || '', mtllib : ( Array.isArray( libraries ) && libraries.length > 0 ? libraries[ libraries.length - 1 ] : '' ), smooth : ( previous !== undefined ? previous.smooth : this.smooth ), groupStart : ( previous !== undefined ? previous.groupEnd : 0 ), groupEnd : -1, groupCount : -1, inherited : false, clone : function( index ) { var cloned = { index : ( typeof index === 'number' ? index : this.index ), name : this.name, mtllib : this.mtllib, smooth : this.smooth, groupStart : 0, groupEnd : -1, groupCount : -1, inherited : false }; cloned.clone = this.clone.bind(cloned); return cloned; } }; this.materials.push( material ); return material; }, currentMaterial : function() { if ( this.materials.length > 0 ) { return this.materials[ this.materials.length - 1 ]; } return undefined; }, _finalize : function( end ) { var lastMultiMaterial = this.currentMaterial(); if ( lastMultiMaterial && lastMultiMaterial.groupEnd === -1 ) { lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3; lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart; lastMultiMaterial.inherited = false; } // Ignore objects tail materials if no face declarations followed them before a new o/g started. if ( end && this.materials.length > 1 ) { for ( var mi = this.materials.length - 1; mi >= 0; mi-- ) { if ( this.materials[mi].groupCount <= 0 ) { this.materials.splice( mi, 1 ); } } } // Guarantee at least one empty material, this makes the creation later more straight forward. if ( end && this.materials.length === 0 ) { this.materials.push({ name : '', smooth : this.smooth }); } return lastMultiMaterial; } }; // Inherit previous objects material. // Spec tells us that a declared material must be set to all objects until a new material is declared. // If a usemtl declaration is encountered while this new object is being parsed, it will // overwrite the inherited material. Exception being that there was already face declarations // to the inherited material, then it will be preserved for proper MultiMaterial continuation. if ( previousMaterial && previousMaterial.name && typeof previousMaterial.clone === "function" ) { var declared = previousMaterial.clone( 0 ); declared.inherited = true; this.object.materials.push( declared ); } this.objects.push( this.object ); }, finalize : function() { if ( this.object && typeof this.object._finalize === 'function' ) { this.object._finalize( true ); } }, parseVertexIndex: function ( value, len ) { var index = parseInt( value, 10 ); return ( index >= 0 ? index - 1 : index + len / 3 ) * 3; }, parseNormalIndex: function ( value, len ) { var index = parseInt( value, 10 ); return ( index >= 0 ? index - 1 : index + len / 3 ) * 3; }, parseUVIndex: function ( value, len ) { var index = parseInt( value, 10 ); return ( index >= 0 ? index - 1 : index + len / 2 ) * 2; }, addVertex: function ( a, b, c ) { var src = this.vertices; var dst = this.object.geometry.vertices; dst.push( src[ a + 0 ] ); dst.push( src[ a + 1 ] ); dst.push( src[ a + 2 ] ); dst.push( src[ b + 0 ] ); dst.push( src[ b + 1 ] ); dst.push( src[ b + 2 ] ); dst.push( src[ c + 0 ] ); dst.push( src[ c + 1 ] ); dst.push( src[ c + 2 ] ); }, addVertexLine: function ( a ) { var src = this.vertices; var dst = this.object.geometry.vertices; dst.push( src[ a + 0 ] ); dst.push( src[ a + 1 ] ); dst.push( src[ a + 2 ] ); }, addNormal : function ( a, b, c ) { var src = this.normals; var dst = this.object.geometry.normals; dst.push( src[ a + 0 ] ); dst.push( src[ a + 1 ] ); dst.push( src[ a + 2 ] ); dst.push( src[ b + 0 ] ); dst.push( src[ b + 1 ] ); dst.push( src[ b + 2 ] ); dst.push( src[ c + 0 ] ); dst.push( src[ c + 1 ] ); dst.push( src[ c + 2 ] ); }, addUV: function ( a, b, c ) { var src = this.uvs; var dst = this.object.geometry.uvs; dst.push( src[ a + 0 ] ); dst.push( src[ a + 1 ] ); dst.push( src[ b + 0 ] ); dst.push( src[ b + 1 ] ); dst.push( src[ c + 0 ] ); dst.push( src[ c + 1 ] ); }, addUVLine: function ( a ) { var src = this.uvs; var dst = this.object.geometry.uvs; dst.push( src[ a + 0 ] ); dst.push( src[ a + 1 ] ); }, addFace: function ( a, b, c, d, ua, ub, uc, ud, na, nb, nc, nd ) { var vLen = this.vertices.length; var ia = this.parseVertexIndex( a, vLen ); var ib = this.parseVertexIndex( b, vLen ); var ic = this.parseVertexIndex( c, vLen ); var id; if ( d === undefined ) { this.addVertex( ia, ib, ic ); } else { id = this.parseVertexIndex( d, vLen ); this.addVertex( ia, ib, id ); this.addVertex( ib, ic, id ); } if ( ua !== undefined ) { var uvLen = this.uvs.length; ia = this.parseUVIndex( ua, uvLen ); ib = this.parseUVIndex( ub, uvLen ); ic = this.parseUVIndex( uc, uvLen ); if ( d === undefined ) { this.addUV( ia, ib, ic ); } else { id = this.parseUVIndex( ud, uvLen ); this.addUV( ia, ib, id ); this.addUV( ib, ic, id ); } } if ( na !== undefined ) { // Normals are many times the same. If so, skip function call and parseInt. var nLen = this.normals.length; ia = this.parseNormalIndex( na, nLen ); ib = na === nb ? ia : this.parseNormalIndex( nb, nLen ); ic = na === nc ? ia : this.parseNormalIndex( nc, nLen ); if ( d === undefined ) { this.addNormal( ia, ib, ic ); } else { id = this.parseNormalIndex( nd, nLen ); this.addNormal( ia, ib, id ); this.addNormal( ib, ic, id ); } } }, addLineGeometry: function ( vertices, uvs ) { this.object.geometry.type = 'Line'; var vLen = this.vertices.length; var uvLen = this.uvs.length; for ( var vi = 0, l = vertices.length; vi < l; vi ++ ) { this.addVertexLine( this.parseVertexIndex( vertices[ vi ], vLen ) ); } for ( var uvi = 0, l = uvs.length; uvi < l; uvi ++ ) { this.addUVLine( this.parseUVIndex( uvs[ uvi ], uvLen ) ); } } }; state.startObject( '', false ); return state; }, parse: function ( text ) { //console.time( 'OBJLoader' ); var state = this._createParserState(); if ( text.indexOf( '\r\n' ) !== - 1 ) { // This is faster than String.split with regex that splits on both text = text.replace( /\r\n/g, '\n' ); } if ( text.indexOf( '\\\n' ) !== - 1) { // join lines separated by a line continuation character (\) text = text.replace( /\\\n/g, '' ); } var lines = text.split( '\n' ); var line = '', lineFirstChar = '', lineSecondChar = ''; var lineLength = 0; var result = []; // Faster to just trim left side of the line. Use if available. var trimLeft = ( typeof ''.trimLeft === 'function' ); for ( var i = 0, l = lines.length; i < l; i ++ ) { line = lines[ i ]; line = trimLeft ? line.trimLeft() : line.trim(); lineLength = line.length; if ( lineLength === 0 ) continue; lineFirstChar = line.charAt( 0 ); // @todo invoke passed in handler if any if ( lineFirstChar === '#' ) continue; if ( lineFirstChar === 'v' ) { lineSecondChar = line.charAt( 1 ); if ( lineSecondChar === ' ' && ( result = this.regexp.vertex_pattern.exec( line ) ) !== null ) { // 0 1 2 3 // ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"] state.vertices.push( parseFloat( result[ 1 ] ), parseFloat( result[ 2 ] ), parseFloat( result[ 3 ] ) ); } else if ( lineSecondChar === 'n' && ( result = this.regexp.normal_pattern.exec( line ) ) !== null ) { // 0 1 2 3 // ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"] state.normals.push( parseFloat( result[ 1 ] ), parseFloat( result[ 2 ] ), parseFloat( result[ 3 ] ) ); } else if ( lineSecondChar === 't' && ( result = this.regexp.uv_pattern.exec( line ) ) !== null ) { // 0 1 2 // ["vt 0.1 0.2", "0.1", "0.2"] state.uvs.push( parseFloat( result[ 1 ] ), parseFloat( result[ 2 ] ) ); } else { throw new Error( "Unexpected vertex/normal/uv line: '" + line + "'" ); } } else if ( lineFirstChar === "f" ) { if ( ( result = this.regexp.face_vertex_uv_normal.exec( line ) ) !== null ) { // f vertex/uv/normal vertex/uv/normal vertex/uv/normal // 0 1 2 3 4 5 6 7 8 9 10 11 12 // ["f 1/1/1 2/2/2 3/3/3", "1", "1", "1", "2", "2", "2", "3", "3", "3", undefined, undefined, undefined] state.addFace( result[ 1 ], result[ 4 ], result[ 7 ], result[ 10 ], result[ 2 ], result[ 5 ], result[ 8 ], result[ 11 ], result[ 3 ], result[ 6 ], result[ 9 ], result[ 12 ] ); } else if ( ( result = this.regexp.face_vertex_uv.exec( line ) ) !== null ) { // f vertex/uv vertex/uv vertex/uv // 0 1 2 3 4 5 6 7 8 // ["f 1/1 2/2 3/3", "1", "1", "2", "2", "3", "3", undefined, undefined] state.addFace( result[ 1 ], result[ 3 ], result[ 5 ], result[ 7 ], result[ 2 ], result[ 4 ], result[ 6 ], result[ 8 ] ); } else if ( ( result = this.regexp.face_vertex_normal.exec( line ) ) !== null ) { // f vertex//normal vertex//normal vertex//normal // 0 1 2 3 4 5 6 7 8 // ["f 1//1 2//2 3//3", "1", "1", "2", "2", "3", "3", undefined, undefined] state.addFace( result[ 1 ], result[ 3 ], result[ 5 ], result[ 7 ], undefined, undefined, undefined, undefined, result[ 2 ], result[ 4 ], result[ 6 ], result[ 8 ] ); } else if ( ( result = this.regexp.face_vertex.exec( line ) ) !== null ) { // f vertex vertex vertex // 0 1 2 3 4 // ["f 1 2 3", "1", "2", "3", undefined] state.addFace( result[ 1 ], result[ 2 ], result[ 3 ], result[ 4 ] ); } else { throw new Error( "Unexpected face line: '" + line + "'" ); } } else if ( lineFirstChar === "l" ) { var lineParts = line.substring( 1 ).trim().split( " " ); var lineVertices = [], lineUVs = []; if ( line.indexOf( "/" ) === - 1 ) { lineVertices = lineParts; } else { for ( var li = 0, llen = lineParts.length; li < llen; li ++ ) { var parts = lineParts[ li ].split( "/" ); if ( parts[ 0 ] !== "" ) lineVertices.push( parts[ 0 ] ); if ( parts[ 1 ] !== "" ) lineUVs.push( parts[ 1 ] ); } } state.addLineGeometry( lineVertices, lineUVs ); } else if ( ( result = this.regexp.object_pattern.exec( line ) ) !== null ) { // o object_name // or // g group_name // WORKAROUND: https://bugs.chromium.org/p/v8/issues/detail?id=2869 // var name = result[ 0 ].substr( 1 ).trim(); var name = ( " " + result[ 0 ].substr( 1 ).trim() ).substr( 1 ); state.startObject( name ); } else if ( this.regexp.material_use_pattern.test( line ) ) { // material state.object.startMaterial( line.substring( 7 ).trim(), state.materialLibraries ); } else if ( this.regexp.material_library_pattern.test( line ) ) { // mtl file state.materialLibraries.push( line.substring( 7 ).trim() ); } else if ( ( result = this.regexp.smoothing_pattern.exec( line ) ) !== null ) { // smooth shading // @todo Handle files that have varying smooth values for a set of faces inside one geometry, // but does not define a usemtl for each face set. // This should be detected and a dummy material created (later MultiMaterial and geometry groups). // This requires some care to not create extra material on each smooth value for "normal" obj files. // where explicit usemtl defines geometry groups. // Example asset: examples/models/obj/cerberus/Cerberus.obj var value = result[ 1 ].trim().toLowerCase(); state.object.smooth = ( value === '1' || value === 'on' ); var material = state.object.currentMaterial(); if ( material ) { material.smooth = state.object.smooth; } } else { // Handle null terminated files without exception if ( line === '\0' ) continue; throw new Error( "Unexpected line: '" + line + "'" ); } } state.finalize(); var container = new THREE.Group(); container.materialLibraries = [].concat( state.materialLibraries ); for ( var i = 0, l = state.objects.length; i < l; i ++ ) { var object = state.objects[ i ]; var geometry = object.geometry; var materials = object.materials; var isLine = ( geometry.type === 'Line' ); // Skip o/g line declarations that did not follow with any faces if ( geometry.vertices.length === 0 ) continue; var buffergeometry = new THREE.BufferGeometry(); buffergeometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( geometry.vertices ), 3 ) ); if ( geometry.normals.length > 0 ) { buffergeometry.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( geometry.normals ), 3 ) ); } else { buffergeometry.computeVertexNormals(); } if ( geometry.uvs.length > 0 ) { buffergeometry.addAttribute( 'uv', new THREE.BufferAttribute( new Float32Array( geometry.uvs ), 2 ) ); } // Create materials var createdMaterials = []; for ( var mi = 0, miLen = materials.length; mi < miLen ; mi++ ) { var sourceMaterial = materials[mi]; var material = undefined; if ( this.materials !== null ) { material = this.materials.create( sourceMaterial.name ); // mtl etc. loaders probably can't create line materials correctly, copy properties to a line material. if ( isLine && material && ! ( material instanceof THREE.LineBasicMaterial ) ) { var materialLine = new THREE.LineBasicMaterial(); materialLine.copy( material ); materialLine.lights = false; material = materialLine; } } if ( ! material ) { material = ( ! isLine ? new THREE.MeshPhongMaterial() : new THREE.LineBasicMaterial() ); material.name = sourceMaterial.name; } material.shading = sourceMaterial.smooth ? THREE.SmoothShading : THREE.FlatShading; createdMaterials.push(material); } // Create mesh var mesh; if ( createdMaterials.length > 1 ) { for ( var mi = 0, miLen = materials.length; mi < miLen ; mi++ ) { var sourceMaterial = materials[mi]; buffergeometry.addGroup( sourceMaterial.groupStart, sourceMaterial.groupCount, mi ); } var multiMaterial = new THREE.MultiMaterial( createdMaterials ); mesh = ( ! isLine ? new THREE.Mesh( buffergeometry, multiMaterial ) : new THREE.LineSegments( buffergeometry, multiMaterial ) ); } else { mesh = ( ! isLine ? new THREE.Mesh( buffergeometry, createdMaterials[ 0 ] ) : new THREE.LineSegments( buffergeometry, createdMaterials[ 0 ] ) ); } mesh.name = object.name; container.add( mesh ); } //console.timeEnd( 'OBJLoader' ); return container; } }; module.exports = exports = OBJLoader; ================================================ FILE: src/objects/objects.js ================================================ var utils = require("../utils/utils.js"); var material = require("../utils/material.js"); const AnimationManager = require("../animation/AnimationManager.js"); function Objects(){ } Objects.prototype = { // standard 1px line with gl line: function(obj){ obj = utils._validate(obj, this._defaults.line); //project to world and normalize var straightProject = utils.lnglatsToWorld(obj.geometry); var normalized = utils.normalizeVertices(straightProject); //flatten array for buffergeometry var flattenedArray = utils.flattenVectors(normalized.vertices); var positions = new Float32Array(flattenedArray); // 3 vertices per point var geometry = new THREE.BufferGeometry(); geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) ); // material var material = new THREE.LineBasicMaterial( { color: 0xff0000, linewidth: 21 } ); var line = new THREE.Line( geometry, material ); line.options = options || {}; line.position.copy(normalized.position) return line }, extrusion: function(options){ }, _addMethods: function(obj, static){ var root = this; if (static) { } else { if (!obj.coordinates) obj.coordinates = [0,0,0]; // Bestow this mesh with animation superpowers and keeps track of its movements in the global animation queue root.animationManager.enroll(obj); obj.setCoords = function(lnglat){ /** Place the given object on the map, centered around the provided longitude and latitude The object's internal coordinates are assumed to be in meter-offset format, meaning 1 unit represents 1 meter distance away from the provided coordinate. */ // If object already added, scale the model so that its units are interpreted as meters at the given latitude if (obj.userData.units === 'meters'){ var s = utils.projectedUnitsPerMeter(lnglat[1]); obj.scale.set(s,s,s); } obj.coordinates = lnglat; obj.set({position:lnglat}) return obj; } obj.setRotation = function(xyz) { if (typeof xyz === 'number') xyz = {z: xyz} var r = { x: utils.radify(xyz.x) || obj.rotation.x, y: utils.radify(xyz.y) || obj.rotation.y, z: utils.radify(xyz.z) || obj.rotation.z } obj._setObject({rotation: [r.x, r.y, r.z]}) } } obj.add = function(){ root.world.add(obj); if (!static) obj.set({position:obj.coordinates}); return obj; } obj.remove = function(){ root.world.remove(obj); root.map.repaint = true; } obj.duplicate = function(a) { var dupe = obj.clone(); dupe.userData = obj.userData; root._addMethods(dupe); return dupe } return obj }, _makeGroup: function(obj, options){ var geoGroup = new THREE.Group(); geoGroup.userData = options || {}; geoGroup.userData.isGeoGroup = true; var isArrayOfObjects = obj.length; if (isArrayOfObjects) for (o of obj) geoGroup.add(o) else geoGroup.add(obj); utils._flipMaterialSides(obj); return geoGroup }, animationManager: new AnimationManager, _defaults: { line: { geometry: null, color: 'black', width:1, opacity:1 }, sphere: { position: [0,0,0], radius: 1, sides: 20, units: 'scene', material: 'MeshBasicMaterial' }, tube: { geometry: null, radius: 1, sides:6, material: 'MeshBasicMaterial' }, extrusion:{ footprint: null, base: 0, top: 100, color:'black', material: 'MeshBasicMaterial', scaleToLatitude: false }, loadObj:{ obj: null, mtl: null, rotation: 0, scale: 1, units: 'scene' }, Object3D: { obj: null, units: 'scene' } }, geometries:{ line: ['LineString'], tube: ['LineString'], sphere: ['Point'], } } module.exports = exports = Objects; ================================================ FILE: src/objects/sphere.js ================================================ var utils = require("../utils/utils.js"); var material = require("../utils/material.js"); var Objects = require('./objects.js'); function Sphere(obj){ obj = utils._validate(obj, Objects.prototype._defaults.sphere); var geometry = new THREE.SphereBufferGeometry( obj.radius, obj.sides, obj.sides ); var mat = material(obj) var output = new THREE.Mesh( geometry, mat ); if (obj.units === 'meters') output = Objects.prototype._makeGroup(output, obj); Objects.prototype._addMethods(output); return output } module.exports = exports = Sphere; ================================================ FILE: src/objects/tube.js ================================================ var utils = require("../utils/utils.js"); var material = require("../utils/material.js"); var Objects = require('./objects.js'); var THREE = require("../three.js"); function tube(obj, world){ // validate and prep input geometry var obj = utils._validate(obj, Objects.prototype._defaults.tube); var straightProject = utils.lnglatsToWorld(obj.geometry); var normalized = utils.normalizeVertices(straightProject); var crossSection = tube.prototype.defineCrossSection(obj); var vertices = tube.prototype.buildVertices(crossSection, normalized.vertices, world); var geom = tube.prototype.buildFaces(vertices, normalized.vertices, obj); var mat = material(obj); var mesh = new THREE.Mesh( geom, mat ); mesh.position.copy(normalized.position); return mesh } tube.prototype = { buildVertices: function (crossSection, spine, world){ //create reusable plane for intersection calculations var geometry = new THREE.PlaneBufferGeometry(99999999999, 9999999999); var m = new THREE.MeshBasicMaterial( {color: 0xffffff, side: THREE.DoubleSide} ); m.opacity = 0 var plane = new THREE.Mesh( geometry, m ); // world.add( plane ); var geom = new THREE.Geometry(); var lastElbow = false; // BUILD VERTICES: iterate through points in spine and position each vertex in cross section // get normalized vectors for each spine segment var spineSegments = [spine[0].clone().normalize()]; for (i in spine) { i = parseFloat(i); var segment; if (spine[i+1]){ segment = new THREE.Vector3() .subVectors( spine[i+1], spine[i]) .normalize(); } spineSegments.push(segment); } spineSegments.push(new THREE.Vector3()); for (i in spine) { i = parseFloat(i); var lineVertex = spine[i]; // ROTATE cross section var humerus = spineSegments[i] var forearm = spineSegments[i+1] var midpointToLookAt = humerus.clone() .add(forearm) .normalize(); if (i === 0) midpointToLookAt = forearm; else if (i === spine.length - 1) midpointToLookAt = humerus; // if first point in input line, rotate and translate it to position if (!lastElbow) { var elbow = crossSection.clone(); elbow .lookAt(midpointToLookAt) elbow.vertices.forEach(function(vertex){ geom.vertices .push(vertex.add(lineVertex)); }) lastElbow = elbow.vertices; } else { var elbow = []; plane.position.copy(lineVertex); plane.lookAt(midpointToLookAt.clone().add(lineVertex)); plane.updateMatrixWorld(); lastElbow.forEach(function(v3){ var raycaster = new THREE.Raycaster(v3, humerus); var intersection = raycaster .intersectObject(plane)[0]; if (intersection) { geom.vertices.push(intersection.point); elbow.push(intersection.point); } else console.error('Tube geometry failed at vertex '+i+'. Consider reducing tube radius, or smoothening out the sharp angle at this vertex') }) lastElbow = elbow } } world.remove(plane); return geom }, defineCrossSection: function(obj){ var crossSection = new THREE.Geometry(); var count = obj.sides; for ( var i = 0; i < count; i ++ ) { var l = obj.radius; var a = (i+0.5) / count * Math.PI; crossSection.vertices.push( new THREE.Vector3 ( -Math.sin( 2 * a ), Math.cos( 2 * a ), 0 ) .multiplyScalar(l) ); } return crossSection }, //build faces between vertices buildFaces: function(geom, spine, obj){ for (var i in spine) { i = parseFloat(i); var vertex = spine[i]; if (i < spine.length - 1) { for (var p = 0; p < obj.sides; p++) { var b1 = i * obj.sides + p; var b2 = i * obj.sides + (p+1) % obj.sides var t1 = b1 + obj.sides var t2 = b2 + obj.sides; var triangle1 = new THREE.Face3(t1, b1, b2); var triangle2 = new THREE.Face3(t1, b2, t2); geom.faces.push(triangle1, triangle2) } } } //add endcaps var v = geom.vertices.length; for (var c = 0; c+2b&&(b=a[c]);return b}function D(){Object.defineProperty(this,"id",{value:Jf+=2});this.uuid=J.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.groups=[];this.boundingSphere=this.boundingBox=null;this.drawRange={start:0,count:Infinity};this.userData={}}function Nb(a,b,c,d,e,f){P.call(this);this.type="BoxGeometry";this.parameters={width:a,height:b,depth:c,widthSegments:d,heightSegments:e, depthSegments:f};this.fromBufferGeometry(new pb(a,b,c,d,e,f));this.mergeVertices()}function pb(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,k,Q,M,Ob){var r=f/Q,u=g/M,O=f/2,y=g/2,x=k/2;g=Q+1;var w=M+1,C=f=0,A,B,z=new p;for(B=0;Bm;m++){if(n=d[m])if(h=n[0],l=n[1]){v&&e.addAttribute("morphTarget"+m,v[h]);f&&e.addAttribute("morphNormal"+m,f[h]);c[m]=l;continue}c[m]=0}g.getUniforms().setValue(a,"morphTargetInfluences",c)}}}function Vf(a,b){var c={};return{update:function(d){var e=b.render.frame,f=d.geometry,g=a.get(d,f);c[g.id]!==e&&(f.isGeometry&&g.updateFromObject(d), a.update(g),c[g.id]=e);return g},dispose:function(){c={}}}}function Za(a,b,c,d,e,f,g,h,l,m){a=void 0!==a?a:[];ea.call(this,a,void 0!==b?b:301,c,d,e,f,g,h,l,m);this.flipY=!1}function Rb(a,b,c){var d=a[0];if(0>=d||0/gm,function(a,c){a=S[c];if(void 0===a)throw Error("Can not resolve #include <"+c+ ">");return Zd(a)})}function Ze(a){return a.replace(/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(a,c,d,e){a="";for(c=parseInt(c);c 0 ) {\n\t\tfloat fogFactor = 0.0;\n\t\tif ( fogType == 1 ) {\n\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t\t} else {\n\t\t\tconst float LOG2 = 1.442695;\n\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );\n\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n\t\t}\n\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\t}\n}"].join("\n")); b.compileShader(Ca);b.compileShader(G);b.attachShader(sa,Ca);b.attachShader(sa,G);b.linkProgram(sa);U=sa;O=b.getAttribLocation(U,"position");Q=b.getAttribLocation(U,"uv");f=b.getUniformLocation(U,"uvOffset");g=b.getUniformLocation(U,"uvScale");h=b.getUniformLocation(U,"rotation");l=b.getUniformLocation(U,"center");m=b.getUniformLocation(U,"scale");v=b.getUniformLocation(U,"color");n=b.getUniformLocation(U,"map");t=b.getUniformLocation(U,"opacity");q=b.getUniformLocation(U,"modelViewMatrix");r=b.getUniformLocation(U, "projectionMatrix");k=b.getUniformLocation(U,"fogType");y=b.getUniformLocation(U,"fogDensity");w=b.getUniformLocation(U,"fogNear");x=b.getUniformLocation(U,"fogFar");A=b.getUniformLocation(U,"fogColor");b.getUniformLocation(U,"fogDepth");C=b.getUniformLocation(U,"alphaTest");sa=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");sa.width=8;sa.height=8;Ca=sa.getContext("2d");Ca.fillStyle="white";Ca.fillRect(0,0,8,8);z=new Sb(sa)}c.useProgram(U);c.initAttributes();c.enableAttribute(O); c.enableAttribute(Q);c.disableUnusedAttributes();c.disable(b.CULL_FACE);c.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,B);b.vertexAttribPointer(O,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(Q,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,qb);b.uniformMatrix4fv(r,!1,Ob.projectionMatrix.elements);c.activeTexture(b.TEXTURE0);b.uniform1i(n,0);Ca=sa=0;(G=p.fog)?(b.uniform3f(A,G.color.r,G.color.g,G.color.b),G.isFog?(b.uniform1f(w,G.near),b.uniform1f(x,G.far),b.uniform1i(k,1),Ca=sa=1):G.isFogExp2&& (b.uniform1f(y,G.density),b.uniform1i(k,2),Ca=sa=2)):(b.uniform1i(k,0),Ca=sa=0);G=0;for(var K=u.length;Gb||a.height>b){if("data"in a){console.warn("THREE.WebGLRenderer: image in DataTexture is too big ("+a.width+"x"+a.height+").");return}b/=Math.max(a.width,a.height);var c=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");c.width=Math.floor(a.width*b);c.height=Math.floor(a.height*b);c.getContext("2d").drawImage(a,0,0,a.width,a.height,0,0,c.width,c.height);console.warn("THREE.WebGLRenderer: image is too big ("+a.width+"x"+a.height+"). Resized to "+c.width+ "x"+c.height,a);return c}return a}function l(a){return J.isPowerOfTwo(a.width)&&J.isPowerOfTwo(a.height)}function m(a,b){return a.generateMipmaps&&b&&1003!==a.minFilter&&1006!==a.minFilter}function v(b,c,e,f){a.generateMipmap(b);d.get(c).__maxMipLevel=Math.log(Math.max(e,f))*Math.LOG2E}function n(b){return 1003===b||1004===b||1005===b?a.NEAREST:a.LINEAR}function t(b){b=b.target;b.removeEventListener("dispose",t);a:{var c=d.get(b);if(b.image&&c.__image__webglTextureCube)a.deleteTexture(c.__image__webglTextureCube); else{if(void 0===c.__webglInit)break a;a.deleteTexture(c.__webglTexture)}d.remove(b)}b.isVideoTexture&&delete A[b.id];g.memory.textures--}function q(b){b=b.target;b.removeEventListener("dispose",q);var c=d.get(b),e=d.get(b.texture);if(b){void 0!==e.__webglTexture&&a.deleteTexture(e.__webglTexture);b.depthTexture&&b.depthTexture.dispose();if(b.isWebGLRenderTargetCube)for(e=0;6>e;e++)a.deleteFramebuffer(c.__webglFramebuffer[e]),c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer[e]);else a.deleteFramebuffer(c.__webglFramebuffer), c.__webglDepthbuffer&&a.deleteRenderbuffer(c.__webglDepthbuffer);d.remove(b.texture);d.remove(b)}g.memory.textures--}function k(b,n){var q=d.get(b);if(b.isVideoTexture){var k=b.id,r=g.render.frame;A[k]!==r&&(A[k]=r,b.update())}if(0p;p++)r[p]=n||k?k?b.image[p].image:b.image[p]:h(b.image[p],e.maxCubemapSize);var x=r[0],y=l(x),C=f.convert(b.format),w=f.convert(b.type);u(a.TEXTURE_CUBE_MAP,b,y);for(p=0;6>p;p++)if(n)for(var O,Q=r[p].mipmaps,A=0,B=Q.length;At;t++)e.__webglFramebuffer[t]=a.createFramebuffer()}else e.__webglFramebuffer= a.createFramebuffer();if(h){c.bindTexture(a.TEXTURE_CUBE_MAP,f.__webglTexture);u(a.TEXTURE_CUBE_MAP,b.texture,n);for(t=0;6>t;t++)p(e.__webglFramebuffer[t],b,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+t);m(b.texture,n)&&v(a.TEXTURE_CUBE_MAP,b.texture,b.width,b.height);c.bindTexture(a.TEXTURE_CUBE_MAP,null)}else c.bindTexture(a.TEXTURE_2D,f.__webglTexture),u(a.TEXTURE_2D,b.texture,n),p(e.__webglFramebuffer,b,a.COLOR_ATTACHMENT0,a.TEXTURE_2D),m(b.texture,n)&&v(a.TEXTURE_2D,b.texture,b.width,b.height), c.bindTexture(a.TEXTURE_2D,null);if(b.depthBuffer){e=d.get(b);f=!0===b.isWebGLRenderTargetCube;if(b.depthTexture){if(f)throw Error("target.depthTexture not supported in Cube render targets");if(b&&b.isWebGLRenderTargetCube)throw Error("Depth Texture with cube render targets is not supported");a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer);if(!b.depthTexture||!b.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(b.depthTexture).__webglTexture&& b.depthTexture.image.width===b.width&&b.depthTexture.image.height===b.height||(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0);k(b.depthTexture,0);e=d.get(b.depthTexture).__webglTexture;if(1026===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.TEXTURE_2D,e,0);else if(1027===b.depthTexture.format)a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_2D,e,0);else throw Error("Unknown depthTexture format"); }else if(f)for(e.__webglDepthbuffer=[],f=0;6>f;f++)a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer[f]),e.__webglDepthbuffer[f]=a.createRenderbuffer(),w(e.__webglDepthbuffer[f],b);else a.bindFramebuffer(a.FRAMEBUFFER,e.__webglFramebuffer),e.__webglDepthbuffer=a.createRenderbuffer(),w(e.__webglDepthbuffer,b);a.bindFramebuffer(a.FRAMEBUFFER,null)}};this.updateRenderTargetMipmap=function(b){var e=b.texture,f=l(b);if(m(e,f)){f=b.isWebGLRenderTargetCube?a.TEXTURE_CUBE_MAP:a.TEXTURE_2D;var g=d.get(e).__webglTexture; c.bindTexture(f,g);v(f,e,b.width,b.height);c.bindTexture(f,null)}}}function af(a,b){return{convert:function(c){if(1E3===c)return a.REPEAT;if(1001===c)return a.CLAMP_TO_EDGE;if(1002===c)return a.MIRRORED_REPEAT;if(1003===c)return a.NEAREST;if(1004===c)return a.NEAREST_MIPMAP_NEAREST;if(1005===c)return a.NEAREST_MIPMAP_LINEAR;if(1006===c)return a.LINEAR;if(1007===c)return a.LINEAR_MIPMAP_NEAREST;if(1008===c)return a.LINEAR_MIPMAP_LINEAR;if(1009===c)return a.UNSIGNED_BYTE;if(1017===c)return a.UNSIGNED_SHORT_4_4_4_4; if(1018===c)return a.UNSIGNED_SHORT_5_5_5_1;if(1019===c)return a.UNSIGNED_SHORT_5_6_5;if(1010===c)return a.BYTE;if(1011===c)return a.SHORT;if(1012===c)return a.UNSIGNED_SHORT;if(1013===c)return a.INT;if(1014===c)return a.UNSIGNED_INT;if(1015===c)return a.FLOAT;if(1016===c){var d=b.get("OES_texture_half_float");if(null!==d)return d.HALF_FLOAT_OES}if(1021===c)return a.ALPHA;if(1022===c)return a.RGB;if(1023===c)return a.RGBA;if(1024===c)return a.LUMINANCE;if(1025===c)return a.LUMINANCE_ALPHA;if(1026=== c)return a.DEPTH_COMPONENT;if(1027===c)return a.DEPTH_STENCIL;if(100===c)return a.FUNC_ADD;if(101===c)return a.FUNC_SUBTRACT;if(102===c)return a.FUNC_REVERSE_SUBTRACT;if(200===c)return a.ZERO;if(201===c)return a.ONE;if(202===c)return a.SRC_COLOR;if(203===c)return a.ONE_MINUS_SRC_COLOR;if(204===c)return a.SRC_ALPHA;if(205===c)return a.ONE_MINUS_SRC_ALPHA;if(206===c)return a.DST_ALPHA;if(207===c)return a.ONE_MINUS_DST_ALPHA;if(208===c)return a.DST_COLOR;if(209===c)return a.ONE_MINUS_DST_COLOR;if(210=== c)return a.SRC_ALPHA_SATURATE;if(33776===c||33777===c||33778===c||33779===c)if(d=b.get("WEBGL_compressed_texture_s3tc"),null!==d){if(33776===c)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===c)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===c)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===c)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===c||35841===c||35842===c||35843===c)if(d=b.get("WEBGL_compressed_texture_pvrtc"),null!==d){if(35840===c)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841=== c)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===c)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===c)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===c&&(d=b.get("WEBGL_compressed_texture_etc1"),null!==d))return d.COMPRESSED_RGB_ETC1_WEBGL;if(37808===c||37809===c||37810===c||37811===c||37812===c||37813===c||37814===c||37815===c||37816===c||37817===c||37818===c||37819===c||37820===c||37821===c)if(d=b.get("WEBGL_compressed_texture_astc"),null!==d)return c;if(103===c||104===c)if(d=b.get("EXT_blend_minmax"), null!==d){if(103===c)return d.MIN_EXT;if(104===c)return d.MAX_EXT}return 1020===c&&(d=b.get("WEBGL_depth_texture"),null!==d)?d.UNSIGNED_INT_24_8_WEBGL:0}}}function Ub(){H.call(this);this.type="Group"}function Z(a,b,c,d){Ra.call(this);this.type="PerspectiveCamera";this.fov=void 0!==a?a:50;this.zoom=1;this.near=void 0!==c?c:.1;this.far=void 0!==d?d:2E3;this.focus=10;this.aspect=void 0!==b?b:1;this.view=null;this.filmGauge=35;this.filmOffset=0;this.updateProjectionMatrix()}function Hc(a){Z.call(this); this.cameras=a||[]}function bf(a){function b(){return null!==e&&!0===e.isPresenting}function c(){if(b()){var c=e.getEyeParameters("left"),f=c.renderWidth;c=c.renderHeight;w=a.getPixelRatio();y=a.getSize();a.setDrawingBufferSize(2*f,c,1);A.start()}else d.enabled&&(a.setDrawingBufferSize(y.width,y.height,w),A.stop())}var d=this,e=null,f=null,g=null,h=[],l=new R,m=new R;"undefined"!==typeof window&&"VRFrameData"in window&&(f=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",c,!1)); var v=new R,n=new ca,t=new p,q=new Z;q.bounds=new W(0,0,.5,1);q.layers.enable(1);var k=new Z;k.bounds=new W(.5,0,.5,1);k.layers.enable(2);var u=new Hc([q,k]);u.layers.enable(1);u.layers.enable(2);var y,w,x=!1;this.enabled=!1;this.userHeight=1.6;this.getController=function(a){var b=h[a];void 0===b&&(b=new Ub,b.matrixAutoUpdate=!1,b.visible=!1,h[a]=b);return b};this.getDevice=function(){return e};this.setDevice=function(a){void 0!==a&&(e=a);A.setContext(a)};this.setPoseTarget=function(a){void 0!==a&& (g=a)};this.getCamera=function(a){if(null===e)return a.position.set(0,d.userHeight,0),a;e.depthNear=a.near;e.depthFar=a.far;e.getFrameData(f);var b=e.stageParameters;b?l.fromArray(b.sittingToStandingTransform):l.makeTranslation(0,d.userHeight,0);b=f.pose;var c=null!==g?g:a;c.matrix.copy(l);c.matrix.decompose(c.position,c.quaternion,c.scale);null!==b.orientation&&(n.fromArray(b.orientation),c.quaternion.multiply(n));null!==b.position&&(n.setFromRotationMatrix(l),t.fromArray(b.position),t.applyQuaternion(n), c.position.add(t));c.updateMatrixWorld();if(!1===e.isPresenting)return a;q.near=a.near;k.near=a.near;q.far=a.far;k.far=a.far;u.matrixWorld.copy(a.matrixWorld);u.matrixWorldInverse.copy(a.matrixWorldInverse);q.matrixWorldInverse.fromArray(f.leftViewMatrix);k.matrixWorldInverse.fromArray(f.rightViewMatrix);m.getInverse(l);q.matrixWorldInverse.multiply(m);k.matrixWorldInverse.multiply(m);a=c.parent;null!==a&&(v.getInverse(a.matrixWorld),q.matrixWorldInverse.multiply(v),k.matrixWorldInverse.multiply(v)); q.matrixWorld.getInverse(q.matrixWorldInverse);k.matrixWorld.getInverse(k.matrixWorldInverse);q.projectionMatrix.fromArray(f.leftProjectionMatrix);k.projectionMatrix.fromArray(f.rightProjectionMatrix);u.projectionMatrix.copy(q.projectionMatrix);a=e.getLayers();a.length&&(a=a[0],null!==a.leftBounds&&4===a.leftBounds.length&&q.bounds.fromArray(a.leftBounds),null!==a.rightBounds&&4===a.rightBounds.length&&k.bounds.fromArray(a.rightBounds));a:for(a=0;aa.matrixWorld.determinant();aa.setMaterial(e,h);h=n(c,b.fog,e,a);I="";g(a,h,e)}else U.renderBufferDirect(c,b.fog,d,e,a,f);a.onAfterRender(U,b,c,d,e,f);z=oa.get(b,Pb||c)}function v(a,b,c){var d=Aa.get(a),g=z.state.lights;c=na.getParameters(a,g.state,z.state.shadowsArray,b,X.numPlanes,X.numIntersection,c);var h=na.getProgramCode(a,c),l=d.program,m=!0;if(void 0===l)a.addEventListener("dispose",e);else if(l.code!==h)f(a);else{if(d.lightsHash!==g.state.hash)Aa.update(a,"lightsHash",g.state.hash);else if(void 0!== c.shaderID)return;m=!1}m&&(c.shaderID?(l=tb[c.shaderID],d.shader={name:a.type,uniforms:Ba.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}):d.shader={name:a.type,uniforms:a.uniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader},a.onBeforeCompile(d.shader,U),l=na.acquireProgram(a,d.shader,c,h),d.program=l,a.program=l);c=l.getAttributes();if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;he.matrixWorld.determinant();aa.setMaterial(d,g);var h=n(a,b,d,e);a=c.id+"_"+h.id+"_"+(!0===d.wireframe);var l=!1;a!==I&&(I=a,l=!0);e.morphTargetInfluences&&(va.update(e,c,d,h),l=!0);g=c.index;var m=c.attributes.position;b=1;!0===d.wireframe&&(g=qa.getWireframeAttribute(c),b=2);a=wa;if(null!==g){var v=ja.get(g);a=xa;a.setIndex(v)}if(l){if(c&&c.isInstancedBufferGeometry&&null===ma.get("ANGLE_instanced_arrays"))console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); else{aa.initAttributes();l=c.attributes;h=h.getAttributes();var t=d.defaultAttributeValues;for(A in h){var q=h[A];if(0<=q){var k=l[A];if(void 0!==k){var r=k.normalized,u=k.itemSize,p=ja.get(k);if(void 0!==p){var y=p.buffer,x=p.type;p=p.bytesPerElement;if(k.isInterleavedBufferAttribute){var w=k.data,C=w.stride;k=k.offset;w&&w.isInstancedInterleavedBuffer?(aa.enableAttributeAndDivisor(q,w.meshPerAttribute),void 0===c.maxInstancedCount&&(c.maxInstancedCount=w.meshPerAttribute*w.count)):aa.enableAttribute(q); F.bindBuffer(F.ARRAY_BUFFER,y);F.vertexAttribPointer(q,u,x,r,C*p,k*p)}else k.isInstancedBufferAttribute?(aa.enableAttributeAndDivisor(q,k.meshPerAttribute),void 0===c.maxInstancedCount&&(c.maxInstancedCount=k.meshPerAttribute*k.count)):aa.enableAttribute(q),F.bindBuffer(F.ARRAY_BUFFER,y),F.vertexAttribPointer(q,u,x,r,0,0)}}else if(void 0!==t&&(r=t[A],void 0!==r))switch(r.length){case 2:F.vertexAttrib2fv(q,r);break;case 3:F.vertexAttrib3fv(q,r);break;case 4:F.vertexAttrib4fv(q,r);break;default:F.vertexAttrib1fv(q, r)}}}aa.disableUnusedAttributes()}null!==g&&F.bindBuffer(F.ELEMENT_ARRAY_BUFFER,v.buffer)}v=Infinity;null!==g?v=g.count:void 0!==m&&(v=m.count);g=c.drawRange.start*b;m=null!==f?f.start*b:0;var A=Math.max(g,m);f=Math.max(0,Math.min(v,g+c.drawRange.count*b,m+(null!==f?f.count*b:Infinity))-1-A+1);if(0!==f){if(e.isMesh)if(!0===d.wireframe)aa.setLineWidth(d.wireframeLinewidth*(null===D?V:1)),a.setMode(F.LINES);else switch(e.drawMode){case 0:a.setMode(F.TRIANGLES);break;case 1:a.setMode(F.TRIANGLE_STRIP); break;case 2:a.setMode(F.TRIANGLE_FAN)}else e.isLine?(d=d.linewidth,void 0===d&&(d=1),aa.setLineWidth(d*(null===D?V:1)),e.isLineSegments?a.setMode(F.LINES):e.isLineLoop?a.setMode(F.LINE_LOOP):a.setMode(F.LINE_STRIP)):e.isPoints&&a.setMode(F.POINTS);c&&c.isInstancedBufferGeometry?0=Sa.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+ a+" texture units while this GPU supports only "+Sa.maxTextures);$d+=1;return a};this.setTexture2D=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTarget&&(a||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);Z.setTexture2D(b,c)}}();this.setTexture=function(){var a=!1;return function(b,c){a||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),a=!0);Z.setTexture2D(b, c)}}();this.setTextureCube=function(){var a=!1;return function(b,c){b&&b.isWebGLRenderTargetCube&&(a||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),a=!0),b=b.texture);b&&b.isCubeTexture||Array.isArray(b.image)&&6===b.image.length?Z.setTextureCube(b,c):Z.setTextureCubeDynamic(b,c)}}();this.setFramebuffer=function(a){H=a};this.getRenderTarget=function(){return D};this.setRenderTarget=function(a){(D=a)&&void 0===Aa.get(a).__webglFramebuffer&& Z.setupRenderTarget(a);var b=H,c=!1;a?(b=Aa.get(a).__webglFramebuffer,a.isWebGLRenderTargetCube&&(b=b[a.activeCubeFace],c=!0),db.copy(a.viewport),S.copy(a.scissor),T=a.scissorTest):(db.copy(N).multiplyScalar(V),S.copy(ba).multiplyScalar(V),T=ea);E!==b&&(F.bindFramebuffer(F.FRAMEBUFFER,b),E=b);aa.viewport(db);aa.scissor(S);aa.setScissorTest(T);c&&(c=Aa.get(a.texture),F.framebufferTexture2D(F.FRAMEBUFFER,F.COLOR_ATTACHMENT0,F.TEXTURE_CUBE_MAP_POSITIVE_X+a.activeCubeFace,c.__webglTexture,a.activeMipMapLevel))}; this.readRenderTargetPixels=function(a,b,c,d,e,f){if(a&&a.isWebGLRenderTarget){var g=Aa.get(a).__webglFramebuffer;if(g){var h=!1;g!==E&&(F.bindFramebuffer(F.FRAMEBUFFER,g),h=!0);try{var l=a.texture,m=l.format,n=l.type;1023!==m&&ia.convert(m)!==F.getParameter(F.IMPLEMENTATION_COLOR_READ_FORMAT)?console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."):1009===n||ia.convert(n)===F.getParameter(F.IMPLEMENTATION_COLOR_READ_TYPE)||1015=== n&&(ma.get("OES_texture_float")||ma.get("WEBGL_color_buffer_float"))||1016===n&&ma.get("EXT_color_buffer_half_float")?F.checkFramebufferStatus(F.FRAMEBUFFER)===F.FRAMEBUFFER_COMPLETE?0<=b&&b<=a.width-d&&0<=c&&c<=a.height-e&&F.readPixels(b,c,d,e,ia.convert(m),ia.convert(n),f):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete."):console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")}finally{h&& F.bindFramebuffer(F.FRAMEBUFFER,E)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")};this.copyFramebufferToTexture=function(a,b,c){var d=b.image.width,e=b.image.height,f=ia.convert(b.format);this.setTexture2D(b,0);F.copyTexImage2D(F.TEXTURE_2D,c||0,f,a.x,a.y,d,e,0)};this.copyTextureToTexture=function(a,b,c,d){var e=b.image.width,f=b.image.height,g=ia.convert(c.format),h=ia.convert(c.type);this.setTexture2D(c,0);b.isDataTexture?F.texSubImage2D(F.TEXTURE_2D, d||0,a.x,a.y,e,f,g,h,b.image.data):F.texSubImage2D(F.TEXTURE_2D,d||0,a.x,a.y,g,h,b.image)}}function Vb(a,b){this.name="";this.color=new G(a);this.density=void 0!==b?b:2.5E-4}function Wb(a,b,c){this.name="";this.color=new G(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3}function vd(){H.call(this);this.type="Scene";this.overrideMaterial=this.fog=this.background=null;this.autoUpdate=!0}function ib(a){I.call(this);this.type="SpriteMaterial";this.color=new G(16777215);this.map=null;this.rotation= 0;this.lights=this.fog=!1;this.setValues(a)}function Ic(a){H.call(this);this.type="Sprite";this.material=void 0!==a?a:new ib;this.center=new B(.5,.5)}function Jc(){H.call(this);this.type="LOD";Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Kc(a,b){a=a||[];this.bones=a.slice(0);this.boneMatrices=new Float32Array(16*this.bones.length);if(void 0===b)this.calculateInverses();else if(this.bones.length===b.length)this.boneInverses=b.slice(0);else for(console.warn("THREE.Skeleton boneInverses is the wrong length."), this.boneInverses=[],a=0,b=this.bones.length;ac;c++){var n=v[h[c]];var t=v[h[(c+1)%3]];f[0]=Math.min(n,t);f[1]=Math.max(n,t);n=f[0]+","+f[1];void 0===g[n]&&(g[n]={index1:f[0],index2:f[1]})}}for(n in g)m=g[n],h=a.vertices[m.index1],b.push(h.x,h.y,h.z),h=a.vertices[m.index2],b.push(h.x,h.y,h.z)}else if(a&&a.isBufferGeometry)if(h=new p,null!==a.index){l=a.attributes.position;v=a.index;var q=a.groups;0===q.length&&(q=[{start:0,count:v.count,materialIndex:0}]);a=0;for(e=q.length;ac;c++)n=v.getX(m+c),t=v.getX(m+(c+1)%3),f[0]=Math.min(n,t),f[1]=Math.max(n,t),n=f[0]+","+f[1],void 0===g[n]&&(g[n]={index1:f[0],index2:f[1]});for(n in g)m=g[n],h.fromBufferAttribute(l,m.index1),b.push(h.x,h.y,h.z),h.fromBufferAttribute(l,m.index2),b.push(h.x,h.y,h.z)}else for(l=a.attributes.position,m=0,d=l.count/3;mc;c++)g=3*m+c,h.fromBufferAttribute(l,g),b.push(h.x,h.y,h.z),g=3*m+(c+1)%3,h.fromBufferAttribute(l,g),b.push(h.x, h.y,h.z);this.addAttribute("position",new z(b,3))}function Mc(a,b,c){P.call(this);this.type="ParametricGeometry";this.parameters={func:a,slices:b,stacks:c};this.fromBufferGeometry(new $b(a,b,c));this.mergeVertices()}function $b(a,b,c){D.call(this);this.type="ParametricBufferGeometry";this.parameters={func:a,slices:b,stacks:c};var d=[],e=[],f=[],g=[],h=new p,l=new p,m=new p,v=new p,n=new p,t,q;3>a.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter."); var k=b+1;for(t=0;t<=c;t++){var u=t/c;for(q=0;q<=b;q++){var y=q/b;a(y,u,l);e.push(l.x,l.y,l.z);0<=y-1E-5?(a(y-1E-5,u,m),v.subVectors(l,m)):(a(y+1E-5,u,m),v.subVectors(m,l));0<=u-1E-5?(a(y,u-1E-5,m),n.subVectors(l,m)):(a(y,u+1E-5,m),n.subVectors(m,l));h.crossVectors(v,n).normalize();f.push(h.x,h.y,h.z);g.push(y,u)}}for(t=0;td&&1===a.x&&(l[b]=a.x-1);0===c.x&&0===c.z&&(l[b]=d/2/Math.PI+.5)}D.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:a, indices:b,radius:c,detail:d};c=c||1;d=d||0;var h=[],l=[];(function(a){for(var c=new p,d=new p,g=new p,h=0;he&&(.2>b&&(l[a+0]+=1),.2>c&&(l[a+2]+=1),.2>d&&(l[a+4]+=1))})();this.addAttribute("position",new z(h,3));this.addAttribute("normal",new z(h.slice(),3));this.addAttribute("uv",new z(l,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Oc(a, b){P.call(this);this.type="TetrahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new ac(a,b));this.mergeVertices()}function ac(a,b){xa.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],a,b);this.type="TetrahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Pc(a,b){P.call(this);this.type="OctahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new ub(a,b));this.mergeVertices()}function ub(a,b){xa.call(this,[1,0,0, -1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],a,b);this.type="OctahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Qc(a,b){P.call(this);this.type="IcosahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new bc(a,b));this.mergeVertices()}function bc(a,b){var c=(1+Math.sqrt(5))/2;xa.call(this,[-1,c,0,1,c,0,-1,-c,0,1,-c,0,0,-1,c,0,1,c,0,-1,-c,0,1,-c,c,0,-1,c,0,1,-c,0,-1,-c,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5, 11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a,b);this.type="IcosahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Rc(a,b){P.call(this);this.type="DodecahedronGeometry";this.parameters={radius:a,detail:b};this.fromBufferGeometry(new cc(a,b));this.mergeVertices()}function cc(a,b){var c=(1+Math.sqrt(5))/2,d=1/c;xa.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-c,0,-d,c,0,d,-c,0,d,c,-d,-c,0,-d,c,0,d,-c,0,d,c, 0,-c,0,-d,c,0,-d,-c,0,d,c,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],a,b);this.type="DodecahedronBufferGeometry";this.parameters={radius:a,detail:b}}function Sc(a,b,c,d,e,f){P.call(this);this.type="TubeGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d, closed:e};void 0!==f&&console.warn("THREE.TubeGeometry: taper has been removed.");a=new dc(a,b,c,d,e);this.tangents=a.tangents;this.normals=a.normals;this.binormals=a.binormals;this.fromBufferGeometry(a);this.mergeVertices()}function dc(a,b,c,d,e){function f(e){v=a.getPointAt(e/b,v);var f=g.normals[e];e=g.binormals[e];for(k=0;k<=d;k++){var m=k/d*Math.PI*2,n=Math.sin(m);m=-Math.cos(m);l.x=m*f.x+n*e.x;l.y=m*f.y+n*e.y;l.z=m*f.z+n*e.z;l.normalize();r.push(l.x,l.y,l.z);h.x=v.x+c*l.x;h.y=v.y+c*l.y;h.z= v.z+c*l.z;q.push(h.x,h.y,h.z)}}D.call(this);this.type="TubeBufferGeometry";this.parameters={path:a,tubularSegments:b,radius:c,radialSegments:d,closed:e};b=b||64;c=c||1;d=d||8;e=e||!1;var g=a.computeFrenetFrames(b,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new p,l=new p,m=new B,v=new p,n,k,q=[],r=[],u=[],y=[];for(n=0;n=b;e-=d)f=df(e,a[e],a[e+1],f);f&&vb(f,f.next)&&(Vc(f),f=f.next);return f}function Wc(a,b){if(!a)return a;b||(b=a);do{var c=!1;if(a.steiner||!vb(a,a.next)&&0!==oa(a.prev,a,a.next))a=a.next;else{Vc(a);a=b=a.prev;if(a===a.next)break;c=!0}}while(c||a!==b);return b} function Xc(a,b,c,d,e,f,g){if(a){if(!g&&f){var h=a,l=h;do null===l.z&&(l.z=ce(l.x,l.y,d,e,f)),l.prevZ=l.prev,l=l.nextZ=l.next;while(l!==h);l.prevZ.nextZ=null;l.prevZ=null;h=l;var m,v,n,k,q=1;do{l=h;var r=h=null;for(v=0;l;){v++;var p=l;for(m=n=0;mn.x?v.x>q.x?v.x:q.x:n.x>q.x?n.x:q.x,A=v.y>n.y?v.y>q.y?v.y:q.y:n.y>q.y?n.y:q.y;m=ce(v.x=m;){if(y!==r.prev&&y!==r.next&&zd(v.x,v.y,n.x,n.y,q.x,q.y,y.x,y.y)&&0<=oa(y.prev,y,y.next)){r=!1;break a}y= y.prevZ}r=!0}}else a:if(r=a,v=r.prev,n=r,q=r.next,0<=oa(v,n,q))r=!1;else{for(m=r.next.next;m!==r.prev;){if(zd(v.x,v.y,n.x,n.y,q.x,q.y,m.x,m.y)&&0<=oa(m.prev,m,m.next)){r=!1;break a}m=m.next}r=!0}if(r)b.push(l.i/c),b.push(a.i/c),b.push(p.i/c),Vc(a),h=a=p.next;else if(a=p,a===h){if(!g)Xc(Wc(a),b,c,d,e,f,1);else if(1===g){g=b;h=c;l=a;do p=l.prev,r=l.next.next,!vb(p,r)&&ef(p,l,l.next,r)&&Yc(p,r)&&Yc(r,p)&&(g.push(p.i/h),g.push(l.i/h),g.push(r.i/h),Vc(l),Vc(l.next),l=a=r),l=l.next;while(l!==a);a=l;Xc(a, b,c,d,e,f,2)}else if(2===g)a:{g=a;do{for(h=g.next.next;h!==g.prev;){if(l=g.i!==h.i){l=g;p=h;if(r=l.next.i!==p.i&&l.prev.i!==p.i){b:{r=l;do{if(r.i!==l.i&&r.next.i!==l.i&&r.i!==p.i&&r.next.i!==p.i&&ef(r,r.next,l,p)){r=!0;break b}r=r.next}while(r!==l);r=!1}r=!r}if(r=r&&Yc(l,p)&&Yc(p,l)){r=l;v=!1;n=(l.x+p.x)/2;p=(l.y+p.y)/2;do r.y>p!==r.next.y>p&&r.next.y!==r.y&&n<(r.next.x-r.x)*(p-r.y)/(r.next.y-r.y)+r.x&&(v=!v),r=r.next;while(r!==l);r=v}l=r}if(l){a=ff(g,h);g=Wc(g,g.next);a=Wc(a,a.next);Xc(g,b,c,d,e, f);Xc(a,b,c,d,e,f);break a}h=h.next}g=g.next}while(g!==a)}break}}}}function Pg(a,b){return a.x-b.x}function Qg(a,b){var c=b,d=a.x,e=a.y,f=-Infinity;do{if(e<=c.y&&e>=c.next.y&&c.next.y!==c.y){var g=c.x+(e-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(g<=d&&g>f){f=g;if(g===d){if(e===c.y)return c;if(e===c.next.y)return c.next}var h=c.x=c.x&&c.x>=g&&d!==c.x&&zd(eh.x)&&Yc(c,a)&&(h=c,m=v)}c=c.next}return h}function ce(a,b,c,d,e){a=32767*(a-c)*e;b=32767*(b-d)*e;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;b=(b|b<<8)&16711935;b=(b|b<<4)&252645135;b=(b|b<<2)&858993459;return(a|a<<1)&1431655765|((b|b<<1)&1431655765)<<1}function Rg(a){var b=a,c=a;do b.xoa(a.prev,a,a.next)?0<=oa(a,b,a.next)&&0<=oa(a,a.prev,b):0>oa(a,b,a.prev)||0>oa(a,a.next,b)}function ff(a,b){var c=new de(a.i,a.x,a.y),d=new de(b.i,b.x,b.y),e=a.next,f=b.prev;a.next=b;b.prev=a;c.next=e;e.prev= c;d.next=c;c.prev=d;f.next=d;d.prev=f;return d}function df(a,b,c,d){a=new de(a,b,c);d?(a.next=d.next,a.prev=d,d.next.prev=a,d.next=a):(a.prev=a,a.next=a);return a}function Vc(a){a.next.prev=a.prev;a.prev.next=a.next;a.prevZ&&(a.prevZ.nextZ=a.nextZ);a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function de(a,b,c){this.i=a;this.x=b;this.y=c;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function gf(a){var b=a.length;2Number.EPSILON){var l=Math.sqrt(h),m=Math.sqrt(f*f+g*g);h=b.x-e/l;b=b.y+d/l; g=((c.x-g/m-h)*g-(c.y+f/m-b)*f)/(d*g-e*f);f=h+d*g-a.x;d=b+e*g-a.y;e=f*f+d*d;if(2>=e)return new B(f,d);e=Math.sqrt(e/2)}else a=!1,d>Number.EPSILON?f>Number.EPSILON&&(a=!0):d<-Number.EPSILON?f<-Number.EPSILON&&(a=!0):Math.sign(e)===Math.sign(g)&&(a=!0),a?(f=-e,e=Math.sqrt(h)):(f=d,d=e,e=Math.sqrt(h/2));return new B(f/e,d/e)}function h(a,b){for(N=a.length;0<=--N;){var c=N;var f=N-1;0>f&&(f=a.length-1);var g,h=x+2*M;for(g=0;gk;k++){var n=m[f[k]];var t=m[f[(k+1)%3]];d[0]=Math.min(n,t);d[1]=Math.max(n,t);n=d[0]+","+d[1];void 0===e[n]?e[n]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[n].face2=h}for(n in e)if(d=e[n],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=b)f=a[d.index1], c.push(f.x,f.y,f.z),f=a[d.index2],c.push(f.x,f.y,f.z);this.addAttribute("position",new z(c,3))}function Ab(a,b,c,d,e,f,g,h){P.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:a,radiusBottom:b,height:c,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new ab(a,b,c,d,e,f,g,h));this.mergeVertices()}function ab(a,b,c,d,e,f,g,h){function l(c){var e,f=new B,l=new p,v=0,u=!0===c?a:b,x=!0===c?1:-1;var z=r;for(e=1;e<=d;e++)n.push(0,y*x,0),t.push(0, x,0),q.push(.5,.5),r++;var G=r;for(e=0;e<=d;e++){var H=e/d*h+g,D=Math.cos(H);H=Math.sin(H);l.x=u*H;l.y=y*x;l.z=u*D;n.push(l.x,l.y,l.z);t.push(0,x,0);f.x=.5*D+.5;f.y=.5*H*x+.5;q.push(f.x,f.y);r++}for(e=0;ethis.duration&&this.resetDuration();this.optimize()}function Pd(a){this.manager=void 0!==a?a:ya;this.textures={}}function ie(a){this.manager=void 0!==a?a: ya}function pc(){}function je(a){"boolean"===typeof a&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),a=void 0);this.manager=void 0!==a?a:ya;this.withCredentials=!1}function nf(a){this.manager=void 0!==a?a:ya;this.texturePath=""}function ke(a){"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported.");"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported.");this.manager= void 0!==a?a:ya;this.options=void 0}function le(){this.type="ShapePath";this.color=new G;this.subPaths=[];this.currentPath=null}function me(a){this.type="Font";this.data=a}function of(a){this.manager=void 0!==a?a:ya}function ne(a){this.manager=void 0!==a?a:ya}function pf(){this.type="StereoCamera";this.aspect=1;this.eyeSep=.064;this.cameraL=new Z;this.cameraL.layers.enable(1);this.cameraL.matrixAutoUpdate=!1;this.cameraR=new Z;this.cameraR.layers.enable(2);this.cameraR.matrixAutoUpdate=!1}function kd(a, b,c){H.call(this);this.type="CubeCamera";var d=new Z(90,1,a,b);d.up.set(0,-1,0);d.lookAt(new p(1,0,0));this.add(d);var e=new Z(90,1,a,b);e.up.set(0,-1,0);e.lookAt(new p(-1,0,0));this.add(e);var f=new Z(90,1,a,b);f.up.set(0,0,1);f.lookAt(new p(0,1,0));this.add(f);var g=new Z(90,1,a,b);g.up.set(0,0,-1);g.lookAt(new p(0,-1,0));this.add(g);var h=new Z(90,1,a,b);h.up.set(0,-1,0);h.lookAt(new p(0,0,1));this.add(h);var l=new Z(90,1,a,b);l.up.set(0,-1,0);l.lookAt(new p(0,0,-1));this.add(l);this.renderTarget= new Lb(c,c,{format:1022,magFilter:1006,minFilter:1006});this.renderTarget.texture.name="CubeCamera";this.update=function(a,b){null===this.parent&&this.updateMatrixWorld();var c=this.renderTarget,m=c.texture.generateMipmaps;c.texture.generateMipmaps=!1;c.activeCubeFace=0;a.render(b,d,c);c.activeCubeFace=1;a.render(b,e,c);c.activeCubeFace=2;a.render(b,f,c);c.activeCubeFace=3;a.render(b,g,c);c.activeCubeFace=4;a.render(b,h,c);c.texture.generateMipmaps=m;c.activeCubeFace=5;a.render(b,l,c);a.setRenderTarget(null)}; this.clear=function(a,b,c,d){for(var e=this.renderTarget,f=0;6>f;f++)e.activeCubeFace=f,a.setRenderTarget(e),a.clear(b,c,d);a.setRenderTarget(null)}}function oe(){H.call(this);this.type="AudioListener";this.context=pe.getContext();this.gain=this.context.createGain();this.gain.connect(this.context.destination);this.filter=null}function qc(a){H.call(this);this.type="Audio";this.context=a.context;this.gain=this.context.createGain();this.gain.connect(a.getInput());this.autoplay=!1;this.buffer=null;this.loop= !1;this.offset=this.startTime=0;this.playbackRate=1;this.isPlaying=!1;this.hasPlaybackControl=!0;this.sourceType="empty";this.filters=[]}function qe(a){qc.call(this,a);this.panner=this.context.createPanner();this.panner.connect(this.gain)}function re(a,b){this.analyser=a.context.createAnalyser();this.analyser.fftSize=void 0!==b?b:2048;this.data=new Uint8Array(this.analyser.frequencyBinCount);a.getOutput().connect(this.analyser)}function se(a,b,c){this.binding=a;this.valueSize=c;a=Float64Array;switch(b){case "quaternion":b= this._slerp;break;case "string":case "bool":a=Array;b=this._select;break;default:b=this._lerp}this.buffer=new a(4*c);this._mixBufferRegion=b;this.referenceCount=this.useCount=this.cumulativeWeight=0}function qf(a,b,c){c=c||ra.parseTrackName(b);this._targetGroup=a;this._bindings=a.subscribe_(b,c)}function ra(a,b,c){this.path=b;this.parsedPath=c||ra.parseTrackName(b);this.node=ra.findNode(a,this.parsedPath.nodeName)||a;this.rootNode=a}function rf(){this.uuid=J.generateUUID();this._objects=Array.prototype.slice.call(arguments); this.nCachedObjects_=0;var a={};this._indicesByUUID=a;for(var b=0,c=arguments.length;b!==c;++b)a[arguments[b].uuid]=b;this._paths=[];this._parsedPaths=[];this._bindings=[];this._bindingsIndicesByPath={};var d=this;this.stats={objects:{get total(){return d._objects.length},get inUse(){return this.total-d.nCachedObjects_}},get bindingsPerObject(){return d._bindings.length}}}function sf(a,b,c){this._mixer=a;this._clip=b;this._localRoot=c||null;a=b.tracks;b=a.length;c=Array(b);for(var d={endingStart:2400, endingEnd:2400},e=0;e!==b;++e){var f=a[e].createInterpolant(null);c[e]=f;f.settings=d}this._interpolantSettings=d;this._interpolants=c;this._propertyBindings=Array(b);this._weightInterpolant=this._timeScaleInterpolant=this._byClipCacheIndex=this._cacheIndex=null;this.loop=2201;this._loopCount=-1;this._startTime=null;this.time=0;this._effectiveWeight=this.weight=this._effectiveTimeScale=this.timeScale=1;this.repetitions=Infinity;this.paused=!1;this.enabled=!0;this.clampWhenFinished=!1;this.zeroSlopeAtEnd= this.zeroSlopeAtStart=!0}function te(a){this._root=a;this._initMemoryManager();this.time=this._accuIndex=0;this.timeScale=1}function Qd(a,b){"string"===typeof a&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),a=b);this.value=a}function ue(){D.call(this);this.type="InstancedBufferGeometry";this.maxInstancedCount=void 0}function ve(a,b,c,d){this.data=a;this.itemSize=b;this.offset=c;this.normalized=!0===d}function rc(a,b){this.array=a;this.stride=b;this.count=void 0!==a?a.length/ b:0;this.dynamic=!1;this.updateRange={offset:0,count:-1};this.version=0}function we(a,b,c){rc.call(this,a,b);this.meshPerAttribute=c||1}function xe(a,b,c){L.call(this,a,b);this.meshPerAttribute=c||1}function tf(a,b,c,d){this.ray=new sb(a,b);this.near=c||0;this.far=d||Infinity;this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}};Object.defineProperties(this.params,{PointCloud:{get:function(){console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");return this.Points}}})} function uf(a,b){return a.distance-b.distance}function ye(a,b,c,d){if(!1!==a.visible&&(a.raycast(b,c),!0===d)){a=a.children;d=0;for(var e=a.length;dc;c++,d++){var e=c/32*Math.PI*2,f=d/32*Math.PI*2;b.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}a.addAttribute("position",new z(b,3));b=new T({fog:!1});this.cone=new Y(a,b);this.add(this.cone);this.update()}function yf(a){var b=[];a&&a.isBone&& b.push(a);for(var c=0;ca?-1:0b;b++)a[b]=(16>b?"0":"")+b.toString(16);return function(){var b=4294967295*Math.random()|0,d=4294967295*Math.random()|0,e=4294967295* Math.random()|0,f=4294967295*Math.random()|0;return(a[b&255]+a[b>>8&255]+a[b>>16&255]+a[b>>24&255]+"-"+a[d&255]+a[d>>8&255]+"-"+a[d>>16&15|64]+a[d>>24&255]+"-"+a[e&63|128]+a[e>>8&255]+"-"+a[e>>16&255]+a[e>>24&255]+a[f&255]+a[f>>8&255]+a[f>>16&255]+a[f>>24&255]).toUpperCase()}}(),clamp:function(a,b,c){return Math.max(b,Math.min(c,a))},euclideanModulo:function(a,b){return(a%b+b)%b},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},lerp:function(a,b,c){return(1-c)*a+c*b},smoothstep:function(a, b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*(3-2*a)},smootherstep:function(a,b,c){if(a<=b)return 0;if(a>=c)return 1;a=(a-b)/(c-b);return a*a*a*(a*(6*a-15)+10)},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(a){return a*J.DEG2RAD},radToDeg:function(a){return a*J.RAD2DEG},isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},ceilPowerOfTwo:function(a){return Math.pow(2, Math.ceil(Math.log(a)/Math.LN2))},floorPowerOfTwo:function(a){return Math.pow(2,Math.floor(Math.log(a)/Math.LN2))}};Object.defineProperties(B.prototype,{width:{get:function(){return this.x},set:function(a){this.x=a}},height:{get:function(){return this.y},set:function(a){this.y=a}}});Object.assign(B.prototype,{isVector2:!0,set:function(a,b){this.x=a;this.y=b;return this},setScalar:function(a){this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this}, setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(a){this.x=a.x;this.y=a.y;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(a,b);this.x+=a.x;this.y+=a.y;return this},addScalar:function(a){this.x+=a;this.y+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;return this},subScalar:function(a){this.x-=a;this.y-=a;return this}, subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiply:function(a){this.x*=a.x;this.y*=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},divide:function(a){this.x/=a.x;this.y/=a.y;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},applyMatrix3:function(a){var b=this.x,c=this.y;a=a.elements;this.x=a[0]*b+a[3]*c+a[6];this.y=a[1]*b+a[4]*c+a[7];return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);return this}, max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));return this},clampScalar:function(){var a=new B,b=new B;return function(c,d){a.set(c,c);b.set(d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y); return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this},negate:function(){this.x=-this.x;this.y=-this.y;return this},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x* this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var a=Math.atan2(this.y,this.x);0>a&&(a+=2*Math.PI);return a},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x;a=this.y-a.y;return b*b+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)},setLength:function(a){return this.normalize().multiplyScalar(a)}, lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."); this.x=a.getX(b);this.y=a.getY(b);return this},rotateAround:function(a,b){var c=Math.cos(b);b=Math.sin(b);var d=this.x-a.x,e=this.y-a.y;this.x=d*c-e*b+a.x;this.y=d*b+e*c+a.y;return this}});Object.assign(R.prototype,{isMatrix4:!0,set:function(a,b,c,d,e,f,g,h,l,m,k,n,t,q,r,p){var v=this.elements;v[0]=a;v[4]=b;v[8]=c;v[12]=d;v[1]=e;v[5]=f;v[9]=g;v[13]=h;v[2]=l;v[6]=m;v[10]=k;v[14]=n;v[3]=t;v[7]=q;v[11]=r;v[15]=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this}, clone:function(){return(new R).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return this},copyPosition:function(a){var b=this.elements;a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractBasis:function(a,b,c){a.setFromMatrixColumn(this,0);b.setFromMatrixColumn(this,1);c.setFromMatrixColumn(this, 2);return this},makeBasis:function(a,b,c){this.set(a.x,b.x,c.x,0,a.y,b.y,c.y,0,a.z,b.z,c.z,0,0,0,0,1);return this},extractRotation:function(){var a=new p;return function(b){var c=this.elements,d=b.elements,e=1/a.setFromMatrixColumn(b,0).length(),f=1/a.setFromMatrixColumn(b,1).length();b=1/a.setFromMatrixColumn(b,2).length();c[0]=d[0]*e;c[1]=d[1]*e;c[2]=d[2]*e;c[3]=0;c[4]=d[4]*f;c[5]=d[5]*f;c[6]=d[6]*f;c[7]=0;c[8]=d[8]*b;c[9]=d[9]*b;c[10]=d[10]*b;c[11]=0;c[12]=0;c[13]=0;c[14]=0;c[15]=1;return this}}(), makeRotationFromEuler:function(a){a&&a.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var b=this.elements,c=a.x,d=a.y,e=a.z,f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=Math.cos(e);e=Math.sin(e);if("XYZ"===a.order){a=f*h;var l=f*e,m=c*h,k=c*e;b[0]=g*h;b[4]=-g*e;b[8]=d;b[1]=l+m*d;b[5]=a-k*d;b[9]=-c*g;b[2]=k-a*d;b[6]=m+l*d;b[10]=f*g}else"YXZ"===a.order?(a=g*h,l=g*e,m=d*h,k=d*e,b[0]=a+k*c,b[4]=m*c-l, b[8]=f*d,b[1]=f*e,b[5]=f*h,b[9]=-c,b[2]=l*c-m,b[6]=k+a*c,b[10]=f*g):"ZXY"===a.order?(a=g*h,l=g*e,m=d*h,k=d*e,b[0]=a-k*c,b[4]=-f*e,b[8]=m+l*c,b[1]=l+m*c,b[5]=f*h,b[9]=k-a*c,b[2]=-f*d,b[6]=c,b[10]=f*g):"ZYX"===a.order?(a=f*h,l=f*e,m=c*h,k=c*e,b[0]=g*h,b[4]=m*d-l,b[8]=a*d+k,b[1]=g*e,b[5]=k*d+a,b[9]=l*d-m,b[2]=-d,b[6]=c*g,b[10]=f*g):"YZX"===a.order?(a=f*g,l=f*d,m=c*g,k=c*d,b[0]=g*h,b[4]=k-a*e,b[8]=m*e+l,b[1]=e,b[5]=f*h,b[9]=-c*h,b[2]=-d*h,b[6]=l*e+m,b[10]=a-k*e):"XZY"===a.order&&(a=f*g,l=f*d,m=c*g,k= c*d,b[0]=g*h,b[4]=-e,b[8]=d*h,b[1]=a*e+k,b[5]=f*h,b[9]=l*e-m,b[2]=m*e-l,b[6]=c*h,b[10]=k*e+a);b[3]=0;b[7]=0;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return this},makeRotationFromQuaternion:function(){var a=new p(0,0,0),b=new p(1,1,1);return function(c){return this.compose(a,c,b)}}(),lookAt:function(){var a=new p,b=new p,c=new p;return function(d,e,f){var g=this.elements;c.subVectors(d,e);0===c.lengthSq()&&(c.z=1);c.normalize();a.crossVectors(f,c);0===a.lengthSq()&&(1===Math.abs(f.z)?c.x+=1E-4:c.z+= 1E-4,c.normalize(),a.crossVectors(f,c));a.normalize();b.crossVectors(c,a);g[0]=a.x;g[4]=b.x;g[8]=c.x;g[1]=a.y;g[5]=b.y;g[9]=c.y;g[2]=a.z;g[6]=b.z;g[10]=c.z;return this}}(),multiply:function(a,b){return void 0!==b?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(a,b)):this.multiplyMatrices(this,a)},premultiply:function(a){return this.multiplyMatrices(a,this)},multiplyMatrices:function(a,b){var c=a.elements,d=b.elements; b=this.elements;a=c[0];var e=c[4],f=c[8],g=c[12],h=c[1],l=c[5],m=c[9],k=c[13],n=c[2],t=c[6],q=c[10],r=c[14],p=c[3],y=c[7],w=c[11];c=c[15];var x=d[0],A=d[4],C=d[8],O=d[12],Q=d[1],z=d[5],B=d[9],H=d[13],G=d[2],D=d[6],E=d[10],J=d[14],L=d[3],I=d[7],K=d[11];d=d[15];b[0]=a*x+e*Q+f*G+g*L;b[4]=a*A+e*z+f*D+g*I;b[8]=a*C+e*B+f*E+g*K;b[12]=a*O+e*H+f*J+g*d;b[1]=h*x+l*Q+m*G+k*L;b[5]=h*A+l*z+m*D+k*I;b[9]=h*C+l*B+m*E+k*K;b[13]=h*O+l*H+m*J+k*d;b[2]=n*x+t*Q+q*G+r*L;b[6]=n*A+t*z+q*D+r*I;b[10]=n*C+t*B+q*E+r*K;b[14]=n* O+t*H+q*J+r*d;b[3]=p*x+y*Q+w*G+c*L;b[7]=p*A+y*z+w*D+c*I;b[11]=p*C+y*B+w*E+c*K;b[15]=p*O+y*H+w*J+c*d;return this},multiplyScalar:function(a){var b=this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},applyToBufferAttribute:function(){var a=new p;return function(b){for(var c=0,d=b.count;cthis.determinant()&&(g=-g);c.x=f[12];c.y=f[13];c.z=f[14];b.copy(this);c=1/g;f=1/h;var m=1/l;b.elements[0]*=c; b.elements[1]*=c;b.elements[2]*=c;b.elements[4]*=f;b.elements[5]*=f;b.elements[6]*=f;b.elements[8]*=m;b.elements[9]*=m;b.elements[10]*=m;d.setFromRotationMatrix(b);e.x=g;e.y=h;e.z=l;return this}}(),makePerspective:function(a,b,c,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(c-d);g[9]=(c+d)/(c-d);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+ e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=1/(b-a),l=1/(c-d),m=1/(f-e);g[0]=2*h;g[4]=0;g[8]=0;g[12]=-((b+a)*h);g[1]=0;g[5]=2*l;g[9]=0;g[13]=-((c+d)*l);g[2]=0;g[6]=0;g[10]=-2*m;g[14]=-((f+e)*m);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},equals:function(a){var b=this.elements;a=a.elements;for(var c=0;16>c;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;16>c;c++)this.elements[c]= a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a}});Object.assign(ca,{slerp:function(a,b,c,d){return c.copy(a).slerp(b,d)},slerpFlat:function(a,b,c,d,e,f,g){var h=c[d+0],l=c[d+1],m=c[d+2];c=c[d+3];d=e[f+0];var k=e[f+1],n=e[f+2];e=e[f+3];if(c!== e||h!==d||l!==k||m!==n){f=1-g;var t=h*d+l*k+m*n+c*e,q=0<=t?1:-1,p=1-t*t;p>Number.EPSILON&&(p=Math.sqrt(p),t=Math.atan2(p,t*q),f=Math.sin(f*t)/p,g=Math.sin(g*t)/p);q*=g;h=h*f+d*q;l=l*f+k*q;m=m*f+n*q;c=c*f+e*q;f===1-g&&(g=1/Math.sqrt(h*h+l*l+m*m+c*c),h*=g,l*=g,m*=g,c*=g)}a[b]=h;a[b+1]=l;a[b+2]=m;a[b+3]=c}});Object.defineProperties(ca.prototype,{x:{get:function(){return this._x},set:function(a){this._x=a;this.onChangeCallback()}},y:{get:function(){return this._y},set:function(a){this._y=a;this.onChangeCallback()}}, z:{get:function(){return this._z},set:function(a){this._z=a;this.onChangeCallback()}},w:{get:function(){return this._w},set:function(a){this._w=a;this.onChangeCallback()}}});Object.assign(ca.prototype,{set:function(a,b,c,d){this._x=a;this._y=b;this._z=c;this._w=d;this.onChangeCallback();return this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(a){this._x=a.x;this._y=a.y;this._z=a.z;this._w=a.w;this.onChangeCallback();return this},setFromEuler:function(a, b){if(!a||!a.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var c=a._x,d=a._y,e=a._z;a=a.order;var f=Math.cos,g=Math.sin,h=f(c/2),l=f(d/2);f=f(e/2);c=g(c/2);d=g(d/2);e=g(e/2);"XYZ"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f-c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f-c*d*e):"YXZ"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f-c*l*e,this._z=h*l*e-c*d*f,this._w=h*l*f+c*d*e):"ZXY"===a?(this._x=c*l*f-h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e+c*d* f,this._w=h*l*f-c*d*e):"ZYX"===a?(this._x=c*l*f-h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e-c*d*f,this._w=h*l*f+c*d*e):"YZX"===a?(this._x=c*l*f+h*d*e,this._y=h*d*f+c*l*e,this._z=h*l*e-c*d*f,this._w=h*l*f-c*d*e):"XZY"===a&&(this._x=c*l*f-h*d*e,this._y=h*d*f-c*l*e,this._z=h*l*e+c*d*f,this._w=h*l*f+c*d*e);if(!1!==b)this.onChangeCallback();return this},setFromAxisAngle:function(a,b){b/=2;var c=Math.sin(b);this._x=a.x*c;this._y=a.y*c;this._z=a.z*c;this._w=Math.cos(b);this.onChangeCallback();return this},setFromRotationMatrix:function(a){var b= a.elements,c=b[0];a=b[4];var d=b[8],e=b[1],f=b[5],g=b[9],h=b[2],l=b[6];b=b[10];var m=c+f+b;0f&&c>b?(c=2*Math.sqrt(1+c-f-b),this._w=(l-g)/c,this._x=.25*c,this._y=(a+e)/c,this._z=(d+h)/c):f>b?(c=2*Math.sqrt(1+f-c-b),this._w=(d-h)/c,this._x=(a+e)/c,this._y=.25*c,this._z=(g+l)/c):(c=2*Math.sqrt(1+b-c-f),this._w=(e-a)/c,this._x=(d+h)/c,this._y=(g+l)/c,this._z=.25*c);this.onChangeCallback();return this},setFromUnitVectors:function(){var a= new p,b;return function(c,d){void 0===a&&(a=new p);b=c.dot(d)+1;1E-6>b?(b=0,Math.abs(c.x)>Math.abs(c.z)?a.set(-c.y,c.x,0):a.set(0,-c.z,c.y)):a.crossVectors(c,d);this._x=a.x;this._y=a.y;this._z=a.z;this._w=b;return this.normalize()}}(),inverse:function(){return this.conjugate()},conjugate:function(){this._x*=-1;this._y*=-1;this._z*=-1;this.onChangeCallback();return this},dot:function(a){return this._x*a._x+this._y*a._y+this._z*a._z+this._w*a._w},lengthSq:function(){return this._x*this._x+this._y*this._y+ this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var a=this.length();0===a?(this._z=this._y=this._x=0,this._w=1):(a=1/a,this._x*=a,this._y*=a,this._z*=a,this._w*=a);this.onChangeCallback();return this},multiply:function(a,b){return void 0!==b?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(a,b)):this.multiplyQuaternions(this, a)},premultiply:function(a){return this.multiplyQuaternions(a,this)},multiplyQuaternions:function(a,b){var c=a._x,d=a._y,e=a._z;a=a._w;var f=b._x,g=b._y,h=b._z;b=b._w;this._x=c*b+a*f+d*h-e*g;this._y=d*b+a*g+e*f-c*h;this._z=e*b+a*h+c*g-d*f;this._w=a*b-c*f-d*g-e*h;this.onChangeCallback();return this},slerp:function(a,b){if(0===b)return this;if(1===b)return this.copy(a);var c=this._x,d=this._y,e=this._z,f=this._w,g=f*a._w+c*a._x+d*a._y+e*a._z;0>g?(this._w=-a._w,this._x=-a._x,this._y=-a._y,this._z=-a._z, g=-g):this.copy(a);if(1<=g)return this._w=f,this._x=c,this._y=d,this._z=e,this;a=1-g*g;if(a<=Number.EPSILON)return g=1-b,this._w=g*f+b*this._w,this._x=g*c+b*this._x,this._y=g*d+b*this._y,this._z=g*e+b*this._z,this.normalize();a=Math.sqrt(a);var h=Math.atan2(a,g);g=Math.sin((1-b)*h)/a;b=Math.sin(b*h)/a;this._w=f*g+this._w*b;this._x=c*g+this._x*b;this._y=d*g+this._y*b;this._z=e*g+this._z*b;this.onChangeCallback();return this},equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&& a._w===this._w},fromArray:function(a,b){void 0===b&&(b=0);this._x=a[b];this._y=a[b+1];this._z=a[b+2];this._w=a[b+3];this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._w;return a},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}});Object.assign(p.prototype,{isVector3:!0,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setScalar:function(a){this.z=this.y= this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x, this.y,this.z)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addScaledVector:function(a,b){this.x+=a.x*b;this.y+=a.y*b;this.z+= a.z*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},multiply:function(a,b){if(void 0!==b)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."), this.multiplyVectors(a,b);this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},multiplyVectors:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},applyEuler:function(){var a=new ca;return function(b){b&&b.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(a.setFromEuler(b))}}(),applyAxisAngle:function(){var a=new ca;return function(b, c){return this.applyQuaternion(a.setFromAxisAngle(b,c))}}(),applyMatrix3:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[3]*c+a[6]*d;this.y=a[1]*b+a[4]*c+a[7]*d;this.z=a[2]*b+a[5]*c+a[8]*d;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z;a=a.elements;var e=1/(a[3]*b+a[7]*c+a[11]*d+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*d+a[12])*e;this.y=(a[1]*b+a[5]*c+a[9]*d+a[13])*e;this.z=(a[2]*b+a[6]*c+a[10]*d+a[14])*e;return this},applyQuaternion:function(a){var b=this.x, c=this.y,d=this.z,e=a.x,f=a.y,g=a.z;a=a.w;var h=a*b+f*d-g*c,l=a*c+g*b-e*d,m=a*d+e*c-f*b;b=-e*b-f*c-g*d;this.x=h*a+b*-e+l*-g-m*-f;this.y=l*a+b*-f+m*-e-h*-g;this.z=m*a+b*-g+h*-f-l*-e;return this},project:function(){var a=new R;return function(b){a.multiplyMatrices(b.projectionMatrix,a.getInverse(b.matrixWorld));return this.applyMatrix4(a)}}(),unproject:function(){var a=new R;return function(b){a.multiplyMatrices(b.matrixWorld,a.getInverse(b.projectionMatrix));return this.applyMatrix4(a)}}(),transformDirection:function(a){var b= this.x,c=this.y,d=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d;this.y=a[1]*b+a[5]*c+a[9]*d;this.z=a[2]*b+a[6]*c+a[10]*d;return this.normalize()},divide:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this},clamp:function(a, b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this},clampScalar:function(){var a=new p,b=new p;return function(c,d){a.set(c,c,c);b.set(d,d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this},ceil:function(){this.x= Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this},dot:function(a){return this.x*a.x+this.y* a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},lerpVectors:function(a, b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},cross:function(a,b){return void 0!==b?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(a,b)):this.crossVectors(this,a)},crossVectors:function(a,b){var c=a.x,d=a.y;a=a.z;var e=b.x,f=b.y;b=b.z;this.x=d*b-a*f;this.y=a*e-c*b;this.z=c*f-d*e;return this},projectOnVector:function(a){var b=a.dot(this)/a.lengthSq();return this.copy(a).multiplyScalar(b)},projectOnPlane:function(){var a= new p;return function(b){a.copy(this).projectOnVector(b);return this.sub(a)}}(),reflect:function(){var a=new p;return function(b){return this.sub(a.copy(b).multiplyScalar(2*this.dot(b)))}}(),angleTo:function(a){a=this.dot(a)/Math.sqrt(this.lengthSq()*a.lengthSq());return Math.acos(J.clamp(a,-1,1))},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},manhattanDistanceTo:function(a){return Math.abs(this.x- a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)},setFromSpherical:function(a){var b=Math.sin(a.phi)*a.radius;this.x=b*Math.sin(a.theta);this.y=Math.cos(a.phi)*a.radius;this.z=b*Math.cos(a.theta);return this},setFromCylindrical:function(a){this.x=a.radius*Math.sin(a.theta);this.y=a.y;this.z=a.radius*Math.cos(a.theta);return this},setFromMatrixPosition:function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this},setFromMatrixScale:function(a){var b=this.setFromMatrixColumn(a,0).length(), c=this.setFromMatrixColumn(a,1).length();a=this.setFromMatrixColumn(a,2).length();this.x=b;this.y=c;this.z=a;return this},setFromMatrixColumn:function(a,b){return this.fromArray(a.elements,4*b)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},fromArray:function(a,b){void 0===b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a},fromBufferAttribute:function(a,b,c){void 0!== c&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);return this}});Object.assign(la.prototype,{isMatrix3:!0,set:function(a,b,c,d,e,f,g,h,l){var m=this.elements;m[0]=a;m[1]=d;m[2]=g;m[3]=b;m[4]=e;m[5]=h;m[6]=c;m[7]=f;m[8]=l;return this},identity:function(){this.set(1,0,0,0,1,0,0,0,1);return this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(a){var b=this.elements;a=a.elements; b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return this},setFromMatrix4:function(a){a=a.elements;this.set(a[0],a[4],a[8],a[1],a[5],a[9],a[2],a[6],a[10]);return this},applyToBufferAttribute:function(){var a=new p;return function(b){for(var c=0,d=b.count;cc;c++)if(b[c]!==a[c])return!1;return!0},fromArray:function(a,b){void 0===b&&(b=0);for(var c=0;9>c;c++)this.elements[c]=a[c+b];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);var c=this.elements;a[b]=c[0];a[b+1]=c[1]; a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a}});var Ff=0;ea.DEFAULT_IMAGE=void 0;ea.DEFAULT_MAPPING=300;ea.prototype=Object.assign(Object.create(za.prototype),{constructor:ea,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.name=a.name;this.image=a.image;this.mipmaps= a.mipmaps.slice(0);this.mapping=a.mapping;this.wrapS=a.wrapS;this.wrapT=a.wrapT;this.magFilter=a.magFilter;this.minFilter=a.minFilter;this.anisotropy=a.anisotropy;this.format=a.format;this.type=a.type;this.offset.copy(a.offset);this.repeat.copy(a.repeat);this.center.copy(a.center);this.rotation=a.rotation;this.matrixAutoUpdate=a.matrixAutoUpdate;this.matrix.copy(a.matrix);this.generateMipmaps=a.generateMipmaps;this.premultiplyAlpha=a.premultiplyAlpha;this.flipY=a.flipY;this.unpackAlignment=a.unpackAlignment; this.encoding=a.encoding;return this},toJSON:function(a){function b(a){if(a instanceof HTMLCanvasElement)var b=a;else{b=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");b.width=a.width;b.height=a.height;var c=b.getContext("2d");a instanceof ImageData?c.putImageData(a,0,0):c.drawImage(a,0,0,a.width,a.height)}return 2048a.x||1a.x?0:1;break;case 1002:a.x=1===Math.abs(Math.floor(a.x)%2)?Math.ceil(a.x)-a.x:a.x-Math.floor(a.x)}if(0>a.y||1a.y?0:1;break;case 1002:a.y=1===Math.abs(Math.floor(a.y)%2)?Math.ceil(a.y)-a.y:a.y-Math.floor(a.y)}this.flipY&&(a.y=1-a.y)}}});Object.defineProperty(ea.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(W.prototype,{isVector4:!0,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setScalar:function(a){this.w=this.z=this.y=this.x=a;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this}, setZ:function(a){this.z=a;return this},setW:function(a){this.w=a;return this},setComponent:function(a,b){switch(a){case 0:this.x=b;break;case 1:this.y=b;break;case 2:this.z=b;break;case 3:this.w=b;break;default:throw Error("index is out of range: "+a);}return this},getComponent:function(a){switch(a){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+a);}},clone:function(){return new this.constructor(this.x,this.y,this.z, this.w)},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1;return this},add:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(a,b);this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;this.w+=a;return this},addVectors:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addScaledVector:function(a, b){this.x+=a.x*b;this.y+=a.y*b;this.z+=a.z*b;this.w+=a.w*b;return this},sub:function(a,b){if(void 0!==b)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(a,b);this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},subScalar:function(a){this.x-=a;this.y-=a;this.z-=a;this.w-=a;return this},subVectors:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},multiplyScalar:function(a){this.x*= a;this.y*=a;this.z*=a;this.w*=a;return this},applyMatrix4:function(a){var b=this.x,c=this.y,d=this.z,e=this.w;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*d+a[12]*e;this.y=a[1]*b+a[5]*c+a[9]*d+a[13]*e;this.z=a[2]*b+a[6]*c+a[10]*d+a[14]*e;this.w=a[3]*b+a[7]*c+a[11]*d+a[15]*e;return this},divideScalar:function(a){return this.multiplyScalar(1/a)},setAxisAngleFromQuaternion:function(a){this.w=2*Math.acos(a.w);var b=Math.sqrt(1-a.w*a.w);1E-4>b?(this.x=1,this.z=this.y=0):(this.x=a.x/b,this.y=a.y/b,this.z=a.z/ b);return this},setAxisAngleFromRotationMatrix:function(a){a=a.elements;var b=a[0];var c=a[4];var d=a[8],e=a[1],f=a[5],g=a[9];var h=a[2];var l=a[6];var m=a[10];if(.01>Math.abs(c-e)&&.01>Math.abs(d-h)&&.01>Math.abs(g-l)){if(.1>Math.abs(c+e)&&.1>Math.abs(d+h)&&.1>Math.abs(g+l)&&.1>Math.abs(b+f+m-3))return this.set(1,0,0,0),this;a=Math.PI;b=(b+1)/2;f=(f+1)/2;m=(m+1)/2;c=(c+e)/4;d=(d+h)/4;g=(g+l)/4;b>f&&b>m?.01>b?(l=0,c=h=.707106781):(l=Math.sqrt(b),h=c/l,c=d/l):f>m?.01>f?(l=.707106781,h=0,c=.707106781): (h=Math.sqrt(f),l=c/h,c=g/h):.01>m?(h=l=.707106781,c=0):(c=Math.sqrt(m),l=d/c,h=g/c);this.set(l,h,c,a);return this}a=Math.sqrt((l-g)*(l-g)+(d-h)*(d-h)+(e-c)*(e-c));.001>Math.abs(a)&&(a=1);this.x=(l-g)/a;this.y=(d-h)/a;this.z=(e-c)/a;this.w=Math.acos((b+f+m-1)/2);return this},min:function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);this.w=Math.min(this.w,a.w);return this},max:function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z, a.z);this.w=Math.max(this.w,a.w);return this},clamp:function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));this.w=Math.max(a.w,Math.min(b.w,this.w));return this},clampScalar:function(){var a,b;return function(c,d){void 0===a&&(a=new W,b=new W);a.set(c,c,c,c);b.set(d,d,d,d);return this.clamp(a,b)}}(),clampLength:function(a,b){var c=this.length();return this.divideScalar(c||1).multiplyScalar(Math.max(a,Math.min(b,c)))}, floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this},ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this},round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this},roundToZero:function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y): Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this},negate:function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+ Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(a){return this.normalize().multiplyScalar(a)},lerp:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this},lerpVectors:function(a,b,c){return this.subVectors(b,a).multiplyScalar(c).add(a)},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z&&a.w===this.w},fromArray:function(a,b){void 0=== b&&(b=0);this.x=a[b];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a},fromBufferAttribute:function(a,b,c){void 0!==c&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute().");this.x=a.getX(b);this.y=a.getY(b);this.z=a.getZ(b);this.w=a.getW(b);return this}});kb.prototype=Object.assign(Object.create(za.prototype),{constructor:kb,isWebGLRenderTarget:!0, setSize:function(a,b){if(this.width!==a||this.height!==b)this.width=a,this.height=b,this.dispose();this.viewport.set(0,0,a,b);this.scissor.set(0,0,a,b)},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.width=a.width;this.height=a.height;this.viewport.copy(a.viewport);this.texture=a.texture.clone();this.depthBuffer=a.depthBuffer;this.stencilBuffer=a.stencilBuffer;this.depthTexture=a.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}}); Lb.prototype=Object.create(kb.prototype);Lb.prototype.constructor=Lb;Lb.prototype.isWebGLRenderTargetCube=!0;lb.prototype=Object.create(ea.prototype);lb.prototype.constructor=lb;lb.prototype.isDataTexture=!0;Object.assign(Xa.prototype,{isBox3:!0,set:function(a,b){this.min.copy(a);this.max.copy(b);return this},setFromArray:function(a){for(var b=Infinity,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,l=a.length;h e&&(e=m);k>f&&(f=k);n>g&&(g=n)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromBufferAttribute:function(a){for(var b=Infinity,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,l=a.count;he&&(e=m);k>f&&(f=k);n>g&&(g=n)}this.min.set(b,c,d);this.max.set(e,f,g);return this},setFromPoints:function(a){this.makeEmpty();for(var b=0,c=a.length;bthis.max.x||a.ythis.max.y||a.zthis.max.z?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y&&this.min.z<=a.min.z&&a.max.z<=this.max.z},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box3: .getParameter() target is now required"),b=new p);return b.set((a.x-this.min.x)/(this.max.x- this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y),(a.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y||a.max.zthis.max.z?!1:!0},intersectsSphere:function(){var a=new p;return function(b){this.clampPoint(b.center,a);return a.distanceToSquared(b.center)<=b.radius*b.radius}}(),intersectsPlane:function(a){if(0=a.constant},intersectsTriangle:function(){function a(a){var e;var f=0;for(e=a.length-3;f<=e;f+=3){h.fromArray(a,f);var g=m.x*Math.abs(h.x)+m.y*Math.abs(h.y)+m.z*Math.abs(h.z),l=b.dot(h),k=c.dot(h), n=d.dot(h);if(Math.max(-Math.max(l,k,n),Math.min(l,k,n))>g)return!1}return!0}var b=new p,c=new p,d=new p,e=new p,f=new p,g=new p,h=new p,l=new p,m=new p,k=new p;return function(h){if(this.isEmpty())return!1;this.getCenter(l);m.subVectors(this.max,l);b.subVectors(h.a,l);c.subVectors(h.b,l);d.subVectors(h.c,l);e.subVectors(c,b);f.subVectors(d,c);g.subVectors(b,d);h=[0,-e.z,e.y,0,-f.z,f.y,0,-g.z,g.y,e.z,0,-e.x,f.z,0,-f.x,g.z,0,-g.x,-e.y,e.x,0,-f.y,f.x,0,-g.y,g.x,0];if(!a(h))return!1;h=[1,0,0,0,1,0,0, 0,1];if(!a(h))return!1;k.crossVectors(e,f);h=[k.x,k.y,k.z];return a(h)}}(),clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box3: .clampPoint() target is now required"),b=new p);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a=new p;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),getBoundingSphere:function(){var a=new p;return function(b){void 0===b&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),b=new Ha); this.getCenter(b.center);b.radius=.5*this.getSize(a).length();return b}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);this.isEmpty()&&this.makeEmpty();return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},applyMatrix4:function(a){if(this.isEmpty())return this;a=a.elements;var b=a[0]*this.min.x,c=a[1]*this.min.x,d=a[2]*this.min.x,e=a[0]*this.max.x,f=a[1]*this.max.x,g=a[2]*this.max.x,h=a[4]*this.min.y,l=a[5]*this.min.y,m=a[6]*this.min.y,k=a[4]*this.max.y, n=a[5]*this.max.y,p=a[6]*this.max.y,q=a[8]*this.min.z,r=a[9]*this.min.z,u=a[10]*this.min.z,y=a[8]*this.max.z,w=a[9]*this.max.z,x=a[10]*this.max.z;this.min.x=Math.min(b,e)+Math.min(h,k)+Math.min(q,y)+a[12];this.min.y=Math.min(c,f)+Math.min(l,n)+Math.min(r,w)+a[13];this.min.z=Math.min(d,g)+Math.min(m,p)+Math.min(u,x)+a[14];this.max.x=Math.max(b,e)+Math.max(h,k)+Math.max(q,y)+a[12];this.max.y=Math.max(c,f)+Math.max(l,n)+Math.max(r,w)+a[13];this.max.z=Math.max(d,g)+Math.max(m,p)+Math.max(u,x)+a[14];return this}, translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});Object.assign(Ha.prototype,{set:function(a,b){this.center.copy(a);this.radius=b;return this},setFromPoints:function(){var a=new Xa;return function(b,c){var d=this.center;void 0!==c?d.copy(c):a.setFromPoints(b).getCenter(d);for(var e=c=0,f=b.length;e=this.radius},containsPoint:function(a){return a.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(a){return a.distanceTo(this.center)-this.radius},intersectsSphere:function(a){var b=this.radius+a.radius;return a.center.distanceToSquared(this.center)<=b*b},intersectsBox:function(a){return a.intersectsSphere(this)},intersectsPlane:function(a){return Math.abs(a.distanceToPoint(this.center))<= this.radius},clampPoint:function(a,b){var c=this.center.distanceToSquared(a);void 0===b&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),b=new p);b.copy(a);c>this.radius*this.radius&&(b.sub(this.center).normalize(),b.multiplyScalar(this.radius).add(this.center));return b},getBoundingBox:function(a){void 0===a&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),a=new Xa);a.set(this.center,this.center);a.expandByScalar(this.radius);return a},applyMatrix4:function(a){this.center.applyMatrix4(a); this.radius*=a.getMaxScaleOnAxis();return this},translate:function(a){this.center.add(a);return this},equals:function(a){return a.center.equals(this.center)&&a.radius===this.radius}});Object.assign(Ia.prototype,{set:function(a,b){this.normal.copy(a);this.constant=b;return this},setComponents:function(a,b,c,d){this.normal.set(a,b,c);this.constant=d;return this},setFromNormalAndCoplanarPoint:function(a,b){this.normal.copy(a);this.constant=-b.dot(this.normal);return this},setFromCoplanarPoints:function(){var a= new p,b=new p;return function(c,d,e){d=a.subVectors(e,d).cross(b.subVectors(c,d)).normalize();this.setFromNormalAndCoplanarPoint(d,c);return this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.normal.copy(a.normal);this.constant=a.constant;return this},normalize:function(){var a=1/this.normal.length();this.normal.multiplyScalar(a);this.constant*=a;return this},negate:function(){this.constant*=-1;this.normal.negate();return this},distanceToPoint:function(a){return this.normal.dot(a)+ this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){void 0===b&&(console.warn("THREE.Plane: .projectPoint() target is now required"),b=new p);return b.copy(this.normal).multiplyScalar(-this.distanceToPoint(a)).add(a)},intersectLine:function(){var a=new p;return function(b,c){void 0===c&&(console.warn("THREE.Plane: .intersectLine() target is now required"),c=new p);var d=b.delta(a),e=this.normal.dot(d);if(0===e){if(0===this.distanceToPoint(b.start))return c.copy(b.start)}else if(e= -(b.start.dot(this.normal)+this.constant)/e,!(0>e||1b&&0a&&0c;c++)b[c].copy(a.planes[c]);return this},setFromMatrix:function(a){var b=this.planes,c=a.elements;a=c[0];var d=c[1],e=c[2],f=c[3],g=c[4],h=c[5],l=c[6],m=c[7],k=c[8],n=c[9],p=c[10],q=c[11],r=c[12],u=c[13],y=c[14];c=c[15];b[0].setComponents(f-a,m-g,q-k,c-r).normalize();b[1].setComponents(f+a,m+g,q+k,c+r).normalize();b[2].setComponents(f+d,m+h,q+n,c+u).normalize();b[3].setComponents(f- d,m-h,q-n,c-u).normalize();b[4].setComponents(f-e,m-l,q-p,c-y).normalize();b[5].setComponents(f+e,m+l,q+p,c+y).normalize();return this},intersectsObject:function(){var a=new Ha;return function(b){var c=b.geometry;null===c.boundingSphere&&c.computeBoundingSphere();a.copy(c.boundingSphere).applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(),intersectsSprite:function(){var a=new Ha;return function(b){a.center.set(0,0,0);a.radius=.7071067811865476;a.applyMatrix4(b.matrixWorld);return this.intersectsSphere(a)}}(), intersectsSphere:function(a){var b=this.planes,c=a.center;a=-a.radius;for(var d=0;6>d;d++)if(b[d].distanceToPoint(c)e;e++){var f=d[e];a.x=0 g&&0>f)return!1}return!0}}(),containsPoint:function(a){for(var b=this.planes,c=0;6>c;c++)if(0>b[c].distanceToPoint(a))return!1;return!0}});var S={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n", aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n", bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n", clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif\n", clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n", color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\n", cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n", defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n", emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n", envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n", envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n", envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n", fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n", gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n", lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n", lights_pars_begin:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n", lights_pars_maps:"#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n", lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n", lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n", lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n", lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif\n", lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif\n", lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n", logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n", map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n", metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif", morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n", normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n",normal_fragment_maps:"#ifdef USE_NORMALMAP\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t#ifdef FLIP_SIDED\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalMatrix * normal );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n", normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tuniform mat3 normalMatrix;\n\t#else\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dFdx( vUv.st );\n\t\t\tvec2 st1 = dFdy( vUv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 N = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( S, T, N );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy *= normalScale;\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapN );\n\t\t}\n\t#endif\n#endif\n", packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n", premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n", roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n", shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n", shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n", shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n", skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n", skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n", specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n", uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n", uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif", uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n", cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n", depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n", distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}\n", equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\n", linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\n", meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n", meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}\n", normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n", normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n", points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}\n", shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}\n",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"}, Ba={merge:function(a){for(var b={},c=0;c>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSL:function(){function a(a,c,d){0>d&&(d+=1);1d?c:d<2/3?a+6*(c-a)*(2/3-d):a}return function(b, c,d){b=J.euclideanModulo(b,1);c=J.clamp(c,0,1);d=J.clamp(d,0,1);0===c?this.r=this.g=this.b=d:(c=.5>=d?d*(1+c):d+c-d*c,d=2*d-c,this.r=a(d,c,b+1/3),this.g=a(d,c,b),this.b=a(d,c,b-1/3));return this}}(),setStyle:function(a){function b(b){void 0!==b&&1>parseFloat(b)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var c;if(c=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var d=c[2];switch(c[1]){case "rgb":case "rgba":if(c=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r= Math.min(255,parseInt(c[1],10))/255,this.g=Math.min(255,parseInt(c[2],10))/255,this.b=Math.min(255,parseInt(c[3],10))/255,b(c[5]),this;if(c=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(c[1],10))/100,this.g=Math.min(100,parseInt(c[2],10))/100,this.b=Math.min(100,parseInt(c[3],10))/100,b(c[5]),this;break;case "hsl":case "hsla":if(c=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){d=parseFloat(c[1])/ 360;var e=parseInt(c[2],10)/100,f=parseInt(c[3],10)/100;b(c[5]);return this.setHSL(d,e,f)}}}else if(c=/^#([A-Fa-f0-9]+)$/.exec(a)){c=c[1];d=c.length;if(3===d)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===d)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}a&&0a?.0773993808*a:Math.pow(.9478672986*a+.0521327014,2.4)}return function(b){this.r=a(b.r);this.g=a(b.g);this.b=a(b.b);return this}}(),copyLinearToSRGB:function(){function a(a){return.0031308>a?12.92*a:1.055*Math.pow(a,.41666)-.055}return function(b){this.r=a(b.r);this.g=a(b.g);this.b=a(b.b);return this}}(),convertSRGBToLinear:function(){this.copySRGBToLinear(this); return this},convertLinearToSRGB:function(){this.copyLinearToSRGB(this);return this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(a){void 0===a&&(console.warn("THREE.Color: .getHSL() target is now required"),a={h:0,s:0,l:0});var b=this.r,c=this.g,d=this.b,e=Math.max(b,c,d),f=Math.min(b,c,d),g,h=(f+e)/2;if(f===e)f=g=0;else{var l=e-f;f=.5>=h?l/(e+f):l/(2-e-f);switch(e){case b:g=(c- d)/l+(cMath.abs(g)?(this._x=Math.atan2(-m,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(n,l),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(m,-1,1)),.99999>Math.abs(m)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,l)):(this._y=Math.atan2(-k,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(n,-1,1)),.99999>Math.abs(n)? (this._y=Math.atan2(-k,e),this._z=Math.atan2(-f,l)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(n,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,l))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-m,l),this._y=Math.atan2(-k,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(n,l),this._y=Math.atan2(g,a)):(this._x= Math.atan2(-m,e),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b);this._order=b;if(!1!==c)this.onChangeCallback();return this},setFromQuaternion:function(){var a=new R;return function(b,c,d){a.makeRotationFromQuaternion(b);return this.setFromRotationMatrix(a,c,d)}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new ca;return function(b){a.setFromEuler(this);return this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x=== this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this.onChangeCallback();return this},toArray:function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new p(this._x,this._y,this._z)},onChange:function(a){this.onChangeCallback=a;return this},onChangeCallback:function(){}}); Object.assign(Wd.prototype,{set:function(a){this.mask=1<g;g++)if(d[g]===d[(g+1)%3]){a.push(f);break}for(f=a.length-1;0<=f;f--)for(d=a[f],this.faces.splice(d,1),c=0,e=this.faceVertexUvs.length;cthis.opacity&&(d.opacity=this.opacity);!0===this.transparent&&(d.transparent=this.transparent);d.depthFunc=this.depthFunc;d.depthTest=this.depthTest;d.depthWrite=this.depthWrite;0!==this.rotation&&(d.rotation=this.rotation);1!==this.linewidth&&(d.linewidth=this.linewidth);void 0!==this.dashSize&&(d.dashSize= this.dashSize);void 0!==this.gapSize&&(d.gapSize=this.gapSize);void 0!==this.scale&&(d.scale=this.scale);!0===this.dithering&&(d.dithering=!0);0a?b.copy(this.origin):b.copy(this.direction).multiplyScalar(a).add(this.origin)},distanceToPoint:function(a){return Math.sqrt(this.distanceSqToPoint(a))},distanceSqToPoint:function(){var a=new p;return function(b){var c=a.subVectors(b,this.origin).dot(this.direction);if(0>c)return this.origin.distanceToSquared(b); a.copy(this.direction).multiplyScalar(c).add(this.origin);return a.distanceToSquared(b)}}(),distanceSqToSegment:function(){var a=new p,b=new p,c=new p;return function(d,e,f,g){a.copy(d).add(e).multiplyScalar(.5);b.copy(e).sub(d).normalize();c.copy(this.origin).sub(a);var h=.5*d.distanceTo(e),l=-this.direction.dot(b),m=c.dot(this.direction),k=-c.dot(b),n=c.lengthSq(),p=Math.abs(1-l*l);if(0=-q?e<=q?(h=1/p,d*=h,e*=h,l=d*(d+l*e+2*m)+e*(l*d+e+2*k)+n):(e=h,d=Math.max(0, -(l*e+m)),l=-d*d+e*(e+2*k)+n):(e=-h,d=Math.max(0,-(l*e+m)),l=-d*d+e*(e+2*k)+n):e<=-q?(d=Math.max(0,-(-l*h+m)),e=0b)return null;b=Math.sqrt(b-e);e=d-b;d+=b;return 0>e&&0>d?null:0>e?this.at(d,c):this.at(e,c)}}(),intersectsSphere:function(a){return this.distanceToPoint(a.center)<=a.radius},distanceToPlane:function(a){var b=a.normal.dot(this.direction);if(0===b)return 0===a.distanceToPoint(this.origin)?0:null;a=-(this.origin.dot(a.normal)+a.constant)/b;return 0<=a?a:null},intersectPlane:function(a, b){a=this.distanceToPlane(a);return null===a?null:this.at(a,b)},intersectsPlane:function(a){var b=a.distanceToPoint(this.origin);return 0===b||0>a.normal.dot(this.direction)*b?!0:!1},intersectBox:function(a,b){var c=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z,f=this.origin;if(0<=c){var g=(a.min.x-f.x)*c;c*=a.max.x-f.x}else g=(a.max.x-f.x)*c,c*=a.min.x-f.x;if(0<=d){var h=(a.min.y-f.y)*d;d*=a.max.y-f.y}else h=(a.max.y-f.y)*d,d*=a.min.y-f.y;if(g>d||h>c)return null;if(h>g||g!== g)g=h;if(da||h>c)return null;if(h>g||g!==g)g=h;if(ac?null:this.at(0<=g?g:c,b)},intersectsBox:function(){var a=new p;return function(b){return null!==this.intersectBox(b,a)}}(),intersectTriangle:function(){var a=new p,b=new p,c=new p,d=new p;return function(e,f,g,h,l){b.subVectors(f,e);c.subVectors(g,e);d.crossVectors(b,c);f=this.direction.dot(d);if(0 f)h=-1,f=-f;else return null;a.subVectors(this.origin,e);e=h*this.direction.dot(c.crossVectors(a,c));if(0>e)return null;g=h*this.direction.dot(b.cross(a));if(0>g||e+g>f)return null;e=-h*a.dot(d);return 0>e?null:this.at(e/f,l)}}(),applyMatrix4:function(a){this.origin.applyMatrix4(a);this.direction.transformDirection(a);return this},equals:function(a){return a.origin.equals(this.origin)&&a.direction.equals(this.direction)}});Object.assign(Qb.prototype,{set:function(a,b){this.start.copy(a);this.end.copy(b); return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.start.copy(a.start);this.end.copy(a.end);return this},getCenter:function(a){void 0===a&&(console.warn("THREE.Line3: .getCenter() target is now required"),a=new p);return a.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){void 0===a&&(console.warn("THREE.Line3: .delta() target is now required"),a=new p);return a.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)}, distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){void 0===b&&(console.warn("THREE.Line3: .at() target is now required"),b=new p);return this.delta(b).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new p,b=new p;return function(c,d){a.subVectors(c,this.start);b.subVectors(this.end,this.start);c=b.dot(b);c=b.dot(a)/c;d&&(c=J.clamp(c,0,1));return c}}(),closestPointToPoint:function(a,b,c){a=this.closestPointToPointParameter(a,b);void 0===c&& (console.warn("THREE.Line3: .closestPointToPoint() target is now required"),c=new p);return this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){this.start.applyMatrix4(a);this.end.applyMatrix4(a);return this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)}});Object.assign(ta,{getNormal:function(){var a=new p;return function(b,c,d,e){void 0===e&&(console.warn("THREE.Triangle: .getNormal() target is now required"),e=new p);e.subVectors(d,c);a.subVectors(b, c);e.cross(a);b=e.lengthSq();return 0=a.x+a.y}}()});Object.assign(ta.prototype,{set:function(a,b,c){this.a.copy(a);this.b.copy(b);this.c.copy(c);return this},setFromPointsAndIndices:function(a,b,c,d){this.a.copy(a[b]);this.b.copy(a[c]);this.c.copy(a[d]);return this},clone:function(){return(new this.constructor).copy(this)},copy:function(a){this.a.copy(a.a);this.b.copy(a.b);this.c.copy(a.c);return this},getArea:function(){var a=new p,b=new p;return function(){a.subVectors(this.c, this.b);b.subVectors(this.a,this.b);return.5*a.cross(b).length()}}(),getMidpoint:function(a){void 0===a&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),a=new p);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(a){return ta.getNormal(this.a,this.b,this.c,a)},getPlane:function(a){void 0===a&&(console.warn("THREE.Triangle: .getPlane() target is now required"),a=new p);return a.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(a, b){return ta.getBarycoord(a,this.a,this.b,this.c,b)},containsPoint:function(a){return ta.containsPoint(a,this.a,this.b,this.c)},intersectsBox:function(a){return a.intersectsTriangle(this)},closestPointToPoint:function(){var a=new Ia,b=[new Qb,new Qb,new Qb],c=new p,d=new p;return function(e,f){void 0===f&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),f=new p);var g=Infinity;a.setFromCoplanarPoints(this.a,this.b,this.c);a.projectPoint(e,c);if(!0===this.containsPoint(c))f.copy(c); else for(b[0].set(this.a,this.b),b[1].set(this.b,this.c),b[2].set(this.c,this.a),e=0;ec.far?null:{distance:b,point:w.clone(),object:a}}function c(c,d,e,f,m,k,n,p,v){g.fromBufferAttribute(m,n);h.fromBufferAttribute(m,p);l.fromBufferAttribute(m,v);if(c=b(c,d,e,f,g,h,l,y))k&&(t.fromBufferAttribute(k,n),q.fromBufferAttribute(k,p),r.fromBufferAttribute(k,v),c.uv=a(y,g,h,l,t,q,r)),k=new Ya(n,p,v),ta.getNormal(g,h,l,k.normal),c.face=k;return c}var d=new R,e=new sb,f=new Ha, g=new p,h=new p,l=new p,m=new p,k=new p,n=new p,t=new B,q=new B,r=new B,u=new p,y=new p,w=new p;return function(p,v){var u=this.geometry,x=this.material,w=this.matrixWorld;if(void 0!==x&&(null===u.boundingSphere&&u.computeBoundingSphere(),f.copy(u.boundingSphere),f.applyMatrix4(w),!1!==p.ray.intersectsSphere(f)&&(d.getInverse(w),e.copy(p.ray).applyMatrix4(d),null===u.boundingBox||!1!==e.intersectsBox(u.boundingBox))))if(u.isBufferGeometry){var A=u.index,z=u.attributes.position,B=u.attributes.uv,H= u.groups;u=u.drawRange;var G;if(null!==A)if(Array.isArray(x)){var D=0;for(G=H.length;De.far||f.push({distance:p,point:b.clone(),face:null,object:this})}}(),clone:function(){return(new this.constructor(this.material)).copy(this)},copy:function(a){H.prototype.copy.call(this,a);void 0!==a.center&&this.center.copy(a.center);return this}});Jc.prototype=Object.assign(Object.create(H.prototype),{constructor:Jc,copy:function(a){H.prototype.copy.call(this,a,!1);a=a.levels;for(var b=0,c=a.length;b=d[e].distance)d[e-1].object.visible=!1,d[e].object.visible=!0;else break;for(;ef||(k.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(k),ud.far||e.push({distance:u,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}}else for(g=0,r=q.length/3-1;gf||(k.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(k),ud.far||e.push({distance:u,point:h.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this}))}else if(g.isGeometry)for(l=g.vertices,m=l.length,g=0;gf||(k.applyMatrix4(this.matrixWorld),u=d.ray.origin.distanceTo(k),ud.far||e.push({distance:u,point:h.clone().applyMatrix4(this.matrixWorld),index:g, face:null,faceIndex:null,object:this}))}}}(),clone:function(){return(new this.constructor(this.geometry,this.material)).copy(this)}});Y.prototype=Object.assign(Object.create(wa.prototype),{constructor:Y,isLineSegments:!0,computeLineDistances:function(){var a=new p,b=new p;return function(){var c=this.geometry;if(c.isBufferGeometry)if(null===c.index){for(var d=c.attributes.position,e=[],f=0,g=d.count;fd.far|| e.push({distance:a,distanceToRay:Math.sqrt(f),point:n.clone(),index:c,face:null,object:g}))}var g=this,h=this.geometry,l=this.matrixWorld,m=d.params.Points.threshold;null===h.boundingSphere&&h.computeBoundingSphere();c.copy(h.boundingSphere);c.applyMatrix4(l);c.radius+=m;if(!1!==d.ray.intersectsSphere(c)){a.getInverse(l);b.copy(d.ray).applyMatrix4(a);m/=(this.scale.x+this.scale.y+this.scale.z)/3;var k=m*m;m=new p;var n=new p;if(h.isBufferGeometry){var t=h.index;h=h.attributes.position.array;if(null!== t){var q=t.array;t=0;for(var r=q.length;t=a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});Yb.prototype=Object.create(ea.prototype); Yb.prototype.constructor=Yb;Yb.prototype.isCompressedTexture=!0;Lc.prototype=Object.create(ea.prototype);Lc.prototype.constructor=Lc;Lc.prototype.isDepthTexture=!0;Zb.prototype=Object.create(D.prototype);Zb.prototype.constructor=Zb;Mc.prototype=Object.create(P.prototype);Mc.prototype.constructor=Mc;$b.prototype=Object.create(D.prototype);$b.prototype.constructor=$b;Nc.prototype=Object.create(P.prototype);Nc.prototype.constructor=Nc;xa.prototype=Object.create(D.prototype);xa.prototype.constructor= xa;Oc.prototype=Object.create(P.prototype);Oc.prototype.constructor=Oc;ac.prototype=Object.create(xa.prototype);ac.prototype.constructor=ac;Pc.prototype=Object.create(P.prototype);Pc.prototype.constructor=Pc;ub.prototype=Object.create(xa.prototype);ub.prototype.constructor=ub;Qc.prototype=Object.create(P.prototype);Qc.prototype.constructor=Qc;bc.prototype=Object.create(xa.prototype);bc.prototype.constructor=bc;Rc.prototype=Object.create(P.prototype);Rc.prototype.constructor=Rc;cc.prototype=Object.create(xa.prototype); cc.prototype.constructor=cc;Sc.prototype=Object.create(P.prototype);Sc.prototype.constructor=Sc;dc.prototype=Object.create(D.prototype);dc.prototype.constructor=dc;Tc.prototype=Object.create(P.prototype);Tc.prototype.constructor=Tc;ec.prototype=Object.create(D.prototype);ec.prototype.constructor=ec;Uc.prototype=Object.create(P.prototype);Uc.prototype.constructor=Uc;fc.prototype=Object.create(D.prototype);fc.prototype.constructor=fc;var Ug={triangulate:function(a,b,c){c=c||2;var d=b&&b.length,e=d? b[0]*c:a.length,f=cf(a,0,e,c,!0),g=[];if(!f)return g;var h;if(d){var l=c;d=[];var m;var k=0;for(m=b.length;k80*c){var q=h=a[0];var r=d=a[1];for(l=c;lh&&(h=k),b>d&&(d=b);h=Math.max(h-q,d-r);h=0!==h?1/h:0}Xc(f,g,c,q,r,h);return g}},$a={area:function(a){for(var b= a.length,c=0,d=b-1,e=0;e$a.area(a)},triangulateShape:function(a,b){var c=[],d=[],e=[];gf(a);hf(c,a);var f=a.length;b.forEach(gf);for(a=0;aMath.abs(g-l)?[new B(a,1-c),new B(h,1-d),new B(m,1-e),new B(n,1-b)]:[new B(g,1-c),new B(l,1-d),new B(k,1-e),new B(p,1-b)]}};Zc.prototype=Object.create(P.prototype);Zc.prototype.constructor=Zc;gc.prototype=Object.create(Ta.prototype);gc.prototype.constructor=gc;$c.prototype=Object.create(P.prototype);$c.prototype.constructor=$c;xb.prototype=Object.create(D.prototype);xb.prototype.constructor=xb;ad.prototype=Object.create(P.prototype);ad.prototype.constructor= ad;hc.prototype=Object.create(D.prototype);hc.prototype.constructor=hc;bd.prototype=Object.create(P.prototype);bd.prototype.constructor=bd;ic.prototype=Object.create(D.prototype);ic.prototype.constructor=ic;yb.prototype=Object.create(P.prototype);yb.prototype.constructor=yb;yb.prototype.toJSON=function(){var a=P.prototype.toJSON.call(this);return kf(this.parameters.shapes,a)};zb.prototype=Object.create(D.prototype);zb.prototype.constructor=zb;zb.prototype.toJSON=function(){var a=D.prototype.toJSON.call(this); return kf(this.parameters.shapes,a)};jc.prototype=Object.create(D.prototype);jc.prototype.constructor=jc;Ab.prototype=Object.create(P.prototype);Ab.prototype.constructor=Ab;ab.prototype=Object.create(D.prototype);ab.prototype.constructor=ab;cd.prototype=Object.create(Ab.prototype);cd.prototype.constructor=cd;dd.prototype=Object.create(ab.prototype);dd.prototype.constructor=dd;ed.prototype=Object.create(P.prototype);ed.prototype.constructor=ed;kc.prototype=Object.create(D.prototype);kc.prototype.constructor= kc;var ka=Object.freeze({WireframeGeometry:Zb,ParametricGeometry:Mc,ParametricBufferGeometry:$b,TetrahedronGeometry:Oc,TetrahedronBufferGeometry:ac,OctahedronGeometry:Pc,OctahedronBufferGeometry:ub,IcosahedronGeometry:Qc,IcosahedronBufferGeometry:bc,DodecahedronGeometry:Rc,DodecahedronBufferGeometry:cc,PolyhedronGeometry:Nc,PolyhedronBufferGeometry:xa,TubeGeometry:Sc,TubeBufferGeometry:dc,TorusKnotGeometry:Tc,TorusKnotBufferGeometry:ec,TorusGeometry:Uc,TorusBufferGeometry:fc,TextGeometry:Zc,TextBufferGeometry:gc, SphereGeometry:$c,SphereBufferGeometry:xb,RingGeometry:ad,RingBufferGeometry:hc,PlaneGeometry:Fc,PlaneBufferGeometry:rb,LatheGeometry:bd,LatheBufferGeometry:ic,ShapeGeometry:yb,ShapeBufferGeometry:zb,ExtrudeGeometry:wb,ExtrudeBufferGeometry:Ta,EdgesGeometry:jc,ConeGeometry:cd,ConeBufferGeometry:dd,CylinderGeometry:Ab,CylinderBufferGeometry:ab,CircleGeometry:ed,CircleBufferGeometry:kc,BoxGeometry:Nb,BoxBufferGeometry:pb});Bb.prototype=Object.create(I.prototype);Bb.prototype.constructor=Bb;Bb.prototype.isShadowMaterial= !0;Bb.prototype.copy=function(a){I.prototype.copy.call(this,a);this.color.copy(a.color);return this};lc.prototype=Object.create(Fa.prototype);lc.prototype.constructor=lc;lc.prototype.isRawShaderMaterial=!0;Ua.prototype=Object.create(I.prototype);Ua.prototype.constructor=Ua;Ua.prototype.isMeshStandardMaterial=!0;Ua.prototype.copy=function(a){I.prototype.copy.call(this,a);this.defines={STANDARD:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness=a.metalness;this.map=a.map;this.lightMap= a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.roughnessMap= a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Cb.prototype=Object.create(Ua.prototype);Cb.prototype.constructor=Cb; Cb.prototype.isMeshPhysicalMaterial=!0;Cb.prototype.copy=function(a){Ua.prototype.copy.call(this,a);this.defines={PHYSICAL:""};this.reflectivity=a.reflectivity;this.clearCoat=a.clearCoat;this.clearCoatRoughness=a.clearCoatRoughness;return this};Ka.prototype=Object.create(I.prototype);Ka.prototype.constructor=Ka;Ka.prototype.isMeshPhongMaterial=!0;Ka.prototype.copy=function(a){I.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map= a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias; this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Db.prototype=Object.create(Ka.prototype);Db.prototype.constructor=Db; Db.prototype.isMeshToonMaterial=!0;Db.prototype.copy=function(a){Ka.prototype.copy.call(this,a);this.gradientMap=a.gradientMap;return this};Eb.prototype=Object.create(I.prototype);Eb.prototype.constructor=Eb;Eb.prototype.isMeshNormalMaterial=!0;Eb.prototype.copy=function(a){I.prototype.copy.call(this,a);this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale= a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Fb.prototype=Object.create(I.prototype);Fb.prototype.constructor=Fb;Fb.prototype.isMeshLambertMaterial=!0;Fb.prototype.copy=function(a){I.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity; this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning= a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};Gb.prototype=Object.create(T.prototype);Gb.prototype.constructor=Gb;Gb.prototype.isLineDashedMaterial=!0;Gb.prototype.copy=function(a){T.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var Vg=Object.freeze({ShadowMaterial:Bb,SpriteMaterial:ib,RawShaderMaterial:lc,ShaderMaterial:Fa,PointsMaterial:Ja,MeshPhysicalMaterial:Cb,MeshStandardMaterial:Ua,MeshPhongMaterial:Ka, MeshToonMaterial:Db,MeshNormalMaterial:Eb,MeshLambertMaterial:Fb,MeshDepthMaterial:fb,MeshDistanceMaterial:gb,MeshBasicMaterial:ua,LineDashedMaterial:Gb,LineBasicMaterial:T,Material:I}),Kb={enabled:!1,files:{},add:function(a,b){!1!==this.enabled&&(this.files[a]=b)},get:function(a){if(!1!==this.enabled)return this.files[a]},remove:function(a){delete this.files[a]},clear:function(){this.files={}}},ya=new ee,cb={};Object.assign(La.prototype,{load:function(a,b,c,d){void 0===a&&(a="");void 0!==this.path&& (a=this.path+a);a=this.manager.resolveURL(a);var e=this,f=Kb.get(a);if(void 0!==f)return e.manager.itemStart(a),setTimeout(function(){b&&b(f);e.manager.itemEnd(a)},0),f;if(void 0!==cb[a])cb[a].push({onLoad:b,onProgress:c,onError:d});else{var g=a.match(/^data:(.*?)(;base64)?,(.*)$/);if(g){c=g[1];var h=!!g[2];g=g[3];g=window.decodeURIComponent(g);h&&(g=window.atob(g));try{var l=(this.responseType||"").toLowerCase();switch(l){case "arraybuffer":case "blob":var m=new Uint8Array(g.length);for(h=0;hg)e=a+1;else if(0b&&(b=0);1Number.EPSILON&&(g.normalize(), c=Math.acos(J.clamp(d[l-1].dot(d[l]),-1,1)),e[l].applyMatrix4(h.makeRotationAxis(g,c))),f[l].crossVectors(d[l],e[l]);if(!0===b)for(c=Math.acos(J.clamp(e[0].dot(e[a]),-1,1)),c/=a,0d;)d+=c;for(;d>c;)d-=c;de&&(e=1);1E-4>d&&(d=e);1E-4>l&&(l=e);Ce.initNonuniformCatmullRom(f.x,g.x,h.x, c.x,d,e,l);De.initNonuniformCatmullRom(f.y,g.y,h.y,c.y,d,e,l);Ee.initNonuniformCatmullRom(f.z,g.z,h.z,c.z,d,e,l)}else"catmullrom"===this.curveType&&(Ce.initCatmullRom(f.x,g.x,h.x,c.x,this.tension),De.initCatmullRom(f.y,g.y,h.y,c.y,this.tension),Ee.initCatmullRom(f.z,g.z,h.z,c.z,this.tension));b.set(Ce.calc(a),De.calc(a),Ee.calc(a));return b};pa.prototype.copy=function(a){E.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;bc.length- 2?c.length-1:a+1];c=c[a>c.length-3?c.length-1:a+2];b.set(mf(d,e.x,f.x,g.x,c.x),mf(d,e.y,f.y,g.y,c.y));return b};Pa.prototype.copy=function(a){E.prototype.copy.call(this,a);this.points=[];for(var b=0,c=a.points.length;b=b)return b=c[a]-b,a=this.curves[a],c=a.getLength(),a.getPointAt(0===c?0:1-b/c);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.length-1]},updateArcLengths:function(){this.needsUpdate=!0;this.cacheLengths=null;this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths; for(var a=[],b=0,c=0,d=this.curves.length;c=e)break a;else{f=b[1];a=e)break b}d=c;c=0}}for(;c>>1,ab;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),a=this.getValueSize(),this.times=na.arraySlice(c,e,f),this.values=na.arraySlice(this.values,e*a,f*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var c=this.times;b=this.values; var d=c.length;0===d&&(console.error("THREE.KeyframeTrack: Track is empty.",this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&na.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this, f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,f=a.length-1,g=1;gk.opacity&&(k.transparent=!0);d.setTextures(l);return d.parse(k)}}()});var Fe={decodeText:function(a){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(a);for(var b="",c=0,d=a.length;cf;f++){var C=h[q++];var z=A[2*C];C=A[2*C+1];z=new B(z,C);2!==f&&c.faceVertexUvs[e][u].push(z);0!==f&&c.faceVertexUvs[e][u+1].push(z)}}y&&(y=3*h[q++],r.normal.set(k[y++],k[y++],k[y]),x.normal.copy(r.normal)); if(w)for(e=0;4>e;e++)y=3*h[q++],w=new p(k[y++],k[y++],k[y]),2!==e&&r.vertexNormals.push(w),0!==e&&x.vertexNormals.push(w);n&&(n=h[q++],n=v[n],r.color.setHex(n),x.color.setHex(n));if(l)for(e=0;4>e;e++)n=h[q++],n=v[n],2!==e&&r.vertexColors.push(new G(n)),0!==e&&x.vertexColors.push(new G(n));c.faces.push(r);c.faces.push(x)}else{r=new Ya;r.a=h[q++];r.b=h[q++];r.c=h[q++];u&&(u=h[q++],r.materialIndex=u);u=c.faces.length;if(e)for(e=0;ef;f++)C=h[q++],z= A[2*C],C=A[2*C+1],z=new B(z,C),c.faceVertexUvs[e][u].push(z);y&&(y=3*h[q++],r.normal.set(k[y++],k[y++],k[y]));if(w)for(e=0;3>e;e++)y=3*h[q++],w=new p(k[y++],k[y++],k[y]),r.vertexNormals.push(w);n&&(n=h[q++],r.color.setHex(v[n]));if(l)for(e=0;3>e;e++)n=h[q++],r.vertexColors.push(new G(v[n]));c.faces.push(r)}}d=a;q=void 0!==d.influencesPerVertex?d.influencesPerVertex:2;if(d.skinWeights)for(g=0,h=d.skinWeights.length;g Number.EPSILON){if(0>k&&(g=b[f],l=-l,h=b[e],k=-k),!(a.yh.y))if(a.y===g.y){if(a.x===g.x)return!0}else{e=k*(a.x-g.x)-l*(a.y-g.y);if(0===e)return!0;0>e||(d=!d)}}else if(a.y===g.y&&(h.x<=a.x&&a.x<=g.x||g.x<=a.x&&a.x<=h.x))return!0}return d}var e=$a.isClockWise,f=this.subPaths;if(0===f.length)return[];if(!0===b)return c(f);b=[];if(1===f.length){var g=f[0];var h=new jb;h.curves=g.curves;b.push(h);return b}var l=!e(f[0].getPoints());l=a?!l:l;h=[];var k=[],p=[],n=0;k[n]=void 0;p[n]=[];for(var t= 0,q=f.length;td&&this._mixBufferRegion(c,a,3*b,1-d,b);d=b;for(var f=b+b;d!==f;++d)if(c[d]!==c[d+b]){e.setValue(c,a);break}},saveOriginalState:function(){var a=this.buffer,b=this.valueSize,c=3*b;this.binding.getValue(a,c);for(var d=b;d!==c;++d)a[d]=a[c+d%b];this.cumulativeWeight= 0},restoreOriginalState:function(){this.binding.setValue(this.buffer,3*this.valueSize)},_select:function(a,b,c,d,e){if(.5<=d)for(d=0;d!==e;++d)a[b+d]=a[c+d]},_slerp:function(a,b,c,d){ca.slerpFlat(a,b,a,b,a,c,d)},_lerp:function(a,b,c,d,e){for(var f=1-d,g=0;g!==e;++g){var h=b+g;a[h]=a[h]*f+a[c+g]*d}}});Object.assign(qf.prototype,{getValue:function(a,b){this.bind();var c=this._bindings[this._targetGroup.nCachedObjects_];void 0!==c&&c.getValue(a,b)},setValue:function(a,b){for(var c=this._bindings,d=this._targetGroup.nCachedObjects_, e=c.length;d!==e;++d)c[d].setValue(a,b)},bind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].bind()},unbind:function(){for(var a=this._bindings,b=this._targetGroup.nCachedObjects_,c=a.length;b!==c;++b)a[b].unbind()}});Object.assign(ra,{Composite:qf,create:function(a,b,c){return a&&a.isAnimationObjectGroup?new ra.Composite(a,b,c):new ra(a,b,c)},sanitizeNodeName:function(){var a=/[\[\]\.:\/]/g;return function(b){return b.replace(/\s/g,"_").replace(a, "")}}(),parseTrackName:function(){var a="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",b=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]");a=/(WCOD+)?/.source.replace("WCOD",a);var c=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),d=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),e=new RegExp("^"+b+a+c+d+"$"),f=["material","materials","bones"];return function(a){var b=e.exec(a);if(!b)throw Error("PropertyBinding: Cannot parse trackName: "+a);b={nodeName:b[2], objectName:b[3],objectIndex:b[4],propertyName:b[5],propertyIndex:b[6]};var c=b.nodeName&&b.nodeName.lastIndexOf(".");if(void 0!==c&&-1!==c){var d=b.nodeName.substring(c+1);-1!==f.indexOf(d)&&(b.nodeName=b.nodeName.substring(0,c),b.objectName=d)}if(null===b.propertyName||0===b.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+a);return b}}(),findNode:function(a,b){if(!b||""===b||"root"===b||"."===b||-1===b||b===a.name||b===a.uuid)return a;if(a.skeleton){var c= a.skeleton.getBoneByName(b);if(void 0!==c)return c}if(a.children){var d=function(a){for(var c=0;c=b){var p=b++,n=a[p];c[n.uuid]=k;a[k]=n;c[l]=p;a[p]=h;h=0;for(l=e;h!==l;++h){n=d[h];var t=n[k];n[k]=n[p];n[p]=t}}}this.nCachedObjects_=b},uncache:function(){for(var a=this._objects,b=a.length,c=this.nCachedObjects_,d=this._indicesByUUID,e=this._bindings,f=e.length,g=0,h=arguments.length;g!==h;++g){var l= arguments[g].uuid,k=d[l];if(void 0!==k)if(delete d[l],kb||0===c)return;this._startTime=null;b*=c}b*=this._updateTimeScale(a);c=this._updateTime(b);a=this._updateWeight(a);if(0c.parameterPositions[1]&&(this.stopFading(),0===d&&(this.enabled=!1))}}return this._effectiveWeight=b},_updateTimeScale:function(a){var b=0;if(!this.paused){b=this.timeScale;var c=this._timeScaleInterpolant;if(null!==c){var d=c.evaluate(a)[0];b*=d;a>c.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b},_updateTime:function(a){var b=this.time+a;if(0===a)return b;var c=this._clip.duration,d=this.loop,e=this._loopCount;if(2200=== d)a:{if(-1===e&&(this._loopCount=0,this._setEndings(!0,!0,!1)),b>=c)b=c;else if(0>b)b=0;else break a;this.clampWhenFinished?this.paused=!0:this.enabled=!1;this._mixer.dispatchEvent({type:"finished",action:this,direction:0>a?-1:1})}else{d=2202===d;-1===e&&(0<=a?(e=0,this._setEndings(!0,0===this.repetitions,d)):this._setEndings(0===this.repetitions,!0,d));if(b>=c||0>b){var f=Math.floor(b/c);b-=c*f;e+=Math.abs(f);var g=this.repetitions-e;0>=g?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,b= 0a,this._setEndings(a,!a,d)):this._setEndings(!1,!1,d),this._loopCount=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:f}))}if(d&&1===(e&1))return this.time=b,c-b}return this.time=b},_setEndings:function(a,b,c){var d=this._interpolantSettings;c?(d.endingStart=2401,d.endingEnd=2401):(d.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,d.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(a, b,c){var d=this._mixer,e=d.time,f=this._weightInterpolant;null===f&&(this._weightInterpolant=f=d._lendControlInterpolant());d=f.parameterPositions;f=f.sampleValues;d[0]=e;f[0]=b;d[1]=e+a;f[1]=c;return this}});te.prototype=Object.assign(Object.create(za.prototype),{constructor:te,_bindAction:function(a,b){var c=a._localRoot||this._root,d=a._clip.tracks,e=d.length,f=a._propertyBindings;a=a._interpolants;var g=c.uuid,h=this._bindingsByRootAndName,k=h[g];void 0===k&&(k={},h[g]=k);for(h=0;h!==e;++h){var m= d[h],p=m.name,n=k[p];if(void 0===n){n=f[h];if(void 0!==n){null===n._cacheIndex&&(++n.referenceCount,this._addInactiveBinding(n,g,p));continue}n=new se(ra.create(c,p,b&&b._propertyBindings[h].binding.parsedPath),m.ValueTypeName,m.getValueSize());++n.referenceCount;this._addInactiveBinding(n,g,p)}f[h]=n;a[h].resultBuffer=n.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null===a._cacheIndex){var b=(a._localRoot||this._root).uuid,c=a._clip.uuid,d=this._actionsByClip[c];this._bindAction(a, d&&d.knownActions[0]);this._addInactiveAction(a,c,b)}b=a._propertyBindings;c=0;for(d=b.length;c!==d;++c){var e=b[c];0===e.useCount++&&(this._lendBinding(e),e.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,c=0,d=b.length;c!==d;++c){var e=b[c];0===--e.useCount&&(e.restoreOriginalState(),this._takeBackBinding(e))}this._takeBackAction(a)}},_initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip= {};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}},_isActiveAction:function(a){a=a._cacheIndex; return null!==a&&athis.max.x||a.ythis.max.y?!1:!0},containsBox:function(a){return this.min.x<=a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<= this.max.y},getParameter:function(a,b){void 0===b&&(console.warn("THREE.Box2: .getParameter() target is now required"),b=new B);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0},clampPoint:function(a,b){void 0===b&&(console.warn("THREE.Box2: .clampPoint() target is now required"),b=new B);return b.copy(a).clamp(this.min,this.max)},distanceToPoint:function(){var a= new B;return function(b){return a.copy(b).clamp(this.min,this.max).sub(b).length()}}(),intersect:function(a){this.min.max(a.min);this.max.min(a.max);return this},union:function(a){this.min.min(a.min);this.max.max(a.max);return this},translate:function(a){this.min.add(a);this.max.add(a);return this},equals:function(a){return a.min.equals(this.min)&&a.max.equals(this.max)}});ld.prototype=Object.create(H.prototype);ld.prototype.constructor=ld;ld.prototype.isImmediateRenderObject=!0;md.prototype=Object.create(Y.prototype); md.prototype.constructor=md;md.prototype.update=function(){var a=new p,b=new p,c=new la;return function(){var d=["a","b","c"];this.object.updateMatrixWorld(!0);c.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,f=this.geometry.attributes.position,g=this.object.geometry;if(g&&g.isGeometry)for(var h=g.vertices,k=g.faces,m=g=0,p=k.length;mMath.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side=0>b?1:0;this.lookAt(this.plane.normal);H.prototype.updateMatrixWorld.call(this,a)};var Sd,Ae;Jb.prototype=Object.create(H.prototype);Jb.prototype.constructor=Jb;Jb.prototype.setDirection= function(){var a=new p,b;return function(c){.99999c.y?this.quaternion.set(1,0,0,0):(a.set(c.z,0,-c.x).normalize(),b=Math.acos(c.y),this.quaternion.setFromAxisAngle(a,b))}}();Jb.prototype.setLength=function(a,b,c){void 0===b&&(b=.2*a);void 0===c&&(c=.2*b);this.line.scale.set(1,Math.max(0,a-b),1);this.line.updateMatrix();this.cone.scale.set(c,b,c);this.cone.position.y=a;this.cone.updateMatrix()};Jb.prototype.setColor=function(a){this.line.material.color.copy(a); this.cone.material.color.copy(a)};sd.prototype=Object.create(Y.prototype);sd.prototype.constructor=sd;E.create=function(a,b){console.log("THREE.Curve.create() has been deprecated");a.prototype=Object.create(E.prototype);a.prototype.constructor=a;a.prototype.getPoint=b;return a};Object.assign(bb.prototype,{createPointsGeometry:function(a){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");a=this.getPoints(a);return this.createGeometry(a)}, createSpacedPointsGeometry:function(a){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");a=this.getSpacedPoints(a);return this.createGeometry(a)},createGeometry:function(a){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var b=new P,c=0,d=a.length;c 90) { console.error("Latitude must be between -90 and 90") return } return input }, Line: function(input) { var scope = this; if (input.constructor !== Array) { console.error("Line must be an array") return } for (coord of input){ if (!scope.Coords(coord)) { console.error("Each coordinate in a line must be a valid Coords type") return } } return input }, Rotation: function(input) { if (input.constructor === Number) input = {z: input} else if (input.constructor === Object) { for (key of Object.keys(input)){ if (!['x', 'y', 'z'].includes(key)) { console.error('Rotation parameters must be x, y, or z') return } if (input[key].constructor !== Number) { console.error('Individual rotation values must be numbers') return } } } else { console.error('Rotation must be an object or a number') return } return input }, Scale: function(input) { if (input.constructor === Number) { input = {x:input, y:input, z: input} } else if (input.constructor === Object) { for (key of Object.keys(input)){ if (!['x', 'y', 'z'].includes(key)) { console.error('Scale parameters must be x, y, or z') return } if (input[key].constructor !== Number) { console.error('Individual scale values must be numbers') return } } } else { console.error('Scale must be an object or a number') return } return input } } module.exports = exports = Validate; ================================================ FILE: tests/threebox-tests-bundle.js ================================================ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 0) { throw new Error('Invalid string. Length must be a multiple of 4') } // Trim off extra bytes after placeholder bytes are found // See: https://github.com/beatgammit/base64-js/issues/42 var validLen = b64.indexOf('=') if (validLen === -1) validLen = len var placeHoldersLen = validLen === len ? 0 : 4 - (validLen % 4) return [validLen, placeHoldersLen] } // base64 is 4/3 + up to two characters of the original data function byteLength (b64) { var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function _byteLength (b64, validLen, placeHoldersLen) { return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen } function toByteArray (b64) { var tmp var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) var curByte = 0 // if there are placeholders, only get up to the last complete 4 chars var len = placeHoldersLen > 0 ? validLen - 4 : validLen for (var i = 0; i < len; i += 4) { tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] arr[curByte++] = (tmp >> 16) & 0xFF arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 2) { tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) arr[curByte++] = tmp & 0xFF } if (placeHoldersLen === 1) { tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) arr[curByte++] = (tmp >> 8) & 0xFF arr[curByte++] = tmp & 0xFF } return arr } function tripletToBase64 (num) { return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] } function encodeChunk (uint8, start, end) { var tmp var output = [] for (var i = start; i < end; i += 3) { tmp = ((uint8[i] << 16) & 0xFF0000) + ((uint8[i + 1] << 8) & 0xFF00) + (uint8[i + 2] & 0xFF) output.push(tripletToBase64(tmp)) } return output.join('') } function fromByteArray (uint8) { var tmp var len = uint8.length var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes var parts = [] var maxChunkLength = 16383 // must be multiple of 3 // go through the array every three bytes, we'll deal with trailing stuff later for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { parts.push(encodeChunk( uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) )) } // pad the end with zeros, but make sure to not forget the extra bytes if (extraBytes === 1) { tmp = uint8[len - 1] parts.push( lookup[tmp >> 2] + lookup[(tmp << 4) & 0x3F] + '==' ) } else if (extraBytes === 2) { tmp = (uint8[len - 2] << 8) + uint8[len - 1] parts.push( lookup[tmp >> 10] + lookup[(tmp >> 4) & 0x3F] + lookup[(tmp << 2) & 0x3F] + '=' ) } return parts.join('') } },{}],2:[function(require,module,exports){ },{}],3:[function(require,module,exports){ arguments[4][2][0].apply(exports,arguments) },{"dup":2}],4:[function(require,module,exports){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ /* eslint-disable no-proto */ 'use strict' var base64 = require('base64-js') var ieee754 = require('ieee754') exports.Buffer = Buffer exports.SlowBuffer = SlowBuffer exports.INSPECT_MAX_BYTES = 50 var K_MAX_LENGTH = 0x7fffffff exports.kMaxLength = K_MAX_LENGTH /** * If `Buffer.TYPED_ARRAY_SUPPORT`: * === true Use Uint8Array implementation (fastest) * === false Print warning and recommend using `buffer` v4.x which has an Object * implementation (most compatible, even IE6) * * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, * Opera 11.6+, iOS 4.2+. * * We report that the browser does not support typed arrays if the are not subclassable * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support * for __proto__ and has a buggy typed array implementation. */ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') { console.error( 'This browser lacks typed array (Uint8Array) support which is required by ' + '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' ) } function typedArraySupport () { // Can typed array instances can be augmented? try { var arr = new Uint8Array(1) arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } } return arr.foo() === 42 } catch (e) { return false } } Object.defineProperty(Buffer.prototype, 'parent', { enumerable: true, get: function () { if (!Buffer.isBuffer(this)) return undefined return this.buffer } }) Object.defineProperty(Buffer.prototype, 'offset', { enumerable: true, get: function () { if (!Buffer.isBuffer(this)) return undefined return this.byteOffset } }) function createBuffer (length) { if (length > K_MAX_LENGTH) { throw new RangeError('The value "' + length + '" is invalid for option "size"') } // Return an augmented `Uint8Array` instance var buf = new Uint8Array(length) buf.__proto__ = Buffer.prototype return buf } /** * The Buffer constructor returns instances of `Uint8Array` that have their * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of * `Uint8Array`, so the returned instances will have all the node `Buffer` methods * and the `Uint8Array` methods. Square bracket notation works as expected -- it * returns a single octet. * * The `Uint8Array` prototype remains unmodified. */ function Buffer (arg, encodingOrOffset, length) { // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { throw new TypeError( 'The "string" argument must be of type string. Received type number' ) } return allocUnsafe(arg) } return from(arg, encodingOrOffset, length) } // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 if (typeof Symbol !== 'undefined' && Symbol.species != null && Buffer[Symbol.species] === Buffer) { Object.defineProperty(Buffer, Symbol.species, { value: null, configurable: true, enumerable: false, writable: false }) } Buffer.poolSize = 8192 // not used by this implementation function from (value, encodingOrOffset, length) { if (typeof value === 'string') { return fromString(value, encodingOrOffset) } if (ArrayBuffer.isView(value)) { return fromArrayLike(value) } if (value == null) { throw TypeError( 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 'or Array-like Object. Received type ' + (typeof value) ) } if (isInstance(value, ArrayBuffer) || (value && isInstance(value.buffer, ArrayBuffer))) { return fromArrayBuffer(value, encodingOrOffset, length) } if (typeof value === 'number') { throw new TypeError( 'The "value" argument must not be of type number. Received type number' ) } var valueOf = value.valueOf && value.valueOf() if (valueOf != null && valueOf !== value) { return Buffer.from(valueOf, encodingOrOffset, length) } var b = fromObject(value) if (b) return b if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') { return Buffer.from( value[Symbol.toPrimitive]('string'), encodingOrOffset, length ) } throw new TypeError( 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + 'or Array-like Object. Received type ' + (typeof value) ) } /** * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError * if value is a number. * Buffer.from(str[, encoding]) * Buffer.from(array) * Buffer.from(buffer) * Buffer.from(arrayBuffer[, byteOffset[, length]]) **/ Buffer.from = function (value, encodingOrOffset, length) { return from(value, encodingOrOffset, length) } // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: // https://github.com/feross/buffer/pull/148 Buffer.prototype.__proto__ = Uint8Array.prototype Buffer.__proto__ = Uint8Array function assertSize (size) { if (typeof size !== 'number') { throw new TypeError('"size" argument must be of type number') } else if (size < 0) { throw new RangeError('The value "' + size + '" is invalid for option "size"') } } function alloc (size, fill, encoding) { assertSize(size) if (size <= 0) { return createBuffer(size) } if (fill !== undefined) { // Only pay attention to encoding if it's a string. This // prevents accidentally sending in a number that would // be interpretted as a start offset. return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill) } return createBuffer(size) } /** * Creates a new filled Buffer instance. * alloc(size[, fill[, encoding]]) **/ Buffer.alloc = function (size, fill, encoding) { return alloc(size, fill, encoding) } function allocUnsafe (size) { assertSize(size) return createBuffer(size < 0 ? 0 : checked(size) | 0) } /** * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. * */ Buffer.allocUnsafe = function (size) { return allocUnsafe(size) } /** * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. */ Buffer.allocUnsafeSlow = function (size) { return allocUnsafe(size) } function fromString (string, encoding) { if (typeof encoding !== 'string' || encoding === '') { encoding = 'utf8' } if (!Buffer.isEncoding(encoding)) { throw new TypeError('Unknown encoding: ' + encoding) } var length = byteLength(string, encoding) | 0 var buf = createBuffer(length) var actual = buf.write(string, encoding) if (actual !== length) { // Writing a hex string, for example, that contains invalid characters will // cause everything after the first invalid character to be ignored. (e.g. // 'abxxcd' will be treated as 'ab') buf = buf.slice(0, actual) } return buf } function fromArrayLike (array) { var length = array.length < 0 ? 0 : checked(array.length) | 0 var buf = createBuffer(length) for (var i = 0; i < length; i += 1) { buf[i] = array[i] & 255 } return buf } function fromArrayBuffer (array, byteOffset, length) { if (byteOffset < 0 || array.byteLength < byteOffset) { throw new RangeError('"offset" is outside of buffer bounds') } if (array.byteLength < byteOffset + (length || 0)) { throw new RangeError('"length" is outside of buffer bounds') } var buf if (byteOffset === undefined && length === undefined) { buf = new Uint8Array(array) } else if (length === undefined) { buf = new Uint8Array(array, byteOffset) } else { buf = new Uint8Array(array, byteOffset, length) } // Return an augmented `Uint8Array` instance buf.__proto__ = Buffer.prototype return buf } function fromObject (obj) { if (Buffer.isBuffer(obj)) { var len = checked(obj.length) | 0 var buf = createBuffer(len) if (buf.length === 0) { return buf } obj.copy(buf, 0, 0, len) return buf } if (obj.length !== undefined) { if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { return createBuffer(0) } return fromArrayLike(obj) } if (obj.type === 'Buffer' && Array.isArray(obj.data)) { return fromArrayLike(obj.data) } } function checked (length) { // Note: cannot use `length < K_MAX_LENGTH` here because that fails when // length is NaN (which is otherwise coerced to zero.) if (length >= K_MAX_LENGTH) { throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') } return length | 0 } function SlowBuffer (length) { if (+length != length) { // eslint-disable-line eqeqeq length = 0 } return Buffer.alloc(+length) } Buffer.isBuffer = function isBuffer (b) { return b != null && b._isBuffer === true && b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false } Buffer.compare = function compare (a, b) { if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { throw new TypeError( 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' ) } if (a === b) return 0 var x = a.length var y = b.length for (var i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i] y = b[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } Buffer.isEncoding = function isEncoding (encoding) { switch (String(encoding).toLowerCase()) { case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'latin1': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return true default: return false } } Buffer.concat = function concat (list, length) { if (!Array.isArray(list)) { throw new TypeError('"list" argument must be an Array of Buffers') } if (list.length === 0) { return Buffer.alloc(0) } var i if (length === undefined) { length = 0 for (i = 0; i < list.length; ++i) { length += list[i].length } } var buffer = Buffer.allocUnsafe(length) var pos = 0 for (i = 0; i < list.length; ++i) { var buf = list[i] if (isInstance(buf, Uint8Array)) { buf = Buffer.from(buf) } if (!Buffer.isBuffer(buf)) { throw new TypeError('"list" argument must be an Array of Buffers') } buf.copy(buffer, pos) pos += buf.length } return buffer } function byteLength (string, encoding) { if (Buffer.isBuffer(string)) { return string.length } if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { return string.byteLength } if (typeof string !== 'string') { throw new TypeError( 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + 'Received type ' + typeof string ) } var len = string.length var mustMatch = (arguments.length > 2 && arguments[2] === true) if (!mustMatch && len === 0) return 0 // Use a for loop to avoid recursion var loweredCase = false for (;;) { switch (encoding) { case 'ascii': case 'latin1': case 'binary': return len case 'utf8': case 'utf-8': return utf8ToBytes(string).length case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return len * 2 case 'hex': return len >>> 1 case 'base64': return base64ToBytes(string).length default: if (loweredCase) { return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 } encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.byteLength = byteLength function slowToString (encoding, start, end) { var loweredCase = false // No need to verify that "this.length <= MAX_UINT32" since it's a read-only // property of a typed array. // This behaves neither like String nor Uint8Array in that we set start/end // to their upper/lower bounds if the value passed is out of range. // undefined is handled specially as per ECMA-262 6th Edition, // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. if (start === undefined || start < 0) { start = 0 } // Return early if start > this.length. Done here to prevent potential uint32 // coercion fail below. if (start > this.length) { return '' } if (end === undefined || end > this.length) { end = this.length } if (end <= 0) { return '' } // Force coersion to uint32. This will also coerce falsey/NaN values to 0. end >>>= 0 start >>>= 0 if (end <= start) { return '' } if (!encoding) encoding = 'utf8' while (true) { switch (encoding) { case 'hex': return hexSlice(this, start, end) case 'utf8': case 'utf-8': return utf8Slice(this, start, end) case 'ascii': return asciiSlice(this, start, end) case 'latin1': case 'binary': return latin1Slice(this, start, end) case 'base64': return base64Slice(this, start, end) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return utf16leSlice(this, start, end) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = (encoding + '').toLowerCase() loweredCase = true } } } // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) // to detect a Buffer instance. It's not possible to use `instanceof Buffer` // reliably in a browserify context because there could be multiple different // copies of the 'buffer' package in use. This method works even for Buffer // instances that were created from another copy of the `buffer` package. // See: https://github.com/feross/buffer/issues/154 Buffer.prototype._isBuffer = true function swap (b, n, m) { var i = b[n] b[n] = b[m] b[m] = i } Buffer.prototype.swap16 = function swap16 () { var len = this.length if (len % 2 !== 0) { throw new RangeError('Buffer size must be a multiple of 16-bits') } for (var i = 0; i < len; i += 2) { swap(this, i, i + 1) } return this } Buffer.prototype.swap32 = function swap32 () { var len = this.length if (len % 4 !== 0) { throw new RangeError('Buffer size must be a multiple of 32-bits') } for (var i = 0; i < len; i += 4) { swap(this, i, i + 3) swap(this, i + 1, i + 2) } return this } Buffer.prototype.swap64 = function swap64 () { var len = this.length if (len % 8 !== 0) { throw new RangeError('Buffer size must be a multiple of 64-bits') } for (var i = 0; i < len; i += 8) { swap(this, i, i + 7) swap(this, i + 1, i + 6) swap(this, i + 2, i + 5) swap(this, i + 3, i + 4) } return this } Buffer.prototype.toString = function toString () { var length = this.length if (length === 0) return '' if (arguments.length === 0) return utf8Slice(this, 0, length) return slowToString.apply(this, arguments) } Buffer.prototype.toLocaleString = Buffer.prototype.toString Buffer.prototype.equals = function equals (b) { if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') if (this === b) return true return Buffer.compare(this, b) === 0 } Buffer.prototype.inspect = function inspect () { var str = '' var max = exports.INSPECT_MAX_BYTES str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() if (this.length > max) str += ' ... ' return '' } Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { if (isInstance(target, Uint8Array)) { target = Buffer.from(target, target.offset, target.byteLength) } if (!Buffer.isBuffer(target)) { throw new TypeError( 'The "target" argument must be one of type Buffer or Uint8Array. ' + 'Received type ' + (typeof target) ) } if (start === undefined) { start = 0 } if (end === undefined) { end = target ? target.length : 0 } if (thisStart === undefined) { thisStart = 0 } if (thisEnd === undefined) { thisEnd = this.length } if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { throw new RangeError('out of range index') } if (thisStart >= thisEnd && start >= end) { return 0 } if (thisStart >= thisEnd) { return -1 } if (start >= end) { return 1 } start >>>= 0 end >>>= 0 thisStart >>>= 0 thisEnd >>>= 0 if (this === target) return 0 var x = thisEnd - thisStart var y = end - start var len = Math.min(x, y) var thisCopy = this.slice(thisStart, thisEnd) var targetCopy = target.slice(start, end) for (var i = 0; i < len; ++i) { if (thisCopy[i] !== targetCopy[i]) { x = thisCopy[i] y = targetCopy[i] break } } if (x < y) return -1 if (y < x) return 1 return 0 } // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, // OR the last index of `val` in `buffer` at offset <= `byteOffset`. // // Arguments: // - buffer - a Buffer to search // - val - a string, Buffer, or number // - byteOffset - an index into `buffer`; will be clamped to an int32 // - encoding - an optional encoding, relevant is val is a string // - dir - true for indexOf, false for lastIndexOf function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { // Empty buffer means no match if (buffer.length === 0) return -1 // Normalize byteOffset if (typeof byteOffset === 'string') { encoding = byteOffset byteOffset = 0 } else if (byteOffset > 0x7fffffff) { byteOffset = 0x7fffffff } else if (byteOffset < -0x80000000) { byteOffset = -0x80000000 } byteOffset = +byteOffset // Coerce to Number. if (numberIsNaN(byteOffset)) { // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer byteOffset = dir ? 0 : (buffer.length - 1) } // Normalize byteOffset: negative offsets start from the end of the buffer if (byteOffset < 0) byteOffset = buffer.length + byteOffset if (byteOffset >= buffer.length) { if (dir) return -1 else byteOffset = buffer.length - 1 } else if (byteOffset < 0) { if (dir) byteOffset = 0 else return -1 } // Normalize val if (typeof val === 'string') { val = Buffer.from(val, encoding) } // Finally, search either indexOf (if dir is true) or lastIndexOf if (Buffer.isBuffer(val)) { // Special case: looking for empty string/buffer always fails if (val.length === 0) { return -1 } return arrayIndexOf(buffer, val, byteOffset, encoding, dir) } else if (typeof val === 'number') { val = val & 0xFF // Search for a byte value [0-255] if (typeof Uint8Array.prototype.indexOf === 'function') { if (dir) { return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) } else { return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) } } return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) } throw new TypeError('val must be string, number or Buffer') } function arrayIndexOf (arr, val, byteOffset, encoding, dir) { var indexSize = 1 var arrLength = arr.length var valLength = val.length if (encoding !== undefined) { encoding = String(encoding).toLowerCase() if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { if (arr.length < 2 || val.length < 2) { return -1 } indexSize = 2 arrLength /= 2 valLength /= 2 byteOffset /= 2 } } function read (buf, i) { if (indexSize === 1) { return buf[i] } else { return buf.readUInt16BE(i * indexSize) } } var i if (dir) { var foundIndex = -1 for (i = byteOffset; i < arrLength; i++) { if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) foundIndex = i if (i - foundIndex + 1 === valLength) return foundIndex * indexSize } else { if (foundIndex !== -1) i -= i - foundIndex foundIndex = -1 } } } else { if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength for (i = byteOffset; i >= 0; i--) { var found = true for (var j = 0; j < valLength; j++) { if (read(arr, i + j) !== read(val, j)) { found = false break } } if (found) return i } } return -1 } Buffer.prototype.includes = function includes (val, byteOffset, encoding) { return this.indexOf(val, byteOffset, encoding) !== -1 } Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, true) } Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { return bidirectionalIndexOf(this, val, byteOffset, encoding, false) } function hexWrite (buf, string, offset, length) { offset = Number(offset) || 0 var remaining = buf.length - offset if (!length) { length = remaining } else { length = Number(length) if (length > remaining) { length = remaining } } var strLen = string.length if (length > strLen / 2) { length = strLen / 2 } for (var i = 0; i < length; ++i) { var parsed = parseInt(string.substr(i * 2, 2), 16) if (numberIsNaN(parsed)) return i buf[offset + i] = parsed } return i } function utf8Write (buf, string, offset, length) { return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) } function asciiWrite (buf, string, offset, length) { return blitBuffer(asciiToBytes(string), buf, offset, length) } function latin1Write (buf, string, offset, length) { return asciiWrite(buf, string, offset, length) } function base64Write (buf, string, offset, length) { return blitBuffer(base64ToBytes(string), buf, offset, length) } function ucs2Write (buf, string, offset, length) { return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) } Buffer.prototype.write = function write (string, offset, length, encoding) { // Buffer#write(string) if (offset === undefined) { encoding = 'utf8' length = this.length offset = 0 // Buffer#write(string, encoding) } else if (length === undefined && typeof offset === 'string') { encoding = offset length = this.length offset = 0 // Buffer#write(string, offset[, length][, encoding]) } else if (isFinite(offset)) { offset = offset >>> 0 if (isFinite(length)) { length = length >>> 0 if (encoding === undefined) encoding = 'utf8' } else { encoding = length length = undefined } } else { throw new Error( 'Buffer.write(string, encoding, offset[, length]) is no longer supported' ) } var remaining = this.length - offset if (length === undefined || length > remaining) length = remaining if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { throw new RangeError('Attempt to write outside buffer bounds') } if (!encoding) encoding = 'utf8' var loweredCase = false for (;;) { switch (encoding) { case 'hex': return hexWrite(this, string, offset, length) case 'utf8': case 'utf-8': return utf8Write(this, string, offset, length) case 'ascii': return asciiWrite(this, string, offset, length) case 'latin1': case 'binary': return latin1Write(this, string, offset, length) case 'base64': // Warning: maxLength not taken into account in base64Write return base64Write(this, string, offset, length) case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return ucs2Write(this, string, offset, length) default: if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) encoding = ('' + encoding).toLowerCase() loweredCase = true } } } Buffer.prototype.toJSON = function toJSON () { return { type: 'Buffer', data: Array.prototype.slice.call(this._arr || this, 0) } } function base64Slice (buf, start, end) { if (start === 0 && end === buf.length) { return base64.fromByteArray(buf) } else { return base64.fromByteArray(buf.slice(start, end)) } } function utf8Slice (buf, start, end) { end = Math.min(buf.length, end) var res = [] var i = start while (i < end) { var firstByte = buf[i] var codePoint = null var bytesPerSequence = (firstByte > 0xEF) ? 4 : (firstByte > 0xDF) ? 3 : (firstByte > 0xBF) ? 2 : 1 if (i + bytesPerSequence <= end) { var secondByte, thirdByte, fourthByte, tempCodePoint switch (bytesPerSequence) { case 1: if (firstByte < 0x80) { codePoint = firstByte } break case 2: secondByte = buf[i + 1] if ((secondByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) if (tempCodePoint > 0x7F) { codePoint = tempCodePoint } } break case 3: secondByte = buf[i + 1] thirdByte = buf[i + 2] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { codePoint = tempCodePoint } } break case 4: secondByte = buf[i + 1] thirdByte = buf[i + 2] fourthByte = buf[i + 3] if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { codePoint = tempCodePoint } } } } if (codePoint === null) { // we did not generate a valid codePoint so insert a // replacement char (U+FFFD) and advance only 1 byte codePoint = 0xFFFD bytesPerSequence = 1 } else if (codePoint > 0xFFFF) { // encode to utf16 (surrogate pair dance) codePoint -= 0x10000 res.push(codePoint >>> 10 & 0x3FF | 0xD800) codePoint = 0xDC00 | codePoint & 0x3FF } res.push(codePoint) i += bytesPerSequence } return decodeCodePointsArray(res) } // Based on http://stackoverflow.com/a/22747272/680742, the browser with // the lowest limit is Chrome, with 0x10000 args. // We go 1 magnitude less, for safety var MAX_ARGUMENTS_LENGTH = 0x1000 function decodeCodePointsArray (codePoints) { var len = codePoints.length if (len <= MAX_ARGUMENTS_LENGTH) { return String.fromCharCode.apply(String, codePoints) // avoid extra slice() } // Decode in chunks to avoid "call stack size exceeded". var res = '' var i = 0 while (i < len) { res += String.fromCharCode.apply( String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) ) } return res } function asciiSlice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i] & 0x7F) } return ret } function latin1Slice (buf, start, end) { var ret = '' end = Math.min(buf.length, end) for (var i = start; i < end; ++i) { ret += String.fromCharCode(buf[i]) } return ret } function hexSlice (buf, start, end) { var len = buf.length if (!start || start < 0) start = 0 if (!end || end < 0 || end > len) end = len var out = '' for (var i = start; i < end; ++i) { out += toHex(buf[i]) } return out } function utf16leSlice (buf, start, end) { var bytes = buf.slice(start, end) var res = '' for (var i = 0; i < bytes.length; i += 2) { res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) } return res } Buffer.prototype.slice = function slice (start, end) { var len = this.length start = ~~start end = end === undefined ? len : ~~end if (start < 0) { start += len if (start < 0) start = 0 } else if (start > len) { start = len } if (end < 0) { end += len if (end < 0) end = 0 } else if (end > len) { end = len } if (end < start) end = start var newBuf = this.subarray(start, end) // Return an augmented `Uint8Array` instance newBuf.__proto__ = Buffer.prototype return newBuf } /* * Need to make sure that buffer isn't trying to write out of bounds. */ function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') } Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } return val } Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { checkOffset(offset, byteLength, this.length) } var val = this[offset + --byteLength] var mul = 1 while (byteLength > 0 && (mul *= 0x100)) { val += this[offset + --byteLength] * mul } return val } Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 1, this.length) return this[offset] } Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) return this[offset] | (this[offset + 1] << 8) } Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) return (this[offset] << 8) | this[offset + 1] } Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return ((this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16)) + (this[offset + 3] * 0x1000000) } Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] * 0x1000000) + ((this[offset + 1] << 16) | (this[offset + 2] << 8) | this[offset + 3]) } Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var val = this[offset] var mul = 1 var i = 0 while (++i < byteLength && (mul *= 0x100)) { val += this[offset + i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) checkOffset(offset, byteLength, this.length) var i = byteLength var mul = 1 var val = this[offset + --i] while (i > 0 && (mul *= 0x100)) { val += this[offset + --i] * mul } mul *= 0x80 if (val >= mul) val -= Math.pow(2, 8 * byteLength) return val } Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 1, this.length) if (!(this[offset] & 0x80)) return (this[offset]) return ((0xff - this[offset] + 1) * -1) } Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset] | (this[offset + 1] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 2, this.length) var val = this[offset + 1] | (this[offset] << 8) return (val & 0x8000) ? val | 0xFFFF0000 : val } Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset]) | (this[offset + 1] << 8) | (this[offset + 2] << 16) | (this[offset + 3] << 24) } Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return (this[offset] << 24) | (this[offset + 1] << 16) | (this[offset + 2] << 8) | (this[offset + 3]) } Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, true, 23, 4) } Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 4, this.length) return ieee754.read(this, offset, false, 23, 4) } Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, true, 52, 8) } Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { offset = offset >>> 0 if (!noAssert) checkOffset(offset, 8, this.length) return ieee754.read(this, offset, false, 52, 8) } function checkInt (buf, value, offset, ext, max, min) { if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') if (offset + ext > buf.length) throw new RangeError('Index out of range') } Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } var mul = 1 var i = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 byteLength = byteLength >>> 0 if (!noAssert) { var maxBytes = Math.pow(2, 8 * byteLength) - 1 checkInt(this, value, offset, byteLength, maxBytes, 0) } var i = byteLength - 1 var mul = 1 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { this[offset + i] = (value / mul) & 0xFF } return offset + byteLength } Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) this[offset] = (value & 0xff) return offset + 1 } Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) return offset + 2 } Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) return offset + 2 } Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) this[offset + 3] = (value >>> 24) this[offset + 2] = (value >>> 16) this[offset + 1] = (value >>> 8) this[offset] = (value & 0xff) return offset + 4 } Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) return offset + 4 } Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) { var limit = Math.pow(2, (8 * byteLength) - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = 0 var mul = 1 var sub = 0 this[offset] = value & 0xFF while (++i < byteLength && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) { var limit = Math.pow(2, (8 * byteLength) - 1) checkInt(this, value, offset, byteLength, limit - 1, -limit) } var i = byteLength - 1 var mul = 1 var sub = 0 this[offset + i] = value & 0xFF while (--i >= 0 && (mul *= 0x100)) { if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { sub = 1 } this[offset + i] = ((value / mul) >> 0) - sub & 0xFF } return offset + byteLength } Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) if (value < 0) value = 0xff + value + 1 this[offset] = (value & 0xff) return offset + 1 } Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) return offset + 2 } Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) this[offset] = (value >>> 8) this[offset + 1] = (value & 0xff) return offset + 2 } Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) this[offset] = (value & 0xff) this[offset + 1] = (value >>> 8) this[offset + 2] = (value >>> 16) this[offset + 3] = (value >>> 24) return offset + 4 } Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) if (value < 0) value = 0xffffffff + value + 1 this[offset] = (value >>> 24) this[offset + 1] = (value >>> 16) this[offset + 2] = (value >>> 8) this[offset + 3] = (value & 0xff) return offset + 4 } function checkIEEE754 (buf, value, offset, ext, max, min) { if (offset + ext > buf.length) throw new RangeError('Index out of range') if (offset < 0) throw new RangeError('Index out of range') } function writeFloat (buf, value, offset, littleEndian, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) { checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) } ieee754.write(buf, value, offset, littleEndian, 23, 4) return offset + 4 } Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { return writeFloat(this, value, offset, true, noAssert) } Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { return writeFloat(this, value, offset, false, noAssert) } function writeDouble (buf, value, offset, littleEndian, noAssert) { value = +value offset = offset >>> 0 if (!noAssert) { checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) } ieee754.write(buf, value, offset, littleEndian, 52, 8) return offset + 8 } Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { return writeDouble(this, value, offset, true, noAssert) } Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { return writeDouble(this, value, offset, false, noAssert) } // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) Buffer.prototype.copy = function copy (target, targetStart, start, end) { if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') if (!start) start = 0 if (!end && end !== 0) end = this.length if (targetStart >= target.length) targetStart = target.length if (!targetStart) targetStart = 0 if (end > 0 && end < start) end = start // Copy 0 bytes; we're done if (end === start) return 0 if (target.length === 0 || this.length === 0) return 0 // Fatal error conditions if (targetStart < 0) { throw new RangeError('targetStart out of bounds') } if (start < 0 || start >= this.length) throw new RangeError('Index out of range') if (end < 0) throw new RangeError('sourceEnd out of bounds') // Are we oob? if (end > this.length) end = this.length if (target.length - targetStart < end - start) { end = target.length - targetStart + start } var len = end - start if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { // Use built-in when available, missing from IE11 this.copyWithin(targetStart, start, end) } else if (this === target && start < targetStart && targetStart < end) { // descending copy from end for (var i = len - 1; i >= 0; --i) { target[i + targetStart] = this[i + start] } } else { Uint8Array.prototype.set.call( target, this.subarray(start, end), targetStart ) } return len } // Usage: // buffer.fill(number[, offset[, end]]) // buffer.fill(buffer[, offset[, end]]) // buffer.fill(string[, offset[, end]][, encoding]) Buffer.prototype.fill = function fill (val, start, end, encoding) { // Handle string cases: if (typeof val === 'string') { if (typeof start === 'string') { encoding = start start = 0 end = this.length } else if (typeof end === 'string') { encoding = end end = this.length } if (encoding !== undefined && typeof encoding !== 'string') { throw new TypeError('encoding must be a string') } if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { throw new TypeError('Unknown encoding: ' + encoding) } if (val.length === 1) { var code = val.charCodeAt(0) if ((encoding === 'utf8' && code < 128) || encoding === 'latin1') { // Fast path: If `val` fits into a single byte, use that numeric value. val = code } } } else if (typeof val === 'number') { val = val & 255 } // Invalid ranges are not set to a default, so can range check early. if (start < 0 || this.length < start || this.length < end) { throw new RangeError('Out of range index') } if (end <= start) { return this } start = start >>> 0 end = end === undefined ? this.length : end >>> 0 if (!val) val = 0 var i if (typeof val === 'number') { for (i = start; i < end; ++i) { this[i] = val } } else { var bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding) var len = bytes.length if (len === 0) { throw new TypeError('The value "' + val + '" is invalid for argument "value"') } for (i = 0; i < end - start; ++i) { this[i + start] = bytes[i % len] } } return this } // HELPER FUNCTIONS // ================ var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g function base64clean (str) { // Node takes equal signs as end of the Base64 encoding str = str.split('=')[0] // Node strips out invalid characters like \n and \t from the string, base64-js does not str = str.trim().replace(INVALID_BASE64_RE, '') // Node converts strings with length < 2 to '' if (str.length < 2) return '' // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not while (str.length % 4 !== 0) { str = str + '=' } return str } function toHex (n) { if (n < 16) return '0' + n.toString(16) return n.toString(16) } function utf8ToBytes (string, units) { units = units || Infinity var codePoint var length = string.length var leadSurrogate = null var bytes = [] for (var i = 0; i < length; ++i) { codePoint = string.charCodeAt(i) // is surrogate component if (codePoint > 0xD7FF && codePoint < 0xE000) { // last char was a lead if (!leadSurrogate) { // no lead yet if (codePoint > 0xDBFF) { // unexpected trail if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } else if (i + 1 === length) { // unpaired lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) continue } // valid lead leadSurrogate = codePoint continue } // 2 leads in a row if (codePoint < 0xDC00) { if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) leadSurrogate = codePoint continue } // valid surrogate pair codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 } else if (leadSurrogate) { // valid bmp char, but last char was a lead if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) } leadSurrogate = null // encode utf8 if (codePoint < 0x80) { if ((units -= 1) < 0) break bytes.push(codePoint) } else if (codePoint < 0x800) { if ((units -= 2) < 0) break bytes.push( codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x10000) { if ((units -= 3) < 0) break bytes.push( codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else if (codePoint < 0x110000) { if ((units -= 4) < 0) break bytes.push( codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80 ) } else { throw new Error('Invalid code point') } } return bytes } function asciiToBytes (str) { var byteArray = [] for (var i = 0; i < str.length; ++i) { // Node's code seems to be doing this and not & 0x7F.. byteArray.push(str.charCodeAt(i) & 0xFF) } return byteArray } function utf16leToBytes (str, units) { var c, hi, lo var byteArray = [] for (var i = 0; i < str.length; ++i) { if ((units -= 2) < 0) break c = str.charCodeAt(i) hi = c >> 8 lo = c % 256 byteArray.push(lo) byteArray.push(hi) } return byteArray } function base64ToBytes (str) { return base64.toByteArray(base64clean(str)) } function blitBuffer (src, dst, offset, length) { for (var i = 0; i < length; ++i) { if ((i + offset >= dst.length) || (i >= src.length)) break dst[i + offset] = src[i] } return i } // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass // the `instanceof` check but they should be treated as of that type. // See: https://github.com/feross/buffer/issues/166 function isInstance (obj, type) { return obj instanceof type || (obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name) } function numberIsNaN (obj) { // For IE11 support return obj !== obj // eslint-disable-line no-self-compare } },{"base64-js":1,"ieee754":25}],5:[function(require,module,exports){ (function (Buffer){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // NOTE: These type checking functions intentionally don't use `instanceof` // because it is fragile and can be easily faked with `Object.create()`. function isArray(arg) { if (Array.isArray) { return Array.isArray(arg); } return objectToString(arg) === '[object Array]'; } exports.isArray = isArray; function isBoolean(arg) { return typeof arg === 'boolean'; } exports.isBoolean = isBoolean; function isNull(arg) { return arg === null; } exports.isNull = isNull; function isNullOrUndefined(arg) { return arg == null; } exports.isNullOrUndefined = isNullOrUndefined; function isNumber(arg) { return typeof arg === 'number'; } exports.isNumber = isNumber; function isString(arg) { return typeof arg === 'string'; } exports.isString = isString; function isSymbol(arg) { return typeof arg === 'symbol'; } exports.isSymbol = isSymbol; function isUndefined(arg) { return arg === void 0; } exports.isUndefined = isUndefined; function isRegExp(re) { return objectToString(re) === '[object RegExp]'; } exports.isRegExp = isRegExp; function isObject(arg) { return typeof arg === 'object' && arg !== null; } exports.isObject = isObject; function isDate(d) { return objectToString(d) === '[object Date]'; } exports.isDate = isDate; function isError(e) { return (objectToString(e) === '[object Error]' || e instanceof Error); } exports.isError = isError; function isFunction(arg) { return typeof arg === 'function'; } exports.isFunction = isFunction; function isPrimitive(arg) { return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || typeof arg === 'symbol' || // ES6 symbol typeof arg === 'undefined'; } exports.isPrimitive = isPrimitive; exports.isBuffer = Buffer.isBuffer; function objectToString(o) { return Object.prototype.toString.call(o); } }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) },{"../../is-buffer/index.js":27}],6:[function(require,module,exports){ var pSlice = Array.prototype.slice; var objectKeys = require('./lib/keys.js'); var isArguments = require('./lib/is_arguments.js'); var deepEqual = module.exports = function (actual, expected, opts) { if (!opts) opts = {}; // 7.1. All identical values are equivalent, as determined by ===. if (actual === expected) { return true; } else if (actual instanceof Date && expected instanceof Date) { return actual.getTime() === expected.getTime(); // 7.3. Other pairs that do not both pass typeof value == 'object', // equivalence is determined by ==. } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') { return opts.strict ? actual === expected : actual == expected; // 7.4. For all other Object pairs, including Array objects, equivalence is // determined by having the same number of owned properties (as verified // with Object.prototype.hasOwnProperty.call), the same set of keys // (although not necessarily the same order), equivalent values for every // corresponding key, and an identical 'prototype' property. Note: this // accounts for both named and indexed properties on Arrays. } else { return objEquiv(actual, expected, opts); } } function isUndefinedOrNull(value) { return value === null || value === undefined; } function isBuffer (x) { if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false; if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { return false; } if (x.length > 0 && typeof x[0] !== 'number') return false; return true; } function objEquiv(a, b, opts) { var i, key; if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) return false; // an identical 'prototype' property. if (a.prototype !== b.prototype) return false; //~~~I've managed to break Object.keys through screwy arguments passing. // Converting to array solves the problem. if (isArguments(a)) { if (!isArguments(b)) { return false; } a = pSlice.call(a); b = pSlice.call(b); return deepEqual(a, b, opts); } if (isBuffer(a)) { if (!isBuffer(b)) { return false; } if (a.length !== b.length) return false; for (i = 0; i < a.length; i++) { if (a[i] !== b[i]) return false; } return true; } try { var ka = objectKeys(a), kb = objectKeys(b); } catch (e) {//happens when one is a string literal and the other isn't return false; } // having the same number of owned properties (keys incorporates // hasOwnProperty) if (ka.length != kb.length) return false; //the same set of keys (although not necessarily the same order), ka.sort(); kb.sort(); //~~~cheap key test for (i = ka.length - 1; i >= 0; i--) { if (ka[i] != kb[i]) return false; } //equivalent values for every corresponding key, and //~~~possibly expensive deep test for (i = ka.length - 1; i >= 0; i--) { key = ka[i]; if (!deepEqual(a[key], b[key], opts)) return false; } return typeof a === typeof b; } },{"./lib/is_arguments.js":7,"./lib/keys.js":8}],7:[function(require,module,exports){ var supportsArgumentsClass = (function(){ return Object.prototype.toString.call(arguments) })() == '[object Arguments]'; exports = module.exports = supportsArgumentsClass ? supported : unsupported; exports.supported = supported; function supported(object) { return Object.prototype.toString.call(object) == '[object Arguments]'; }; exports.unsupported = unsupported; function unsupported(object){ return object && typeof object == 'object' && typeof object.length == 'number' && Object.prototype.hasOwnProperty.call(object, 'callee') && !Object.prototype.propertyIsEnumerable.call(object, 'callee') || false; }; },{}],8:[function(require,module,exports){ exports = module.exports = typeof Object.keys === 'function' ? Object.keys : shim; exports.shim = shim; function shim (obj) { var keys = []; for (var key in obj) keys.push(key); return keys; } },{}],9:[function(require,module,exports){ 'use strict'; var keys = require('object-keys'); var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; var toStr = Object.prototype.toString; var concat = Array.prototype.concat; var origDefineProperty = Object.defineProperty; var isFunction = function (fn) { return typeof fn === 'function' && toStr.call(fn) === '[object Function]'; }; var arePropertyDescriptorsSupported = function () { var obj = {}; try { origDefineProperty(obj, 'x', { enumerable: false, value: obj }); // eslint-disable-next-line no-unused-vars, no-restricted-syntax for (var _ in obj) { // jscs:ignore disallowUnusedVariables return false; } return obj.x === obj; } catch (e) { /* this is IE 8. */ return false; } }; var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported(); var defineProperty = function (object, name, value, predicate) { if (name in object && (!isFunction(predicate) || !predicate())) { return; } if (supportsDescriptors) { origDefineProperty(object, name, { configurable: true, enumerable: false, value: value, writable: true }); } else { object[name] = value; } }; var defineProperties = function (object, map) { var predicates = arguments.length > 2 ? arguments[2] : {}; var props = keys(map); if (hasSymbols) { props = concat.call(props, Object.getOwnPropertySymbols(map)); } for (var i = 0; i < props.length; i += 1) { defineProperty(object, props[i], map[props[i]], predicates[props[i]]); } }; defineProperties.supportsDescriptors = !!supportsDescriptors; module.exports = defineProperties; },{"object-keys":32}],10:[function(require,module,exports){ module.exports = function () { for (var i = 0; i < arguments.length; i++) { if (arguments[i] !== undefined) return arguments[i]; } }; },{}],11:[function(require,module,exports){ 'use strict'; /* globals Set, Map, WeakSet, WeakMap, Promise, Symbol, Proxy, Atomics, SharedArrayBuffer, ArrayBuffer, DataView, Uint8Array, Float32Array, Float64Array, Int8Array, Int16Array, Int32Array, Uint8ClampedArray, Uint16Array, Uint32Array, */ var undefined; // eslint-disable-line no-shadow-restricted-names var ThrowTypeError = Object.getOwnPropertyDescriptor ? (function () { return Object.getOwnPropertyDescriptor(arguments, 'callee').get; }()) : function () { throw new TypeError(); }; var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol'; var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto var generator; // = function * () {}; var generatorFunction = generator ? getProto(generator) : undefined; var asyncFn; // async function() {}; var asyncFunction = asyncFn ? asyncFn.constructor : undefined; var asyncGen; // async function * () {}; var asyncGenFunction = asyncGen ? getProto(asyncGen) : undefined; var asyncGenIterator = asyncGen ? asyncGen() : undefined; var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); var INTRINSICS = { '$ %Array%': Array, '$ %ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, '$ %ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer.prototype, '$ %ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, '$ %ArrayPrototype%': Array.prototype, '$ %ArrayProto_entries%': Array.prototype.entries, '$ %ArrayProto_forEach%': Array.prototype.forEach, '$ %ArrayProto_keys%': Array.prototype.keys, '$ %ArrayProto_values%': Array.prototype.values, '$ %AsyncFromSyncIteratorPrototype%': undefined, '$ %AsyncFunction%': asyncFunction, '$ %AsyncFunctionPrototype%': asyncFunction ? asyncFunction.prototype : undefined, '$ %AsyncGenerator%': asyncGen ? getProto(asyncGenIterator) : undefined, '$ %AsyncGeneratorFunction%': asyncGenFunction, '$ %AsyncGeneratorPrototype%': asyncGenFunction ? asyncGenFunction.prototype : undefined, '$ %AsyncIteratorPrototype%': asyncGenIterator && hasSymbols && Symbol.asyncIterator ? asyncGenIterator[Symbol.asyncIterator]() : undefined, '$ %Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, '$ %Boolean%': Boolean, '$ %BooleanPrototype%': Boolean.prototype, '$ %DataView%': typeof DataView === 'undefined' ? undefined : DataView, '$ %DataViewPrototype%': typeof DataView === 'undefined' ? undefined : DataView.prototype, '$ %Date%': Date, '$ %DatePrototype%': Date.prototype, '$ %decodeURI%': decodeURI, '$ %decodeURIComponent%': decodeURIComponent, '$ %encodeURI%': encodeURI, '$ %encodeURIComponent%': encodeURIComponent, '$ %Error%': Error, '$ %ErrorPrototype%': Error.prototype, '$ %eval%': eval, // eslint-disable-line no-eval '$ %EvalError%': EvalError, '$ %EvalErrorPrototype%': EvalError.prototype, '$ %Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, '$ %Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined : Float32Array.prototype, '$ %Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, '$ %Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined : Float64Array.prototype, '$ %Function%': Function, '$ %FunctionPrototype%': Function.prototype, '$ %Generator%': generator ? getProto(generator()) : undefined, '$ %GeneratorFunction%': generatorFunction, '$ %GeneratorPrototype%': generatorFunction ? generatorFunction.prototype : undefined, '$ %Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, '$ %Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined : Int8Array.prototype, '$ %Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, '$ %Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined : Int8Array.prototype, '$ %Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, '$ %Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined : Int32Array.prototype, '$ %isFinite%': isFinite, '$ %isNaN%': isNaN, '$ %IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, '$ %JSON%': JSON, '$ %JSONParse%': JSON.parse, '$ %Map%': typeof Map === 'undefined' ? undefined : Map, '$ %MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), '$ %MapPrototype%': typeof Map === 'undefined' ? undefined : Map.prototype, '$ %Math%': Math, '$ %Number%': Number, '$ %NumberPrototype%': Number.prototype, '$ %Object%': Object, '$ %ObjectPrototype%': Object.prototype, '$ %ObjProto_toString%': Object.prototype.toString, '$ %ObjProto_valueOf%': Object.prototype.valueOf, '$ %parseFloat%': parseFloat, '$ %parseInt%': parseInt, '$ %Promise%': typeof Promise === 'undefined' ? undefined : Promise, '$ %PromisePrototype%': typeof Promise === 'undefined' ? undefined : Promise.prototype, '$ %PromiseProto_then%': typeof Promise === 'undefined' ? undefined : Promise.prototype.then, '$ %Promise_all%': typeof Promise === 'undefined' ? undefined : Promise.all, '$ %Promise_reject%': typeof Promise === 'undefined' ? undefined : Promise.reject, '$ %Promise_resolve%': typeof Promise === 'undefined' ? undefined : Promise.resolve, '$ %Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, '$ %RangeError%': RangeError, '$ %RangeErrorPrototype%': RangeError.prototype, '$ %ReferenceError%': ReferenceError, '$ %ReferenceErrorPrototype%': ReferenceError.prototype, '$ %Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, '$ %RegExp%': RegExp, '$ %RegExpPrototype%': RegExp.prototype, '$ %Set%': typeof Set === 'undefined' ? undefined : Set, '$ %SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), '$ %SetPrototype%': typeof Set === 'undefined' ? undefined : Set.prototype, '$ %SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, '$ %SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer.prototype, '$ %String%': String, '$ %StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, '$ %StringPrototype%': String.prototype, '$ %Symbol%': hasSymbols ? Symbol : undefined, '$ %SymbolPrototype%': hasSymbols ? Symbol.prototype : undefined, '$ %SyntaxError%': SyntaxError, '$ %SyntaxErrorPrototype%': SyntaxError.prototype, '$ %ThrowTypeError%': ThrowTypeError, '$ %TypedArray%': TypedArray, '$ %TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined, '$ %TypeError%': TypeError, '$ %TypeErrorPrototype%': TypeError.prototype, '$ %Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, '$ %Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array.prototype, '$ %Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, '$ %Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray.prototype, '$ %Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, '$ %Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array.prototype, '$ %Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, '$ %Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array.prototype, '$ %URIError%': URIError, '$ %URIErrorPrototype%': URIError.prototype, '$ %WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, '$ %WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined : WeakMap.prototype, '$ %WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet, '$ %WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined : WeakSet.prototype }; module.exports = function GetIntrinsic(name, allowMissing) { if (arguments.length > 1 && typeof allowMissing !== 'boolean') { throw new TypeError('"allowMissing" argument must be a boolean'); } var key = '$ ' + name; if (!(key in INTRINSICS)) { throw new SyntaxError('intrinsic ' + name + ' does not exist!'); } // istanbul ignore if // hopefully this is impossible to test :-) if (typeof INTRINSICS[key] === 'undefined' && !allowMissing) { throw new TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); } return INTRINSICS[key]; }; },{}],12:[function(require,module,exports){ 'use strict'; var GetIntrinsic = require('./GetIntrinsic'); var $Object = GetIntrinsic('%Object%'); var $TypeError = GetIntrinsic('%TypeError%'); var $String = GetIntrinsic('%String%'); var assertRecord = require('./helpers/assertRecord'); var $isNaN = require('./helpers/isNaN'); var $isFinite = require('./helpers/isFinite'); var sign = require('./helpers/sign'); var mod = require('./helpers/mod'); var IsCallable = require('is-callable'); var toPrimitive = require('es-to-primitive/es5'); var has = require('has'); // https://es5.github.io/#x9 var ES5 = { ToPrimitive: toPrimitive, ToBoolean: function ToBoolean(value) { return !!value; }, ToNumber: function ToNumber(value) { return +value; // eslint-disable-line no-implicit-coercion }, ToInteger: function ToInteger(value) { var number = this.ToNumber(value); if ($isNaN(number)) { return 0; } if (number === 0 || !$isFinite(number)) { return number; } return sign(number) * Math.floor(Math.abs(number)); }, ToInt32: function ToInt32(x) { return this.ToNumber(x) >> 0; }, ToUint32: function ToUint32(x) { return this.ToNumber(x) >>> 0; }, ToUint16: function ToUint16(value) { var number = this.ToNumber(value); if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } var posInt = sign(number) * Math.floor(Math.abs(number)); return mod(posInt, 0x10000); }, ToString: function ToString(value) { return $String(value); }, ToObject: function ToObject(value) { this.CheckObjectCoercible(value); return $Object(value); }, CheckObjectCoercible: function CheckObjectCoercible(value, optMessage) { /* jshint eqnull:true */ if (value == null) { throw new $TypeError(optMessage || 'Cannot call method on ' + value); } return value; }, IsCallable: IsCallable, SameValue: function SameValue(x, y) { if (x === y) { // 0 === -0, but they are not identical. if (x === 0) { return 1 / x === 1 / y; } return true; } return $isNaN(x) && $isNaN(y); }, // https://www.ecma-international.org/ecma-262/5.1/#sec-8 Type: function Type(x) { if (x === null) { return 'Null'; } if (typeof x === 'undefined') { return 'Undefined'; } if (typeof x === 'function' || typeof x === 'object') { return 'Object'; } if (typeof x === 'number') { return 'Number'; } if (typeof x === 'boolean') { return 'Boolean'; } if (typeof x === 'string') { return 'String'; } }, // https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type IsPropertyDescriptor: function IsPropertyDescriptor(Desc) { if (this.Type(Desc) !== 'Object') { return false; } var allowed = { '[[Configurable]]': true, '[[Enumerable]]': true, '[[Get]]': true, '[[Set]]': true, '[[Value]]': true, '[[Writable]]': true }; for (var key in Desc) { // eslint-disable-line if (has(Desc, key) && !allowed[key]) { return false; } } var isData = has(Desc, '[[Value]]'); var IsAccessor = has(Desc, '[[Get]]') || has(Desc, '[[Set]]'); if (isData && IsAccessor) { throw new $TypeError('Property Descriptors may not be both accessor and data descriptors'); } return true; }, // https://ecma-international.org/ecma-262/5.1/#sec-8.10.1 IsAccessorDescriptor: function IsAccessorDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(this, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) { return false; } return true; }, // https://ecma-international.org/ecma-262/5.1/#sec-8.10.2 IsDataDescriptor: function IsDataDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(this, 'Property Descriptor', 'Desc', Desc); if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { return false; } return true; }, // https://ecma-international.org/ecma-262/5.1/#sec-8.10.3 IsGenericDescriptor: function IsGenericDescriptor(Desc) { if (typeof Desc === 'undefined') { return false; } assertRecord(this, 'Property Descriptor', 'Desc', Desc); if (!this.IsAccessorDescriptor(Desc) && !this.IsDataDescriptor(Desc)) { return true; } return false; }, // https://ecma-international.org/ecma-262/5.1/#sec-8.10.4 FromPropertyDescriptor: function FromPropertyDescriptor(Desc) { if (typeof Desc === 'undefined') { return Desc; } assertRecord(this, 'Property Descriptor', 'Desc', Desc); if (this.IsDataDescriptor(Desc)) { return { value: Desc['[[Value]]'], writable: !!Desc['[[Writable]]'], enumerable: !!Desc['[[Enumerable]]'], configurable: !!Desc['[[Configurable]]'] }; } else if (this.IsAccessorDescriptor(Desc)) { return { get: Desc['[[Get]]'], set: Desc['[[Set]]'], enumerable: !!Desc['[[Enumerable]]'], configurable: !!Desc['[[Configurable]]'] }; } else { throw new $TypeError('FromPropertyDescriptor must be called with a fully populated Property Descriptor'); } }, // https://ecma-international.org/ecma-262/5.1/#sec-8.10.5 ToPropertyDescriptor: function ToPropertyDescriptor(Obj) { if (this.Type(Obj) !== 'Object') { throw new $TypeError('ToPropertyDescriptor requires an object'); } var desc = {}; if (has(Obj, 'enumerable')) { desc['[[Enumerable]]'] = this.ToBoolean(Obj.enumerable); } if (has(Obj, 'configurable')) { desc['[[Configurable]]'] = this.ToBoolean(Obj.configurable); } if (has(Obj, 'value')) { desc['[[Value]]'] = Obj.value; } if (has(Obj, 'writable')) { desc['[[Writable]]'] = this.ToBoolean(Obj.writable); } if (has(Obj, 'get')) { var getter = Obj.get; if (typeof getter !== 'undefined' && !this.IsCallable(getter)) { throw new TypeError('getter must be a function'); } desc['[[Get]]'] = getter; } if (has(Obj, 'set')) { var setter = Obj.set; if (typeof setter !== 'undefined' && !this.IsCallable(setter)) { throw new $TypeError('setter must be a function'); } desc['[[Set]]'] = setter; } if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) { throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute'); } return desc; } }; module.exports = ES5; },{"./GetIntrinsic":11,"./helpers/assertRecord":13,"./helpers/isFinite":14,"./helpers/isNaN":15,"./helpers/mod":16,"./helpers/sign":17,"es-to-primitive/es5":18,"has":24,"is-callable":28}],13:[function(require,module,exports){ 'use strict'; var GetIntrinsic = require('../GetIntrinsic'); var $TypeError = GetIntrinsic('%TypeError%'); var $SyntaxError = GetIntrinsic('%SyntaxError%'); var has = require('has'); var predicates = { // https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type 'Property Descriptor': function isPropertyDescriptor(ES, Desc) { if (ES.Type(Desc) !== 'Object') { return false; } var allowed = { '[[Configurable]]': true, '[[Enumerable]]': true, '[[Get]]': true, '[[Set]]': true, '[[Value]]': true, '[[Writable]]': true }; for (var key in Desc) { // eslint-disable-line if (has(Desc, key) && !allowed[key]) { return false; } } var isData = has(Desc, '[[Value]]'); var IsAccessor = has(Desc, '[[Get]]') || has(Desc, '[[Set]]'); if (isData && IsAccessor) { throw new $TypeError('Property Descriptors may not be both accessor and data descriptors'); } return true; } }; module.exports = function assertRecord(ES, recordType, argumentName, value) { var predicate = predicates[recordType]; if (typeof predicate !== 'function') { throw new $SyntaxError('unknown record type: ' + recordType); } if (!predicate(ES, value)) { throw new $TypeError(argumentName + ' must be a ' + recordType); } console.log(predicate(ES, value), value); }; },{"../GetIntrinsic":11,"has":24}],14:[function(require,module,exports){ var $isNaN = Number.isNaN || function (a) { return a !== a; }; module.exports = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; }; },{}],15:[function(require,module,exports){ module.exports = Number.isNaN || function isNaN(a) { return a !== a; }; },{}],16:[function(require,module,exports){ module.exports = function mod(number, modulo) { var remain = number % modulo; return Math.floor(remain >= 0 ? remain : remain + modulo); }; },{}],17:[function(require,module,exports){ module.exports = function sign(number) { return number >= 0 ? 1 : -1; }; },{}],18:[function(require,module,exports){ 'use strict'; var toStr = Object.prototype.toString; var isPrimitive = require('./helpers/isPrimitive'); var isCallable = require('is-callable'); // http://ecma-international.org/ecma-262/5.1/#sec-8.12.8 var ES5internalSlots = { '[[DefaultValue]]': function (O) { var actualHint; if (arguments.length > 1) { actualHint = arguments[1]; } else { actualHint = toStr.call(O) === '[object Date]' ? String : Number; } if (actualHint === String || actualHint === Number) { var methods = actualHint === String ? ['toString', 'valueOf'] : ['valueOf', 'toString']; var value, i; for (i = 0; i < methods.length; ++i) { if (isCallable(O[methods[i]])) { value = O[methods[i]](); if (isPrimitive(value)) { return value; } } } throw new TypeError('No default value'); } throw new TypeError('invalid [[DefaultValue]] hint supplied'); } }; // http://ecma-international.org/ecma-262/5.1/#sec-9.1 module.exports = function ToPrimitive(input) { if (isPrimitive(input)) { return input; } if (arguments.length > 1) { return ES5internalSlots['[[DefaultValue]]'](input, arguments[1]); } return ES5internalSlots['[[DefaultValue]]'](input); }; },{"./helpers/isPrimitive":19,"is-callable":28}],19:[function(require,module,exports){ module.exports = function isPrimitive(value) { return value === null || (typeof value !== 'function' && typeof value !== 'object'); }; },{}],20:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. var objectCreate = Object.create || objectCreatePolyfill var objectKeys = Object.keys || objectKeysPolyfill var bind = Function.prototype.bind || functionBindPolyfill function EventEmitter() { if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) { this._events = objectCreate(null); this._eventsCount = 0; } this._maxListeners = this._maxListeners || undefined; } module.exports = EventEmitter; // Backwards-compat with node 0.10.x EventEmitter.EventEmitter = EventEmitter; EventEmitter.prototype._events = undefined; EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are // added to it. This is a useful default which helps finding memory leaks. var defaultMaxListeners = 10; var hasDefineProperty; try { var o = {}; if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 }); hasDefineProperty = o.x === 0; } catch (err) { hasDefineProperty = false } if (hasDefineProperty) { Object.defineProperty(EventEmitter, 'defaultMaxListeners', { enumerable: true, get: function() { return defaultMaxListeners; }, set: function(arg) { // check whether the input is a positive number (whose value is zero or // greater and not a NaN). if (typeof arg !== 'number' || arg < 0 || arg !== arg) throw new TypeError('"defaultMaxListeners" must be a positive number'); defaultMaxListeners = arg; } }); } else { EventEmitter.defaultMaxListeners = defaultMaxListeners; } // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { if (typeof n !== 'number' || n < 0 || isNaN(n)) throw new TypeError('"n" argument must be a positive number'); this._maxListeners = n; return this; }; function $getMaxListeners(that) { if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners; return that._maxListeners; } EventEmitter.prototype.getMaxListeners = function getMaxListeners() { return $getMaxListeners(this); }; // These standalone emit* functions are used to optimize calling of event // handlers for fast cases because emit() itself often has a variable number of // arguments and can be deoptimized because of that. These functions always have // the same number of arguments and thus do not get deoptimized, so the code // inside them can execute faster. function emitNone(handler, isFn, self) { if (isFn) handler.call(self); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self); } } function emitOne(handler, isFn, self, arg1) { if (isFn) handler.call(self, arg1); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self, arg1); } } function emitTwo(handler, isFn, self, arg1, arg2) { if (isFn) handler.call(self, arg1, arg2); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self, arg1, arg2); } } function emitThree(handler, isFn, self, arg1, arg2, arg3) { if (isFn) handler.call(self, arg1, arg2, arg3); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].call(self, arg1, arg2, arg3); } } function emitMany(handler, isFn, self, args) { if (isFn) handler.apply(self, args); else { var len = handler.length; var listeners = arrayClone(handler, len); for (var i = 0; i < len; ++i) listeners[i].apply(self, args); } } EventEmitter.prototype.emit = function emit(type) { var er, handler, len, args, i, events; var doError = (type === 'error'); events = this._events; if (events) doError = (doError && events.error == null); else if (!doError) return false; // If there is no 'error' event listener then throw. if (doError) { if (arguments.length > 1) er = arguments[1]; if (er instanceof Error) { throw er; // Unhandled 'error' event } else { // At least give some kind of context to the user var err = new Error('Unhandled "error" event. (' + er + ')'); err.context = er; throw err; } return false; } handler = events[type]; if (!handler) return false; var isFn = typeof handler === 'function'; len = arguments.length; switch (len) { // fast cases case 1: emitNone(handler, isFn, this); break; case 2: emitOne(handler, isFn, this, arguments[1]); break; case 3: emitTwo(handler, isFn, this, arguments[1], arguments[2]); break; case 4: emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); break; // slower default: args = new Array(len - 1); for (i = 1; i < len; i++) args[i - 1] = arguments[i]; emitMany(handler, isFn, this, args); } return true; }; function _addListener(target, type, listener, prepend) { var m; var events; var existing; if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function'); events = target._events; if (!events) { events = target._events = objectCreate(null); target._eventsCount = 0; } else { // To avoid recursion in the case that type === "newListener"! Before // adding it to the listeners, first emit "newListener". if (events.newListener) { target.emit('newListener', type, listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the // this._events to be assigned to a new object events = target._events; } existing = events[type]; } if (!existing) { // Optimize the case of one listener. Don't need the extra array object. existing = events[type] = listener; ++target._eventsCount; } else { if (typeof existing === 'function') { // Adding the second element, need to change to array. existing = events[type] = prepend ? [listener, existing] : [existing, listener]; } else { // If we've already got an array, just append. if (prepend) { existing.unshift(listener); } else { existing.push(listener); } } // Check for listener leak if (!existing.warned) { m = $getMaxListeners(target); if (m && m > 0 && existing.length > m) { existing.warned = true; var w = new Error('Possible EventEmitter memory leak detected. ' + existing.length + ' "' + String(type) + '" listeners ' + 'added. Use emitter.setMaxListeners() to ' + 'increase limit.'); w.name = 'MaxListenersExceededWarning'; w.emitter = target; w.type = type; w.count = existing.length; if (typeof console === 'object' && console.warn) { console.warn('%s: %s', w.name, w.message); } } } } return target; } EventEmitter.prototype.addListener = function addListener(type, listener) { return _addListener(this, type, listener, false); }; EventEmitter.prototype.on = EventEmitter.prototype.addListener; EventEmitter.prototype.prependListener = function prependListener(type, listener) { return _addListener(this, type, listener, true); }; function onceWrapper() { if (!this.fired) { this.target.removeListener(this.type, this.wrapFn); this.fired = true; switch (arguments.length) { case 0: return this.listener.call(this.target); case 1: return this.listener.call(this.target, arguments[0]); case 2: return this.listener.call(this.target, arguments[0], arguments[1]); case 3: return this.listener.call(this.target, arguments[0], arguments[1], arguments[2]); default: var args = new Array(arguments.length); for (var i = 0; i < args.length; ++i) args[i] = arguments[i]; this.listener.apply(this.target, args); } } } function _onceWrap(target, type, listener) { var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; var wrapped = bind.call(onceWrapper, state); wrapped.listener = listener; state.wrapFn = wrapped; return wrapped; } EventEmitter.prototype.once = function once(type, listener) { if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function'); this.on(type, _onceWrap(this, type, listener)); return this; }; EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function'); this.prependListener(type, _onceWrap(this, type, listener)); return this; }; // Emits a 'removeListener' event if and only if the listener was removed. EventEmitter.prototype.removeListener = function removeListener(type, listener) { var list, events, position, i, originalListener; if (typeof listener !== 'function') throw new TypeError('"listener" argument must be a function'); events = this._events; if (!events) return this; list = events[type]; if (!list) return this; if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) this._events = objectCreate(null); else { delete events[type]; if (events.removeListener) this.emit('removeListener', type, list.listener || listener); } } else if (typeof list !== 'function') { position = -1; for (i = list.length - 1; i >= 0; i--) { if (list[i] === listener || list[i].listener === listener) { originalListener = list[i].listener; position = i; break; } } if (position < 0) return this; if (position === 0) list.shift(); else spliceOne(list, position); if (list.length === 1) events[type] = list[0]; if (events.removeListener) this.emit('removeListener', type, originalListener || listener); } return this; }; EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { var listeners, events, i; events = this._events; if (!events) return this; // not listening for removeListener, no need to emit if (!events.removeListener) { if (arguments.length === 0) { this._events = objectCreate(null); this._eventsCount = 0; } else if (events[type]) { if (--this._eventsCount === 0) this._events = objectCreate(null); else delete events[type]; } return this; } // emit removeListener for all listeners on all events if (arguments.length === 0) { var keys = objectKeys(events); var key; for (i = 0; i < keys.length; ++i) { key = keys[i]; if (key === 'removeListener') continue; this.removeAllListeners(key); } this.removeAllListeners('removeListener'); this._events = objectCreate(null); this._eventsCount = 0; return this; } listeners = events[type]; if (typeof listeners === 'function') { this.removeListener(type, listeners); } else if (listeners) { // LIFO order for (i = listeners.length - 1; i >= 0; i--) { this.removeListener(type, listeners[i]); } } return this; }; function _listeners(target, type, unwrap) { var events = target._events; if (!events) return []; var evlistener = events[type]; if (!evlistener) return []; if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); } EventEmitter.prototype.listeners = function listeners(type) { return _listeners(this, type, true); }; EventEmitter.prototype.rawListeners = function rawListeners(type) { return _listeners(this, type, false); }; EventEmitter.listenerCount = function(emitter, type) { if (typeof emitter.listenerCount === 'function') { return emitter.listenerCount(type); } else { return listenerCount.call(emitter, type); } }; EventEmitter.prototype.listenerCount = listenerCount; function listenerCount(type) { var events = this._events; if (events) { var evlistener = events[type]; if (typeof evlistener === 'function') { return 1; } else if (evlistener) { return evlistener.length; } } return 0; } EventEmitter.prototype.eventNames = function eventNames() { return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; }; // About 1.5x faster than the two-arg version of Array#splice(). function spliceOne(list, index) { for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) list[i] = list[k]; list.pop(); } function arrayClone(arr, n) { var copy = new Array(n); for (var i = 0; i < n; ++i) copy[i] = arr[i]; return copy; } function unwrapListeners(arr) { var ret = new Array(arr.length); for (var i = 0; i < ret.length; ++i) { ret[i] = arr[i].listener || arr[i]; } return ret; } function objectCreatePolyfill(proto) { var F = function() {}; F.prototype = proto; return new F; } function objectKeysPolyfill(obj) { var keys = []; for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { keys.push(k); } return k; } function functionBindPolyfill(context) { var fn = this; return function () { return fn.apply(context, arguments); }; } },{}],21:[function(require,module,exports){ 'use strict'; var isCallable = require('is-callable'); var toStr = Object.prototype.toString; var hasOwnProperty = Object.prototype.hasOwnProperty; var forEachArray = function forEachArray(array, iterator, receiver) { for (var i = 0, len = array.length; i < len; i++) { if (hasOwnProperty.call(array, i)) { if (receiver == null) { iterator(array[i], i, array); } else { iterator.call(receiver, array[i], i, array); } } } }; var forEachString = function forEachString(string, iterator, receiver) { for (var i = 0, len = string.length; i < len; i++) { // no such thing as a sparse string. if (receiver == null) { iterator(string.charAt(i), i, string); } else { iterator.call(receiver, string.charAt(i), i, string); } } }; var forEachObject = function forEachObject(object, iterator, receiver) { for (var k in object) { if (hasOwnProperty.call(object, k)) { if (receiver == null) { iterator(object[k], k, object); } else { iterator.call(receiver, object[k], k, object); } } } }; var forEach = function forEach(list, iterator, thisArg) { if (!isCallable(iterator)) { throw new TypeError('iterator must be a function'); } var receiver; if (arguments.length >= 3) { receiver = thisArg; } if (toStr.call(list) === '[object Array]') { forEachArray(list, iterator, receiver); } else if (typeof list === 'string') { forEachString(list, iterator, receiver); } else { forEachObject(list, iterator, receiver); } }; module.exports = forEach; },{"is-callable":28}],22:[function(require,module,exports){ 'use strict'; /* eslint no-invalid-this: 1 */ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; var slice = Array.prototype.slice; var toStr = Object.prototype.toString; var funcType = '[object Function]'; module.exports = function bind(that) { var target = this; if (typeof target !== 'function' || toStr.call(target) !== funcType) { throw new TypeError(ERROR_MESSAGE + target); } var args = slice.call(arguments, 1); var bound; var binder = function () { if (this instanceof bound) { var result = target.apply( this, args.concat(slice.call(arguments)) ); if (Object(result) === result) { return result; } return this; } else { return target.apply( that, args.concat(slice.call(arguments)) ); } }; var boundLength = Math.max(0, target.length - args.length); var boundArgs = []; for (var i = 0; i < boundLength; i++) { boundArgs.push('$' + i); } bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); if (target.prototype) { var Empty = function Empty() {}; Empty.prototype = target.prototype; bound.prototype = new Empty(); Empty.prototype = null; } return bound; }; },{}],23:[function(require,module,exports){ 'use strict'; var implementation = require('./implementation'); module.exports = Function.prototype.bind || implementation; },{"./implementation":22}],24:[function(require,module,exports){ 'use strict'; var bind = require('function-bind'); module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); },{"function-bind":23}],25:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var nBits = -7 var i = isLE ? (nBytes - 1) : 0 var d = isLE ? -1 : 1 var s = buffer[offset + i] i += d e = s & ((1 << (-nBits)) - 1) s >>= (-nBits) nBits += eLen for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} m = e & ((1 << (-nBits)) - 1) e >>= (-nBits) nBits += mLen for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} if (e === 0) { e = 1 - eBias } else if (e === eMax) { return m ? NaN : ((s ? -1 : 1) * Infinity) } else { m = m + Math.pow(2, mLen) e = e - eBias } return (s ? -1 : 1) * m * Math.pow(2, e - mLen) } exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { var e, m, c var eLen = (nBytes * 8) - mLen - 1 var eMax = (1 << eLen) - 1 var eBias = eMax >> 1 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) var i = isLE ? 0 : (nBytes - 1) var d = isLE ? 1 : -1 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 value = Math.abs(value) if (isNaN(value) || value === Infinity) { m = isNaN(value) ? 1 : 0 e = eMax } else { e = Math.floor(Math.log(value) / Math.LN2) if (value * (c = Math.pow(2, -e)) < 1) { e-- c *= 2 } if (e + eBias >= 1) { value += rt / c } else { value += rt * Math.pow(2, 1 - eBias) } if (value * c >= 2) { e++ c /= 2 } if (e + eBias >= eMax) { m = 0 e = eMax } else if (e + eBias >= 1) { m = ((value * c) - 1) * Math.pow(2, mLen) e = e + eBias } else { m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) e = 0 } } for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} e = (e << mLen) | m eLen += mLen for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} buffer[offset + i - d] |= s * 128 } },{}],26:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { ctor.super_ = superCtor ctor.prototype = Object.create(superCtor.prototype, { constructor: { value: ctor, enumerable: false, writable: true, configurable: true } }); }; } else { // old school shim for old browsers module.exports = function inherits(ctor, superCtor) { ctor.super_ = superCtor var TempCtor = function () {} TempCtor.prototype = superCtor.prototype ctor.prototype = new TempCtor() ctor.prototype.constructor = ctor } } },{}],27:[function(require,module,exports){ /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT */ // The _isBuffer check is for Safari 5-7 support, because it's missing // Object.prototype.constructor. Remove this eventually module.exports = function (obj) { return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) } function isBuffer (obj) { return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) } // For Node v0.10 support. Remove this eventually. function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } },{}],28:[function(require,module,exports){ 'use strict'; var fnToStr = Function.prototype.toString; var constructorRegex = /^\s*class\b/; var isES6ClassFn = function isES6ClassFunction(value) { try { var fnStr = fnToStr.call(value); return constructorRegex.test(fnStr); } catch (e) { return false; // not a function } }; var tryFunctionObject = function tryFunctionToStr(value) { try { if (isES6ClassFn(value)) { return false; } fnToStr.call(value); return true; } catch (e) { return false; } }; var toStr = Object.prototype.toString; var fnClass = '[object Function]'; var genClass = '[object GeneratorFunction]'; var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; module.exports = function isCallable(value) { if (!value) { return false; } if (typeof value !== 'function' && typeof value !== 'object') { return false; } if (typeof value === 'function' && !value.prototype) { return true; } if (hasToStringTag) { return tryFunctionObject(value); } if (isES6ClassFn(value)) { return false; } var strClass = toStr.call(value); return strClass === fnClass || strClass === genClass; }; },{}],29:[function(require,module,exports){ var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; },{}],30:[function(require,module,exports){ var hasMap = typeof Map === 'function' && Map.prototype; var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null; var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null; var mapForEach = hasMap && Map.prototype.forEach; var hasSet = typeof Set === 'function' && Set.prototype; var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null; var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null; var setForEach = hasSet && Set.prototype.forEach; var booleanValueOf = Boolean.prototype.valueOf; var objectToString = Object.prototype.toString; var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null; var inspectCustom = require('./util.inspect').custom; var inspectSymbol = (inspectCustom && isSymbol(inspectCustom)) ? inspectCustom : null; module.exports = function inspect_ (obj, opts, depth, seen) { if (!opts) opts = {}; if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) { throw new TypeError('option "quoteStyle" must be "single" or "double"'); } if (typeof obj === 'undefined') { return 'undefined'; } if (obj === null) { return 'null'; } if (typeof obj === 'boolean') { return obj ? 'true' : 'false'; } if (typeof obj === 'string') { return inspectString(obj, opts); } if (typeof obj === 'number') { if (obj === 0) { return Infinity / obj > 0 ? '0' : '-0'; } return String(obj); } if (typeof obj === 'bigint') { return String(obj) + 'n'; } var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth; if (typeof depth === 'undefined') depth = 0; if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') { return '[Object]'; } if (typeof seen === 'undefined') seen = []; else if (indexOf(seen, obj) >= 0) { return '[Circular]'; } function inspect (value, from) { if (from) { seen = seen.slice(); seen.push(from); } return inspect_(value, opts, depth + 1, seen); } if (typeof obj === 'function') { var name = nameOf(obj); return '[Function' + (name ? ': ' + name : '') + ']'; } if (isSymbol(obj)) { var symString = Symbol.prototype.toString.call(obj); return typeof obj === 'object' ? markBoxed(symString) : symString; } if (isElement(obj)) { var s = '<' + String(obj.nodeName).toLowerCase(); var attrs = obj.attributes || []; for (var i = 0; i < attrs.length; i++) { s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts); } s += '>'; if (obj.childNodes && obj.childNodes.length) s += '...'; s += ''; return s; } if (isArray(obj)) { if (obj.length === 0) return '[]'; return '[ ' + arrObjKeys(obj, inspect).join(', ') + ' ]'; } if (isError(obj)) { var parts = arrObjKeys(obj, inspect); if (parts.length === 0) return '[' + String(obj) + ']'; return '{ [' + String(obj) + '] ' + parts.join(', ') + ' }'; } if (typeof obj === 'object') { if (inspectSymbol && typeof obj[inspectSymbol] === 'function') { return obj[inspectSymbol](); } else if (typeof obj.inspect === 'function') { return obj.inspect(); } } if (isMap(obj)) { var parts = []; mapForEach.call(obj, function (value, key) { parts.push(inspect(key, obj) + ' => ' + inspect(value, obj)); }); return collectionOf('Map', mapSize.call(obj), parts); } if (isSet(obj)) { var parts = []; setForEach.call(obj, function (value ) { parts.push(inspect(value, obj)); }); return collectionOf('Set', setSize.call(obj), parts); } if (isNumber(obj)) { return markBoxed(inspect(Number(obj))); } if (isBigInt(obj)) { return markBoxed(inspect(bigIntValueOf.call(obj))); } if (isBoolean(obj)) { return markBoxed(booleanValueOf.call(obj)); } if (isString(obj)) { return markBoxed(inspect(String(obj))); } if (!isDate(obj) && !isRegExp(obj)) { var xs = arrObjKeys(obj, inspect); if (xs.length === 0) return '{}'; return '{ ' + xs.join(', ') + ' }'; } return String(obj); }; function wrapQuotes (s, defaultStyle, opts) { var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'"; return quoteChar + s + quoteChar; } function quote (s) { return String(s).replace(/"/g, '"'); } function isArray (obj) { return toStr(obj) === '[object Array]'; } function isDate (obj) { return toStr(obj) === '[object Date]'; } function isRegExp (obj) { return toStr(obj) === '[object RegExp]'; } function isError (obj) { return toStr(obj) === '[object Error]'; } function isSymbol (obj) { return toStr(obj) === '[object Symbol]'; } function isString (obj) { return toStr(obj) === '[object String]'; } function isNumber (obj) { return toStr(obj) === '[object Number]'; } function isBigInt (obj) { return toStr(obj) === '[object BigInt]'; } function isBoolean (obj) { return toStr(obj) === '[object Boolean]'; } var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; }; function has (obj, key) { return hasOwn.call(obj, key); } function toStr (obj) { return objectToString.call(obj); } function nameOf (f) { if (f.name) return f.name; var m = String(f).match(/^function\s*([\w$]+)/); if (m) return m[1]; } function indexOf (xs, x) { if (xs.indexOf) return xs.indexOf(x); for (var i = 0, l = xs.length; i < l; i++) { if (xs[i] === x) return i; } return -1; } function isMap (x) { if (!mapSize) { return false; } try { mapSize.call(x); try { setSize.call(x); } catch (s) { return true; } return x instanceof Map; // core-js workaround, pre-v2.5.0 } catch (e) {} return false; } function isSet (x) { if (!setSize) { return false; } try { setSize.call(x); try { mapSize.call(x); } catch (m) { return true; } return x instanceof Set; // core-js workaround, pre-v2.5.0 } catch (e) {} return false; } function isElement (x) { if (!x || typeof x !== 'object') return false; if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) { return true; } return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function' ; } function inspectString (str, opts) { var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte); return wrapQuotes(s, 'single', opts); } function lowbyte (c) { var n = c.charCodeAt(0); var x = { 8: 'b', 9: 't', 10: 'n', 12: 'f', 13: 'r' }[n]; if (x) return '\\' + x; return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16); } function markBoxed (str) { return 'Object(' + str + ')'; } function collectionOf (type, size, entries) { return type + ' (' + size + ') {' + entries.join(', ') + '}'; } function arrObjKeys (obj, inspect) { var isArr = isArray(obj); var xs = []; if (isArr) { xs.length = obj.length; for (var i = 0; i < obj.length; i++) { xs[i] = has(obj, i) ? inspect(obj[i], obj) : ''; } } for (var key in obj) { if (!has(obj, key)) continue; if (isArr && String(Number(key)) === key && key < obj.length) continue; if (/[^\w$]/.test(key)) { xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj)); } else { xs.push(key + ': ' + inspect(obj[key], obj)); } } return xs; } },{"./util.inspect":2}],31:[function(require,module,exports){ 'use strict'; var keysShim; if (!Object.keys) { // modified from https://github.com/es-shims/es5-shim var has = Object.prototype.hasOwnProperty; var toStr = Object.prototype.toString; var isArgs = require('./isArguments'); // eslint-disable-line global-require var isEnumerable = Object.prototype.propertyIsEnumerable; var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); var dontEnums = [ 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor' ]; var equalsConstructorPrototype = function (o) { var ctor = o.constructor; return ctor && ctor.prototype === o; }; var excludedKeys = { $applicationCache: true, $console: true, $external: true, $frame: true, $frameElement: true, $frames: true, $innerHeight: true, $innerWidth: true, $outerHeight: true, $outerWidth: true, $pageXOffset: true, $pageYOffset: true, $parent: true, $scrollLeft: true, $scrollTop: true, $scrollX: true, $scrollY: true, $self: true, $webkitIndexedDB: true, $webkitStorageInfo: true, $window: true }; var hasAutomationEqualityBug = (function () { /* global window */ if (typeof window === 'undefined') { return false; } for (var k in window) { try { if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { try { equalsConstructorPrototype(window[k]); } catch (e) { return true; } } } catch (e) { return true; } } return false; }()); var equalsConstructorPrototypeIfNotBuggy = function (o) { /* global window */ if (typeof window === 'undefined' || !hasAutomationEqualityBug) { return equalsConstructorPrototype(o); } try { return equalsConstructorPrototype(o); } catch (e) { return false; } }; keysShim = function keys(object) { var isObject = object !== null && typeof object === 'object'; var isFunction = toStr.call(object) === '[object Function]'; var isArguments = isArgs(object); var isString = isObject && toStr.call(object) === '[object String]'; var theKeys = []; if (!isObject && !isFunction && !isArguments) { throw new TypeError('Object.keys called on a non-object'); } var skipProto = hasProtoEnumBug && isFunction; if (isString && object.length > 0 && !has.call(object, 0)) { for (var i = 0; i < object.length; ++i) { theKeys.push(String(i)); } } if (isArguments && object.length > 0) { for (var j = 0; j < object.length; ++j) { theKeys.push(String(j)); } } else { for (var name in object) { if (!(skipProto && name === 'prototype') && has.call(object, name)) { theKeys.push(String(name)); } } } if (hasDontEnumBug) { var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); for (var k = 0; k < dontEnums.length; ++k) { if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { theKeys.push(dontEnums[k]); } } } return theKeys; }; } module.exports = keysShim; },{"./isArguments":33}],32:[function(require,module,exports){ 'use strict'; var slice = Array.prototype.slice; var isArgs = require('./isArguments'); var origKeys = Object.keys; var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation'); var originalKeys = Object.keys; keysShim.shim = function shimObjectKeys() { if (Object.keys) { var keysWorksWithArguments = (function () { // Safari 5.0 bug var args = Object.keys(arguments); return args && args.length === arguments.length; }(1, 2)); if (!keysWorksWithArguments) { Object.keys = function keys(object) { // eslint-disable-line func-name-matching if (isArgs(object)) { return originalKeys(slice.call(object)); } return originalKeys(object); }; } } else { Object.keys = keysShim; } return Object.keys || keysShim; }; module.exports = keysShim; },{"./implementation":31,"./isArguments":33}],33:[function(require,module,exports){ 'use strict'; var toStr = Object.prototype.toString; module.exports = function isArguments(value) { var str = toStr.call(value); var isArgs = str === '[object Arguments]'; if (!isArgs) { isArgs = str !== '[object Array]' && value !== null && typeof value === 'object' && typeof value.length === 'number' && value.length >= 0 && toStr.call(value.callee) === '[object Function]'; } return isArgs; }; },{}],34:[function(require,module,exports){ (function (process){ // .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1, // backported and transplited with Babel, with backwards-compat fixes // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // resolves . and .. elements in a path array with directory names there // must be no slashes, empty elements, or device names (c:\) in the array // (so also no leading and trailing slashes - it does not distinguish // relative and absolute paths) function normalizeArray(parts, allowAboveRoot) { // if the path tries to go above the root, `up` ends up > 0 var up = 0; for (var i = parts.length - 1; i >= 0; i--) { var last = parts[i]; if (last === '.') { parts.splice(i, 1); } else if (last === '..') { parts.splice(i, 1); up++; } else if (up) { parts.splice(i, 1); up--; } } // if the path is allowed to go above the root, restore leading ..s if (allowAboveRoot) { for (; up--; up) { parts.unshift('..'); } } return parts; } // path.resolve([from ...], to) // posix version exports.resolve = function() { var resolvedPath = '', resolvedAbsolute = false; for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { var path = (i >= 0) ? arguments[i] : process.cwd(); // Skip empty and invalid entries if (typeof path !== 'string') { throw new TypeError('Arguments to path.resolve must be strings'); } else if (!path) { continue; } resolvedPath = path + '/' + resolvedPath; resolvedAbsolute = path.charAt(0) === '/'; } // At this point the path should be resolved to a full absolute path, but // handle relative paths to be safe (might happen when process.cwd() fails) // Normalize the path resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { return !!p; }), !resolvedAbsolute).join('/'); return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; }; // path.normalize(path) // posix version exports.normalize = function(path) { var isAbsolute = exports.isAbsolute(path), trailingSlash = substr(path, -1) === '/'; // Normalize the path path = normalizeArray(filter(path.split('/'), function(p) { return !!p; }), !isAbsolute).join('/'); if (!path && !isAbsolute) { path = '.'; } if (path && trailingSlash) { path += '/'; } return (isAbsolute ? '/' : '') + path; }; // posix version exports.isAbsolute = function(path) { return path.charAt(0) === '/'; }; // posix version exports.join = function() { var paths = Array.prototype.slice.call(arguments, 0); return exports.normalize(filter(paths, function(p, index) { if (typeof p !== 'string') { throw new TypeError('Arguments to path.join must be strings'); } return p; }).join('/')); }; // path.relative(from, to) // posix version exports.relative = function(from, to) { from = exports.resolve(from).substr(1); to = exports.resolve(to).substr(1); function trim(arr) { var start = 0; for (; start < arr.length; start++) { if (arr[start] !== '') break; } var end = arr.length - 1; for (; end >= 0; end--) { if (arr[end] !== '') break; } if (start > end) return []; return arr.slice(start, end - start + 1); } var fromParts = trim(from.split('/')); var toParts = trim(to.split('/')); var length = Math.min(fromParts.length, toParts.length); var samePartsLength = length; for (var i = 0; i < length; i++) { if (fromParts[i] !== toParts[i]) { samePartsLength = i; break; } } var outputParts = []; for (var i = samePartsLength; i < fromParts.length; i++) { outputParts.push('..'); } outputParts = outputParts.concat(toParts.slice(samePartsLength)); return outputParts.join('/'); }; exports.sep = '/'; exports.delimiter = ':'; exports.dirname = function (path) { if (typeof path !== 'string') path = path + ''; if (path.length === 0) return '.'; var code = path.charCodeAt(0); var hasRoot = code === 47 /*/*/; var end = -1; var matchedSlash = true; for (var i = path.length - 1; i >= 1; --i) { code = path.charCodeAt(i); if (code === 47 /*/*/) { if (!matchedSlash) { end = i; break; } } else { // We saw the first non-path separator matchedSlash = false; } } if (end === -1) return hasRoot ? '/' : '.'; if (hasRoot && end === 1) { // return '//'; // Backwards-compat fix: return '/'; } return path.slice(0, end); }; function basename(path) { if (typeof path !== 'string') path = path + ''; var start = 0; var end = -1; var matchedSlash = true; var i; for (i = path.length - 1; i >= 0; --i) { if (path.charCodeAt(i) === 47 /*/*/) { // If we reached a path separator that was not part of a set of path // separators at the end of the string, stop now if (!matchedSlash) { start = i + 1; break; } } else if (end === -1) { // We saw the first non-path separator, mark this as the end of our // path component matchedSlash = false; end = i + 1; } } if (end === -1) return ''; return path.slice(start, end); } // Uses a mixed approach for backwards-compatibility, as ext behavior changed // in new Node.js versions, so only basename() above is backported here exports.basename = function (path, ext) { var f = basename(path); if (ext && f.substr(-1 * ext.length) === ext) { f = f.substr(0, f.length - ext.length); } return f; }; exports.extname = function (path) { if (typeof path !== 'string') path = path + ''; var startDot = -1; var startPart = 0; var end = -1; var matchedSlash = true; // Track the state of characters (if any) we see before our first dot and // after any path separator we find var preDotState = 0; for (var i = path.length - 1; i >= 0; --i) { var code = path.charCodeAt(i); if (code === 47 /*/*/) { // If we reached a path separator that was not part of a set of path // separators at the end of the string, stop now if (!matchedSlash) { startPart = i + 1; break; } continue; } if (end === -1) { // We saw the first non-path separator, mark this as the end of our // extension matchedSlash = false; end = i + 1; } if (code === 46 /*.*/) { // If this is our first dot, mark it as the start of our extension if (startDot === -1) startDot = i; else if (preDotState !== 1) preDotState = 1; } else if (startDot !== -1) { // We saw a non-dot and non-path separator before our dot, so we should // have a good chance at having a non-empty extension preDotState = -1; } } if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot preDotState === 0 || // The (right-most) trimmed path component is exactly '..' preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { return ''; } return path.slice(startDot, end); }; function filter (xs, f) { if (xs.filter) return xs.filter(f); var res = []; for (var i = 0; i < xs.length; i++) { if (f(xs[i], i, xs)) res.push(xs[i]); } return res; } // String.prototype.substr - negative index don't work in IE8 var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) { return str.substr(start, len) } : function (str, start, len) { if (start < 0) start = str.length + start; return str.substr(start, len); } ; }).call(this,require('_process')) },{"_process":36}],35:[function(require,module,exports){ (function (process){ 'use strict'; if (!process.version || process.version.indexOf('v0.') === 0 || process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { module.exports = { nextTick: nextTick }; } else { module.exports = process } function nextTick(fn, arg1, arg2, arg3) { if (typeof fn !== 'function') { throw new TypeError('"callback" argument must be a function'); } var len = arguments.length; var args, i; switch (len) { case 0: case 1: return process.nextTick(fn); case 2: return process.nextTick(function afterTickOne() { fn.call(null, arg1); }); case 3: return process.nextTick(function afterTickTwo() { fn.call(null, arg1, arg2); }); case 4: return process.nextTick(function afterTickThree() { fn.call(null, arg1, arg2, arg3); }); default: args = new Array(len - 1); i = 0; while (i < args.length) { args[i++] = arguments[i]; } return process.nextTick(function afterTick() { fn.apply(null, args); }); } } }).call(this,require('_process')) },{"_process":36}],36:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; },{}],37:[function(require,module,exports){ module.exports = require('./lib/_stream_duplex.js'); },{"./lib/_stream_duplex.js":38}],38:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // a duplex stream is just a stream that is both readable and writable. // Since JS doesn't have multiple prototypal inheritance, this class // prototypally inherits from Readable, and then parasitically from // Writable. 'use strict'; /**/ var pna = require('process-nextick-args'); /**/ /**/ var objectKeys = Object.keys || function (obj) { var keys = []; for (var key in obj) { keys.push(key); }return keys; }; /**/ module.exports = Duplex; /**/ var util = require('core-util-is'); util.inherits = require('inherits'); /**/ var Readable = require('./_stream_readable'); var Writable = require('./_stream_writable'); util.inherits(Duplex, Readable); { // avoid scope creep, the keys array can then be collected var keys = objectKeys(Writable.prototype); for (var v = 0; v < keys.length; v++) { var method = keys[v]; if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; } } function Duplex(options) { if (!(this instanceof Duplex)) return new Duplex(options); Readable.call(this, options); Writable.call(this, options); if (options && options.readable === false) this.readable = false; if (options && options.writable === false) this.writable = false; this.allowHalfOpen = true; if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; this.once('end', onend); } Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function () { return this._writableState.highWaterMark; } }); // the no-half-open enforcer function onend() { // if we allow half-open state, or if the writable side ended, // then we're ok. if (this.allowHalfOpen || this._writableState.ended) return; // no more data can be written. // But allow more writes to happen in this tick. pna.nextTick(onEndNT, this); } function onEndNT(self) { self.end(); } Object.defineProperty(Duplex.prototype, 'destroyed', { get: function () { if (this._readableState === undefined || this._writableState === undefined) { return false; } return this._readableState.destroyed && this._writableState.destroyed; }, set: function (value) { // we ignore the value if the stream // has not been initialized yet if (this._readableState === undefined || this._writableState === undefined) { return; } // backward compatibility, the user is explicitly // managing destroyed this._readableState.destroyed = value; this._writableState.destroyed = value; } }); Duplex.prototype._destroy = function (err, cb) { this.push(null); this.end(); pna.nextTick(cb, err); }; },{"./_stream_readable":40,"./_stream_writable":42,"core-util-is":5,"inherits":26,"process-nextick-args":35}],39:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // a passthrough stream. // basically just the most minimal sort of Transform stream. // Every written chunk gets output as-is. 'use strict'; module.exports = PassThrough; var Transform = require('./_stream_transform'); /**/ var util = require('core-util-is'); util.inherits = require('inherits'); /**/ util.inherits(PassThrough, Transform); function PassThrough(options) { if (!(this instanceof PassThrough)) return new PassThrough(options); Transform.call(this, options); } PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; },{"./_stream_transform":41,"core-util-is":5,"inherits":26}],40:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; /**/ var pna = require('process-nextick-args'); /**/ module.exports = Readable; /**/ var isArray = require('isarray'); /**/ /**/ var Duplex; /**/ Readable.ReadableState = ReadableState; /**/ var EE = require('events').EventEmitter; var EElistenerCount = function (emitter, type) { return emitter.listeners(type).length; }; /**/ /**/ var Stream = require('./internal/streams/stream'); /**/ /**/ var Buffer = require('safe-buffer').Buffer; var OurUint8Array = global.Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); } function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } /**/ /**/ var util = require('core-util-is'); util.inherits = require('inherits'); /**/ /**/ var debugUtil = require('util'); var debug = void 0; if (debugUtil && debugUtil.debuglog) { debug = debugUtil.debuglog('stream'); } else { debug = function () {}; } /**/ var BufferList = require('./internal/streams/BufferList'); var destroyImpl = require('./internal/streams/destroy'); var StringDecoder; util.inherits(Readable, Stream); var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; function prependListener(emitter, event, fn) { // Sadly this is not cacheable as some libraries bundle their own // event emitter implementation with them. if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any // userland ones. NEVER DO THIS. This is here only because this code needs // to continue to work with older versions of Node.js that do not include // the prependListener() method. The goal is to eventually remove this hack. if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; } function ReadableState(options, stream) { Duplex = Duplex || require('./_stream_duplex'); options = options || {}; // Duplex streams are both readable and writable, but share // the same options object. // However, some cases require setting options to different // values for the readable and the writable sides of the duplex stream. // These options can be provided separately as readableXXX and writableXXX. var isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to // make all the buffer merging and length checks go away this.objectMode = !!options.objectMode; if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer // Note: 0 is a valid value, means "don't call _read preemptively ever" var hwm = options.highWaterMark; var readableHwm = options.readableHighWaterMark; var defaultHwm = this.objectMode ? 16 : 16 * 1024; if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; // cast to ints. this.highWaterMark = Math.floor(this.highWaterMark); // A linked list is used to store data chunks instead of an array because the // linked list can remove elements from the beginning faster than // array.shift() this.buffer = new BufferList(); this.length = 0; this.pipes = null; this.pipesCount = 0; this.flowing = null; this.ended = false; this.endEmitted = false; this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted // immediately, or on a later tick. We set this to true at first, because // any actions that shouldn't happen until "later" should generally also // not happen before the first read call. this.sync = true; // whenever we return null, then we set a flag to say // that we're awaiting a 'readable' event emission. this.needReadable = false; this.emittedReadable = false; this.readableListening = false; this.resumeScheduled = false; // has it been destroyed this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string // encoding is 'binary' so we have to make this configurable. // Everything else in the universe uses 'utf8', though. this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled this.readingMore = false; this.decoder = null; this.encoding = null; if (options.encoding) { if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } } function Readable(options) { Duplex = Duplex || require('./_stream_duplex'); if (!(this instanceof Readable)) return new Readable(options); this._readableState = new ReadableState(options, this); // legacy this.readable = true; if (options) { if (typeof options.read === 'function') this._read = options.read; if (typeof options.destroy === 'function') this._destroy = options.destroy; } Stream.call(this); } Object.defineProperty(Readable.prototype, 'destroyed', { get: function () { if (this._readableState === undefined) { return false; } return this._readableState.destroyed; }, set: function (value) { // we ignore the value if the stream // has not been initialized yet if (!this._readableState) { return; } // backward compatibility, the user is explicitly // managing destroyed this._readableState.destroyed = value; } }); Readable.prototype.destroy = destroyImpl.destroy; Readable.prototype._undestroy = destroyImpl.undestroy; Readable.prototype._destroy = function (err, cb) { this.push(null); cb(err); }; // Manually shove something into the read() buffer. // This returns true if the highWaterMark has not been hit yet, // similar to how Writable.write() returns true if you should // write() some more. Readable.prototype.push = function (chunk, encoding) { var state = this._readableState; var skipChunkCheck; if (!state.objectMode) { if (typeof chunk === 'string') { encoding = encoding || state.defaultEncoding; if (encoding !== state.encoding) { chunk = Buffer.from(chunk, encoding); encoding = ''; } skipChunkCheck = true; } } else { skipChunkCheck = true; } return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); }; // Unshift should *always* be something directly out of read() Readable.prototype.unshift = function (chunk) { return readableAddChunk(this, chunk, null, true, false); }; function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { var state = stream._readableState; if (chunk === null) { state.reading = false; onEofChunk(stream, state); } else { var er; if (!skipChunkCheck) er = chunkInvalid(state, chunk); if (er) { stream.emit('error', er); } else if (state.objectMode || chunk && chunk.length > 0) { if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { chunk = _uint8ArrayToBuffer(chunk); } if (addToFront) { if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); } else if (state.ended) { stream.emit('error', new Error('stream.push() after EOF')); } else { state.reading = false; if (state.decoder && !encoding) { chunk = state.decoder.write(chunk); if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); } else { addChunk(stream, state, chunk, false); } } } else if (!addToFront) { state.reading = false; } } return needMoreData(state); } function addChunk(stream, state, chunk, addToFront) { if (state.flowing && state.length === 0 && !state.sync) { stream.emit('data', chunk); stream.read(0); } else { // update the buffer info. state.length += state.objectMode ? 1 : chunk.length; if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); if (state.needReadable) emitReadable(stream); } maybeReadMore(stream, state); } function chunkInvalid(state, chunk) { var er; if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { er = new TypeError('Invalid non-string/buffer chunk'); } return er; } // if it's past the high water mark, we can push in some more. // Also, if we have no data yet, we can stand some // more bytes. This is to work around cases where hwm=0, // such as the repl. Also, if the push() triggered a // readable event, and the user called read(largeNumber) such that // needReadable was set, then we ought to push more, so that another // 'readable' event will be triggered. function needMoreData(state) { return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); } Readable.prototype.isPaused = function () { return this._readableState.flowing === false; }; // backwards compatibility. Readable.prototype.setEncoding = function (enc) { if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; }; // Don't raise the hwm > 8MB var MAX_HWM = 0x800000; function computeNewHighWaterMark(n) { if (n >= MAX_HWM) { n = MAX_HWM; } else { // Get the next highest power of 2 to prevent increasing hwm excessively in // tiny amounts n--; n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16; n++; } return n; } // This function is designed to be inlinable, so please take care when making // changes to the function body. function howMuchToRead(n, state) { if (n <= 0 || state.length === 0 && state.ended) return 0; if (state.objectMode) return 1; if (n !== n) { // Only flow one buffer at a time if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; } // If we're asking for more than the current hwm, then raise the hwm. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); if (n <= state.length) return n; // Don't have enough if (!state.ended) { state.needReadable = true; return 0; } return state.length; } // you can override either this method, or the async _read(n) below. Readable.prototype.read = function (n) { debug('read', n); n = parseInt(n, 10); var state = this._readableState; var nOrig = n; if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we // already have a bunch of data in the buffer, then just trigger // the 'readable' event and move on. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { debug('read: emitReadable', state.length, state.ended); if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); return null; } n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. if (n === 0 && state.ended) { if (state.length === 0) endReadable(this); return null; } // All the actual chunk generation logic needs to be // *below* the call to _read. The reason is that in certain // synthetic stream cases, such as passthrough streams, _read // may be a completely synchronous operation which may change // the state of the read buffer, providing enough data when // before there was *not* enough. // // So, the steps are: // 1. Figure out what the state of things will be after we do // a read from the buffer. // // 2. If that resulting state will trigger a _read, then call _read. // Note that this may be asynchronous, or synchronous. Yes, it is // deeply ugly to write APIs this way, but that still doesn't mean // that the Readable class should behave improperly, as streams are // designed to be sync/async agnostic. // Take note if the _read call is sync or async (ie, if the read call // has returned yet), so that we know whether or not it's safe to emit // 'readable' etc. // // 3. Actually pull the requested chunks out of the buffer and return. // if we need a readable event, then we need to do some reading. var doRead = state.needReadable; debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some if (state.length === 0 || state.length - n < state.highWaterMark) { doRead = true; debug('length less than watermark', doRead); } // however, if we've ended, then there's no point, and if we're already // reading, then it's unnecessary. if (state.ended || state.reading) { doRead = false; debug('reading or ended', doRead); } else if (doRead) { debug('do read'); state.reading = true; state.sync = true; // if the length is currently zero, then we *need* a readable event. if (state.length === 0) state.needReadable = true; // call internal read method this._read(state.highWaterMark); state.sync = false; // If _read pushed data synchronously, then `reading` will be false, // and we need to re-evaluate how much data we can return to the user. if (!state.reading) n = howMuchToRead(nOrig, state); } var ret; if (n > 0) ret = fromList(n, state);else ret = null; if (ret === null) { state.needReadable = true; n = 0; } else { state.length -= n; } if (state.length === 0) { // If we have nothing in the buffer, then we want to know // as soon as we *do* get something into the buffer. if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. if (nOrig !== n && state.ended) endReadable(this); } if (ret !== null) this.emit('data', ret); return ret; }; function onEofChunk(stream, state) { if (state.ended) return; if (state.decoder) { var chunk = state.decoder.end(); if (chunk && chunk.length) { state.buffer.push(chunk); state.length += state.objectMode ? 1 : chunk.length; } } state.ended = true; // emit 'readable' now to make sure it gets picked up. emitReadable(stream); } // Don't emit readable right away in sync mode, because this can trigger // another read() call => stack overflow. This way, it might trigger // a nextTick recursion warning, but that's not so bad. function emitReadable(stream) { var state = stream._readableState; state.needReadable = false; if (!state.emittedReadable) { debug('emitReadable', state.flowing); state.emittedReadable = true; if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); } } function emitReadable_(stream) { debug('emit readable'); stream.emit('readable'); flow(stream); } // at this point, the user has presumably seen the 'readable' event, // and called read() to consume some data. that may have triggered // in turn another _read(n) call, in which case reading = true if // it's in progress. // However, if we're not ended, or reading, and the length < hwm, // then go ahead and try to read some more preemptively. function maybeReadMore(stream, state) { if (!state.readingMore) { state.readingMore = true; pna.nextTick(maybeReadMore_, stream, state); } } function maybeReadMore_(stream, state) { var len = state.length; while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { debug('maybeReadMore read 0'); stream.read(0); if (len === state.length) // didn't get any data, stop spinning. break;else len = state.length; } state.readingMore = false; } // abstract method. to be overridden in specific implementation classes. // call cb(er, data) where data is <= n in length. // for virtual (non-string, non-buffer) streams, "length" is somewhat // arbitrary, and perhaps not very meaningful. Readable.prototype._read = function (n) { this.emit('error', new Error('_read() is not implemented')); }; Readable.prototype.pipe = function (dest, pipeOpts) { var src = this; var state = this._readableState; switch (state.pipesCount) { case 0: state.pipes = dest; break; case 1: state.pipes = [state.pipes, dest]; break; default: state.pipes.push(dest); break; } state.pipesCount += 1; debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; var endFn = doEnd ? onend : unpipe; if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); dest.on('unpipe', onunpipe); function onunpipe(readable, unpipeInfo) { debug('onunpipe'); if (readable === src) { if (unpipeInfo && unpipeInfo.hasUnpiped === false) { unpipeInfo.hasUnpiped = true; cleanup(); } } } function onend() { debug('onend'); dest.end(); } // when the dest drains, it reduces the awaitDrain counter // on the source. This would be more elegant with a .once() // handler in flow(), but adding and removing repeatedly is // too slow. var ondrain = pipeOnDrain(src); dest.on('drain', ondrain); var cleanedUp = false; function cleanup() { debug('cleanup'); // cleanup event handlers once the pipe is broken dest.removeListener('close', onclose); dest.removeListener('finish', onfinish); dest.removeListener('drain', ondrain); dest.removeListener('error', onerror); dest.removeListener('unpipe', onunpipe); src.removeListener('end', onend); src.removeListener('end', unpipe); src.removeListener('data', ondata); cleanedUp = true; // if the reader is waiting for a drain event from this // specific writer, then it would cause it to never start // flowing again. // So, if this is awaiting a drain, then we just call it now. // If we don't know, then assume that we are waiting for one. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); } // If the user pushes more data while we're writing to dest then we'll end up // in ondata again. However, we only want to increase awaitDrain once because // dest will only emit one 'drain' event for the multiple writes. // => Introduce a guard on increasing awaitDrain. var increasedAwaitDrain = false; src.on('data', ondata); function ondata(chunk) { debug('ondata'); increasedAwaitDrain = false; var ret = dest.write(chunk); if (false === ret && !increasedAwaitDrain) { // If the user unpiped during `dest.write()`, it is possible // to get stuck in a permanently paused state if that write // also returned false. // => Check whether `dest` is still a piping destination. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { debug('false write response, pause', src._readableState.awaitDrain); src._readableState.awaitDrain++; increasedAwaitDrain = true; } src.pause(); } } // if the dest has an error, then stop piping into it. // however, don't suppress the throwing behavior for this. function onerror(er) { debug('onerror', er); unpipe(); dest.removeListener('error', onerror); if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); } // Make sure our error handler is attached before userland ones. prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. function onclose() { dest.removeListener('finish', onfinish); unpipe(); } dest.once('close', onclose); function onfinish() { debug('onfinish'); dest.removeListener('close', onclose); unpipe(); } dest.once('finish', onfinish); function unpipe() { debug('unpipe'); src.unpipe(dest); } // tell the dest that it's being piped to dest.emit('pipe', src); // start the flow if it hasn't been started already. if (!state.flowing) { debug('pipe resume'); src.resume(); } return dest; }; function pipeOnDrain(src) { return function () { var state = src._readableState; debug('pipeOnDrain', state.awaitDrain); if (state.awaitDrain) state.awaitDrain--; if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { state.flowing = true; flow(src); } }; } Readable.prototype.unpipe = function (dest) { var state = this._readableState; var unpipeInfo = { hasUnpiped: false }; // if we're not piping anywhere, then do nothing. if (state.pipesCount === 0) return this; // just one destination. most common case. if (state.pipesCount === 1) { // passed in one, but it's not the right one. if (dest && dest !== state.pipes) return this; if (!dest) dest = state.pipes; // got a match. state.pipes = null; state.pipesCount = 0; state.flowing = false; if (dest) dest.emit('unpipe', this, unpipeInfo); return this; } // slow case. multiple pipe destinations. if (!dest) { // remove all. var dests = state.pipes; var len = state.pipesCount; state.pipes = null; state.pipesCount = 0; state.flowing = false; for (var i = 0; i < len; i++) { dests[i].emit('unpipe', this, unpipeInfo); }return this; } // try to find the right one. var index = indexOf(state.pipes, dest); if (index === -1) return this; state.pipes.splice(index, 1); state.pipesCount -= 1; if (state.pipesCount === 1) state.pipes = state.pipes[0]; dest.emit('unpipe', this, unpipeInfo); return this; }; // set up data events if they are asked for // Ensure readable listeners eventually get something Readable.prototype.on = function (ev, fn) { var res = Stream.prototype.on.call(this, ev, fn); if (ev === 'data') { // Start flowing on next tick if stream isn't explicitly paused if (this._readableState.flowing !== false) this.resume(); } else if (ev === 'readable') { var state = this._readableState; if (!state.endEmitted && !state.readableListening) { state.readableListening = state.needReadable = true; state.emittedReadable = false; if (!state.reading) { pna.nextTick(nReadingNextTick, this); } else if (state.length) { emitReadable(this); } } } return res; }; Readable.prototype.addListener = Readable.prototype.on; function nReadingNextTick(self) { debug('readable nexttick read 0'); self.read(0); } // pause() and resume() are remnants of the legacy readable stream API // If the user uses them, then switch into old mode. Readable.prototype.resume = function () { var state = this._readableState; if (!state.flowing) { debug('resume'); state.flowing = true; resume(this, state); } return this; }; function resume(stream, state) { if (!state.resumeScheduled) { state.resumeScheduled = true; pna.nextTick(resume_, stream, state); } } function resume_(stream, state) { if (!state.reading) { debug('resume read 0'); stream.read(0); } state.resumeScheduled = false; state.awaitDrain = 0; stream.emit('resume'); flow(stream); if (state.flowing && !state.reading) stream.read(0); } Readable.prototype.pause = function () { debug('call pause flowing=%j', this._readableState.flowing); if (false !== this._readableState.flowing) { debug('pause'); this._readableState.flowing = false; this.emit('pause'); } return this; }; function flow(stream) { var state = stream._readableState; debug('flow', state.flowing); while (state.flowing && stream.read() !== null) {} } // wrap an old-style stream as the async data source. // This is *not* part of the readable stream interface. // It is an ugly unfortunate mess of history. Readable.prototype.wrap = function (stream) { var _this = this; var state = this._readableState; var paused = false; stream.on('end', function () { debug('wrapped end'); if (state.decoder && !state.ended) { var chunk = state.decoder.end(); if (chunk && chunk.length) _this.push(chunk); } _this.push(null); }); stream.on('data', function (chunk) { debug('wrapped data'); if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; var ret = _this.push(chunk); if (!ret) { paused = true; stream.pause(); } }); // proxy all the other methods. // important when wrapping filters and duplexes. for (var i in stream) { if (this[i] === undefined && typeof stream[i] === 'function') { this[i] = function (method) { return function () { return stream[method].apply(stream, arguments); }; }(i); } } // proxy certain important events. for (var n = 0; n < kProxyEvents.length; n++) { stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); } // when we try to consume some more bytes, simply unpause the // underlying stream. this._read = function (n) { debug('wrapped _read', n); if (paused) { paused = false; stream.resume(); } }; return this; }; Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function () { return this._readableState.highWaterMark; } }); // exposed for testing purposes only. Readable._fromList = fromList; // Pluck off n bytes from an array of buffers. // Length is the combined lengths of all the buffers in the list. // This function is designed to be inlinable, so please take care when making // changes to the function body. function fromList(n, state) { // nothing buffered if (state.length === 0) return null; var ret; if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { // read it all, truncate the list if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); state.buffer.clear(); } else { // read part of list ret = fromListPartial(n, state.buffer, state.decoder); } return ret; } // Extracts only enough buffered data to satisfy the amount requested. // This function is designed to be inlinable, so please take care when making // changes to the function body. function fromListPartial(n, list, hasStrings) { var ret; if (n < list.head.data.length) { // slice is the same for buffers and strings ret = list.head.data.slice(0, n); list.head.data = list.head.data.slice(n); } else if (n === list.head.data.length) { // first chunk is a perfect match ret = list.shift(); } else { // result spans more than one buffer ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); } return ret; } // Copies a specified amount of characters from the list of buffered data // chunks. // This function is designed to be inlinable, so please take care when making // changes to the function body. function copyFromBufferString(n, list) { var p = list.head; var c = 1; var ret = p.data; n -= ret.length; while (p = p.next) { var str = p.data; var nb = n > str.length ? str.length : n; if (nb === str.length) ret += str;else ret += str.slice(0, n); n -= nb; if (n === 0) { if (nb === str.length) { ++c; if (p.next) list.head = p.next;else list.head = list.tail = null; } else { list.head = p; p.data = str.slice(nb); } break; } ++c; } list.length -= c; return ret; } // Copies a specified amount of bytes from the list of buffered data chunks. // This function is designed to be inlinable, so please take care when making // changes to the function body. function copyFromBuffer(n, list) { var ret = Buffer.allocUnsafe(n); var p = list.head; var c = 1; p.data.copy(ret); n -= p.data.length; while (p = p.next) { var buf = p.data; var nb = n > buf.length ? buf.length : n; buf.copy(ret, ret.length - n, 0, nb); n -= nb; if (n === 0) { if (nb === buf.length) { ++c; if (p.next) list.head = p.next;else list.head = list.tail = null; } else { list.head = p; p.data = buf.slice(nb); } break; } ++c; } list.length -= c; return ret; } function endReadable(stream) { var state = stream._readableState; // If we get here before consuming all the bytes, then that is a // bug in node. Should never happen. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); if (!state.endEmitted) { state.ended = true; pna.nextTick(endReadableNT, state, stream); } } function endReadableNT(state, stream) { // Check that we didn't get one last unshift. if (!state.endEmitted && state.length === 0) { state.endEmitted = true; stream.readable = false; stream.emit('end'); } } function indexOf(xs, x) { for (var i = 0, l = xs.length; i < l; i++) { if (xs[i] === x) return i; } return -1; } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./_stream_duplex":38,"./internal/streams/BufferList":43,"./internal/streams/destroy":44,"./internal/streams/stream":45,"_process":36,"core-util-is":5,"events":20,"inherits":26,"isarray":29,"process-nextick-args":35,"safe-buffer":51,"string_decoder/":57,"util":2}],41:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // a transform stream is a readable/writable stream where you do // something with the data. Sometimes it's called a "filter", // but that's not a great name for it, since that implies a thing where // some bits pass through, and others are simply ignored. (That would // be a valid example of a transform, of course.) // // While the output is causally related to the input, it's not a // necessarily symmetric or synchronous transformation. For example, // a zlib stream might take multiple plain-text writes(), and then // emit a single compressed chunk some time in the future. // // Here's how this works: // // The Transform stream has all the aspects of the readable and writable // stream classes. When you write(chunk), that calls _write(chunk,cb) // internally, and returns false if there's a lot of pending writes // buffered up. When you call read(), that calls _read(n) until // there's enough pending readable data buffered up. // // In a transform stream, the written data is placed in a buffer. When // _read(n) is called, it transforms the queued up data, calling the // buffered _write cb's as it consumes chunks. If consuming a single // written chunk would result in multiple output chunks, then the first // outputted bit calls the readcb, and subsequent chunks just go into // the read buffer, and will cause it to emit 'readable' if necessary. // // This way, back-pressure is actually determined by the reading side, // since _read has to be called to start processing a new chunk. However, // a pathological inflate type of transform can cause excessive buffering // here. For example, imagine a stream where every byte of input is // interpreted as an integer from 0-255, and then results in that many // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in // 1kb of data being output. In this case, you could write a very small // amount of input, and end up with a very large amount of output. In // such a pathological inflating mechanism, there'd be no way to tell // the system to stop doing the transform. A single 4MB write could // cause the system to run out of memory. // // However, even in such a pathological case, only a single written chunk // would be consumed, and then the rest would wait (un-transformed) until // the results of the previous transformed chunk were consumed. 'use strict'; module.exports = Transform; var Duplex = require('./_stream_duplex'); /**/ var util = require('core-util-is'); util.inherits = require('inherits'); /**/ util.inherits(Transform, Duplex); function afterTransform(er, data) { var ts = this._transformState; ts.transforming = false; var cb = ts.writecb; if (!cb) { return this.emit('error', new Error('write callback called multiple times')); } ts.writechunk = null; ts.writecb = null; if (data != null) // single equals check for both `null` and `undefined` this.push(data); cb(er); var rs = this._readableState; rs.reading = false; if (rs.needReadable || rs.length < rs.highWaterMark) { this._read(rs.highWaterMark); } } function Transform(options) { if (!(this instanceof Transform)) return new Transform(options); Duplex.call(this, options); this._transformState = { afterTransform: afterTransform.bind(this), needTransform: false, transforming: false, writecb: null, writechunk: null, writeencoding: null }; // start out asking for a readable event once data is transformed. this._readableState.needReadable = true; // we have implemented the _read method, and done the other things // that Readable wants before the first _read call, so unset the // sync guard flag. this._readableState.sync = false; if (options) { if (typeof options.transform === 'function') this._transform = options.transform; if (typeof options.flush === 'function') this._flush = options.flush; } // When the writable side finishes, then flush out anything remaining. this.on('prefinish', prefinish); } function prefinish() { var _this = this; if (typeof this._flush === 'function') { this._flush(function (er, data) { done(_this, er, data); }); } else { done(this, null, null); } } Transform.prototype.push = function (chunk, encoding) { this._transformState.needTransform = false; return Duplex.prototype.push.call(this, chunk, encoding); }; // This is the part where you do stuff! // override this function in implementation classes. // 'chunk' is an input chunk. // // Call `push(newChunk)` to pass along transformed output // to the readable side. You may call 'push' zero or more times. // // Call `cb(err)` when you are done with this chunk. If you pass // an error, then that'll put the hurt on the whole operation. If you // never call cb(), then you'll never get another chunk. Transform.prototype._transform = function (chunk, encoding, cb) { throw new Error('_transform() is not implemented'); }; Transform.prototype._write = function (chunk, encoding, cb) { var ts = this._transformState; ts.writecb = cb; ts.writechunk = chunk; ts.writeencoding = encoding; if (!ts.transforming) { var rs = this._readableState; if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); } }; // Doesn't matter what the args are here. // _transform does all the work. // That we got here means that the readable side wants more data. Transform.prototype._read = function (n) { var ts = this._transformState; if (ts.writechunk !== null && ts.writecb && !ts.transforming) { ts.transforming = true; this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); } else { // mark that we need a transform, so that any data that comes in // will get processed, now that we've asked for it. ts.needTransform = true; } }; Transform.prototype._destroy = function (err, cb) { var _this2 = this; Duplex.prototype._destroy.call(this, err, function (err2) { cb(err2); _this2.emit('close'); }); }; function done(stream, er, data) { if (er) return stream.emit('error', er); if (data != null) // single equals check for both `null` and `undefined` stream.push(data); // if there's nothing in the write buffer, then that means // that nothing more will ever be provided if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); return stream.push(null); } },{"./_stream_duplex":38,"core-util-is":5,"inherits":26}],42:[function(require,module,exports){ (function (process,global,setImmediate){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. // A bit simpler than readable streams. // Implement an async ._write(chunk, encoding, cb), and it'll handle all // the drain event emission and buffering. 'use strict'; /**/ var pna = require('process-nextick-args'); /**/ module.exports = Writable; /* */ function WriteReq(chunk, encoding, cb) { this.chunk = chunk; this.encoding = encoding; this.callback = cb; this.next = null; } // It seems a linked list but it is not // there will be only 2 of these for each stream function CorkedRequest(state) { var _this = this; this.next = null; this.entry = null; this.finish = function () { onCorkedFinish(_this, state); }; } /* */ /**/ var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; /**/ /**/ var Duplex; /**/ Writable.WritableState = WritableState; /**/ var util = require('core-util-is'); util.inherits = require('inherits'); /**/ /**/ var internalUtil = { deprecate: require('util-deprecate') }; /**/ /**/ var Stream = require('./internal/streams/stream'); /**/ /**/ var Buffer = require('safe-buffer').Buffer; var OurUint8Array = global.Uint8Array || function () {}; function _uint8ArrayToBuffer(chunk) { return Buffer.from(chunk); } function _isUint8Array(obj) { return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } /**/ var destroyImpl = require('./internal/streams/destroy'); util.inherits(Writable, Stream); function nop() {} function WritableState(options, stream) { Duplex = Duplex || require('./_stream_duplex'); options = options || {}; // Duplex streams are both readable and writable, but share // the same options object. // However, some cases require setting options to different // values for the readable and the writable sides of the duplex stream. // These options can be provided separately as readableXXX and writableXXX. var isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream // contains buffers or objects. this.objectMode = !!options.objectMode; if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false // Note: 0 is a valid value, means that we always return false if // the entire buffer is not flushed immediately on write() var hwm = options.highWaterMark; var writableHwm = options.writableHighWaterMark; var defaultHwm = this.objectMode ? 16 : 16 * 1024; if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; // cast to ints. this.highWaterMark = Math.floor(this.highWaterMark); // if _final has been called this.finalCalled = false; // drain event flag. this.needDrain = false; // at the start of calling end() this.ending = false; // when end() has been called, and returned this.ended = false; // when 'finish' is emitted this.finished = false; // has it been destroyed this.destroyed = false; // should we decode strings into buffers before passing to _write? // this is here so that some node-core streams can optimize string // handling at a lower level. var noDecode = options.decodeStrings === false; this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string // encoding is 'binary' so we have to make this configurable. // Everything else in the universe uses 'utf8', though. this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement // of how much we're waiting to get pushed to some underlying // socket or file. this.length = 0; // a flag to see when we're in the middle of a write. this.writing = false; // when true all writes will be buffered until .uncork() call this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, // or on a later tick. We set this to true at first, because any // actions that shouldn't happen until "later" should generally also // not happen before the first write call. this.sync = true; // a flag to know if we're processing previously buffered items, which // may call the _write() callback in the same tick, so that we don't // end up in an overlapped onwrite situation. this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) this.onwrite = function (er) { onwrite(stream, er); }; // the callback that the user supplies to write(chunk,encoding,cb) this.writecb = null; // the amount that is being written when _write is called. this.writelen = 0; this.bufferedRequest = null; this.lastBufferedRequest = null; // number of pending user-supplied write callbacks // this must be 0 before 'finish' can be emitted this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs // This is relevant for synchronous Transform streams this.prefinished = false; // True if the error was already emitted and should not be thrown again this.errorEmitted = false; // count buffered requests this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always // one allocated and free to use, and we maintain at most two this.corkedRequestsFree = new CorkedRequest(this); } WritableState.prototype.getBuffer = function getBuffer() { var current = this.bufferedRequest; var out = []; while (current) { out.push(current); current = current.next; } return out; }; (function () { try { Object.defineProperty(WritableState.prototype, 'buffer', { get: internalUtil.deprecate(function () { return this.getBuffer(); }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') }); } catch (_) {} })(); // Test _writableState for inheritance to account for Duplex streams, // whose prototype chain only points to Readable. var realHasInstance; if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { realHasInstance = Function.prototype[Symbol.hasInstance]; Object.defineProperty(Writable, Symbol.hasInstance, { value: function (object) { if (realHasInstance.call(this, object)) return true; if (this !== Writable) return false; return object && object._writableState instanceof WritableState; } }); } else { realHasInstance = function (object) { return object instanceof this; }; } function Writable(options) { Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too. // `realHasInstance` is necessary because using plain `instanceof` // would return false, as no `_writableState` property is attached. // Trying to use the custom `instanceof` for Writable here will also break the // Node.js LazyTransform implementation, which has a non-trivial getter for // `_writableState` that would lead to infinite recursion. if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { return new Writable(options); } this._writableState = new WritableState(options, this); // legacy. this.writable = true; if (options) { if (typeof options.write === 'function') this._write = options.write; if (typeof options.writev === 'function') this._writev = options.writev; if (typeof options.destroy === 'function') this._destroy = options.destroy; if (typeof options.final === 'function') this._final = options.final; } Stream.call(this); } // Otherwise people can pipe Writable streams, which is just wrong. Writable.prototype.pipe = function () { this.emit('error', new Error('Cannot pipe, not readable')); }; function writeAfterEnd(stream, cb) { var er = new Error('write after end'); // TODO: defer error events consistently everywhere, not just the cb stream.emit('error', er); pna.nextTick(cb, er); } // Checks that a user-supplied chunk is valid, especially for the particular // mode the stream is in. Currently this means that `null` is never accepted // and undefined/non-string values are only allowed in object mode. function validChunk(stream, state, chunk, cb) { var valid = true; var er = false; if (chunk === null) { er = new TypeError('May not write null values to stream'); } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { er = new TypeError('Invalid non-string/buffer chunk'); } if (er) { stream.emit('error', er); pna.nextTick(cb, er); valid = false; } return valid; } Writable.prototype.write = function (chunk, encoding, cb) { var state = this._writableState; var ret = false; var isBuf = !state.objectMode && _isUint8Array(chunk); if (isBuf && !Buffer.isBuffer(chunk)) { chunk = _uint8ArrayToBuffer(chunk); } if (typeof encoding === 'function') { cb = encoding; encoding = null; } if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; if (typeof cb !== 'function') cb = nop; if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { state.pendingcb++; ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); } return ret; }; Writable.prototype.cork = function () { var state = this._writableState; state.corked++; }; Writable.prototype.uncork = function () { var state = this._writableState; if (state.corked) { state.corked--; if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); } }; Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { // node::ParseEncoding() requires lower case. if (typeof encoding === 'string') encoding = encoding.toLowerCase(); if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); this._writableState.defaultEncoding = encoding; return this; }; function decodeChunk(state, chunk, encoding) { if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { chunk = Buffer.from(chunk, encoding); } return chunk; } Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { // making it explicit this property is not enumerable // because otherwise some prototype manipulation in // userland will fail enumerable: false, get: function () { return this._writableState.highWaterMark; } }); // if we're already writing something, then just put this // in the queue, and wait our turn. Otherwise, call _write // If we return false, then we need a drain event, so set that flag. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { if (!isBuf) { var newChunk = decodeChunk(state, chunk, encoding); if (chunk !== newChunk) { isBuf = true; encoding = 'buffer'; chunk = newChunk; } } var len = state.objectMode ? 1 : chunk.length; state.length += len; var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. if (!ret) state.needDrain = true; if (state.writing || state.corked) { var last = state.lastBufferedRequest; state.lastBufferedRequest = { chunk: chunk, encoding: encoding, isBuf: isBuf, callback: cb, next: null }; if (last) { last.next = state.lastBufferedRequest; } else { state.bufferedRequest = state.lastBufferedRequest; } state.bufferedRequestCount += 1; } else { doWrite(stream, state, false, len, chunk, encoding, cb); } return ret; } function doWrite(stream, state, writev, len, chunk, encoding, cb) { state.writelen = len; state.writecb = cb; state.writing = true; state.sync = true; if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); state.sync = false; } function onwriteError(stream, state, sync, er, cb) { --state.pendingcb; if (sync) { // defer the callback if we are being called synchronously // to avoid piling up things on the stack pna.nextTick(cb, er); // this can emit finish, and it will always happen // after error pna.nextTick(finishMaybe, stream, state); stream._writableState.errorEmitted = true; stream.emit('error', er); } else { // the caller expect this to happen before if // it is async cb(er); stream._writableState.errorEmitted = true; stream.emit('error', er); // this can emit finish, but finish must // always follow error finishMaybe(stream, state); } } function onwriteStateUpdate(state) { state.writing = false; state.writecb = null; state.length -= state.writelen; state.writelen = 0; } function onwrite(stream, er) { var state = stream._writableState; var sync = state.sync; var cb = state.writecb; onwriteStateUpdate(state); if (er) onwriteError(stream, state, sync, er, cb);else { // Check if we're actually ready to finish, but don't emit yet var finished = needFinish(state); if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { clearBuffer(stream, state); } if (sync) { /**/ asyncWrite(afterWrite, stream, state, finished, cb); /**/ } else { afterWrite(stream, state, finished, cb); } } } function afterWrite(stream, state, finished, cb) { if (!finished) onwriteDrain(stream, state); state.pendingcb--; cb(); finishMaybe(stream, state); } // Must force callback to be called on nextTick, so that we don't // emit 'drain' before the write() consumer gets the 'false' return // value, and has a chance to attach a 'drain' listener. function onwriteDrain(stream, state) { if (state.length === 0 && state.needDrain) { state.needDrain = false; stream.emit('drain'); } } // if there's something in the buffer waiting, then process it function clearBuffer(stream, state) { state.bufferProcessing = true; var entry = state.bufferedRequest; if (stream._writev && entry && entry.next) { // Fast case, write everything using _writev() var l = state.bufferedRequestCount; var buffer = new Array(l); var holder = state.corkedRequestsFree; holder.entry = entry; var count = 0; var allBuffers = true; while (entry) { buffer[count] = entry; if (!entry.isBuf) allBuffers = false; entry = entry.next; count += 1; } buffer.allBuffers = allBuffers; doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time // as the hot path ends with doWrite state.pendingcb++; state.lastBufferedRequest = null; if (holder.next) { state.corkedRequestsFree = holder.next; holder.next = null; } else { state.corkedRequestsFree = new CorkedRequest(state); } state.bufferedRequestCount = 0; } else { // Slow case, write chunks one-by-one while (entry) { var chunk = entry.chunk; var encoding = entry.encoding; var cb = entry.callback; var len = state.objectMode ? 1 : chunk.length; doWrite(stream, state, false, len, chunk, encoding, cb); entry = entry.next; state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then // it means that we need to wait until it does. // also, that means that the chunk and cb are currently // being processed, so move the buffer counter past them. if (state.writing) { break; } } if (entry === null) state.lastBufferedRequest = null; } state.bufferedRequest = entry; state.bufferProcessing = false; } Writable.prototype._write = function (chunk, encoding, cb) { cb(new Error('_write() is not implemented')); }; Writable.prototype._writev = null; Writable.prototype.end = function (chunk, encoding, cb) { var state = this._writableState; if (typeof chunk === 'function') { cb = chunk; chunk = null; encoding = null; } else if (typeof encoding === 'function') { cb = encoding; encoding = null; } if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks if (state.corked) { state.corked = 1; this.uncork(); } // ignore unnecessary end() calls. if (!state.ending && !state.finished) endWritable(this, state, cb); }; function needFinish(state) { return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; } function callFinal(stream, state) { stream._final(function (err) { state.pendingcb--; if (err) { stream.emit('error', err); } state.prefinished = true; stream.emit('prefinish'); finishMaybe(stream, state); }); } function prefinish(stream, state) { if (!state.prefinished && !state.finalCalled) { if (typeof stream._final === 'function') { state.pendingcb++; state.finalCalled = true; pna.nextTick(callFinal, stream, state); } else { state.prefinished = true; stream.emit('prefinish'); } } } function finishMaybe(stream, state) { var need = needFinish(state); if (need) { prefinish(stream, state); if (state.pendingcb === 0) { state.finished = true; stream.emit('finish'); } } return need; } function endWritable(stream, state, cb) { state.ending = true; finishMaybe(stream, state); if (cb) { if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); } state.ended = true; stream.writable = false; } function onCorkedFinish(corkReq, state, err) { var entry = corkReq.entry; corkReq.entry = null; while (entry) { var cb = entry.callback; state.pendingcb--; cb(err); entry = entry.next; } if (state.corkedRequestsFree) { state.corkedRequestsFree.next = corkReq; } else { state.corkedRequestsFree = corkReq; } } Object.defineProperty(Writable.prototype, 'destroyed', { get: function () { if (this._writableState === undefined) { return false; } return this._writableState.destroyed; }, set: function (value) { // we ignore the value if the stream // has not been initialized yet if (!this._writableState) { return; } // backward compatibility, the user is explicitly // managing destroyed this._writableState.destroyed = value; } }); Writable.prototype.destroy = destroyImpl.destroy; Writable.prototype._undestroy = destroyImpl.undestroy; Writable.prototype._destroy = function (err, cb) { this.end(); cb(err); }; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) },{"./_stream_duplex":38,"./internal/streams/destroy":44,"./internal/streams/stream":45,"_process":36,"core-util-is":5,"inherits":26,"process-nextick-args":35,"safe-buffer":51,"timers":63,"util-deprecate":64}],43:[function(require,module,exports){ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Buffer = require('safe-buffer').Buffer; var util = require('util'); function copyBuffer(src, target, offset) { src.copy(target, offset); } module.exports = function () { function BufferList() { _classCallCheck(this, BufferList); this.head = null; this.tail = null; this.length = 0; } BufferList.prototype.push = function push(v) { var entry = { data: v, next: null }; if (this.length > 0) this.tail.next = entry;else this.head = entry; this.tail = entry; ++this.length; }; BufferList.prototype.unshift = function unshift(v) { var entry = { data: v, next: this.head }; if (this.length === 0) this.tail = entry; this.head = entry; ++this.length; }; BufferList.prototype.shift = function shift() { if (this.length === 0) return; var ret = this.head.data; if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; --this.length; return ret; }; BufferList.prototype.clear = function clear() { this.head = this.tail = null; this.length = 0; }; BufferList.prototype.join = function join(s) { if (this.length === 0) return ''; var p = this.head; var ret = '' + p.data; while (p = p.next) { ret += s + p.data; }return ret; }; BufferList.prototype.concat = function concat(n) { if (this.length === 0) return Buffer.alloc(0); if (this.length === 1) return this.head.data; var ret = Buffer.allocUnsafe(n >>> 0); var p = this.head; var i = 0; while (p) { copyBuffer(p.data, ret, i); i += p.data.length; p = p.next; } return ret; }; return BufferList; }(); if (util && util.inspect && util.inspect.custom) { module.exports.prototype[util.inspect.custom] = function () { var obj = util.inspect({ length: this.length }); return this.constructor.name + ' ' + obj; }; } },{"safe-buffer":51,"util":2}],44:[function(require,module,exports){ 'use strict'; /**/ var pna = require('process-nextick-args'); /**/ // undocumented cb() API, needed for core, not for public API function destroy(err, cb) { var _this = this; var readableDestroyed = this._readableState && this._readableState.destroyed; var writableDestroyed = this._writableState && this._writableState.destroyed; if (readableDestroyed || writableDestroyed) { if (cb) { cb(err); } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { pna.nextTick(emitErrorNT, this, err); } return this; } // we set destroyed to true before firing error callbacks in order // to make it re-entrance safe in case destroy() is called within callbacks if (this._readableState) { this._readableState.destroyed = true; } // if this is a duplex stream mark the writable part as destroyed as well if (this._writableState) { this._writableState.destroyed = true; } this._destroy(err || null, function (err) { if (!cb && err) { pna.nextTick(emitErrorNT, _this, err); if (_this._writableState) { _this._writableState.errorEmitted = true; } } else if (cb) { cb(err); } }); return this; } function undestroy() { if (this._readableState) { this._readableState.destroyed = false; this._readableState.reading = false; this._readableState.ended = false; this._readableState.endEmitted = false; } if (this._writableState) { this._writableState.destroyed = false; this._writableState.ended = false; this._writableState.ending = false; this._writableState.finished = false; this._writableState.errorEmitted = false; } } function emitErrorNT(self, err) { self.emit('error', err); } module.exports = { destroy: destroy, undestroy: undestroy }; },{"process-nextick-args":35}],45:[function(require,module,exports){ module.exports = require('events').EventEmitter; },{"events":20}],46:[function(require,module,exports){ module.exports = require('./readable').PassThrough },{"./readable":47}],47:[function(require,module,exports){ exports = module.exports = require('./lib/_stream_readable.js'); exports.Stream = exports; exports.Readable = exports; exports.Writable = require('./lib/_stream_writable.js'); exports.Duplex = require('./lib/_stream_duplex.js'); exports.Transform = require('./lib/_stream_transform.js'); exports.PassThrough = require('./lib/_stream_passthrough.js'); },{"./lib/_stream_duplex.js":38,"./lib/_stream_passthrough.js":39,"./lib/_stream_readable.js":40,"./lib/_stream_transform.js":41,"./lib/_stream_writable.js":42}],48:[function(require,module,exports){ module.exports = require('./readable').Transform },{"./readable":47}],49:[function(require,module,exports){ module.exports = require('./lib/_stream_writable.js'); },{"./lib/_stream_writable.js":42}],50:[function(require,module,exports){ (function (process,setImmediate){ var through = require('through'); var nextTick = typeof setImmediate !== 'undefined' ? setImmediate : process.nextTick ; module.exports = function (write, end) { var tr = through(write, end); tr.pause(); var resume = tr.resume; var pause = tr.pause; var paused = false; tr.pause = function () { paused = true; return pause.apply(this, arguments); }; tr.resume = function () { paused = false; return resume.apply(this, arguments); }; nextTick(function () { if (!paused) tr.resume(); }); return tr; }; }).call(this,require('_process'),require("timers").setImmediate) },{"_process":36,"through":62,"timers":63}],51:[function(require,module,exports){ /* eslint-disable node/no-deprecated-api */ var buffer = require('buffer') var Buffer = buffer.Buffer // alternative to using Object.keys for old browsers function copyProps (src, dst) { for (var key in src) { dst[key] = src[key] } } if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { module.exports = buffer } else { // Copy properties from require('buffer') copyProps(buffer, exports) exports.Buffer = SafeBuffer } function SafeBuffer (arg, encodingOrOffset, length) { return Buffer(arg, encodingOrOffset, length) } // Copy static methods from Buffer copyProps(Buffer, SafeBuffer) SafeBuffer.from = function (arg, encodingOrOffset, length) { if (typeof arg === 'number') { throw new TypeError('Argument must not be a number') } return Buffer(arg, encodingOrOffset, length) } SafeBuffer.alloc = function (size, fill, encoding) { if (typeof size !== 'number') { throw new TypeError('Argument must be a number') } var buf = Buffer(size) if (fill !== undefined) { if (typeof encoding === 'string') { buf.fill(fill, encoding) } else { buf.fill(fill) } } else { buf.fill(0) } return buf } SafeBuffer.allocUnsafe = function (size) { if (typeof size !== 'number') { throw new TypeError('Argument must be a number') } return Buffer(size) } SafeBuffer.allocUnsafeSlow = function (size) { if (typeof size !== 'number') { throw new TypeError('Argument must be a number') } return buffer.SlowBuffer(size) } },{"buffer":4}],52:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. module.exports = Stream; var EE = require('events').EventEmitter; var inherits = require('inherits'); inherits(Stream, EE); Stream.Readable = require('readable-stream/readable.js'); Stream.Writable = require('readable-stream/writable.js'); Stream.Duplex = require('readable-stream/duplex.js'); Stream.Transform = require('readable-stream/transform.js'); Stream.PassThrough = require('readable-stream/passthrough.js'); // Backwards-compat with node 0.4.x Stream.Stream = Stream; // old-style streams. Note that the pipe method (the only relevant // part of this class) is overridden in the Readable class. function Stream() { EE.call(this); } Stream.prototype.pipe = function(dest, options) { var source = this; function ondata(chunk) { if (dest.writable) { if (false === dest.write(chunk) && source.pause) { source.pause(); } } } source.on('data', ondata); function ondrain() { if (source.readable && source.resume) { source.resume(); } } dest.on('drain', ondrain); // If the 'end' option is not supplied, dest.end() will be called when // source gets the 'end' or 'close' events. Only dest.end() once. if (!dest._isStdio && (!options || options.end !== false)) { source.on('end', onend); source.on('close', onclose); } var didOnEnd = false; function onend() { if (didOnEnd) return; didOnEnd = true; dest.end(); } function onclose() { if (didOnEnd) return; didOnEnd = true; if (typeof dest.destroy === 'function') dest.destroy(); } // don't leave dangling pipes when there are errors. function onerror(er) { cleanup(); if (EE.listenerCount(this, 'error') === 0) { throw er; // Unhandled stream error in pipe. } } source.on('error', onerror); dest.on('error', onerror); // remove all the event listeners that were added. function cleanup() { source.removeListener('data', ondata); dest.removeListener('drain', ondrain); source.removeListener('end', onend); source.removeListener('close', onclose); source.removeListener('error', onerror); dest.removeListener('error', onerror); source.removeListener('end', cleanup); source.removeListener('close', cleanup); dest.removeListener('close', cleanup); } source.on('end', cleanup); source.on('close', cleanup); dest.on('close', cleanup); dest.emit('pipe', source); // Allow for unix-like usage: A.pipe(B).pipe(C) return dest; }; },{"events":20,"inherits":26,"readable-stream/duplex.js":37,"readable-stream/passthrough.js":46,"readable-stream/readable.js":47,"readable-stream/transform.js":48,"readable-stream/writable.js":49}],53:[function(require,module,exports){ 'use strict'; var bind = require('function-bind'); var ES = require('es-abstract/es5'); var replace = bind.call(Function.call, String.prototype.replace); var leftWhitespace = /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/; var rightWhitespace = /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/; module.exports = function trim() { var S = ES.ToString(ES.CheckObjectCoercible(this)); return replace(replace(S, leftWhitespace, ''), rightWhitespace, ''); }; },{"es-abstract/es5":12,"function-bind":23}],54:[function(require,module,exports){ 'use strict'; var bind = require('function-bind'); var define = require('define-properties'); var implementation = require('./implementation'); var getPolyfill = require('./polyfill'); var shim = require('./shim'); var boundTrim = bind.call(Function.call, getPolyfill()); define(boundTrim, { getPolyfill: getPolyfill, implementation: implementation, shim: shim }); module.exports = boundTrim; },{"./implementation":53,"./polyfill":55,"./shim":56,"define-properties":9,"function-bind":23}],55:[function(require,module,exports){ 'use strict'; var implementation = require('./implementation'); var zeroWidthSpace = '\u200b'; module.exports = function getPolyfill() { if (String.prototype.trim && zeroWidthSpace.trim() === zeroWidthSpace) { return String.prototype.trim; } return implementation; }; },{"./implementation":53}],56:[function(require,module,exports){ 'use strict'; var define = require('define-properties'); var getPolyfill = require('./polyfill'); module.exports = function shimStringTrim() { var polyfill = getPolyfill(); define(String.prototype, { trim: polyfill }, { trim: function () { return String.prototype.trim !== polyfill; } }); return polyfill; }; },{"./polyfill":55,"define-properties":9}],57:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; /**/ var Buffer = require('safe-buffer').Buffer; /**/ var isEncoding = Buffer.isEncoding || function (encoding) { encoding = '' + encoding; switch (encoding && encoding.toLowerCase()) { case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': return true; default: return false; } }; function _normalizeEncoding(enc) { if (!enc) return 'utf8'; var retried; while (true) { switch (enc) { case 'utf8': case 'utf-8': return 'utf8'; case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': return 'utf16le'; case 'latin1': case 'binary': return 'latin1'; case 'base64': case 'ascii': case 'hex': return enc; default: if (retried) return; // undefined enc = ('' + enc).toLowerCase(); retried = true; } } }; // Do not cache `Buffer.isEncoding` when checking encoding names as some // modules monkey-patch it to support additional encodings function normalizeEncoding(enc) { var nenc = _normalizeEncoding(enc); if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); return nenc || enc; } // StringDecoder provides an interface for efficiently splitting a series of // buffers into a series of JS strings without breaking apart multi-byte // characters. exports.StringDecoder = StringDecoder; function StringDecoder(encoding) { this.encoding = normalizeEncoding(encoding); var nb; switch (this.encoding) { case 'utf16le': this.text = utf16Text; this.end = utf16End; nb = 4; break; case 'utf8': this.fillLast = utf8FillLast; nb = 4; break; case 'base64': this.text = base64Text; this.end = base64End; nb = 3; break; default: this.write = simpleWrite; this.end = simpleEnd; return; } this.lastNeed = 0; this.lastTotal = 0; this.lastChar = Buffer.allocUnsafe(nb); } StringDecoder.prototype.write = function (buf) { if (buf.length === 0) return ''; var r; var i; if (this.lastNeed) { r = this.fillLast(buf); if (r === undefined) return ''; i = this.lastNeed; this.lastNeed = 0; } else { i = 0; } if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); return r || ''; }; StringDecoder.prototype.end = utf8End; // Returns only complete characters in a Buffer StringDecoder.prototype.text = utf8Text; // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer StringDecoder.prototype.fillLast = function (buf) { if (this.lastNeed <= buf.length) { buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); return this.lastChar.toString(this.encoding, 0, this.lastTotal); } buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); this.lastNeed -= buf.length; }; // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a // continuation byte. If an invalid byte is detected, -2 is returned. function utf8CheckByte(byte) { if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; return byte >> 6 === 0x02 ? -1 : -2; } // Checks at most 3 bytes at the end of a Buffer in order to detect an // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) // needed to complete the UTF-8 character (if applicable) are returned. function utf8CheckIncomplete(self, buf, i) { var j = buf.length - 1; if (j < i) return 0; var nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) self.lastNeed = nb - 1; return nb; } if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) self.lastNeed = nb - 2; return nb; } if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) { if (nb === 2) nb = 0;else self.lastNeed = nb - 3; } return nb; } return 0; } // Validates as many continuation bytes for a multi-byte UTF-8 character as // needed or are available. If we see a non-continuation byte where we expect // one, we "replace" the validated continuation bytes we've seen so far with // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding // behavior. The continuation byte check is included three times in the case // where all of the continuation bytes for a character exist in the same buffer. // It is also done this way as a slight performance increase instead of using a // loop. function utf8CheckExtraBytes(self, buf, p) { if ((buf[0] & 0xC0) !== 0x80) { self.lastNeed = 0; return '\ufffd'; } if (self.lastNeed > 1 && buf.length > 1) { if ((buf[1] & 0xC0) !== 0x80) { self.lastNeed = 1; return '\ufffd'; } if (self.lastNeed > 2 && buf.length > 2) { if ((buf[2] & 0xC0) !== 0x80) { self.lastNeed = 2; return '\ufffd'; } } } } // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. function utf8FillLast(buf) { var p = this.lastTotal - this.lastNeed; var r = utf8CheckExtraBytes(this, buf, p); if (r !== undefined) return r; if (this.lastNeed <= buf.length) { buf.copy(this.lastChar, p, 0, this.lastNeed); return this.lastChar.toString(this.encoding, 0, this.lastTotal); } buf.copy(this.lastChar, p, 0, buf.length); this.lastNeed -= buf.length; } // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a // partial character, the character's bytes are buffered until the required // number of bytes are available. function utf8Text(buf, i) { var total = utf8CheckIncomplete(this, buf, i); if (!this.lastNeed) return buf.toString('utf8', i); this.lastTotal = total; var end = buf.length - (total - this.lastNeed); buf.copy(this.lastChar, 0, end); return buf.toString('utf8', i, end); } // For UTF-8, a replacement character is added when ending on a partial // character. function utf8End(buf) { var r = buf && buf.length ? this.write(buf) : ''; if (this.lastNeed) return r + '\ufffd'; return r; } // UTF-16LE typically needs two bytes per character, but even if we have an even // number of bytes available, we need to check if we end on a leading/high // surrogate. In that case, we need to wait for the next two bytes in order to // decode the last character properly. function utf16Text(buf, i) { if ((buf.length - i) % 2 === 0) { var r = buf.toString('utf16le', i); if (r) { var c = r.charCodeAt(r.length - 1); if (c >= 0xD800 && c <= 0xDBFF) { this.lastNeed = 2; this.lastTotal = 4; this.lastChar[0] = buf[buf.length - 2]; this.lastChar[1] = buf[buf.length - 1]; return r.slice(0, -1); } } return r; } this.lastNeed = 1; this.lastTotal = 2; this.lastChar[0] = buf[buf.length - 1]; return buf.toString('utf16le', i, buf.length - 1); } // For UTF-16LE we do not explicitly append special replacement characters if we // end on a partial character, we simply let v8 handle that. function utf16End(buf) { var r = buf && buf.length ? this.write(buf) : ''; if (this.lastNeed) { var end = this.lastTotal - this.lastNeed; return r + this.lastChar.toString('utf16le', 0, end); } return r; } function base64Text(buf, i) { var n = (buf.length - i) % 3; if (n === 0) return buf.toString('base64', i); this.lastNeed = 3 - n; this.lastTotal = 3; if (n === 1) { this.lastChar[0] = buf[buf.length - 1]; } else { this.lastChar[0] = buf[buf.length - 2]; this.lastChar[1] = buf[buf.length - 1]; } return buf.toString('base64', i, buf.length - n); } function base64End(buf) { var r = buf && buf.length ? this.write(buf) : ''; if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); return r; } // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) function simpleWrite(buf) { return buf.toString(this.encoding); } function simpleEnd(buf) { return buf && buf.length ? this.write(buf) : ''; } },{"safe-buffer":51}],58:[function(require,module,exports){ (function (process,setImmediate){ var defined = require('defined'); var createDefaultStream = require('./lib/default_stream'); var Test = require('./lib/test'); var createResult = require('./lib/results'); var through = require('through'); var canEmitExit = typeof process !== 'undefined' && process && typeof process.on === 'function' && process.browser !== true ; var canExit = typeof process !== 'undefined' && process && typeof process.exit === 'function' ; var nextTick = typeof setImmediate !== 'undefined' ? setImmediate : process.nextTick ; exports = module.exports = (function () { var harness; var lazyLoad = function () { return getHarness().apply(this, arguments); }; lazyLoad.only = function () { return getHarness().only.apply(this, arguments); }; lazyLoad.createStream = function (opts) { if (!opts) opts = {}; if (!harness) { var output = through(); getHarness({ stream: output, objectMode: opts.objectMode }); return output; } return harness.createStream(opts); }; lazyLoad.onFinish = function () { return getHarness().onFinish.apply(this, arguments); }; lazyLoad.onFailure = function () { return getHarness().onFailure.apply(this, arguments); }; lazyLoad.getHarness = getHarness return lazyLoad function getHarness(opts) { if (!opts) opts = {}; opts.autoclose = !canEmitExit; if (!harness) harness = createExitHarness(opts); return harness; } })(); function createExitHarness(conf) { if (!conf) conf = {}; var harness = createHarness({ autoclose: defined(conf.autoclose, false) }); var stream = harness.createStream({ objectMode: conf.objectMode }); var es = stream.pipe(conf.stream || createDefaultStream()); if (canEmitExit) { es.on('error', function (err) { harness._exitCode = 1 }); } var ended = false; stream.on('end', function () { ended = true }); if (conf.exit === false) return harness; if (!canEmitExit || !canExit) return harness; var inErrorState = false; process.on('exit', function (code) { // let the process exit cleanly. if (code !== 0) { return } if (!ended) { var only = harness._results._only; for (var i = 0; i < harness._tests.length; i++) { var t = harness._tests[i]; if (only && t !== only) continue; t._exit(); } } harness.close(); process.exit(code || harness._exitCode); }); return harness; } exports.createHarness = createHarness; exports.Test = Test; exports.test = exports; // tap compat exports.test.skip = Test.skip; var exitInterval; function createHarness(conf_) { if (!conf_) conf_ = {}; var results = createResult(); if (conf_.autoclose !== false) { results.once('done', function () { results.close() }); } var test = function (name, conf, cb) { var t = new Test(name, conf, cb); test._tests.push(t); (function inspectCode(st) { st.on('test', function sub(st_) { inspectCode(st_); }); st.on('result', function (r) { if (!r.ok && typeof r !== 'string') test._exitCode = 1 }); })(t); results.push(t); return t; }; test._results = results; test._tests = []; test.createStream = function (opts) { return results.createStream(opts); }; test.onFinish = function (cb) { results.on('done', cb); }; test.onFailure = function (cb) { results.on('fail', cb); }; var only = false; test.only = function () { if (only) throw new Error('there can only be one only test'); only = true; var t = test.apply(null, arguments); results.only(t); return t; }; test._exitCode = 0; test.close = function () { results.close() }; return test; } }).call(this,require('_process'),require("timers").setImmediate) },{"./lib/default_stream":59,"./lib/results":60,"./lib/test":61,"_process":36,"defined":10,"through":62,"timers":63}],59:[function(require,module,exports){ (function (process){ var through = require('through'); var fs = require('fs'); module.exports = function () { var line = ''; var stream = through(write, flush); return stream; function write(buf) { for (var i = 0; i < buf.length; i++) { var c = typeof buf === 'string' ? buf.charAt(i) : String.fromCharCode(buf[i]) ; if (c === '\n') flush(); else line += c; } } function flush() { if (fs.writeSync && /^win/.test(process.platform)) { try { fs.writeSync(1, line + '\n'); } catch (e) { stream.emit('error', e) } } else { try { console.log(line) } catch (e) { stream.emit('error', e) } } line = ''; } }; }).call(this,require('_process')) },{"_process":36,"fs":3,"through":62}],60:[function(require,module,exports){ (function (process,setImmediate){ var defined = require('defined'); var EventEmitter = require('events').EventEmitter; var inherits = require('inherits'); var through = require('through'); var resumer = require('resumer'); var inspect = require('object-inspect'); var bind = require('function-bind'); var has = require('has'); var regexpTest = bind.call(Function.call, RegExp.prototype.test); var yamlIndicators = /\:|\-|\?/; var nextTick = typeof setImmediate !== 'undefined' ? setImmediate : process.nextTick ; module.exports = Results; inherits(Results, EventEmitter); function Results() { if (!(this instanceof Results)) return new Results; this.count = 0; this.fail = 0; this.pass = 0; this.todo = 0; this._stream = through(); this.tests = []; this._only = null; this._isRunning = false; } Results.prototype.createStream = function (opts) { if (!opts) opts = {}; var self = this; var output, testId = 0; if (opts.objectMode) { output = through(); self.on('_push', function ontest(t, extra) { if (!extra) extra = {}; var id = testId++; t.once('prerun', function () { var row = { type: 'test', name: t.name, id: id }; if (has(extra, 'parent')) { row.parent = extra.parent; } output.queue(row); }); t.on('test', function (st) { ontest(st, { parent: id }); }); t.on('result', function (res) { res.test = id; res.type = 'assert'; output.queue(res); }); t.on('end', function () { output.queue({ type: 'end', test: id }); }); }); self.on('done', function () { output.queue(null) }); } else { output = resumer(); output.queue('TAP version 13\n'); self._stream.pipe(output); } if (!this._isRunning) { this._isRunning = true; nextTick(function next() { var t; while (t = getNextTest(self)) { t.run(); if (!t.ended) return t.once('end', function () { nextTick(next); }); } self.emit('done'); }); } return output; }; Results.prototype.push = function (t) { var self = this; self.tests.push(t); self._watch(t); self.emit('_push', t); }; Results.prototype.only = function (t) { this._only = t; }; Results.prototype._watch = function (t) { var self = this; var write = function (s) { self._stream.queue(s) }; t.once('prerun', function () { write('# ' + t.name + '\n'); }); t.on('result', function (res) { if (typeof res === 'string') { write('# ' + res + '\n'); return; } write(encodeResult(res, self.count + 1)); self.count ++; if (res.ok || res.todo) self.pass ++ else { self.fail ++; self.emit('fail'); } }); t.on('test', function (st) { self._watch(st) }); }; Results.prototype.close = function () { var self = this; if (self.closed) self._stream.emit('error', new Error('ALREADY CLOSED')); self.closed = true; var write = function (s) { self._stream.queue(s) }; write('\n1..' + self.count + '\n'); write('# tests ' + self.count + '\n'); write('# pass ' + (self.pass + self.todo) + '\n'); if (self.todo) write('# todo ' + self.todo + '\n'); if (self.fail) write('# fail ' + self.fail + '\n'); else write('\n# ok\n'); self._stream.queue(null); }; function encodeResult(res, count) { var output = ''; output += (res.ok ? 'ok ' : 'not ok ') + count; output += res.name ? ' ' + res.name.toString().replace(/\s+/g, ' ') : ''; if (res.skip) output += ' # SKIP'; else if (res.todo) output += ' # TODO'; output += '\n'; if (res.ok) return output; var outer = ' '; var inner = outer + ' '; output += outer + '---\n'; output += inner + 'operator: ' + res.operator + '\n'; if (has(res, 'expected') || has(res, 'actual')) { var ex = inspect(res.expected, {depth: res.objectPrintDepth}); var ac = inspect(res.actual, {depth: res.objectPrintDepth}); if (Math.max(ex.length, ac.length) > 65 || invalidYaml(ex) || invalidYaml(ac)) { output += inner + 'expected: |-\n' + inner + ' ' + ex + '\n'; output += inner + 'actual: |-\n' + inner + ' ' + ac + '\n'; } else { output += inner + 'expected: ' + ex + '\n'; output += inner + 'actual: ' + ac + '\n'; } } if (res.at) { output += inner + 'at: ' + res.at + '\n'; } var actualStack = res.actual && (typeof res.actual === 'object' || typeof res.actual === 'function') ? res.actual.stack : undefined; var errorStack = res.error && res.error.stack; var stack = defined(actualStack, errorStack); if (stack) { var lines = String(stack).split('\n'); output += inner + 'stack: |-\n'; for (var i = 0; i < lines.length; i++) { output += inner + ' ' + lines[i] + '\n'; } } output += outer + '...\n'; return output; } function getNextTest(results) { if (!results._only) { return results.tests.shift(); } do { var t = results.tests.shift(); if (!t) continue; if (results._only === t) { return t; } } while (results.tests.length !== 0) } function invalidYaml(str) { return regexpTest(yamlIndicators, str); } }).call(this,require('_process'),require("timers").setImmediate) },{"_process":36,"defined":10,"events":20,"function-bind":23,"has":24,"inherits":26,"object-inspect":30,"resumer":50,"through":62,"timers":63}],61:[function(require,module,exports){ (function (process,setImmediate,__dirname){ var deepEqual = require('deep-equal'); var defined = require('defined'); var path = require('path'); var inherits = require('inherits'); var EventEmitter = require('events').EventEmitter; var has = require('has'); var trim = require('string.prototype.trim'); var bind = require('function-bind'); var forEach = require('for-each'); var isEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable); var toLowerCase = bind.call(Function.call, String.prototype.toLowerCase); module.exports = Test; var nextTick = typeof setImmediate !== 'undefined' ? setImmediate : process.nextTick; var safeSetTimeout = setTimeout; var safeClearTimeout = clearTimeout; inherits(Test, EventEmitter); var getTestArgs = function (name_, opts_, cb_) { var name = '(anonymous)'; var opts = {}; var cb; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; var t = typeof arg; if (t === 'string') { name = arg; } else if (t === 'object') { opts = arg || opts; } else if (t === 'function') { cb = arg; } } return { name: name, opts: opts, cb: cb }; }; function Test(name_, opts_, cb_) { if (! (this instanceof Test)) { return new Test(name_, opts_, cb_); } var args = getTestArgs(name_, opts_, cb_); this.readable = true; this.name = args.name || '(anonymous)'; this.assertCount = 0; this.pendingCount = 0; this._skip = args.opts.skip || false; this._todo = args.opts.todo || false; this._timeout = args.opts.timeout; this._plan = undefined; this._cb = args.cb; this._progeny = []; this._ok = true; var depthEnvVar = process.env.NODE_TAPE_OBJECT_PRINT_DEPTH; if (args.opts.objectPrintDepth) { this._objectPrintDepth = args.opts.objectPrintDepth; } else if (depthEnvVar) { if (toLowerCase(depthEnvVar) === 'infinity') { this._objectPrintDepth = Infinity; } else { this._objectPrintDepth = depthEnvVar; } } else { this._objectPrintDepth = 5; } for (var prop in this) { this[prop] = (function bind(self, val) { if (typeof val === 'function') { return function bound() { return val.apply(self, arguments); }; } return val; })(this, this[prop]); } } Test.prototype.run = function () { if (this._skip) { this.comment('SKIP ' + this.name); } if (!this._cb || this._skip) { return this._end(); } if (this._timeout != null) { this.timeoutAfter(this._timeout); } this.emit('prerun'); this._cb(this); this.emit('run'); }; Test.prototype.test = function (name, opts, cb) { var self = this; var t = new Test(name, opts, cb); this._progeny.push(t); this.pendingCount++; this.emit('test', t); t.on('prerun', function () { self.assertCount++; }) if (!self._pendingAsserts()) { nextTick(function () { self._end(); }); } nextTick(function () { if (!self._plan && self.pendingCount == self._progeny.length) { self._end(); } }); }; Test.prototype.comment = function (msg) { var that = this; forEach(trim(msg).split('\n'), function (aMsg) { that.emit('result', trim(aMsg).replace(/^#\s*/, '')); }); }; Test.prototype.plan = function (n) { this._plan = n; this.emit('plan', n); }; Test.prototype.timeoutAfter = function (ms) { if (!ms) throw new Error('timeoutAfter requires a timespan'); var self = this; var timeout = safeSetTimeout(function () { self.fail('test timed out after ' + ms + 'ms'); self.end(); }, ms); this.once('end', function () { safeClearTimeout(timeout); }); } Test.prototype.end = function (err) { var self = this; if (arguments.length >= 1 && !!err) { this.ifError(err); } if (this.calledEnd) { this.fail('.end() called twice'); } this.calledEnd = true; this._end(); }; Test.prototype._end = function (err) { var self = this; if (this._progeny.length) { var t = this._progeny.shift(); t.on('end', function () { self._end() }); t.run(); return; } if (!this.ended) this.emit('end'); var pendingAsserts = this._pendingAsserts(); if (!this._planError && this._plan !== undefined && pendingAsserts) { this._planError = true; this.fail('plan != count', { expected : this._plan, actual : this.assertCount }); } this.ended = true; }; Test.prototype._exit = function () { if (this._plan !== undefined && !this._planError && this.assertCount !== this._plan) { this._planError = true; this.fail('plan != count', { expected : this._plan, actual : this.assertCount, exiting : true }); } else if (!this.ended) { this.fail('test exited without ending', { exiting: true }); } }; Test.prototype._pendingAsserts = function () { if (this._plan === undefined) { return 1; } return this._plan - (this._progeny.length + this.assertCount); }; Test.prototype._assert = function assert(ok, opts) { var self = this; var extra = opts.extra || {}; var res = { id: self.assertCount++, ok: Boolean(ok), skip: defined(extra.skip, opts.skip), todo: defined(extra.todo, opts.todo, self._todo), name: defined(extra.message, opts.message, '(unnamed assert)'), operator: defined(extra.operator, opts.operator), objectPrintDepth: self._objectPrintDepth }; if (has(opts, 'actual') || has(extra, 'actual')) { res.actual = defined(extra.actual, opts.actual); } if (has(opts, 'expected') || has(extra, 'expected')) { res.expected = defined(extra.expected, opts.expected); } this._ok = Boolean(this._ok && ok); if (!ok && !res.todo) { res.error = defined(extra.error, opts.error, new Error(res.name)); } if (!ok) { var e = new Error('exception'); var err = (e.stack || '').split('\n'); var dir = __dirname + path.sep; for (var i = 0; i < err.length; i++) { /* Stack trace lines may resemble one of the following. We need to should correctly extract a function name (if any) and path / line no. for each line. at myFunction (/path/to/file.js:123:45) at myFunction (/path/to/file.other-ext:123:45) at myFunction (/path to/file.js:123:45) at myFunction (C:\path\to\file.js:123:45) at myFunction (/path/to/file.js:123) at Test. (/path/to/file.js:123:45) at Test.bound [as run] (/path/to/file.js:123:45) at /path/to/file.js:123:45 Regex has three parts. First is non-capturing group for 'at ' (plus anything preceding it). /^(?:[^\s]*\s*\bat\s+)/ Second captures function call description (optional). This is not necessarily a valid JS function name, but just what the stack trace is using to represent a function call. It may look like `` or 'Test.bound [as run]'. For our purposes, we assume that, if there is a function name, it's everything leading up to the first open parentheses (trimmed) before our pathname. /(?:(.*)\s+\()?/ Last part captures file path plus line no (and optional column no). /((?:\/|[a-zA-Z]:\\)[^:\)]+:(\d+)(?::(\d+))?)/ */ var re = /^(?:[^\s]*\s*\bat\s+)(?:(.*)\s+\()?((?:\/|[a-zA-Z]:\\)[^:\)]+:(\d+)(?::(\d+))?)/ var m = re.exec(err[i]); if (!m) { continue; } var callDescription = m[1] || ''; var filePath = m[2]; if (filePath.slice(0, dir.length) === dir) { continue; } // Function call description may not (just) be a function name. // Try to extract function name by looking at first "word" only. res.functionName = callDescription.split(/\s+/)[0] res.file = filePath; res.line = Number(m[3]); if (m[4]) res.column = Number(m[4]); res.at = callDescription + ' (' + filePath + ')'; break; } } self.emit('result', res); var pendingAsserts = self._pendingAsserts(); if (!pendingAsserts) { if (extra.exiting) { self._end(); } else { nextTick(function () { self._end(); }); } } if (!self._planError && pendingAsserts < 0) { self._planError = true; self.fail('plan != count', { expected : self._plan, actual : self._plan - pendingAsserts }); } }; Test.prototype.fail = function (msg, extra) { this._assert(false, { message : msg, operator : 'fail', extra : extra }); }; Test.prototype.pass = function (msg, extra) { this._assert(true, { message : msg, operator : 'pass', extra : extra }); }; Test.prototype.skip = function (msg, extra) { this._assert(true, { message : msg, operator : 'skip', skip : true, extra : extra }); }; function assert(value, msg, extra) { this._assert(value, { message : defined(msg, 'should be truthy'), operator : 'ok', expected : true, actual : value, extra : extra }); } Test.prototype.ok = Test.prototype['true'] = Test.prototype.assert = assert; function notOK(value, msg, extra) { this._assert(!value, { message : defined(msg, 'should be falsy'), operator : 'notOk', expected : false, actual : value, extra : extra }); } Test.prototype.notOk = Test.prototype['false'] = Test.prototype.notok = notOK; function error(err, msg, extra) { this._assert(!err, { message : defined(msg, String(err)), operator : 'error', actual : err, extra : extra }); } Test.prototype.error = Test.prototype.ifError = Test.prototype.ifErr = Test.prototype.iferror = error; function equal(a, b, msg, extra) { this._assert(a === b, { message : defined(msg, 'should be equal'), operator : 'equal', actual : a, expected : b, extra : extra }); } Test.prototype.equal = Test.prototype.equals = Test.prototype.isEqual = Test.prototype.is = Test.prototype.strictEqual = Test.prototype.strictEquals = equal; function notEqual(a, b, msg, extra) { this._assert(a !== b, { message : defined(msg, 'should not be equal'), operator : 'notEqual', actual : a, expected : b, extra : extra }); } Test.prototype.notEqual = Test.prototype.notEquals = Test.prototype.notStrictEqual = Test.prototype.notStrictEquals = Test.prototype.isNotEqual = Test.prototype.isNot = Test.prototype.not = Test.prototype.doesNotEqual = Test.prototype.isInequal = notEqual; function tapeDeepEqual(a, b, msg, extra) { this._assert(deepEqual(a, b, { strict: true }), { message : defined(msg, 'should be equivalent'), operator : 'deepEqual', actual : a, expected : b, extra : extra }); } Test.prototype.deepEqual = Test.prototype.deepEquals = Test.prototype.isEquivalent = Test.prototype.same = tapeDeepEqual; function deepLooseEqual(a, b, msg, extra) { this._assert(deepEqual(a, b), { message : defined(msg, 'should be equivalent'), operator : 'deepLooseEqual', actual : a, expected : b, extra : extra }); } Test.prototype.deepLooseEqual = Test.prototype.looseEqual = Test.prototype.looseEquals = deepLooseEqual; function notDeepEqual(a, b, msg, extra) { this._assert(!deepEqual(a, b, { strict: true }), { message : defined(msg, 'should not be equivalent'), operator : 'notDeepEqual', actual : a, expected : b, extra : extra }); } Test.prototype.notDeepEqual = Test.prototype.notDeepEquals = Test.prototype.notEquivalent = Test.prototype.notDeeply = Test.prototype.notSame = Test.prototype.isNotDeepEqual = Test.prototype.isNotDeeply = Test.prototype.isNotEquivalent = Test.prototype.isInequivalent = notDeepEqual; function notDeepLooseEqual(a, b, msg, extra) { this._assert(!deepEqual(a, b), { message : defined(msg, 'should be equivalent'), operator : 'notDeepLooseEqual', actual : a, expected : b, extra : extra }); } Test.prototype.notDeepLooseEqual = Test.prototype.notLooseEqual = Test.prototype.notLooseEquals = notDeepLooseEqual; Test.prototype['throws'] = function (fn, expected, msg, extra) { if (typeof expected === 'string') { msg = expected; expected = undefined; } var caught = undefined; try { fn(); } catch (err) { caught = { error : err }; if ((err != null) && (!isEnumerable(err, 'message') || !has(err, 'message'))) { var message = err.message; delete err.message; err.message = message; } } var passed = caught; if (expected instanceof RegExp) { passed = expected.test(caught && caught.error); expected = String(expected); } if (typeof expected === 'function' && caught) { passed = caught.error instanceof expected; caught.error = caught.error.constructor; } this._assert(typeof fn === 'function' && passed, { message : defined(msg, 'should throw'), operator : 'throws', actual : caught && caught.error, expected : expected, error: !passed && caught && caught.error, extra : extra }); }; Test.prototype.doesNotThrow = function (fn, expected, msg, extra) { if (typeof expected === 'string') { msg = expected; expected = undefined; } var caught = undefined; try { fn(); } catch (err) { caught = { error : err }; } this._assert(!caught, { message : defined(msg, 'should not throw'), operator : 'throws', actual : caught && caught.error, expected : expected, error : caught && caught.error, extra : extra }); }; Test.skip = function (name_, _opts, _cb) { var args = getTestArgs.apply(null, arguments); args.opts.skip = true; return Test(args.name, args.opts, args.cb); }; // vim: set softtabstop=4 shiftwidth=4: }).call(this,require('_process'),require("timers").setImmediate,"/node_modules/tape/lib") },{"_process":36,"deep-equal":6,"defined":10,"events":20,"for-each":21,"function-bind":23,"has":24,"inherits":26,"path":34,"string.prototype.trim":54,"timers":63}],62:[function(require,module,exports){ (function (process){ var Stream = require('stream') // through // // a stream that does nothing but re-emit the input. // useful for aggregating a series of changing but not ending streams into one stream) exports = module.exports = through through.through = through //create a readable writable stream. function through (write, end, opts) { write = write || function (data) { this.queue(data) } end = end || function () { this.queue(null) } var ended = false, destroyed = false, buffer = [], _ended = false var stream = new Stream() stream.readable = stream.writable = true stream.paused = false // stream.autoPause = !(opts && opts.autoPause === false) stream.autoDestroy = !(opts && opts.autoDestroy === false) stream.write = function (data) { write.call(this, data) return !stream.paused } function drain() { while(buffer.length && !stream.paused) { var data = buffer.shift() if(null === data) return stream.emit('end') else stream.emit('data', data) } } stream.queue = stream.push = function (data) { // console.error(ended) if(_ended) return stream if(data === null) _ended = true buffer.push(data) drain() return stream } //this will be registered as the first 'end' listener //must call destroy next tick, to make sure we're after any //stream piped from here. //this is only a problem if end is not emitted synchronously. //a nicer way to do this is to make sure this is the last listener for 'end' stream.on('end', function () { stream.readable = false if(!stream.writable && stream.autoDestroy) process.nextTick(function () { stream.destroy() }) }) function _end () { stream.writable = false end.call(stream) if(!stream.readable && stream.autoDestroy) stream.destroy() } stream.end = function (data) { if(ended) return ended = true if(arguments.length) stream.write(data) _end() // will emit or queue return stream } stream.destroy = function () { if(destroyed) return destroyed = true ended = true buffer.length = 0 stream.writable = stream.readable = false stream.emit('close') return stream } stream.pause = function () { if(stream.paused) return stream.paused = true return stream } stream.resume = function () { if(stream.paused) { stream.paused = false stream.emit('resume') } drain() //may have become paused again, //as drain emits 'data'. if(!stream.paused) stream.emit('drain') return stream } return stream } }).call(this,require('_process')) },{"_process":36,"stream":52}],63:[function(require,module,exports){ (function (setImmediate,clearImmediate){ var nextTick = require('process/browser.js').nextTick; var apply = Function.prototype.apply; var slice = Array.prototype.slice; var immediateIds = {}; var nextImmediateId = 0; // DOM APIs, for completeness exports.setTimeout = function() { return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); }; exports.setInterval = function() { return new Timeout(apply.call(setInterval, window, arguments), clearInterval); }; exports.clearTimeout = exports.clearInterval = function(timeout) { timeout.close(); }; function Timeout(id, clearFn) { this._id = id; this._clearFn = clearFn; } Timeout.prototype.unref = Timeout.prototype.ref = function() {}; Timeout.prototype.close = function() { this._clearFn.call(window, this._id); }; // Does not start the time, just sets up the members needed. exports.enroll = function(item, msecs) { clearTimeout(item._idleTimeoutId); item._idleTimeout = msecs; }; exports.unenroll = function(item) { clearTimeout(item._idleTimeoutId); item._idleTimeout = -1; }; exports._unrefActive = exports.active = function(item) { clearTimeout(item._idleTimeoutId); var msecs = item._idleTimeout; if (msecs >= 0) { item._idleTimeoutId = setTimeout(function onTimeout() { if (item._onTimeout) item._onTimeout(); }, msecs); } }; // That's not how node.js implements it but the exposed api is the same. exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { var id = nextImmediateId++; var args = arguments.length < 2 ? false : slice.call(arguments, 1); immediateIds[id] = true; nextTick(function onNextTick() { if (immediateIds[id]) { // fn.call() is faster so we optimize for the common use-case // @see http://jsperf.com/call-apply-segu if (args) { fn.apply(null, args); } else { fn.call(null); } // Prevent ids from leaking exports.clearImmediate(id); } }); return id; }; exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { delete immediateIds[id]; }; }).call(this,require("timers").setImmediate,require("timers").clearImmediate) },{"process/browser.js":36,"timers":63}],64:[function(require,module,exports){ (function (global){ /** * Module exports. */ module.exports = deprecate; /** * Mark that a method should not be used. * Returns a modified function which warns once by default. * * If `localStorage.noDeprecation = true` is set, then it is a no-op. * * If `localStorage.throwDeprecation = true` is set, then deprecated functions * will throw an Error when invoked. * * If `localStorage.traceDeprecation = true` is set, then deprecated functions * will invoke `console.trace()` instead of `console.error()`. * * @param {Function} fn - the function to deprecate * @param {String} msg - the string to print to the console when `fn` is invoked * @returns {Function} a new "deprecated" version of `fn` * @api public */ function deprecate (fn, msg) { if (config('noDeprecation')) { return fn; } var warned = false; function deprecated() { if (!warned) { if (config('throwDeprecation')) { throw new Error(msg); } else if (config('traceDeprecation')) { console.trace(msg); } else { console.warn(msg); } warned = true; } return fn.apply(this, arguments); } return deprecated; } /** * Checks `localStorage` for boolean values for the given `name`. * * @param {String} name * @returns {Boolean} * @api private */ function config (name) { // accessing global.localStorage can trigger a DOMException in sandboxed iframes try { if (!global.localStorage) return false; } catch (_) { return false; } var val = global.localStorage[name]; if (null == val) return false; return String(val).toLowerCase() === 'true'; } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],65:[function(require,module,exports){ window.test = require('tape'); // Threebox = require("../src/Threebox.js"); // THREE = require("../src/three.js"); // window.runTests = function () { // // material(instance); // } function vector3Equals(t, input, expected, allowableError, epsilon) { // Check that two Vector3s are equal to each other, allowing for a certain percentage of error due to floating point math if (allowableError === undefined) allowableError = 0.0000001; if (epsilon === undefined) epsilon = 0.00000000000001; var dX, dY, dZ; dX = Math.abs(input.x - expected.x) / (expected.x === 0 ? 1 : expected.x); dY = Math.abs(input.y - expected.y) / (expected.y === 0 ? 1 : expected.y); dZ = Math.abs(input.z - expected.z) / (expected.z === 0 ? 1 : expected.z); if (dX < epsilon) dX = 0; if (dY < epsilon) dY = 0; if (dZ < epsilon) dZ = 0; if(dX > allowableError || dY > allowableError || dZ > allowableError) { t.fail("Vector3 Equivalence failed: (" + input.x + ", " + input.y + ", " + input.z + ") expected: (" + expected.x + ", " + expected.y + ", " + expected.z + ")"); console.log(dY); } t.pass("ok Vector3 equivalence"); } function precisionRound(number, precision) { var factor = Math.pow(10, precision); var tempNumber = number * factor; var roundedTempNumber = Math.round(tempNumber); return roundedTempNumber / factor; }; },{"tape":58}]},{},[65]); ================================================ FILE: tests/threebox-tests.html ================================================ Threebox tests Open the console to see test results
================================================ FILE: tests/threebox-tests.js ================================================ window.test = require('tape'); // Threebox = require("../src/Threebox.js"); // THREE = require("../src/three.js"); // window.runTests = function () { // // material(instance); // } function vector3Equals(t, input, expected, allowableError, epsilon) { // Check that two Vector3s are equal to each other, allowing for a certain percentage of error due to floating point math if (allowableError === undefined) allowableError = 0.0000001; if (epsilon === undefined) epsilon = 0.00000000000001; var dX, dY, dZ; dX = Math.abs(input.x - expected.x) / (expected.x === 0 ? 1 : expected.x); dY = Math.abs(input.y - expected.y) / (expected.y === 0 ? 1 : expected.y); dZ = Math.abs(input.z - expected.z) / (expected.z === 0 ? 1 : expected.z); if (dX < epsilon) dX = 0; if (dY < epsilon) dY = 0; if (dZ < epsilon) dZ = 0; if(dX > allowableError || dY > allowableError || dZ > allowableError) { t.fail("Vector3 Equivalence failed: (" + input.x + ", " + input.y + ", " + input.z + ") expected: (" + expected.x + ", " + expected.y + ", " + expected.z + ")"); console.log(dY); } t.pass("ok Vector3 equivalence"); } function precisionRound(number, precision) { var factor = Math.pow(10, precision); var tempNumber = number * factor; var roundedTempNumber = Math.round(tempNumber); return roundedTempNumber / factor; }; ================================================ FILE: tests/unit/camera.test.js ================================================ function cameraTest(instance){ } ================================================ FILE: tests/unit/material.test.js ================================================ function materialTest(instance){ var material; test('MATERIAL default type, color, opacity', function(t) { material = instance.material(); t.equal(material.type, 'MeshBasicMaterial'); t.deepEqual(material.color, { r: 0, g: 0, b: 0 }); t.equal(material.opacity, 1); t.end(); }); test('MATERIAL custom type', function(t) { material = instance.material({material:'MeshPhysicalMaterial'}); t.equal(material.opacity, 1); t.equal(material.type, 'MeshPhysicalMaterial'); t.deepEqual(material.color, { r: 0, g: 0, b: 0 }); t.end(); }); test('MATERIAL custom color', function(t) { material = instance.material({color:'red'}); t.equal(material.opacity, 1); t.equal(material.type, 'MeshBasicMaterial'); t.deepEqual(material.color, { r: 1, g: 0, b: 0 }); t.end(); }); test('MATERIAL custom opacity', function(t) { material = instance.material({opacity:0.5}); t.equal(material.opacity, 0.5); t.equal(material.type, 'MeshBasicMaterial'); t.deepEqual(material.color, { r: 0, g: 0, b: 0 }); t.end(); }); test('MATERIAL custom color, opacity, type', function(t) { allCustom = instance.material({ material: 'MeshBasicMaterial', opacity: 0.5, color: 'blue' }); t.equal(allCustom.opacity, 0.5); t.equal(allCustom.type, 'MeshBasicMaterial'); t.deepEqual(allCustom.color, { r: 0, g: 0, b: 1 }); t.end(); }); test('MATERIAL when THREE.Material provided, other material params ignored except opacity', function(t) { threeMaterial = instance.material({ material: new THREE.MeshBasicMaterial({color: 'cyan'}), opacity: 0.5, color: 'blue' }); t.equal(threeMaterial.opacity, 0.5); t.equal(threeMaterial.type, 'MeshBasicMaterial'); t.deepEqual(threeMaterial.color, { r: 0, g: 1, b: 1 }); t.end(); }); } ================================================ FILE: tests/unit/object.test.js ================================================ function objectTest(instance){ var mesh = new THREE.Mesh(); var group test('OBJECT _makeGroup from one object', function(t){ group = instance.objects._makeGroup(mesh, {foo: true}); t.equal(group.userData.foo, true); t.equal(group.type, 'Group'); t.equal(group.children.length, 1); t.end(); }); test('OBJECT _makeGroup from multiple objects', function(t){ var mesh2 = new THREE.Mesh(); group = instance.objects._makeGroup([mesh, mesh2], {foo: false}); t.equal(group.userData.foo, false); t.equal(group.type, 'Group'); t.equal(group.children.length, 2); t.end(); }) test('OBJECT _addMethods static', function(t){ group = instance.objects._makeGroup(mesh, {}); var addedMethods = instance.objects._addMethods(group, true); t.equal(addedMethods.setCoords, undefined); t.equal(addedMethods.type, 'Group'); t.end(); }) test('OBJECT _addMethods dynamic', function(t){ var sphere = instance.sphere({units: 'meters'}); t.equal(sphere.type, 'Group'); t.equal(typeof sphere.followPath, 'function'); t.deepEqual(sphere.coordinates, [0,0,0]); t.end(); }) test('OBJECT setCoords updates both position and scale', function(t){ var sphere = instance.sphere({units: 'meters'}); var newPosition = [0,-20]; sphere.setCoords(newPosition) var scaleFactor = instance.projectedUnitsPerMeter(newPosition[1]); vector3Equals(t, sphere.position, instance.projectToWorld(newPosition)); t.equal(sphere.scale.x, scaleFactor); t.deepEqual(sphere.coordinates, newPosition) t.end(); }) } ================================================ FILE: tests/unit/utilities.test.js ================================================ function utilitiesTest(instance){ test('PROJECTION project / unproject', function(t) { var coord, projected, expected; coord = [0,0,0]; var projected = instance.projectToWorld(coord); var unprojected = instance.unprojectFromWorld(projected); var expected = new THREE.Vector3(0,0,0); vector3Equals(t, projected, expected); vector3Equals(t, new THREE.Vector3(unprojected), new THREE.Vector3(expected)); coord = [30,30,0]; var projected = instance.projectToWorld(coord); var unprojected = instance.unprojectFromWorld(projected); var expected = new THREE.Vector3(-85333.33333333333, -89522.98305691125, 0); vector3Equals(t, projected, expected); vector3Equals(t, new THREE.Vector3(unprojected), new THREE.Vector3(expected)); coord = [30,-30,0]; var projected = instance.projectToWorld(coord); var unprojected = instance.unprojectFromWorld(projected); var expected = new THREE.Vector3(-85333.33333333333, -89522.9830569113, 0); vector3Equals(t, projected, expected); vector3Equals(t, new THREE.Vector3(unprojected), new THREE.Vector3(expected)); coord = [-30,30,0]; var projected = instance.projectToWorld(coord); var unprojected = instance.unprojectFromWorld(projected); var expected = new THREE.Vector3(-85333.33333333333, -89522.9830569113, 0); vector3Equals(t, projected, expected); vector3Equals(t, new THREE.Vector3(unprojected), new THREE.Vector3(expected)); coord = [-30,-30,0]; var projected = instance.projectToWorld(coord); var unprojected = instance.unprojectFromWorld(projected); var expected = new THREE.Vector3(-85333.33333333333, 89522.9830569113, 0); vector3Equals(t, projected, expected); vector3Equals(t, new THREE.Vector3(unprojected), new THREE.Vector3(expected)); t.end(); }); test('PROJECTION project / unproject extended lat/lng range', function(t) { var coord, projected, expected; coord = [180,0,0]; var projected = instance.projectToWorld(coord); var unprojected = instance.unprojectFromWorld(projected); var expected = new THREE.Vector3(-511999.99999999994,1.8093822187881337e-11,0); vector3Equals(t, projected, expected); vector3Equals(t, new THREE.Vector3(unprojected), new THREE.Vector3(expected)); coord = [-180,0,0]; var projected = instance.projectToWorld(coord); var unprojected = instance.unprojectFromWorld(projected); var expected = new THREE.Vector3(511999.99999999994,1.8093822187881337e-11,0); vector3Equals(t, projected, expected); vector3Equals(t, new THREE.Vector3(unprojected), new THREE.Vector3(expected)); coord = [0,90,0]; var projected = instance.projectToWorld(coord); var unprojected = instance.unprojectFromWorld(projected); var expected = new THREE.Vector3(0,-3042.073317352722,0); vector3Equals(t, projected, expected); vector3Equals(t, new THREE.Vector3(unprojected), new THREE.Vector3(expected)); coord = [0, 85.051129,0]; var projected = instance.projectToWorld(coord); var unprojected = instance.unprojectFromWorld(projected); var expected = new THREE.Vector3(0, -512000.00726036413, 0); vector3Equals(t, projected, expected); vector3Equals(t, new THREE.Vector3(unprojected), new THREE.Vector3(expected)); coord = [0, -85.051129,0]; var projected = instance.projectToWorld(coord); var unprojected = instance.unprojectFromWorld(projected); var expected = new THREE.Vector3(0, -512000.00726036413, 0); vector3Equals(t, projected, expected); vector3Equals(t, new THREE.Vector3(unprojected), new THREE.Vector3(expected)); coord = [300,0,0]; var projected = instance.projectToWorld(coord); var unprojected = instance.unprojectFromWorld(projected); var expected = new THREE.Vector3(-853333.3333333333,1.8093822187881337e-11,0); vector3Equals(t, projected, expected); vector3Equals(t, new THREE.Vector3(unprojected), new THREE.Vector3(expected)); t.end(); }); test('PROJECTION with altitude', function(t) { var coord, projected, expected; coord = [0,0,10000]; var projected = instance.projectToWorld(coord); var expected = new THREE.Vector3(0,0,255.52089831565812); vector3Equals(t, projected, expected); coord = [0,0,-10000]; var projected = instance.projectToWorld(coord); var expected = new THREE.Vector3(0,0,-255.52089831565812); vector3Equals(t, projected, expected); t.end(); }); test('PROJECTION projectedUnitsPerMeter', function(t) { var pupm1 = instance.projectedUnitsPerMeter(10); var pupm2 = instance.projectedUnitsPerMeter(-35); t.equals(pupm1, 0.025946272004267072); t.equals(pupm2, 0.03119334195612554); t.end(); }); // test('PROJECTION project / unproject invalid input', function(t) { // // TODO: Check for null/undefined/NaN values // t.end(); // }); test('NORMALIZEVERTICES', function(t){ var input = [ new THREE.Vector3(100, 101, 102), new THREE.Vector3(103, 104, 105) ]; var normalized = instance.utils.normalizeVertices(input); t.deepEqual( normalized.position, { x: 101.5, y: 102.5, z: 103.5 } ); t.deepEqual( normalized.vertices, [ {x: -1.5, y: -1.5, z: -1.5}, {x: 1.5, y: 1.5, z: 1.5} ] ); t.end(); }) var defaults = { foo: 'bar', biz: false } test('VALIDATOR empty input', function(t) { var output = instance.utils._validate({}, defaults); t.deepEqual(output, defaults); t.end(); }); test('VALIDATOR does not overwrite unknown props', function(t) { var output = instance.utils._validate({a:true}, defaults); t.deepEqual(output, { foo: 'bar', biz: false, a: true }); t.end(); }); test('VALIDATOR missing required params throw error', function(t) { var output = instance.utils._validate({}, {b: null}); t.error(output, 'proper error'); t.end(); }); } ================================================ FILE: tests/unit/validate.test.js ================================================ function validateTest(instance){ var v = instance.utils.Validator; // Coords validation test('VALIDATE invalid Coords', function(t){ t.error(v.Coords(true), 'error'); t.error(v.Coords(['a']), 'error'); t.error(v.Coords([1]), 'error'); t.error(v.Coords([3, false]), 'error'); t.end(); }); test('VALIDATE valid Coords', function(t){ t.deepEqual(v.Coords([22,33]), [22,33]); t.deepEqual(v.Coords([22,33,-10]), [22,33, -10]); t.end(); }); // Line validation test('VALIDATE invalid Line', function(t){ t.error(v.Line([[1,2], [false, 4]]), 'error'); t.end(); }); test('VALIDATE valid Line', function(t){ t.deepEqual(v.Line([[-100, 20], [22,33]]), [[-100, 20], [22,33]]); t.end(); }); // Rotation validation test('VALIDATE invalid Rotation', function(t){ t.error(v.Rotation('rotate'), 'error'); t.end(); }); test('VALIDATE valid Rotation', function(t){ t.deepEqual(v.Rotation(40), {z:40}); t.deepEqual(v.Rotation({x:20, y:10, z:90}), {x:20, y:10, z:90}); t.end(); }); // Scale validation test('VALIDATE invalid Scale', function(t){ t.error(v.Scale('scale'), 'error'); t.end(); }); test('VALIDATE valid Scale', function(t){ t.deepEqual(v.Scale(22), {x:22, y:22, z:22}); t.deepEqual(v.Scale({x:20, y:10, z:90}), {x:20, y:10, z:90}); t.end(); }); }