diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d87b1d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/* diff --git a/dgi_3d_viewer.info.yml b/dgi_3d_viewer.info.yml index 0547bfc..4da1297 100644 --- a/dgi_3d_viewer.info.yml +++ b/dgi_3d_viewer.info.yml @@ -3,3 +3,15 @@ description: View 3D objects in Drupal. package: Media type: module core_version_requirement: ^9 +dependencies: + - entity_reference_revisions:entity_reference_revisions + - drupal:field + - field_group:field_group + - drupal:file + - filehash:filehash + - drupal:language + - drupal:media + - paragraphs:paragraphs + - drupal:path + - islandora:islandora + - islandora_defaults:islandora_defaults diff --git a/dgi_3d_viewer.libraries.yml b/dgi_3d_viewer.libraries.yml index b6d4934..8fbc411 100644 --- a/dgi_3d_viewer.libraries.yml +++ b/dgi_3d_viewer.libraries.yml @@ -1,7 +1,7 @@ # Test library for compiling threejs pieces into a single file. test_threejs: js: - js/test_threejs.js: + js/dist/test_threejs.js: attributes: type: module dependencies: @@ -12,7 +12,7 @@ test_threejs: # The compiled js for rendering a viewer powered by Three.js dgi_3d_viewer: js: - js/dgi_3d_viewer.js: + js/dist/dgi_3d_viewer.js: attributes: type: module dependencies: diff --git a/dgi_3d_viewer.module b/dgi_3d_viewer.module new file mode 100644 index 0000000..9826c2b --- /dev/null +++ b/dgi_3d_viewer.module @@ -0,0 +1,77 @@ +bundle() !== '3d_object') { + return; + } + $camera = $media->get('field_camera')->referencedEntities()[0] ?? NULL; + + if (!$camera) { + $media->field_customcamera = NULL; + return; + } + + $camera_settings = dgi_3d_viewer_flatten_camera_values($camera); + + $media->field_customcamera = serialize($camera_settings); +} + +/** + * Flatten camera values. + */ +function dgi_3d_viewer_flatten_camera_values(ParagraphInterface $camera) { + $type = $camera->bundle(); + $camera_settings = [ + 'settings' => [ + 'near' => $camera->field_near->value, + 'far' => $camera->field_far->value, + 'position' => [ + 'x' => $camera->field_position_x->value, + 'y' => $camera->field_position_y->value, + 'z' => $camera->field_position_z->value, + ], + 'rotation' => [ + 'x' => $camera->field_rotation_x->value, + 'y' => $camera->field_rotation_y->value, + 'z' => $camera->field_rotation_z->value, + ], + ], + ]; + switch ($type) { + case 'orthographic_camera_settings': + $camera_settings['type'] = 'OrthographicCamera'; + $camera_settings['settings']['top'] = $camera->field_top->value; + $camera_settings['settings']['bottom'] = $camera->field_bottom->value; + $camera_settings['settings']['left'] = $camera->field_left->value; + $camera_settings['settings']['right'] = $camera->field_right->value; + break; + + case 'perspective_camera_settings': + $camera_settings['type'] = 'PerspectiveCamera'; + $camera_settings['settings']['aspect'] = $camera->field_aspect->value; + $camera_settings['settings']['fov'] = $camera->field_fov->value; + break; + } + + return $camera_settings; +} + +/** + * Implements hook_js_settings_alter(). + */ +function dgi_3d_viewer_js_settings_alter(array &$settings, AttachedAssetsInterface $assets) { + // Check if prod split is enabled. + $settings['isProd'] = \Drupal::config('config_split.config_split.prod')->get('status'); +} diff --git a/js/ThreeDViewer.js b/js/ThreeDViewer.js new file mode 100644 index 0000000..b65134a --- /dev/null +++ b/js/ThreeDViewer.js @@ -0,0 +1,315 @@ +import * as THREE from 'three'; +import {GLTFLoader} from 'addons/loaders/GLTFLoader.js'; +import {OBJLoader} from 'addons/loaders/OBJLoader.js'; +import {MTLLoader} from 'addons/loaders/MTLLoader.js'; +import {OrbitControls} from 'addons/controls/OrbitControls.js'; +import * as JSZip from 'jszip'; +import * as JSZipUtils from 'jszip-utils'; + +export class ThreeDViewer { + + constructor(container, settings, isProd) { + this.log = !isProd; + this.container = container; + this.scene = new THREE.Scene(); + this.scene.background = new THREE.Color(0x111111); + this.settings = settings; + this.camera = new THREE.PerspectiveCamera(67, window.innerWidth / window.innerHeight, 0.1, 800); + this.camera.position.set(0, 1, -10); + this.renderer = new THREE.WebGLRenderer({antialias: true}); + this.manager = new THREE.LoadingManager(); + this.materials = []; + this.loader = []; + + this.setRendererSettings(); + + this.container.appendChild(this.renderer.domElement); + + // Instantiate only once. + if (this.container.classList.contains(this.settings.canvas_loaded_class)) { + throw "Attempted to load ThreeJS viewer, but it has already been loaded."; + } + else { + // Flag that the viewer has been loaded. + this.container.classList.add(this.settings.canvas_loaded_class); + } + + // Add event listener for resize event. + window.addEventListener('resize', this.onWindowResize.bind(this)); + } + + + loadModel(url, fileType = 'gltf') { + // Add a loader. + var progressClass = this.settings.progress_element_classes; + this.manager.onProgress = function (item, loaded, total) { + let progress = Math.round(loaded / total * 100); + let progress_display = ''; + if (progress < 100) { + progress_display = progress + '%'; + } + document.getElementsByClassName(progressClass)[0].innerText = progress_display; + }; + + // loader.load(url, this.onModelLoaded.bind(this)); + switch (this.settings.model_ext) { + case "obj": + this.loadObj(url); + break; + case "glb": + case "gltf": + default: + this.loadGltf(url); + break; + } + } + + createCameraFromSettings() { + if (this.settings.camera_settings.type === 'OrthographicCamera') { + this.camera = new THREE.OrthographicCamera( + this.settings.camera_settings.settings.left, + this.settings.camera_settings.settings.right, + this.settings.camera_settings.settings.top, + this.settings.camera_settings.settings.bottom, + this.settings.camera_settings.settings.near, + this.settings.camera_settings.settings.far + ); + } else if (this.settings.camera_settings.type == 'PerspectiveCamera') { + this.camera = new THREE.PerspectiveCamera( + this.settings.camera_settings.settings.fov, + this.settings.camera_settings.settings.aspect, + this.settings.camera_settings.settings.near, + this.settings.camera_settings.settings.far + ); + } + + this.camera.position.set( + this.settings.camera_settings.settings.position.x, + this.settings.camera_settings.settings.position.y, + this.settings.camera_settings.settings.position.z + ); + this.camera.rotation.set( + this.settings.camera_settings.settings.rotation.x, + this.settings.camera_settings.settings.rotation.y, + this.settings.camera_settings.settings.rotation.z + ); + } + + onObjLoaded(obj) { + + // let box = new THREE.Box3().setFromObject(obj); + obj = this.centerAndScaleObject(obj); + + this.scene.add(obj); + + // Override camera from settings. + if ("camera_settings" in this.settings) { + this.log && console.log('Using overridden camera from camera settings.'); + this.createCameraFromSettings(); + } else { + this.log && console.log('Using default camera.' + this.camera.type); + } + + // Override light. + if ("light" in this.settings) { + this.log && console.log('Using overridden light from settings.'); + this.createLightFromSettings(); + } else { + this.log && console.log('Using default light.'); + let light = new THREE.AmbientLight(); // White light + this.scene.add(light); + } + + // Instantiating controls in the constructor does not work + // because we are updating camera dynamically. + this.controls = new OrbitControls(this.camera, this.renderer.domElement); + this.render(); + } + + onGLTFLoaded(gltf) { + this.scene.add(gltf.scene); + + // Override camera from settings. + if ("camera_settings" in this.settings) { + this.log && console.log('Using overridden camera from camera settings.'); + this.createCameraFromSettings(); + } + // Add camera from file. + else if (gltf.cameras.length > 0) { + this.log && console.log('Using camera from uploaded file.'); + this.camera = gltf.cameras[0]; + } + + // Override light. + if ("light" in this.settings) { + this.log && console.log('Using overridden light from settings.'); + this.createLightFromSettings(); + } else if (!this.hasLights(gltf)) { + this.log && console.log('Using default light.'); + let light = new THREE.AmbientLight(); // White light + this.scene.add(light); + } + + // Instantiating controls in the constructor does not work + // because we are updating camera dynamically. + this.controls = new OrbitControls(this.camera, this.renderer.domElement); + this.render(); + } + + createLightFromSettings() { + var light = []; + switch (this.settings.light) { + case 'PointLight': + light = new THREE.PointLight(); + break; + case 'DirectionalLight': + light = new THREE.DirectionalLight(); + break; + case 'SpotLight': + light = new THREE.SpotLight(); + break; + case 'HemisphereLight': + light = new THREE.HemisphereLight(); + break; + case 'AmbientLight': + default: + light = new THREE.AmbientLight(); + break; + } + + this.scene.add(light); + } + + hasLights(gltf) { + let hasLights = false; + + gltf.scene.traverse((child) => { + if (child instanceof THREE.Light) { + hasLights = true; + } + }); + + return hasLights; + } + + onWindowResize() { + this.camera.aspect = window.innerWidth / window.innerHeight; + this.camera.updateProjectionMatrix(); + this.renderer.setSize(window.innerWidth, window.innerHeight); + } + + render() { + this.resizeCanvasToDisplaySize(); + this.controls.update(); + this.renderer.render(this.scene, this.camera); + requestAnimationFrame(this.render.bind(this)); + } + + setRendererSettings() { + // Just a size for the renderer to start with. + // This will be updated in the render() function. + this.renderer.setSize(window.innerWidth, window.innerHeight); + // Make sure the renderer canvas is responsive. + // Rather than triggering a resize event, we just set the size of the + // canvas to the size of the container element. + this.renderer.domElement.style.maxWidth = '100%'; + this.renderer.domElement.style.maxHeight = '100%'; + this.renderer.domElement.style.objectFit = 'contain'; + } + + // getMaterialsFromMtl() { + // const loadingManager = new THREE.LoadingManager(); + // JSZipUtils.getBinaryContent(this.settings.compressed_resources_url, function (err, data) { + // if (err) { + // console.log(err); + // } + // + // const mtlLoader = new MTLLoader(loadingManager); + // + // JSZip.loadAsync(data) + // .then(function (zip) { + // zip.forEach(function (relativePath, file) { + // loadingManager.setURLModifier(relativePath); + // console.log(relativePath); + // + // if (relativePath.match(/\.(mtl)$/i)) { + // file.async("string") + // .then(function (content) { + // this.loader.createMaterial(mtlLoader.parse(content)); + // }); + // } + // }); + // }); + // }); + // } + + + loadGltf(url) { + this.log && console.log('Beginning to render ' + url + ' with gltf loader'); + this.loader = new GLTFLoader(this.manager); + this.loader.load(url, this.onGLTFLoaded.bind(this)); + } + + loadObj(url) { + this.log && console.log('Beginning to render ' + url + ' with obj loader'); + this.loader = new OBJLoader(this.manager); + if ("compressed_resources_url" in this.settings) { + console.log('ca;l func'); + // this.getMaterialsFromMtl.bind(this); + console.log('here'); + const loadingManager = new THREE.LoadingManager(); + JSZipUtils.getBinaryContent(this.settings.compressed_resources_url, function (err, data) { + if (err) { + console.log(err); + } + + const mtlLoader = new MTLLoader(loadingManager); + + JSZip.loadAsync(data) + .then(function (zip) { + zip.forEach(function (relativePath, file) { + console.log(relativePath); + if (relativePath.match(/\.(mtl)$/i)) { + file.async("string") + .then(function (content) { + this.loader.createMaterial(mtlLoader.parse(content)); + }); + } + }); + }); + }); + } + + this.loader.load(url, this.onObjLoaded.bind(this)); + } + + resizeCanvasToDisplaySize() { + const canvas = this.renderer.domElement; + const width = canvas.clientWidth; + const height = canvas.clientHeight; + + if (canvas.width !== width || canvas.height !== height) { + // you must pass false here or three.js sadly fights the browser + this.renderer.setSize(width, height, false); + this.camera.aspect = width / height; + this.camera.lookAt(0, 0, 0); + this.camera.updateProjectionMatrix(); + } + } + + centerAndScaleObject(obj) { + var box = new THREE.Box3().setFromObject(obj); + var center = new THREE.Vector3(); + box.getCenter(center); + obj.position.sub(center); // center the model + + // Scale. + let size = new THREE.Vector3(); + box.getSize(size); + var scaleVec = new THREE.Vector3(3, 3, 3).divide(size); + let scale = Math.min(scaleVec.x, Math.min(scaleVec.y, scaleVec.z)); + obj.scale.setScalar(scale); + + return obj; + } +} diff --git a/js/dgi_3d_viewer.es6.js b/js/dgi_3d_viewer.es6.js index 4d5bfb3..872ab66 100644 --- a/js/dgi_3d_viewer.es6.js +++ b/js/dgi_3d_viewer.es6.js @@ -2,55 +2,26 @@ * @file * A Drupal behavior to display a 3D model using ThreeJS. */ -import * as THREE from 'three'; // Import ThreeJS. -import { GLTFLoader } from 'addons/loaders/GLTFLoader.js'; // Import the GLTFLoader addon. -// TODO: Add support for other loaders. -// TODO: Add support for OrbitControls. -// Set mapping of file extensions to supported loaders. -const file_extension_to_loader = { - 'glb': GLTFLoader, - 'gltf': GLTFLoader, -}; +import {ThreeDViewer} from './ThreeDViewer.js'; -/** - * Setting up the Drupal behavior. - */ (function ($, Drupal, drupalSettings) { 'use strict'; + Drupal.behaviors.dgi3DViewer = { - /** - * Settings expected to be replaced by drupalSettings for this viewer. - */ - dgi3DViewerSettings: { - canvas_loaded_class: 'dgi-3d-viewer-canvas-loaded', - file_url: false, - container_classes: [ - 'dgi-3d-viewer-canvas' - ], - progress_element_classes: [ - 'dgi-3d-viewer-progress' - ], - perspective_camera_settings: { - fov: 50, - aspect: window.innerWidth / window.innerHeight, - near: 0.1, - far: 2000, - position: { - x: 0, - y: 0, - z: 25 - }, - rotation: { - x: 0, - y: 0, - z: 0 - } - } - }, - /** - * Attach the behavior. - * @param context - */ + /** + * Settings expected to be replaced by drupalSettings for this viewer. + */ + dgi3DViewerSettings: { + canvas_loaded_class: 'dgi-3d-viewer-canvas-loaded', + file_url: false, + model_ext: 'gltf', + container_classes: [ + 'dgi-3d-viewer-canvas' + ], + progress_element_classes: [ + 'dgi-3d-viewer-progress' + ], + }, attach: function (context) { // Get the settings from drupalSettings. if (drupalSettings.dgi3DViewer) { @@ -59,156 +30,31 @@ const file_extension_to_loader = { ...drupalSettings.dgi3DViewer }; } + + // Get the settings from drupalSettings. + const settings = this.dgi3DViewerSettings || {}; + // Get the container. - let container_classes = this.dgi3DViewerSettings.container_classes.join(' '); - const container = context.getElementsByClassName(container_classes)[0]; - if (container) { - // Verify that ThreeJS is loaded. - if (typeof THREE !== "undefined") { - // Verify that the viewer has not already been loaded. - if (!container.classList.contains(this.dgi3DViewerSettings.canvas_loaded_class)) { - // Get the path to the model. - let model_path = this.dgi3DViewerSettings.file_url; - if (!model_path) { - // This is present for debugging purposes. - console.error('File path to model is not defined.'); - } else { - // Get the type of model, and the name of the appropriate loader. - let model_ext = model_path ? model_path.split('.').pop() : 'undefined'; - if (model_ext in file_extension_to_loader) { - let loader_class = file_extension_to_loader[model_ext]; - this.renderThreeJS(model_path, loader_class, container); - } else { - // If this gets triggered, the field widget should be hardened to prevent it. - console.error('No loader currently supported for file extension: ' + model_ext); - } - } - } else { - // This is present for debugging purposes, not something the user needs to see. - console.log('Attempted to load ThreeJS viewer, but it has already been loaded.'); - } - } else { - // This is present for debugging purposes, not something the user needs to see. - console.error('THREE is undefined'); - } - } else { - // This likely means the element attaching this behavior needs to be hardened. - console.log('No container element found for placing the 3D viewer.'); - console.error('Expected to find an element with the following classes: ' + container_classes); - } - }, - renderThreeJS: function (model_path, loader_class, container) { - // Again, this is present for debugging purposes to facilitate development. - console.log('Beginning to render ' + model_path + ' with ' + loader_class.name + '.'); - const scene = new THREE.Scene(); - const loader = new loader_class(); - let camera = new THREE.PerspectiveCamera(); - let camera_settings = this.dgi3DViewerSettings.perspective_camera_settings; - // Setting this up as an array of Loader callbacks to allow for future expansion. - let onLoad = { - GLTFLoader: function ( gltf ) { - // Add the scene. - scene.add( gltf.scene ); - // If the scene has camera(s), use the first one for the viewer. - if (gltf.cameras.length > 0) { - camera = gltf.cameras[0]; - } - else { - // Useful for debugging camera usage and settings. - console.log('No camera found in file, creating a camera from settings.'); - if (camera_settings) { - camera = new THREE.PerspectiveCamera( - camera_settings.fov, - camera_settings.aspect, - camera_settings.near, - camera_settings.far - ); - camera.position.set( - camera_settings.position.x, - camera_settings.position.y, - camera_settings.position.z - ); - } - } - // Add lights if none exist. - // There is not a built-in way to check for lights in the GLTF file like there is for cameras. - // Therefore, we search the whole scene for lights, and stop if we find one. - if (scene.children.length > 0) { - let has_light = false; - function checkSceneForLights(child) { - if (!has_light) { - console.log(child.type); - if (child.children.length > 0) { - child.children.forEach(checkSceneForLights); - } - if (child instanceof THREE.Light) { - has_light = true; - } - } - } - scene.children.forEach(checkSceneForLights); - if (!has_light) { - console.log('No lights found in gltf file, adding default light.'); - let light = new THREE.AmbientLight(); // White light - scene.add( light ); - } - } - // The last step for the 'onLoad' callback is to render the scene. - render(); - } - }; + let container_classes = settings.container_classes.join(' '); + const threeViewerElement = context.getElementsByClassName(container_classes)[0]; - // Get the progress loader element. - const progress_element_classes = '.' + this.dgi3DViewerSettings.progress_element_classes.join(' .'); + // If the three-viewer element exists, create a new ThreeDViewer instance and attach it to the element. + if (threeViewerElement) { - // Pretty safe to generalize the loader.load() call to all supported - // loaders. We can only get to this point if the file extension is - // supported, and if the loader is defined. Looking through provided - // ThreeJS Loaders, they all seem to expect the same load() parameters. - // However, if a loader has a different expectation for load() - // parameters, that would be identified in implementation of support - // for that loader, and can be handled as a special case at that point. - loader.load( - model_path, // URL of model file to be loaded. - onLoad[loader_class.name], // Callback function to be executed on load. - function ( xhr ) { // Callback function to be executed on progress. - let progress = Math.round(xhr.loaded / xhr.total * 100); - let progress_display = ''; - if (progress < 100) { - progress_display = progress + '%'; - } - $(progress_element_classes, document).text(progress_display); - }, - function ( error ) { // Callback function to be executed on error. - console.error( 'An error happened:' + error ); - } - ); + try { + /** + * Sets up the view manager. + * @return {Viewer} + */ + const viewer = new ThreeDViewer(threeViewerElement, settings, drupalSettings.isProd ?? true); - // Set up the renderer. Currently, the same for all models. - const renderer = new THREE.WebGLRenderer( { antialias: true } ); - // Just a size for the renderer to start with. - // This will be updated in the render() function. - renderer.setSize( window.innerWidth, window.innerHeight ); - // Make sure the renderer canvas is responsive. - // Rather than triggering a resize event, we just set the size of the - // canvas to the size of the container element. - renderer.domElement.style.maxWidth = '100%'; - renderer.domElement.style.maxHeight = '100%'; - renderer.domElement.style.objectFit = 'contain'; - // Add the canvas to the container. - container.appendChild( renderer.domElement ); - // Flag that the viewer has been loaded. - container.classList.add(this.dgi3DViewerSettings.canvas_loaded_class); + viewer.loadModel(settings.file_url, settings.model_ext); + } + catch (err) { + drupalSettings.isProd && console.log("An error occurred: " + err); + } - function render() { - // These width and height values don't get set until the renderer is - // added to the DOM, so we have to wait until this point to set them. - camera.aspect = container.clientWidth / container.clientHeight; - renderer.setSize(container.clientWidth, container.clientHeight); - // This needs to be done anytime the camera is updated. - camera.updateProjectionMatrix(); - renderer.render( scene, camera ); } - } + }, }; }(jQuery, Drupal, drupalSettings)); diff --git a/js/dgi_3d_viewer.js b/js/dist/dgi_3d_viewer.js similarity index 89% rename from js/dgi_3d_viewer.js rename to js/dist/dgi_3d_viewer.js index 2f373c5..cda95ae 100644 --- a/js/dgi_3d_viewer.js +++ b/js/dist/dgi_3d_viewer.js @@ -7,16 +7,48 @@ * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ /******/ (() => { // webpackBootstrap -/******/ "use strict"; /******/ var __webpack_modules__ = ({ +/***/ "./js/ThreeDViewer.js": +/*!****************************!*\ + !*** ./js/ThreeDViewer.js ***! + \****************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ThreeDViewer\": () => (/* binding */ ThreeDViewer)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! three */ \"../../../libraries/three/build/three.module.js\");\n/* harmony import */ var addons_loaders_GLTFLoader_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! addons/loaders/GLTFLoader.js */ \"../../../libraries/three/examples/jsm/loaders/GLTFLoader.js\");\n/* harmony import */ var addons_loaders_OBJLoader_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! addons/loaders/OBJLoader.js */ \"../../../libraries/three/examples/jsm/loaders/OBJLoader.js\");\n/* harmony import */ var addons_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! addons/loaders/MTLLoader.js */ \"../../../libraries/three/examples/jsm/loaders/MTLLoader.js\");\n/* harmony import */ var addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! addons/controls/OrbitControls.js */ \"../../../libraries/three/examples/jsm/controls/OrbitControls.js\");\n/* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jszip */ \"./node_modules/jszip/dist/jszip.min.js\");\n/* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jszip__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var jszip_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jszip-utils */ \"./node_modules/jszip-utils/lib/index.js\");\n/* harmony import */ var jszip_utils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jszip_utils__WEBPACK_IMPORTED_MODULE_1__);\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n\n\n\n\n\n\n\nvar ThreeDViewer = /*#__PURE__*/function () {\n function ThreeDViewer(container, settings, isProd) {\n _classCallCheck(this, ThreeDViewer);\n this.log = !isProd;\n this.container = container;\n this.scene = new three__WEBPACK_IMPORTED_MODULE_2__.Scene();\n this.scene.background = new three__WEBPACK_IMPORTED_MODULE_2__.Color(0x111111);\n this.settings = settings;\n this.camera = new three__WEBPACK_IMPORTED_MODULE_2__.PerspectiveCamera(67, window.innerWidth / window.innerHeight, 0.1, 800);\n this.camera.position.set(0, 1, -10);\n this.renderer = new three__WEBPACK_IMPORTED_MODULE_2__.WebGLRenderer({\n antialias: true\n });\n this.manager = new three__WEBPACK_IMPORTED_MODULE_2__.LoadingManager();\n this.materials = [];\n this.loader = [];\n this.setRendererSettings();\n this.container.appendChild(this.renderer.domElement);\n\n // Instantiate only once.\n if (this.container.classList.contains(this.settings.canvas_loaded_class)) {\n throw \"Attempted to load ThreeJS viewer, but it has already been loaded.\";\n } else {\n // Flag that the viewer has been loaded.\n this.container.classList.add(this.settings.canvas_loaded_class);\n }\n\n // Add event listener for resize event.\n window.addEventListener('resize', this.onWindowResize.bind(this));\n }\n _createClass(ThreeDViewer, [{\n key: \"loadModel\",\n value: function loadModel(url) {\n var fileType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'gltf';\n // Add a loader.\n var progressClass = this.settings.progress_element_classes;\n this.manager.onProgress = function (item, loaded, total) {\n var progress = Math.round(loaded / total * 100);\n var progress_display = '';\n if (progress < 100) {\n progress_display = progress + '%';\n }\n document.getElementsByClassName(progressClass)[0].innerText = progress_display;\n };\n\n // loader.load(url, this.onModelLoaded.bind(this));\n switch (this.settings.model_ext) {\n case \"obj\":\n this.loadObj(url);\n break;\n case \"glb\":\n case \"gltf\":\n default:\n this.loadGltf(url);\n break;\n }\n }\n }, {\n key: \"createCameraFromSettings\",\n value: function createCameraFromSettings() {\n if (this.settings.camera_settings.type === 'OrthographicCamera') {\n this.camera = new three__WEBPACK_IMPORTED_MODULE_2__.OrthographicCamera(this.settings.camera_settings.settings.left, this.settings.camera_settings.settings.right, this.settings.camera_settings.settings.top, this.settings.camera_settings.settings.bottom, this.settings.camera_settings.settings.near, this.settings.camera_settings.settings.far);\n } else if (this.settings.camera_settings.type == 'PerspectiveCamera') {\n this.camera = new three__WEBPACK_IMPORTED_MODULE_2__.PerspectiveCamera(this.settings.camera_settings.settings.fov, this.settings.camera_settings.settings.aspect, this.settings.camera_settings.settings.near, this.settings.camera_settings.settings.far);\n }\n this.camera.position.set(this.settings.camera_settings.settings.position.x, this.settings.camera_settings.settings.position.y, this.settings.camera_settings.settings.position.z);\n this.camera.rotation.set(this.settings.camera_settings.settings.rotation.x, this.settings.camera_settings.settings.rotation.y, this.settings.camera_settings.settings.rotation.z);\n }\n }, {\n key: \"onObjLoaded\",\n value: function onObjLoaded(obj) {\n // let box = new THREE.Box3().setFromObject(obj);\n obj = this.centerAndScaleObject(obj);\n this.scene.add(obj);\n\n // Override camera from settings.\n if (\"camera_settings\" in this.settings) {\n this.log && console.log('Using overridden camera from camera settings.');\n this.createCameraFromSettings();\n } else {\n this.log && console.log('Using default camera.' + this.camera.type);\n }\n\n // Override light.\n if (\"light\" in this.settings) {\n this.log && console.log('Using overridden light from settings.');\n this.createLightFromSettings();\n } else {\n this.log && console.log('Using default light.');\n var light = new three__WEBPACK_IMPORTED_MODULE_2__.AmbientLight(); // White light\n this.scene.add(light);\n }\n\n // Instantiating controls in the constructor does not work\n // because we are updating camera dynamically.\n this.controls = new addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_3__.OrbitControls(this.camera, this.renderer.domElement);\n this.render();\n }\n }, {\n key: \"onGLTFLoaded\",\n value: function onGLTFLoaded(gltf) {\n this.scene.add(gltf.scene);\n\n // Override camera from settings.\n if (\"camera_settings\" in this.settings) {\n this.log && console.log('Using overridden camera from camera settings.');\n this.createCameraFromSettings();\n }\n // Add camera from file.\n else if (gltf.cameras.length > 0) {\n this.log && console.log('Using camera from uploaded file.');\n this.camera = gltf.cameras[0];\n }\n\n // Override light.\n if (\"light\" in this.settings) {\n this.log && console.log('Using overridden light from settings.');\n this.createLightFromSettings();\n } else if (!this.hasLights(gltf)) {\n this.log && console.log('Using default light.');\n var light = new three__WEBPACK_IMPORTED_MODULE_2__.AmbientLight(); // White light\n this.scene.add(light);\n }\n\n // Instantiating controls in the constructor does not work\n // because we are updating camera dynamically.\n this.controls = new addons_controls_OrbitControls_js__WEBPACK_IMPORTED_MODULE_3__.OrbitControls(this.camera, this.renderer.domElement);\n this.render();\n }\n }, {\n key: \"createLightFromSettings\",\n value: function createLightFromSettings() {\n var light = [];\n switch (this.settings.light) {\n case 'PointLight':\n light = new three__WEBPACK_IMPORTED_MODULE_2__.PointLight();\n break;\n case 'DirectionalLight':\n light = new three__WEBPACK_IMPORTED_MODULE_2__.DirectionalLight();\n break;\n case 'SpotLight':\n light = new three__WEBPACK_IMPORTED_MODULE_2__.SpotLight();\n break;\n case 'HemisphereLight':\n light = new three__WEBPACK_IMPORTED_MODULE_2__.HemisphereLight();\n break;\n case 'AmbientLight':\n default:\n light = new three__WEBPACK_IMPORTED_MODULE_2__.AmbientLight();\n break;\n }\n this.scene.add(light);\n }\n }, {\n key: \"hasLights\",\n value: function hasLights(gltf) {\n var hasLights = false;\n gltf.scene.traverse(function (child) {\n if (child instanceof three__WEBPACK_IMPORTED_MODULE_2__.Light) {\n hasLights = true;\n }\n });\n return hasLights;\n }\n }, {\n key: \"onWindowResize\",\n value: function onWindowResize() {\n this.camera.aspect = window.innerWidth / window.innerHeight;\n this.camera.updateProjectionMatrix();\n this.renderer.setSize(window.innerWidth, window.innerHeight);\n }\n }, {\n key: \"render\",\n value: function render() {\n this.resizeCanvasToDisplaySize();\n this.controls.update();\n this.renderer.render(this.scene, this.camera);\n requestAnimationFrame(this.render.bind(this));\n }\n }, {\n key: \"setRendererSettings\",\n value: function setRendererSettings() {\n // Just a size for the renderer to start with.\n // This will be updated in the render() function.\n this.renderer.setSize(window.innerWidth, window.innerHeight);\n // Make sure the renderer canvas is responsive.\n // Rather than triggering a resize event, we just set the size of the\n // canvas to the size of the container element.\n this.renderer.domElement.style.maxWidth = '100%';\n this.renderer.domElement.style.maxHeight = '100%';\n this.renderer.domElement.style.objectFit = 'contain';\n }\n\n // getMaterialsFromMtl() {\n // const loadingManager = new THREE.LoadingManager();\n // JSZipUtils.getBinaryContent(this.settings.compressed_resources_url, function (err, data) {\n // if (err) {\n // console.log(err);\n // }\n //\n // const mtlLoader = new MTLLoader(loadingManager);\n //\n // JSZip.loadAsync(data)\n // .then(function (zip) {\n // zip.forEach(function (relativePath, file) {\n // loadingManager.setURLModifier(relativePath);\n // console.log(relativePath);\n //\n // if (relativePath.match(/\\.(mtl)$/i)) {\n // file.async(\"string\")\n // .then(function (content) {\n // this.loader.createMaterial(mtlLoader.parse(content));\n // });\n // }\n // });\n // });\n // });\n // }\n }, {\n key: \"loadGltf\",\n value: function loadGltf(url) {\n this.log && console.log('Beginning to render ' + url + ' with gltf loader');\n this.loader = new addons_loaders_GLTFLoader_js__WEBPACK_IMPORTED_MODULE_4__.GLTFLoader(this.manager);\n this.loader.load(url, this.onGLTFLoaded.bind(this));\n }\n }, {\n key: \"loadObj\",\n value: function loadObj(url) {\n this.log && console.log('Beginning to render ' + url + ' with obj loader');\n this.loader = new addons_loaders_OBJLoader_js__WEBPACK_IMPORTED_MODULE_5__.OBJLoader(this.manager);\n if (\"compressed_resources_url\" in this.settings) {\n console.log('ca;l func');\n // this.getMaterialsFromMtl.bind(this);\n console.log('here');\n var loadingManager = new three__WEBPACK_IMPORTED_MODULE_2__.LoadingManager();\n jszip_utils__WEBPACK_IMPORTED_MODULE_1__.getBinaryContent(this.settings.compressed_resources_url, function (err, data) {\n if (err) {\n console.log(err);\n }\n var mtlLoader = new addons_loaders_MTLLoader_js__WEBPACK_IMPORTED_MODULE_6__.MTLLoader(loadingManager);\n jszip__WEBPACK_IMPORTED_MODULE_0__.loadAsync(data).then(function (zip) {\n zip.forEach(function (relativePath, file) {\n console.log(relativePath);\n if (relativePath.match(/\\.(mtl)$/i)) {\n file.async(\"string\").then(function (content) {\n this.loader.createMaterial(mtlLoader.parse(content));\n });\n }\n });\n });\n });\n }\n this.loader.load(url, this.onObjLoaded.bind(this));\n }\n }, {\n key: \"resizeCanvasToDisplaySize\",\n value: function resizeCanvasToDisplaySize() {\n var canvas = this.renderer.domElement;\n var width = canvas.clientWidth;\n var height = canvas.clientHeight;\n if (canvas.width !== width || canvas.height !== height) {\n // you must pass false here or three.js sadly fights the browser\n this.renderer.setSize(width, height, false);\n this.camera.aspect = width / height;\n this.camera.lookAt(0, 0, 0);\n this.camera.updateProjectionMatrix();\n }\n }\n }, {\n key: \"centerAndScaleObject\",\n value: function centerAndScaleObject(obj) {\n var box = new three__WEBPACK_IMPORTED_MODULE_2__.Box3().setFromObject(obj);\n var center = new three__WEBPACK_IMPORTED_MODULE_2__.Vector3();\n box.getCenter(center);\n obj.position.sub(center); // center the model\n\n // Scale.\n var size = new three__WEBPACK_IMPORTED_MODULE_2__.Vector3();\n box.getSize(size);\n var scaleVec = new three__WEBPACK_IMPORTED_MODULE_2__.Vector3(3, 3, 3).divide(size);\n var scale = Math.min(scaleVec.x, Math.min(scaleVec.y, scaleVec.z));\n obj.scale.setScalar(scale);\n return obj;\n }\n }]);\n return ThreeDViewer;\n}();\n\n//# sourceURL=webpack://dgi_3d_viewer/./js/ThreeDViewer.js?"); + +/***/ }), + /***/ "./js/dgi_3d_viewer.es6.js": /*!*********************************!*\ !*** ./js/dgi_3d_viewer.es6.js ***! \*********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! three */ \"../../../libraries/three/build/three.module.js\");\n/* harmony import */ var addons_loaders_GLTFLoader_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! addons/loaders/GLTFLoader.js */ \"../../../libraries/three/examples/jsm/loaders/GLTFLoader.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/**\n * @file\n * A Drupal behavior to display a 3D model using ThreeJS.\n */\n // Import ThreeJS.\n // Import the GLTFLoader addon.\n// TODO: Add support for other loaders.\n// TODO: Add support for OrbitControls.\n// Set mapping of file extensions to supported loaders.\nvar file_extension_to_loader = {\n 'glb': addons_loaders_GLTFLoader_js__WEBPACK_IMPORTED_MODULE_0__.GLTFLoader,\n 'gltf': addons_loaders_GLTFLoader_js__WEBPACK_IMPORTED_MODULE_0__.GLTFLoader\n};\n\n/**\n * Setting up the Drupal behavior.\n */\n(function ($, Drupal, drupalSettings) {\n 'use strict';\n\n Drupal.behaviors.dgi3DViewer = {\n /**\n * Settings expected to be replaced by drupalSettings for this viewer.\n */\n dgi3DViewerSettings: {\n canvas_loaded_class: 'dgi-3d-viewer-canvas-loaded',\n file_url: false,\n container_classes: ['dgi-3d-viewer-canvas'],\n progress_element_classes: ['dgi-3d-viewer-progress'],\n perspective_camera_settings: {\n fov: 50,\n aspect: window.innerWidth / window.innerHeight,\n near: 0.1,\n far: 2000,\n position: {\n x: 0,\n y: 0,\n z: 25\n },\n rotation: {\n x: 0,\n y: 0,\n z: 0\n }\n }\n },\n /**\n * Attach the behavior.\n * @param context\n */\n attach: function attach(context) {\n // Get the settings from drupalSettings.\n if (drupalSettings.dgi3DViewer) {\n this.dgi3DViewerSettings = _objectSpread(_objectSpread({}, this.dgi3DViewerSettings), drupalSettings.dgi3DViewer);\n }\n // Get the container.\n var container_classes = this.dgi3DViewerSettings.container_classes.join(' ');\n var container = context.getElementsByClassName(container_classes)[0];\n if (container) {\n // Verify that ThreeJS is loaded.\n if (typeof three__WEBPACK_IMPORTED_MODULE_1__ !== \"undefined\") {\n // Verify that the viewer has not already been loaded.\n if (!container.classList.contains(this.dgi3DViewerSettings.canvas_loaded_class)) {\n // Get the path to the model.\n var model_path = this.dgi3DViewerSettings.file_url;\n if (!model_path) {\n // This is present for debugging purposes.\n console.error('File path to model is not defined.');\n } else {\n // Get the type of model, and the name of the appropriate loader.\n var model_ext = model_path ? model_path.split('.').pop() : 'undefined';\n if (model_ext in file_extension_to_loader) {\n var loader_class = file_extension_to_loader[model_ext];\n this.renderThreeJS(model_path, loader_class, container);\n } else {\n // If this gets triggered, the field widget should be hardened to prevent it.\n console.error('No loader currently supported for file extension: ' + model_ext);\n }\n }\n } else {\n // This is present for debugging purposes, not something the user needs to see.\n console.log('Attempted to load ThreeJS viewer, but it has already been loaded.');\n }\n } else {\n // This is present for debugging purposes, not something the user needs to see.\n console.error('THREE is undefined');\n }\n } else {\n // This likely means the element attaching this behavior needs to be hardened.\n console.log('No container element found for placing the 3D viewer.');\n console.error('Expected to find an element with the following classes: ' + container_classes);\n }\n },\n renderThreeJS: function renderThreeJS(model_path, loader_class, container) {\n // Again, this is present for debugging purposes to facilitate development.\n console.log('Beginning to render ' + model_path + ' with ' + loader_class.name + '.');\n var scene = new three__WEBPACK_IMPORTED_MODULE_1__.Scene();\n var loader = new loader_class();\n var camera = new three__WEBPACK_IMPORTED_MODULE_1__.PerspectiveCamera();\n var camera_settings = this.dgi3DViewerSettings.perspective_camera_settings;\n // Setting this up as an array of Loader callbacks to allow for future expansion.\n var onLoad = {\n GLTFLoader: function GLTFLoader(gltf) {\n // Add the scene.\n scene.add(gltf.scene);\n // If the scene has camera(s), use the first one for the viewer.\n if (gltf.cameras.length > 0) {\n camera = gltf.cameras[0];\n } else {\n // Useful for debugging camera usage and settings.\n console.log('No camera found in file, creating a camera from settings.');\n if (camera_settings) {\n camera = new three__WEBPACK_IMPORTED_MODULE_1__.PerspectiveCamera(camera_settings.fov, camera_settings.aspect, camera_settings.near, camera_settings.far);\n camera.position.set(camera_settings.position.x, camera_settings.position.y, camera_settings.position.z);\n }\n }\n // Add lights if none exist.\n // There is not a built-in way to check for lights in the GLTF file like there is for cameras.\n // Therefore, we search the whole scene for lights, and stop if we find one.\n if (scene.children.length > 0) {\n var checkSceneForLights = function checkSceneForLights(child) {\n if (!has_light) {\n console.log(child.type);\n if (child.children.length > 0) {\n child.children.forEach(checkSceneForLights);\n }\n if (child instanceof three__WEBPACK_IMPORTED_MODULE_1__.Light) {\n has_light = true;\n }\n }\n };\n var has_light = false;\n scene.children.forEach(checkSceneForLights);\n if (!has_light) {\n console.log('No lights found in gltf file, adding default light.');\n var light = new three__WEBPACK_IMPORTED_MODULE_1__.AmbientLight(); // White light\n scene.add(light);\n }\n }\n // The last step for the 'onLoad' callback is to render the scene.\n render();\n }\n };\n\n // Get the progress loader element.\n var progress_element_classes = '.' + this.dgi3DViewerSettings.progress_element_classes.join(' .');\n\n // Pretty safe to generalize the loader.load() call to all supported\n // loaders. We can only get to this point if the file extension is\n // supported, and if the loader is defined. Looking through provided\n // ThreeJS Loaders, they all seem to expect the same load() parameters.\n // However, if a loader has a different expectation for load()\n // parameters, that would be identified in implementation of support\n // for that loader, and can be handled as a special case at that point.\n loader.load(model_path,\n // URL of model file to be loaded.\n onLoad[loader_class.name],\n // Callback function to be executed on load.\n function (xhr) {\n // Callback function to be executed on progress.\n var progress = Math.round(xhr.loaded / xhr.total * 100);\n var progress_display = '';\n if (progress < 100) {\n progress_display = progress + '%';\n }\n $(progress_element_classes, document).text(progress_display);\n }, function (error) {\n // Callback function to be executed on error.\n console.error('An error happened:' + error);\n });\n\n // Set up the renderer. Currently, the same for all models.\n var renderer = new three__WEBPACK_IMPORTED_MODULE_1__.WebGLRenderer({\n antialias: true\n });\n // Just a size for the renderer to start with.\n // This will be updated in the render() function.\n renderer.setSize(window.innerWidth, window.innerHeight);\n // Make sure the renderer canvas is responsive.\n // Rather than triggering a resize event, we just set the size of the\n // canvas to the size of the container element.\n renderer.domElement.style.maxWidth = '100%';\n renderer.domElement.style.maxHeight = '100%';\n renderer.domElement.style.objectFit = 'contain';\n // Add the canvas to the container.\n container.appendChild(renderer.domElement);\n // Flag that the viewer has been loaded.\n container.classList.add(this.dgi3DViewerSettings.canvas_loaded_class);\n function render() {\n // These width and height values don't get set until the renderer is\n // added to the DOM, so we have to wait until this point to set them.\n camera.aspect = container.clientWidth / container.clientHeight;\n renderer.setSize(container.clientWidth, container.clientHeight);\n // This needs to be done anytime the camera is updated.\n camera.updateProjectionMatrix();\n renderer.render(scene, camera);\n }\n }\n };\n})(jQuery, Drupal, drupalSettings);\n\n//# sourceURL=webpack://dgi_3d_viewer/./js/dgi_3d_viewer.es6.js?"); +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _ThreeDViewer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ThreeDViewer.js */ \"./js/ThreeDViewer.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/**\n * @file\n * A Drupal behavior to display a 3D model using ThreeJS.\n */\n\n(function ($, Drupal, drupalSettings) {\n 'use strict';\n\n Drupal.behaviors.dgi3DViewer = {\n /**\n * Settings expected to be replaced by drupalSettings for this viewer.\n */\n dgi3DViewerSettings: {\n canvas_loaded_class: 'dgi-3d-viewer-canvas-loaded',\n file_url: false,\n model_ext: 'gltf',\n container_classes: ['dgi-3d-viewer-canvas'],\n progress_element_classes: ['dgi-3d-viewer-progress']\n },\n attach: function attach(context) {\n // Get the settings from drupalSettings.\n if (drupalSettings.dgi3DViewer) {\n this.dgi3DViewerSettings = _objectSpread(_objectSpread({}, this.dgi3DViewerSettings), drupalSettings.dgi3DViewer);\n }\n\n // Get the settings from drupalSettings.\n var settings = this.dgi3DViewerSettings || {};\n\n // Get the container.\n var container_classes = settings.container_classes.join(' ');\n var threeViewerElement = context.getElementsByClassName(container_classes)[0];\n\n // If the three-viewer element exists, create a new ThreeDViewer instance and attach it to the element.\n if (threeViewerElement) {\n try {\n var _drupalSettings$isPro;\n /**\n * Sets up the view manager.\n * @return {Viewer}\n */\n var viewer = new _ThreeDViewer_js__WEBPACK_IMPORTED_MODULE_0__.ThreeDViewer(threeViewerElement, settings, (_drupalSettings$isPro = drupalSettings.isProd) !== null && _drupalSettings$isPro !== void 0 ? _drupalSettings$isPro : true);\n viewer.loadModel(settings.file_url, settings.model_ext);\n } catch (err) {\n drupalSettings.isProd && console.log(\"An error occurred: \" + err);\n }\n }\n }\n };\n})(jQuery, Drupal, drupalSettings);\n\n//# sourceURL=webpack://dgi_3d_viewer/./js/dgi_3d_viewer.es6.js?"); + +/***/ }), + +/***/ "./node_modules/jszip-utils/lib/index.js": +/*!***********************************************!*\ + !*** ./node_modules/jszip-utils/lib/index.js ***! + \***********************************************/ +/***/ ((module) => { + +"use strict"; +eval("\n/*globals Promise */\n\nvar JSZipUtils = {};\n// just use the responseText with xhr1, response with xhr2.\n// The transformation doesn't throw away high-order byte (with responseText)\n// because JSZip handles that case. If not used with JSZip, you may need to\n// do it, see https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\nJSZipUtils._getBinaryFromXHR = function (xhr) {\n // for xhr.responseText, the 0xFF mask is applied by JSZip\n return xhr.response || xhr.responseText;\n};\n\n// taken from jQuery\nfunction createStandardXHR() {\n try {\n return new window.XMLHttpRequest();\n } catch( e ) {}\n}\n\nfunction createActiveXHR() {\n try {\n return new window.ActiveXObject(\"Microsoft.XMLHTTP\");\n } catch( e ) {}\n}\n\n// Create the request object\nvar createXHR = (typeof window !== \"undefined\" && window.ActiveXObject) ?\n /* Microsoft failed to properly\n * implement the XMLHttpRequest in IE7 (can't request local files),\n * so we use the ActiveXObject when it is available\n * Additionally XMLHttpRequest can be disabled in IE7/IE8 so\n * we need a fallback.\n */\n function() {\n return createStandardXHR() || createActiveXHR();\n} :\n // For all other browsers, use the standard XMLHttpRequest object\n createStandardXHR;\n\n\n/**\n * @param {string} path The path to the resource to GET.\n * @param {function|{callback: function, progress: function}} options\n * @return {Promise|undefined} If no callback is passed then a promise is returned\n */\nJSZipUtils.getBinaryContent = function (path, options) {\n var promise, resolve, reject;\n var callback;\n\n if (!options) {\n options = {};\n }\n\n // backward compatible callback\n if (typeof options === \"function\") {\n callback = options;\n options = {};\n } else if (typeof options.callback === 'function') {\n // callback inside options object\n callback = options.callback;\n }\n\n if (!callback && typeof Promise !== \"undefined\") {\n promise = new Promise(function (_resolve, _reject) {\n resolve = _resolve;\n reject = _reject;\n });\n } else {\n resolve = function (data) { callback(null, data); };\n reject = function (err) { callback(err, null); };\n }\n\n /*\n * Here is the tricky part : getting the data.\n * In firefox/chrome/opera/... setting the mimeType to 'text/plain; charset=x-user-defined'\n * is enough, the result is in the standard xhr.responseText.\n * cf https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Receiving_binary_data_in_older_browsers\n * In IE <= 9, we must use (the IE only) attribute responseBody\n * (for binary data, its content is different from responseText).\n * In IE 10, the 'charset=x-user-defined' trick doesn't work, only the\n * responseType will work :\n * http://msdn.microsoft.com/en-us/library/ie/hh673569%28v=vs.85%29.aspx#Binary_Object_upload_and_download\n *\n * I'd like to use jQuery to avoid this XHR madness, but it doesn't support\n * the responseType attribute : http://bugs.jquery.com/ticket/11461\n */\n try {\n var xhr = createXHR();\n\n xhr.open('GET', path, true);\n\n // recent browsers\n if (\"responseType\" in xhr) {\n xhr.responseType = \"arraybuffer\";\n }\n\n // older browser\n if(xhr.overrideMimeType) {\n xhr.overrideMimeType(\"text/plain; charset=x-user-defined\");\n }\n\n xhr.onreadystatechange = function (event) {\n // use `xhr` and not `this`... thanks IE\n if (xhr.readyState === 4) {\n if (xhr.status === 200 || xhr.status === 0) {\n try {\n resolve(JSZipUtils._getBinaryFromXHR(xhr));\n } catch(err) {\n reject(new Error(err));\n }\n } else {\n reject(new Error(\"Ajax error for \" + path + \" : \" + this.status + \" \" + this.statusText));\n }\n }\n };\n\n if(options.progress) {\n xhr.onprogress = function(e) {\n options.progress({\n path: path,\n originalEvent: e,\n percent: e.loaded / e.total * 100,\n loaded: e.loaded,\n total: e.total\n });\n };\n }\n\n xhr.send();\n\n } catch (e) {\n reject(new Error(e), null);\n }\n\n // returns a promise or undefined depending on whether a callback was\n // provided\n return promise;\n};\n\n// export\nmodule.exports = JSZipUtils;\n\n// enforcing Stuk's coding style\n// vim: set shiftwidth=4 softtabstop=4:\n\n\n//# sourceURL=webpack://dgi_3d_viewer/./node_modules/jszip-utils/lib/index.js?"); + +/***/ }), + +/***/ "./node_modules/jszip/dist/jszip.min.js": +/*!**********************************************!*\ + !*** ./node_modules/jszip/dist/jszip.min.js ***! + \**********************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +eval("/*!\n\nJSZip v3.10.1 - A JavaScript class for generating and reading zip files\n\n\n(c) 2009-2016 Stuart Knightley \nDual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.\n\nJSZip uses the library pako released under the MIT license :\nhttps://github.com/nodeca/pako/blob/main/LICENSE\n*/\n\n!function(e){if(true)module.exports=e();else {}}(function(){return function s(a,o,h){function u(r,e){if(!o[r]){if(!a[r]){var t=undefined;if(!e&&t)return require(r,!0);if(l)return l(r,!0);var n=new Error(\"Cannot find module '\"+r+\"'\");throw n.code=\"MODULE_NOT_FOUND\",n}var i=o[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return u(t||e)},i,i.exports,s,a,o,h)}return o[r].exports}for(var l=undefined,e=0;e>2,s=(3&t)<<4|r>>4,a=1>6:64,o=2>4,r=(15&i)<<4|(s=p.indexOf(e.charAt(o++)))>>2,n=(3&s)<<6|(a=p.indexOf(e.charAt(o++))),l[h++]=t,64!==s&&(l[h++]=r),64!==a&&(l[h++]=n);return l}},{\"./support\":30,\"./utils\":32}],2:[function(e,t,r){\"use strict\";var n=e(\"./external\"),i=e(\"./stream/DataWorker\"),s=e(\"./stream/Crc32Probe\"),a=e(\"./stream/DataLengthProbe\");function o(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}o.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a(\"data_length\")),t=this;return e.on(\"end\",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error(\"Bug : uncompressed data size mismatch\")}),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo(\"compressedSize\",this.compressedSize).withStreamInfo(\"uncompressedSize\",this.uncompressedSize).withStreamInfo(\"crc32\",this.crc32).withStreamInfo(\"compression\",this.compression)}},o.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new a(\"uncompressedSize\")).pipe(t.compressWorker(r)).pipe(new a(\"compressedSize\")).withStreamInfo(\"compression\",t)},t.exports=o},{\"./external\":6,\"./stream/Crc32Probe\":25,\"./stream/DataLengthProbe\":26,\"./stream/DataWorker\":27}],3:[function(e,t,r){\"use strict\";var n=e(\"./stream/GenericWorker\");r.STORE={magic:\"\\0\\0\",compressWorker:function(){return new n(\"STORE compression\")},uncompressWorker:function(){return new n(\"STORE decompression\")}},r.DEFLATE=e(\"./flate\")},{\"./flate\":7,\"./stream/GenericWorker\":28}],4:[function(e,t,r){\"use strict\";var n=e(\"./utils\");var o=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?\"string\"!==n.getTypeOf(e)?function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t[a])];return-1^e}(0|t,e,e.length,0):function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length,0):0}},{\"./utils\":32}],5:[function(e,t,r){\"use strict\";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){\"use strict\";var n=null;n=\"undefined\"!=typeof Promise?Promise:e(\"lie\"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){\"use strict\";var n=\"undefined\"!=typeof Uint8Array&&\"undefined\"!=typeof Uint16Array&&\"undefined\"!=typeof Uint32Array,i=e(\"pako\"),s=e(\"./utils\"),a=e(\"./stream/GenericWorker\"),o=n?\"uint8array\":\"array\";function h(e,t){a.call(this,\"FlateWorker/\"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic=\"\\b\\0\",s.inherits(h,a),h.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(o,e.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},r.compressWorker=function(e){return new h(\"Deflate\",e)},r.uncompressWorker=function(){return new h(\"Inflate\",{})}},{\"./stream/GenericWorker\":28,\"./utils\":32,pako:38}],8:[function(e,t,r){\"use strict\";function A(e,t){var r,n=\"\";for(r=0;r>>=8;return n}function n(e,t,r,n,i,s){var a,o,h=e.file,u=e.compression,l=s!==O.utf8encode,f=I.transformTo(\"string\",s(h.name)),c=I.transformTo(\"string\",O.utf8encode(h.name)),d=h.comment,p=I.transformTo(\"string\",s(d)),m=I.transformTo(\"string\",O.utf8encode(d)),_=c.length!==h.name.length,g=m.length!==d.length,b=\"\",v=\"\",y=\"\",w=h.dir,k=h.date,x={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(x.crc32=e.crc32,x.compressedSize=e.compressedSize,x.uncompressedSize=e.uncompressedSize);var S=0;t&&(S|=8),l||!_&&!g||(S|=2048);var z=0,C=0;w&&(z|=16),\"UNIX\"===i?(C=798,z|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(h.unixPermissions,w)):(C=20,z|=function(e){return 63&(e||0)}(h.dosPermissions)),a=k.getUTCHours(),a<<=6,a|=k.getUTCMinutes(),a<<=5,a|=k.getUTCSeconds()/2,o=k.getUTCFullYear()-1980,o<<=4,o|=k.getUTCMonth()+1,o<<=5,o|=k.getUTCDate(),_&&(v=A(1,1)+A(B(f),4)+c,b+=\"up\"+A(v.length,2)+v),g&&(y=A(1,1)+A(B(p),4)+m,b+=\"uc\"+A(y.length,2)+y);var E=\"\";return E+=\"\\n\\0\",E+=A(S,2),E+=u.magic,E+=A(a,2),E+=A(o,2),E+=A(x.crc32,4),E+=A(x.compressedSize,4),E+=A(x.uncompressedSize,4),E+=A(f.length,2),E+=A(b.length,2),{fileRecord:R.LOCAL_FILE_HEADER+E+f+b,dirRecord:R.CENTRAL_FILE_HEADER+A(C,2)+E+A(p.length,2)+\"\\0\\0\\0\\0\"+A(z,4)+A(n,4)+f+b+p}}var I=e(\"../utils\"),i=e(\"../stream/GenericWorker\"),O=e(\"../utf8\"),B=e(\"../crc32\"),R=e(\"../signature\");function s(e,t,r,n){i.call(this,\"ZipFileWorker\"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}I.inherits(s,i),s.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,i.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))},s.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},s.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=n(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return R.DATA_DESCRIPTOR+A(e.crc32,4)+A(e.compressedSize,4)+A(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},s.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return n.transformTo(\"string\",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{\"../utils\":32}],19:[function(e,t,r){\"use strict\";var n=e(\"./Uint8ArrayReader\");function i(e){n.call(this,e)}e(\"../utils\").inherits(i,n),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{\"../utils\":32,\"./Uint8ArrayReader\":21}],20:[function(e,t,r){\"use strict\";var n=e(\"./DataReader\");function i(e){n.call(this,e)}e(\"../utils\").inherits(i,n),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{\"../utils\":32,\"./DataReader\":18}],21:[function(e,t,r){\"use strict\";var n=e(\"./ArrayReader\");function i(e){n.call(this,e)}e(\"../utils\").inherits(i,n),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{\"../utils\":32,\"./ArrayReader\":17}],22:[function(e,t,r){\"use strict\";var n=e(\"../utils\"),i=e(\"../support\"),s=e(\"./ArrayReader\"),a=e(\"./StringReader\"),o=e(\"./NodeBufferReader\"),h=e(\"./Uint8ArrayReader\");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),\"string\"!==t||i.uint8array?\"nodebuffer\"===t?new o(e):i.uint8array?new h(n.transformTo(\"uint8array\",e)):new s(n.transformTo(\"array\",e)):new a(e)}},{\"../support\":30,\"../utils\":32,\"./ArrayReader\":17,\"./NodeBufferReader\":19,\"./StringReader\":20,\"./Uint8ArrayReader\":21}],23:[function(e,t,r){\"use strict\";r.LOCAL_FILE_HEADER=\"PK\u0003\u0004\",r.CENTRAL_FILE_HEADER=\"PK\u0001\u0002\",r.CENTRAL_DIRECTORY_END=\"PK\u0005\u0006\",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR=\"PK\u0006\u0007\",r.ZIP64_CENTRAL_DIRECTORY_END=\"PK\u0006\u0006\",r.DATA_DESCRIPTOR=\"PK\u0007\\b\"},{}],24:[function(e,t,r){\"use strict\";var n=e(\"./GenericWorker\"),i=e(\"../utils\");function s(e){n.call(this,\"ConvertWorker to \"+e),this.destType=e}i.inherits(s,n),s.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{\"../utils\":32,\"./GenericWorker\":28}],25:[function(e,t,r){\"use strict\";var n=e(\"./GenericWorker\"),i=e(\"../crc32\");function s(){n.call(this,\"Crc32Probe\"),this.withStreamInfo(\"crc32\",0)}e(\"../utils\").inherits(s,n),s.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{\"../crc32\":4,\"../utils\":32,\"./GenericWorker\":28}],26:[function(e,t,r){\"use strict\";var n=e(\"../utils\"),i=e(\"./GenericWorker\");function s(e){i.call(this,\"DataLengthProbe for \"+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(s,i),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=s},{\"../utils\":32,\"./GenericWorker\":28}],27:[function(e,t,r){\"use strict\";var n=e(\"../utils\"),i=e(\"./GenericWorker\");function s(e){i.call(this,\"DataWorker\");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type=\"\",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}n.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case\"string\":e=this.data.substring(this.index,t);break;case\"uint8array\":e=this.data.subarray(this.index,t);break;case\"array\":case\"nodebuffer\":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{\"../utils\":32,\"./GenericWorker\":28}],28:[function(e,t,r){\"use strict\";function n(e){this.name=e||\"default\",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit(\"data\",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit(\"end\"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit(\"error\",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit(\"error\",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r \"+e:e}},t.exports=n},{}],29:[function(e,t,r){\"use strict\";var h=e(\"../utils\"),i=e(\"./ConvertWorker\"),s=e(\"./GenericWorker\"),u=e(\"../base64\"),n=e(\"../support\"),a=e(\"../external\"),o=null;if(n.nodestream)try{o=e(\"../nodejs/NodejsStreamOutputAdapter\")}catch(e){}function l(e,o){return new a.Promise(function(t,r){var n=[],i=e._internalType,s=e._outputType,a=e._mimeType;e.on(\"data\",function(e,t){n.push(e),o&&o(t)}).on(\"error\",function(e){n=[],r(e)}).on(\"end\",function(){try{var e=function(e,t,r){switch(e){case\"blob\":return h.newBlob(h.transformTo(\"arraybuffer\",t),r);case\"base64\":return u.encode(t);default:return h.transformTo(e,t)}}(s,function(e,t){var r,n=0,i=null,s=0;for(r=0;r>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t}(e)},s.utf8decode=function(e){return h.nodebuffer?o.transformTo(\"nodebuffer\",e).toString(\"utf-8\"):function(e){var t,r,n,i,s=e.length,a=new Array(2*s);for(t=r=0;t>10&1023,a[r++]=56320|1023&n)}return a.length!==r&&(a.subarray?a=a.subarray(0,r):a.length=r),o.applyFromCharCode(a)}(e=o.transformTo(h.uint8array?\"uint8array\":\"array\",e))},o.inherits(a,n),a.prototype.processChunk=function(e){var t=o.transformTo(h.uint8array?\"uint8array\":\"array\",e.data);if(this.leftOver&&this.leftOver.length){if(h.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var n=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+u[e[r]]>t?r:t}(t),i=t;n!==t.length&&(h.uint8array?(i=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(i=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:s.utf8decode(i),meta:e.meta})},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=a,o.inherits(l,n),l.prototype.processChunk=function(e){this.push({data:s.utf8encode(e.data),meta:e.meta})},s.Utf8EncodeWorker=l},{\"./nodejsUtils\":14,\"./stream/GenericWorker\":28,\"./support\":30,\"./utils\":32}],32:[function(e,t,a){\"use strict\";var o=e(\"./support\"),h=e(\"./base64\"),r=e(\"./nodejsUtils\"),u=e(\"./external\");function n(e){return e}function l(e,t){for(var r=0;r>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||\"/\"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,r,n,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t},r.buf2binstring=function(e){return l(e,e.length)},r.binstring2buf=function(e){for(var t=new h.Buf8(e.length),r=0,n=t.length;r>10&1023,o[n++]=56320|1023&i)}return l(o,n)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+u[e[r]]>t?r:t}},{\"./common\":41}],43:[function(e,t,r){\"use strict\";t.exports=function(e,t,r,n){for(var i=65535&e|0,s=e>>>16&65535|0,a=0;0!==r;){for(r-=a=2e3>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,r){\"use strict\";var h,c=e(\"../utils/common\"),u=e(\"./trees\"),d=e(\"./adler32\"),p=e(\"./crc32\"),n=e(\"./messages\"),l=0,f=4,m=0,_=-2,g=-1,b=4,i=2,v=8,y=9,s=286,a=30,o=19,w=2*s+1,k=15,x=3,S=258,z=S+x+1,C=42,E=113,A=1,I=2,O=3,B=4;function R(e,t){return e.msg=n[t],t}function T(e){return(e<<1)-(4e.avail_out&&(r=e.avail_out),0!==r&&(c.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function N(e,t){u._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function U(e,t){e.pending_buf[e.pending++]=t}function P(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function L(e,t){var r,n,i=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match,h=e.strstart>e.w_size-z?e.strstart-(e.w_size-z):0,u=e.window,l=e.w_mask,f=e.prev,c=e.strstart+S,d=u[s+a-1],p=u[s+a];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===d&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&sh&&0!=--i);return a<=e.lookahead?a:e.lookahead}function j(e){var t,r,n,i,s,a,o,h,u,l,f=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-z)){for(c.arraySet(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=r=e.hash_size;n=e.head[--t],e.head[t]=f<=n?n-f:0,--r;);for(t=r=f;n=e.prev[--t],e.prev[t]=f<=n?n-f:0,--r;);i+=f}if(0===e.strm.avail_in)break;if(a=e.strm,o=e.window,h=e.strstart+e.lookahead,u=i,l=void 0,l=a.avail_in,u=x)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<=x&&(e.ins_h=(e.ins_h<=x)if(n=u._tr_tally(e,e.strstart-e.match_start,e.match_length-x),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=x){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=x&&(e.ins_h=(e.ins_h<=x&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-x,n=u._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-x),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(j(e),0===e.lookahead&&t===l)return A;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,N(e,!1),0===e.strm.avail_out))return A;if(e.strstart-e.block_start>=e.w_size-z&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):(e.strstart>e.block_start&&(N(e,!1),e.strm.avail_out),A)}),new M(4,4,8,4,Z),new M(4,5,16,8,Z),new M(4,6,32,32,Z),new M(4,4,16,16,W),new M(8,16,32,32,W),new M(8,16,128,128,W),new M(8,32,128,256,W),new M(32,128,258,1024,W),new M(32,258,258,4096,W)],r.deflateInit=function(e,t){return Y(e,t,v,15,8,0)},r.deflateInit2=Y,r.deflateReset=K,r.deflateResetKeep=G,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?_:(e.state.gzhead=t,m):_},r.deflate=function(e,t){var r,n,i,s;if(!e||!e.state||5>8&255),U(n,n.gzhead.time>>16&255),U(n,n.gzhead.time>>24&255),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(U(n,255&n.gzhead.extra.length),U(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(U(n,0),U(n,0),U(n,0),U(n,0),U(n,0),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,3),n.status=E);else{var a=v+(n.w_bits-8<<4)<<8;a|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=E,P(n,a),0!==n.strstart&&(P(n,e.adler>>>16),P(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending!==n.pending_buf_size));)U(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&F(e),n.pending+2<=n.pending_buf_size&&(U(n,255&e.adler),U(n,e.adler>>8&255),e.adler=0,n.status=E)):n.status=E),0!==n.pending){if(F(e),0===e.avail_out)return n.last_flush=-1,m}else if(0===e.avail_in&&T(t)<=T(r)&&t!==f)return R(e,-5);if(666===n.status&&0!==e.avail_in)return R(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==l&&666!==n.status){var o=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(j(e),0===e.lookahead)){if(t===l)return A;break}if(e.match_length=0,r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}(n,t):3===n.strategy?function(e,t){for(var r,n,i,s,a=e.window;;){if(e.lookahead<=S){if(j(e),e.lookahead<=S&&t===l)return A;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=x&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=x?(r=u._tr_tally(e,1,e.match_length-x),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}(n,t):h[n.level].func(n,t);if(o!==O&&o!==B||(n.status=666),o===A||o===O)return 0===e.avail_out&&(n.last_flush=-1),m;if(o===I&&(1===t?u._tr_align(n):5!==t&&(u._tr_stored_block(n,0,0,!1),3===t&&(D(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),F(e),0===e.avail_out))return n.last_flush=-1,m}return t!==f?m:n.wrap<=0?1:(2===n.wrap?(U(n,255&e.adler),U(n,e.adler>>8&255),U(n,e.adler>>16&255),U(n,e.adler>>24&255),U(n,255&e.total_in),U(n,e.total_in>>8&255),U(n,e.total_in>>16&255),U(n,e.total_in>>24&255)):(P(n,e.adler>>>16),P(n,65535&e.adler)),F(e),0=r.w_size&&(0===s&&(D(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new c.Buf8(r.w_size),c.arraySet(u,t,l-r.w_size,r.w_size,0),t=u,l=r.w_size),a=e.avail_in,o=e.next_in,h=e.input,e.avail_in=l,e.next_in=0,e.input=t,j(r);r.lookahead>=x;){for(n=r.strstart,i=r.lookahead-(x-1);r.ins_h=(r.ins_h<>>=y=v>>>24,p-=y,0===(y=v>>>16&255))C[s++]=65535&v;else{if(!(16&y)){if(0==(64&y)){v=m[(65535&v)+(d&(1<>>=y,p-=y),p<15&&(d+=z[n++]<>>=y=v>>>24,p-=y,!(16&(y=v>>>16&255))){if(0==(64&y)){v=_[(65535&v)+(d&(1<>>=y,p-=y,(y=s-a)>3,d&=(1<<(p-=w<<3))-1,e.next_in=n,e.next_out=s,e.avail_in=n>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new I.Buf16(320),this.work=new I.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=\"\",t.wrap&&(e.adler=1&t.wrap),t.mode=P,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new I.Buf32(n),t.distcode=t.distdyn=new I.Buf32(i),t.sane=1,t.back=-1,N):U}function o(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,a(e)):U}function h(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=s.wsize?(I.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n<(i=s.wsize-s.wnext)&&(i=n),I.arraySet(s.window,t,r-n,i,s.wnext),(n-=i)?(I.arraySet(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=B(r.check,E,2,0),l=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg=\"incorrect header check\",r.mode=30;break}if(8!=(15&u)){e.msg=\"unknown compression method\",r.mode=30;break}if(l-=4,k=8+(15&(u>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){e.msg=\"invalid window size\",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=3;case 3:for(;l<32;){if(0===o)break e;o--,u+=n[s++]<>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=B(r.check,E,4,0)),l=u=0,r.mode=4;case 4:for(;l<16;){if(0===o)break e;o--,u+=n[s++]<>8),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=5;case 5:if(1024&r.flags){for(;l<16;){if(0===o)break e;o--,u+=n[s++]<>>8&255,r.check=B(r.check,E,2,0)),l=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(o<(d=r.length)&&(d=o),d&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),I.arraySet(r.head.extra,n,s,d,k)),512&r.flags&&(r.check=B(r.check,n,d,s)),o-=d,s+=d,r.length-=d),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===o)break e;for(d=0;k=n[s+d++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k)),k&&d>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;l<32;){if(0===o)break e;o--,u+=n[s++]<>>=7&l,l-=7&l,r.mode=27;break}for(;l<3;){if(0===o)break e;o--,u+=n[s++]<>>=1)){case 0:r.mode=14;break;case 1:if(j(r),r.mode=20,6!==t)break;u>>>=2,l-=2;break e;case 2:r.mode=17;break;case 3:e.msg=\"invalid block type\",r.mode=30}u>>>=2,l-=2;break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break e;o--,u+=n[s++]<>>16^65535)){e.msg=\"invalid stored block lengths\",r.mode=30;break}if(r.length=65535&u,l=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(d=r.length){if(o>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,286>>=3,l-=3}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=T(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg=\"invalid code lengths set\",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>>=_,l-=_,r.lens[r.have++]=b;else{if(16===b){for(z=_+2;l>>=_,l-=_,0===r.have){e.msg=\"invalid bit length repeat\",r.mode=30;break}k=r.lens[r.have-1],d=3+(3&u),u>>>=2,l-=2}else if(17===b){for(z=_+3;l>>=_)),u>>>=3,l-=3}else{for(z=_+7;l>>=_)),u>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){e.msg=\"invalid bit length repeat\",r.mode=30;break}for(;d--;)r.lens[r.have++]=k}}if(30===r.mode)break;if(0===r.lens[256]){e.msg=\"invalid code -- missing end-of-block\",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},x=T(D,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg=\"invalid literal/lengths set\",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=T(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){e.msg=\"invalid distances set\",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=o&&258<=h){e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,R(e,c),a=e.next_out,i=e.output,h=e.avail_out,s=e.next_in,n=e.input,o=e.avail_in,u=r.hold,l=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;g=(C=r.lencode[u&(1<>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>>=v,l-=v,r.back+=v}if(u>>>=_,l-=_,r.back+=_,r.length=b,0===g){r.mode=26;break}if(32&g){r.back=-1,r.mode=12;break}if(64&g){e.msg=\"invalid literal/length code\",r.mode=30;break}r.extra=15&g,r.mode=22;case 22:if(r.extra){for(z=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;g=(C=r.distcode[u&(1<>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>>=v,l-=v,r.back+=v}if(u>>>=_,l-=_,r.back+=_,64&g){e.msg=\"invalid distance code\",r.mode=30;break}r.offset=b,r.extra=15&g,r.mode=24;case 24:if(r.extra){for(z=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg=\"invalid distance too far back\",r.mode=30;break}r.mode=25;case 25:if(0===h)break e;if(d=c-h,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){e.msg=\"invalid distance too far back\",r.mode=30;break}p=d>r.wnext?(d-=r.wnext,r.wsize-d):r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=i,p=a-r.offset,d=r.length;for(hd?(m=R[T+a[v]],A[I+a[v]]):(m=96,0),h=1<>S)+(u-=h)]=p<<24|m<<16|_|0,0!==u;);for(h=1<>=1;if(0!==h?(E&=h-1,E+=h):E=0,v++,0==--O[b]){if(b===w)break;b=t[r+a[v]]}if(k>>7)]}function U(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>d-r?(e.bi_buf|=t<>d-e.bi_valid,e.bi_valid+=r-d):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){var n,i,s=new Array(g+1),a=0;for(n=1;n<=g;n++)s[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var o=e[2*i+1];0!==o&&(e[2*i]=j(s[o]++,o))}}function W(e){var t;for(t=0;t>1;1<=r;r--)G(e,s,r);for(i=h;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,s,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,s[2*i]=s[2*r]+s[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,s[2*r+1]=s[2*n+1]=i,e.heap[1]=i++,G(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,s,a,o,h=t.dyn_tree,u=t.max_code,l=t.stat_desc.static_tree,f=t.stat_desc.has_stree,c=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(s=0;s<=g;s++)e.bl_count[s]=0;for(h[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<_;r++)p<(s=h[2*h[2*(n=e.heap[r])+1]+1]+1)&&(s=p,m++),h[2*n+1]=s,u>=7;n>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return o;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return h;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=i&&(i=s)):i=s=r+5,r+4<=i&&-1!==t?J(e,t,r,n):4===e.strategy||s===i?(P(e,2+(n?1:0),3),K(e,z,C)):(P(e,4+(n?1:0),3),function(e,t,r,n){var i;for(P(e,t-257,5),P(e,r-1,5),P(e,n-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(A[r]+u+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){P(e,2,3),L(e,m,z),function(e){16===e.bi_valid?(U(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{\"../utils/common\":41}],53:[function(e,t,r){\"use strict\";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=\"\",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(e){!function(r,n){\"use strict\";if(!r.setImmediate){var i,s,t,a,o=1,h={},u=!1,l=r.document,e=Object.getPrototypeOf&&Object.getPrototypeOf(r);e=e&&e.setTimeout?e:r,i=\"[object process]\"==={}.toString.call(r.process)?function(e){process.nextTick(function(){c(e)})}:function(){if(r.postMessage&&!r.importScripts){var e=!0,t=r.onmessage;return r.onmessage=function(){e=!1},r.postMessage(\"\",\"*\"),r.onmessage=t,e}}()?(a=\"setImmediate$\"+Math.random()+\"$\",r.addEventListener?r.addEventListener(\"message\",d,!1):r.attachEvent(\"onmessage\",d),function(e){r.postMessage(a+e,\"*\")}):r.MessageChannel?((t=new MessageChannel).port1.onmessage=function(e){c(e.data)},function(e){t.port2.postMessage(e)}):l&&\"onreadystatechange\"in l.createElement(\"script\")?(s=l.documentElement,function(e){var t=l.createElement(\"script\");t.onreadystatechange=function(){c(e),t.onreadystatechange=null,s.removeChild(t),t=null},s.appendChild(t)}):function(e){setTimeout(c,0,e)},e.setImmediate=function(e){\"function\"!=typeof e&&(e=new Function(\"\"+e));for(var t=new Array(arguments.length-1),r=0;r { +"use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ACESFilmicToneMapping\": () => (/* binding */ ACESFilmicToneMapping),\n/* harmony export */ \"AddEquation\": () => (/* binding */ AddEquation),\n/* harmony export */ \"AddOperation\": () => (/* binding */ AddOperation),\n/* harmony export */ \"AdditiveAnimationBlendMode\": () => (/* binding */ AdditiveAnimationBlendMode),\n/* harmony export */ \"AdditiveBlending\": () => (/* binding */ AdditiveBlending),\n/* harmony export */ \"AlphaFormat\": () => (/* binding */ AlphaFormat),\n/* harmony export */ \"AlwaysDepth\": () => (/* binding */ AlwaysDepth),\n/* harmony export */ \"AlwaysStencilFunc\": () => (/* binding */ AlwaysStencilFunc),\n/* harmony export */ \"AmbientLight\": () => (/* binding */ AmbientLight),\n/* harmony export */ \"AmbientLightProbe\": () => (/* binding */ AmbientLightProbe),\n/* harmony export */ \"AnimationAction\": () => (/* binding */ AnimationAction),\n/* harmony export */ \"AnimationClip\": () => (/* binding */ AnimationClip),\n/* harmony export */ \"AnimationLoader\": () => (/* binding */ AnimationLoader),\n/* harmony export */ \"AnimationMixer\": () => (/* binding */ AnimationMixer),\n/* harmony export */ \"AnimationObjectGroup\": () => (/* binding */ AnimationObjectGroup),\n/* harmony export */ \"AnimationUtils\": () => (/* binding */ AnimationUtils),\n/* harmony export */ \"ArcCurve\": () => (/* binding */ ArcCurve),\n/* harmony export */ \"ArrayCamera\": () => (/* binding */ ArrayCamera),\n/* harmony export */ \"ArrowHelper\": () => (/* binding */ ArrowHelper),\n/* harmony export */ \"Audio\": () => (/* binding */ Audio),\n/* harmony export */ \"AudioAnalyser\": () => (/* binding */ AudioAnalyser),\n/* harmony export */ \"AudioContext\": () => (/* binding */ AudioContext),\n/* harmony export */ \"AudioListener\": () => (/* binding */ AudioListener),\n/* harmony export */ \"AudioLoader\": () => (/* binding */ AudioLoader),\n/* harmony export */ \"AxesHelper\": () => (/* binding */ AxesHelper),\n/* harmony export */ \"BackSide\": () => (/* binding */ BackSide),\n/* harmony export */ \"BasicDepthPacking\": () => (/* binding */ BasicDepthPacking),\n/* harmony export */ \"BasicShadowMap\": () => (/* binding */ BasicShadowMap),\n/* harmony export */ \"Bone\": () => (/* binding */ Bone),\n/* harmony export */ \"BooleanKeyframeTrack\": () => (/* binding */ BooleanKeyframeTrack),\n/* harmony export */ \"Box2\": () => (/* binding */ Box2),\n/* harmony export */ \"Box3\": () => (/* binding */ Box3),\n/* harmony export */ \"Box3Helper\": () => (/* binding */ Box3Helper),\n/* harmony export */ \"BoxBufferGeometry\": () => (/* binding */ BoxBufferGeometry),\n/* harmony export */ \"BoxGeometry\": () => (/* binding */ BoxGeometry),\n/* harmony export */ \"BoxHelper\": () => (/* binding */ BoxHelper),\n/* harmony export */ \"BufferAttribute\": () => (/* binding */ BufferAttribute),\n/* harmony export */ \"BufferGeometry\": () => (/* binding */ BufferGeometry),\n/* harmony export */ \"BufferGeometryLoader\": () => (/* binding */ BufferGeometryLoader),\n/* harmony export */ \"ByteType\": () => (/* binding */ ByteType),\n/* harmony export */ \"Cache\": () => (/* binding */ Cache),\n/* harmony export */ \"Camera\": () => (/* binding */ Camera),\n/* harmony export */ \"CameraHelper\": () => (/* binding */ CameraHelper),\n/* harmony export */ \"CanvasTexture\": () => (/* binding */ CanvasTexture),\n/* harmony export */ \"CapsuleBufferGeometry\": () => (/* binding */ CapsuleBufferGeometry),\n/* harmony export */ \"CapsuleGeometry\": () => (/* binding */ CapsuleGeometry),\n/* harmony export */ \"CatmullRomCurve3\": () => (/* binding */ CatmullRomCurve3),\n/* harmony export */ \"CineonToneMapping\": () => (/* binding */ CineonToneMapping),\n/* harmony export */ \"CircleBufferGeometry\": () => (/* binding */ CircleBufferGeometry),\n/* harmony export */ \"CircleGeometry\": () => (/* binding */ CircleGeometry),\n/* harmony export */ \"ClampToEdgeWrapping\": () => (/* binding */ ClampToEdgeWrapping),\n/* harmony export */ \"Clock\": () => (/* binding */ Clock),\n/* harmony export */ \"Color\": () => (/* binding */ Color),\n/* harmony export */ \"ColorKeyframeTrack\": () => (/* binding */ ColorKeyframeTrack),\n/* harmony export */ \"ColorManagement\": () => (/* binding */ ColorManagement),\n/* harmony export */ \"CompressedArrayTexture\": () => (/* binding */ CompressedArrayTexture),\n/* harmony export */ \"CompressedTexture\": () => (/* binding */ CompressedTexture),\n/* harmony export */ \"CompressedTextureLoader\": () => (/* binding */ CompressedTextureLoader),\n/* harmony export */ \"ConeBufferGeometry\": () => (/* binding */ ConeBufferGeometry),\n/* harmony export */ \"ConeGeometry\": () => (/* binding */ ConeGeometry),\n/* harmony export */ \"CubeCamera\": () => (/* binding */ CubeCamera),\n/* harmony export */ \"CubeReflectionMapping\": () => (/* binding */ CubeReflectionMapping),\n/* harmony export */ \"CubeRefractionMapping\": () => (/* binding */ CubeRefractionMapping),\n/* harmony export */ \"CubeTexture\": () => (/* binding */ CubeTexture),\n/* harmony export */ \"CubeTextureLoader\": () => (/* binding */ CubeTextureLoader),\n/* harmony export */ \"CubeUVReflectionMapping\": () => (/* binding */ CubeUVReflectionMapping),\n/* harmony export */ \"CubicBezierCurve\": () => (/* binding */ CubicBezierCurve),\n/* harmony export */ \"CubicBezierCurve3\": () => (/* binding */ CubicBezierCurve3),\n/* harmony export */ \"CubicInterpolant\": () => (/* binding */ CubicInterpolant),\n/* harmony export */ \"CullFaceBack\": () => (/* binding */ CullFaceBack),\n/* harmony export */ \"CullFaceFront\": () => (/* binding */ CullFaceFront),\n/* harmony export */ \"CullFaceFrontBack\": () => (/* binding */ CullFaceFrontBack),\n/* harmony export */ \"CullFaceNone\": () => (/* binding */ CullFaceNone),\n/* harmony export */ \"Curve\": () => (/* binding */ Curve),\n/* harmony export */ \"CurvePath\": () => (/* binding */ CurvePath),\n/* harmony export */ \"CustomBlending\": () => (/* binding */ CustomBlending),\n/* harmony export */ \"CustomToneMapping\": () => (/* binding */ CustomToneMapping),\n/* harmony export */ \"CylinderBufferGeometry\": () => (/* binding */ CylinderBufferGeometry),\n/* harmony export */ \"CylinderGeometry\": () => (/* binding */ CylinderGeometry),\n/* harmony export */ \"Cylindrical\": () => (/* binding */ Cylindrical),\n/* harmony export */ \"Data3DTexture\": () => (/* binding */ Data3DTexture),\n/* harmony export */ \"DataArrayTexture\": () => (/* binding */ DataArrayTexture),\n/* harmony export */ \"DataTexture\": () => (/* binding */ DataTexture),\n/* harmony export */ \"DataTextureLoader\": () => (/* binding */ DataTextureLoader),\n/* harmony export */ \"DataUtils\": () => (/* binding */ DataUtils),\n/* harmony export */ \"DecrementStencilOp\": () => (/* binding */ DecrementStencilOp),\n/* harmony export */ \"DecrementWrapStencilOp\": () => (/* binding */ DecrementWrapStencilOp),\n/* harmony export */ \"DefaultLoadingManager\": () => (/* binding */ DefaultLoadingManager),\n/* harmony export */ \"DepthFormat\": () => (/* binding */ DepthFormat),\n/* harmony export */ \"DepthStencilFormat\": () => (/* binding */ DepthStencilFormat),\n/* harmony export */ \"DepthTexture\": () => (/* binding */ DepthTexture),\n/* harmony export */ \"DirectionalLight\": () => (/* binding */ DirectionalLight),\n/* harmony export */ \"DirectionalLightHelper\": () => (/* binding */ DirectionalLightHelper),\n/* harmony export */ \"DiscreteInterpolant\": () => (/* binding */ DiscreteInterpolant),\n/* harmony export */ \"DisplayP3ColorSpace\": () => (/* binding */ DisplayP3ColorSpace),\n/* harmony export */ \"DodecahedronBufferGeometry\": () => (/* binding */ DodecahedronBufferGeometry),\n/* harmony export */ \"DodecahedronGeometry\": () => (/* binding */ DodecahedronGeometry),\n/* harmony export */ \"DoubleSide\": () => (/* binding */ DoubleSide),\n/* harmony export */ \"DstAlphaFactor\": () => (/* binding */ DstAlphaFactor),\n/* harmony export */ \"DstColorFactor\": () => (/* binding */ DstColorFactor),\n/* harmony export */ \"DynamicCopyUsage\": () => (/* binding */ DynamicCopyUsage),\n/* harmony export */ \"DynamicDrawUsage\": () => (/* binding */ DynamicDrawUsage),\n/* harmony export */ \"DynamicReadUsage\": () => (/* binding */ DynamicReadUsage),\n/* harmony export */ \"EdgesGeometry\": () => (/* binding */ EdgesGeometry),\n/* harmony export */ \"EllipseCurve\": () => (/* binding */ EllipseCurve),\n/* harmony export */ \"EqualDepth\": () => (/* binding */ EqualDepth),\n/* harmony export */ \"EqualStencilFunc\": () => (/* binding */ EqualStencilFunc),\n/* harmony export */ \"EquirectangularReflectionMapping\": () => (/* binding */ EquirectangularReflectionMapping),\n/* harmony export */ \"EquirectangularRefractionMapping\": () => (/* binding */ EquirectangularRefractionMapping),\n/* harmony export */ \"Euler\": () => (/* binding */ Euler),\n/* harmony export */ \"EventDispatcher\": () => (/* binding */ EventDispatcher),\n/* harmony export */ \"ExtrudeBufferGeometry\": () => (/* binding */ ExtrudeBufferGeometry),\n/* harmony export */ \"ExtrudeGeometry\": () => (/* binding */ ExtrudeGeometry),\n/* harmony export */ \"FileLoader\": () => (/* binding */ FileLoader),\n/* harmony export */ \"Float16BufferAttribute\": () => (/* binding */ Float16BufferAttribute),\n/* harmony export */ \"Float32BufferAttribute\": () => (/* binding */ Float32BufferAttribute),\n/* harmony export */ \"Float64BufferAttribute\": () => (/* binding */ Float64BufferAttribute),\n/* harmony export */ \"FloatType\": () => (/* binding */ FloatType),\n/* harmony export */ \"Fog\": () => (/* binding */ Fog),\n/* harmony export */ \"FogExp2\": () => (/* binding */ FogExp2),\n/* harmony export */ \"FramebufferTexture\": () => (/* binding */ FramebufferTexture),\n/* harmony export */ \"FrontSide\": () => (/* binding */ FrontSide),\n/* harmony export */ \"Frustum\": () => (/* binding */ Frustum),\n/* harmony export */ \"GLBufferAttribute\": () => (/* binding */ GLBufferAttribute),\n/* harmony export */ \"GLSL1\": () => (/* binding */ GLSL1),\n/* harmony export */ \"GLSL3\": () => (/* binding */ GLSL3),\n/* harmony export */ \"GreaterDepth\": () => (/* binding */ GreaterDepth),\n/* harmony export */ \"GreaterEqualDepth\": () => (/* binding */ GreaterEqualDepth),\n/* harmony export */ \"GreaterEqualStencilFunc\": () => (/* binding */ GreaterEqualStencilFunc),\n/* harmony export */ \"GreaterStencilFunc\": () => (/* binding */ GreaterStencilFunc),\n/* harmony export */ \"GridHelper\": () => (/* binding */ GridHelper),\n/* harmony export */ \"Group\": () => (/* binding */ Group),\n/* harmony export */ \"HalfFloatType\": () => (/* binding */ HalfFloatType),\n/* harmony export */ \"HemisphereLight\": () => (/* binding */ HemisphereLight),\n/* harmony export */ \"HemisphereLightHelper\": () => (/* binding */ HemisphereLightHelper),\n/* harmony export */ \"HemisphereLightProbe\": () => (/* binding */ HemisphereLightProbe),\n/* harmony export */ \"IcosahedronBufferGeometry\": () => (/* binding */ IcosahedronBufferGeometry),\n/* harmony export */ \"IcosahedronGeometry\": () => (/* binding */ IcosahedronGeometry),\n/* harmony export */ \"ImageBitmapLoader\": () => (/* binding */ ImageBitmapLoader),\n/* harmony export */ \"ImageLoader\": () => (/* binding */ ImageLoader),\n/* harmony export */ \"ImageUtils\": () => (/* binding */ ImageUtils),\n/* harmony export */ \"IncrementStencilOp\": () => (/* binding */ IncrementStencilOp),\n/* harmony export */ \"IncrementWrapStencilOp\": () => (/* binding */ IncrementWrapStencilOp),\n/* harmony export */ \"InstancedBufferAttribute\": () => (/* binding */ InstancedBufferAttribute),\n/* harmony export */ \"InstancedBufferGeometry\": () => (/* binding */ InstancedBufferGeometry),\n/* harmony export */ \"InstancedInterleavedBuffer\": () => (/* binding */ InstancedInterleavedBuffer),\n/* harmony export */ \"InstancedMesh\": () => (/* binding */ InstancedMesh),\n/* harmony export */ \"Int16BufferAttribute\": () => (/* binding */ Int16BufferAttribute),\n/* harmony export */ \"Int32BufferAttribute\": () => (/* binding */ Int32BufferAttribute),\n/* harmony export */ \"Int8BufferAttribute\": () => (/* binding */ Int8BufferAttribute),\n/* harmony export */ \"IntType\": () => (/* binding */ IntType),\n/* harmony export */ \"InterleavedBuffer\": () => (/* binding */ InterleavedBuffer),\n/* harmony export */ \"InterleavedBufferAttribute\": () => (/* binding */ InterleavedBufferAttribute),\n/* harmony export */ \"Interpolant\": () => (/* binding */ Interpolant),\n/* harmony export */ \"InterpolateDiscrete\": () => (/* binding */ InterpolateDiscrete),\n/* harmony export */ \"InterpolateLinear\": () => (/* binding */ InterpolateLinear),\n/* harmony export */ \"InterpolateSmooth\": () => (/* binding */ InterpolateSmooth),\n/* harmony export */ \"InvertStencilOp\": () => (/* binding */ InvertStencilOp),\n/* harmony export */ \"KeepStencilOp\": () => (/* binding */ KeepStencilOp),\n/* harmony export */ \"KeyframeTrack\": () => (/* binding */ KeyframeTrack),\n/* harmony export */ \"LOD\": () => (/* binding */ LOD),\n/* harmony export */ \"LatheBufferGeometry\": () => (/* binding */ LatheBufferGeometry),\n/* harmony export */ \"LatheGeometry\": () => (/* binding */ LatheGeometry),\n/* harmony export */ \"Layers\": () => (/* binding */ Layers),\n/* harmony export */ \"LessDepth\": () => (/* binding */ LessDepth),\n/* harmony export */ \"LessEqualDepth\": () => (/* binding */ LessEqualDepth),\n/* harmony export */ \"LessEqualStencilFunc\": () => (/* binding */ LessEqualStencilFunc),\n/* harmony export */ \"LessStencilFunc\": () => (/* binding */ LessStencilFunc),\n/* harmony export */ \"Light\": () => (/* binding */ Light),\n/* harmony export */ \"LightProbe\": () => (/* binding */ LightProbe),\n/* harmony export */ \"Line\": () => (/* binding */ Line),\n/* harmony export */ \"Line3\": () => (/* binding */ Line3),\n/* harmony export */ \"LineBasicMaterial\": () => (/* binding */ LineBasicMaterial),\n/* harmony export */ \"LineCurve\": () => (/* binding */ LineCurve),\n/* harmony export */ \"LineCurve3\": () => (/* binding */ LineCurve3),\n/* harmony export */ \"LineDashedMaterial\": () => (/* binding */ LineDashedMaterial),\n/* harmony export */ \"LineLoop\": () => (/* binding */ LineLoop),\n/* harmony export */ \"LineSegments\": () => (/* binding */ LineSegments),\n/* harmony export */ \"LinearEncoding\": () => (/* binding */ LinearEncoding),\n/* harmony export */ \"LinearFilter\": () => (/* binding */ LinearFilter),\n/* harmony export */ \"LinearInterpolant\": () => (/* binding */ LinearInterpolant),\n/* harmony export */ \"LinearMipMapLinearFilter\": () => (/* binding */ LinearMipMapLinearFilter),\n/* harmony export */ \"LinearMipMapNearestFilter\": () => (/* binding */ LinearMipMapNearestFilter),\n/* harmony export */ \"LinearMipmapLinearFilter\": () => (/* binding */ LinearMipmapLinearFilter),\n/* harmony export */ \"LinearMipmapNearestFilter\": () => (/* binding */ LinearMipmapNearestFilter),\n/* harmony export */ \"LinearSRGBColorSpace\": () => (/* binding */ LinearSRGBColorSpace),\n/* harmony export */ \"LinearToneMapping\": () => (/* binding */ LinearToneMapping),\n/* harmony export */ \"Loader\": () => (/* binding */ Loader),\n/* harmony export */ \"LoaderUtils\": () => (/* binding */ LoaderUtils),\n/* harmony export */ \"LoadingManager\": () => (/* binding */ LoadingManager),\n/* harmony export */ \"LoopOnce\": () => (/* binding */ LoopOnce),\n/* harmony export */ \"LoopPingPong\": () => (/* binding */ LoopPingPong),\n/* harmony export */ \"LoopRepeat\": () => (/* binding */ LoopRepeat),\n/* harmony export */ \"LuminanceAlphaFormat\": () => (/* binding */ LuminanceAlphaFormat),\n/* harmony export */ \"LuminanceFormat\": () => (/* binding */ LuminanceFormat),\n/* harmony export */ \"MOUSE\": () => (/* binding */ MOUSE),\n/* harmony export */ \"Material\": () => (/* binding */ Material),\n/* harmony export */ \"MaterialLoader\": () => (/* binding */ MaterialLoader),\n/* harmony export */ \"MathUtils\": () => (/* binding */ MathUtils),\n/* harmony export */ \"Matrix3\": () => (/* binding */ Matrix3),\n/* harmony export */ \"Matrix4\": () => (/* binding */ Matrix4),\n/* harmony export */ \"MaxEquation\": () => (/* binding */ MaxEquation),\n/* harmony export */ \"Mesh\": () => (/* binding */ Mesh),\n/* harmony export */ \"MeshBasicMaterial\": () => (/* binding */ MeshBasicMaterial),\n/* harmony export */ \"MeshDepthMaterial\": () => (/* binding */ MeshDepthMaterial),\n/* harmony export */ \"MeshDistanceMaterial\": () => (/* binding */ MeshDistanceMaterial),\n/* harmony export */ \"MeshLambertMaterial\": () => (/* binding */ MeshLambertMaterial),\n/* harmony export */ \"MeshMatcapMaterial\": () => (/* binding */ MeshMatcapMaterial),\n/* harmony export */ \"MeshNormalMaterial\": () => (/* binding */ MeshNormalMaterial),\n/* harmony export */ \"MeshPhongMaterial\": () => (/* binding */ MeshPhongMaterial),\n/* harmony export */ \"MeshPhysicalMaterial\": () => (/* binding */ MeshPhysicalMaterial),\n/* harmony export */ \"MeshStandardMaterial\": () => (/* binding */ MeshStandardMaterial),\n/* harmony export */ \"MeshToonMaterial\": () => (/* binding */ MeshToonMaterial),\n/* harmony export */ \"MinEquation\": () => (/* binding */ MinEquation),\n/* harmony export */ \"MirroredRepeatWrapping\": () => (/* binding */ MirroredRepeatWrapping),\n/* harmony export */ \"MixOperation\": () => (/* binding */ MixOperation),\n/* harmony export */ \"MultiplyBlending\": () => (/* binding */ MultiplyBlending),\n/* harmony export */ \"MultiplyOperation\": () => (/* binding */ MultiplyOperation),\n/* harmony export */ \"NearestFilter\": () => (/* binding */ NearestFilter),\n/* harmony export */ \"NearestMipMapLinearFilter\": () => (/* binding */ NearestMipMapLinearFilter),\n/* harmony export */ \"NearestMipMapNearestFilter\": () => (/* binding */ NearestMipMapNearestFilter),\n/* harmony export */ \"NearestMipmapLinearFilter\": () => (/* binding */ NearestMipmapLinearFilter),\n/* harmony export */ \"NearestMipmapNearestFilter\": () => (/* binding */ NearestMipmapNearestFilter),\n/* harmony export */ \"NeverDepth\": () => (/* binding */ NeverDepth),\n/* harmony export */ \"NeverStencilFunc\": () => (/* binding */ NeverStencilFunc),\n/* harmony export */ \"NoBlending\": () => (/* binding */ NoBlending),\n/* harmony export */ \"NoColorSpace\": () => (/* binding */ NoColorSpace),\n/* harmony export */ \"NoToneMapping\": () => (/* binding */ NoToneMapping),\n/* harmony export */ \"NormalAnimationBlendMode\": () => (/* binding */ NormalAnimationBlendMode),\n/* harmony export */ \"NormalBlending\": () => (/* binding */ NormalBlending),\n/* harmony export */ \"NotEqualDepth\": () => (/* binding */ NotEqualDepth),\n/* harmony export */ \"NotEqualStencilFunc\": () => (/* binding */ NotEqualStencilFunc),\n/* harmony export */ \"NumberKeyframeTrack\": () => (/* binding */ NumberKeyframeTrack),\n/* harmony export */ \"Object3D\": () => (/* binding */ Object3D),\n/* harmony export */ \"ObjectLoader\": () => (/* binding */ ObjectLoader),\n/* harmony export */ \"ObjectSpaceNormalMap\": () => (/* binding */ ObjectSpaceNormalMap),\n/* harmony export */ \"OctahedronBufferGeometry\": () => (/* binding */ OctahedronBufferGeometry),\n/* harmony export */ \"OctahedronGeometry\": () => (/* binding */ OctahedronGeometry),\n/* harmony export */ \"OneFactor\": () => (/* binding */ OneFactor),\n/* harmony export */ \"OneMinusDstAlphaFactor\": () => (/* binding */ OneMinusDstAlphaFactor),\n/* harmony export */ \"OneMinusDstColorFactor\": () => (/* binding */ OneMinusDstColorFactor),\n/* harmony export */ \"OneMinusSrcAlphaFactor\": () => (/* binding */ OneMinusSrcAlphaFactor),\n/* harmony export */ \"OneMinusSrcColorFactor\": () => (/* binding */ OneMinusSrcColorFactor),\n/* harmony export */ \"OrthographicCamera\": () => (/* binding */ OrthographicCamera),\n/* harmony export */ \"PCFShadowMap\": () => (/* binding */ PCFShadowMap),\n/* harmony export */ \"PCFSoftShadowMap\": () => (/* binding */ PCFSoftShadowMap),\n/* harmony export */ \"PMREMGenerator\": () => (/* binding */ PMREMGenerator),\n/* harmony export */ \"Path\": () => (/* binding */ Path),\n/* harmony export */ \"PerspectiveCamera\": () => (/* binding */ PerspectiveCamera),\n/* harmony export */ \"Plane\": () => (/* binding */ Plane),\n/* harmony export */ \"PlaneBufferGeometry\": () => (/* binding */ PlaneBufferGeometry),\n/* harmony export */ \"PlaneGeometry\": () => (/* binding */ PlaneGeometry),\n/* harmony export */ \"PlaneHelper\": () => (/* binding */ PlaneHelper),\n/* harmony export */ \"PointLight\": () => (/* binding */ PointLight),\n/* harmony export */ \"PointLightHelper\": () => (/* binding */ PointLightHelper),\n/* harmony export */ \"Points\": () => (/* binding */ Points),\n/* harmony export */ \"PointsMaterial\": () => (/* binding */ PointsMaterial),\n/* harmony export */ \"PolarGridHelper\": () => (/* binding */ PolarGridHelper),\n/* harmony export */ \"PolyhedronBufferGeometry\": () => (/* binding */ PolyhedronBufferGeometry),\n/* harmony export */ \"PolyhedronGeometry\": () => (/* binding */ PolyhedronGeometry),\n/* harmony export */ \"PositionalAudio\": () => (/* binding */ PositionalAudio),\n/* harmony export */ \"PropertyBinding\": () => (/* binding */ PropertyBinding),\n/* harmony export */ \"PropertyMixer\": () => (/* binding */ PropertyMixer),\n/* harmony export */ \"QuadraticBezierCurve\": () => (/* binding */ QuadraticBezierCurve),\n/* harmony export */ \"QuadraticBezierCurve3\": () => (/* binding */ QuadraticBezierCurve3),\n/* harmony export */ \"Quaternion\": () => (/* binding */ Quaternion),\n/* harmony export */ \"QuaternionKeyframeTrack\": () => (/* binding */ QuaternionKeyframeTrack),\n/* harmony export */ \"QuaternionLinearInterpolant\": () => (/* binding */ QuaternionLinearInterpolant),\n/* harmony export */ \"RED_GREEN_RGTC2_Format\": () => (/* binding */ RED_GREEN_RGTC2_Format),\n/* harmony export */ \"RED_RGTC1_Format\": () => (/* binding */ RED_RGTC1_Format),\n/* harmony export */ \"REVISION\": () => (/* binding */ REVISION),\n/* harmony export */ \"RGBADepthPacking\": () => (/* binding */ RGBADepthPacking),\n/* harmony export */ \"RGBAFormat\": () => (/* binding */ RGBAFormat),\n/* harmony export */ \"RGBAIntegerFormat\": () => (/* binding */ RGBAIntegerFormat),\n/* harmony export */ \"RGBA_ASTC_10x10_Format\": () => (/* binding */ RGBA_ASTC_10x10_Format),\n/* harmony export */ \"RGBA_ASTC_10x5_Format\": () => (/* binding */ RGBA_ASTC_10x5_Format),\n/* harmony export */ \"RGBA_ASTC_10x6_Format\": () => (/* binding */ RGBA_ASTC_10x6_Format),\n/* harmony export */ \"RGBA_ASTC_10x8_Format\": () => (/* binding */ RGBA_ASTC_10x8_Format),\n/* harmony export */ \"RGBA_ASTC_12x10_Format\": () => (/* binding */ RGBA_ASTC_12x10_Format),\n/* harmony export */ \"RGBA_ASTC_12x12_Format\": () => (/* binding */ RGBA_ASTC_12x12_Format),\n/* harmony export */ \"RGBA_ASTC_4x4_Format\": () => (/* binding */ RGBA_ASTC_4x4_Format),\n/* harmony export */ \"RGBA_ASTC_5x4_Format\": () => (/* binding */ RGBA_ASTC_5x4_Format),\n/* harmony export */ \"RGBA_ASTC_5x5_Format\": () => (/* binding */ RGBA_ASTC_5x5_Format),\n/* harmony export */ \"RGBA_ASTC_6x5_Format\": () => (/* binding */ RGBA_ASTC_6x5_Format),\n/* harmony export */ \"RGBA_ASTC_6x6_Format\": () => (/* binding */ RGBA_ASTC_6x6_Format),\n/* harmony export */ \"RGBA_ASTC_8x5_Format\": () => (/* binding */ RGBA_ASTC_8x5_Format),\n/* harmony export */ \"RGBA_ASTC_8x6_Format\": () => (/* binding */ RGBA_ASTC_8x6_Format),\n/* harmony export */ \"RGBA_ASTC_8x8_Format\": () => (/* binding */ RGBA_ASTC_8x8_Format),\n/* harmony export */ \"RGBA_BPTC_Format\": () => (/* binding */ RGBA_BPTC_Format),\n/* harmony export */ \"RGBA_ETC2_EAC_Format\": () => (/* binding */ RGBA_ETC2_EAC_Format),\n/* harmony export */ \"RGBA_PVRTC_2BPPV1_Format\": () => (/* binding */ RGBA_PVRTC_2BPPV1_Format),\n/* harmony export */ \"RGBA_PVRTC_4BPPV1_Format\": () => (/* binding */ RGBA_PVRTC_4BPPV1_Format),\n/* harmony export */ \"RGBA_S3TC_DXT1_Format\": () => (/* binding */ RGBA_S3TC_DXT1_Format),\n/* harmony export */ \"RGBA_S3TC_DXT3_Format\": () => (/* binding */ RGBA_S3TC_DXT3_Format),\n/* harmony export */ \"RGBA_S3TC_DXT5_Format\": () => (/* binding */ RGBA_S3TC_DXT5_Format),\n/* harmony export */ \"RGB_ETC1_Format\": () => (/* binding */ RGB_ETC1_Format),\n/* harmony export */ \"RGB_ETC2_Format\": () => (/* binding */ RGB_ETC2_Format),\n/* harmony export */ \"RGB_PVRTC_2BPPV1_Format\": () => (/* binding */ RGB_PVRTC_2BPPV1_Format),\n/* harmony export */ \"RGB_PVRTC_4BPPV1_Format\": () => (/* binding */ RGB_PVRTC_4BPPV1_Format),\n/* harmony export */ \"RGB_S3TC_DXT1_Format\": () => (/* binding */ RGB_S3TC_DXT1_Format),\n/* harmony export */ \"RGFormat\": () => (/* binding */ RGFormat),\n/* harmony export */ \"RGIntegerFormat\": () => (/* binding */ RGIntegerFormat),\n/* harmony export */ \"RawShaderMaterial\": () => (/* binding */ RawShaderMaterial),\n/* harmony export */ \"Ray\": () => (/* binding */ Ray),\n/* harmony export */ \"Raycaster\": () => (/* binding */ Raycaster),\n/* harmony export */ \"RectAreaLight\": () => (/* binding */ RectAreaLight),\n/* harmony export */ \"RedFormat\": () => (/* binding */ RedFormat),\n/* harmony export */ \"RedIntegerFormat\": () => (/* binding */ RedIntegerFormat),\n/* harmony export */ \"ReinhardToneMapping\": () => (/* binding */ ReinhardToneMapping),\n/* harmony export */ \"RepeatWrapping\": () => (/* binding */ RepeatWrapping),\n/* harmony export */ \"ReplaceStencilOp\": () => (/* binding */ ReplaceStencilOp),\n/* harmony export */ \"ReverseSubtractEquation\": () => (/* binding */ ReverseSubtractEquation),\n/* harmony export */ \"RingBufferGeometry\": () => (/* binding */ RingBufferGeometry),\n/* harmony export */ \"RingGeometry\": () => (/* binding */ RingGeometry),\n/* harmony export */ \"SIGNED_RED_GREEN_RGTC2_Format\": () => (/* binding */ SIGNED_RED_GREEN_RGTC2_Format),\n/* harmony export */ \"SIGNED_RED_RGTC1_Format\": () => (/* binding */ SIGNED_RED_RGTC1_Format),\n/* harmony export */ \"SRGBColorSpace\": () => (/* binding */ SRGBColorSpace),\n/* harmony export */ \"Scene\": () => (/* binding */ Scene),\n/* harmony export */ \"ShaderChunk\": () => (/* binding */ ShaderChunk),\n/* harmony export */ \"ShaderLib\": () => (/* binding */ ShaderLib),\n/* harmony export */ \"ShaderMaterial\": () => (/* binding */ ShaderMaterial),\n/* harmony export */ \"ShadowMaterial\": () => (/* binding */ ShadowMaterial),\n/* harmony export */ \"Shape\": () => (/* binding */ Shape),\n/* harmony export */ \"ShapeBufferGeometry\": () => (/* binding */ ShapeBufferGeometry),\n/* harmony export */ \"ShapeGeometry\": () => (/* binding */ ShapeGeometry),\n/* harmony export */ \"ShapePath\": () => (/* binding */ ShapePath),\n/* harmony export */ \"ShapeUtils\": () => (/* binding */ ShapeUtils),\n/* harmony export */ \"ShortType\": () => (/* binding */ ShortType),\n/* harmony export */ \"Skeleton\": () => (/* binding */ Skeleton),\n/* harmony export */ \"SkeletonHelper\": () => (/* binding */ SkeletonHelper),\n/* harmony export */ \"SkinnedMesh\": () => (/* binding */ SkinnedMesh),\n/* harmony export */ \"Source\": () => (/* binding */ Source),\n/* harmony export */ \"Sphere\": () => (/* binding */ Sphere),\n/* harmony export */ \"SphereBufferGeometry\": () => (/* binding */ SphereBufferGeometry),\n/* harmony export */ \"SphereGeometry\": () => (/* binding */ SphereGeometry),\n/* harmony export */ \"Spherical\": () => (/* binding */ Spherical),\n/* harmony export */ \"SphericalHarmonics3\": () => (/* binding */ SphericalHarmonics3),\n/* harmony export */ \"SplineCurve\": () => (/* binding */ SplineCurve),\n/* harmony export */ \"SpotLight\": () => (/* binding */ SpotLight),\n/* harmony export */ \"SpotLightHelper\": () => (/* binding */ SpotLightHelper),\n/* harmony export */ \"Sprite\": () => (/* binding */ Sprite),\n/* harmony export */ \"SpriteMaterial\": () => (/* binding */ SpriteMaterial),\n/* harmony export */ \"SrcAlphaFactor\": () => (/* binding */ SrcAlphaFactor),\n/* harmony export */ \"SrcAlphaSaturateFactor\": () => (/* binding */ SrcAlphaSaturateFactor),\n/* harmony export */ \"SrcColorFactor\": () => (/* binding */ SrcColorFactor),\n/* harmony export */ \"StaticCopyUsage\": () => (/* binding */ StaticCopyUsage),\n/* harmony export */ \"StaticDrawUsage\": () => (/* binding */ StaticDrawUsage),\n/* harmony export */ \"StaticReadUsage\": () => (/* binding */ StaticReadUsage),\n/* harmony export */ \"StereoCamera\": () => (/* binding */ StereoCamera),\n/* harmony export */ \"StreamCopyUsage\": () => (/* binding */ StreamCopyUsage),\n/* harmony export */ \"StreamDrawUsage\": () => (/* binding */ StreamDrawUsage),\n/* harmony export */ \"StreamReadUsage\": () => (/* binding */ StreamReadUsage),\n/* harmony export */ \"StringKeyframeTrack\": () => (/* binding */ StringKeyframeTrack),\n/* harmony export */ \"SubtractEquation\": () => (/* binding */ SubtractEquation),\n/* harmony export */ \"SubtractiveBlending\": () => (/* binding */ SubtractiveBlending),\n/* harmony export */ \"TOUCH\": () => (/* binding */ TOUCH),\n/* harmony export */ \"TangentSpaceNormalMap\": () => (/* binding */ TangentSpaceNormalMap),\n/* harmony export */ \"TetrahedronBufferGeometry\": () => (/* binding */ TetrahedronBufferGeometry),\n/* harmony export */ \"TetrahedronGeometry\": () => (/* binding */ TetrahedronGeometry),\n/* harmony export */ \"Texture\": () => (/* binding */ Texture),\n/* harmony export */ \"TextureLoader\": () => (/* binding */ TextureLoader),\n/* harmony export */ \"TorusBufferGeometry\": () => (/* binding */ TorusBufferGeometry),\n/* harmony export */ \"TorusGeometry\": () => (/* binding */ TorusGeometry),\n/* harmony export */ \"TorusKnotBufferGeometry\": () => (/* binding */ TorusKnotBufferGeometry),\n/* harmony export */ \"TorusKnotGeometry\": () => (/* binding */ TorusKnotGeometry),\n/* harmony export */ \"Triangle\": () => (/* binding */ Triangle),\n/* harmony export */ \"TriangleFanDrawMode\": () => (/* binding */ TriangleFanDrawMode),\n/* harmony export */ \"TriangleStripDrawMode\": () => (/* binding */ TriangleStripDrawMode),\n/* harmony export */ \"TrianglesDrawMode\": () => (/* binding */ TrianglesDrawMode),\n/* harmony export */ \"TubeBufferGeometry\": () => (/* binding */ TubeBufferGeometry),\n/* harmony export */ \"TubeGeometry\": () => (/* binding */ TubeGeometry),\n/* harmony export */ \"TwoPassDoubleSide\": () => (/* binding */ TwoPassDoubleSide),\n/* harmony export */ \"UVMapping\": () => (/* binding */ UVMapping),\n/* harmony export */ \"Uint16BufferAttribute\": () => (/* binding */ Uint16BufferAttribute),\n/* harmony export */ \"Uint32BufferAttribute\": () => (/* binding */ Uint32BufferAttribute),\n/* harmony export */ \"Uint8BufferAttribute\": () => (/* binding */ Uint8BufferAttribute),\n/* harmony export */ \"Uint8ClampedBufferAttribute\": () => (/* binding */ Uint8ClampedBufferAttribute),\n/* harmony export */ \"Uniform\": () => (/* binding */ Uniform),\n/* harmony export */ \"UniformsGroup\": () => (/* binding */ UniformsGroup),\n/* harmony export */ \"UniformsLib\": () => (/* binding */ UniformsLib),\n/* harmony export */ \"UniformsUtils\": () => (/* binding */ UniformsUtils),\n/* harmony export */ \"UnsignedByteType\": () => (/* binding */ UnsignedByteType),\n/* harmony export */ \"UnsignedInt248Type\": () => (/* binding */ UnsignedInt248Type),\n/* harmony export */ \"UnsignedIntType\": () => (/* binding */ UnsignedIntType),\n/* harmony export */ \"UnsignedShort4444Type\": () => (/* binding */ UnsignedShort4444Type),\n/* harmony export */ \"UnsignedShort5551Type\": () => (/* binding */ UnsignedShort5551Type),\n/* harmony export */ \"UnsignedShortType\": () => (/* binding */ UnsignedShortType),\n/* harmony export */ \"VSMShadowMap\": () => (/* binding */ VSMShadowMap),\n/* harmony export */ \"Vector2\": () => (/* binding */ Vector2),\n/* harmony export */ \"Vector3\": () => (/* binding */ Vector3),\n/* harmony export */ \"Vector4\": () => (/* binding */ Vector4),\n/* harmony export */ \"VectorKeyframeTrack\": () => (/* binding */ VectorKeyframeTrack),\n/* harmony export */ \"VideoTexture\": () => (/* binding */ VideoTexture),\n/* harmony export */ \"WebGL1Renderer\": () => (/* binding */ WebGL1Renderer),\n/* harmony export */ \"WebGL3DRenderTarget\": () => (/* binding */ WebGL3DRenderTarget),\n/* harmony export */ \"WebGLArrayRenderTarget\": () => (/* binding */ WebGLArrayRenderTarget),\n/* harmony export */ \"WebGLCubeRenderTarget\": () => (/* binding */ WebGLCubeRenderTarget),\n/* harmony export */ \"WebGLMultipleRenderTargets\": () => (/* binding */ WebGLMultipleRenderTargets),\n/* harmony export */ \"WebGLRenderTarget\": () => (/* binding */ WebGLRenderTarget),\n/* harmony export */ \"WebGLRenderer\": () => (/* binding */ WebGLRenderer),\n/* harmony export */ \"WebGLUtils\": () => (/* binding */ WebGLUtils),\n/* harmony export */ \"WireframeGeometry\": () => (/* binding */ WireframeGeometry),\n/* harmony export */ \"WrapAroundEnding\": () => (/* binding */ WrapAroundEnding),\n/* harmony export */ \"ZeroCurvatureEnding\": () => (/* binding */ ZeroCurvatureEnding),\n/* harmony export */ \"ZeroFactor\": () => (/* binding */ ZeroFactor),\n/* harmony export */ \"ZeroSlopeEnding\": () => (/* binding */ ZeroSlopeEnding),\n/* harmony export */ \"ZeroStencilOp\": () => (/* binding */ ZeroStencilOp),\n/* harmony export */ \"_SRGBAFormat\": () => (/* binding */ _SRGBAFormat),\n/* harmony export */ \"sRGBEncoding\": () => (/* binding */ sRGBEncoding)\n/* harmony export */ });\nvar _TO_LINEAR, _FROM_LINEAR;\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i[\"return\"] && (_r = _i[\"return\"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/**\n * @license\n * Copyright 2010-2023 Three.js Authors\n * SPDX-License-Identifier: MIT\n */\nvar REVISION = '151';\nvar MOUSE = {\n LEFT: 0,\n MIDDLE: 1,\n RIGHT: 2,\n ROTATE: 0,\n DOLLY: 1,\n PAN: 2\n};\nvar TOUCH = {\n ROTATE: 0,\n PAN: 1,\n DOLLY_PAN: 2,\n DOLLY_ROTATE: 3\n};\nvar CullFaceNone = 0;\nvar CullFaceBack = 1;\nvar CullFaceFront = 2;\nvar CullFaceFrontBack = 3;\nvar BasicShadowMap = 0;\nvar PCFShadowMap = 1;\nvar PCFSoftShadowMap = 2;\nvar VSMShadowMap = 3;\nvar FrontSide = 0;\nvar BackSide = 1;\nvar DoubleSide = 2;\nvar TwoPassDoubleSide = 2; // r149\nvar NoBlending = 0;\nvar NormalBlending = 1;\nvar AdditiveBlending = 2;\nvar SubtractiveBlending = 3;\nvar MultiplyBlending = 4;\nvar CustomBlending = 5;\nvar AddEquation = 100;\nvar SubtractEquation = 101;\nvar ReverseSubtractEquation = 102;\nvar MinEquation = 103;\nvar MaxEquation = 104;\nvar ZeroFactor = 200;\nvar OneFactor = 201;\nvar SrcColorFactor = 202;\nvar OneMinusSrcColorFactor = 203;\nvar SrcAlphaFactor = 204;\nvar OneMinusSrcAlphaFactor = 205;\nvar DstAlphaFactor = 206;\nvar OneMinusDstAlphaFactor = 207;\nvar DstColorFactor = 208;\nvar OneMinusDstColorFactor = 209;\nvar SrcAlphaSaturateFactor = 210;\nvar NeverDepth = 0;\nvar AlwaysDepth = 1;\nvar LessDepth = 2;\nvar LessEqualDepth = 3;\nvar EqualDepth = 4;\nvar GreaterEqualDepth = 5;\nvar GreaterDepth = 6;\nvar NotEqualDepth = 7;\nvar MultiplyOperation = 0;\nvar MixOperation = 1;\nvar AddOperation = 2;\nvar NoToneMapping = 0;\nvar LinearToneMapping = 1;\nvar ReinhardToneMapping = 2;\nvar CineonToneMapping = 3;\nvar ACESFilmicToneMapping = 4;\nvar CustomToneMapping = 5;\nvar UVMapping = 300;\nvar CubeReflectionMapping = 301;\nvar CubeRefractionMapping = 302;\nvar EquirectangularReflectionMapping = 303;\nvar EquirectangularRefractionMapping = 304;\nvar CubeUVReflectionMapping = 306;\nvar RepeatWrapping = 1000;\nvar ClampToEdgeWrapping = 1001;\nvar MirroredRepeatWrapping = 1002;\nvar NearestFilter = 1003;\nvar NearestMipmapNearestFilter = 1004;\nvar NearestMipMapNearestFilter = 1004;\nvar NearestMipmapLinearFilter = 1005;\nvar NearestMipMapLinearFilter = 1005;\nvar LinearFilter = 1006;\nvar LinearMipmapNearestFilter = 1007;\nvar LinearMipMapNearestFilter = 1007;\nvar LinearMipmapLinearFilter = 1008;\nvar LinearMipMapLinearFilter = 1008;\nvar UnsignedByteType = 1009;\nvar ByteType = 1010;\nvar ShortType = 1011;\nvar UnsignedShortType = 1012;\nvar IntType = 1013;\nvar UnsignedIntType = 1014;\nvar FloatType = 1015;\nvar HalfFloatType = 1016;\nvar UnsignedShort4444Type = 1017;\nvar UnsignedShort5551Type = 1018;\nvar UnsignedInt248Type = 1020;\nvar AlphaFormat = 1021;\nvar RGBAFormat = 1023;\nvar LuminanceFormat = 1024;\nvar LuminanceAlphaFormat = 1025;\nvar DepthFormat = 1026;\nvar DepthStencilFormat = 1027;\nvar RedFormat = 1028;\nvar RedIntegerFormat = 1029;\nvar RGFormat = 1030;\nvar RGIntegerFormat = 1031;\nvar RGBAIntegerFormat = 1033;\nvar RGB_S3TC_DXT1_Format = 33776;\nvar RGBA_S3TC_DXT1_Format = 33777;\nvar RGBA_S3TC_DXT3_Format = 33778;\nvar RGBA_S3TC_DXT5_Format = 33779;\nvar RGB_PVRTC_4BPPV1_Format = 35840;\nvar RGB_PVRTC_2BPPV1_Format = 35841;\nvar RGBA_PVRTC_4BPPV1_Format = 35842;\nvar RGBA_PVRTC_2BPPV1_Format = 35843;\nvar RGB_ETC1_Format = 36196;\nvar RGB_ETC2_Format = 37492;\nvar RGBA_ETC2_EAC_Format = 37496;\nvar RGBA_ASTC_4x4_Format = 37808;\nvar RGBA_ASTC_5x4_Format = 37809;\nvar RGBA_ASTC_5x5_Format = 37810;\nvar RGBA_ASTC_6x5_Format = 37811;\nvar RGBA_ASTC_6x6_Format = 37812;\nvar RGBA_ASTC_8x5_Format = 37813;\nvar RGBA_ASTC_8x6_Format = 37814;\nvar RGBA_ASTC_8x8_Format = 37815;\nvar RGBA_ASTC_10x5_Format = 37816;\nvar RGBA_ASTC_10x6_Format = 37817;\nvar RGBA_ASTC_10x8_Format = 37818;\nvar RGBA_ASTC_10x10_Format = 37819;\nvar RGBA_ASTC_12x10_Format = 37820;\nvar RGBA_ASTC_12x12_Format = 37821;\nvar RGBA_BPTC_Format = 36492;\nvar RED_RGTC1_Format = 36283;\nvar SIGNED_RED_RGTC1_Format = 36284;\nvar RED_GREEN_RGTC2_Format = 36285;\nvar SIGNED_RED_GREEN_RGTC2_Format = 36286;\nvar LoopOnce = 2200;\nvar LoopRepeat = 2201;\nvar LoopPingPong = 2202;\nvar InterpolateDiscrete = 2300;\nvar InterpolateLinear = 2301;\nvar InterpolateSmooth = 2302;\nvar ZeroCurvatureEnding = 2400;\nvar ZeroSlopeEnding = 2401;\nvar WrapAroundEnding = 2402;\nvar NormalAnimationBlendMode = 2500;\nvar AdditiveAnimationBlendMode = 2501;\nvar TrianglesDrawMode = 0;\nvar TriangleStripDrawMode = 1;\nvar TriangleFanDrawMode = 2;\nvar LinearEncoding = 3000;\nvar sRGBEncoding = 3001;\nvar BasicDepthPacking = 3200;\nvar RGBADepthPacking = 3201;\nvar TangentSpaceNormalMap = 0;\nvar ObjectSpaceNormalMap = 1;\n\n// Color space string identifiers, matching CSS Color Module Level 4 and WebGPU names where available.\nvar NoColorSpace = '';\nvar SRGBColorSpace = 'srgb';\nvar LinearSRGBColorSpace = 'srgb-linear';\nvar DisplayP3ColorSpace = 'display-p3';\nvar ZeroStencilOp = 0;\nvar KeepStencilOp = 7680;\nvar ReplaceStencilOp = 7681;\nvar IncrementStencilOp = 7682;\nvar DecrementStencilOp = 7683;\nvar IncrementWrapStencilOp = 34055;\nvar DecrementWrapStencilOp = 34056;\nvar InvertStencilOp = 5386;\nvar NeverStencilFunc = 512;\nvar LessStencilFunc = 513;\nvar EqualStencilFunc = 514;\nvar LessEqualStencilFunc = 515;\nvar GreaterStencilFunc = 516;\nvar NotEqualStencilFunc = 517;\nvar GreaterEqualStencilFunc = 518;\nvar AlwaysStencilFunc = 519;\nvar StaticDrawUsage = 35044;\nvar DynamicDrawUsage = 35048;\nvar StreamDrawUsage = 35040;\nvar StaticReadUsage = 35045;\nvar DynamicReadUsage = 35049;\nvar StreamReadUsage = 35041;\nvar StaticCopyUsage = 35046;\nvar DynamicCopyUsage = 35050;\nvar StreamCopyUsage = 35042;\nvar GLSL1 = '100';\nvar GLSL3 = '300 es';\nvar _SRGBAFormat = 1035; // fallback for WebGL 1\n\n/**\n * https://github.com/mrdoob/eventdispatcher.js/\n */\nvar EventDispatcher = /*#__PURE__*/function () {\n function EventDispatcher() {\n _classCallCheck(this, EventDispatcher);\n }\n _createClass(EventDispatcher, [{\n key: \"addEventListener\",\n value: function addEventListener(type, listener) {\n if (this._listeners === undefined) this._listeners = {};\n var listeners = this._listeners;\n if (listeners[type] === undefined) {\n listeners[type] = [];\n }\n if (listeners[type].indexOf(listener) === -1) {\n listeners[type].push(listener);\n }\n }\n }, {\n key: \"hasEventListener\",\n value: function hasEventListener(type, listener) {\n if (this._listeners === undefined) return false;\n var listeners = this._listeners;\n return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1;\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, listener) {\n if (this._listeners === undefined) return;\n var listeners = this._listeners;\n var listenerArray = listeners[type];\n if (listenerArray !== undefined) {\n var index = listenerArray.indexOf(listener);\n if (index !== -1) {\n listenerArray.splice(index, 1);\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (this._listeners === undefined) return;\n var listeners = this._listeners;\n var listenerArray = listeners[event.type];\n if (listenerArray !== undefined) {\n event.target = this;\n\n // Make a copy, in case listeners are removed while iterating.\n var array = listenerArray.slice(0);\n for (var i = 0, l = array.length; i < l; i++) {\n array[i].call(this, event);\n }\n event.target = null;\n }\n }\n }]);\n return EventDispatcher;\n}();\nvar _lut = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff'];\nvar _seed = 1234567;\nvar DEG2RAD = Math.PI / 180;\nvar RAD2DEG = 180 / Math.PI;\n\n// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136\nfunction generateUUID() {\n var d0 = Math.random() * 0xffffffff | 0;\n var d1 = Math.random() * 0xffffffff | 0;\n var d2 = Math.random() * 0xffffffff | 0;\n var d3 = Math.random() * 0xffffffff | 0;\n var uuid = _lut[d0 & 0xff] + _lut[d0 >> 8 & 0xff] + _lut[d0 >> 16 & 0xff] + _lut[d0 >> 24 & 0xff] + '-' + _lut[d1 & 0xff] + _lut[d1 >> 8 & 0xff] + '-' + _lut[d1 >> 16 & 0x0f | 0x40] + _lut[d1 >> 24 & 0xff] + '-' + _lut[d2 & 0x3f | 0x80] + _lut[d2 >> 8 & 0xff] + '-' + _lut[d2 >> 16 & 0xff] + _lut[d2 >> 24 & 0xff] + _lut[d3 & 0xff] + _lut[d3 >> 8 & 0xff] + _lut[d3 >> 16 & 0xff] + _lut[d3 >> 24 & 0xff];\n\n // .toLowerCase() here flattens concatenated strings to save heap memory space.\n return uuid.toLowerCase();\n}\nfunction clamp(value, min, max) {\n return Math.max(min, Math.min(max, value));\n}\n\n// compute euclidean modulo of m % n\n// https://en.wikipedia.org/wiki/Modulo_operation\nfunction euclideanModulo(n, m) {\n return (n % m + m) % m;\n}\n\n// Linear mapping from range to range \nfunction mapLinear(x, a1, a2, b1, b2) {\n return b1 + (x - a1) * (b2 - b1) / (a2 - a1);\n}\n\n// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/\nfunction inverseLerp(x, y, value) {\n if (x !== y) {\n return (value - x) / (y - x);\n } else {\n return 0;\n }\n}\n\n// https://en.wikipedia.org/wiki/Linear_interpolation\nfunction lerp(x, y, t) {\n return (1 - t) * x + t * y;\n}\n\n// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/\nfunction damp(x, y, lambda, dt) {\n return lerp(x, y, 1 - Math.exp(-lambda * dt));\n}\n\n// https://www.desmos.com/calculator/vcsjnyz7x4\nfunction pingpong(x) {\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n return length - Math.abs(euclideanModulo(x, length * 2) - length);\n}\n\n// http://en.wikipedia.org/wiki/Smoothstep\nfunction smoothstep(x, min, max) {\n if (x <= min) return 0;\n if (x >= max) return 1;\n x = (x - min) / (max - min);\n return x * x * (3 - 2 * x);\n}\nfunction smootherstep(x, min, max) {\n if (x <= min) return 0;\n if (x >= max) return 1;\n x = (x - min) / (max - min);\n return x * x * x * (x * (x * 6 - 15) + 10);\n}\n\n// Random integer from interval\nfunction randInt(low, high) {\n return low + Math.floor(Math.random() * (high - low + 1));\n}\n\n// Random float from interval\nfunction randFloat(low, high) {\n return low + Math.random() * (high - low);\n}\n\n// Random float from <-range/2, range/2> interval\nfunction randFloatSpread(range) {\n return range * (0.5 - Math.random());\n}\n\n// Deterministic pseudo-random float in the interval [ 0, 1 ]\nfunction seededRandom(s) {\n if (s !== undefined) _seed = s;\n\n // Mulberry32 generator\n\n var t = _seed += 0x6D2B79F5;\n t = Math.imul(t ^ t >>> 15, t | 1);\n t ^= t + Math.imul(t ^ t >>> 7, t | 61);\n return ((t ^ t >>> 14) >>> 0) / 4294967296;\n}\nfunction degToRad(degrees) {\n return degrees * DEG2RAD;\n}\nfunction radToDeg(radians) {\n return radians * RAD2DEG;\n}\nfunction isPowerOfTwo(value) {\n return (value & value - 1) === 0 && value !== 0;\n}\nfunction ceilPowerOfTwo(value) {\n return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2));\n}\nfunction floorPowerOfTwo(value) {\n return Math.pow(2, Math.floor(Math.log(value) / Math.LN2));\n}\nfunction setQuaternionFromProperEuler(q, a, b, c, order) {\n // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles\n\n // rotations are applied to the axes in the order specified by 'order'\n // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'\n // angles are in radians\n\n var cos = Math.cos;\n var sin = Math.sin;\n var c2 = cos(b / 2);\n var s2 = sin(b / 2);\n var c13 = cos((a + c) / 2);\n var s13 = sin((a + c) / 2);\n var c1_3 = cos((a - c) / 2);\n var s1_3 = sin((a - c) / 2);\n var c3_1 = cos((c - a) / 2);\n var s3_1 = sin((c - a) / 2);\n switch (order) {\n case 'XYX':\n q.set(c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13);\n break;\n case 'YZY':\n q.set(s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13);\n break;\n case 'ZXZ':\n q.set(s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13);\n break;\n case 'XZX':\n q.set(c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13);\n break;\n case 'YXY':\n q.set(s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13);\n break;\n case 'ZYZ':\n q.set(s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13);\n break;\n default:\n console.warn('THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order);\n }\n}\nfunction denormalize(value, array) {\n switch (array.constructor) {\n case Float32Array:\n return value;\n case Uint16Array:\n return value / 65535.0;\n case Uint8Array:\n return value / 255.0;\n case Int16Array:\n return Math.max(value / 32767.0, -1.0);\n case Int8Array:\n return Math.max(value / 127.0, -1.0);\n default:\n throw new Error('Invalid component type.');\n }\n}\nfunction normalize(value, array) {\n switch (array.constructor) {\n case Float32Array:\n return value;\n case Uint16Array:\n return Math.round(value * 65535.0);\n case Uint8Array:\n return Math.round(value * 255.0);\n case Int16Array:\n return Math.round(value * 32767.0);\n case Int8Array:\n return Math.round(value * 127.0);\n default:\n throw new Error('Invalid component type.');\n }\n}\nvar MathUtils = {\n DEG2RAD: DEG2RAD,\n RAD2DEG: RAD2DEG,\n generateUUID: generateUUID,\n clamp: clamp,\n euclideanModulo: euclideanModulo,\n mapLinear: mapLinear,\n inverseLerp: inverseLerp,\n lerp: lerp,\n damp: damp,\n pingpong: pingpong,\n smoothstep: smoothstep,\n smootherstep: smootherstep,\n randInt: randInt,\n randFloat: randFloat,\n randFloatSpread: randFloatSpread,\n seededRandom: seededRandom,\n degToRad: degToRad,\n radToDeg: radToDeg,\n isPowerOfTwo: isPowerOfTwo,\n ceilPowerOfTwo: ceilPowerOfTwo,\n floorPowerOfTwo: floorPowerOfTwo,\n setQuaternionFromProperEuler: setQuaternionFromProperEuler,\n normalize: normalize,\n denormalize: denormalize\n};\nvar Vector2 = /*#__PURE__*/function (_Symbol$iterator) {\n function Vector2() {\n var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n _classCallCheck(this, Vector2);\n Vector2.prototype.isVector2 = true;\n this.x = x;\n this.y = y;\n }\n _createClass(Vector2, [{\n key: \"width\",\n get: function get() {\n return this.x;\n },\n set: function set(value) {\n this.x = value;\n }\n }, {\n key: \"height\",\n get: function get() {\n return this.y;\n },\n set: function set(value) {\n this.y = value;\n }\n }, {\n key: \"set\",\n value: function set(x, y) {\n this.x = x;\n this.y = y;\n return this;\n }\n }, {\n key: \"setScalar\",\n value: function setScalar(scalar) {\n this.x = scalar;\n this.y = scalar;\n return this;\n }\n }, {\n key: \"setX\",\n value: function setX(x) {\n this.x = x;\n return this;\n }\n }, {\n key: \"setY\",\n value: function setY(y) {\n this.y = y;\n return this;\n }\n }, {\n key: \"setComponent\",\n value: function setComponent(index, value) {\n switch (index) {\n case 0:\n this.x = value;\n break;\n case 1:\n this.y = value;\n break;\n default:\n throw new Error('index is out of range: ' + index);\n }\n return this;\n }\n }, {\n key: \"getComponent\",\n value: function getComponent(index) {\n switch (index) {\n case 0:\n return this.x;\n case 1:\n return this.y;\n default:\n throw new Error('index is out of range: ' + index);\n }\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor(this.x, this.y);\n }\n }, {\n key: \"copy\",\n value: function copy(v) {\n this.x = v.x;\n this.y = v.y;\n return this;\n }\n }, {\n key: \"add\",\n value: function add(v) {\n this.x += v.x;\n this.y += v.y;\n return this;\n }\n }, {\n key: \"addScalar\",\n value: function addScalar(s) {\n this.x += s;\n this.y += s;\n return this;\n }\n }, {\n key: \"addVectors\",\n value: function addVectors(a, b) {\n this.x = a.x + b.x;\n this.y = a.y + b.y;\n return this;\n }\n }, {\n key: \"addScaledVector\",\n value: function addScaledVector(v, s) {\n this.x += v.x * s;\n this.y += v.y * s;\n return this;\n }\n }, {\n key: \"sub\",\n value: function sub(v) {\n this.x -= v.x;\n this.y -= v.y;\n return this;\n }\n }, {\n key: \"subScalar\",\n value: function subScalar(s) {\n this.x -= s;\n this.y -= s;\n return this;\n }\n }, {\n key: \"subVectors\",\n value: function subVectors(a, b) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n return this;\n }\n }, {\n key: \"multiply\",\n value: function multiply(v) {\n this.x *= v.x;\n this.y *= v.y;\n return this;\n }\n }, {\n key: \"multiplyScalar\",\n value: function multiplyScalar(scalar) {\n this.x *= scalar;\n this.y *= scalar;\n return this;\n }\n }, {\n key: \"divide\",\n value: function divide(v) {\n this.x /= v.x;\n this.y /= v.y;\n return this;\n }\n }, {\n key: \"divideScalar\",\n value: function divideScalar(scalar) {\n return this.multiplyScalar(1 / scalar);\n }\n }, {\n key: \"applyMatrix3\",\n value: function applyMatrix3(m) {\n var x = this.x,\n y = this.y;\n var e = m.elements;\n this.x = e[0] * x + e[3] * y + e[6];\n this.y = e[1] * x + e[4] * y + e[7];\n return this;\n }\n }, {\n key: \"min\",\n value: function min(v) {\n this.x = Math.min(this.x, v.x);\n this.y = Math.min(this.y, v.y);\n return this;\n }\n }, {\n key: \"max\",\n value: function max(v) {\n this.x = Math.max(this.x, v.x);\n this.y = Math.max(this.y, v.y);\n return this;\n }\n }, {\n key: \"clamp\",\n value: function clamp(min, max) {\n // assumes min < max, componentwise\n\n this.x = Math.max(min.x, Math.min(max.x, this.x));\n this.y = Math.max(min.y, Math.min(max.y, this.y));\n return this;\n }\n }, {\n key: \"clampScalar\",\n value: function clampScalar(minVal, maxVal) {\n this.x = Math.max(minVal, Math.min(maxVal, this.x));\n this.y = Math.max(minVal, Math.min(maxVal, this.y));\n return this;\n }\n }, {\n key: \"clampLength\",\n value: function clampLength(min, max) {\n var length = this.length();\n return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));\n }\n }, {\n key: \"floor\",\n value: function floor() {\n this.x = Math.floor(this.x);\n this.y = Math.floor(this.y);\n return this;\n }\n }, {\n key: \"ceil\",\n value: function ceil() {\n this.x = Math.ceil(this.x);\n this.y = Math.ceil(this.y);\n return this;\n }\n }, {\n key: \"round\",\n value: function round() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n return this;\n }\n }, {\n key: \"roundToZero\",\n value: function roundToZero() {\n this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x);\n this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y);\n return this;\n }\n }, {\n key: \"negate\",\n value: function negate() {\n this.x = -this.x;\n this.y = -this.y;\n return this;\n }\n }, {\n key: \"dot\",\n value: function dot(v) {\n return this.x * v.x + this.y * v.y;\n }\n }, {\n key: \"cross\",\n value: function cross(v) {\n return this.x * v.y - this.y * v.x;\n }\n }, {\n key: \"lengthSq\",\n value: function lengthSq() {\n return this.x * this.x + this.y * this.y;\n }\n }, {\n key: \"length\",\n value: function length() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }\n }, {\n key: \"manhattanLength\",\n value: function manhattanLength() {\n return Math.abs(this.x) + Math.abs(this.y);\n }\n }, {\n key: \"normalize\",\n value: function normalize() {\n return this.divideScalar(this.length() || 1);\n }\n }, {\n key: \"angle\",\n value: function angle() {\n // computes the angle in radians with respect to the positive x-axis\n\n var angle = Math.atan2(-this.y, -this.x) + Math.PI;\n return angle;\n }\n }, {\n key: \"angleTo\",\n value: function angleTo(v) {\n var denominator = Math.sqrt(this.lengthSq() * v.lengthSq());\n if (denominator === 0) return Math.PI / 2;\n var theta = this.dot(v) / denominator;\n\n // clamp, to handle numerical problems\n\n return Math.acos(clamp(theta, -1, 1));\n }\n }, {\n key: \"distanceTo\",\n value: function distanceTo(v) {\n return Math.sqrt(this.distanceToSquared(v));\n }\n }, {\n key: \"distanceToSquared\",\n value: function distanceToSquared(v) {\n var dx = this.x - v.x,\n dy = this.y - v.y;\n return dx * dx + dy * dy;\n }\n }, {\n key: \"manhattanDistanceTo\",\n value: function manhattanDistanceTo(v) {\n return Math.abs(this.x - v.x) + Math.abs(this.y - v.y);\n }\n }, {\n key: \"setLength\",\n value: function setLength(length) {\n return this.normalize().multiplyScalar(length);\n }\n }, {\n key: \"lerp\",\n value: function lerp(v, alpha) {\n this.x += (v.x - this.x) * alpha;\n this.y += (v.y - this.y) * alpha;\n return this;\n }\n }, {\n key: \"lerpVectors\",\n value: function lerpVectors(v1, v2, alpha) {\n this.x = v1.x + (v2.x - v1.x) * alpha;\n this.y = v1.y + (v2.y - v1.y) * alpha;\n return this;\n }\n }, {\n key: \"equals\",\n value: function equals(v) {\n return v.x === this.x && v.y === this.y;\n }\n }, {\n key: \"fromArray\",\n value: function fromArray(array) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n this.x = array[offset];\n this.y = array[offset + 1];\n return this;\n }\n }, {\n key: \"toArray\",\n value: function toArray() {\n var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n array[offset] = this.x;\n array[offset + 1] = this.y;\n return array;\n }\n }, {\n key: \"fromBufferAttribute\",\n value: function fromBufferAttribute(attribute, index) {\n this.x = attribute.getX(index);\n this.y = attribute.getY(index);\n return this;\n }\n }, {\n key: \"rotateAround\",\n value: function rotateAround(center, angle) {\n var c = Math.cos(angle),\n s = Math.sin(angle);\n var x = this.x - center.x;\n var y = this.y - center.y;\n this.x = x * c - y * s + center.x;\n this.y = x * s + y * c + center.y;\n return this;\n }\n }, {\n key: \"random\",\n value: function random() {\n this.x = Math.random();\n this.y = Math.random();\n return this;\n }\n }, {\n key: _Symbol$iterator,\n value: /*#__PURE__*/_regeneratorRuntime().mark(function value() {\n return _regeneratorRuntime().wrap(function value$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return this.x;\n case 2:\n _context2.next = 4;\n return this.y;\n case 4:\n case \"end\":\n return _context2.stop();\n }\n }, value, this);\n })\n }]);\n return Vector2;\n}(Symbol.iterator);\nvar Matrix3 = /*#__PURE__*/function () {\n function Matrix3() {\n _classCallCheck(this, Matrix3);\n Matrix3.prototype.isMatrix3 = true;\n this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1];\n }\n _createClass(Matrix3, [{\n key: \"set\",\n value: function set(n11, n12, n13, n21, n22, n23, n31, n32, n33) {\n var te = this.elements;\n te[0] = n11;\n te[1] = n21;\n te[2] = n31;\n te[3] = n12;\n te[4] = n22;\n te[5] = n32;\n te[6] = n13;\n te[7] = n23;\n te[8] = n33;\n return this;\n }\n }, {\n key: \"identity\",\n value: function identity() {\n this.set(1, 0, 0, 0, 1, 0, 0, 0, 1);\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(m) {\n var te = this.elements;\n var me = m.elements;\n te[0] = me[0];\n te[1] = me[1];\n te[2] = me[2];\n te[3] = me[3];\n te[4] = me[4];\n te[5] = me[5];\n te[6] = me[6];\n te[7] = me[7];\n te[8] = me[8];\n return this;\n }\n }, {\n key: \"extractBasis\",\n value: function extractBasis(xAxis, yAxis, zAxis) {\n xAxis.setFromMatrix3Column(this, 0);\n yAxis.setFromMatrix3Column(this, 1);\n zAxis.setFromMatrix3Column(this, 2);\n return this;\n }\n }, {\n key: \"setFromMatrix4\",\n value: function setFromMatrix4(m) {\n var me = m.elements;\n this.set(me[0], me[4], me[8], me[1], me[5], me[9], me[2], me[6], me[10]);\n return this;\n }\n }, {\n key: \"multiply\",\n value: function multiply(m) {\n return this.multiplyMatrices(this, m);\n }\n }, {\n key: \"premultiply\",\n value: function premultiply(m) {\n return this.multiplyMatrices(m, this);\n }\n }, {\n key: \"multiplyMatrices\",\n value: function multiplyMatrices(a, b) {\n var ae = a.elements;\n var be = b.elements;\n var te = this.elements;\n var a11 = ae[0],\n a12 = ae[3],\n a13 = ae[6];\n var a21 = ae[1],\n a22 = ae[4],\n a23 = ae[7];\n var a31 = ae[2],\n a32 = ae[5],\n a33 = ae[8];\n var b11 = be[0],\n b12 = be[3],\n b13 = be[6];\n var b21 = be[1],\n b22 = be[4],\n b23 = be[7];\n var b31 = be[2],\n b32 = be[5],\n b33 = be[8];\n te[0] = a11 * b11 + a12 * b21 + a13 * b31;\n te[3] = a11 * b12 + a12 * b22 + a13 * b32;\n te[6] = a11 * b13 + a12 * b23 + a13 * b33;\n te[1] = a21 * b11 + a22 * b21 + a23 * b31;\n te[4] = a21 * b12 + a22 * b22 + a23 * b32;\n te[7] = a21 * b13 + a22 * b23 + a23 * b33;\n te[2] = a31 * b11 + a32 * b21 + a33 * b31;\n te[5] = a31 * b12 + a32 * b22 + a33 * b32;\n te[8] = a31 * b13 + a32 * b23 + a33 * b33;\n return this;\n }\n }, {\n key: \"multiplyScalar\",\n value: function multiplyScalar(s) {\n var te = this.elements;\n te[0] *= s;\n te[3] *= s;\n te[6] *= s;\n te[1] *= s;\n te[4] *= s;\n te[7] *= s;\n te[2] *= s;\n te[5] *= s;\n te[8] *= s;\n return this;\n }\n }, {\n key: \"determinant\",\n value: function determinant() {\n var te = this.elements;\n var a = te[0],\n b = te[1],\n c = te[2],\n d = te[3],\n e = te[4],\n f = te[5],\n g = te[6],\n h = te[7],\n i = te[8];\n return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g;\n }\n }, {\n key: \"invert\",\n value: function invert() {\n var te = this.elements,\n n11 = te[0],\n n21 = te[1],\n n31 = te[2],\n n12 = te[3],\n n22 = te[4],\n n32 = te[5],\n n13 = te[6],\n n23 = te[7],\n n33 = te[8],\n t11 = n33 * n22 - n32 * n23,\n t12 = n32 * n13 - n33 * n12,\n t13 = n23 * n12 - n22 * n13,\n det = n11 * t11 + n21 * t12 + n31 * t13;\n if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);\n var detInv = 1 / det;\n te[0] = t11 * detInv;\n te[1] = (n31 * n23 - n33 * n21) * detInv;\n te[2] = (n32 * n21 - n31 * n22) * detInv;\n te[3] = t12 * detInv;\n te[4] = (n33 * n11 - n31 * n13) * detInv;\n te[5] = (n31 * n12 - n32 * n11) * detInv;\n te[6] = t13 * detInv;\n te[7] = (n21 * n13 - n23 * n11) * detInv;\n te[8] = (n22 * n11 - n21 * n12) * detInv;\n return this;\n }\n }, {\n key: \"transpose\",\n value: function transpose() {\n var tmp;\n var m = this.elements;\n tmp = m[1];\n m[1] = m[3];\n m[3] = tmp;\n tmp = m[2];\n m[2] = m[6];\n m[6] = tmp;\n tmp = m[5];\n m[5] = m[7];\n m[7] = tmp;\n return this;\n }\n }, {\n key: \"getNormalMatrix\",\n value: function getNormalMatrix(matrix4) {\n return this.setFromMatrix4(matrix4).invert().transpose();\n }\n }, {\n key: \"transposeIntoArray\",\n value: function transposeIntoArray(r) {\n var m = this.elements;\n r[0] = m[0];\n r[1] = m[3];\n r[2] = m[6];\n r[3] = m[1];\n r[4] = m[4];\n r[5] = m[7];\n r[6] = m[2];\n r[7] = m[5];\n r[8] = m[8];\n return this;\n }\n }, {\n key: \"setUvTransform\",\n value: function setUvTransform(tx, ty, sx, sy, rotation, cx, cy) {\n var c = Math.cos(rotation);\n var s = Math.sin(rotation);\n this.set(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c, -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1);\n return this;\n }\n\n //\n }, {\n key: \"scale\",\n value: function scale(sx, sy) {\n this.premultiply(_m3.makeScale(sx, sy));\n return this;\n }\n }, {\n key: \"rotate\",\n value: function rotate(theta) {\n this.premultiply(_m3.makeRotation(-theta));\n return this;\n }\n }, {\n key: \"translate\",\n value: function translate(tx, ty) {\n this.premultiply(_m3.makeTranslation(tx, ty));\n return this;\n }\n\n // for 2D Transforms\n }, {\n key: \"makeTranslation\",\n value: function makeTranslation(x, y) {\n this.set(1, 0, x, 0, 1, y, 0, 0, 1);\n return this;\n }\n }, {\n key: \"makeRotation\",\n value: function makeRotation(theta) {\n // counterclockwise\n\n var c = Math.cos(theta);\n var s = Math.sin(theta);\n this.set(c, -s, 0, s, c, 0, 0, 0, 1);\n return this;\n }\n }, {\n key: \"makeScale\",\n value: function makeScale(x, y) {\n this.set(x, 0, 0, 0, y, 0, 0, 0, 1);\n return this;\n }\n\n //\n }, {\n key: \"equals\",\n value: function equals(matrix) {\n var te = this.elements;\n var me = matrix.elements;\n for (var i = 0; i < 9; i++) {\n if (te[i] !== me[i]) return false;\n }\n return true;\n }\n }, {\n key: \"fromArray\",\n value: function fromArray(array) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n for (var i = 0; i < 9; i++) {\n this.elements[i] = array[i + offset];\n }\n return this;\n }\n }, {\n key: \"toArray\",\n value: function toArray() {\n var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var te = this.elements;\n array[offset] = te[0];\n array[offset + 1] = te[1];\n array[offset + 2] = te[2];\n array[offset + 3] = te[3];\n array[offset + 4] = te[4];\n array[offset + 5] = te[5];\n array[offset + 6] = te[6];\n array[offset + 7] = te[7];\n array[offset + 8] = te[8];\n return array;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().fromArray(this.elements);\n }\n }]);\n return Matrix3;\n}();\nvar _m3 = /*@__PURE__*/new Matrix3();\nfunction arrayNeedsUint32(array) {\n // assumes larger values usually on last\n\n for (var i = array.length - 1; i >= 0; --i) {\n if (array[i] >= 65535) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565\n }\n\n return false;\n}\nvar TYPED_ARRAYS = {\n Int8Array: Int8Array,\n Uint8Array: Uint8Array,\n Uint8ClampedArray: Uint8ClampedArray,\n Int16Array: Int16Array,\n Uint16Array: Uint16Array,\n Int32Array: Int32Array,\n Uint32Array: Uint32Array,\n Float32Array: Float32Array,\n Float64Array: Float64Array\n};\nfunction getTypedArray(type, buffer) {\n return new TYPED_ARRAYS[type](buffer);\n}\nfunction createElementNS(name) {\n return document.createElementNS('http://www.w3.org/1999/xhtml', name);\n}\nfunction SRGBToLinear(c) {\n return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4);\n}\nfunction LinearToSRGB(c) {\n return c < 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055;\n}\n\n/**\n * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping\n * or clipping. Based on W3C specifications for sRGB and Display P3,\n * and ICC specifications for the D50 connection space. Values in/out\n * are _linear_ sRGB and _linear_ Display P3.\n *\n * Note that both sRGB and Display P3 use the sRGB transfer functions.\n *\n * Reference:\n * - http://www.russellcottrell.com/photo/matrixCalculator.htm\n */\n\nvar LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/new Matrix3().fromArray([0.8224621, 0.0331941, 0.0170827, 0.1775380, 0.9668058, 0.0723974, -0.0000001, 0.0000001, 0.9105199]);\nvar LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/new Matrix3().fromArray([1.2249401, -0.0420569, -0.0196376, -0.2249404, 1.0420571, -0.0786361, 0.0000001, 0.0000000, 1.0982735]);\nfunction DisplayP3ToLinearSRGB(color) {\n // Display P3 uses the sRGB transfer functions\n return color.convertSRGBToLinear().applyMatrix3(LINEAR_DISPLAY_P3_TO_LINEAR_SRGB);\n}\nfunction LinearSRGBToDisplayP3(color) {\n // Display P3 uses the sRGB transfer functions\n return color.applyMatrix3(LINEAR_SRGB_TO_LINEAR_DISPLAY_P3).convertLinearToSRGB();\n}\n\n// Conversions from to Linear-sRGB reference space.\nvar TO_LINEAR = (_TO_LINEAR = {}, _defineProperty(_TO_LINEAR, LinearSRGBColorSpace, function (color) {\n return color;\n}), _defineProperty(_TO_LINEAR, SRGBColorSpace, function (color) {\n return color.convertSRGBToLinear();\n}), _defineProperty(_TO_LINEAR, DisplayP3ColorSpace, DisplayP3ToLinearSRGB), _TO_LINEAR);\n\n// Conversions to from Linear-sRGB reference space.\nvar FROM_LINEAR = (_FROM_LINEAR = {}, _defineProperty(_FROM_LINEAR, LinearSRGBColorSpace, function (color) {\n return color;\n}), _defineProperty(_FROM_LINEAR, SRGBColorSpace, function (color) {\n return color.convertLinearToSRGB();\n}), _defineProperty(_FROM_LINEAR, DisplayP3ColorSpace, LinearSRGBToDisplayP3), _FROM_LINEAR);\nvar ColorManagement = {\n enabled: false,\n get legacyMode() {\n console.warn('THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.');\n return !this.enabled;\n },\n set legacyMode(legacyMode) {\n console.warn('THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.');\n this.enabled = !legacyMode;\n },\n get workingColorSpace() {\n return LinearSRGBColorSpace;\n },\n set workingColorSpace(colorSpace) {\n console.warn('THREE.ColorManagement: .workingColorSpace is readonly.');\n },\n convert: function convert(color, sourceColorSpace, targetColorSpace) {\n if (this.enabled === false || sourceColorSpace === targetColorSpace || !sourceColorSpace || !targetColorSpace) {\n return color;\n }\n var sourceToLinear = TO_LINEAR[sourceColorSpace];\n var targetFromLinear = FROM_LINEAR[targetColorSpace];\n if (sourceToLinear === undefined || targetFromLinear === undefined) {\n throw new Error(\"Unsupported color space conversion, \\\"\".concat(sourceColorSpace, \"\\\" to \\\"\").concat(targetColorSpace, \"\\\".\"));\n }\n return targetFromLinear(sourceToLinear(color));\n },\n fromWorkingColorSpace: function fromWorkingColorSpace(color, targetColorSpace) {\n return this.convert(color, this.workingColorSpace, targetColorSpace);\n },\n toWorkingColorSpace: function toWorkingColorSpace(color, sourceColorSpace) {\n return this.convert(color, sourceColorSpace, this.workingColorSpace);\n }\n};\nvar _canvas;\nvar ImageUtils = /*#__PURE__*/function () {\n function ImageUtils() {\n _classCallCheck(this, ImageUtils);\n }\n _createClass(ImageUtils, null, [{\n key: \"getDataURL\",\n value: function getDataURL(image) {\n if (/^data:/i.test(image.src)) {\n return image.src;\n }\n if (typeof HTMLCanvasElement === 'undefined') {\n return image.src;\n }\n var canvas;\n if (image instanceof HTMLCanvasElement) {\n canvas = image;\n } else {\n if (_canvas === undefined) _canvas = createElementNS('canvas');\n _canvas.width = image.width;\n _canvas.height = image.height;\n var context = _canvas.getContext('2d');\n if (image instanceof ImageData) {\n context.putImageData(image, 0, 0);\n } else {\n context.drawImage(image, 0, 0, image.width, image.height);\n }\n canvas = _canvas;\n }\n if (canvas.width > 2048 || canvas.height > 2048) {\n console.warn('THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image);\n return canvas.toDataURL('image/jpeg', 0.6);\n } else {\n return canvas.toDataURL('image/png');\n }\n }\n }, {\n key: \"sRGBToLinear\",\n value: function sRGBToLinear(image) {\n if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {\n var canvas = createElementNS('canvas');\n canvas.width = image.width;\n canvas.height = image.height;\n var context = canvas.getContext('2d');\n context.drawImage(image, 0, 0, image.width, image.height);\n var imageData = context.getImageData(0, 0, image.width, image.height);\n var data = imageData.data;\n for (var i = 0; i < data.length; i++) {\n data[i] = SRGBToLinear(data[i] / 255) * 255;\n }\n context.putImageData(imageData, 0, 0);\n return canvas;\n } else if (image.data) {\n var _data = image.data.slice(0);\n for (var _i = 0; _i < _data.length; _i++) {\n if (_data instanceof Uint8Array || _data instanceof Uint8ClampedArray) {\n _data[_i] = Math.floor(SRGBToLinear(_data[_i] / 255) * 255);\n } else {\n // assuming float\n\n _data[_i] = SRGBToLinear(_data[_i]);\n }\n }\n return {\n data: _data,\n width: image.width,\n height: image.height\n };\n } else {\n console.warn('THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.');\n return image;\n }\n }\n }]);\n return ImageUtils;\n}();\nvar Source = /*#__PURE__*/function () {\n function Source() {\n var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n _classCallCheck(this, Source);\n this.isSource = true;\n this.uuid = generateUUID();\n this.data = data;\n this.version = 0;\n }\n _createClass(Source, [{\n key: \"needsUpdate\",\n set: function set(value) {\n if (value === true) this.version++;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(meta) {\n var isRootObject = meta === undefined || typeof meta === 'string';\n if (!isRootObject && meta.images[this.uuid] !== undefined) {\n return meta.images[this.uuid];\n }\n var output = {\n uuid: this.uuid,\n url: ''\n };\n var data = this.data;\n if (data !== null) {\n var url;\n if (Array.isArray(data)) {\n // cube texture\n\n url = [];\n for (var i = 0, l = data.length; i < l; i++) {\n if (data[i].isDataTexture) {\n url.push(serializeImage(data[i].image));\n } else {\n url.push(serializeImage(data[i]));\n }\n }\n } else {\n // texture\n\n url = serializeImage(data);\n }\n output.url = url;\n }\n if (!isRootObject) {\n meta.images[this.uuid] = output;\n }\n return output;\n }\n }]);\n return Source;\n}();\nfunction serializeImage(image) {\n if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {\n // default images\n\n return ImageUtils.getDataURL(image);\n } else {\n if (image.data) {\n // images of DataTexture\n\n return {\n data: Array.from(image.data),\n width: image.width,\n height: image.height,\n type: image.data.constructor.name\n };\n } else {\n console.warn('THREE.Texture: Unable to serialize Texture.');\n return {};\n }\n }\n}\nvar textureId = 0;\nvar Texture = /*#__PURE__*/function (_EventDispatcher) {\n _inherits(Texture, _EventDispatcher);\n var _super = _createSuper(Texture);\n function Texture() {\n var _this2;\n var image = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Texture.DEFAULT_IMAGE;\n var mapping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Texture.DEFAULT_MAPPING;\n var wrapS = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ClampToEdgeWrapping;\n var wrapT = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ClampToEdgeWrapping;\n var magFilter = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : LinearFilter;\n var minFilter = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : LinearMipmapLinearFilter;\n var format = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : RGBAFormat;\n var type = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : UnsignedByteType;\n var anisotropy = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : Texture.DEFAULT_ANISOTROPY;\n var encoding = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : LinearEncoding;\n _classCallCheck(this, Texture);\n _this2 = _super.call(this);\n _this2.isTexture = true;\n Object.defineProperty(_assertThisInitialized(_this2), 'id', {\n value: textureId++\n });\n _this2.uuid = generateUUID();\n _this2.name = '';\n _this2.source = new Source(image);\n _this2.mipmaps = [];\n _this2.mapping = mapping;\n _this2.channel = 0;\n _this2.wrapS = wrapS;\n _this2.wrapT = wrapT;\n _this2.magFilter = magFilter;\n _this2.minFilter = minFilter;\n _this2.anisotropy = anisotropy;\n _this2.format = format;\n _this2.internalFormat = null;\n _this2.type = type;\n _this2.offset = new Vector2(0, 0);\n _this2.repeat = new Vector2(1, 1);\n _this2.center = new Vector2(0, 0);\n _this2.rotation = 0;\n _this2.matrixAutoUpdate = true;\n _this2.matrix = new Matrix3();\n _this2.generateMipmaps = true;\n _this2.premultiplyAlpha = false;\n _this2.flipY = true;\n _this2.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)\n\n // Values of encoding !== THREE.LinearEncoding only supported on map, envMap and emissiveMap.\n //\n // Also changing the encoding after already used by a Material will not automatically make the Material\n // update. You need to explicitly call Material.needsUpdate to trigger it to recompile.\n _this2.encoding = encoding;\n _this2.userData = {};\n _this2.version = 0;\n _this2.onUpdate = null;\n _this2.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not\n _this2.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)\n return _this2;\n }\n _createClass(Texture, [{\n key: \"image\",\n get: function get() {\n return this.source.data;\n },\n set: function set() {\n var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n this.source.data = value;\n }\n }, {\n key: \"updateMatrix\",\n value: function updateMatrix() {\n this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y);\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n this.name = source.name;\n this.source = source.source;\n this.mipmaps = source.mipmaps.slice(0);\n this.mapping = source.mapping;\n this.channel = source.channel;\n this.wrapS = source.wrapS;\n this.wrapT = source.wrapT;\n this.magFilter = source.magFilter;\n this.minFilter = source.minFilter;\n this.anisotropy = source.anisotropy;\n this.format = source.format;\n this.internalFormat = source.internalFormat;\n this.type = source.type;\n this.offset.copy(source.offset);\n this.repeat.copy(source.repeat);\n this.center.copy(source.center);\n this.rotation = source.rotation;\n this.matrixAutoUpdate = source.matrixAutoUpdate;\n this.matrix.copy(source.matrix);\n this.generateMipmaps = source.generateMipmaps;\n this.premultiplyAlpha = source.premultiplyAlpha;\n this.flipY = source.flipY;\n this.unpackAlignment = source.unpackAlignment;\n this.encoding = source.encoding;\n this.userData = JSON.parse(JSON.stringify(source.userData));\n this.needsUpdate = true;\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(meta) {\n var isRootObject = meta === undefined || typeof meta === 'string';\n if (!isRootObject && meta.textures[this.uuid] !== undefined) {\n return meta.textures[this.uuid];\n }\n var output = {\n metadata: {\n version: 4.5,\n type: 'Texture',\n generator: 'Texture.toJSON'\n },\n uuid: this.uuid,\n name: this.name,\n image: this.source.toJSON(meta).uuid,\n mapping: this.mapping,\n channel: this.channel,\n repeat: [this.repeat.x, this.repeat.y],\n offset: [this.offset.x, this.offset.y],\n center: [this.center.x, this.center.y],\n rotation: this.rotation,\n wrap: [this.wrapS, this.wrapT],\n format: this.format,\n internalFormat: this.internalFormat,\n type: this.type,\n encoding: this.encoding,\n minFilter: this.minFilter,\n magFilter: this.magFilter,\n anisotropy: this.anisotropy,\n flipY: this.flipY,\n generateMipmaps: this.generateMipmaps,\n premultiplyAlpha: this.premultiplyAlpha,\n unpackAlignment: this.unpackAlignment\n };\n if (Object.keys(this.userData).length > 0) output.userData = this.userData;\n if (!isRootObject) {\n meta.textures[this.uuid] = output;\n }\n return output;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.dispatchEvent({\n type: 'dispose'\n });\n }\n }, {\n key: \"transformUv\",\n value: function transformUv(uv) {\n if (this.mapping !== UVMapping) return uv;\n uv.applyMatrix3(this.matrix);\n if (uv.x < 0 || uv.x > 1) {\n switch (this.wrapS) {\n case RepeatWrapping:\n uv.x = uv.x - Math.floor(uv.x);\n break;\n case ClampToEdgeWrapping:\n uv.x = uv.x < 0 ? 0 : 1;\n break;\n case MirroredRepeatWrapping:\n if (Math.abs(Math.floor(uv.x) % 2) === 1) {\n uv.x = Math.ceil(uv.x) - uv.x;\n } else {\n uv.x = uv.x - Math.floor(uv.x);\n }\n break;\n }\n }\n if (uv.y < 0 || uv.y > 1) {\n switch (this.wrapT) {\n case RepeatWrapping:\n uv.y = uv.y - Math.floor(uv.y);\n break;\n case ClampToEdgeWrapping:\n uv.y = uv.y < 0 ? 0 : 1;\n break;\n case MirroredRepeatWrapping:\n if (Math.abs(Math.floor(uv.y) % 2) === 1) {\n uv.y = Math.ceil(uv.y) - uv.y;\n } else {\n uv.y = uv.y - Math.floor(uv.y);\n }\n break;\n }\n }\n if (this.flipY) {\n uv.y = 1 - uv.y;\n }\n return uv;\n }\n }, {\n key: \"needsUpdate\",\n set: function set(value) {\n if (value === true) {\n this.version++;\n this.source.needsUpdate = true;\n }\n }\n }]);\n return Texture;\n}(EventDispatcher);\nTexture.DEFAULT_IMAGE = null;\nTexture.DEFAULT_MAPPING = UVMapping;\nTexture.DEFAULT_ANISOTROPY = 1;\nvar Vector4 = /*#__PURE__*/function (_Symbol$iterator2) {\n function Vector4() {\n var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var w = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n _classCallCheck(this, Vector4);\n Vector4.prototype.isVector4 = true;\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n }\n _createClass(Vector4, [{\n key: \"width\",\n get: function get() {\n return this.z;\n },\n set: function set(value) {\n this.z = value;\n }\n }, {\n key: \"height\",\n get: function get() {\n return this.w;\n },\n set: function set(value) {\n this.w = value;\n }\n }, {\n key: \"set\",\n value: function set(x, y, z, w) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n return this;\n }\n }, {\n key: \"setScalar\",\n value: function setScalar(scalar) {\n this.x = scalar;\n this.y = scalar;\n this.z = scalar;\n this.w = scalar;\n return this;\n }\n }, {\n key: \"setX\",\n value: function setX(x) {\n this.x = x;\n return this;\n }\n }, {\n key: \"setY\",\n value: function setY(y) {\n this.y = y;\n return this;\n }\n }, {\n key: \"setZ\",\n value: function setZ(z) {\n this.z = z;\n return this;\n }\n }, {\n key: \"setW\",\n value: function setW(w) {\n this.w = w;\n return this;\n }\n }, {\n key: \"setComponent\",\n value: function setComponent(index, value) {\n switch (index) {\n case 0:\n this.x = value;\n break;\n case 1:\n this.y = value;\n break;\n case 2:\n this.z = value;\n break;\n case 3:\n this.w = value;\n break;\n default:\n throw new Error('index is out of range: ' + index);\n }\n return this;\n }\n }, {\n key: \"getComponent\",\n value: function getComponent(index) {\n switch (index) {\n case 0:\n return this.x;\n case 1:\n return this.y;\n case 2:\n return this.z;\n case 3:\n return this.w;\n default:\n throw new Error('index is out of range: ' + index);\n }\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor(this.x, this.y, this.z, this.w);\n }\n }, {\n key: \"copy\",\n value: function copy(v) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n this.w = v.w !== undefined ? v.w : 1;\n return this;\n }\n }, {\n key: \"add\",\n value: function add(v) {\n this.x += v.x;\n this.y += v.y;\n this.z += v.z;\n this.w += v.w;\n return this;\n }\n }, {\n key: \"addScalar\",\n value: function addScalar(s) {\n this.x += s;\n this.y += s;\n this.z += s;\n this.w += s;\n return this;\n }\n }, {\n key: \"addVectors\",\n value: function addVectors(a, b) {\n this.x = a.x + b.x;\n this.y = a.y + b.y;\n this.z = a.z + b.z;\n this.w = a.w + b.w;\n return this;\n }\n }, {\n key: \"addScaledVector\",\n value: function addScaledVector(v, s) {\n this.x += v.x * s;\n this.y += v.y * s;\n this.z += v.z * s;\n this.w += v.w * s;\n return this;\n }\n }, {\n key: \"sub\",\n value: function sub(v) {\n this.x -= v.x;\n this.y -= v.y;\n this.z -= v.z;\n this.w -= v.w;\n return this;\n }\n }, {\n key: \"subScalar\",\n value: function subScalar(s) {\n this.x -= s;\n this.y -= s;\n this.z -= s;\n this.w -= s;\n return this;\n }\n }, {\n key: \"subVectors\",\n value: function subVectors(a, b) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n this.z = a.z - b.z;\n this.w = a.w - b.w;\n return this;\n }\n }, {\n key: \"multiply\",\n value: function multiply(v) {\n this.x *= v.x;\n this.y *= v.y;\n this.z *= v.z;\n this.w *= v.w;\n return this;\n }\n }, {\n key: \"multiplyScalar\",\n value: function multiplyScalar(scalar) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n this.w *= scalar;\n return this;\n }\n }, {\n key: \"applyMatrix4\",\n value: function applyMatrix4(m) {\n var x = this.x,\n y = this.y,\n z = this.z,\n w = this.w;\n var e = m.elements;\n this.x = e[0] * x + e[4] * y + e[8] * z + e[12] * w;\n this.y = e[1] * x + e[5] * y + e[9] * z + e[13] * w;\n this.z = e[2] * x + e[6] * y + e[10] * z + e[14] * w;\n this.w = e[3] * x + e[7] * y + e[11] * z + e[15] * w;\n return this;\n }\n }, {\n key: \"divideScalar\",\n value: function divideScalar(scalar) {\n return this.multiplyScalar(1 / scalar);\n }\n }, {\n key: \"setAxisAngleFromQuaternion\",\n value: function setAxisAngleFromQuaternion(q) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm\n\n // q is assumed to be normalized\n\n this.w = 2 * Math.acos(q.w);\n var s = Math.sqrt(1 - q.w * q.w);\n if (s < 0.0001) {\n this.x = 1;\n this.y = 0;\n this.z = 0;\n } else {\n this.x = q.x / s;\n this.y = q.y / s;\n this.z = q.z / s;\n }\n return this;\n }\n }, {\n key: \"setAxisAngleFromRotationMatrix\",\n value: function setAxisAngleFromRotationMatrix(m) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm\n\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n var angle, x, y, z; // variables for result\n var epsilon = 0.01,\n // margin to allow for rounding errors\n epsilon2 = 0.1,\n // margin to distinguish between 0 and 180 degrees\n\n te = m.elements,\n m11 = te[0],\n m12 = te[4],\n m13 = te[8],\n m21 = te[1],\n m22 = te[5],\n m23 = te[9],\n m31 = te[2],\n m32 = te[6],\n m33 = te[10];\n if (Math.abs(m12 - m21) < epsilon && Math.abs(m13 - m31) < epsilon && Math.abs(m23 - m32) < epsilon) {\n // singularity found\n // first check for identity matrix which must have +1 for all terms\n // in leading diagonal and zero in other terms\n\n if (Math.abs(m12 + m21) < epsilon2 && Math.abs(m13 + m31) < epsilon2 && Math.abs(m23 + m32) < epsilon2 && Math.abs(m11 + m22 + m33 - 3) < epsilon2) {\n // this singularity is identity matrix so angle = 0\n\n this.set(1, 0, 0, 0);\n return this; // zero angle, arbitrary axis\n }\n\n // otherwise this singularity is angle = 180\n\n angle = Math.PI;\n var xx = (m11 + 1) / 2;\n var yy = (m22 + 1) / 2;\n var zz = (m33 + 1) / 2;\n var xy = (m12 + m21) / 4;\n var xz = (m13 + m31) / 4;\n var yz = (m23 + m32) / 4;\n if (xx > yy && xx > zz) {\n // m11 is the largest diagonal term\n\n if (xx < epsilon) {\n x = 0;\n y = 0.707106781;\n z = 0.707106781;\n } else {\n x = Math.sqrt(xx);\n y = xy / x;\n z = xz / x;\n }\n } else if (yy > zz) {\n // m22 is the largest diagonal term\n\n if (yy < epsilon) {\n x = 0.707106781;\n y = 0;\n z = 0.707106781;\n } else {\n y = Math.sqrt(yy);\n x = xy / y;\n z = yz / y;\n }\n } else {\n // m33 is the largest diagonal term so base result on this\n\n if (zz < epsilon) {\n x = 0.707106781;\n y = 0.707106781;\n z = 0;\n } else {\n z = Math.sqrt(zz);\n x = xz / z;\n y = yz / z;\n }\n }\n this.set(x, y, z, angle);\n return this; // return 180 deg rotation\n }\n\n // as we have reached here there are no singularities so we can handle normally\n\n var s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12)); // used to normalize\n\n if (Math.abs(s) < 0.001) s = 1;\n\n // prevent divide by zero, should not happen if matrix is orthogonal and should be\n // caught by singularity test above, but I've left it in just in case\n\n this.x = (m32 - m23) / s;\n this.y = (m13 - m31) / s;\n this.z = (m21 - m12) / s;\n this.w = Math.acos((m11 + m22 + m33 - 1) / 2);\n return this;\n }\n }, {\n key: \"min\",\n value: function min(v) {\n this.x = Math.min(this.x, v.x);\n this.y = Math.min(this.y, v.y);\n this.z = Math.min(this.z, v.z);\n this.w = Math.min(this.w, v.w);\n return this;\n }\n }, {\n key: \"max\",\n value: function max(v) {\n this.x = Math.max(this.x, v.x);\n this.y = Math.max(this.y, v.y);\n this.z = Math.max(this.z, v.z);\n this.w = Math.max(this.w, v.w);\n return this;\n }\n }, {\n key: \"clamp\",\n value: function clamp(min, max) {\n // assumes min < max, componentwise\n\n this.x = Math.max(min.x, Math.min(max.x, this.x));\n this.y = Math.max(min.y, Math.min(max.y, this.y));\n this.z = Math.max(min.z, Math.min(max.z, this.z));\n this.w = Math.max(min.w, Math.min(max.w, this.w));\n return this;\n }\n }, {\n key: \"clampScalar\",\n value: function clampScalar(minVal, maxVal) {\n this.x = Math.max(minVal, Math.min(maxVal, this.x));\n this.y = Math.max(minVal, Math.min(maxVal, this.y));\n this.z = Math.max(minVal, Math.min(maxVal, this.z));\n this.w = Math.max(minVal, Math.min(maxVal, this.w));\n return this;\n }\n }, {\n key: \"clampLength\",\n value: function clampLength(min, max) {\n var length = this.length();\n return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));\n }\n }, {\n key: \"floor\",\n value: function floor() {\n this.x = Math.floor(this.x);\n this.y = Math.floor(this.y);\n this.z = Math.floor(this.z);\n this.w = Math.floor(this.w);\n return this;\n }\n }, {\n key: \"ceil\",\n value: function ceil() {\n this.x = Math.ceil(this.x);\n this.y = Math.ceil(this.y);\n this.z = Math.ceil(this.z);\n this.w = Math.ceil(this.w);\n return this;\n }\n }, {\n key: \"round\",\n value: function round() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n this.z = Math.round(this.z);\n this.w = Math.round(this.w);\n return this;\n }\n }, {\n key: \"roundToZero\",\n value: function roundToZero() {\n this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x);\n this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y);\n this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z);\n this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w);\n return this;\n }\n }, {\n key: \"negate\",\n value: function negate() {\n this.x = -this.x;\n this.y = -this.y;\n this.z = -this.z;\n this.w = -this.w;\n return this;\n }\n }, {\n key: \"dot\",\n value: function dot(v) {\n return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w;\n }\n }, {\n key: \"lengthSq\",\n value: function lengthSq() {\n return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;\n }\n }, {\n key: \"length\",\n value: function length() {\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);\n }\n }, {\n key: \"manhattanLength\",\n value: function manhattanLength() {\n return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w);\n }\n }, {\n key: \"normalize\",\n value: function normalize() {\n return this.divideScalar(this.length() || 1);\n }\n }, {\n key: \"setLength\",\n value: function setLength(length) {\n return this.normalize().multiplyScalar(length);\n }\n }, {\n key: \"lerp\",\n value: function lerp(v, alpha) {\n this.x += (v.x - this.x) * alpha;\n this.y += (v.y - this.y) * alpha;\n this.z += (v.z - this.z) * alpha;\n this.w += (v.w - this.w) * alpha;\n return this;\n }\n }, {\n key: \"lerpVectors\",\n value: function lerpVectors(v1, v2, alpha) {\n this.x = v1.x + (v2.x - v1.x) * alpha;\n this.y = v1.y + (v2.y - v1.y) * alpha;\n this.z = v1.z + (v2.z - v1.z) * alpha;\n this.w = v1.w + (v2.w - v1.w) * alpha;\n return this;\n }\n }, {\n key: \"equals\",\n value: function equals(v) {\n return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w;\n }\n }, {\n key: \"fromArray\",\n value: function fromArray(array) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n this.x = array[offset];\n this.y = array[offset + 1];\n this.z = array[offset + 2];\n this.w = array[offset + 3];\n return this;\n }\n }, {\n key: \"toArray\",\n value: function toArray() {\n var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n array[offset] = this.x;\n array[offset + 1] = this.y;\n array[offset + 2] = this.z;\n array[offset + 3] = this.w;\n return array;\n }\n }, {\n key: \"fromBufferAttribute\",\n value: function fromBufferAttribute(attribute, index) {\n this.x = attribute.getX(index);\n this.y = attribute.getY(index);\n this.z = attribute.getZ(index);\n this.w = attribute.getW(index);\n return this;\n }\n }, {\n key: \"random\",\n value: function random() {\n this.x = Math.random();\n this.y = Math.random();\n this.z = Math.random();\n this.w = Math.random();\n return this;\n }\n }, {\n key: _Symbol$iterator2,\n value: /*#__PURE__*/_regeneratorRuntime().mark(function value() {\n return _regeneratorRuntime().wrap(function value$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n _context3.next = 2;\n return this.x;\n case 2:\n _context3.next = 4;\n return this.y;\n case 4:\n _context3.next = 6;\n return this.z;\n case 6:\n _context3.next = 8;\n return this.w;\n case 8:\n case \"end\":\n return _context3.stop();\n }\n }, value, this);\n })\n }]);\n return Vector4;\n}(Symbol.iterator);\n/*\n In options, we can specify:\n * Texture parameters for an auto-generated target texture\n * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers\n*/\nvar WebGLRenderTarget = /*#__PURE__*/function (_EventDispatcher2) {\n _inherits(WebGLRenderTarget, _EventDispatcher2);\n var _super2 = _createSuper(WebGLRenderTarget);\n function WebGLRenderTarget() {\n var _this3;\n var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n _classCallCheck(this, WebGLRenderTarget);\n _this3 = _super2.call(this);\n _this3.isWebGLRenderTarget = true;\n _this3.width = width;\n _this3.height = height;\n _this3.depth = 1;\n _this3.scissor = new Vector4(0, 0, width, height);\n _this3.scissorTest = false;\n _this3.viewport = new Vector4(0, 0, width, height);\n var image = {\n width: width,\n height: height,\n depth: 1\n };\n _this3.texture = new Texture(image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding);\n _this3.texture.isRenderTargetTexture = true;\n _this3.texture.flipY = false;\n _this3.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n _this3.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;\n _this3.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n _this3.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;\n _this3.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;\n _this3.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;\n _this3.samples = options.samples !== undefined ? options.samples : 0;\n return _this3;\n }\n _createClass(WebGLRenderTarget, [{\n key: \"setSize\",\n value: function setSize(width, height) {\n var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n if (this.width !== width || this.height !== height || this.depth !== depth) {\n this.width = width;\n this.height = height;\n this.depth = depth;\n this.texture.image.width = width;\n this.texture.image.height = height;\n this.texture.image.depth = depth;\n this.dispose();\n }\n this.viewport.set(0, 0, width, height);\n this.scissor.set(0, 0, width, height);\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n this.width = source.width;\n this.height = source.height;\n this.depth = source.depth;\n this.viewport.copy(source.viewport);\n this.texture = source.texture.clone();\n this.texture.isRenderTargetTexture = true;\n\n // ensure image object is not shared, see #20328\n\n var image = Object.assign({}, source.texture.image);\n this.texture.source = new Source(image);\n this.depthBuffer = source.depthBuffer;\n this.stencilBuffer = source.stencilBuffer;\n if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();\n this.samples = source.samples;\n return this;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.dispatchEvent({\n type: 'dispose'\n });\n }\n }]);\n return WebGLRenderTarget;\n}(EventDispatcher);\nvar DataArrayTexture = /*#__PURE__*/function (_Texture) {\n _inherits(DataArrayTexture, _Texture);\n var _super3 = _createSuper(DataArrayTexture);\n function DataArrayTexture() {\n var _this4;\n var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n _classCallCheck(this, DataArrayTexture);\n _this4 = _super3.call(this, null);\n _this4.isDataArrayTexture = true;\n _this4.image = {\n data: data,\n width: width,\n height: height,\n depth: depth\n };\n _this4.magFilter = NearestFilter;\n _this4.minFilter = NearestFilter;\n _this4.wrapR = ClampToEdgeWrapping;\n _this4.generateMipmaps = false;\n _this4.flipY = false;\n _this4.unpackAlignment = 1;\n return _this4;\n }\n return _createClass(DataArrayTexture);\n}(Texture);\nvar WebGLArrayRenderTarget = /*#__PURE__*/function (_WebGLRenderTarget) {\n _inherits(WebGLArrayRenderTarget, _WebGLRenderTarget);\n var _super4 = _createSuper(WebGLArrayRenderTarget);\n function WebGLArrayRenderTarget() {\n var _this5;\n var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n _classCallCheck(this, WebGLArrayRenderTarget);\n _this5 = _super4.call(this, width, height);\n _this5.isWebGLArrayRenderTarget = true;\n _this5.depth = depth;\n _this5.texture = new DataArrayTexture(null, width, height, depth);\n _this5.texture.isRenderTargetTexture = true;\n return _this5;\n }\n return _createClass(WebGLArrayRenderTarget);\n}(WebGLRenderTarget);\nvar Data3DTexture = /*#__PURE__*/function (_Texture2) {\n _inherits(Data3DTexture, _Texture2);\n var _super5 = _createSuper(Data3DTexture);\n function Data3DTexture() {\n var _this6;\n var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n _classCallCheck(this, Data3DTexture);\n // We're going to add .setXXX() methods for setting properties later.\n // Users can still set in DataTexture3D directly.\n //\n //\tconst texture = new THREE.DataTexture3D( data, width, height, depth );\n // \ttexture.anisotropy = 16;\n //\n // See #14839\n\n _this6 = _super5.call(this, null);\n _this6.isData3DTexture = true;\n _this6.image = {\n data: data,\n width: width,\n height: height,\n depth: depth\n };\n _this6.magFilter = NearestFilter;\n _this6.minFilter = NearestFilter;\n _this6.wrapR = ClampToEdgeWrapping;\n _this6.generateMipmaps = false;\n _this6.flipY = false;\n _this6.unpackAlignment = 1;\n return _this6;\n }\n return _createClass(Data3DTexture);\n}(Texture);\nvar WebGL3DRenderTarget = /*#__PURE__*/function (_WebGLRenderTarget2) {\n _inherits(WebGL3DRenderTarget, _WebGLRenderTarget2);\n var _super6 = _createSuper(WebGL3DRenderTarget);\n function WebGL3DRenderTarget() {\n var _this7;\n var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n _classCallCheck(this, WebGL3DRenderTarget);\n _this7 = _super6.call(this, width, height);\n _this7.isWebGL3DRenderTarget = true;\n _this7.depth = depth;\n _this7.texture = new Data3DTexture(null, width, height, depth);\n _this7.texture.isRenderTargetTexture = true;\n return _this7;\n }\n return _createClass(WebGL3DRenderTarget);\n}(WebGLRenderTarget);\nvar WebGLMultipleRenderTargets = /*#__PURE__*/function (_WebGLRenderTarget3) {\n _inherits(WebGLMultipleRenderTargets, _WebGLRenderTarget3);\n var _super7 = _createSuper(WebGLMultipleRenderTargets);\n function WebGLMultipleRenderTargets() {\n var _this8;\n var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var count = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n _classCallCheck(this, WebGLMultipleRenderTargets);\n _this8 = _super7.call(this, width, height, options);\n _this8.isWebGLMultipleRenderTargets = true;\n var texture = _this8.texture;\n _this8.texture = [];\n for (var i = 0; i < count; i++) {\n _this8.texture[i] = texture.clone();\n _this8.texture[i].isRenderTargetTexture = true;\n }\n return _this8;\n }\n _createClass(WebGLMultipleRenderTargets, [{\n key: \"setSize\",\n value: function setSize(width, height) {\n var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n if (this.width !== width || this.height !== height || this.depth !== depth) {\n this.width = width;\n this.height = height;\n this.depth = depth;\n for (var i = 0, il = this.texture.length; i < il; i++) {\n this.texture[i].image.width = width;\n this.texture[i].image.height = height;\n this.texture[i].image.depth = depth;\n }\n this.dispose();\n }\n this.viewport.set(0, 0, width, height);\n this.scissor.set(0, 0, width, height);\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n this.dispose();\n this.width = source.width;\n this.height = source.height;\n this.depth = source.depth;\n this.viewport.set(0, 0, this.width, this.height);\n this.scissor.set(0, 0, this.width, this.height);\n this.depthBuffer = source.depthBuffer;\n this.stencilBuffer = source.stencilBuffer;\n if (source.depthTexture !== null) this.depthTexture = source.depthTexture.clone();\n this.texture.length = 0;\n for (var i = 0, il = source.texture.length; i < il; i++) {\n this.texture[i] = source.texture[i].clone();\n this.texture[i].isRenderTargetTexture = true;\n }\n return this;\n }\n }]);\n return WebGLMultipleRenderTargets;\n}(WebGLRenderTarget);\nvar Quaternion = /*#__PURE__*/function (_Symbol$iterator3) {\n function Quaternion() {\n var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var w = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n _classCallCheck(this, Quaternion);\n this.isQuaternion = true;\n this._x = x;\n this._y = y;\n this._z = z;\n this._w = w;\n }\n _createClass(Quaternion, [{\n key: \"x\",\n get: function get() {\n return this._x;\n },\n set: function set(value) {\n this._x = value;\n this._onChangeCallback();\n }\n }, {\n key: \"y\",\n get: function get() {\n return this._y;\n },\n set: function set(value) {\n this._y = value;\n this._onChangeCallback();\n }\n }, {\n key: \"z\",\n get: function get() {\n return this._z;\n },\n set: function set(value) {\n this._z = value;\n this._onChangeCallback();\n }\n }, {\n key: \"w\",\n get: function get() {\n return this._w;\n },\n set: function set(value) {\n this._w = value;\n this._onChangeCallback();\n }\n }, {\n key: \"set\",\n value: function set(x, y, z, w) {\n this._x = x;\n this._y = y;\n this._z = z;\n this._w = w;\n this._onChangeCallback();\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor(this._x, this._y, this._z, this._w);\n }\n }, {\n key: \"copy\",\n value: function copy(quaternion) {\n this._x = quaternion.x;\n this._y = quaternion.y;\n this._z = quaternion.z;\n this._w = quaternion.w;\n this._onChangeCallback();\n return this;\n }\n }, {\n key: \"setFromEuler\",\n value: function setFromEuler(euler, update) {\n var x = euler._x,\n y = euler._y,\n z = euler._z,\n order = euler._order;\n\n // http://www.mathworks.com/matlabcentral/fileexchange/\n // \t20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n //\tcontent/SpinCalc.m\n\n var cos = Math.cos;\n var sin = Math.sin;\n var c1 = cos(x / 2);\n var c2 = cos(y / 2);\n var c3 = cos(z / 2);\n var s1 = sin(x / 2);\n var s2 = sin(y / 2);\n var s3 = sin(z / 2);\n switch (order) {\n case 'XYZ':\n this._x = s1 * c2 * c3 + c1 * s2 * s3;\n this._y = c1 * s2 * c3 - s1 * c2 * s3;\n this._z = c1 * c2 * s3 + s1 * s2 * c3;\n this._w = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case 'YXZ':\n this._x = s1 * c2 * c3 + c1 * s2 * s3;\n this._y = c1 * s2 * c3 - s1 * c2 * s3;\n this._z = c1 * c2 * s3 - s1 * s2 * c3;\n this._w = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n case 'ZXY':\n this._x = s1 * c2 * c3 - c1 * s2 * s3;\n this._y = c1 * s2 * c3 + s1 * c2 * s3;\n this._z = c1 * c2 * s3 + s1 * s2 * c3;\n this._w = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case 'ZYX':\n this._x = s1 * c2 * c3 - c1 * s2 * s3;\n this._y = c1 * s2 * c3 + s1 * c2 * s3;\n this._z = c1 * c2 * s3 - s1 * s2 * c3;\n this._w = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n case 'YZX':\n this._x = s1 * c2 * c3 + c1 * s2 * s3;\n this._y = c1 * s2 * c3 + s1 * c2 * s3;\n this._z = c1 * c2 * s3 - s1 * s2 * c3;\n this._w = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case 'XZY':\n this._x = s1 * c2 * c3 - c1 * s2 * s3;\n this._y = c1 * s2 * c3 - s1 * c2 * s3;\n this._z = c1 * c2 * s3 + s1 * s2 * c3;\n this._w = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n default:\n console.warn('THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order);\n }\n if (update !== false) this._onChangeCallback();\n return this;\n }\n }, {\n key: \"setFromAxisAngle\",\n value: function setFromAxisAngle(axis, angle) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n\n // assumes axis is normalized\n\n var halfAngle = angle / 2,\n s = Math.sin(halfAngle);\n this._x = axis.x * s;\n this._y = axis.y * s;\n this._z = axis.z * s;\n this._w = Math.cos(halfAngle);\n this._onChangeCallback();\n return this;\n }\n }, {\n key: \"setFromRotationMatrix\",\n value: function setFromRotationMatrix(m) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm\n\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n var te = m.elements,\n m11 = te[0],\n m12 = te[4],\n m13 = te[8],\n m21 = te[1],\n m22 = te[5],\n m23 = te[9],\n m31 = te[2],\n m32 = te[6],\n m33 = te[10],\n trace = m11 + m22 + m33;\n if (trace > 0) {\n var s = 0.5 / Math.sqrt(trace + 1.0);\n this._w = 0.25 / s;\n this._x = (m32 - m23) * s;\n this._y = (m13 - m31) * s;\n this._z = (m21 - m12) * s;\n } else if (m11 > m22 && m11 > m33) {\n var _s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33);\n this._w = (m32 - m23) / _s;\n this._x = 0.25 * _s;\n this._y = (m12 + m21) / _s;\n this._z = (m13 + m31) / _s;\n } else if (m22 > m33) {\n var _s2 = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33);\n this._w = (m13 - m31) / _s2;\n this._x = (m12 + m21) / _s2;\n this._y = 0.25 * _s2;\n this._z = (m23 + m32) / _s2;\n } else {\n var _s3 = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22);\n this._w = (m21 - m12) / _s3;\n this._x = (m13 + m31) / _s3;\n this._y = (m23 + m32) / _s3;\n this._z = 0.25 * _s3;\n }\n this._onChangeCallback();\n return this;\n }\n }, {\n key: \"setFromUnitVectors\",\n value: function setFromUnitVectors(vFrom, vTo) {\n // assumes direction vectors vFrom and vTo are normalized\n\n var r = vFrom.dot(vTo) + 1;\n if (r < Number.EPSILON) {\n // vFrom and vTo point in opposite directions\n\n r = 0;\n if (Math.abs(vFrom.x) > Math.abs(vFrom.z)) {\n this._x = -vFrom.y;\n this._y = vFrom.x;\n this._z = 0;\n this._w = r;\n } else {\n this._x = 0;\n this._y = -vFrom.z;\n this._z = vFrom.y;\n this._w = r;\n }\n } else {\n // crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3\n\n this._x = vFrom.y * vTo.z - vFrom.z * vTo.y;\n this._y = vFrom.z * vTo.x - vFrom.x * vTo.z;\n this._z = vFrom.x * vTo.y - vFrom.y * vTo.x;\n this._w = r;\n }\n return this.normalize();\n }\n }, {\n key: \"angleTo\",\n value: function angleTo(q) {\n return 2 * Math.acos(Math.abs(clamp(this.dot(q), -1, 1)));\n }\n }, {\n key: \"rotateTowards\",\n value: function rotateTowards(q, step) {\n var angle = this.angleTo(q);\n if (angle === 0) return this;\n var t = Math.min(1, step / angle);\n this.slerp(q, t);\n return this;\n }\n }, {\n key: \"identity\",\n value: function identity() {\n return this.set(0, 0, 0, 1);\n }\n }, {\n key: \"invert\",\n value: function invert() {\n // quaternion is assumed to have unit length\n\n return this.conjugate();\n }\n }, {\n key: \"conjugate\",\n value: function conjugate() {\n this._x *= -1;\n this._y *= -1;\n this._z *= -1;\n this._onChangeCallback();\n return this;\n }\n }, {\n key: \"dot\",\n value: function dot(v) {\n return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w;\n }\n }, {\n key: \"lengthSq\",\n value: function lengthSq() {\n return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w;\n }\n }, {\n key: \"length\",\n value: function length() {\n return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w);\n }\n }, {\n key: \"normalize\",\n value: function normalize() {\n var l = this.length();\n if (l === 0) {\n this._x = 0;\n this._y = 0;\n this._z = 0;\n this._w = 1;\n } else {\n l = 1 / l;\n this._x = this._x * l;\n this._y = this._y * l;\n this._z = this._z * l;\n this._w = this._w * l;\n }\n this._onChangeCallback();\n return this;\n }\n }, {\n key: \"multiply\",\n value: function multiply(q) {\n return this.multiplyQuaternions(this, q);\n }\n }, {\n key: \"premultiply\",\n value: function premultiply(q) {\n return this.multiplyQuaternions(q, this);\n }\n }, {\n key: \"multiplyQuaternions\",\n value: function multiplyQuaternions(a, b) {\n // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n var qax = a._x,\n qay = a._y,\n qaz = a._z,\n qaw = a._w;\n var qbx = b._x,\n qby = b._y,\n qbz = b._z,\n qbw = b._w;\n this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n this._onChangeCallback();\n return this;\n }\n }, {\n key: \"slerp\",\n value: function slerp(qb, t) {\n if (t === 0) return this;\n if (t === 1) return this.copy(qb);\n var x = this._x,\n y = this._y,\n z = this._z,\n w = this._w;\n\n // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n var cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z;\n if (cosHalfTheta < 0) {\n this._w = -qb._w;\n this._x = -qb._x;\n this._y = -qb._y;\n this._z = -qb._z;\n cosHalfTheta = -cosHalfTheta;\n } else {\n this.copy(qb);\n }\n if (cosHalfTheta >= 1.0) {\n this._w = w;\n this._x = x;\n this._y = y;\n this._z = z;\n return this;\n }\n var sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta;\n if (sqrSinHalfTheta <= Number.EPSILON) {\n var s = 1 - t;\n this._w = s * w + t * this._w;\n this._x = s * x + t * this._x;\n this._y = s * y + t * this._y;\n this._z = s * z + t * this._z;\n this.normalize();\n this._onChangeCallback();\n return this;\n }\n var sinHalfTheta = Math.sqrt(sqrSinHalfTheta);\n var halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta);\n var ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta,\n ratioB = Math.sin(t * halfTheta) / sinHalfTheta;\n this._w = w * ratioA + this._w * ratioB;\n this._x = x * ratioA + this._x * ratioB;\n this._y = y * ratioA + this._y * ratioB;\n this._z = z * ratioA + this._z * ratioB;\n this._onChangeCallback();\n return this;\n }\n }, {\n key: \"slerpQuaternions\",\n value: function slerpQuaternions(qa, qb, t) {\n return this.copy(qa).slerp(qb, t);\n }\n }, {\n key: \"random\",\n value: function random() {\n // Derived from http://planning.cs.uiuc.edu/node198.html\n // Note, this source uses w, x, y, z ordering,\n // so we swap the order below.\n\n var u1 = Math.random();\n var sqrt1u1 = Math.sqrt(1 - u1);\n var sqrtu1 = Math.sqrt(u1);\n var u2 = 2 * Math.PI * Math.random();\n var u3 = 2 * Math.PI * Math.random();\n return this.set(sqrt1u1 * Math.cos(u2), sqrtu1 * Math.sin(u3), sqrtu1 * Math.cos(u3), sqrt1u1 * Math.sin(u2));\n }\n }, {\n key: \"equals\",\n value: function equals(quaternion) {\n return quaternion._x === this._x && quaternion._y === this._y && quaternion._z === this._z && quaternion._w === this._w;\n }\n }, {\n key: \"fromArray\",\n value: function fromArray(array) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n this._x = array[offset];\n this._y = array[offset + 1];\n this._z = array[offset + 2];\n this._w = array[offset + 3];\n this._onChangeCallback();\n return this;\n }\n }, {\n key: \"toArray\",\n value: function toArray() {\n var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n array[offset] = this._x;\n array[offset + 1] = this._y;\n array[offset + 2] = this._z;\n array[offset + 3] = this._w;\n return array;\n }\n }, {\n key: \"fromBufferAttribute\",\n value: function fromBufferAttribute(attribute, index) {\n this._x = attribute.getX(index);\n this._y = attribute.getY(index);\n this._z = attribute.getZ(index);\n this._w = attribute.getW(index);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n return this.toArray();\n }\n }, {\n key: \"_onChange\",\n value: function _onChange(callback) {\n this._onChangeCallback = callback;\n return this;\n }\n }, {\n key: \"_onChangeCallback\",\n value: function _onChangeCallback() {}\n }, {\n key: _Symbol$iterator3,\n value: /*#__PURE__*/_regeneratorRuntime().mark(function value() {\n return _regeneratorRuntime().wrap(function value$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n _context4.next = 2;\n return this._x;\n case 2:\n _context4.next = 4;\n return this._y;\n case 4:\n _context4.next = 6;\n return this._z;\n case 6:\n _context4.next = 8;\n return this._w;\n case 8:\n case \"end\":\n return _context4.stop();\n }\n }, value, this);\n })\n }], [{\n key: \"slerpFlat\",\n value: function slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) {\n // fuzz-free, array-based Quaternion SLERP operation\n\n var x0 = src0[srcOffset0 + 0],\n y0 = src0[srcOffset0 + 1],\n z0 = src0[srcOffset0 + 2],\n w0 = src0[srcOffset0 + 3];\n var x1 = src1[srcOffset1 + 0],\n y1 = src1[srcOffset1 + 1],\n z1 = src1[srcOffset1 + 2],\n w1 = src1[srcOffset1 + 3];\n if (t === 0) {\n dst[dstOffset + 0] = x0;\n dst[dstOffset + 1] = y0;\n dst[dstOffset + 2] = z0;\n dst[dstOffset + 3] = w0;\n return;\n }\n if (t === 1) {\n dst[dstOffset + 0] = x1;\n dst[dstOffset + 1] = y1;\n dst[dstOffset + 2] = z1;\n dst[dstOffset + 3] = w1;\n return;\n }\n if (w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1) {\n var s = 1 - t;\n var cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1,\n dir = cos >= 0 ? 1 : -1,\n sqrSin = 1 - cos * cos;\n\n // Skip the Slerp for tiny steps to avoid numeric problems:\n if (sqrSin > Number.EPSILON) {\n var sin = Math.sqrt(sqrSin),\n len = Math.atan2(sin, cos * dir);\n s = Math.sin(s * len) / sin;\n t = Math.sin(t * len) / sin;\n }\n var tDir = t * dir;\n x0 = x0 * s + x1 * tDir;\n y0 = y0 * s + y1 * tDir;\n z0 = z0 * s + z1 * tDir;\n w0 = w0 * s + w1 * tDir;\n\n // Normalize in case we just did a lerp:\n if (s === 1 - t) {\n var f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0);\n x0 *= f;\n y0 *= f;\n z0 *= f;\n w0 *= f;\n }\n }\n dst[dstOffset] = x0;\n dst[dstOffset + 1] = y0;\n dst[dstOffset + 2] = z0;\n dst[dstOffset + 3] = w0;\n }\n }, {\n key: \"multiplyQuaternionsFlat\",\n value: function multiplyQuaternionsFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1) {\n var x0 = src0[srcOffset0];\n var y0 = src0[srcOffset0 + 1];\n var z0 = src0[srcOffset0 + 2];\n var w0 = src0[srcOffset0 + 3];\n var x1 = src1[srcOffset1];\n var y1 = src1[srcOffset1 + 1];\n var z1 = src1[srcOffset1 + 2];\n var w1 = src1[srcOffset1 + 3];\n dst[dstOffset] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1;\n dst[dstOffset + 1] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1;\n dst[dstOffset + 2] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1;\n dst[dstOffset + 3] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1;\n return dst;\n }\n }]);\n return Quaternion;\n}(Symbol.iterator);\nvar Vector3 = /*#__PURE__*/function (_Symbol$iterator4) {\n function Vector3() {\n var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n _classCallCheck(this, Vector3);\n Vector3.prototype.isVector3 = true;\n this.x = x;\n this.y = y;\n this.z = z;\n }\n _createClass(Vector3, [{\n key: \"set\",\n value: function set(x, y, z) {\n if (z === undefined) z = this.z; // sprite.scale.set(x,y)\n\n this.x = x;\n this.y = y;\n this.z = z;\n return this;\n }\n }, {\n key: \"setScalar\",\n value: function setScalar(scalar) {\n this.x = scalar;\n this.y = scalar;\n this.z = scalar;\n return this;\n }\n }, {\n key: \"setX\",\n value: function setX(x) {\n this.x = x;\n return this;\n }\n }, {\n key: \"setY\",\n value: function setY(y) {\n this.y = y;\n return this;\n }\n }, {\n key: \"setZ\",\n value: function setZ(z) {\n this.z = z;\n return this;\n }\n }, {\n key: \"setComponent\",\n value: function setComponent(index, value) {\n switch (index) {\n case 0:\n this.x = value;\n break;\n case 1:\n this.y = value;\n break;\n case 2:\n this.z = value;\n break;\n default:\n throw new Error('index is out of range: ' + index);\n }\n return this;\n }\n }, {\n key: \"getComponent\",\n value: function getComponent(index) {\n switch (index) {\n case 0:\n return this.x;\n case 1:\n return this.y;\n case 2:\n return this.z;\n default:\n throw new Error('index is out of range: ' + index);\n }\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor(this.x, this.y, this.z);\n }\n }, {\n key: \"copy\",\n value: function copy(v) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n return this;\n }\n }, {\n key: \"add\",\n value: function add(v) {\n this.x += v.x;\n this.y += v.y;\n this.z += v.z;\n return this;\n }\n }, {\n key: \"addScalar\",\n value: function addScalar(s) {\n this.x += s;\n this.y += s;\n this.z += s;\n return this;\n }\n }, {\n key: \"addVectors\",\n value: function addVectors(a, b) {\n this.x = a.x + b.x;\n this.y = a.y + b.y;\n this.z = a.z + b.z;\n return this;\n }\n }, {\n key: \"addScaledVector\",\n value: function addScaledVector(v, s) {\n this.x += v.x * s;\n this.y += v.y * s;\n this.z += v.z * s;\n return this;\n }\n }, {\n key: \"sub\",\n value: function sub(v) {\n this.x -= v.x;\n this.y -= v.y;\n this.z -= v.z;\n return this;\n }\n }, {\n key: \"subScalar\",\n value: function subScalar(s) {\n this.x -= s;\n this.y -= s;\n this.z -= s;\n return this;\n }\n }, {\n key: \"subVectors\",\n value: function subVectors(a, b) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n this.z = a.z - b.z;\n return this;\n }\n }, {\n key: \"multiply\",\n value: function multiply(v) {\n this.x *= v.x;\n this.y *= v.y;\n this.z *= v.z;\n return this;\n }\n }, {\n key: \"multiplyScalar\",\n value: function multiplyScalar(scalar) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n return this;\n }\n }, {\n key: \"multiplyVectors\",\n value: function multiplyVectors(a, b) {\n this.x = a.x * b.x;\n this.y = a.y * b.y;\n this.z = a.z * b.z;\n return this;\n }\n }, {\n key: \"applyEuler\",\n value: function applyEuler(euler) {\n return this.applyQuaternion(_quaternion$4.setFromEuler(euler));\n }\n }, {\n key: \"applyAxisAngle\",\n value: function applyAxisAngle(axis, angle) {\n return this.applyQuaternion(_quaternion$4.setFromAxisAngle(axis, angle));\n }\n }, {\n key: \"applyMatrix3\",\n value: function applyMatrix3(m) {\n var x = this.x,\n y = this.y,\n z = this.z;\n var e = m.elements;\n this.x = e[0] * x + e[3] * y + e[6] * z;\n this.y = e[1] * x + e[4] * y + e[7] * z;\n this.z = e[2] * x + e[5] * y + e[8] * z;\n return this;\n }\n }, {\n key: \"applyNormalMatrix\",\n value: function applyNormalMatrix(m) {\n return this.applyMatrix3(m).normalize();\n }\n }, {\n key: \"applyMatrix4\",\n value: function applyMatrix4(m) {\n var x = this.x,\n y = this.y,\n z = this.z;\n var e = m.elements;\n var w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);\n this.x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w;\n this.y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w;\n this.z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w;\n return this;\n }\n }, {\n key: \"applyQuaternion\",\n value: function applyQuaternion(q) {\n var x = this.x,\n y = this.y,\n z = this.z;\n var qx = q.x,\n qy = q.y,\n qz = q.z,\n qw = q.w;\n\n // calculate quat * vector\n\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n\n this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return this;\n }\n }, {\n key: \"project\",\n value: function project(camera) {\n return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix);\n }\n }, {\n key: \"unproject\",\n value: function unproject(camera) {\n return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld);\n }\n }, {\n key: \"transformDirection\",\n value: function transformDirection(m) {\n // input: THREE.Matrix4 affine matrix\n // vector interpreted as a direction\n\n var x = this.x,\n y = this.y,\n z = this.z;\n var e = m.elements;\n this.x = e[0] * x + e[4] * y + e[8] * z;\n this.y = e[1] * x + e[5] * y + e[9] * z;\n this.z = e[2] * x + e[6] * y + e[10] * z;\n return this.normalize();\n }\n }, {\n key: \"divide\",\n value: function divide(v) {\n this.x /= v.x;\n this.y /= v.y;\n this.z /= v.z;\n return this;\n }\n }, {\n key: \"divideScalar\",\n value: function divideScalar(scalar) {\n return this.multiplyScalar(1 / scalar);\n }\n }, {\n key: \"min\",\n value: function min(v) {\n this.x = Math.min(this.x, v.x);\n this.y = Math.min(this.y, v.y);\n this.z = Math.min(this.z, v.z);\n return this;\n }\n }, {\n key: \"max\",\n value: function max(v) {\n this.x = Math.max(this.x, v.x);\n this.y = Math.max(this.y, v.y);\n this.z = Math.max(this.z, v.z);\n return this;\n }\n }, {\n key: \"clamp\",\n value: function clamp(min, max) {\n // assumes min < max, componentwise\n\n this.x = Math.max(min.x, Math.min(max.x, this.x));\n this.y = Math.max(min.y, Math.min(max.y, this.y));\n this.z = Math.max(min.z, Math.min(max.z, this.z));\n return this;\n }\n }, {\n key: \"clampScalar\",\n value: function clampScalar(minVal, maxVal) {\n this.x = Math.max(minVal, Math.min(maxVal, this.x));\n this.y = Math.max(minVal, Math.min(maxVal, this.y));\n this.z = Math.max(minVal, Math.min(maxVal, this.z));\n return this;\n }\n }, {\n key: \"clampLength\",\n value: function clampLength(min, max) {\n var length = this.length();\n return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length)));\n }\n }, {\n key: \"floor\",\n value: function floor() {\n this.x = Math.floor(this.x);\n this.y = Math.floor(this.y);\n this.z = Math.floor(this.z);\n return this;\n }\n }, {\n key: \"ceil\",\n value: function ceil() {\n this.x = Math.ceil(this.x);\n this.y = Math.ceil(this.y);\n this.z = Math.ceil(this.z);\n return this;\n }\n }, {\n key: \"round\",\n value: function round() {\n this.x = Math.round(this.x);\n this.y = Math.round(this.y);\n this.z = Math.round(this.z);\n return this;\n }\n }, {\n key: \"roundToZero\",\n value: function roundToZero() {\n this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x);\n this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y);\n this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z);\n return this;\n }\n }, {\n key: \"negate\",\n value: function negate() {\n this.x = -this.x;\n this.y = -this.y;\n this.z = -this.z;\n return this;\n }\n }, {\n key: \"dot\",\n value: function dot(v) {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n }\n\n // TODO lengthSquared?\n }, {\n key: \"lengthSq\",\n value: function lengthSq() {\n return this.x * this.x + this.y * this.y + this.z * this.z;\n }\n }, {\n key: \"length\",\n value: function length() {\n return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);\n }\n }, {\n key: \"manhattanLength\",\n value: function manhattanLength() {\n return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z);\n }\n }, {\n key: \"normalize\",\n value: function normalize() {\n return this.divideScalar(this.length() || 1);\n }\n }, {\n key: \"setLength\",\n value: function setLength(length) {\n return this.normalize().multiplyScalar(length);\n }\n }, {\n key: \"lerp\",\n value: function lerp(v, alpha) {\n this.x += (v.x - this.x) * alpha;\n this.y += (v.y - this.y) * alpha;\n this.z += (v.z - this.z) * alpha;\n return this;\n }\n }, {\n key: \"lerpVectors\",\n value: function lerpVectors(v1, v2, alpha) {\n this.x = v1.x + (v2.x - v1.x) * alpha;\n this.y = v1.y + (v2.y - v1.y) * alpha;\n this.z = v1.z + (v2.z - v1.z) * alpha;\n return this;\n }\n }, {\n key: \"cross\",\n value: function cross(v) {\n return this.crossVectors(this, v);\n }\n }, {\n key: \"crossVectors\",\n value: function crossVectors(a, b) {\n var ax = a.x,\n ay = a.y,\n az = a.z;\n var bx = b.x,\n by = b.y,\n bz = b.z;\n this.x = ay * bz - az * by;\n this.y = az * bx - ax * bz;\n this.z = ax * by - ay * bx;\n return this;\n }\n }, {\n key: \"projectOnVector\",\n value: function projectOnVector(v) {\n var denominator = v.lengthSq();\n if (denominator === 0) return this.set(0, 0, 0);\n var scalar = v.dot(this) / denominator;\n return this.copy(v).multiplyScalar(scalar);\n }\n }, {\n key: \"projectOnPlane\",\n value: function projectOnPlane(planeNormal) {\n _vector$b.copy(this).projectOnVector(planeNormal);\n return this.sub(_vector$b);\n }\n }, {\n key: \"reflect\",\n value: function reflect(normal) {\n // reflect incident vector off plane orthogonal to normal\n // normal is assumed to have unit length\n\n return this.sub(_vector$b.copy(normal).multiplyScalar(2 * this.dot(normal)));\n }\n }, {\n key: \"angleTo\",\n value: function angleTo(v) {\n var denominator = Math.sqrt(this.lengthSq() * v.lengthSq());\n if (denominator === 0) return Math.PI / 2;\n var theta = this.dot(v) / denominator;\n\n // clamp, to handle numerical problems\n\n return Math.acos(clamp(theta, -1, 1));\n }\n }, {\n key: \"distanceTo\",\n value: function distanceTo(v) {\n return Math.sqrt(this.distanceToSquared(v));\n }\n }, {\n key: \"distanceToSquared\",\n value: function distanceToSquared(v) {\n var dx = this.x - v.x,\n dy = this.y - v.y,\n dz = this.z - v.z;\n return dx * dx + dy * dy + dz * dz;\n }\n }, {\n key: \"manhattanDistanceTo\",\n value: function manhattanDistanceTo(v) {\n return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z);\n }\n }, {\n key: \"setFromSpherical\",\n value: function setFromSpherical(s) {\n return this.setFromSphericalCoords(s.radius, s.phi, s.theta);\n }\n }, {\n key: \"setFromSphericalCoords\",\n value: function setFromSphericalCoords(radius, phi, theta) {\n var sinPhiRadius = Math.sin(phi) * radius;\n this.x = sinPhiRadius * Math.sin(theta);\n this.y = Math.cos(phi) * radius;\n this.z = sinPhiRadius * Math.cos(theta);\n return this;\n }\n }, {\n key: \"setFromCylindrical\",\n value: function setFromCylindrical(c) {\n return this.setFromCylindricalCoords(c.radius, c.theta, c.y);\n }\n }, {\n key: \"setFromCylindricalCoords\",\n value: function setFromCylindricalCoords(radius, theta, y) {\n this.x = radius * Math.sin(theta);\n this.y = y;\n this.z = radius * Math.cos(theta);\n return this;\n }\n }, {\n key: \"setFromMatrixPosition\",\n value: function setFromMatrixPosition(m) {\n var e = m.elements;\n this.x = e[12];\n this.y = e[13];\n this.z = e[14];\n return this;\n }\n }, {\n key: \"setFromMatrixScale\",\n value: function setFromMatrixScale(m) {\n var sx = this.setFromMatrixColumn(m, 0).length();\n var sy = this.setFromMatrixColumn(m, 1).length();\n var sz = this.setFromMatrixColumn(m, 2).length();\n this.x = sx;\n this.y = sy;\n this.z = sz;\n return this;\n }\n }, {\n key: \"setFromMatrixColumn\",\n value: function setFromMatrixColumn(m, index) {\n return this.fromArray(m.elements, index * 4);\n }\n }, {\n key: \"setFromMatrix3Column\",\n value: function setFromMatrix3Column(m, index) {\n return this.fromArray(m.elements, index * 3);\n }\n }, {\n key: \"setFromEuler\",\n value: function setFromEuler(e) {\n this.x = e._x;\n this.y = e._y;\n this.z = e._z;\n return this;\n }\n }, {\n key: \"setFromColor\",\n value: function setFromColor(c) {\n this.x = c.r;\n this.y = c.g;\n this.z = c.b;\n return this;\n }\n }, {\n key: \"equals\",\n value: function equals(v) {\n return v.x === this.x && v.y === this.y && v.z === this.z;\n }\n }, {\n key: \"fromArray\",\n value: function fromArray(array) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n this.x = array[offset];\n this.y = array[offset + 1];\n this.z = array[offset + 2];\n return this;\n }\n }, {\n key: \"toArray\",\n value: function toArray() {\n var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n array[offset] = this.x;\n array[offset + 1] = this.y;\n array[offset + 2] = this.z;\n return array;\n }\n }, {\n key: \"fromBufferAttribute\",\n value: function fromBufferAttribute(attribute, index) {\n this.x = attribute.getX(index);\n this.y = attribute.getY(index);\n this.z = attribute.getZ(index);\n return this;\n }\n }, {\n key: \"random\",\n value: function random() {\n this.x = Math.random();\n this.y = Math.random();\n this.z = Math.random();\n return this;\n }\n }, {\n key: \"randomDirection\",\n value: function randomDirection() {\n // Derived from https://mathworld.wolfram.com/SpherePointPicking.html\n\n var u = (Math.random() - 0.5) * 2;\n var t = Math.random() * Math.PI * 2;\n var f = Math.sqrt(1 - Math.pow(u, 2));\n this.x = f * Math.cos(t);\n this.y = f * Math.sin(t);\n this.z = u;\n return this;\n }\n }, {\n key: _Symbol$iterator4,\n value: /*#__PURE__*/_regeneratorRuntime().mark(function value() {\n return _regeneratorRuntime().wrap(function value$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n _context5.next = 2;\n return this.x;\n case 2:\n _context5.next = 4;\n return this.y;\n case 4:\n _context5.next = 6;\n return this.z;\n case 6:\n case \"end\":\n return _context5.stop();\n }\n }, value, this);\n })\n }]);\n return Vector3;\n}(Symbol.iterator);\nvar _vector$b = /*@__PURE__*/new Vector3();\nvar _quaternion$4 = /*@__PURE__*/new Quaternion();\nvar Box3 = /*#__PURE__*/function () {\n function Box3() {\n var min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector3(+Infinity, +Infinity, +Infinity);\n var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(-Infinity, -Infinity, -Infinity);\n _classCallCheck(this, Box3);\n this.isBox3 = true;\n this.min = min;\n this.max = max;\n }\n _createClass(Box3, [{\n key: \"set\",\n value: function set(min, max) {\n this.min.copy(min);\n this.max.copy(max);\n return this;\n }\n }, {\n key: \"setFromArray\",\n value: function setFromArray(array) {\n this.makeEmpty();\n for (var i = 0, il = array.length; i < il; i += 3) {\n this.expandByPoint(_vector$a.fromArray(array, i));\n }\n return this;\n }\n }, {\n key: \"setFromBufferAttribute\",\n value: function setFromBufferAttribute(attribute) {\n this.makeEmpty();\n for (var i = 0, il = attribute.count; i < il; i++) {\n this.expandByPoint(_vector$a.fromBufferAttribute(attribute, i));\n }\n return this;\n }\n }, {\n key: \"setFromPoints\",\n value: function setFromPoints(points) {\n this.makeEmpty();\n for (var i = 0, il = points.length; i < il; i++) {\n this.expandByPoint(points[i]);\n }\n return this;\n }\n }, {\n key: \"setFromCenterAndSize\",\n value: function setFromCenterAndSize(center, size) {\n var halfSize = _vector$a.copy(size).multiplyScalar(0.5);\n this.min.copy(center).sub(halfSize);\n this.max.copy(center).add(halfSize);\n return this;\n }\n }, {\n key: \"setFromObject\",\n value: function setFromObject(object) {\n var precise = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n this.makeEmpty();\n return this.expandByObject(object, precise);\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }, {\n key: \"copy\",\n value: function copy(box) {\n this.min.copy(box.min);\n this.max.copy(box.max);\n return this;\n }\n }, {\n key: \"makeEmpty\",\n value: function makeEmpty() {\n this.min.x = this.min.y = this.min.z = +Infinity;\n this.max.x = this.max.y = this.max.z = -Infinity;\n return this;\n }\n }, {\n key: \"isEmpty\",\n value: function isEmpty() {\n // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z;\n }\n }, {\n key: \"getCenter\",\n value: function getCenter(target) {\n return this.isEmpty() ? target.set(0, 0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5);\n }\n }, {\n key: \"getSize\",\n value: function getSize(target) {\n return this.isEmpty() ? target.set(0, 0, 0) : target.subVectors(this.max, this.min);\n }\n }, {\n key: \"expandByPoint\",\n value: function expandByPoint(point) {\n this.min.min(point);\n this.max.max(point);\n return this;\n }\n }, {\n key: \"expandByVector\",\n value: function expandByVector(vector) {\n this.min.sub(vector);\n this.max.add(vector);\n return this;\n }\n }, {\n key: \"expandByScalar\",\n value: function expandByScalar(scalar) {\n this.min.addScalar(-scalar);\n this.max.addScalar(scalar);\n return this;\n }\n }, {\n key: \"expandByObject\",\n value: function expandByObject(object) {\n var precise = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n // Computes the world-axis-aligned bounding box of an object (including its children),\n // accounting for both the object's, and children's, world transforms\n\n object.updateWorldMatrix(false, false);\n if (object.boundingBox !== undefined) {\n if (object.boundingBox === null) {\n object.computeBoundingBox();\n }\n _box$3.copy(object.boundingBox);\n _box$3.applyMatrix4(object.matrixWorld);\n this.union(_box$3);\n } else {\n var geometry = object.geometry;\n if (geometry !== undefined) {\n if (precise && geometry.attributes !== undefined && geometry.attributes.position !== undefined) {\n var position = geometry.attributes.position;\n for (var i = 0, l = position.count; i < l; i++) {\n _vector$a.fromBufferAttribute(position, i).applyMatrix4(object.matrixWorld);\n this.expandByPoint(_vector$a);\n }\n } else {\n if (geometry.boundingBox === null) {\n geometry.computeBoundingBox();\n }\n _box$3.copy(geometry.boundingBox);\n _box$3.applyMatrix4(object.matrixWorld);\n this.union(_box$3);\n }\n }\n }\n var children = object.children;\n for (var _i2 = 0, _l = children.length; _i2 < _l; _i2++) {\n this.expandByObject(children[_i2], precise);\n }\n return this;\n }\n }, {\n key: \"containsPoint\",\n value: function containsPoint(point) {\n return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y || point.z < this.min.z || point.z > this.max.z ? false : true;\n }\n }, {\n key: \"containsBox\",\n value: function containsBox(box) {\n return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y && this.min.z <= box.min.z && box.max.z <= this.max.z;\n }\n }, {\n key: \"getParameter\",\n value: function getParameter(point, target) {\n // This can potentially have a divide by zero if the box\n // has a size dimension of 0.\n\n return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y), (point.z - this.min.z) / (this.max.z - this.min.z));\n }\n }, {\n key: \"intersectsBox\",\n value: function intersectsBox(box) {\n // using 6 splitting planes to rule out intersections.\n return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y || box.max.z < this.min.z || box.min.z > this.max.z ? false : true;\n }\n }, {\n key: \"intersectsSphere\",\n value: function intersectsSphere(sphere) {\n // Find the point on the AABB closest to the sphere center.\n this.clampPoint(sphere.center, _vector$a);\n\n // If that point is inside the sphere, the AABB and sphere intersect.\n return _vector$a.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius;\n }\n }, {\n key: \"intersectsPlane\",\n value: function intersectsPlane(plane) {\n // We compute the minimum and maximum dot product values. If those values\n // are on the same side (back or front) of the plane, then there is no intersection.\n\n var min, max;\n if (plane.normal.x > 0) {\n min = plane.normal.x * this.min.x;\n max = plane.normal.x * this.max.x;\n } else {\n min = plane.normal.x * this.max.x;\n max = plane.normal.x * this.min.x;\n }\n if (plane.normal.y > 0) {\n min += plane.normal.y * this.min.y;\n max += plane.normal.y * this.max.y;\n } else {\n min += plane.normal.y * this.max.y;\n max += plane.normal.y * this.min.y;\n }\n if (plane.normal.z > 0) {\n min += plane.normal.z * this.min.z;\n max += plane.normal.z * this.max.z;\n } else {\n min += plane.normal.z * this.max.z;\n max += plane.normal.z * this.min.z;\n }\n return min <= -plane.constant && max >= -plane.constant;\n }\n }, {\n key: \"intersectsTriangle\",\n value: function intersectsTriangle(triangle) {\n if (this.isEmpty()) {\n return false;\n }\n\n // compute box center and extents\n this.getCenter(_center);\n _extents.subVectors(this.max, _center);\n\n // translate triangle to aabb origin\n _v0$2.subVectors(triangle.a, _center);\n _v1$7.subVectors(triangle.b, _center);\n _v2$4.subVectors(triangle.c, _center);\n\n // compute edge vectors for triangle\n _f0.subVectors(_v1$7, _v0$2);\n _f1.subVectors(_v2$4, _v1$7);\n _f2.subVectors(_v0$2, _v2$4);\n\n // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb\n // make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation\n // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)\n var axes = [0, -_f0.z, _f0.y, 0, -_f1.z, _f1.y, 0, -_f2.z, _f2.y, _f0.z, 0, -_f0.x, _f1.z, 0, -_f1.x, _f2.z, 0, -_f2.x, -_f0.y, _f0.x, 0, -_f1.y, _f1.x, 0, -_f2.y, _f2.x, 0];\n if (!satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents)) {\n return false;\n }\n\n // test 3 face normals from the aabb\n axes = [1, 0, 0, 0, 1, 0, 0, 0, 1];\n if (!satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents)) {\n return false;\n }\n\n // finally testing the face normal of the triangle\n // use already existing triangle edge vectors here\n _triangleNormal.crossVectors(_f0, _f1);\n axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z];\n return satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents);\n }\n }, {\n key: \"clampPoint\",\n value: function clampPoint(point, target) {\n return target.copy(point).clamp(this.min, this.max);\n }\n }, {\n key: \"distanceToPoint\",\n value: function distanceToPoint(point) {\n return this.clampPoint(point, _vector$a).distanceTo(point);\n }\n }, {\n key: \"getBoundingSphere\",\n value: function getBoundingSphere(target) {\n if (this.isEmpty()) {\n target.makeEmpty();\n } else {\n this.getCenter(target.center);\n target.radius = this.getSize(_vector$a).length() * 0.5;\n }\n return target;\n }\n }, {\n key: \"intersect\",\n value: function intersect(box) {\n this.min.max(box.min);\n this.max.min(box.max);\n\n // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values.\n if (this.isEmpty()) this.makeEmpty();\n return this;\n }\n }, {\n key: \"union\",\n value: function union(box) {\n this.min.min(box.min);\n this.max.max(box.max);\n return this;\n }\n }, {\n key: \"applyMatrix4\",\n value: function applyMatrix4(matrix) {\n // transform of empty box is an empty box.\n if (this.isEmpty()) return this;\n\n // NOTE: I am using a binary pattern to specify all 2^3 combinations below\n _points[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(matrix); // 000\n _points[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(matrix); // 001\n _points[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(matrix); // 010\n _points[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(matrix); // 011\n _points[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(matrix); // 100\n _points[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(matrix); // 101\n _points[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(matrix); // 110\n _points[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(matrix); // 111\n\n this.setFromPoints(_points);\n return this;\n }\n }, {\n key: \"translate\",\n value: function translate(offset) {\n this.min.add(offset);\n this.max.add(offset);\n return this;\n }\n }, {\n key: \"equals\",\n value: function equals(box) {\n return box.min.equals(this.min) && box.max.equals(this.max);\n }\n }]);\n return Box3;\n}();\nvar _points = [/*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3()];\nvar _vector$a = /*@__PURE__*/new Vector3();\nvar _box$3 = /*@__PURE__*/new Box3();\n\n// triangle centered vertices\n\nvar _v0$2 = /*@__PURE__*/new Vector3();\nvar _v1$7 = /*@__PURE__*/new Vector3();\nvar _v2$4 = /*@__PURE__*/new Vector3();\n\n// triangle edge vectors\n\nvar _f0 = /*@__PURE__*/new Vector3();\nvar _f1 = /*@__PURE__*/new Vector3();\nvar _f2 = /*@__PURE__*/new Vector3();\nvar _center = /*@__PURE__*/new Vector3();\nvar _extents = /*@__PURE__*/new Vector3();\nvar _triangleNormal = /*@__PURE__*/new Vector3();\nvar _testAxis = /*@__PURE__*/new Vector3();\nfunction satForAxes(axes, v0, v1, v2, extents) {\n for (var i = 0, j = axes.length - 3; i <= j; i += 3) {\n _testAxis.fromArray(axes, i);\n // project the aabb onto the separating axis\n var r = extents.x * Math.abs(_testAxis.x) + extents.y * Math.abs(_testAxis.y) + extents.z * Math.abs(_testAxis.z);\n // project all 3 vertices of the triangle onto the separating axis\n var p0 = v0.dot(_testAxis);\n var p1 = v1.dot(_testAxis);\n var p2 = v2.dot(_testAxis);\n // actual test, basically see if either of the most extreme of the triangle points intersects r\n if (Math.max(-Math.max(p0, p1, p2), Math.min(p0, p1, p2)) > r) {\n // points of the projected triangle are outside the projected half-length of the aabb\n // the axis is separating and we can exit\n return false;\n }\n }\n return true;\n}\nvar _box$2 = /*@__PURE__*/new Box3();\nvar _v1$6 = /*@__PURE__*/new Vector3();\nvar _v2$3 = /*@__PURE__*/new Vector3();\nvar Sphere = /*#__PURE__*/function () {\n function Sphere() {\n var center = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector3();\n var radius = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;\n _classCallCheck(this, Sphere);\n this.center = center;\n this.radius = radius;\n }\n _createClass(Sphere, [{\n key: \"set\",\n value: function set(center, radius) {\n this.center.copy(center);\n this.radius = radius;\n return this;\n }\n }, {\n key: \"setFromPoints\",\n value: function setFromPoints(points, optionalCenter) {\n var center = this.center;\n if (optionalCenter !== undefined) {\n center.copy(optionalCenter);\n } else {\n _box$2.setFromPoints(points).getCenter(center);\n }\n var maxRadiusSq = 0;\n for (var i = 0, il = points.length; i < il; i++) {\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(points[i]));\n }\n this.radius = Math.sqrt(maxRadiusSq);\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(sphere) {\n this.center.copy(sphere.center);\n this.radius = sphere.radius;\n return this;\n }\n }, {\n key: \"isEmpty\",\n value: function isEmpty() {\n return this.radius < 0;\n }\n }, {\n key: \"makeEmpty\",\n value: function makeEmpty() {\n this.center.set(0, 0, 0);\n this.radius = -1;\n return this;\n }\n }, {\n key: \"containsPoint\",\n value: function containsPoint(point) {\n return point.distanceToSquared(this.center) <= this.radius * this.radius;\n }\n }, {\n key: \"distanceToPoint\",\n value: function distanceToPoint(point) {\n return point.distanceTo(this.center) - this.radius;\n }\n }, {\n key: \"intersectsSphere\",\n value: function intersectsSphere(sphere) {\n var radiusSum = this.radius + sphere.radius;\n return sphere.center.distanceToSquared(this.center) <= radiusSum * radiusSum;\n }\n }, {\n key: \"intersectsBox\",\n value: function intersectsBox(box) {\n return box.intersectsSphere(this);\n }\n }, {\n key: \"intersectsPlane\",\n value: function intersectsPlane(plane) {\n return Math.abs(plane.distanceToPoint(this.center)) <= this.radius;\n }\n }, {\n key: \"clampPoint\",\n value: function clampPoint(point, target) {\n var deltaLengthSq = this.center.distanceToSquared(point);\n target.copy(point);\n if (deltaLengthSq > this.radius * this.radius) {\n target.sub(this.center).normalize();\n target.multiplyScalar(this.radius).add(this.center);\n }\n return target;\n }\n }, {\n key: \"getBoundingBox\",\n value: function getBoundingBox(target) {\n if (this.isEmpty()) {\n // Empty sphere produces empty bounding box\n target.makeEmpty();\n return target;\n }\n target.set(this.center, this.center);\n target.expandByScalar(this.radius);\n return target;\n }\n }, {\n key: \"applyMatrix4\",\n value: function applyMatrix4(matrix) {\n this.center.applyMatrix4(matrix);\n this.radius = this.radius * matrix.getMaxScaleOnAxis();\n return this;\n }\n }, {\n key: \"translate\",\n value: function translate(offset) {\n this.center.add(offset);\n return this;\n }\n }, {\n key: \"expandByPoint\",\n value: function expandByPoint(point) {\n if (this.isEmpty()) {\n this.center.copy(point);\n this.radius = 0;\n return this;\n }\n _v1$6.subVectors(point, this.center);\n var lengthSq = _v1$6.lengthSq();\n if (lengthSq > this.radius * this.radius) {\n // calculate the minimal sphere\n\n var length = Math.sqrt(lengthSq);\n var delta = (length - this.radius) * 0.5;\n this.center.addScaledVector(_v1$6, delta / length);\n this.radius += delta;\n }\n return this;\n }\n }, {\n key: \"union\",\n value: function union(sphere) {\n if (sphere.isEmpty()) {\n return this;\n }\n if (this.isEmpty()) {\n this.copy(sphere);\n return this;\n }\n if (this.center.equals(sphere.center) === true) {\n this.radius = Math.max(this.radius, sphere.radius);\n } else {\n _v2$3.subVectors(sphere.center, this.center).setLength(sphere.radius);\n this.expandByPoint(_v1$6.copy(sphere.center).add(_v2$3));\n this.expandByPoint(_v1$6.copy(sphere.center).sub(_v2$3));\n }\n return this;\n }\n }, {\n key: \"equals\",\n value: function equals(sphere) {\n return sphere.center.equals(this.center) && sphere.radius === this.radius;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }]);\n return Sphere;\n}();\nvar _vector$9 = /*@__PURE__*/new Vector3();\nvar _segCenter = /*@__PURE__*/new Vector3();\nvar _segDir = /*@__PURE__*/new Vector3();\nvar _diff = /*@__PURE__*/new Vector3();\nvar _edge1 = /*@__PURE__*/new Vector3();\nvar _edge2 = /*@__PURE__*/new Vector3();\nvar _normal$1 = /*@__PURE__*/new Vector3();\nvar Ray = /*#__PURE__*/function () {\n function Ray() {\n var origin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector3();\n var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(0, 0, -1);\n _classCallCheck(this, Ray);\n this.origin = origin;\n this.direction = direction;\n }\n _createClass(Ray, [{\n key: \"set\",\n value: function set(origin, direction) {\n this.origin.copy(origin);\n this.direction.copy(direction);\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(ray) {\n this.origin.copy(ray.origin);\n this.direction.copy(ray.direction);\n return this;\n }\n }, {\n key: \"at\",\n value: function at(t, target) {\n return target.copy(this.origin).addScaledVector(this.direction, t);\n }\n }, {\n key: \"lookAt\",\n value: function lookAt(v) {\n this.direction.copy(v).sub(this.origin).normalize();\n return this;\n }\n }, {\n key: \"recast\",\n value: function recast(t) {\n this.origin.copy(this.at(t, _vector$9));\n return this;\n }\n }, {\n key: \"closestPointToPoint\",\n value: function closestPointToPoint(point, target) {\n target.subVectors(point, this.origin);\n var directionDistance = target.dot(this.direction);\n if (directionDistance < 0) {\n return target.copy(this.origin);\n }\n return target.copy(this.origin).addScaledVector(this.direction, directionDistance);\n }\n }, {\n key: \"distanceToPoint\",\n value: function distanceToPoint(point) {\n return Math.sqrt(this.distanceSqToPoint(point));\n }\n }, {\n key: \"distanceSqToPoint\",\n value: function distanceSqToPoint(point) {\n var directionDistance = _vector$9.subVectors(point, this.origin).dot(this.direction);\n\n // point behind the ray\n\n if (directionDistance < 0) {\n return this.origin.distanceToSquared(point);\n }\n _vector$9.copy(this.origin).addScaledVector(this.direction, directionDistance);\n return _vector$9.distanceToSquared(point);\n }\n }, {\n key: \"distanceSqToSegment\",\n value: function distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) {\n // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h\n // It returns the min distance between the ray and the segment\n // defined by v0 and v1\n // It can also set two optional targets :\n // - The closest point on the ray\n // - The closest point on the segment\n\n _segCenter.copy(v0).add(v1).multiplyScalar(0.5);\n _segDir.copy(v1).sub(v0).normalize();\n _diff.copy(this.origin).sub(_segCenter);\n var segExtent = v0.distanceTo(v1) * 0.5;\n var a01 = -this.direction.dot(_segDir);\n var b0 = _diff.dot(this.direction);\n var b1 = -_diff.dot(_segDir);\n var c = _diff.lengthSq();\n var det = Math.abs(1 - a01 * a01);\n var s0, s1, sqrDist, extDet;\n if (det > 0) {\n // The ray and segment are not parallel.\n\n s0 = a01 * b1 - b0;\n s1 = a01 * b0 - b1;\n extDet = segExtent * det;\n if (s0 >= 0) {\n if (s1 >= -extDet) {\n if (s1 <= extDet) {\n // region 0\n // Minimum at interior points of ray and segment.\n\n var invDet = 1 / det;\n s0 *= invDet;\n s1 *= invDet;\n sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c;\n } else {\n // region 1\n\n s1 = segExtent;\n s0 = Math.max(0, -(a01 * s1 + b0));\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n }\n } else {\n // region 5\n\n s1 = -segExtent;\n s0 = Math.max(0, -(a01 * s1 + b0));\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n }\n } else {\n if (s1 <= -extDet) {\n // region 4\n\n s0 = Math.max(0, -(-a01 * segExtent + b0));\n s1 = s0 > 0 ? -segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n } else if (s1 <= extDet) {\n // region 3\n\n s0 = 0;\n s1 = Math.min(Math.max(-segExtent, -b1), segExtent);\n sqrDist = s1 * (s1 + 2 * b1) + c;\n } else {\n // region 2\n\n s0 = Math.max(0, -(a01 * segExtent + b0));\n s1 = s0 > 0 ? segExtent : Math.min(Math.max(-segExtent, -b1), segExtent);\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n }\n }\n } else {\n // Ray and segment are parallel.\n\n s1 = a01 > 0 ? -segExtent : segExtent;\n s0 = Math.max(0, -(a01 * s1 + b0));\n sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c;\n }\n if (optionalPointOnRay) {\n optionalPointOnRay.copy(this.origin).addScaledVector(this.direction, s0);\n }\n if (optionalPointOnSegment) {\n optionalPointOnSegment.copy(_segCenter).addScaledVector(_segDir, s1);\n }\n return sqrDist;\n }\n }, {\n key: \"intersectSphere\",\n value: function intersectSphere(sphere, target) {\n _vector$9.subVectors(sphere.center, this.origin);\n var tca = _vector$9.dot(this.direction);\n var d2 = _vector$9.dot(_vector$9) - tca * tca;\n var radius2 = sphere.radius * sphere.radius;\n if (d2 > radius2) return null;\n var thc = Math.sqrt(radius2 - d2);\n\n // t0 = first intersect point - entrance on front of sphere\n var t0 = tca - thc;\n\n // t1 = second intersect point - exit point on back of sphere\n var t1 = tca + thc;\n\n // test to see if t1 is behind the ray - if so, return null\n if (t1 < 0) return null;\n\n // test to see if t0 is behind the ray:\n // if it is, the ray is inside the sphere, so return the second exit point scaled by t1,\n // in order to always return an intersect point that is in front of the ray.\n if (t0 < 0) return this.at(t1, target);\n\n // else t0 is in front of the ray, so return the first collision point scaled by t0\n return this.at(t0, target);\n }\n }, {\n key: \"intersectsSphere\",\n value: function intersectsSphere(sphere) {\n return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius;\n }\n }, {\n key: \"distanceToPlane\",\n value: function distanceToPlane(plane) {\n var denominator = plane.normal.dot(this.direction);\n if (denominator === 0) {\n // line is coplanar, return origin\n if (plane.distanceToPoint(this.origin) === 0) {\n return 0;\n }\n\n // Null is preferable to undefined since undefined means.... it is undefined\n\n return null;\n }\n var t = -(this.origin.dot(plane.normal) + plane.constant) / denominator;\n\n // Return if the ray never intersects the plane\n\n return t >= 0 ? t : null;\n }\n }, {\n key: \"intersectPlane\",\n value: function intersectPlane(plane, target) {\n var t = this.distanceToPlane(plane);\n if (t === null) {\n return null;\n }\n return this.at(t, target);\n }\n }, {\n key: \"intersectsPlane\",\n value: function intersectsPlane(plane) {\n // check if the ray lies on the plane first\n\n var distToPoint = plane.distanceToPoint(this.origin);\n if (distToPoint === 0) {\n return true;\n }\n var denominator = plane.normal.dot(this.direction);\n if (denominator * distToPoint < 0) {\n return true;\n }\n\n // ray origin is behind the plane (and is pointing behind it)\n\n return false;\n }\n }, {\n key: \"intersectBox\",\n value: function intersectBox(box, target) {\n var tmin, tmax, tymin, tymax, tzmin, tzmax;\n var invdirx = 1 / this.direction.x,\n invdiry = 1 / this.direction.y,\n invdirz = 1 / this.direction.z;\n var origin = this.origin;\n if (invdirx >= 0) {\n tmin = (box.min.x - origin.x) * invdirx;\n tmax = (box.max.x - origin.x) * invdirx;\n } else {\n tmin = (box.max.x - origin.x) * invdirx;\n tmax = (box.min.x - origin.x) * invdirx;\n }\n if (invdiry >= 0) {\n tymin = (box.min.y - origin.y) * invdiry;\n tymax = (box.max.y - origin.y) * invdiry;\n } else {\n tymin = (box.max.y - origin.y) * invdiry;\n tymax = (box.min.y - origin.y) * invdiry;\n }\n if (tmin > tymax || tymin > tmax) return null;\n if (tymin > tmin || isNaN(tmin)) tmin = tymin;\n if (tymax < tmax || isNaN(tmax)) tmax = tymax;\n if (invdirz >= 0) {\n tzmin = (box.min.z - origin.z) * invdirz;\n tzmax = (box.max.z - origin.z) * invdirz;\n } else {\n tzmin = (box.max.z - origin.z) * invdirz;\n tzmax = (box.min.z - origin.z) * invdirz;\n }\n if (tmin > tzmax || tzmin > tmax) return null;\n if (tzmin > tmin || tmin !== tmin) tmin = tzmin;\n if (tzmax < tmax || tmax !== tmax) tmax = tzmax;\n\n //return point closest to the ray (positive side)\n\n if (tmax < 0) return null;\n return this.at(tmin >= 0 ? tmin : tmax, target);\n }\n }, {\n key: \"intersectsBox\",\n value: function intersectsBox(box) {\n return this.intersectBox(box, _vector$9) !== null;\n }\n }, {\n key: \"intersectTriangle\",\n value: function intersectTriangle(a, b, c, backfaceCulling, target) {\n // Compute the offset origin, edges, and normal.\n\n // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h\n\n _edge1.subVectors(b, a);\n _edge2.subVectors(c, a);\n _normal$1.crossVectors(_edge1, _edge2);\n\n // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,\n // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by\n // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))\n // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))\n // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)\n var DdN = this.direction.dot(_normal$1);\n var sign;\n if (DdN > 0) {\n if (backfaceCulling) return null;\n sign = 1;\n } else if (DdN < 0) {\n sign = -1;\n DdN = -DdN;\n } else {\n return null;\n }\n _diff.subVectors(this.origin, a);\n var DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2));\n\n // b1 < 0, no intersection\n if (DdQxE2 < 0) {\n return null;\n }\n var DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff));\n\n // b2 < 0, no intersection\n if (DdE1xQ < 0) {\n return null;\n }\n\n // b1+b2 > 1, no intersection\n if (DdQxE2 + DdE1xQ > DdN) {\n return null;\n }\n\n // Line intersects triangle, check if ray does.\n var QdN = -sign * _diff.dot(_normal$1);\n\n // t < 0, no intersection\n if (QdN < 0) {\n return null;\n }\n\n // Ray intersects triangle.\n return this.at(QdN / DdN, target);\n }\n }, {\n key: \"applyMatrix4\",\n value: function applyMatrix4(matrix4) {\n this.origin.applyMatrix4(matrix4);\n this.direction.transformDirection(matrix4);\n return this;\n }\n }, {\n key: \"equals\",\n value: function equals(ray) {\n return ray.origin.equals(this.origin) && ray.direction.equals(this.direction);\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }]);\n return Ray;\n}();\nvar Matrix4 = /*#__PURE__*/function () {\n function Matrix4() {\n _classCallCheck(this, Matrix4);\n Matrix4.prototype.isMatrix4 = true;\n this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n }\n _createClass(Matrix4, [{\n key: \"set\",\n value: function set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {\n var te = this.elements;\n te[0] = n11;\n te[4] = n12;\n te[8] = n13;\n te[12] = n14;\n te[1] = n21;\n te[5] = n22;\n te[9] = n23;\n te[13] = n24;\n te[2] = n31;\n te[6] = n32;\n te[10] = n33;\n te[14] = n34;\n te[3] = n41;\n te[7] = n42;\n te[11] = n43;\n te[15] = n44;\n return this;\n }\n }, {\n key: \"identity\",\n value: function identity() {\n this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new Matrix4().fromArray(this.elements);\n }\n }, {\n key: \"copy\",\n value: function copy(m) {\n var te = this.elements;\n var me = m.elements;\n te[0] = me[0];\n te[1] = me[1];\n te[2] = me[2];\n te[3] = me[3];\n te[4] = me[4];\n te[5] = me[5];\n te[6] = me[6];\n te[7] = me[7];\n te[8] = me[8];\n te[9] = me[9];\n te[10] = me[10];\n te[11] = me[11];\n te[12] = me[12];\n te[13] = me[13];\n te[14] = me[14];\n te[15] = me[15];\n return this;\n }\n }, {\n key: \"copyPosition\",\n value: function copyPosition(m) {\n var te = this.elements,\n me = m.elements;\n te[12] = me[12];\n te[13] = me[13];\n te[14] = me[14];\n return this;\n }\n }, {\n key: \"setFromMatrix3\",\n value: function setFromMatrix3(m) {\n var me = m.elements;\n this.set(me[0], me[3], me[6], 0, me[1], me[4], me[7], 0, me[2], me[5], me[8], 0, 0, 0, 0, 1);\n return this;\n }\n }, {\n key: \"extractBasis\",\n value: function extractBasis(xAxis, yAxis, zAxis) {\n xAxis.setFromMatrixColumn(this, 0);\n yAxis.setFromMatrixColumn(this, 1);\n zAxis.setFromMatrixColumn(this, 2);\n return this;\n }\n }, {\n key: \"makeBasis\",\n value: function makeBasis(xAxis, yAxis, zAxis) {\n this.set(xAxis.x, yAxis.x, zAxis.x, 0, xAxis.y, yAxis.y, zAxis.y, 0, xAxis.z, yAxis.z, zAxis.z, 0, 0, 0, 0, 1);\n return this;\n }\n }, {\n key: \"extractRotation\",\n value: function extractRotation(m) {\n // this method does not support reflection matrices\n\n var te = this.elements;\n var me = m.elements;\n var scaleX = 1 / _v1$5.setFromMatrixColumn(m, 0).length();\n var scaleY = 1 / _v1$5.setFromMatrixColumn(m, 1).length();\n var scaleZ = 1 / _v1$5.setFromMatrixColumn(m, 2).length();\n te[0] = me[0] * scaleX;\n te[1] = me[1] * scaleX;\n te[2] = me[2] * scaleX;\n te[3] = 0;\n te[4] = me[4] * scaleY;\n te[5] = me[5] * scaleY;\n te[6] = me[6] * scaleY;\n te[7] = 0;\n te[8] = me[8] * scaleZ;\n te[9] = me[9] * scaleZ;\n te[10] = me[10] * scaleZ;\n te[11] = 0;\n te[12] = 0;\n te[13] = 0;\n te[14] = 0;\n te[15] = 1;\n return this;\n }\n }, {\n key: \"makeRotationFromEuler\",\n value: function makeRotationFromEuler(euler) {\n var te = this.elements;\n var x = euler.x,\n y = euler.y,\n z = euler.z;\n var a = Math.cos(x),\n b = Math.sin(x);\n var c = Math.cos(y),\n d = Math.sin(y);\n var e = Math.cos(z),\n f = Math.sin(z);\n if (euler.order === 'XYZ') {\n var ae = a * e,\n af = a * f,\n be = b * e,\n bf = b * f;\n te[0] = c * e;\n te[4] = -c * f;\n te[8] = d;\n te[1] = af + be * d;\n te[5] = ae - bf * d;\n te[9] = -b * c;\n te[2] = bf - ae * d;\n te[6] = be + af * d;\n te[10] = a * c;\n } else if (euler.order === 'YXZ') {\n var ce = c * e,\n cf = c * f,\n de = d * e,\n df = d * f;\n te[0] = ce + df * b;\n te[4] = de * b - cf;\n te[8] = a * d;\n te[1] = a * f;\n te[5] = a * e;\n te[9] = -b;\n te[2] = cf * b - de;\n te[6] = df + ce * b;\n te[10] = a * c;\n } else if (euler.order === 'ZXY') {\n var _ce = c * e,\n _cf = c * f,\n _de = d * e,\n _df = d * f;\n te[0] = _ce - _df * b;\n te[4] = -a * f;\n te[8] = _de + _cf * b;\n te[1] = _cf + _de * b;\n te[5] = a * e;\n te[9] = _df - _ce * b;\n te[2] = -a * d;\n te[6] = b;\n te[10] = a * c;\n } else if (euler.order === 'ZYX') {\n var _ae = a * e,\n _af = a * f,\n _be = b * e,\n _bf = b * f;\n te[0] = c * e;\n te[4] = _be * d - _af;\n te[8] = _ae * d + _bf;\n te[1] = c * f;\n te[5] = _bf * d + _ae;\n te[9] = _af * d - _be;\n te[2] = -d;\n te[6] = b * c;\n te[10] = a * c;\n } else if (euler.order === 'YZX') {\n var ac = a * c,\n ad = a * d,\n bc = b * c,\n bd = b * d;\n te[0] = c * e;\n te[4] = bd - ac * f;\n te[8] = bc * f + ad;\n te[1] = f;\n te[5] = a * e;\n te[9] = -b * e;\n te[2] = -d * e;\n te[6] = ad * f + bc;\n te[10] = ac - bd * f;\n } else if (euler.order === 'XZY') {\n var _ac = a * c,\n _ad = a * d,\n _bc = b * c,\n _bd = b * d;\n te[0] = c * e;\n te[4] = -f;\n te[8] = d * e;\n te[1] = _ac * f + _bd;\n te[5] = a * e;\n te[9] = _ad * f - _bc;\n te[2] = _bc * f - _ad;\n te[6] = b * e;\n te[10] = _bd * f + _ac;\n }\n\n // bottom row\n te[3] = 0;\n te[7] = 0;\n te[11] = 0;\n\n // last column\n te[12] = 0;\n te[13] = 0;\n te[14] = 0;\n te[15] = 1;\n return this;\n }\n }, {\n key: \"makeRotationFromQuaternion\",\n value: function makeRotationFromQuaternion(q) {\n return this.compose(_zero, q, _one);\n }\n }, {\n key: \"lookAt\",\n value: function lookAt(eye, target, up) {\n var te = this.elements;\n _z.subVectors(eye, target);\n if (_z.lengthSq() === 0) {\n // eye and target are in the same position\n\n _z.z = 1;\n }\n _z.normalize();\n _x.crossVectors(up, _z);\n if (_x.lengthSq() === 0) {\n // up and z are parallel\n\n if (Math.abs(up.z) === 1) {\n _z.x += 0.0001;\n } else {\n _z.z += 0.0001;\n }\n _z.normalize();\n _x.crossVectors(up, _z);\n }\n _x.normalize();\n _y.crossVectors(_z, _x);\n te[0] = _x.x;\n te[4] = _y.x;\n te[8] = _z.x;\n te[1] = _x.y;\n te[5] = _y.y;\n te[9] = _z.y;\n te[2] = _x.z;\n te[6] = _y.z;\n te[10] = _z.z;\n return this;\n }\n }, {\n key: \"multiply\",\n value: function multiply(m) {\n return this.multiplyMatrices(this, m);\n }\n }, {\n key: \"premultiply\",\n value: function premultiply(m) {\n return this.multiplyMatrices(m, this);\n }\n }, {\n key: \"multiplyMatrices\",\n value: function multiplyMatrices(a, b) {\n var ae = a.elements;\n var be = b.elements;\n var te = this.elements;\n var a11 = ae[0],\n a12 = ae[4],\n a13 = ae[8],\n a14 = ae[12];\n var a21 = ae[1],\n a22 = ae[5],\n a23 = ae[9],\n a24 = ae[13];\n var a31 = ae[2],\n a32 = ae[6],\n a33 = ae[10],\n a34 = ae[14];\n var a41 = ae[3],\n a42 = ae[7],\n a43 = ae[11],\n a44 = ae[15];\n var b11 = be[0],\n b12 = be[4],\n b13 = be[8],\n b14 = be[12];\n var b21 = be[1],\n b22 = be[5],\n b23 = be[9],\n b24 = be[13];\n var b31 = be[2],\n b32 = be[6],\n b33 = be[10],\n b34 = be[14];\n var b41 = be[3],\n b42 = be[7],\n b43 = be[11],\n b44 = be[15];\n te[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41;\n te[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42;\n te[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43;\n te[12] = a11 * b14 + a12 * b24 + a13 * b34 + a14 * b44;\n te[1] = a21 * b11 + a22 * b21 + a23 * b31 + a24 * b41;\n te[5] = a21 * b12 + a22 * b22 + a23 * b32 + a24 * b42;\n te[9] = a21 * b13 + a22 * b23 + a23 * b33 + a24 * b43;\n te[13] = a21 * b14 + a22 * b24 + a23 * b34 + a24 * b44;\n te[2] = a31 * b11 + a32 * b21 + a33 * b31 + a34 * b41;\n te[6] = a31 * b12 + a32 * b22 + a33 * b32 + a34 * b42;\n te[10] = a31 * b13 + a32 * b23 + a33 * b33 + a34 * b43;\n te[14] = a31 * b14 + a32 * b24 + a33 * b34 + a34 * b44;\n te[3] = a41 * b11 + a42 * b21 + a43 * b31 + a44 * b41;\n te[7] = a41 * b12 + a42 * b22 + a43 * b32 + a44 * b42;\n te[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43;\n te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44;\n return this;\n }\n }, {\n key: \"multiplyScalar\",\n value: function multiplyScalar(s) {\n var te = this.elements;\n te[0] *= s;\n te[4] *= s;\n te[8] *= s;\n te[12] *= s;\n te[1] *= s;\n te[5] *= s;\n te[9] *= s;\n te[13] *= s;\n te[2] *= s;\n te[6] *= s;\n te[10] *= s;\n te[14] *= s;\n te[3] *= s;\n te[7] *= s;\n te[11] *= s;\n te[15] *= s;\n return this;\n }\n }, {\n key: \"determinant\",\n value: function determinant() {\n var te = this.elements;\n var n11 = te[0],\n n12 = te[4],\n n13 = te[8],\n n14 = te[12];\n var n21 = te[1],\n n22 = te[5],\n n23 = te[9],\n n24 = te[13];\n var n31 = te[2],\n n32 = te[6],\n n33 = te[10],\n n34 = te[14];\n var n41 = te[3],\n n42 = te[7],\n n43 = te[11],\n n44 = te[15];\n\n //TODO: make this more efficient\n //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm )\n\n return n41 * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + n42 * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + n43 * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + n44 * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31);\n }\n }, {\n key: \"transpose\",\n value: function transpose() {\n var te = this.elements;\n var tmp;\n tmp = te[1];\n te[1] = te[4];\n te[4] = tmp;\n tmp = te[2];\n te[2] = te[8];\n te[8] = tmp;\n tmp = te[6];\n te[6] = te[9];\n te[9] = tmp;\n tmp = te[3];\n te[3] = te[12];\n te[12] = tmp;\n tmp = te[7];\n te[7] = te[13];\n te[13] = tmp;\n tmp = te[11];\n te[11] = te[14];\n te[14] = tmp;\n return this;\n }\n }, {\n key: \"setPosition\",\n value: function setPosition(x, y, z) {\n var te = this.elements;\n if (x.isVector3) {\n te[12] = x.x;\n te[13] = x.y;\n te[14] = x.z;\n } else {\n te[12] = x;\n te[13] = y;\n te[14] = z;\n }\n return this;\n }\n }, {\n key: \"invert\",\n value: function invert() {\n // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm\n var te = this.elements,\n n11 = te[0],\n n21 = te[1],\n n31 = te[2],\n n41 = te[3],\n n12 = te[4],\n n22 = te[5],\n n32 = te[6],\n n42 = te[7],\n n13 = te[8],\n n23 = te[9],\n n33 = te[10],\n n43 = te[11],\n n14 = te[12],\n n24 = te[13],\n n34 = te[14],\n n44 = te[15],\n t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44,\n t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44,\n t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44,\n t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34;\n var det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14;\n if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n var detInv = 1 / det;\n te[0] = t11 * detInv;\n te[1] = (n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44) * detInv;\n te[2] = (n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44) * detInv;\n te[3] = (n23 * n32 * n41 - n22 * n33 * n41 - n23 * n31 * n42 + n21 * n33 * n42 + n22 * n31 * n43 - n21 * n32 * n43) * detInv;\n te[4] = t12 * detInv;\n te[5] = (n13 * n34 * n41 - n14 * n33 * n41 + n14 * n31 * n43 - n11 * n34 * n43 - n13 * n31 * n44 + n11 * n33 * n44) * detInv;\n te[6] = (n14 * n32 * n41 - n12 * n34 * n41 - n14 * n31 * n42 + n11 * n34 * n42 + n12 * n31 * n44 - n11 * n32 * n44) * detInv;\n te[7] = (n12 * n33 * n41 - n13 * n32 * n41 + n13 * n31 * n42 - n11 * n33 * n42 - n12 * n31 * n43 + n11 * n32 * n43) * detInv;\n te[8] = t13 * detInv;\n te[9] = (n14 * n23 * n41 - n13 * n24 * n41 - n14 * n21 * n43 + n11 * n24 * n43 + n13 * n21 * n44 - n11 * n23 * n44) * detInv;\n te[10] = (n12 * n24 * n41 - n14 * n22 * n41 + n14 * n21 * n42 - n11 * n24 * n42 - n12 * n21 * n44 + n11 * n22 * n44) * detInv;\n te[11] = (n13 * n22 * n41 - n12 * n23 * n41 - n13 * n21 * n42 + n11 * n23 * n42 + n12 * n21 * n43 - n11 * n22 * n43) * detInv;\n te[12] = t14 * detInv;\n te[13] = (n13 * n24 * n31 - n14 * n23 * n31 + n14 * n21 * n33 - n11 * n24 * n33 - n13 * n21 * n34 + n11 * n23 * n34) * detInv;\n te[14] = (n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34) * detInv;\n te[15] = (n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33) * detInv;\n return this;\n }\n }, {\n key: \"scale\",\n value: function scale(v) {\n var te = this.elements;\n var x = v.x,\n y = v.y,\n z = v.z;\n te[0] *= x;\n te[4] *= y;\n te[8] *= z;\n te[1] *= x;\n te[5] *= y;\n te[9] *= z;\n te[2] *= x;\n te[6] *= y;\n te[10] *= z;\n te[3] *= x;\n te[7] *= y;\n te[11] *= z;\n return this;\n }\n }, {\n key: \"getMaxScaleOnAxis\",\n value: function getMaxScaleOnAxis() {\n var te = this.elements;\n var scaleXSq = te[0] * te[0] + te[1] * te[1] + te[2] * te[2];\n var scaleYSq = te[4] * te[4] + te[5] * te[5] + te[6] * te[6];\n var scaleZSq = te[8] * te[8] + te[9] * te[9] + te[10] * te[10];\n return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq));\n }\n }, {\n key: \"makeTranslation\",\n value: function makeTranslation(x, y, z) {\n this.set(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1);\n return this;\n }\n }, {\n key: \"makeRotationX\",\n value: function makeRotationX(theta) {\n var c = Math.cos(theta),\n s = Math.sin(theta);\n this.set(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1);\n return this;\n }\n }, {\n key: \"makeRotationY\",\n value: function makeRotationY(theta) {\n var c = Math.cos(theta),\n s = Math.sin(theta);\n this.set(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1);\n return this;\n }\n }, {\n key: \"makeRotationZ\",\n value: function makeRotationZ(theta) {\n var c = Math.cos(theta),\n s = Math.sin(theta);\n this.set(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\n return this;\n }\n }, {\n key: \"makeRotationAxis\",\n value: function makeRotationAxis(axis, angle) {\n // Based on http://www.gamedev.net/reference/articles/article1199.asp\n\n var c = Math.cos(angle);\n var s = Math.sin(angle);\n var t = 1 - c;\n var x = axis.x,\n y = axis.y,\n z = axis.z;\n var tx = t * x,\n ty = t * y;\n this.set(tx * x + c, tx * y - s * z, tx * z + s * y, 0, tx * y + s * z, ty * y + c, ty * z - s * x, 0, tx * z - s * y, ty * z + s * x, t * z * z + c, 0, 0, 0, 0, 1);\n return this;\n }\n }, {\n key: \"makeScale\",\n value: function makeScale(x, y, z) {\n this.set(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1);\n return this;\n }\n }, {\n key: \"makeShear\",\n value: function makeShear(xy, xz, yx, yz, zx, zy) {\n this.set(1, yx, zx, 0, xy, 1, zy, 0, xz, yz, 1, 0, 0, 0, 0, 1);\n return this;\n }\n }, {\n key: \"compose\",\n value: function compose(position, quaternion, scale) {\n var te = this.elements;\n var x = quaternion._x,\n y = quaternion._y,\n z = quaternion._z,\n w = quaternion._w;\n var x2 = x + x,\n y2 = y + y,\n z2 = z + z;\n var xx = x * x2,\n xy = x * y2,\n xz = x * z2;\n var yy = y * y2,\n yz = y * z2,\n zz = z * z2;\n var wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n var sx = scale.x,\n sy = scale.y,\n sz = scale.z;\n te[0] = (1 - (yy + zz)) * sx;\n te[1] = (xy + wz) * sx;\n te[2] = (xz - wy) * sx;\n te[3] = 0;\n te[4] = (xy - wz) * sy;\n te[5] = (1 - (xx + zz)) * sy;\n te[6] = (yz + wx) * sy;\n te[7] = 0;\n te[8] = (xz + wy) * sz;\n te[9] = (yz - wx) * sz;\n te[10] = (1 - (xx + yy)) * sz;\n te[11] = 0;\n te[12] = position.x;\n te[13] = position.y;\n te[14] = position.z;\n te[15] = 1;\n return this;\n }\n }, {\n key: \"decompose\",\n value: function decompose(position, quaternion, scale) {\n var te = this.elements;\n var sx = _v1$5.set(te[0], te[1], te[2]).length();\n var sy = _v1$5.set(te[4], te[5], te[6]).length();\n var sz = _v1$5.set(te[8], te[9], te[10]).length();\n\n // if determine is negative, we need to invert one scale\n var det = this.determinant();\n if (det < 0) sx = -sx;\n position.x = te[12];\n position.y = te[13];\n position.z = te[14];\n\n // scale the rotation part\n _m1$2.copy(this);\n var invSX = 1 / sx;\n var invSY = 1 / sy;\n var invSZ = 1 / sz;\n _m1$2.elements[0] *= invSX;\n _m1$2.elements[1] *= invSX;\n _m1$2.elements[2] *= invSX;\n _m1$2.elements[4] *= invSY;\n _m1$2.elements[5] *= invSY;\n _m1$2.elements[6] *= invSY;\n _m1$2.elements[8] *= invSZ;\n _m1$2.elements[9] *= invSZ;\n _m1$2.elements[10] *= invSZ;\n quaternion.setFromRotationMatrix(_m1$2);\n scale.x = sx;\n scale.y = sy;\n scale.z = sz;\n return this;\n }\n }, {\n key: \"makePerspective\",\n value: function makePerspective(left, right, top, bottom, near, far) {\n var te = this.elements;\n var x = 2 * near / (right - left);\n var y = 2 * near / (top - bottom);\n var a = (right + left) / (right - left);\n var b = (top + bottom) / (top - bottom);\n var c = -(far + near) / (far - near);\n var d = -2 * far * near / (far - near);\n te[0] = x;\n te[4] = 0;\n te[8] = a;\n te[12] = 0;\n te[1] = 0;\n te[5] = y;\n te[9] = b;\n te[13] = 0;\n te[2] = 0;\n te[6] = 0;\n te[10] = c;\n te[14] = d;\n te[3] = 0;\n te[7] = 0;\n te[11] = -1;\n te[15] = 0;\n return this;\n }\n }, {\n key: \"makeOrthographic\",\n value: function makeOrthographic(left, right, top, bottom, near, far) {\n var te = this.elements;\n var w = 1.0 / (right - left);\n var h = 1.0 / (top - bottom);\n var p = 1.0 / (far - near);\n var x = (right + left) * w;\n var y = (top + bottom) * h;\n var z = (far + near) * p;\n te[0] = 2 * w;\n te[4] = 0;\n te[8] = 0;\n te[12] = -x;\n te[1] = 0;\n te[5] = 2 * h;\n te[9] = 0;\n te[13] = -y;\n te[2] = 0;\n te[6] = 0;\n te[10] = -2 * p;\n te[14] = -z;\n te[3] = 0;\n te[7] = 0;\n te[11] = 0;\n te[15] = 1;\n return this;\n }\n }, {\n key: \"equals\",\n value: function equals(matrix) {\n var te = this.elements;\n var me = matrix.elements;\n for (var i = 0; i < 16; i++) {\n if (te[i] !== me[i]) return false;\n }\n return true;\n }\n }, {\n key: \"fromArray\",\n value: function fromArray(array) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n for (var i = 0; i < 16; i++) {\n this.elements[i] = array[i + offset];\n }\n return this;\n }\n }, {\n key: \"toArray\",\n value: function toArray() {\n var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var te = this.elements;\n array[offset] = te[0];\n array[offset + 1] = te[1];\n array[offset + 2] = te[2];\n array[offset + 3] = te[3];\n array[offset + 4] = te[4];\n array[offset + 5] = te[5];\n array[offset + 6] = te[6];\n array[offset + 7] = te[7];\n array[offset + 8] = te[8];\n array[offset + 9] = te[9];\n array[offset + 10] = te[10];\n array[offset + 11] = te[11];\n array[offset + 12] = te[12];\n array[offset + 13] = te[13];\n array[offset + 14] = te[14];\n array[offset + 15] = te[15];\n return array;\n }\n }]);\n return Matrix4;\n}();\nvar _v1$5 = /*@__PURE__*/new Vector3();\nvar _m1$2 = /*@__PURE__*/new Matrix4();\nvar _zero = /*@__PURE__*/new Vector3(0, 0, 0);\nvar _one = /*@__PURE__*/new Vector3(1, 1, 1);\nvar _x = /*@__PURE__*/new Vector3();\nvar _y = /*@__PURE__*/new Vector3();\nvar _z = /*@__PURE__*/new Vector3();\nvar _matrix = /*@__PURE__*/new Matrix4();\nvar _quaternion$3 = /*@__PURE__*/new Quaternion();\nvar Euler = /*#__PURE__*/function (_Symbol$iterator5) {\n function Euler() {\n var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var order = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Euler.DEFAULT_ORDER;\n _classCallCheck(this, Euler);\n this.isEuler = true;\n this._x = x;\n this._y = y;\n this._z = z;\n this._order = order;\n }\n _createClass(Euler, [{\n key: \"x\",\n get: function get() {\n return this._x;\n },\n set: function set(value) {\n this._x = value;\n this._onChangeCallback();\n }\n }, {\n key: \"y\",\n get: function get() {\n return this._y;\n },\n set: function set(value) {\n this._y = value;\n this._onChangeCallback();\n }\n }, {\n key: \"z\",\n get: function get() {\n return this._z;\n },\n set: function set(value) {\n this._z = value;\n this._onChangeCallback();\n }\n }, {\n key: \"order\",\n get: function get() {\n return this._order;\n },\n set: function set(value) {\n this._order = value;\n this._onChangeCallback();\n }\n }, {\n key: \"set\",\n value: function set(x, y, z) {\n var order = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this._order;\n this._x = x;\n this._y = y;\n this._z = z;\n this._order = order;\n this._onChangeCallback();\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor(this._x, this._y, this._z, this._order);\n }\n }, {\n key: \"copy\",\n value: function copy(euler) {\n this._x = euler._x;\n this._y = euler._y;\n this._z = euler._z;\n this._order = euler._order;\n this._onChangeCallback();\n return this;\n }\n }, {\n key: \"setFromRotationMatrix\",\n value: function setFromRotationMatrix(m) {\n var order = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._order;\n var update = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n var te = m.elements;\n var m11 = te[0],\n m12 = te[4],\n m13 = te[8];\n var m21 = te[1],\n m22 = te[5],\n m23 = te[9];\n var m31 = te[2],\n m32 = te[6],\n m33 = te[10];\n switch (order) {\n case 'XYZ':\n this._y = Math.asin(clamp(m13, -1, 1));\n if (Math.abs(m13) < 0.9999999) {\n this._x = Math.atan2(-m23, m33);\n this._z = Math.atan2(-m12, m11);\n } else {\n this._x = Math.atan2(m32, m22);\n this._z = 0;\n }\n break;\n case 'YXZ':\n this._x = Math.asin(-clamp(m23, -1, 1));\n if (Math.abs(m23) < 0.9999999) {\n this._y = Math.atan2(m13, m33);\n this._z = Math.atan2(m21, m22);\n } else {\n this._y = Math.atan2(-m31, m11);\n this._z = 0;\n }\n break;\n case 'ZXY':\n this._x = Math.asin(clamp(m32, -1, 1));\n if (Math.abs(m32) < 0.9999999) {\n this._y = Math.atan2(-m31, m33);\n this._z = Math.atan2(-m12, m22);\n } else {\n this._y = 0;\n this._z = Math.atan2(m21, m11);\n }\n break;\n case 'ZYX':\n this._y = Math.asin(-clamp(m31, -1, 1));\n if (Math.abs(m31) < 0.9999999) {\n this._x = Math.atan2(m32, m33);\n this._z = Math.atan2(m21, m11);\n } else {\n this._x = 0;\n this._z = Math.atan2(-m12, m22);\n }\n break;\n case 'YZX':\n this._z = Math.asin(clamp(m21, -1, 1));\n if (Math.abs(m21) < 0.9999999) {\n this._x = Math.atan2(-m23, m22);\n this._y = Math.atan2(-m31, m11);\n } else {\n this._x = 0;\n this._y = Math.atan2(m13, m33);\n }\n break;\n case 'XZY':\n this._z = Math.asin(-clamp(m12, -1, 1));\n if (Math.abs(m12) < 0.9999999) {\n this._x = Math.atan2(m32, m22);\n this._y = Math.atan2(m13, m11);\n } else {\n this._x = Math.atan2(-m23, m33);\n this._y = 0;\n }\n break;\n default:\n console.warn('THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order);\n }\n this._order = order;\n if (update === true) this._onChangeCallback();\n return this;\n }\n }, {\n key: \"setFromQuaternion\",\n value: function setFromQuaternion(q, order, update) {\n _matrix.makeRotationFromQuaternion(q);\n return this.setFromRotationMatrix(_matrix, order, update);\n }\n }, {\n key: \"setFromVector3\",\n value: function setFromVector3(v) {\n var order = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._order;\n return this.set(v.x, v.y, v.z, order);\n }\n }, {\n key: \"reorder\",\n value: function reorder(newOrder) {\n // WARNING: this discards revolution information -bhouston\n\n _quaternion$3.setFromEuler(this);\n return this.setFromQuaternion(_quaternion$3, newOrder);\n }\n }, {\n key: \"equals\",\n value: function equals(euler) {\n return euler._x === this._x && euler._y === this._y && euler._z === this._z && euler._order === this._order;\n }\n }, {\n key: \"fromArray\",\n value: function fromArray(array) {\n this._x = array[0];\n this._y = array[1];\n this._z = array[2];\n if (array[3] !== undefined) this._order = array[3];\n this._onChangeCallback();\n return this;\n }\n }, {\n key: \"toArray\",\n value: function toArray() {\n var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n array[offset] = this._x;\n array[offset + 1] = this._y;\n array[offset + 2] = this._z;\n array[offset + 3] = this._order;\n return array;\n }\n }, {\n key: \"_onChange\",\n value: function _onChange(callback) {\n this._onChangeCallback = callback;\n return this;\n }\n }, {\n key: \"_onChangeCallback\",\n value: function _onChangeCallback() {}\n }, {\n key: _Symbol$iterator5,\n value: /*#__PURE__*/_regeneratorRuntime().mark(function value() {\n return _regeneratorRuntime().wrap(function value$(_context6) {\n while (1) switch (_context6.prev = _context6.next) {\n case 0:\n _context6.next = 2;\n return this._x;\n case 2:\n _context6.next = 4;\n return this._y;\n case 4:\n _context6.next = 6;\n return this._z;\n case 6:\n _context6.next = 8;\n return this._order;\n case 8:\n case \"end\":\n return _context6.stop();\n }\n }, value, this);\n })\n }]);\n return Euler;\n}(Symbol.iterator);\nEuler.DEFAULT_ORDER = 'XYZ';\nvar Layers = /*#__PURE__*/function () {\n function Layers() {\n _classCallCheck(this, Layers);\n this.mask = 1 | 0;\n }\n _createClass(Layers, [{\n key: \"set\",\n value: function set(channel) {\n this.mask = (1 << channel | 0) >>> 0;\n }\n }, {\n key: \"enable\",\n value: function enable(channel) {\n this.mask |= 1 << channel | 0;\n }\n }, {\n key: \"enableAll\",\n value: function enableAll() {\n this.mask = 0xffffffff | 0;\n }\n }, {\n key: \"toggle\",\n value: function toggle(channel) {\n this.mask ^= 1 << channel | 0;\n }\n }, {\n key: \"disable\",\n value: function disable(channel) {\n this.mask &= ~(1 << channel | 0);\n }\n }, {\n key: \"disableAll\",\n value: function disableAll() {\n this.mask = 0;\n }\n }, {\n key: \"test\",\n value: function test(layers) {\n return (this.mask & layers.mask) !== 0;\n }\n }, {\n key: \"isEnabled\",\n value: function isEnabled(channel) {\n return (this.mask & (1 << channel | 0)) !== 0;\n }\n }]);\n return Layers;\n}();\nvar _object3DId = 0;\nvar _v1$4 = /*@__PURE__*/new Vector3();\nvar _q1 = /*@__PURE__*/new Quaternion();\nvar _m1$1 = /*@__PURE__*/new Matrix4();\nvar _target = /*@__PURE__*/new Vector3();\nvar _position$3 = /*@__PURE__*/new Vector3();\nvar _scale$2 = /*@__PURE__*/new Vector3();\nvar _quaternion$2 = /*@__PURE__*/new Quaternion();\nvar _xAxis = /*@__PURE__*/new Vector3(1, 0, 0);\nvar _yAxis = /*@__PURE__*/new Vector3(0, 1, 0);\nvar _zAxis = /*@__PURE__*/new Vector3(0, 0, 1);\nvar _addedEvent = {\n type: 'added'\n};\nvar _removedEvent = {\n type: 'removed'\n};\nvar Object3D = /*#__PURE__*/function (_EventDispatcher3) {\n _inherits(Object3D, _EventDispatcher3);\n var _super8 = _createSuper(Object3D);\n function Object3D() {\n var _this9;\n _classCallCheck(this, Object3D);\n _this9 = _super8.call(this);\n _this9.isObject3D = true;\n Object.defineProperty(_assertThisInitialized(_this9), 'id', {\n value: _object3DId++\n });\n _this9.uuid = generateUUID();\n _this9.name = '';\n _this9.type = 'Object3D';\n _this9.parent = null;\n _this9.children = [];\n _this9.up = Object3D.DEFAULT_UP.clone();\n var position = new Vector3();\n var rotation = new Euler();\n var quaternion = new Quaternion();\n var scale = new Vector3(1, 1, 1);\n function onRotationChange() {\n quaternion.setFromEuler(rotation, false);\n }\n function onQuaternionChange() {\n rotation.setFromQuaternion(quaternion, undefined, false);\n }\n rotation._onChange(onRotationChange);\n quaternion._onChange(onQuaternionChange);\n Object.defineProperties(_assertThisInitialized(_this9), {\n position: {\n configurable: true,\n enumerable: true,\n value: position\n },\n rotation: {\n configurable: true,\n enumerable: true,\n value: rotation\n },\n quaternion: {\n configurable: true,\n enumerable: true,\n value: quaternion\n },\n scale: {\n configurable: true,\n enumerable: true,\n value: scale\n },\n modelViewMatrix: {\n value: new Matrix4()\n },\n normalMatrix: {\n value: new Matrix3()\n }\n });\n _this9.matrix = new Matrix4();\n _this9.matrixWorld = new Matrix4();\n _this9.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;\n _this9.matrixWorldNeedsUpdate = false;\n _this9.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer\n\n _this9.layers = new Layers();\n _this9.visible = true;\n _this9.castShadow = false;\n _this9.receiveShadow = false;\n _this9.frustumCulled = true;\n _this9.renderOrder = 0;\n _this9.animations = [];\n _this9.userData = {};\n return _this9;\n }\n _createClass(Object3D, [{\n key: \"onBeforeRender\",\n value: function onBeforeRender( /* renderer, scene, camera, geometry, material, group */) {}\n }, {\n key: \"onAfterRender\",\n value: function onAfterRender( /* renderer, scene, camera, geometry, material, group */) {}\n }, {\n key: \"applyMatrix4\",\n value: function applyMatrix4(matrix) {\n if (this.matrixAutoUpdate) this.updateMatrix();\n this.matrix.premultiply(matrix);\n this.matrix.decompose(this.position, this.quaternion, this.scale);\n }\n }, {\n key: \"applyQuaternion\",\n value: function applyQuaternion(q) {\n this.quaternion.premultiply(q);\n return this;\n }\n }, {\n key: \"setRotationFromAxisAngle\",\n value: function setRotationFromAxisAngle(axis, angle) {\n // assumes axis is normalized\n\n this.quaternion.setFromAxisAngle(axis, angle);\n }\n }, {\n key: \"setRotationFromEuler\",\n value: function setRotationFromEuler(euler) {\n this.quaternion.setFromEuler(euler, true);\n }\n }, {\n key: \"setRotationFromMatrix\",\n value: function setRotationFromMatrix(m) {\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n\n this.quaternion.setFromRotationMatrix(m);\n }\n }, {\n key: \"setRotationFromQuaternion\",\n value: function setRotationFromQuaternion(q) {\n // assumes q is normalized\n\n this.quaternion.copy(q);\n }\n }, {\n key: \"rotateOnAxis\",\n value: function rotateOnAxis(axis, angle) {\n // rotate object on axis in object space\n // axis is assumed to be normalized\n\n _q1.setFromAxisAngle(axis, angle);\n this.quaternion.multiply(_q1);\n return this;\n }\n }, {\n key: \"rotateOnWorldAxis\",\n value: function rotateOnWorldAxis(axis, angle) {\n // rotate object on axis in world space\n // axis is assumed to be normalized\n // method assumes no rotated parent\n\n _q1.setFromAxisAngle(axis, angle);\n this.quaternion.premultiply(_q1);\n return this;\n }\n }, {\n key: \"rotateX\",\n value: function rotateX(angle) {\n return this.rotateOnAxis(_xAxis, angle);\n }\n }, {\n key: \"rotateY\",\n value: function rotateY(angle) {\n return this.rotateOnAxis(_yAxis, angle);\n }\n }, {\n key: \"rotateZ\",\n value: function rotateZ(angle) {\n return this.rotateOnAxis(_zAxis, angle);\n }\n }, {\n key: \"translateOnAxis\",\n value: function translateOnAxis(axis, distance) {\n // translate object by distance along axis in object space\n // axis is assumed to be normalized\n\n _v1$4.copy(axis).applyQuaternion(this.quaternion);\n this.position.add(_v1$4.multiplyScalar(distance));\n return this;\n }\n }, {\n key: \"translateX\",\n value: function translateX(distance) {\n return this.translateOnAxis(_xAxis, distance);\n }\n }, {\n key: \"translateY\",\n value: function translateY(distance) {\n return this.translateOnAxis(_yAxis, distance);\n }\n }, {\n key: \"translateZ\",\n value: function translateZ(distance) {\n return this.translateOnAxis(_zAxis, distance);\n }\n }, {\n key: \"localToWorld\",\n value: function localToWorld(vector) {\n this.updateWorldMatrix(true, false);\n return vector.applyMatrix4(this.matrixWorld);\n }\n }, {\n key: \"worldToLocal\",\n value: function worldToLocal(vector) {\n this.updateWorldMatrix(true, false);\n return vector.applyMatrix4(_m1$1.copy(this.matrixWorld).invert());\n }\n }, {\n key: \"lookAt\",\n value: function lookAt(x, y, z) {\n // This method does not support objects having non-uniformly-scaled parent(s)\n\n if (x.isVector3) {\n _target.copy(x);\n } else {\n _target.set(x, y, z);\n }\n var parent = this.parent;\n this.updateWorldMatrix(true, false);\n _position$3.setFromMatrixPosition(this.matrixWorld);\n if (this.isCamera || this.isLight) {\n _m1$1.lookAt(_position$3, _target, this.up);\n } else {\n _m1$1.lookAt(_target, _position$3, this.up);\n }\n this.quaternion.setFromRotationMatrix(_m1$1);\n if (parent) {\n _m1$1.extractRotation(parent.matrixWorld);\n _q1.setFromRotationMatrix(_m1$1);\n this.quaternion.premultiply(_q1.invert());\n }\n }\n }, {\n key: \"add\",\n value: function add(object) {\n if (arguments.length > 1) {\n for (var i = 0; i < arguments.length; i++) {\n this.add(arguments[i]);\n }\n return this;\n }\n if (object === this) {\n console.error('THREE.Object3D.add: object can\\'t be added as a child of itself.', object);\n return this;\n }\n if (object && object.isObject3D) {\n if (object.parent !== null) {\n object.parent.remove(object);\n }\n object.parent = this;\n this.children.push(object);\n object.dispatchEvent(_addedEvent);\n } else {\n console.error('THREE.Object3D.add: object not an instance of THREE.Object3D.', object);\n }\n return this;\n }\n }, {\n key: \"remove\",\n value: function remove(object) {\n if (arguments.length > 1) {\n for (var i = 0; i < arguments.length; i++) {\n this.remove(arguments[i]);\n }\n return this;\n }\n var index = this.children.indexOf(object);\n if (index !== -1) {\n object.parent = null;\n this.children.splice(index, 1);\n object.dispatchEvent(_removedEvent);\n }\n return this;\n }\n }, {\n key: \"removeFromParent\",\n value: function removeFromParent() {\n var parent = this.parent;\n if (parent !== null) {\n parent.remove(this);\n }\n return this;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n for (var i = 0; i < this.children.length; i++) {\n var object = this.children[i];\n object.parent = null;\n object.dispatchEvent(_removedEvent);\n }\n this.children.length = 0;\n return this;\n }\n }, {\n key: \"attach\",\n value: function attach(object) {\n // adds object as a child of this, while maintaining the object's world transform\n\n // Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)\n\n this.updateWorldMatrix(true, false);\n _m1$1.copy(this.matrixWorld).invert();\n if (object.parent !== null) {\n object.parent.updateWorldMatrix(true, false);\n _m1$1.multiply(object.parent.matrixWorld);\n }\n object.applyMatrix4(_m1$1);\n this.add(object);\n object.updateWorldMatrix(false, true);\n return this;\n }\n }, {\n key: \"getObjectById\",\n value: function getObjectById(id) {\n return this.getObjectByProperty('id', id);\n }\n }, {\n key: \"getObjectByName\",\n value: function getObjectByName(name) {\n return this.getObjectByProperty('name', name);\n }\n }, {\n key: \"getObjectByProperty\",\n value: function getObjectByProperty(name, value) {\n if (this[name] === value) return this;\n for (var i = 0, l = this.children.length; i < l; i++) {\n var child = this.children[i];\n var object = child.getObjectByProperty(name, value);\n if (object !== undefined) {\n return object;\n }\n }\n return undefined;\n }\n }, {\n key: \"getObjectsByProperty\",\n value: function getObjectsByProperty(name, value) {\n var result = [];\n if (this[name] === value) result.push(this);\n for (var i = 0, l = this.children.length; i < l; i++) {\n var childResult = this.children[i].getObjectsByProperty(name, value);\n if (childResult.length > 0) {\n result = result.concat(childResult);\n }\n }\n return result;\n }\n }, {\n key: \"getWorldPosition\",\n value: function getWorldPosition(target) {\n this.updateWorldMatrix(true, false);\n return target.setFromMatrixPosition(this.matrixWorld);\n }\n }, {\n key: \"getWorldQuaternion\",\n value: function getWorldQuaternion(target) {\n this.updateWorldMatrix(true, false);\n this.matrixWorld.decompose(_position$3, target, _scale$2);\n return target;\n }\n }, {\n key: \"getWorldScale\",\n value: function getWorldScale(target) {\n this.updateWorldMatrix(true, false);\n this.matrixWorld.decompose(_position$3, _quaternion$2, target);\n return target;\n }\n }, {\n key: \"getWorldDirection\",\n value: function getWorldDirection(target) {\n this.updateWorldMatrix(true, false);\n var e = this.matrixWorld.elements;\n return target.set(e[8], e[9], e[10]).normalize();\n }\n }, {\n key: \"raycast\",\n value: function raycast( /* raycaster, intersects */) {}\n }, {\n key: \"traverse\",\n value: function traverse(callback) {\n callback(this);\n var children = this.children;\n for (var i = 0, l = children.length; i < l; i++) {\n children[i].traverse(callback);\n }\n }\n }, {\n key: \"traverseVisible\",\n value: function traverseVisible(callback) {\n if (this.visible === false) return;\n callback(this);\n var children = this.children;\n for (var i = 0, l = children.length; i < l; i++) {\n children[i].traverseVisible(callback);\n }\n }\n }, {\n key: \"traverseAncestors\",\n value: function traverseAncestors(callback) {\n var parent = this.parent;\n if (parent !== null) {\n callback(parent);\n parent.traverseAncestors(callback);\n }\n }\n }, {\n key: \"updateMatrix\",\n value: function updateMatrix() {\n this.matrix.compose(this.position, this.quaternion, this.scale);\n this.matrixWorldNeedsUpdate = true;\n }\n }, {\n key: \"updateMatrixWorld\",\n value: function updateMatrixWorld(force) {\n if (this.matrixAutoUpdate) this.updateMatrix();\n if (this.matrixWorldNeedsUpdate || force) {\n if (this.parent === null) {\n this.matrixWorld.copy(this.matrix);\n } else {\n this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);\n }\n this.matrixWorldNeedsUpdate = false;\n force = true;\n }\n\n // update children\n\n var children = this.children;\n for (var i = 0, l = children.length; i < l; i++) {\n var child = children[i];\n if (child.matrixWorldAutoUpdate === true || force === true) {\n child.updateMatrixWorld(force);\n }\n }\n }\n }, {\n key: \"updateWorldMatrix\",\n value: function updateWorldMatrix(updateParents, updateChildren) {\n var parent = this.parent;\n if (updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true) {\n parent.updateWorldMatrix(true, false);\n }\n if (this.matrixAutoUpdate) this.updateMatrix();\n if (this.parent === null) {\n this.matrixWorld.copy(this.matrix);\n } else {\n this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix);\n }\n\n // update children\n\n if (updateChildren === true) {\n var children = this.children;\n for (var i = 0, l = children.length; i < l; i++) {\n var child = children[i];\n if (child.matrixWorldAutoUpdate === true) {\n child.updateWorldMatrix(false, true);\n }\n }\n }\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(meta) {\n // meta is a string when called from JSON.stringify\n var isRootObject = meta === undefined || typeof meta === 'string';\n var output = {};\n\n // meta is a hash used to collect geometries, materials.\n // not providing it implies that this is the root object\n // being serialized.\n if (isRootObject) {\n // initialize meta obj\n meta = {\n geometries: {},\n materials: {},\n textures: {},\n images: {},\n shapes: {},\n skeletons: {},\n animations: {},\n nodes: {}\n };\n output.metadata = {\n version: 4.5,\n type: 'Object',\n generator: 'Object3D.toJSON'\n };\n }\n\n // standard Object3D serialization\n\n var object = {};\n object.uuid = this.uuid;\n object.type = this.type;\n if (this.name !== '') object.name = this.name;\n if (this.castShadow === true) object.castShadow = true;\n if (this.receiveShadow === true) object.receiveShadow = true;\n if (this.visible === false) object.visible = false;\n if (this.frustumCulled === false) object.frustumCulled = false;\n if (this.renderOrder !== 0) object.renderOrder = this.renderOrder;\n if (Object.keys(this.userData).length > 0) object.userData = this.userData;\n object.layers = this.layers.mask;\n object.matrix = this.matrix.toArray();\n object.up = this.up.toArray();\n if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false;\n\n // object specific properties\n\n if (this.isInstancedMesh) {\n object.type = 'InstancedMesh';\n object.count = this.count;\n object.instanceMatrix = this.instanceMatrix.toJSON();\n if (this.instanceColor !== null) object.instanceColor = this.instanceColor.toJSON();\n }\n\n //\n\n function serialize(library, element) {\n if (library[element.uuid] === undefined) {\n library[element.uuid] = element.toJSON(meta);\n }\n return element.uuid;\n }\n if (this.isScene) {\n if (this.background) {\n if (this.background.isColor) {\n object.background = this.background.toJSON();\n } else if (this.background.isTexture) {\n object.background = this.background.toJSON(meta).uuid;\n }\n }\n if (this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true) {\n object.environment = this.environment.toJSON(meta).uuid;\n }\n } else if (this.isMesh || this.isLine || this.isPoints) {\n object.geometry = serialize(meta.geometries, this.geometry);\n var parameters = this.geometry.parameters;\n if (parameters !== undefined && parameters.shapes !== undefined) {\n var shapes = parameters.shapes;\n if (Array.isArray(shapes)) {\n for (var i = 0, l = shapes.length; i < l; i++) {\n var shape = shapes[i];\n serialize(meta.shapes, shape);\n }\n } else {\n serialize(meta.shapes, shapes);\n }\n }\n }\n if (this.isSkinnedMesh) {\n object.bindMode = this.bindMode;\n object.bindMatrix = this.bindMatrix.toArray();\n if (this.skeleton !== undefined) {\n serialize(meta.skeletons, this.skeleton);\n object.skeleton = this.skeleton.uuid;\n }\n }\n if (this.material !== undefined) {\n if (Array.isArray(this.material)) {\n var uuids = [];\n for (var _i3 = 0, _l2 = this.material.length; _i3 < _l2; _i3++) {\n uuids.push(serialize(meta.materials, this.material[_i3]));\n }\n object.material = uuids;\n } else {\n object.material = serialize(meta.materials, this.material);\n }\n }\n\n //\n\n if (this.children.length > 0) {\n object.children = [];\n for (var _i4 = 0; _i4 < this.children.length; _i4++) {\n object.children.push(this.children[_i4].toJSON(meta).object);\n }\n }\n\n //\n\n if (this.animations.length > 0) {\n object.animations = [];\n for (var _i5 = 0; _i5 < this.animations.length; _i5++) {\n var animation = this.animations[_i5];\n object.animations.push(serialize(meta.animations, animation));\n }\n }\n if (isRootObject) {\n var geometries = extractFromCache(meta.geometries);\n var materials = extractFromCache(meta.materials);\n var textures = extractFromCache(meta.textures);\n var images = extractFromCache(meta.images);\n var _shapes = extractFromCache(meta.shapes);\n var skeletons = extractFromCache(meta.skeletons);\n var animations = extractFromCache(meta.animations);\n var nodes = extractFromCache(meta.nodes);\n if (geometries.length > 0) output.geometries = geometries;\n if (materials.length > 0) output.materials = materials;\n if (textures.length > 0) output.textures = textures;\n if (images.length > 0) output.images = images;\n if (_shapes.length > 0) output.shapes = _shapes;\n if (skeletons.length > 0) output.skeletons = skeletons;\n if (animations.length > 0) output.animations = animations;\n if (nodes.length > 0) output.nodes = nodes;\n }\n output.object = object;\n return output;\n\n // extract data from the cache hash\n // remove metadata on each item\n // and return as array\n function extractFromCache(cache) {\n var values = [];\n for (var key in cache) {\n var data = cache[key];\n delete data.metadata;\n values.push(data);\n }\n return values;\n }\n }\n }, {\n key: \"clone\",\n value: function clone(recursive) {\n return new this.constructor().copy(this, recursive);\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n var recursive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n this.name = source.name;\n this.up.copy(source.up);\n this.position.copy(source.position);\n this.rotation.order = source.rotation.order;\n this.quaternion.copy(source.quaternion);\n this.scale.copy(source.scale);\n this.matrix.copy(source.matrix);\n this.matrixWorld.copy(source.matrixWorld);\n this.matrixAutoUpdate = source.matrixAutoUpdate;\n this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;\n this.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;\n this.layers.mask = source.layers.mask;\n this.visible = source.visible;\n this.castShadow = source.castShadow;\n this.receiveShadow = source.receiveShadow;\n this.frustumCulled = source.frustumCulled;\n this.renderOrder = source.renderOrder;\n this.userData = JSON.parse(JSON.stringify(source.userData));\n if (recursive === true) {\n for (var i = 0; i < source.children.length; i++) {\n var child = source.children[i];\n this.add(child.clone());\n }\n }\n return this;\n }\n }]);\n return Object3D;\n}(EventDispatcher);\nObject3D.DEFAULT_UP = /*@__PURE__*/new Vector3(0, 1, 0);\nObject3D.DEFAULT_MATRIX_AUTO_UPDATE = true;\nObject3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;\nvar _v0$1 = /*@__PURE__*/new Vector3();\nvar _v1$3 = /*@__PURE__*/new Vector3();\nvar _v2$2 = /*@__PURE__*/new Vector3();\nvar _v3$1 = /*@__PURE__*/new Vector3();\nvar _vab = /*@__PURE__*/new Vector3();\nvar _vac = /*@__PURE__*/new Vector3();\nvar _vbc = /*@__PURE__*/new Vector3();\nvar _vap = /*@__PURE__*/new Vector3();\nvar _vbp = /*@__PURE__*/new Vector3();\nvar _vcp = /*@__PURE__*/new Vector3();\nvar warnedGetUV = false;\nvar Triangle = /*#__PURE__*/function () {\n function Triangle() {\n var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector3();\n var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3();\n var c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Vector3();\n _classCallCheck(this, Triangle);\n this.a = a;\n this.b = b;\n this.c = c;\n }\n _createClass(Triangle, [{\n key: \"set\",\n value: function set(a, b, c) {\n this.a.copy(a);\n this.b.copy(b);\n this.c.copy(c);\n return this;\n }\n }, {\n key: \"setFromPointsAndIndices\",\n value: function setFromPointsAndIndices(points, i0, i1, i2) {\n this.a.copy(points[i0]);\n this.b.copy(points[i1]);\n this.c.copy(points[i2]);\n return this;\n }\n }, {\n key: \"setFromAttributeAndIndices\",\n value: function setFromAttributeAndIndices(attribute, i0, i1, i2) {\n this.a.fromBufferAttribute(attribute, i0);\n this.b.fromBufferAttribute(attribute, i1);\n this.c.fromBufferAttribute(attribute, i2);\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }, {\n key: \"copy\",\n value: function copy(triangle) {\n this.a.copy(triangle.a);\n this.b.copy(triangle.b);\n this.c.copy(triangle.c);\n return this;\n }\n }, {\n key: \"getArea\",\n value: function getArea() {\n _v0$1.subVectors(this.c, this.b);\n _v1$3.subVectors(this.a, this.b);\n return _v0$1.cross(_v1$3).length() * 0.5;\n }\n }, {\n key: \"getMidpoint\",\n value: function getMidpoint(target) {\n return target.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3);\n }\n }, {\n key: \"getNormal\",\n value: function getNormal(target) {\n return Triangle.getNormal(this.a, this.b, this.c, target);\n }\n }, {\n key: \"getPlane\",\n value: function getPlane(target) {\n return target.setFromCoplanarPoints(this.a, this.b, this.c);\n }\n }, {\n key: \"getBarycoord\",\n value: function getBarycoord(point, target) {\n return Triangle.getBarycoord(point, this.a, this.b, this.c, target);\n }\n }, {\n key: \"getUV\",\n value: function getUV(point, uv1, uv2, uv3, target) {\n // @deprecated, r151\n\n if (warnedGetUV === false) {\n console.warn('THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().');\n warnedGetUV = true;\n }\n return Triangle.getInterpolation(point, this.a, this.b, this.c, uv1, uv2, uv3, target);\n }\n }, {\n key: \"getInterpolation\",\n value: function getInterpolation(point, v1, v2, v3, target) {\n return Triangle.getInterpolation(point, this.a, this.b, this.c, v1, v2, v3, target);\n }\n }, {\n key: \"containsPoint\",\n value: function containsPoint(point) {\n return Triangle.containsPoint(point, this.a, this.b, this.c);\n }\n }, {\n key: \"isFrontFacing\",\n value: function isFrontFacing(direction) {\n return Triangle.isFrontFacing(this.a, this.b, this.c, direction);\n }\n }, {\n key: \"intersectsBox\",\n value: function intersectsBox(box) {\n return box.intersectsTriangle(this);\n }\n }, {\n key: \"closestPointToPoint\",\n value: function closestPointToPoint(p, target) {\n var a = this.a,\n b = this.b,\n c = this.c;\n var v, w;\n\n // algorithm thanks to Real-Time Collision Detection by Christer Ericson,\n // published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc.,\n // under the accompanying license; see chapter 5.1.5 for detailed explanation.\n // basically, we're distinguishing which of the voronoi regions of the triangle\n // the point lies in with the minimum amount of redundant computation.\n\n _vab.subVectors(b, a);\n _vac.subVectors(c, a);\n _vap.subVectors(p, a);\n var d1 = _vab.dot(_vap);\n var d2 = _vac.dot(_vap);\n if (d1 <= 0 && d2 <= 0) {\n // vertex region of A; barycentric coords (1, 0, 0)\n return target.copy(a);\n }\n _vbp.subVectors(p, b);\n var d3 = _vab.dot(_vbp);\n var d4 = _vac.dot(_vbp);\n if (d3 >= 0 && d4 <= d3) {\n // vertex region of B; barycentric coords (0, 1, 0)\n return target.copy(b);\n }\n var vc = d1 * d4 - d3 * d2;\n if (vc <= 0 && d1 >= 0 && d3 <= 0) {\n v = d1 / (d1 - d3);\n // edge region of AB; barycentric coords (1-v, v, 0)\n return target.copy(a).addScaledVector(_vab, v);\n }\n _vcp.subVectors(p, c);\n var d5 = _vab.dot(_vcp);\n var d6 = _vac.dot(_vcp);\n if (d6 >= 0 && d5 <= d6) {\n // vertex region of C; barycentric coords (0, 0, 1)\n return target.copy(c);\n }\n var vb = d5 * d2 - d1 * d6;\n if (vb <= 0 && d2 >= 0 && d6 <= 0) {\n w = d2 / (d2 - d6);\n // edge region of AC; barycentric coords (1-w, 0, w)\n return target.copy(a).addScaledVector(_vac, w);\n }\n var va = d3 * d6 - d5 * d4;\n if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) {\n _vbc.subVectors(c, b);\n w = (d4 - d3) / (d4 - d3 + (d5 - d6));\n // edge region of BC; barycentric coords (0, 1-w, w)\n return target.copy(b).addScaledVector(_vbc, w); // edge region of BC\n }\n\n // face region\n var denom = 1 / (va + vb + vc);\n // u = va * denom\n v = vb * denom;\n w = vc * denom;\n return target.copy(a).addScaledVector(_vab, v).addScaledVector(_vac, w);\n }\n }, {\n key: \"equals\",\n value: function equals(triangle) {\n return triangle.a.equals(this.a) && triangle.b.equals(this.b) && triangle.c.equals(this.c);\n }\n }], [{\n key: \"getNormal\",\n value: function getNormal(a, b, c, target) {\n target.subVectors(c, b);\n _v0$1.subVectors(a, b);\n target.cross(_v0$1);\n var targetLengthSq = target.lengthSq();\n if (targetLengthSq > 0) {\n return target.multiplyScalar(1 / Math.sqrt(targetLengthSq));\n }\n return target.set(0, 0, 0);\n }\n\n // static/instance method to calculate barycentric coordinates\n // based on: http://www.blackpawn.com/texts/pointinpoly/default.html\n }, {\n key: \"getBarycoord\",\n value: function getBarycoord(point, a, b, c, target) {\n _v0$1.subVectors(c, a);\n _v1$3.subVectors(b, a);\n _v2$2.subVectors(point, a);\n var dot00 = _v0$1.dot(_v0$1);\n var dot01 = _v0$1.dot(_v1$3);\n var dot02 = _v0$1.dot(_v2$2);\n var dot11 = _v1$3.dot(_v1$3);\n var dot12 = _v1$3.dot(_v2$2);\n var denom = dot00 * dot11 - dot01 * dot01;\n\n // collinear or singular triangle\n if (denom === 0) {\n // arbitrary location outside of triangle?\n // not sure if this is the best idea, maybe should be returning undefined\n return target.set(-2, -1, -1);\n }\n var invDenom = 1 / denom;\n var u = (dot11 * dot02 - dot01 * dot12) * invDenom;\n var v = (dot00 * dot12 - dot01 * dot02) * invDenom;\n\n // barycentric coordinates must always sum to 1\n return target.set(1 - u - v, v, u);\n }\n }, {\n key: \"containsPoint\",\n value: function containsPoint(point, a, b, c) {\n this.getBarycoord(point, a, b, c, _v3$1);\n return _v3$1.x >= 0 && _v3$1.y >= 0 && _v3$1.x + _v3$1.y <= 1;\n }\n }, {\n key: \"getUV\",\n value: function getUV(point, p1, p2, p3, uv1, uv2, uv3, target) {\n // @deprecated, r151\n\n if (warnedGetUV === false) {\n console.warn('THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().');\n warnedGetUV = true;\n }\n return this.getInterpolation(point, p1, p2, p3, uv1, uv2, uv3, target);\n }\n }, {\n key: \"getInterpolation\",\n value: function getInterpolation(point, p1, p2, p3, v1, v2, v3, target) {\n this.getBarycoord(point, p1, p2, p3, _v3$1);\n target.setScalar(0);\n target.addScaledVector(v1, _v3$1.x);\n target.addScaledVector(v2, _v3$1.y);\n target.addScaledVector(v3, _v3$1.z);\n return target;\n }\n }, {\n key: \"isFrontFacing\",\n value: function isFrontFacing(a, b, c, direction) {\n _v0$1.subVectors(c, b);\n _v1$3.subVectors(a, b);\n\n // strictly front facing\n return _v0$1.cross(_v1$3).dot(direction) < 0 ? true : false;\n }\n }]);\n return Triangle;\n}();\nvar materialId = 0;\nvar Material = /*#__PURE__*/function (_EventDispatcher4) {\n _inherits(Material, _EventDispatcher4);\n var _super9 = _createSuper(Material);\n function Material() {\n var _this10;\n _classCallCheck(this, Material);\n _this10 = _super9.call(this);\n _this10.isMaterial = true;\n Object.defineProperty(_assertThisInitialized(_this10), 'id', {\n value: materialId++\n });\n _this10.uuid = generateUUID();\n _this10.name = '';\n _this10.type = 'Material';\n _this10.blending = NormalBlending;\n _this10.side = FrontSide;\n _this10.vertexColors = false;\n _this10.opacity = 1;\n _this10.transparent = false;\n _this10.blendSrc = SrcAlphaFactor;\n _this10.blendDst = OneMinusSrcAlphaFactor;\n _this10.blendEquation = AddEquation;\n _this10.blendSrcAlpha = null;\n _this10.blendDstAlpha = null;\n _this10.blendEquationAlpha = null;\n _this10.depthFunc = LessEqualDepth;\n _this10.depthTest = true;\n _this10.depthWrite = true;\n _this10.stencilWriteMask = 0xff;\n _this10.stencilFunc = AlwaysStencilFunc;\n _this10.stencilRef = 0;\n _this10.stencilFuncMask = 0xff;\n _this10.stencilFail = KeepStencilOp;\n _this10.stencilZFail = KeepStencilOp;\n _this10.stencilZPass = KeepStencilOp;\n _this10.stencilWrite = false;\n _this10.clippingPlanes = null;\n _this10.clipIntersection = false;\n _this10.clipShadows = false;\n _this10.shadowSide = null;\n _this10.colorWrite = true;\n _this10.precision = null; // override the renderer's default precision for this material\n\n _this10.polygonOffset = false;\n _this10.polygonOffsetFactor = 0;\n _this10.polygonOffsetUnits = 0;\n _this10.dithering = false;\n _this10.alphaToCoverage = false;\n _this10.premultipliedAlpha = false;\n _this10.forceSinglePass = false;\n _this10.visible = true;\n _this10.toneMapped = true;\n _this10.userData = {};\n _this10.version = 0;\n _this10._alphaTest = 0;\n return _this10;\n }\n _createClass(Material, [{\n key: \"alphaTest\",\n get: function get() {\n return this._alphaTest;\n },\n set: function set(value) {\n if (this._alphaTest > 0 !== value > 0) {\n this.version++;\n }\n this._alphaTest = value;\n }\n }, {\n key: \"onBuild\",\n value: function onBuild( /* shaderobject, renderer */) {}\n }, {\n key: \"onBeforeRender\",\n value: function onBeforeRender( /* renderer, scene, camera, geometry, object, group */) {}\n }, {\n key: \"onBeforeCompile\",\n value: function onBeforeCompile( /* shaderobject, renderer */) {}\n }, {\n key: \"customProgramCacheKey\",\n value: function customProgramCacheKey() {\n return this.onBeforeCompile.toString();\n }\n }, {\n key: \"setValues\",\n value: function setValues(values) {\n if (values === undefined) return;\n for (var key in values) {\n var newValue = values[key];\n if (newValue === undefined) {\n console.warn(\"THREE.Material: parameter '\".concat(key, \"' has value of undefined.\"));\n continue;\n }\n var currentValue = this[key];\n if (currentValue === undefined) {\n console.warn(\"THREE.Material: '\".concat(key, \"' is not a property of THREE.\").concat(this.type, \".\"));\n continue;\n }\n if (currentValue && currentValue.isColor) {\n currentValue.set(newValue);\n } else if (currentValue && currentValue.isVector3 && newValue && newValue.isVector3) {\n currentValue.copy(newValue);\n } else {\n this[key] = newValue;\n }\n }\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(meta) {\n var isRootObject = meta === undefined || typeof meta === 'string';\n if (isRootObject) {\n meta = {\n textures: {},\n images: {}\n };\n }\n var data = {\n metadata: {\n version: 4.5,\n type: 'Material',\n generator: 'Material.toJSON'\n }\n };\n\n // standard Material serialization\n data.uuid = this.uuid;\n data.type = this.type;\n if (this.name !== '') data.name = this.name;\n if (this.color && this.color.isColor) data.color = this.color.getHex();\n if (this.roughness !== undefined) data.roughness = this.roughness;\n if (this.metalness !== undefined) data.metalness = this.metalness;\n if (this.sheen !== undefined) data.sheen = this.sheen;\n if (this.sheenColor && this.sheenColor.isColor) data.sheenColor = this.sheenColor.getHex();\n if (this.sheenRoughness !== undefined) data.sheenRoughness = this.sheenRoughness;\n if (this.emissive && this.emissive.isColor) data.emissive = this.emissive.getHex();\n if (this.emissiveIntensity && this.emissiveIntensity !== 1) data.emissiveIntensity = this.emissiveIntensity;\n if (this.specular && this.specular.isColor) data.specular = this.specular.getHex();\n if (this.specularIntensity !== undefined) data.specularIntensity = this.specularIntensity;\n if (this.specularColor && this.specularColor.isColor) data.specularColor = this.specularColor.getHex();\n if (this.shininess !== undefined) data.shininess = this.shininess;\n if (this.clearcoat !== undefined) data.clearcoat = this.clearcoat;\n if (this.clearcoatRoughness !== undefined) data.clearcoatRoughness = this.clearcoatRoughness;\n if (this.clearcoatMap && this.clearcoatMap.isTexture) {\n data.clearcoatMap = this.clearcoatMap.toJSON(meta).uuid;\n }\n if (this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture) {\n data.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(meta).uuid;\n }\n if (this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture) {\n data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(meta).uuid;\n data.clearcoatNormalScale = this.clearcoatNormalScale.toArray();\n }\n if (this.iridescence !== undefined) data.iridescence = this.iridescence;\n if (this.iridescenceIOR !== undefined) data.iridescenceIOR = this.iridescenceIOR;\n if (this.iridescenceThicknessRange !== undefined) data.iridescenceThicknessRange = this.iridescenceThicknessRange;\n if (this.iridescenceMap && this.iridescenceMap.isTexture) {\n data.iridescenceMap = this.iridescenceMap.toJSON(meta).uuid;\n }\n if (this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture) {\n data.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(meta).uuid;\n }\n if (this.map && this.map.isTexture) data.map = this.map.toJSON(meta).uuid;\n if (this.matcap && this.matcap.isTexture) data.matcap = this.matcap.toJSON(meta).uuid;\n if (this.alphaMap && this.alphaMap.isTexture) data.alphaMap = this.alphaMap.toJSON(meta).uuid;\n if (this.lightMap && this.lightMap.isTexture) {\n data.lightMap = this.lightMap.toJSON(meta).uuid;\n data.lightMapIntensity = this.lightMapIntensity;\n }\n if (this.aoMap && this.aoMap.isTexture) {\n data.aoMap = this.aoMap.toJSON(meta).uuid;\n data.aoMapIntensity = this.aoMapIntensity;\n }\n if (this.bumpMap && this.bumpMap.isTexture) {\n data.bumpMap = this.bumpMap.toJSON(meta).uuid;\n data.bumpScale = this.bumpScale;\n }\n if (this.normalMap && this.normalMap.isTexture) {\n data.normalMap = this.normalMap.toJSON(meta).uuid;\n data.normalMapType = this.normalMapType;\n data.normalScale = this.normalScale.toArray();\n }\n if (this.displacementMap && this.displacementMap.isTexture) {\n data.displacementMap = this.displacementMap.toJSON(meta).uuid;\n data.displacementScale = this.displacementScale;\n data.displacementBias = this.displacementBias;\n }\n if (this.roughnessMap && this.roughnessMap.isTexture) data.roughnessMap = this.roughnessMap.toJSON(meta).uuid;\n if (this.metalnessMap && this.metalnessMap.isTexture) data.metalnessMap = this.metalnessMap.toJSON(meta).uuid;\n if (this.emissiveMap && this.emissiveMap.isTexture) data.emissiveMap = this.emissiveMap.toJSON(meta).uuid;\n if (this.specularMap && this.specularMap.isTexture) data.specularMap = this.specularMap.toJSON(meta).uuid;\n if (this.specularIntensityMap && this.specularIntensityMap.isTexture) data.specularIntensityMap = this.specularIntensityMap.toJSON(meta).uuid;\n if (this.specularColorMap && this.specularColorMap.isTexture) data.specularColorMap = this.specularColorMap.toJSON(meta).uuid;\n if (this.envMap && this.envMap.isTexture) {\n data.envMap = this.envMap.toJSON(meta).uuid;\n if (this.combine !== undefined) data.combine = this.combine;\n }\n if (this.envMapIntensity !== undefined) data.envMapIntensity = this.envMapIntensity;\n if (this.reflectivity !== undefined) data.reflectivity = this.reflectivity;\n if (this.refractionRatio !== undefined) data.refractionRatio = this.refractionRatio;\n if (this.gradientMap && this.gradientMap.isTexture) {\n data.gradientMap = this.gradientMap.toJSON(meta).uuid;\n }\n if (this.transmission !== undefined) data.transmission = this.transmission;\n if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid;\n if (this.thickness !== undefined) data.thickness = this.thickness;\n if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid;\n if (this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity) data.attenuationDistance = this.attenuationDistance;\n if (this.attenuationColor !== undefined) data.attenuationColor = this.attenuationColor.getHex();\n if (this.size !== undefined) data.size = this.size;\n if (this.shadowSide !== null) data.shadowSide = this.shadowSide;\n if (this.sizeAttenuation !== undefined) data.sizeAttenuation = this.sizeAttenuation;\n if (this.blending !== NormalBlending) data.blending = this.blending;\n if (this.side !== FrontSide) data.side = this.side;\n if (this.vertexColors) data.vertexColors = true;\n if (this.opacity < 1) data.opacity = this.opacity;\n if (this.transparent === true) data.transparent = this.transparent;\n data.depthFunc = this.depthFunc;\n data.depthTest = this.depthTest;\n data.depthWrite = this.depthWrite;\n data.colorWrite = this.colorWrite;\n data.stencilWrite = this.stencilWrite;\n data.stencilWriteMask = this.stencilWriteMask;\n data.stencilFunc = this.stencilFunc;\n data.stencilRef = this.stencilRef;\n data.stencilFuncMask = this.stencilFuncMask;\n data.stencilFail = this.stencilFail;\n data.stencilZFail = this.stencilZFail;\n data.stencilZPass = this.stencilZPass;\n\n // rotation (SpriteMaterial)\n if (this.rotation !== undefined && this.rotation !== 0) data.rotation = this.rotation;\n if (this.polygonOffset === true) data.polygonOffset = true;\n if (this.polygonOffsetFactor !== 0) data.polygonOffsetFactor = this.polygonOffsetFactor;\n if (this.polygonOffsetUnits !== 0) data.polygonOffsetUnits = this.polygonOffsetUnits;\n if (this.linewidth !== undefined && this.linewidth !== 1) data.linewidth = this.linewidth;\n if (this.dashSize !== undefined) data.dashSize = this.dashSize;\n if (this.gapSize !== undefined) data.gapSize = this.gapSize;\n if (this.scale !== undefined) data.scale = this.scale;\n if (this.dithering === true) data.dithering = true;\n if (this.alphaTest > 0) data.alphaTest = this.alphaTest;\n if (this.alphaToCoverage === true) data.alphaToCoverage = this.alphaToCoverage;\n if (this.premultipliedAlpha === true) data.premultipliedAlpha = this.premultipliedAlpha;\n if (this.forceSinglePass === true) data.forceSinglePass = this.forceSinglePass;\n if (this.wireframe === true) data.wireframe = this.wireframe;\n if (this.wireframeLinewidth > 1) data.wireframeLinewidth = this.wireframeLinewidth;\n if (this.wireframeLinecap !== 'round') data.wireframeLinecap = this.wireframeLinecap;\n if (this.wireframeLinejoin !== 'round') data.wireframeLinejoin = this.wireframeLinejoin;\n if (this.flatShading === true) data.flatShading = this.flatShading;\n if (this.visible === false) data.visible = false;\n if (this.toneMapped === false) data.toneMapped = false;\n if (this.fog === false) data.fog = false;\n if (Object.keys(this.userData).length > 0) data.userData = this.userData;\n\n // TODO: Copied from Object3D.toJSON\n\n function extractFromCache(cache) {\n var values = [];\n for (var key in cache) {\n var _data2 = cache[key];\n delete _data2.metadata;\n values.push(_data2);\n }\n return values;\n }\n if (isRootObject) {\n var textures = extractFromCache(meta.textures);\n var images = extractFromCache(meta.images);\n if (textures.length > 0) data.textures = textures;\n if (images.length > 0) data.images = images;\n }\n return data;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n this.name = source.name;\n this.blending = source.blending;\n this.side = source.side;\n this.vertexColors = source.vertexColors;\n this.opacity = source.opacity;\n this.transparent = source.transparent;\n this.blendSrc = source.blendSrc;\n this.blendDst = source.blendDst;\n this.blendEquation = source.blendEquation;\n this.blendSrcAlpha = source.blendSrcAlpha;\n this.blendDstAlpha = source.blendDstAlpha;\n this.blendEquationAlpha = source.blendEquationAlpha;\n this.depthFunc = source.depthFunc;\n this.depthTest = source.depthTest;\n this.depthWrite = source.depthWrite;\n this.stencilWriteMask = source.stencilWriteMask;\n this.stencilFunc = source.stencilFunc;\n this.stencilRef = source.stencilRef;\n this.stencilFuncMask = source.stencilFuncMask;\n this.stencilFail = source.stencilFail;\n this.stencilZFail = source.stencilZFail;\n this.stencilZPass = source.stencilZPass;\n this.stencilWrite = source.stencilWrite;\n var srcPlanes = source.clippingPlanes;\n var dstPlanes = null;\n if (srcPlanes !== null) {\n var n = srcPlanes.length;\n dstPlanes = new Array(n);\n for (var i = 0; i !== n; ++i) {\n dstPlanes[i] = srcPlanes[i].clone();\n }\n }\n this.clippingPlanes = dstPlanes;\n this.clipIntersection = source.clipIntersection;\n this.clipShadows = source.clipShadows;\n this.shadowSide = source.shadowSide;\n this.colorWrite = source.colorWrite;\n this.precision = source.precision;\n this.polygonOffset = source.polygonOffset;\n this.polygonOffsetFactor = source.polygonOffsetFactor;\n this.polygonOffsetUnits = source.polygonOffsetUnits;\n this.dithering = source.dithering;\n this.alphaTest = source.alphaTest;\n this.alphaToCoverage = source.alphaToCoverage;\n this.premultipliedAlpha = source.premultipliedAlpha;\n this.forceSinglePass = source.forceSinglePass;\n this.visible = source.visible;\n this.toneMapped = source.toneMapped;\n this.userData = JSON.parse(JSON.stringify(source.userData));\n return this;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.dispatchEvent({\n type: 'dispose'\n });\n }\n }, {\n key: \"needsUpdate\",\n set: function set(value) {\n if (value === true) this.version++;\n }\n }]);\n return Material;\n}(EventDispatcher);\nvar _colorKeywords = {\n 'aliceblue': 0xF0F8FF,\n 'antiquewhite': 0xFAEBD7,\n 'aqua': 0x00FFFF,\n 'aquamarine': 0x7FFFD4,\n 'azure': 0xF0FFFF,\n 'beige': 0xF5F5DC,\n 'bisque': 0xFFE4C4,\n 'black': 0x000000,\n 'blanchedalmond': 0xFFEBCD,\n 'blue': 0x0000FF,\n 'blueviolet': 0x8A2BE2,\n 'brown': 0xA52A2A,\n 'burlywood': 0xDEB887,\n 'cadetblue': 0x5F9EA0,\n 'chartreuse': 0x7FFF00,\n 'chocolate': 0xD2691E,\n 'coral': 0xFF7F50,\n 'cornflowerblue': 0x6495ED,\n 'cornsilk': 0xFFF8DC,\n 'crimson': 0xDC143C,\n 'cyan': 0x00FFFF,\n 'darkblue': 0x00008B,\n 'darkcyan': 0x008B8B,\n 'darkgoldenrod': 0xB8860B,\n 'darkgray': 0xA9A9A9,\n 'darkgreen': 0x006400,\n 'darkgrey': 0xA9A9A9,\n 'darkkhaki': 0xBDB76B,\n 'darkmagenta': 0x8B008B,\n 'darkolivegreen': 0x556B2F,\n 'darkorange': 0xFF8C00,\n 'darkorchid': 0x9932CC,\n 'darkred': 0x8B0000,\n 'darksalmon': 0xE9967A,\n 'darkseagreen': 0x8FBC8F,\n 'darkslateblue': 0x483D8B,\n 'darkslategray': 0x2F4F4F,\n 'darkslategrey': 0x2F4F4F,\n 'darkturquoise': 0x00CED1,\n 'darkviolet': 0x9400D3,\n 'deeppink': 0xFF1493,\n 'deepskyblue': 0x00BFFF,\n 'dimgray': 0x696969,\n 'dimgrey': 0x696969,\n 'dodgerblue': 0x1E90FF,\n 'firebrick': 0xB22222,\n 'floralwhite': 0xFFFAF0,\n 'forestgreen': 0x228B22,\n 'fuchsia': 0xFF00FF,\n 'gainsboro': 0xDCDCDC,\n 'ghostwhite': 0xF8F8FF,\n 'gold': 0xFFD700,\n 'goldenrod': 0xDAA520,\n 'gray': 0x808080,\n 'green': 0x008000,\n 'greenyellow': 0xADFF2F,\n 'grey': 0x808080,\n 'honeydew': 0xF0FFF0,\n 'hotpink': 0xFF69B4,\n 'indianred': 0xCD5C5C,\n 'indigo': 0x4B0082,\n 'ivory': 0xFFFFF0,\n 'khaki': 0xF0E68C,\n 'lavender': 0xE6E6FA,\n 'lavenderblush': 0xFFF0F5,\n 'lawngreen': 0x7CFC00,\n 'lemonchiffon': 0xFFFACD,\n 'lightblue': 0xADD8E6,\n 'lightcoral': 0xF08080,\n 'lightcyan': 0xE0FFFF,\n 'lightgoldenrodyellow': 0xFAFAD2,\n 'lightgray': 0xD3D3D3,\n 'lightgreen': 0x90EE90,\n 'lightgrey': 0xD3D3D3,\n 'lightpink': 0xFFB6C1,\n 'lightsalmon': 0xFFA07A,\n 'lightseagreen': 0x20B2AA,\n 'lightskyblue': 0x87CEFA,\n 'lightslategray': 0x778899,\n 'lightslategrey': 0x778899,\n 'lightsteelblue': 0xB0C4DE,\n 'lightyellow': 0xFFFFE0,\n 'lime': 0x00FF00,\n 'limegreen': 0x32CD32,\n 'linen': 0xFAF0E6,\n 'magenta': 0xFF00FF,\n 'maroon': 0x800000,\n 'mediumaquamarine': 0x66CDAA,\n 'mediumblue': 0x0000CD,\n 'mediumorchid': 0xBA55D3,\n 'mediumpurple': 0x9370DB,\n 'mediumseagreen': 0x3CB371,\n 'mediumslateblue': 0x7B68EE,\n 'mediumspringgreen': 0x00FA9A,\n 'mediumturquoise': 0x48D1CC,\n 'mediumvioletred': 0xC71585,\n 'midnightblue': 0x191970,\n 'mintcream': 0xF5FFFA,\n 'mistyrose': 0xFFE4E1,\n 'moccasin': 0xFFE4B5,\n 'navajowhite': 0xFFDEAD,\n 'navy': 0x000080,\n 'oldlace': 0xFDF5E6,\n 'olive': 0x808000,\n 'olivedrab': 0x6B8E23,\n 'orange': 0xFFA500,\n 'orangered': 0xFF4500,\n 'orchid': 0xDA70D6,\n 'palegoldenrod': 0xEEE8AA,\n 'palegreen': 0x98FB98,\n 'paleturquoise': 0xAFEEEE,\n 'palevioletred': 0xDB7093,\n 'papayawhip': 0xFFEFD5,\n 'peachpuff': 0xFFDAB9,\n 'peru': 0xCD853F,\n 'pink': 0xFFC0CB,\n 'plum': 0xDDA0DD,\n 'powderblue': 0xB0E0E6,\n 'purple': 0x800080,\n 'rebeccapurple': 0x663399,\n 'red': 0xFF0000,\n 'rosybrown': 0xBC8F8F,\n 'royalblue': 0x4169E1,\n 'saddlebrown': 0x8B4513,\n 'salmon': 0xFA8072,\n 'sandybrown': 0xF4A460,\n 'seagreen': 0x2E8B57,\n 'seashell': 0xFFF5EE,\n 'sienna': 0xA0522D,\n 'silver': 0xC0C0C0,\n 'skyblue': 0x87CEEB,\n 'slateblue': 0x6A5ACD,\n 'slategray': 0x708090,\n 'slategrey': 0x708090,\n 'snow': 0xFFFAFA,\n 'springgreen': 0x00FF7F,\n 'steelblue': 0x4682B4,\n 'tan': 0xD2B48C,\n 'teal': 0x008080,\n 'thistle': 0xD8BFD8,\n 'tomato': 0xFF6347,\n 'turquoise': 0x40E0D0,\n 'violet': 0xEE82EE,\n 'wheat': 0xF5DEB3,\n 'white': 0xFFFFFF,\n 'whitesmoke': 0xF5F5F5,\n 'yellow': 0xFFFF00,\n 'yellowgreen': 0x9ACD32\n};\nvar _hslA = {\n h: 0,\n s: 0,\n l: 0\n};\nvar _hslB = {\n h: 0,\n s: 0,\n l: 0\n};\nfunction hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * 6 * (2 / 3 - t);\n return p;\n}\nvar Color = /*#__PURE__*/function (_Symbol$iterator6) {\n function Color(r, g, b) {\n _classCallCheck(this, Color);\n this.isColor = true;\n this.r = 1;\n this.g = 1;\n this.b = 1;\n if (g === undefined && b === undefined) {\n // r is THREE.Color, hex or string\n return this.set(r);\n }\n return this.setRGB(r, g, b);\n }\n _createClass(Color, [{\n key: \"set\",\n value: function set(value) {\n if (value && value.isColor) {\n this.copy(value);\n } else if (typeof value === 'number') {\n this.setHex(value);\n } else if (typeof value === 'string') {\n this.setStyle(value);\n }\n return this;\n }\n }, {\n key: \"setScalar\",\n value: function setScalar(scalar) {\n this.r = scalar;\n this.g = scalar;\n this.b = scalar;\n return this;\n }\n }, {\n key: \"setHex\",\n value: function setHex(hex) {\n var colorSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SRGBColorSpace;\n hex = Math.floor(hex);\n this.r = (hex >> 16 & 255) / 255;\n this.g = (hex >> 8 & 255) / 255;\n this.b = (hex & 255) / 255;\n ColorManagement.toWorkingColorSpace(this, colorSpace);\n return this;\n }\n }, {\n key: \"setRGB\",\n value: function setRGB(r, g, b) {\n var colorSpace = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ColorManagement.workingColorSpace;\n this.r = r;\n this.g = g;\n this.b = b;\n ColorManagement.toWorkingColorSpace(this, colorSpace);\n return this;\n }\n }, {\n key: \"setHSL\",\n value: function setHSL(h, s, l) {\n var colorSpace = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ColorManagement.workingColorSpace;\n // h,s,l ranges are in 0.0 - 1.0\n h = euclideanModulo(h, 1);\n s = clamp(s, 0, 1);\n l = clamp(l, 0, 1);\n if (s === 0) {\n this.r = this.g = this.b = l;\n } else {\n var p = l <= 0.5 ? l * (1 + s) : l + s - l * s;\n var q = 2 * l - p;\n this.r = hue2rgb(q, p, h + 1 / 3);\n this.g = hue2rgb(q, p, h);\n this.b = hue2rgb(q, p, h - 1 / 3);\n }\n ColorManagement.toWorkingColorSpace(this, colorSpace);\n return this;\n }\n }, {\n key: \"setStyle\",\n value: function setStyle(style) {\n var colorSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SRGBColorSpace;\n function handleAlpha(string) {\n if (string === undefined) return;\n if (parseFloat(string) < 1) {\n console.warn('THREE.Color: Alpha component of ' + style + ' will be ignored.');\n }\n }\n var m;\n if (m = /^(\\w+)\\(([^\\)]*)\\)/.exec(style)) {\n // rgb / hsl\n\n var color;\n var name = m[1];\n var components = m[2];\n switch (name) {\n case 'rgb':\n case 'rgba':\n if (color = /^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(components)) {\n // rgb(255,0,0) rgba(255,0,0,0.5)\n this.r = Math.min(255, parseInt(color[1], 10)) / 255;\n this.g = Math.min(255, parseInt(color[2], 10)) / 255;\n this.b = Math.min(255, parseInt(color[3], 10)) / 255;\n ColorManagement.toWorkingColorSpace(this, colorSpace);\n handleAlpha(color[4]);\n return this;\n }\n if (color = /^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(components)) {\n // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5)\n this.r = Math.min(100, parseInt(color[1], 10)) / 100;\n this.g = Math.min(100, parseInt(color[2], 10)) / 100;\n this.b = Math.min(100, parseInt(color[3], 10)) / 100;\n ColorManagement.toWorkingColorSpace(this, colorSpace);\n handleAlpha(color[4]);\n return this;\n }\n break;\n case 'hsl':\n case 'hsla':\n if (color = /^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(components)) {\n // hsl(120,50%,50%) hsla(120,50%,50%,0.5)\n var h = parseFloat(color[1]) / 360;\n var s = parseFloat(color[2]) / 100;\n var l = parseFloat(color[3]) / 100;\n handleAlpha(color[4]);\n return this.setHSL(h, s, l, colorSpace);\n }\n break;\n default:\n console.warn('THREE.Color: Unknown color model ' + style);\n }\n } else if (m = /^\\#([A-Fa-f\\d]+)$/.exec(style)) {\n // hex color\n\n var hex = m[1];\n var size = hex.length;\n if (size === 3) {\n // #ff0\n return this.setRGB(parseInt(hex.charAt(0), 16) / 15, parseInt(hex.charAt(1), 16) / 15, parseInt(hex.charAt(2), 16) / 15, colorSpace);\n } else if (size === 6) {\n // #ff0000\n return this.setHex(parseInt(hex, 16), colorSpace);\n } else {\n console.warn('THREE.Color: Invalid hex color ' + style);\n }\n } else if (style && style.length > 0) {\n return this.setColorName(style, colorSpace);\n }\n return this;\n }\n }, {\n key: \"setColorName\",\n value: function setColorName(style) {\n var colorSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SRGBColorSpace;\n // color keywords\n var hex = _colorKeywords[style.toLowerCase()];\n if (hex !== undefined) {\n // red\n this.setHex(hex, colorSpace);\n } else {\n // unknown color\n console.warn('THREE.Color: Unknown color ' + style);\n }\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor(this.r, this.g, this.b);\n }\n }, {\n key: \"copy\",\n value: function copy(color) {\n this.r = color.r;\n this.g = color.g;\n this.b = color.b;\n return this;\n }\n }, {\n key: \"copySRGBToLinear\",\n value: function copySRGBToLinear(color) {\n this.r = SRGBToLinear(color.r);\n this.g = SRGBToLinear(color.g);\n this.b = SRGBToLinear(color.b);\n return this;\n }\n }, {\n key: \"copyLinearToSRGB\",\n value: function copyLinearToSRGB(color) {\n this.r = LinearToSRGB(color.r);\n this.g = LinearToSRGB(color.g);\n this.b = LinearToSRGB(color.b);\n return this;\n }\n }, {\n key: \"convertSRGBToLinear\",\n value: function convertSRGBToLinear() {\n this.copySRGBToLinear(this);\n return this;\n }\n }, {\n key: \"convertLinearToSRGB\",\n value: function convertLinearToSRGB() {\n this.copyLinearToSRGB(this);\n return this;\n }\n }, {\n key: \"getHex\",\n value: function getHex() {\n var colorSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SRGBColorSpace;\n ColorManagement.fromWorkingColorSpace(_color.copy(this), colorSpace);\n return clamp(_color.r * 255, 0, 255) << 16 ^ clamp(_color.g * 255, 0, 255) << 8 ^ clamp(_color.b * 255, 0, 255) << 0;\n }\n }, {\n key: \"getHexString\",\n value: function getHexString() {\n var colorSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SRGBColorSpace;\n return ('000000' + this.getHex(colorSpace).toString(16)).slice(-6);\n }\n }, {\n key: \"getHSL\",\n value: function getHSL(target) {\n var colorSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ColorManagement.workingColorSpace;\n // h,s,l ranges are in 0.0 - 1.0\n\n ColorManagement.fromWorkingColorSpace(_color.copy(this), colorSpace);\n var r = _color.r,\n g = _color.g,\n b = _color.b;\n var max = Math.max(r, g, b);\n var min = Math.min(r, g, b);\n var hue, saturation;\n var lightness = (min + max) / 2.0;\n if (min === max) {\n hue = 0;\n saturation = 0;\n } else {\n var delta = max - min;\n saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min);\n switch (max) {\n case r:\n hue = (g - b) / delta + (g < b ? 6 : 0);\n break;\n case g:\n hue = (b - r) / delta + 2;\n break;\n case b:\n hue = (r - g) / delta + 4;\n break;\n }\n hue /= 6;\n }\n target.h = hue;\n target.s = saturation;\n target.l = lightness;\n return target;\n }\n }, {\n key: \"getRGB\",\n value: function getRGB(target) {\n var colorSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ColorManagement.workingColorSpace;\n ColorManagement.fromWorkingColorSpace(_color.copy(this), colorSpace);\n target.r = _color.r;\n target.g = _color.g;\n target.b = _color.b;\n return target;\n }\n }, {\n key: \"getStyle\",\n value: function getStyle() {\n var colorSpace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SRGBColorSpace;\n ColorManagement.fromWorkingColorSpace(_color.copy(this), colorSpace);\n var r = _color.r,\n g = _color.g,\n b = _color.b;\n if (colorSpace !== SRGBColorSpace) {\n // Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).\n return \"color(\".concat(colorSpace, \" \").concat(r.toFixed(3), \" \").concat(g.toFixed(3), \" \").concat(b.toFixed(3), \")\");\n }\n return \"rgb(\".concat(r * 255 | 0, \",\").concat(g * 255 | 0, \",\").concat(b * 255 | 0, \")\");\n }\n }, {\n key: \"offsetHSL\",\n value: function offsetHSL(h, s, l) {\n this.getHSL(_hslA);\n _hslA.h += h;\n _hslA.s += s;\n _hslA.l += l;\n this.setHSL(_hslA.h, _hslA.s, _hslA.l);\n return this;\n }\n }, {\n key: \"add\",\n value: function add(color) {\n this.r += color.r;\n this.g += color.g;\n this.b += color.b;\n return this;\n }\n }, {\n key: \"addColors\",\n value: function addColors(color1, color2) {\n this.r = color1.r + color2.r;\n this.g = color1.g + color2.g;\n this.b = color1.b + color2.b;\n return this;\n }\n }, {\n key: \"addScalar\",\n value: function addScalar(s) {\n this.r += s;\n this.g += s;\n this.b += s;\n return this;\n }\n }, {\n key: \"sub\",\n value: function sub(color) {\n this.r = Math.max(0, this.r - color.r);\n this.g = Math.max(0, this.g - color.g);\n this.b = Math.max(0, this.b - color.b);\n return this;\n }\n }, {\n key: \"multiply\",\n value: function multiply(color) {\n this.r *= color.r;\n this.g *= color.g;\n this.b *= color.b;\n return this;\n }\n }, {\n key: \"multiplyScalar\",\n value: function multiplyScalar(s) {\n this.r *= s;\n this.g *= s;\n this.b *= s;\n return this;\n }\n }, {\n key: \"lerp\",\n value: function lerp(color, alpha) {\n this.r += (color.r - this.r) * alpha;\n this.g += (color.g - this.g) * alpha;\n this.b += (color.b - this.b) * alpha;\n return this;\n }\n }, {\n key: \"lerpColors\",\n value: function lerpColors(color1, color2, alpha) {\n this.r = color1.r + (color2.r - color1.r) * alpha;\n this.g = color1.g + (color2.g - color1.g) * alpha;\n this.b = color1.b + (color2.b - color1.b) * alpha;\n return this;\n }\n }, {\n key: \"lerpHSL\",\n value: function lerpHSL(color, alpha) {\n this.getHSL(_hslA);\n color.getHSL(_hslB);\n var h = lerp(_hslA.h, _hslB.h, alpha);\n var s = lerp(_hslA.s, _hslB.s, alpha);\n var l = lerp(_hslA.l, _hslB.l, alpha);\n this.setHSL(h, s, l);\n return this;\n }\n }, {\n key: \"setFromVector3\",\n value: function setFromVector3(v) {\n this.r = v.x;\n this.g = v.y;\n this.b = v.z;\n return this;\n }\n }, {\n key: \"applyMatrix3\",\n value: function applyMatrix3(m) {\n var r = this.r,\n g = this.g,\n b = this.b;\n var e = m.elements;\n this.r = e[0] * r + e[3] * g + e[6] * b;\n this.g = e[1] * r + e[4] * g + e[7] * b;\n this.b = e[2] * r + e[5] * g + e[8] * b;\n return this;\n }\n }, {\n key: \"equals\",\n value: function equals(c) {\n return c.r === this.r && c.g === this.g && c.b === this.b;\n }\n }, {\n key: \"fromArray\",\n value: function fromArray(array) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n this.r = array[offset];\n this.g = array[offset + 1];\n this.b = array[offset + 2];\n return this;\n }\n }, {\n key: \"toArray\",\n value: function toArray() {\n var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n array[offset] = this.r;\n array[offset + 1] = this.g;\n array[offset + 2] = this.b;\n return array;\n }\n }, {\n key: \"fromBufferAttribute\",\n value: function fromBufferAttribute(attribute, index) {\n this.r = attribute.getX(index);\n this.g = attribute.getY(index);\n this.b = attribute.getZ(index);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n return this.getHex();\n }\n }, {\n key: _Symbol$iterator6,\n value: /*#__PURE__*/_regeneratorRuntime().mark(function value() {\n return _regeneratorRuntime().wrap(function value$(_context7) {\n while (1) switch (_context7.prev = _context7.next) {\n case 0:\n _context7.next = 2;\n return this.r;\n case 2:\n _context7.next = 4;\n return this.g;\n case 4:\n _context7.next = 6;\n return this.b;\n case 6:\n case \"end\":\n return _context7.stop();\n }\n }, value, this);\n })\n }]);\n return Color;\n}(Symbol.iterator);\nvar _color = /*@__PURE__*/new Color();\nColor.NAMES = _colorKeywords;\nvar MeshBasicMaterial = /*#__PURE__*/function (_Material) {\n _inherits(MeshBasicMaterial, _Material);\n var _super10 = _createSuper(MeshBasicMaterial);\n function MeshBasicMaterial(parameters) {\n var _this11;\n _classCallCheck(this, MeshBasicMaterial);\n _this11 = _super10.call(this);\n _this11.isMeshBasicMaterial = true;\n _this11.type = 'MeshBasicMaterial';\n _this11.color = new Color(0xffffff); // emissive\n\n _this11.map = null;\n _this11.lightMap = null;\n _this11.lightMapIntensity = 1.0;\n _this11.aoMap = null;\n _this11.aoMapIntensity = 1.0;\n _this11.specularMap = null;\n _this11.alphaMap = null;\n _this11.envMap = null;\n _this11.combine = MultiplyOperation;\n _this11.reflectivity = 1;\n _this11.refractionRatio = 0.98;\n _this11.wireframe = false;\n _this11.wireframeLinewidth = 1;\n _this11.wireframeLinecap = 'round';\n _this11.wireframeLinejoin = 'round';\n _this11.fog = true;\n _this11.setValues(parameters);\n return _this11;\n }\n _createClass(MeshBasicMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(MeshBasicMaterial.prototype), \"copy\", this).call(this, source);\n this.color.copy(source.color);\n this.map = source.map;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.specularMap = source.specularMap;\n this.alphaMap = source.alphaMap;\n this.envMap = source.envMap;\n this.combine = source.combine;\n this.reflectivity = source.reflectivity;\n this.refractionRatio = source.refractionRatio;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.fog = source.fog;\n return this;\n }\n }]);\n return MeshBasicMaterial;\n}(Material); // Fast Half Float Conversions, http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf\nvar _tables = /*@__PURE__*/_generateTables();\nfunction _generateTables() {\n // float32 to float16 helpers\n\n var buffer = new ArrayBuffer(4);\n var floatView = new Float32Array(buffer);\n var uint32View = new Uint32Array(buffer);\n var baseTable = new Uint32Array(512);\n var shiftTable = new Uint32Array(512);\n for (var i = 0; i < 256; ++i) {\n var e = i - 127;\n\n // very small number (0, -0)\n\n if (e < -27) {\n baseTable[i] = 0x0000;\n baseTable[i | 0x100] = 0x8000;\n shiftTable[i] = 24;\n shiftTable[i | 0x100] = 24;\n\n // small number (denorm)\n } else if (e < -14) {\n baseTable[i] = 0x0400 >> -e - 14;\n baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;\n shiftTable[i] = -e - 1;\n shiftTable[i | 0x100] = -e - 1;\n\n // normal number\n } else if (e <= 15) {\n baseTable[i] = e + 15 << 10;\n baseTable[i | 0x100] = e + 15 << 10 | 0x8000;\n shiftTable[i] = 13;\n shiftTable[i | 0x100] = 13;\n\n // large number (Infinity, -Infinity)\n } else if (e < 128) {\n baseTable[i] = 0x7c00;\n baseTable[i | 0x100] = 0xfc00;\n shiftTable[i] = 24;\n shiftTable[i | 0x100] = 24;\n\n // stay (NaN, Infinity, -Infinity)\n } else {\n baseTable[i] = 0x7c00;\n baseTable[i | 0x100] = 0xfc00;\n shiftTable[i] = 13;\n shiftTable[i | 0x100] = 13;\n }\n }\n\n // float16 to float32 helpers\n\n var mantissaTable = new Uint32Array(2048);\n var exponentTable = new Uint32Array(64);\n var offsetTable = new Uint32Array(64);\n for (var _i6 = 1; _i6 < 1024; ++_i6) {\n var m = _i6 << 13; // zero pad mantissa bits\n var _e = 0; // zero exponent\n\n // normalized\n while ((m & 0x00800000) === 0) {\n m <<= 1;\n _e -= 0x00800000; // decrement exponent\n }\n\n m &= ~0x00800000; // clear leading 1 bit\n _e += 0x38800000; // adjust bias\n\n mantissaTable[_i6] = m | _e;\n }\n for (var _i7 = 1024; _i7 < 2048; ++_i7) {\n mantissaTable[_i7] = 0x38000000 + (_i7 - 1024 << 13);\n }\n for (var _i8 = 1; _i8 < 31; ++_i8) {\n exponentTable[_i8] = _i8 << 23;\n }\n exponentTable[31] = 0x47800000;\n exponentTable[32] = 0x80000000;\n for (var _i9 = 33; _i9 < 63; ++_i9) {\n exponentTable[_i9] = 0x80000000 + (_i9 - 32 << 23);\n }\n exponentTable[63] = 0xc7800000;\n for (var _i10 = 1; _i10 < 64; ++_i10) {\n if (_i10 !== 32) {\n offsetTable[_i10] = 1024;\n }\n }\n return {\n floatView: floatView,\n uint32View: uint32View,\n baseTable: baseTable,\n shiftTable: shiftTable,\n mantissaTable: mantissaTable,\n exponentTable: exponentTable,\n offsetTable: offsetTable\n };\n}\n\n// float32 to float16\n\nfunction toHalfFloat(val) {\n if (Math.abs(val) > 65504) console.warn('THREE.DataUtils.toHalfFloat(): Value out of range.');\n val = clamp(val, -65504, 65504);\n _tables.floatView[0] = val;\n var f = _tables.uint32View[0];\n var e = f >> 23 & 0x1ff;\n return _tables.baseTable[e] + ((f & 0x007fffff) >> _tables.shiftTable[e]);\n}\n\n// float16 to float32\n\nfunction fromHalfFloat(val) {\n var m = val >> 10;\n _tables.uint32View[0] = _tables.mantissaTable[_tables.offsetTable[m] + (val & 0x3ff)] + _tables.exponentTable[m];\n return _tables.floatView[0];\n}\nvar DataUtils = {\n toHalfFloat: toHalfFloat,\n fromHalfFloat: fromHalfFloat\n};\nvar _vector$8 = /*@__PURE__*/new Vector3();\nvar _vector2$1 = /*@__PURE__*/new Vector2();\nvar BufferAttribute = /*#__PURE__*/function () {\n function BufferAttribute(array, itemSize) {\n var normalized = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n _classCallCheck(this, BufferAttribute);\n if (Array.isArray(array)) {\n throw new TypeError('THREE.BufferAttribute: array should be a Typed Array.');\n }\n this.isBufferAttribute = true;\n this.name = '';\n this.array = array;\n this.itemSize = itemSize;\n this.count = array !== undefined ? array.length / itemSize : 0;\n this.normalized = normalized;\n this.usage = StaticDrawUsage;\n this.updateRange = {\n offset: 0,\n count: -1\n };\n this.version = 0;\n }\n _createClass(BufferAttribute, [{\n key: \"onUploadCallback\",\n value: function onUploadCallback() {}\n }, {\n key: \"needsUpdate\",\n set: function set(value) {\n if (value === true) this.version++;\n }\n }, {\n key: \"setUsage\",\n value: function setUsage(value) {\n this.usage = value;\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n this.name = source.name;\n this.array = new source.array.constructor(source.array);\n this.itemSize = source.itemSize;\n this.count = source.count;\n this.normalized = source.normalized;\n this.usage = source.usage;\n return this;\n }\n }, {\n key: \"copyAt\",\n value: function copyAt(index1, attribute, index2) {\n index1 *= this.itemSize;\n index2 *= attribute.itemSize;\n for (var i = 0, l = this.itemSize; i < l; i++) {\n this.array[index1 + i] = attribute.array[index2 + i];\n }\n return this;\n }\n }, {\n key: \"copyArray\",\n value: function copyArray(array) {\n this.array.set(array);\n return this;\n }\n }, {\n key: \"applyMatrix3\",\n value: function applyMatrix3(m) {\n if (this.itemSize === 2) {\n for (var i = 0, l = this.count; i < l; i++) {\n _vector2$1.fromBufferAttribute(this, i);\n _vector2$1.applyMatrix3(m);\n this.setXY(i, _vector2$1.x, _vector2$1.y);\n }\n } else if (this.itemSize === 3) {\n for (var _i11 = 0, _l3 = this.count; _i11 < _l3; _i11++) {\n _vector$8.fromBufferAttribute(this, _i11);\n _vector$8.applyMatrix3(m);\n this.setXYZ(_i11, _vector$8.x, _vector$8.y, _vector$8.z);\n }\n }\n return this;\n }\n }, {\n key: \"applyMatrix4\",\n value: function applyMatrix4(m) {\n for (var i = 0, l = this.count; i < l; i++) {\n _vector$8.fromBufferAttribute(this, i);\n _vector$8.applyMatrix4(m);\n this.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z);\n }\n return this;\n }\n }, {\n key: \"applyNormalMatrix\",\n value: function applyNormalMatrix(m) {\n for (var i = 0, l = this.count; i < l; i++) {\n _vector$8.fromBufferAttribute(this, i);\n _vector$8.applyNormalMatrix(m);\n this.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z);\n }\n return this;\n }\n }, {\n key: \"transformDirection\",\n value: function transformDirection(m) {\n for (var i = 0, l = this.count; i < l; i++) {\n _vector$8.fromBufferAttribute(this, i);\n _vector$8.transformDirection(m);\n this.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z);\n }\n return this;\n }\n }, {\n key: \"set\",\n value: function set(value) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n // Matching BufferAttribute constructor, do not normalize the array.\n this.array.set(value, offset);\n return this;\n }\n }, {\n key: \"getX\",\n value: function getX(index) {\n var x = this.array[index * this.itemSize];\n if (this.normalized) x = denormalize(x, this.array);\n return x;\n }\n }, {\n key: \"setX\",\n value: function setX(index, x) {\n if (this.normalized) x = normalize(x, this.array);\n this.array[index * this.itemSize] = x;\n return this;\n }\n }, {\n key: \"getY\",\n value: function getY(index) {\n var y = this.array[index * this.itemSize + 1];\n if (this.normalized) y = denormalize(y, this.array);\n return y;\n }\n }, {\n key: \"setY\",\n value: function setY(index, y) {\n if (this.normalized) y = normalize(y, this.array);\n this.array[index * this.itemSize + 1] = y;\n return this;\n }\n }, {\n key: \"getZ\",\n value: function getZ(index) {\n var z = this.array[index * this.itemSize + 2];\n if (this.normalized) z = denormalize(z, this.array);\n return z;\n }\n }, {\n key: \"setZ\",\n value: function setZ(index, z) {\n if (this.normalized) z = normalize(z, this.array);\n this.array[index * this.itemSize + 2] = z;\n return this;\n }\n }, {\n key: \"getW\",\n value: function getW(index) {\n var w = this.array[index * this.itemSize + 3];\n if (this.normalized) w = denormalize(w, this.array);\n return w;\n }\n }, {\n key: \"setW\",\n value: function setW(index, w) {\n if (this.normalized) w = normalize(w, this.array);\n this.array[index * this.itemSize + 3] = w;\n return this;\n }\n }, {\n key: \"setXY\",\n value: function setXY(index, x, y) {\n index *= this.itemSize;\n if (this.normalized) {\n x = normalize(x, this.array);\n y = normalize(y, this.array);\n }\n this.array[index + 0] = x;\n this.array[index + 1] = y;\n return this;\n }\n }, {\n key: \"setXYZ\",\n value: function setXYZ(index, x, y, z) {\n index *= this.itemSize;\n if (this.normalized) {\n x = normalize(x, this.array);\n y = normalize(y, this.array);\n z = normalize(z, this.array);\n }\n this.array[index + 0] = x;\n this.array[index + 1] = y;\n this.array[index + 2] = z;\n return this;\n }\n }, {\n key: \"setXYZW\",\n value: function setXYZW(index, x, y, z, w) {\n index *= this.itemSize;\n if (this.normalized) {\n x = normalize(x, this.array);\n y = normalize(y, this.array);\n z = normalize(z, this.array);\n w = normalize(w, this.array);\n }\n this.array[index + 0] = x;\n this.array[index + 1] = y;\n this.array[index + 2] = z;\n this.array[index + 3] = w;\n return this;\n }\n }, {\n key: \"onUpload\",\n value: function onUpload(callback) {\n this.onUploadCallback = callback;\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor(this.array, this.itemSize).copy(this);\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = {\n itemSize: this.itemSize,\n type: this.array.constructor.name,\n array: Array.from(this.array),\n normalized: this.normalized\n };\n if (this.name !== '') data.name = this.name;\n if (this.usage !== StaticDrawUsage) data.usage = this.usage;\n if (this.updateRange.offset !== 0 || this.updateRange.count !== -1) data.updateRange = this.updateRange;\n return data;\n }\n }, {\n key: \"copyColorsArray\",\n value: function copyColorsArray() {\n // @deprecated, r144\n\n console.error('THREE.BufferAttribute: copyColorsArray() was removed in r144.');\n }\n }, {\n key: \"copyVector2sArray\",\n value: function copyVector2sArray() {\n // @deprecated, r144\n\n console.error('THREE.BufferAttribute: copyVector2sArray() was removed in r144.');\n }\n }, {\n key: \"copyVector3sArray\",\n value: function copyVector3sArray() {\n // @deprecated, r144\n\n console.error('THREE.BufferAttribute: copyVector3sArray() was removed in r144.');\n }\n }, {\n key: \"copyVector4sArray\",\n value: function copyVector4sArray() {\n // @deprecated, r144\n\n console.error('THREE.BufferAttribute: copyVector4sArray() was removed in r144.');\n }\n }]);\n return BufferAttribute;\n}(); //\nvar Int8BufferAttribute = /*#__PURE__*/function (_BufferAttribute) {\n _inherits(Int8BufferAttribute, _BufferAttribute);\n var _super11 = _createSuper(Int8BufferAttribute);\n function Int8BufferAttribute(array, itemSize, normalized) {\n _classCallCheck(this, Int8BufferAttribute);\n return _super11.call(this, new Int8Array(array), itemSize, normalized);\n }\n return _createClass(Int8BufferAttribute);\n}(BufferAttribute);\nvar Uint8BufferAttribute = /*#__PURE__*/function (_BufferAttribute2) {\n _inherits(Uint8BufferAttribute, _BufferAttribute2);\n var _super12 = _createSuper(Uint8BufferAttribute);\n function Uint8BufferAttribute(array, itemSize, normalized) {\n _classCallCheck(this, Uint8BufferAttribute);\n return _super12.call(this, new Uint8Array(array), itemSize, normalized);\n }\n return _createClass(Uint8BufferAttribute);\n}(BufferAttribute);\nvar Uint8ClampedBufferAttribute = /*#__PURE__*/function (_BufferAttribute3) {\n _inherits(Uint8ClampedBufferAttribute, _BufferAttribute3);\n var _super13 = _createSuper(Uint8ClampedBufferAttribute);\n function Uint8ClampedBufferAttribute(array, itemSize, normalized) {\n _classCallCheck(this, Uint8ClampedBufferAttribute);\n return _super13.call(this, new Uint8ClampedArray(array), itemSize, normalized);\n }\n return _createClass(Uint8ClampedBufferAttribute);\n}(BufferAttribute);\nvar Int16BufferAttribute = /*#__PURE__*/function (_BufferAttribute4) {\n _inherits(Int16BufferAttribute, _BufferAttribute4);\n var _super14 = _createSuper(Int16BufferAttribute);\n function Int16BufferAttribute(array, itemSize, normalized) {\n _classCallCheck(this, Int16BufferAttribute);\n return _super14.call(this, new Int16Array(array), itemSize, normalized);\n }\n return _createClass(Int16BufferAttribute);\n}(BufferAttribute);\nvar Uint16BufferAttribute = /*#__PURE__*/function (_BufferAttribute5) {\n _inherits(Uint16BufferAttribute, _BufferAttribute5);\n var _super15 = _createSuper(Uint16BufferAttribute);\n function Uint16BufferAttribute(array, itemSize, normalized) {\n _classCallCheck(this, Uint16BufferAttribute);\n return _super15.call(this, new Uint16Array(array), itemSize, normalized);\n }\n return _createClass(Uint16BufferAttribute);\n}(BufferAttribute);\nvar Int32BufferAttribute = /*#__PURE__*/function (_BufferAttribute6) {\n _inherits(Int32BufferAttribute, _BufferAttribute6);\n var _super16 = _createSuper(Int32BufferAttribute);\n function Int32BufferAttribute(array, itemSize, normalized) {\n _classCallCheck(this, Int32BufferAttribute);\n return _super16.call(this, new Int32Array(array), itemSize, normalized);\n }\n return _createClass(Int32BufferAttribute);\n}(BufferAttribute);\nvar Uint32BufferAttribute = /*#__PURE__*/function (_BufferAttribute7) {\n _inherits(Uint32BufferAttribute, _BufferAttribute7);\n var _super17 = _createSuper(Uint32BufferAttribute);\n function Uint32BufferAttribute(array, itemSize, normalized) {\n _classCallCheck(this, Uint32BufferAttribute);\n return _super17.call(this, new Uint32Array(array), itemSize, normalized);\n }\n return _createClass(Uint32BufferAttribute);\n}(BufferAttribute);\nvar Float16BufferAttribute = /*#__PURE__*/function (_BufferAttribute8) {\n _inherits(Float16BufferAttribute, _BufferAttribute8);\n var _super18 = _createSuper(Float16BufferAttribute);\n function Float16BufferAttribute(array, itemSize, normalized) {\n var _this12;\n _classCallCheck(this, Float16BufferAttribute);\n _this12 = _super18.call(this, new Uint16Array(array), itemSize, normalized);\n _this12.isFloat16BufferAttribute = true;\n return _this12;\n }\n _createClass(Float16BufferAttribute, [{\n key: \"getX\",\n value: function getX(index) {\n var x = fromHalfFloat(this.array[index * this.itemSize]);\n if (this.normalized) x = denormalize(x, this.array);\n return x;\n }\n }, {\n key: \"setX\",\n value: function setX(index, x) {\n if (this.normalized) x = normalize(x, this.array);\n this.array[index * this.itemSize] = toHalfFloat(x);\n return this;\n }\n }, {\n key: \"getY\",\n value: function getY(index) {\n var y = fromHalfFloat(this.array[index * this.itemSize + 1]);\n if (this.normalized) y = denormalize(y, this.array);\n return y;\n }\n }, {\n key: \"setY\",\n value: function setY(index, y) {\n if (this.normalized) y = normalize(y, this.array);\n this.array[index * this.itemSize + 1] = toHalfFloat(y);\n return this;\n }\n }, {\n key: \"getZ\",\n value: function getZ(index) {\n var z = fromHalfFloat(this.array[index * this.itemSize + 2]);\n if (this.normalized) z = denormalize(z, this.array);\n return z;\n }\n }, {\n key: \"setZ\",\n value: function setZ(index, z) {\n if (this.normalized) z = normalize(z, this.array);\n this.array[index * this.itemSize + 2] = toHalfFloat(z);\n return this;\n }\n }, {\n key: \"getW\",\n value: function getW(index) {\n var w = fromHalfFloat(this.array[index * this.itemSize + 3]);\n if (this.normalized) w = denormalize(w, this.array);\n return w;\n }\n }, {\n key: \"setW\",\n value: function setW(index, w) {\n if (this.normalized) w = normalize(w, this.array);\n this.array[index * this.itemSize + 3] = toHalfFloat(w);\n return this;\n }\n }, {\n key: \"setXY\",\n value: function setXY(index, x, y) {\n index *= this.itemSize;\n if (this.normalized) {\n x = normalize(x, this.array);\n y = normalize(y, this.array);\n }\n this.array[index + 0] = toHalfFloat(x);\n this.array[index + 1] = toHalfFloat(y);\n return this;\n }\n }, {\n key: \"setXYZ\",\n value: function setXYZ(index, x, y, z) {\n index *= this.itemSize;\n if (this.normalized) {\n x = normalize(x, this.array);\n y = normalize(y, this.array);\n z = normalize(z, this.array);\n }\n this.array[index + 0] = toHalfFloat(x);\n this.array[index + 1] = toHalfFloat(y);\n this.array[index + 2] = toHalfFloat(z);\n return this;\n }\n }, {\n key: \"setXYZW\",\n value: function setXYZW(index, x, y, z, w) {\n index *= this.itemSize;\n if (this.normalized) {\n x = normalize(x, this.array);\n y = normalize(y, this.array);\n z = normalize(z, this.array);\n w = normalize(w, this.array);\n }\n this.array[index + 0] = toHalfFloat(x);\n this.array[index + 1] = toHalfFloat(y);\n this.array[index + 2] = toHalfFloat(z);\n this.array[index + 3] = toHalfFloat(w);\n return this;\n }\n }]);\n return Float16BufferAttribute;\n}(BufferAttribute);\nvar Float32BufferAttribute = /*#__PURE__*/function (_BufferAttribute9) {\n _inherits(Float32BufferAttribute, _BufferAttribute9);\n var _super19 = _createSuper(Float32BufferAttribute);\n function Float32BufferAttribute(array, itemSize, normalized) {\n _classCallCheck(this, Float32BufferAttribute);\n return _super19.call(this, new Float32Array(array), itemSize, normalized);\n }\n return _createClass(Float32BufferAttribute);\n}(BufferAttribute);\nvar Float64BufferAttribute = /*#__PURE__*/function (_BufferAttribute10) {\n _inherits(Float64BufferAttribute, _BufferAttribute10);\n var _super20 = _createSuper(Float64BufferAttribute);\n function Float64BufferAttribute(array, itemSize, normalized) {\n _classCallCheck(this, Float64BufferAttribute);\n return _super20.call(this, new Float64Array(array), itemSize, normalized);\n }\n return _createClass(Float64BufferAttribute);\n}(BufferAttribute);\nvar _id$1 = 0;\nvar _m1 = /*@__PURE__*/new Matrix4();\nvar _obj = /*@__PURE__*/new Object3D();\nvar _offset = /*@__PURE__*/new Vector3();\nvar _box$1 = /*@__PURE__*/new Box3();\nvar _boxMorphTargets = /*@__PURE__*/new Box3();\nvar _vector$7 = /*@__PURE__*/new Vector3();\nvar BufferGeometry = /*#__PURE__*/function (_EventDispatcher5) {\n _inherits(BufferGeometry, _EventDispatcher5);\n var _super21 = _createSuper(BufferGeometry);\n function BufferGeometry() {\n var _this13;\n _classCallCheck(this, BufferGeometry);\n _this13 = _super21.call(this);\n _this13.isBufferGeometry = true;\n Object.defineProperty(_assertThisInitialized(_this13), 'id', {\n value: _id$1++\n });\n _this13.uuid = generateUUID();\n _this13.name = '';\n _this13.type = 'BufferGeometry';\n _this13.index = null;\n _this13.attributes = {};\n _this13.morphAttributes = {};\n _this13.morphTargetsRelative = false;\n _this13.groups = [];\n _this13.boundingBox = null;\n _this13.boundingSphere = null;\n _this13.drawRange = {\n start: 0,\n count: Infinity\n };\n _this13.userData = {};\n return _this13;\n }\n _createClass(BufferGeometry, [{\n key: \"getIndex\",\n value: function getIndex() {\n return this.index;\n }\n }, {\n key: \"setIndex\",\n value: function setIndex(index) {\n if (Array.isArray(index)) {\n this.index = new (arrayNeedsUint32(index) ? Uint32BufferAttribute : Uint16BufferAttribute)(index, 1);\n } else {\n this.index = index;\n }\n return this;\n }\n }, {\n key: \"getAttribute\",\n value: function getAttribute(name) {\n return this.attributes[name];\n }\n }, {\n key: \"setAttribute\",\n value: function setAttribute(name, attribute) {\n this.attributes[name] = attribute;\n return this;\n }\n }, {\n key: \"deleteAttribute\",\n value: function deleteAttribute(name) {\n delete this.attributes[name];\n return this;\n }\n }, {\n key: \"hasAttribute\",\n value: function hasAttribute(name) {\n return this.attributes[name] !== undefined;\n }\n }, {\n key: \"addGroup\",\n value: function addGroup(start, count) {\n var materialIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n this.groups.push({\n start: start,\n count: count,\n materialIndex: materialIndex\n });\n }\n }, {\n key: \"clearGroups\",\n value: function clearGroups() {\n this.groups = [];\n }\n }, {\n key: \"setDrawRange\",\n value: function setDrawRange(start, count) {\n this.drawRange.start = start;\n this.drawRange.count = count;\n }\n }, {\n key: \"applyMatrix4\",\n value: function applyMatrix4(matrix) {\n var position = this.attributes.position;\n if (position !== undefined) {\n position.applyMatrix4(matrix);\n position.needsUpdate = true;\n }\n var normal = this.attributes.normal;\n if (normal !== undefined) {\n var normalMatrix = new Matrix3().getNormalMatrix(matrix);\n normal.applyNormalMatrix(normalMatrix);\n normal.needsUpdate = true;\n }\n var tangent = this.attributes.tangent;\n if (tangent !== undefined) {\n tangent.transformDirection(matrix);\n tangent.needsUpdate = true;\n }\n if (this.boundingBox !== null) {\n this.computeBoundingBox();\n }\n if (this.boundingSphere !== null) {\n this.computeBoundingSphere();\n }\n return this;\n }\n }, {\n key: \"applyQuaternion\",\n value: function applyQuaternion(q) {\n _m1.makeRotationFromQuaternion(q);\n this.applyMatrix4(_m1);\n return this;\n }\n }, {\n key: \"rotateX\",\n value: function rotateX(angle) {\n // rotate geometry around world x-axis\n\n _m1.makeRotationX(angle);\n this.applyMatrix4(_m1);\n return this;\n }\n }, {\n key: \"rotateY\",\n value: function rotateY(angle) {\n // rotate geometry around world y-axis\n\n _m1.makeRotationY(angle);\n this.applyMatrix4(_m1);\n return this;\n }\n }, {\n key: \"rotateZ\",\n value: function rotateZ(angle) {\n // rotate geometry around world z-axis\n\n _m1.makeRotationZ(angle);\n this.applyMatrix4(_m1);\n return this;\n }\n }, {\n key: \"translate\",\n value: function translate(x, y, z) {\n // translate geometry\n\n _m1.makeTranslation(x, y, z);\n this.applyMatrix4(_m1);\n return this;\n }\n }, {\n key: \"scale\",\n value: function scale(x, y, z) {\n // scale geometry\n\n _m1.makeScale(x, y, z);\n this.applyMatrix4(_m1);\n return this;\n }\n }, {\n key: \"lookAt\",\n value: function lookAt(vector) {\n _obj.lookAt(vector);\n _obj.updateMatrix();\n this.applyMatrix4(_obj.matrix);\n return this;\n }\n }, {\n key: \"center\",\n value: function center() {\n this.computeBoundingBox();\n this.boundingBox.getCenter(_offset).negate();\n this.translate(_offset.x, _offset.y, _offset.z);\n return this;\n }\n }, {\n key: \"setFromPoints\",\n value: function setFromPoints(points) {\n var position = [];\n for (var i = 0, l = points.length; i < l; i++) {\n var point = points[i];\n position.push(point.x, point.y, point.z || 0);\n }\n this.setAttribute('position', new Float32BufferAttribute(position, 3));\n return this;\n }\n }, {\n key: \"computeBoundingBox\",\n value: function computeBoundingBox() {\n if (this.boundingBox === null) {\n this.boundingBox = new Box3();\n }\n var position = this.attributes.position;\n var morphAttributesPosition = this.morphAttributes.position;\n if (position && position.isGLBufferAttribute) {\n console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set \"mesh.frustumCulled\" to \"false\".', this);\n this.boundingBox.set(new Vector3(-Infinity, -Infinity, -Infinity), new Vector3(+Infinity, +Infinity, +Infinity));\n return;\n }\n if (position !== undefined) {\n this.boundingBox.setFromBufferAttribute(position);\n\n // process morph attributes if present\n\n if (morphAttributesPosition) {\n for (var i = 0, il = morphAttributesPosition.length; i < il; i++) {\n var morphAttribute = morphAttributesPosition[i];\n _box$1.setFromBufferAttribute(morphAttribute);\n if (this.morphTargetsRelative) {\n _vector$7.addVectors(this.boundingBox.min, _box$1.min);\n this.boundingBox.expandByPoint(_vector$7);\n _vector$7.addVectors(this.boundingBox.max, _box$1.max);\n this.boundingBox.expandByPoint(_vector$7);\n } else {\n this.boundingBox.expandByPoint(_box$1.min);\n this.boundingBox.expandByPoint(_box$1.max);\n }\n }\n }\n } else {\n this.boundingBox.makeEmpty();\n }\n if (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) {\n console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \"position\" attribute is likely to have NaN values.', this);\n }\n }\n }, {\n key: \"computeBoundingSphere\",\n value: function computeBoundingSphere() {\n if (this.boundingSphere === null) {\n this.boundingSphere = new Sphere();\n }\n var position = this.attributes.position;\n var morphAttributesPosition = this.morphAttributes.position;\n if (position && position.isGLBufferAttribute) {\n console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set \"mesh.frustumCulled\" to \"false\".', this);\n this.boundingSphere.set(new Vector3(), Infinity);\n return;\n }\n if (position) {\n // first, find the center of the bounding sphere\n\n var center = this.boundingSphere.center;\n _box$1.setFromBufferAttribute(position);\n\n // process morph attributes if present\n\n if (morphAttributesPosition) {\n for (var i = 0, il = morphAttributesPosition.length; i < il; i++) {\n var morphAttribute = morphAttributesPosition[i];\n _boxMorphTargets.setFromBufferAttribute(morphAttribute);\n if (this.morphTargetsRelative) {\n _vector$7.addVectors(_box$1.min, _boxMorphTargets.min);\n _box$1.expandByPoint(_vector$7);\n _vector$7.addVectors(_box$1.max, _boxMorphTargets.max);\n _box$1.expandByPoint(_vector$7);\n } else {\n _box$1.expandByPoint(_boxMorphTargets.min);\n _box$1.expandByPoint(_boxMorphTargets.max);\n }\n }\n }\n _box$1.getCenter(center);\n\n // second, try to find a boundingSphere with a radius smaller than the\n // boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n\n var maxRadiusSq = 0;\n for (var _i12 = 0, _il = position.count; _i12 < _il; _i12++) {\n _vector$7.fromBufferAttribute(position, _i12);\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$7));\n }\n\n // process morph attributes if present\n\n if (morphAttributesPosition) {\n for (var _i13 = 0, _il2 = morphAttributesPosition.length; _i13 < _il2; _i13++) {\n var _morphAttribute = morphAttributesPosition[_i13];\n var morphTargetsRelative = this.morphTargetsRelative;\n for (var j = 0, jl = _morphAttribute.count; j < jl; j++) {\n _vector$7.fromBufferAttribute(_morphAttribute, j);\n if (morphTargetsRelative) {\n _offset.fromBufferAttribute(position, j);\n _vector$7.add(_offset);\n }\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$7));\n }\n }\n }\n this.boundingSphere.radius = Math.sqrt(maxRadiusSq);\n if (isNaN(this.boundingSphere.radius)) {\n console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \"position\" attribute is likely to have NaN values.', this);\n }\n }\n }\n }, {\n key: \"computeTangents\",\n value: function computeTangents() {\n var index = this.index;\n var attributes = this.attributes;\n\n // based on http://www.terathon.com/code/tangent.html\n // (per vertex tangents)\n\n if (index === null || attributes.position === undefined || attributes.normal === undefined || attributes.uv === undefined) {\n console.error('THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)');\n return;\n }\n var indices = index.array;\n var positions = attributes.position.array;\n var normals = attributes.normal.array;\n var uvs = attributes.uv.array;\n var nVertices = positions.length / 3;\n if (this.hasAttribute('tangent') === false) {\n this.setAttribute('tangent', new BufferAttribute(new Float32Array(4 * nVertices), 4));\n }\n var tangents = this.getAttribute('tangent').array;\n var tan1 = [],\n tan2 = [];\n for (var i = 0; i < nVertices; i++) {\n tan1[i] = new Vector3();\n tan2[i] = new Vector3();\n }\n var vA = new Vector3(),\n vB = new Vector3(),\n vC = new Vector3(),\n uvA = new Vector2(),\n uvB = new Vector2(),\n uvC = new Vector2(),\n sdir = new Vector3(),\n tdir = new Vector3();\n function handleTriangle(a, b, c) {\n vA.fromArray(positions, a * 3);\n vB.fromArray(positions, b * 3);\n vC.fromArray(positions, c * 3);\n uvA.fromArray(uvs, a * 2);\n uvB.fromArray(uvs, b * 2);\n uvC.fromArray(uvs, c * 2);\n vB.sub(vA);\n vC.sub(vA);\n uvB.sub(uvA);\n uvC.sub(uvA);\n var r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y);\n\n // silently ignore degenerate uv triangles having coincident or colinear vertices\n\n if (!isFinite(r)) return;\n sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r);\n tdir.copy(vC).multiplyScalar(uvB.x).addScaledVector(vB, -uvC.x).multiplyScalar(r);\n tan1[a].add(sdir);\n tan1[b].add(sdir);\n tan1[c].add(sdir);\n tan2[a].add(tdir);\n tan2[b].add(tdir);\n tan2[c].add(tdir);\n }\n var groups = this.groups;\n if (groups.length === 0) {\n groups = [{\n start: 0,\n count: indices.length\n }];\n }\n for (var _i14 = 0, il = groups.length; _i14 < il; ++_i14) {\n var group = groups[_i14];\n var start = group.start;\n var count = group.count;\n for (var j = start, jl = start + count; j < jl; j += 3) {\n handleTriangle(indices[j + 0], indices[j + 1], indices[j + 2]);\n }\n }\n var tmp = new Vector3(),\n tmp2 = new Vector3();\n var n = new Vector3(),\n n2 = new Vector3();\n function handleVertex(v) {\n n.fromArray(normals, v * 3);\n n2.copy(n);\n var t = tan1[v];\n\n // Gram-Schmidt orthogonalize\n\n tmp.copy(t);\n tmp.sub(n.multiplyScalar(n.dot(t))).normalize();\n\n // Calculate handedness\n\n tmp2.crossVectors(n2, t);\n var test = tmp2.dot(tan2[v]);\n var w = test < 0.0 ? -1.0 : 1.0;\n tangents[v * 4] = tmp.x;\n tangents[v * 4 + 1] = tmp.y;\n tangents[v * 4 + 2] = tmp.z;\n tangents[v * 4 + 3] = w;\n }\n for (var _i15 = 0, _il3 = groups.length; _i15 < _il3; ++_i15) {\n var _group = groups[_i15];\n var _start2 = _group.start;\n var _count = _group.count;\n for (var _j = _start2, _jl = _start2 + _count; _j < _jl; _j += 3) {\n handleVertex(indices[_j + 0]);\n handleVertex(indices[_j + 1]);\n handleVertex(indices[_j + 2]);\n }\n }\n }\n }, {\n key: \"computeVertexNormals\",\n value: function computeVertexNormals() {\n var index = this.index;\n var positionAttribute = this.getAttribute('position');\n if (positionAttribute !== undefined) {\n var normalAttribute = this.getAttribute('normal');\n if (normalAttribute === undefined) {\n normalAttribute = new BufferAttribute(new Float32Array(positionAttribute.count * 3), 3);\n this.setAttribute('normal', normalAttribute);\n } else {\n // reset existing normals to zero\n\n for (var i = 0, il = normalAttribute.count; i < il; i++) {\n normalAttribute.setXYZ(i, 0, 0, 0);\n }\n }\n var pA = new Vector3(),\n pB = new Vector3(),\n pC = new Vector3();\n var nA = new Vector3(),\n nB = new Vector3(),\n nC = new Vector3();\n var cb = new Vector3(),\n ab = new Vector3();\n\n // indexed elements\n\n if (index) {\n for (var _i16 = 0, _il4 = index.count; _i16 < _il4; _i16 += 3) {\n var vA = index.getX(_i16 + 0);\n var vB = index.getX(_i16 + 1);\n var vC = index.getX(_i16 + 2);\n pA.fromBufferAttribute(positionAttribute, vA);\n pB.fromBufferAttribute(positionAttribute, vB);\n pC.fromBufferAttribute(positionAttribute, vC);\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n nA.fromBufferAttribute(normalAttribute, vA);\n nB.fromBufferAttribute(normalAttribute, vB);\n nC.fromBufferAttribute(normalAttribute, vC);\n nA.add(cb);\n nB.add(cb);\n nC.add(cb);\n normalAttribute.setXYZ(vA, nA.x, nA.y, nA.z);\n normalAttribute.setXYZ(vB, nB.x, nB.y, nB.z);\n normalAttribute.setXYZ(vC, nC.x, nC.y, nC.z);\n }\n } else {\n // non-indexed elements (unconnected triangle soup)\n\n for (var _i17 = 0, _il5 = positionAttribute.count; _i17 < _il5; _i17 += 3) {\n pA.fromBufferAttribute(positionAttribute, _i17 + 0);\n pB.fromBufferAttribute(positionAttribute, _i17 + 1);\n pC.fromBufferAttribute(positionAttribute, _i17 + 2);\n cb.subVectors(pC, pB);\n ab.subVectors(pA, pB);\n cb.cross(ab);\n normalAttribute.setXYZ(_i17 + 0, cb.x, cb.y, cb.z);\n normalAttribute.setXYZ(_i17 + 1, cb.x, cb.y, cb.z);\n normalAttribute.setXYZ(_i17 + 2, cb.x, cb.y, cb.z);\n }\n }\n this.normalizeNormals();\n normalAttribute.needsUpdate = true;\n }\n }\n }, {\n key: \"merge\",\n value: function merge() {\n // @deprecated, r144\n\n console.error('THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeGeometries() instead.');\n return this;\n }\n }, {\n key: \"normalizeNormals\",\n value: function normalizeNormals() {\n var normals = this.attributes.normal;\n for (var i = 0, il = normals.count; i < il; i++) {\n _vector$7.fromBufferAttribute(normals, i);\n _vector$7.normalize();\n normals.setXYZ(i, _vector$7.x, _vector$7.y, _vector$7.z);\n }\n }\n }, {\n key: \"toNonIndexed\",\n value: function toNonIndexed() {\n function convertBufferAttribute(attribute, indices) {\n var array = attribute.array;\n var itemSize = attribute.itemSize;\n var normalized = attribute.normalized;\n var array2 = new array.constructor(indices.length * itemSize);\n var index = 0,\n index2 = 0;\n for (var i = 0, l = indices.length; i < l; i++) {\n if (attribute.isInterleavedBufferAttribute) {\n index = indices[i] * attribute.data.stride + attribute.offset;\n } else {\n index = indices[i] * itemSize;\n }\n for (var j = 0; j < itemSize; j++) {\n array2[index2++] = array[index++];\n }\n }\n return new BufferAttribute(array2, itemSize, normalized);\n }\n\n //\n\n if (this.index === null) {\n console.warn('THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.');\n return this;\n }\n var geometry2 = new BufferGeometry();\n var indices = this.index.array;\n var attributes = this.attributes;\n\n // attributes\n\n for (var name in attributes) {\n var attribute = attributes[name];\n var newAttribute = convertBufferAttribute(attribute, indices);\n geometry2.setAttribute(name, newAttribute);\n }\n\n // morph attributes\n\n var morphAttributes = this.morphAttributes;\n for (var _name in morphAttributes) {\n var morphArray = [];\n var morphAttribute = morphAttributes[_name]; // morphAttribute: array of Float32BufferAttributes\n\n for (var i = 0, il = morphAttribute.length; i < il; i++) {\n var _attribute = morphAttribute[i];\n var _newAttribute = convertBufferAttribute(_attribute, indices);\n morphArray.push(_newAttribute);\n }\n geometry2.morphAttributes[_name] = morphArray;\n }\n geometry2.morphTargetsRelative = this.morphTargetsRelative;\n\n // groups\n\n var groups = this.groups;\n for (var _i18 = 0, l = groups.length; _i18 < l; _i18++) {\n var group = groups[_i18];\n geometry2.addGroup(group.start, group.count, group.materialIndex);\n }\n return geometry2;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = {\n metadata: {\n version: 4.5,\n type: 'BufferGeometry',\n generator: 'BufferGeometry.toJSON'\n }\n };\n\n // standard BufferGeometry serialization\n\n data.uuid = this.uuid;\n data.type = this.type;\n if (this.name !== '') data.name = this.name;\n if (Object.keys(this.userData).length > 0) data.userData = this.userData;\n if (this.parameters !== undefined) {\n var parameters = this.parameters;\n for (var key in parameters) {\n if (parameters[key] !== undefined) data[key] = parameters[key];\n }\n return data;\n }\n\n // for simplicity the code assumes attributes are not shared across geometries, see #15811\n\n data.data = {\n attributes: {}\n };\n var index = this.index;\n if (index !== null) {\n data.data.index = {\n type: index.array.constructor.name,\n array: Array.prototype.slice.call(index.array)\n };\n }\n var attributes = this.attributes;\n for (var _key in attributes) {\n var attribute = attributes[_key];\n data.data.attributes[_key] = attribute.toJSON(data.data);\n }\n var morphAttributes = {};\n var hasMorphAttributes = false;\n for (var _key2 in this.morphAttributes) {\n var attributeArray = this.morphAttributes[_key2];\n var array = [];\n for (var i = 0, il = attributeArray.length; i < il; i++) {\n var _attribute2 = attributeArray[i];\n array.push(_attribute2.toJSON(data.data));\n }\n if (array.length > 0) {\n morphAttributes[_key2] = array;\n hasMorphAttributes = true;\n }\n }\n if (hasMorphAttributes) {\n data.data.morphAttributes = morphAttributes;\n data.data.morphTargetsRelative = this.morphTargetsRelative;\n }\n var groups = this.groups;\n if (groups.length > 0) {\n data.data.groups = JSON.parse(JSON.stringify(groups));\n }\n var boundingSphere = this.boundingSphere;\n if (boundingSphere !== null) {\n data.data.boundingSphere = {\n center: boundingSphere.center.toArray(),\n radius: boundingSphere.radius\n };\n }\n return data;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n // reset\n\n this.index = null;\n this.attributes = {};\n this.morphAttributes = {};\n this.groups = [];\n this.boundingBox = null;\n this.boundingSphere = null;\n\n // used for storing cloned, shared data\n\n var data = {};\n\n // name\n\n this.name = source.name;\n\n // index\n\n var index = source.index;\n if (index !== null) {\n this.setIndex(index.clone(data));\n }\n\n // attributes\n\n var attributes = source.attributes;\n for (var name in attributes) {\n var attribute = attributes[name];\n this.setAttribute(name, attribute.clone(data));\n }\n\n // morph attributes\n\n var morphAttributes = source.morphAttributes;\n for (var _name2 in morphAttributes) {\n var array = [];\n var morphAttribute = morphAttributes[_name2]; // morphAttribute: array of Float32BufferAttributes\n\n for (var i = 0, l = morphAttribute.length; i < l; i++) {\n array.push(morphAttribute[i].clone(data));\n }\n this.morphAttributes[_name2] = array;\n }\n this.morphTargetsRelative = source.morphTargetsRelative;\n\n // groups\n\n var groups = source.groups;\n for (var _i19 = 0, _l4 = groups.length; _i19 < _l4; _i19++) {\n var group = groups[_i19];\n this.addGroup(group.start, group.count, group.materialIndex);\n }\n\n // bounding box\n\n var boundingBox = source.boundingBox;\n if (boundingBox !== null) {\n this.boundingBox = boundingBox.clone();\n }\n\n // bounding sphere\n\n var boundingSphere = source.boundingSphere;\n if (boundingSphere !== null) {\n this.boundingSphere = boundingSphere.clone();\n }\n\n // draw range\n\n this.drawRange.start = source.drawRange.start;\n this.drawRange.count = source.drawRange.count;\n\n // user data\n\n this.userData = source.userData;\n return this;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.dispatchEvent({\n type: 'dispose'\n });\n }\n }]);\n return BufferGeometry;\n}(EventDispatcher);\nvar _inverseMatrix$2 = /*@__PURE__*/new Matrix4();\nvar _ray$2 = /*@__PURE__*/new Ray();\nvar _sphere$4 = /*@__PURE__*/new Sphere();\nvar _sphereHitAt = /*@__PURE__*/new Vector3();\nvar _vA$1 = /*@__PURE__*/new Vector3();\nvar _vB$1 = /*@__PURE__*/new Vector3();\nvar _vC$1 = /*@__PURE__*/new Vector3();\nvar _tempA = /*@__PURE__*/new Vector3();\nvar _morphA = /*@__PURE__*/new Vector3();\nvar _uvA$1 = /*@__PURE__*/new Vector2();\nvar _uvB$1 = /*@__PURE__*/new Vector2();\nvar _uvC$1 = /*@__PURE__*/new Vector2();\nvar _normalA = /*@__PURE__*/new Vector3();\nvar _normalB = /*@__PURE__*/new Vector3();\nvar _normalC = /*@__PURE__*/new Vector3();\nvar _intersectionPoint = /*@__PURE__*/new Vector3();\nvar _intersectionPointWorld = /*@__PURE__*/new Vector3();\nvar Mesh = /*#__PURE__*/function (_Object3D) {\n _inherits(Mesh, _Object3D);\n var _super22 = _createSuper(Mesh);\n function Mesh() {\n var _this14;\n var geometry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new BufferGeometry();\n var material = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new MeshBasicMaterial();\n _classCallCheck(this, Mesh);\n _this14 = _super22.call(this);\n _this14.isMesh = true;\n _this14.type = 'Mesh';\n _this14.geometry = geometry;\n _this14.material = material;\n _this14.updateMorphTargets();\n return _this14;\n }\n _createClass(Mesh, [{\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(Mesh.prototype), \"copy\", this).call(this, source, recursive);\n if (source.morphTargetInfluences !== undefined) {\n this.morphTargetInfluences = source.morphTargetInfluences.slice();\n }\n if (source.morphTargetDictionary !== undefined) {\n this.morphTargetDictionary = Object.assign({}, source.morphTargetDictionary);\n }\n this.material = source.material;\n this.geometry = source.geometry;\n return this;\n }\n }, {\n key: \"updateMorphTargets\",\n value: function updateMorphTargets() {\n var geometry = this.geometry;\n var morphAttributes = geometry.morphAttributes;\n var keys = Object.keys(morphAttributes);\n if (keys.length > 0) {\n var morphAttribute = morphAttributes[keys[0]];\n if (morphAttribute !== undefined) {\n this.morphTargetInfluences = [];\n this.morphTargetDictionary = {};\n for (var m = 0, ml = morphAttribute.length; m < ml; m++) {\n var name = morphAttribute[m].name || String(m);\n this.morphTargetInfluences.push(0);\n this.morphTargetDictionary[name] = m;\n }\n }\n }\n }\n }, {\n key: \"getVertexPosition\",\n value: function getVertexPosition(index, target) {\n var geometry = this.geometry;\n var position = geometry.attributes.position;\n var morphPosition = geometry.morphAttributes.position;\n var morphTargetsRelative = geometry.morphTargetsRelative;\n target.fromBufferAttribute(position, index);\n var morphInfluences = this.morphTargetInfluences;\n if (morphPosition && morphInfluences) {\n _morphA.set(0, 0, 0);\n for (var i = 0, il = morphPosition.length; i < il; i++) {\n var influence = morphInfluences[i];\n var morphAttribute = morphPosition[i];\n if (influence === 0) continue;\n _tempA.fromBufferAttribute(morphAttribute, index);\n if (morphTargetsRelative) {\n _morphA.addScaledVector(_tempA, influence);\n } else {\n _morphA.addScaledVector(_tempA.sub(target), influence);\n }\n }\n target.add(_morphA);\n }\n if (this.isSkinnedMesh) {\n this.applyBoneTransform(index, target);\n }\n return target;\n }\n }, {\n key: \"raycast\",\n value: function raycast(raycaster, intersects) {\n var geometry = this.geometry;\n var material = this.material;\n var matrixWorld = this.matrixWorld;\n if (material === undefined) return;\n\n // Checking boundingSphere distance to ray\n\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n _sphere$4.copy(geometry.boundingSphere);\n _sphere$4.applyMatrix4(matrixWorld);\n _ray$2.copy(raycaster.ray).recast(raycaster.near);\n if (_sphere$4.containsPoint(_ray$2.origin) === false) {\n if (_ray$2.intersectSphere(_sphere$4, _sphereHitAt) === null) return;\n if (_ray$2.origin.distanceToSquared(_sphereHitAt) > Math.pow(raycaster.far - raycaster.near, 2)) return;\n }\n\n //\n\n _inverseMatrix$2.copy(matrixWorld).invert();\n _ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2);\n\n // Check boundingBox before continuing\n\n if (geometry.boundingBox !== null) {\n if (_ray$2.intersectsBox(geometry.boundingBox) === false) return;\n }\n var intersection;\n var index = geometry.index;\n var position = geometry.attributes.position;\n var uv = geometry.attributes.uv;\n var uv2 = geometry.attributes.uv2;\n var normal = geometry.attributes.normal;\n var groups = geometry.groups;\n var drawRange = geometry.drawRange;\n if (index !== null) {\n // indexed buffer geometry\n\n if (Array.isArray(material)) {\n for (var i = 0, il = groups.length; i < il; i++) {\n var group = groups[i];\n var groupMaterial = material[group.materialIndex];\n var start = Math.max(group.start, drawRange.start);\n var end = Math.min(index.count, Math.min(group.start + group.count, drawRange.start + drawRange.count));\n for (var j = start, jl = end; j < jl; j += 3) {\n var a = index.getX(j);\n var b = index.getX(j + 1);\n var c = index.getX(j + 2);\n intersection = checkGeometryIntersection(this, groupMaterial, raycaster, _ray$2, uv, uv2, normal, a, b, c);\n if (intersection) {\n intersection.faceIndex = Math.floor(j / 3); // triangle number in indexed buffer semantics\n intersection.face.materialIndex = group.materialIndex;\n intersects.push(intersection);\n }\n }\n }\n } else {\n var _start3 = Math.max(0, drawRange.start);\n var _end2 = Math.min(index.count, drawRange.start + drawRange.count);\n for (var _i20 = _start3, _il6 = _end2; _i20 < _il6; _i20 += 3) {\n var _a = index.getX(_i20);\n var _b = index.getX(_i20 + 1);\n var _c = index.getX(_i20 + 2);\n intersection = checkGeometryIntersection(this, material, raycaster, _ray$2, uv, uv2, normal, _a, _b, _c);\n if (intersection) {\n intersection.faceIndex = Math.floor(_i20 / 3); // triangle number in indexed buffer semantics\n intersects.push(intersection);\n }\n }\n }\n } else if (position !== undefined) {\n // non-indexed buffer geometry\n\n if (Array.isArray(material)) {\n for (var _i21 = 0, _il7 = groups.length; _i21 < _il7; _i21++) {\n var _group2 = groups[_i21];\n var _groupMaterial = material[_group2.materialIndex];\n var _start4 = Math.max(_group2.start, drawRange.start);\n var _end3 = Math.min(position.count, Math.min(_group2.start + _group2.count, drawRange.start + drawRange.count));\n for (var _j2 = _start4, _jl2 = _end3; _j2 < _jl2; _j2 += 3) {\n var _a2 = _j2;\n var _b2 = _j2 + 1;\n var _c2 = _j2 + 2;\n intersection = checkGeometryIntersection(this, _groupMaterial, raycaster, _ray$2, uv, uv2, normal, _a2, _b2, _c2);\n if (intersection) {\n intersection.faceIndex = Math.floor(_j2 / 3); // triangle number in non-indexed buffer semantics\n intersection.face.materialIndex = _group2.materialIndex;\n intersects.push(intersection);\n }\n }\n }\n } else {\n var _start5 = Math.max(0, drawRange.start);\n var _end4 = Math.min(position.count, drawRange.start + drawRange.count);\n for (var _i22 = _start5, _il8 = _end4; _i22 < _il8; _i22 += 3) {\n var _a3 = _i22;\n var _b3 = _i22 + 1;\n var _c3 = _i22 + 2;\n intersection = checkGeometryIntersection(this, material, raycaster, _ray$2, uv, uv2, normal, _a3, _b3, _c3);\n if (intersection) {\n intersection.faceIndex = Math.floor(_i22 / 3); // triangle number in non-indexed buffer semantics\n intersects.push(intersection);\n }\n }\n }\n }\n }\n }]);\n return Mesh;\n}(Object3D);\nfunction checkIntersection(object, material, raycaster, ray, pA, pB, pC, point) {\n var intersect;\n if (material.side === BackSide) {\n intersect = ray.intersectTriangle(pC, pB, pA, true, point);\n } else {\n intersect = ray.intersectTriangle(pA, pB, pC, material.side === FrontSide, point);\n }\n if (intersect === null) return null;\n _intersectionPointWorld.copy(point);\n _intersectionPointWorld.applyMatrix4(object.matrixWorld);\n var distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld);\n if (distance < raycaster.near || distance > raycaster.far) return null;\n return {\n distance: distance,\n point: _intersectionPointWorld.clone(),\n object: object\n };\n}\nfunction checkGeometryIntersection(object, material, raycaster, ray, uv, uv2, normal, a, b, c) {\n object.getVertexPosition(a, _vA$1);\n object.getVertexPosition(b, _vB$1);\n object.getVertexPosition(c, _vC$1);\n var intersection = checkIntersection(object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint);\n if (intersection) {\n if (uv) {\n _uvA$1.fromBufferAttribute(uv, a);\n _uvB$1.fromBufferAttribute(uv, b);\n _uvC$1.fromBufferAttribute(uv, c);\n intersection.uv = Triangle.getInterpolation(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2());\n }\n if (uv2) {\n _uvA$1.fromBufferAttribute(uv2, a);\n _uvB$1.fromBufferAttribute(uv2, b);\n _uvC$1.fromBufferAttribute(uv2, c);\n intersection.uv2 = Triangle.getInterpolation(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2());\n }\n if (normal) {\n _normalA.fromBufferAttribute(normal, a);\n _normalB.fromBufferAttribute(normal, b);\n _normalC.fromBufferAttribute(normal, c);\n intersection.normal = Triangle.getInterpolation(_intersectionPoint, _vA$1, _vB$1, _vC$1, _normalA, _normalB, _normalC, new Vector3());\n if (intersection.normal.dot(ray.direction) > 0) {\n intersection.normal.multiplyScalar(-1);\n }\n }\n var face = {\n a: a,\n b: b,\n c: c,\n normal: new Vector3(),\n materialIndex: 0\n };\n Triangle.getNormal(_vA$1, _vB$1, _vC$1, face.normal);\n intersection.face = face;\n }\n return intersection;\n}\nvar BoxGeometry = /*#__PURE__*/function (_BufferGeometry) {\n _inherits(BoxGeometry, _BufferGeometry);\n var _super23 = _createSuper(BoxGeometry);\n function BoxGeometry() {\n var _this15;\n var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var widthSegments = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n var heightSegments = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;\n var depthSegments = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;\n _classCallCheck(this, BoxGeometry);\n _this15 = _super23.call(this);\n _this15.type = 'BoxGeometry';\n _this15.parameters = {\n width: width,\n height: height,\n depth: depth,\n widthSegments: widthSegments,\n heightSegments: heightSegments,\n depthSegments: depthSegments\n };\n var scope = _assertThisInitialized(_this15);\n\n // segments\n\n widthSegments = Math.floor(widthSegments);\n heightSegments = Math.floor(heightSegments);\n depthSegments = Math.floor(depthSegments);\n\n // buffers\n\n var indices = [];\n var vertices = [];\n var normals = [];\n var uvs = [];\n\n // helper variables\n\n var numberOfVertices = 0;\n var groupStart = 0;\n\n // build each side of the box geometry\n\n buildPlane('z', 'y', 'x', -1, -1, depth, height, width, depthSegments, heightSegments, 0); // px\n buildPlane('z', 'y', 'x', 1, -1, depth, height, -width, depthSegments, heightSegments, 1); // nx\n buildPlane('x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2); // py\n buildPlane('x', 'z', 'y', 1, -1, width, depth, -height, widthSegments, depthSegments, 3); // ny\n buildPlane('x', 'y', 'z', 1, -1, width, height, depth, widthSegments, heightSegments, 4); // pz\n buildPlane('x', 'y', 'z', -1, -1, width, height, -depth, widthSegments, heightSegments, 5); // nz\n\n // build geometry\n\n _this15.setIndex(indices);\n _this15.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n _this15.setAttribute('normal', new Float32BufferAttribute(normals, 3));\n _this15.setAttribute('uv', new Float32BufferAttribute(uvs, 2));\n function buildPlane(u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex) {\n var segmentWidth = width / gridX;\n var segmentHeight = height / gridY;\n var widthHalf = width / 2;\n var heightHalf = height / 2;\n var depthHalf = depth / 2;\n var gridX1 = gridX + 1;\n var gridY1 = gridY + 1;\n var vertexCounter = 0;\n var groupCount = 0;\n var vector = new Vector3();\n\n // generate vertices, normals and uvs\n\n for (var iy = 0; iy < gridY1; iy++) {\n var y = iy * segmentHeight - heightHalf;\n for (var ix = 0; ix < gridX1; ix++) {\n var x = ix * segmentWidth - widthHalf;\n\n // set values to correct vector component\n\n vector[u] = x * udir;\n vector[v] = y * vdir;\n vector[w] = depthHalf;\n\n // now apply vector to vertex buffer\n\n vertices.push(vector.x, vector.y, vector.z);\n\n // set values to correct vector component\n\n vector[u] = 0;\n vector[v] = 0;\n vector[w] = depth > 0 ? 1 : -1;\n\n // now apply vector to normal buffer\n\n normals.push(vector.x, vector.y, vector.z);\n\n // uvs\n\n uvs.push(ix / gridX);\n uvs.push(1 - iy / gridY);\n\n // counters\n\n vertexCounter += 1;\n }\n }\n\n // indices\n\n // 1. you need three indices to draw a single face\n // 2. a single segment consists of two faces\n // 3. so we need to generate six (2*3) indices per segment\n\n for (var _iy = 0; _iy < gridY; _iy++) {\n for (var _ix = 0; _ix < gridX; _ix++) {\n var a = numberOfVertices + _ix + gridX1 * _iy;\n var b = numberOfVertices + _ix + gridX1 * (_iy + 1);\n var c = numberOfVertices + (_ix + 1) + gridX1 * (_iy + 1);\n var d = numberOfVertices + (_ix + 1) + gridX1 * _iy;\n\n // faces\n\n indices.push(a, b, d);\n indices.push(b, c, d);\n\n // increase counter\n\n groupCount += 6;\n }\n }\n\n // add a group to the geometry. this will ensure multi material support\n\n scope.addGroup(groupStart, groupCount, materialIndex);\n\n // calculate new start value for groups\n\n groupStart += groupCount;\n\n // update total number of vertices\n\n numberOfVertices += vertexCounter;\n }\n return _this15;\n }\n _createClass(BoxGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(BoxGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new BoxGeometry(data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments);\n }\n }]);\n return BoxGeometry;\n}(BufferGeometry);\n/**\n * Uniform Utilities\n */\nfunction cloneUniforms(src) {\n var dst = {};\n for (var u in src) {\n dst[u] = {};\n for (var p in src[u]) {\n var property = src[u][p];\n if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) {\n if (property.isRenderTargetTexture) {\n console.warn('UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().');\n dst[u][p] = null;\n } else {\n dst[u][p] = property.clone();\n }\n } else if (Array.isArray(property)) {\n dst[u][p] = property.slice();\n } else {\n dst[u][p] = property;\n }\n }\n }\n return dst;\n}\nfunction mergeUniforms(uniforms) {\n var merged = {};\n for (var u = 0; u < uniforms.length; u++) {\n var _tmp = cloneUniforms(uniforms[u]);\n for (var p in _tmp) {\n merged[p] = _tmp[p];\n }\n }\n return merged;\n}\nfunction cloneUniformsGroups(src) {\n var dst = [];\n for (var u = 0; u < src.length; u++) {\n dst.push(src[u].clone());\n }\n return dst;\n}\nfunction getUnlitUniformColorSpace(renderer) {\n if (renderer.getRenderTarget() === null) {\n // https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398\n return renderer.outputEncoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;\n }\n return LinearSRGBColorSpace;\n}\n\n// Legacy\n\nvar UniformsUtils = {\n clone: cloneUniforms,\n merge: mergeUniforms\n};\nvar default_vertex = \"void main() {\\n\\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\\n}\";\nvar default_fragment = \"void main() {\\n\\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\\n}\";\nvar ShaderMaterial = /*#__PURE__*/function (_Material2) {\n _inherits(ShaderMaterial, _Material2);\n var _super24 = _createSuper(ShaderMaterial);\n function ShaderMaterial(parameters) {\n var _this16;\n _classCallCheck(this, ShaderMaterial);\n _this16 = _super24.call(this);\n _this16.isShaderMaterial = true;\n _this16.type = 'ShaderMaterial';\n _this16.defines = {};\n _this16.uniforms = {};\n _this16.uniformsGroups = [];\n _this16.vertexShader = default_vertex;\n _this16.fragmentShader = default_fragment;\n _this16.linewidth = 1;\n _this16.wireframe = false;\n _this16.wireframeLinewidth = 1;\n _this16.fog = false; // set to use scene fog\n _this16.lights = false; // set to use scene lights\n _this16.clipping = false; // set to use user-defined clipping planes\n\n _this16.forceSinglePass = true;\n _this16.extensions = {\n derivatives: false,\n // set to use derivatives\n fragDepth: false,\n // set to use fragment depth values\n drawBuffers: false,\n // set to use draw buffers\n shaderTextureLOD: false // set to use shader texture LOD\n };\n\n // When rendered geometry doesn't include these attributes but the material does,\n // use these default values in WebGL. This avoids errors when buffer data is missing.\n _this16.defaultAttributeValues = {\n 'color': [1, 1, 1],\n 'uv': [0, 0],\n 'uv2': [0, 0]\n };\n _this16.index0AttributeName = undefined;\n _this16.uniformsNeedUpdate = false;\n _this16.glslVersion = null;\n if (parameters !== undefined) {\n _this16.setValues(parameters);\n }\n return _this16;\n }\n _createClass(ShaderMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(ShaderMaterial.prototype), \"copy\", this).call(this, source);\n this.fragmentShader = source.fragmentShader;\n this.vertexShader = source.vertexShader;\n this.uniforms = cloneUniforms(source.uniforms);\n this.uniformsGroups = cloneUniformsGroups(source.uniformsGroups);\n this.defines = Object.assign({}, source.defines);\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.fog = source.fog;\n this.lights = source.lights;\n this.clipping = source.clipping;\n this.extensions = Object.assign({}, source.extensions);\n this.glslVersion = source.glslVersion;\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(meta) {\n var data = _get(_getPrototypeOf(ShaderMaterial.prototype), \"toJSON\", this).call(this, meta);\n data.glslVersion = this.glslVersion;\n data.uniforms = {};\n for (var name in this.uniforms) {\n var uniform = this.uniforms[name];\n var _value = uniform.value;\n if (_value && _value.isTexture) {\n data.uniforms[name] = {\n type: 't',\n value: _value.toJSON(meta).uuid\n };\n } else if (_value && _value.isColor) {\n data.uniforms[name] = {\n type: 'c',\n value: _value.getHex()\n };\n } else if (_value && _value.isVector2) {\n data.uniforms[name] = {\n type: 'v2',\n value: _value.toArray()\n };\n } else if (_value && _value.isVector3) {\n data.uniforms[name] = {\n type: 'v3',\n value: _value.toArray()\n };\n } else if (_value && _value.isVector4) {\n data.uniforms[name] = {\n type: 'v4',\n value: _value.toArray()\n };\n } else if (_value && _value.isMatrix3) {\n data.uniforms[name] = {\n type: 'm3',\n value: _value.toArray()\n };\n } else if (_value && _value.isMatrix4) {\n data.uniforms[name] = {\n type: 'm4',\n value: _value.toArray()\n };\n } else {\n data.uniforms[name] = {\n value: _value\n };\n\n // note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far\n }\n }\n\n if (Object.keys(this.defines).length > 0) data.defines = this.defines;\n data.vertexShader = this.vertexShader;\n data.fragmentShader = this.fragmentShader;\n var extensions = {};\n for (var key in this.extensions) {\n if (this.extensions[key] === true) extensions[key] = true;\n }\n if (Object.keys(extensions).length > 0) data.extensions = extensions;\n return data;\n }\n }]);\n return ShaderMaterial;\n}(Material);\nvar Camera = /*#__PURE__*/function (_Object3D2) {\n _inherits(Camera, _Object3D2);\n var _super25 = _createSuper(Camera);\n function Camera() {\n var _this17;\n _classCallCheck(this, Camera);\n _this17 = _super25.call(this);\n _this17.isCamera = true;\n _this17.type = 'Camera';\n _this17.matrixWorldInverse = new Matrix4();\n _this17.projectionMatrix = new Matrix4();\n _this17.projectionMatrixInverse = new Matrix4();\n return _this17;\n }\n _createClass(Camera, [{\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(Camera.prototype), \"copy\", this).call(this, source, recursive);\n this.matrixWorldInverse.copy(source.matrixWorldInverse);\n this.projectionMatrix.copy(source.projectionMatrix);\n this.projectionMatrixInverse.copy(source.projectionMatrixInverse);\n return this;\n }\n }, {\n key: \"getWorldDirection\",\n value: function getWorldDirection(target) {\n this.updateWorldMatrix(true, false);\n var e = this.matrixWorld.elements;\n return target.set(-e[8], -e[9], -e[10]).normalize();\n }\n }, {\n key: \"updateMatrixWorld\",\n value: function updateMatrixWorld(force) {\n _get(_getPrototypeOf(Camera.prototype), \"updateMatrixWorld\", this).call(this, force);\n this.matrixWorldInverse.copy(this.matrixWorld).invert();\n }\n }, {\n key: \"updateWorldMatrix\",\n value: function updateWorldMatrix(updateParents, updateChildren) {\n _get(_getPrototypeOf(Camera.prototype), \"updateWorldMatrix\", this).call(this, updateParents, updateChildren);\n this.matrixWorldInverse.copy(this.matrixWorld).invert();\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }]);\n return Camera;\n}(Object3D);\nvar PerspectiveCamera = /*#__PURE__*/function (_Camera) {\n _inherits(PerspectiveCamera, _Camera);\n var _super26 = _createSuper(PerspectiveCamera);\n function PerspectiveCamera() {\n var _this18;\n var fov = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 50;\n var aspect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var near = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1;\n var far = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 2000;\n _classCallCheck(this, PerspectiveCamera);\n _this18 = _super26.call(this);\n _this18.isPerspectiveCamera = true;\n _this18.type = 'PerspectiveCamera';\n _this18.fov = fov;\n _this18.zoom = 1;\n _this18.near = near;\n _this18.far = far;\n _this18.focus = 10;\n _this18.aspect = aspect;\n _this18.view = null;\n _this18.filmGauge = 35; // width of the film (default in millimeters)\n _this18.filmOffset = 0; // horizontal film offset (same unit as gauge)\n\n _this18.updateProjectionMatrix();\n return _this18;\n }\n _createClass(PerspectiveCamera, [{\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(PerspectiveCamera.prototype), \"copy\", this).call(this, source, recursive);\n this.fov = source.fov;\n this.zoom = source.zoom;\n this.near = source.near;\n this.far = source.far;\n this.focus = source.focus;\n this.aspect = source.aspect;\n this.view = source.view === null ? null : Object.assign({}, source.view);\n this.filmGauge = source.filmGauge;\n this.filmOffset = source.filmOffset;\n return this;\n }\n\n /**\n * Sets the FOV by focal length in respect to the current .filmGauge.\n *\n * The default film gauge is 35, so that the focal length can be specified for\n * a 35mm (full frame) camera.\n *\n * Values for focal length and film gauge must have the same unit.\n */\n }, {\n key: \"setFocalLength\",\n value: function setFocalLength(focalLength) {\n /** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */\n var vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;\n this.fov = RAD2DEG * 2 * Math.atan(vExtentSlope);\n this.updateProjectionMatrix();\n }\n\n /**\n * Calculates the focal length from the current .fov and .filmGauge.\n */\n }, {\n key: \"getFocalLength\",\n value: function getFocalLength() {\n var vExtentSlope = Math.tan(DEG2RAD * 0.5 * this.fov);\n return 0.5 * this.getFilmHeight() / vExtentSlope;\n }\n }, {\n key: \"getEffectiveFOV\",\n value: function getEffectiveFOV() {\n return RAD2DEG * 2 * Math.atan(Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom);\n }\n }, {\n key: \"getFilmWidth\",\n value: function getFilmWidth() {\n // film not completely covered in portrait format (aspect < 1)\n return this.filmGauge * Math.min(this.aspect, 1);\n }\n }, {\n key: \"getFilmHeight\",\n value: function getFilmHeight() {\n // film not completely covered in landscape format (aspect > 1)\n return this.filmGauge / Math.max(this.aspect, 1);\n }\n\n /**\n * Sets an offset in a larger frustum. This is useful for multi-window or\n * multi-monitor/multi-machine setups.\n *\n * For example, if you have 3x2 monitors and each monitor is 1920x1080 and\n * the monitors are in grid like this\n *\n * +---+---+---+\n * | A | B | C |\n * +---+---+---+\n * | D | E | F |\n * +---+---+---+\n *\n * then for each monitor you would call it like this\n *\n * const w = 1920;\n * const h = 1080;\n * const fullWidth = w * 3;\n * const fullHeight = h * 2;\n *\n * --A--\n * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );\n * --B--\n * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );\n * --C--\n * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );\n * --D--\n * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );\n * --E--\n * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );\n * --F--\n * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );\n *\n * Note there is no reason monitors have to be the same size or in a grid.\n */\n }, {\n key: \"setViewOffset\",\n value: function setViewOffset(fullWidth, fullHeight, x, y, width, height) {\n this.aspect = fullWidth / fullHeight;\n if (this.view === null) {\n this.view = {\n enabled: true,\n fullWidth: 1,\n fullHeight: 1,\n offsetX: 0,\n offsetY: 0,\n width: 1,\n height: 1\n };\n }\n this.view.enabled = true;\n this.view.fullWidth = fullWidth;\n this.view.fullHeight = fullHeight;\n this.view.offsetX = x;\n this.view.offsetY = y;\n this.view.width = width;\n this.view.height = height;\n this.updateProjectionMatrix();\n }\n }, {\n key: \"clearViewOffset\",\n value: function clearViewOffset() {\n if (this.view !== null) {\n this.view.enabled = false;\n }\n this.updateProjectionMatrix();\n }\n }, {\n key: \"updateProjectionMatrix\",\n value: function updateProjectionMatrix() {\n var near = this.near;\n var top = near * Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom;\n var height = 2 * top;\n var width = this.aspect * height;\n var left = -0.5 * width;\n var view = this.view;\n if (this.view !== null && this.view.enabled) {\n var fullWidth = view.fullWidth,\n fullHeight = view.fullHeight;\n left += view.offsetX * width / fullWidth;\n top -= view.offsetY * height / fullHeight;\n width *= view.width / fullWidth;\n height *= view.height / fullHeight;\n }\n var skew = this.filmOffset;\n if (skew !== 0) left += near * skew / this.getFilmWidth();\n this.projectionMatrix.makePerspective(left, left + width, top, top - height, near, this.far);\n this.projectionMatrixInverse.copy(this.projectionMatrix).invert();\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(meta) {\n var data = _get(_getPrototypeOf(PerspectiveCamera.prototype), \"toJSON\", this).call(this, meta);\n data.object.fov = this.fov;\n data.object.zoom = this.zoom;\n data.object.near = this.near;\n data.object.far = this.far;\n data.object.focus = this.focus;\n data.object.aspect = this.aspect;\n if (this.view !== null) data.object.view = Object.assign({}, this.view);\n data.object.filmGauge = this.filmGauge;\n data.object.filmOffset = this.filmOffset;\n return data;\n }\n }]);\n return PerspectiveCamera;\n}(Camera);\nvar fov = -90; // negative fov is not an error\nvar aspect = 1;\nvar CubeCamera = /*#__PURE__*/function (_Object3D3) {\n _inherits(CubeCamera, _Object3D3);\n var _super27 = _createSuper(CubeCamera);\n function CubeCamera(near, far, renderTarget) {\n var _this19;\n _classCallCheck(this, CubeCamera);\n _this19 = _super27.call(this);\n _this19.type = 'CubeCamera';\n _this19.renderTarget = renderTarget;\n var cameraPX = new PerspectiveCamera(fov, aspect, near, far);\n cameraPX.layers = _this19.layers;\n cameraPX.up.set(0, 1, 0);\n cameraPX.lookAt(1, 0, 0);\n _this19.add(cameraPX);\n var cameraNX = new PerspectiveCamera(fov, aspect, near, far);\n cameraNX.layers = _this19.layers;\n cameraNX.up.set(0, 1, 0);\n cameraNX.lookAt(-1, 0, 0);\n _this19.add(cameraNX);\n var cameraPY = new PerspectiveCamera(fov, aspect, near, far);\n cameraPY.layers = _this19.layers;\n cameraPY.up.set(0, 0, -1);\n cameraPY.lookAt(0, 1, 0);\n _this19.add(cameraPY);\n var cameraNY = new PerspectiveCamera(fov, aspect, near, far);\n cameraNY.layers = _this19.layers;\n cameraNY.up.set(0, 0, 1);\n cameraNY.lookAt(0, -1, 0);\n _this19.add(cameraNY);\n var cameraPZ = new PerspectiveCamera(fov, aspect, near, far);\n cameraPZ.layers = _this19.layers;\n cameraPZ.up.set(0, 1, 0);\n cameraPZ.lookAt(0, 0, 1);\n _this19.add(cameraPZ);\n var cameraNZ = new PerspectiveCamera(fov, aspect, near, far);\n cameraNZ.layers = _this19.layers;\n cameraNZ.up.set(0, 1, 0);\n cameraNZ.lookAt(0, 0, -1);\n _this19.add(cameraNZ);\n return _this19;\n }\n _createClass(CubeCamera, [{\n key: \"update\",\n value: function update(renderer, scene) {\n if (this.parent === null) this.updateMatrixWorld();\n var renderTarget = this.renderTarget;\n var _this$children = _slicedToArray(this.children, 6),\n cameraPX = _this$children[0],\n cameraNX = _this$children[1],\n cameraPY = _this$children[2],\n cameraNY = _this$children[3],\n cameraPZ = _this$children[4],\n cameraNZ = _this$children[5];\n var currentRenderTarget = renderer.getRenderTarget();\n var currentToneMapping = renderer.toneMapping;\n var currentXrEnabled = renderer.xr.enabled;\n renderer.toneMapping = NoToneMapping;\n renderer.xr.enabled = false;\n var generateMipmaps = renderTarget.texture.generateMipmaps;\n renderTarget.texture.generateMipmaps = false;\n renderer.setRenderTarget(renderTarget, 0);\n renderer.render(scene, cameraPX);\n renderer.setRenderTarget(renderTarget, 1);\n renderer.render(scene, cameraNX);\n renderer.setRenderTarget(renderTarget, 2);\n renderer.render(scene, cameraPY);\n renderer.setRenderTarget(renderTarget, 3);\n renderer.render(scene, cameraNY);\n renderer.setRenderTarget(renderTarget, 4);\n renderer.render(scene, cameraPZ);\n renderTarget.texture.generateMipmaps = generateMipmaps;\n renderer.setRenderTarget(renderTarget, 5);\n renderer.render(scene, cameraNZ);\n renderer.setRenderTarget(currentRenderTarget);\n renderer.toneMapping = currentToneMapping;\n renderer.xr.enabled = currentXrEnabled;\n renderTarget.texture.needsPMREMUpdate = true;\n }\n }]);\n return CubeCamera;\n}(Object3D);\nvar CubeTexture = /*#__PURE__*/function (_Texture3) {\n _inherits(CubeTexture, _Texture3);\n var _super28 = _createSuper(CubeTexture);\n function CubeTexture(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding) {\n var _this20;\n _classCallCheck(this, CubeTexture);\n images = images !== undefined ? images : [];\n mapping = mapping !== undefined ? mapping : CubeReflectionMapping;\n _this20 = _super28.call(this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding);\n _this20.isCubeTexture = true;\n _this20.flipY = false;\n return _this20;\n }\n _createClass(CubeTexture, [{\n key: \"images\",\n get: function get() {\n return this.image;\n },\n set: function set(value) {\n this.image = value;\n }\n }]);\n return CubeTexture;\n}(Texture);\nvar WebGLCubeRenderTarget = /*#__PURE__*/function (_WebGLRenderTarget4) {\n _inherits(WebGLCubeRenderTarget, _WebGLRenderTarget4);\n var _super29 = _createSuper(WebGLCubeRenderTarget);\n function WebGLCubeRenderTarget() {\n var _this21;\n var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, WebGLCubeRenderTarget);\n _this21 = _super29.call(this, size, size, options);\n _this21.isWebGLCubeRenderTarget = true;\n var image = {\n width: size,\n height: size,\n depth: 1\n };\n var images = [image, image, image, image, image, image];\n _this21.texture = new CubeTexture(images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding);\n\n // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)\n // in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words,\n // in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly.\n\n // three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped\n // and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture\n // as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures).\n\n _this21.texture.isRenderTargetTexture = true;\n _this21.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;\n _this21.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;\n return _this21;\n }\n _createClass(WebGLCubeRenderTarget, [{\n key: \"fromEquirectangularTexture\",\n value: function fromEquirectangularTexture(renderer, texture) {\n this.texture.type = texture.type;\n this.texture.encoding = texture.encoding;\n this.texture.generateMipmaps = texture.generateMipmaps;\n this.texture.minFilter = texture.minFilter;\n this.texture.magFilter = texture.magFilter;\n var shader = {\n uniforms: {\n tEquirect: {\n value: null\n }\n },\n vertexShader: /* glsl */\"\\n\\n\\t\\t\\t\\tvarying vec3 vWorldDirection;\\n\\n\\t\\t\\t\\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\\n\\n\\t\\t\\t\\t\\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\\n\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\tvoid main() {\\n\\n\\t\\t\\t\\t\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\n\\t\\t\\t\\t\\t#include \\n\\t\\t\\t\\t\\t#include \\n\\n\\t\\t\\t\\t}\\n\\t\\t\\t\",\n fragmentShader: /* glsl */\"\\n\\n\\t\\t\\t\\tuniform sampler2D tEquirect;\\n\\n\\t\\t\\t\\tvarying vec3 vWorldDirection;\\n\\n\\t\\t\\t\\t#include \\n\\n\\t\\t\\t\\tvoid main() {\\n\\n\\t\\t\\t\\t\\tvec3 direction = normalize( vWorldDirection );\\n\\n\\t\\t\\t\\t\\tvec2 sampleUV = equirectUv( direction );\\n\\n\\t\\t\\t\\t\\tgl_FragColor = texture2D( tEquirect, sampleUV );\\n\\n\\t\\t\\t\\t}\\n\\t\\t\\t\"\n };\n var geometry = new BoxGeometry(5, 5, 5);\n var material = new ShaderMaterial({\n name: 'CubemapFromEquirect',\n uniforms: cloneUniforms(shader.uniforms),\n vertexShader: shader.vertexShader,\n fragmentShader: shader.fragmentShader,\n side: BackSide,\n blending: NoBlending\n });\n material.uniforms.tEquirect.value = texture;\n var mesh = new Mesh(geometry, material);\n var currentMinFilter = texture.minFilter;\n\n // Avoid blurred poles\n if (texture.minFilter === LinearMipmapLinearFilter) texture.minFilter = LinearFilter;\n var camera = new CubeCamera(1, 10, this);\n camera.update(renderer, mesh);\n texture.minFilter = currentMinFilter;\n mesh.geometry.dispose();\n mesh.material.dispose();\n return this;\n }\n }, {\n key: \"clear\",\n value: function clear(renderer, color, depth, stencil) {\n var currentRenderTarget = renderer.getRenderTarget();\n for (var i = 0; i < 6; i++) {\n renderer.setRenderTarget(this, i);\n renderer.clear(color, depth, stencil);\n }\n renderer.setRenderTarget(currentRenderTarget);\n }\n }]);\n return WebGLCubeRenderTarget;\n}(WebGLRenderTarget);\nvar _vector1 = /*@__PURE__*/new Vector3();\nvar _vector2 = /*@__PURE__*/new Vector3();\nvar _normalMatrix = /*@__PURE__*/new Matrix3();\nvar Plane = /*#__PURE__*/function () {\n function Plane() {\n var normal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector3(1, 0, 0);\n var constant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n _classCallCheck(this, Plane);\n this.isPlane = true;\n\n // normal is assumed to be normalized\n\n this.normal = normal;\n this.constant = constant;\n }\n _createClass(Plane, [{\n key: \"set\",\n value: function set(normal, constant) {\n this.normal.copy(normal);\n this.constant = constant;\n return this;\n }\n }, {\n key: \"setComponents\",\n value: function setComponents(x, y, z, w) {\n this.normal.set(x, y, z);\n this.constant = w;\n return this;\n }\n }, {\n key: \"setFromNormalAndCoplanarPoint\",\n value: function setFromNormalAndCoplanarPoint(normal, point) {\n this.normal.copy(normal);\n this.constant = -point.dot(this.normal);\n return this;\n }\n }, {\n key: \"setFromCoplanarPoints\",\n value: function setFromCoplanarPoints(a, b, c) {\n var normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize();\n\n // Q: should an error be thrown if normal is zero (e.g. degenerate plane)?\n\n this.setFromNormalAndCoplanarPoint(normal, a);\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(plane) {\n this.normal.copy(plane.normal);\n this.constant = plane.constant;\n return this;\n }\n }, {\n key: \"normalize\",\n value: function normalize() {\n // Note: will lead to a divide by zero if the plane is invalid.\n\n var inverseNormalLength = 1.0 / this.normal.length();\n this.normal.multiplyScalar(inverseNormalLength);\n this.constant *= inverseNormalLength;\n return this;\n }\n }, {\n key: \"negate\",\n value: function negate() {\n this.constant *= -1;\n this.normal.negate();\n return this;\n }\n }, {\n key: \"distanceToPoint\",\n value: function distanceToPoint(point) {\n return this.normal.dot(point) + this.constant;\n }\n }, {\n key: \"distanceToSphere\",\n value: function distanceToSphere(sphere) {\n return this.distanceToPoint(sphere.center) - sphere.radius;\n }\n }, {\n key: \"projectPoint\",\n value: function projectPoint(point, target) {\n return target.copy(point).addScaledVector(this.normal, -this.distanceToPoint(point));\n }\n }, {\n key: \"intersectLine\",\n value: function intersectLine(line, target) {\n var direction = line.delta(_vector1);\n var denominator = this.normal.dot(direction);\n if (denominator === 0) {\n // line is coplanar, return origin\n if (this.distanceToPoint(line.start) === 0) {\n return target.copy(line.start);\n }\n\n // Unsure if this is the correct method to handle this case.\n return null;\n }\n var t = -(line.start.dot(this.normal) + this.constant) / denominator;\n if (t < 0 || t > 1) {\n return null;\n }\n return target.copy(line.start).addScaledVector(direction, t);\n }\n }, {\n key: \"intersectsLine\",\n value: function intersectsLine(line) {\n // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.\n\n var startSign = this.distanceToPoint(line.start);\n var endSign = this.distanceToPoint(line.end);\n return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0;\n }\n }, {\n key: \"intersectsBox\",\n value: function intersectsBox(box) {\n return box.intersectsPlane(this);\n }\n }, {\n key: \"intersectsSphere\",\n value: function intersectsSphere(sphere) {\n return sphere.intersectsPlane(this);\n }\n }, {\n key: \"coplanarPoint\",\n value: function coplanarPoint(target) {\n return target.copy(this.normal).multiplyScalar(-this.constant);\n }\n }, {\n key: \"applyMatrix4\",\n value: function applyMatrix4(matrix, optionalNormalMatrix) {\n var normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix);\n var referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix);\n var normal = this.normal.applyMatrix3(normalMatrix).normalize();\n this.constant = -referencePoint.dot(normal);\n return this;\n }\n }, {\n key: \"translate\",\n value: function translate(offset) {\n this.constant -= offset.dot(this.normal);\n return this;\n }\n }, {\n key: \"equals\",\n value: function equals(plane) {\n return plane.normal.equals(this.normal) && plane.constant === this.constant;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }]);\n return Plane;\n}();\nvar _sphere$3 = /*@__PURE__*/new Sphere();\nvar _vector$6 = /*@__PURE__*/new Vector3();\nvar Frustum = /*#__PURE__*/function () {\n function Frustum() {\n var p0 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Plane();\n var p1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Plane();\n var p2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Plane();\n var p3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Plane();\n var p4 = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : new Plane();\n var p5 = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new Plane();\n _classCallCheck(this, Frustum);\n this.planes = [p0, p1, p2, p3, p4, p5];\n }\n _createClass(Frustum, [{\n key: \"set\",\n value: function set(p0, p1, p2, p3, p4, p5) {\n var planes = this.planes;\n planes[0].copy(p0);\n planes[1].copy(p1);\n planes[2].copy(p2);\n planes[3].copy(p3);\n planes[4].copy(p4);\n planes[5].copy(p5);\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(frustum) {\n var planes = this.planes;\n for (var i = 0; i < 6; i++) {\n planes[i].copy(frustum.planes[i]);\n }\n return this;\n }\n }, {\n key: \"setFromProjectionMatrix\",\n value: function setFromProjectionMatrix(m) {\n var planes = this.planes;\n var me = m.elements;\n var me0 = me[0],\n me1 = me[1],\n me2 = me[2],\n me3 = me[3];\n var me4 = me[4],\n me5 = me[5],\n me6 = me[6],\n me7 = me[7];\n var me8 = me[8],\n me9 = me[9],\n me10 = me[10],\n me11 = me[11];\n var me12 = me[12],\n me13 = me[13],\n me14 = me[14],\n me15 = me[15];\n planes[0].setComponents(me3 - me0, me7 - me4, me11 - me8, me15 - me12).normalize();\n planes[1].setComponents(me3 + me0, me7 + me4, me11 + me8, me15 + me12).normalize();\n planes[2].setComponents(me3 + me1, me7 + me5, me11 + me9, me15 + me13).normalize();\n planes[3].setComponents(me3 - me1, me7 - me5, me11 - me9, me15 - me13).normalize();\n planes[4].setComponents(me3 - me2, me7 - me6, me11 - me10, me15 - me14).normalize();\n planes[5].setComponents(me3 + me2, me7 + me6, me11 + me10, me15 + me14).normalize();\n return this;\n }\n }, {\n key: \"intersectsObject\",\n value: function intersectsObject(object) {\n if (object.boundingSphere !== undefined) {\n if (object.boundingSphere === null) object.computeBoundingSphere();\n _sphere$3.copy(object.boundingSphere).applyMatrix4(object.matrixWorld);\n } else {\n var geometry = object.geometry;\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n _sphere$3.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld);\n }\n return this.intersectsSphere(_sphere$3);\n }\n }, {\n key: \"intersectsSprite\",\n value: function intersectsSprite(sprite) {\n _sphere$3.center.set(0, 0, 0);\n _sphere$3.radius = 0.7071067811865476;\n _sphere$3.applyMatrix4(sprite.matrixWorld);\n return this.intersectsSphere(_sphere$3);\n }\n }, {\n key: \"intersectsSphere\",\n value: function intersectsSphere(sphere) {\n var planes = this.planes;\n var center = sphere.center;\n var negRadius = -sphere.radius;\n for (var i = 0; i < 6; i++) {\n var distance = planes[i].distanceToPoint(center);\n if (distance < negRadius) {\n return false;\n }\n }\n return true;\n }\n }, {\n key: \"intersectsBox\",\n value: function intersectsBox(box) {\n var planes = this.planes;\n for (var i = 0; i < 6; i++) {\n var plane = planes[i];\n\n // corner at max distance\n\n _vector$6.x = plane.normal.x > 0 ? box.max.x : box.min.x;\n _vector$6.y = plane.normal.y > 0 ? box.max.y : box.min.y;\n _vector$6.z = plane.normal.z > 0 ? box.max.z : box.min.z;\n if (plane.distanceToPoint(_vector$6) < 0) {\n return false;\n }\n }\n return true;\n }\n }, {\n key: \"containsPoint\",\n value: function containsPoint(point) {\n var planes = this.planes;\n for (var i = 0; i < 6; i++) {\n if (planes[i].distanceToPoint(point) < 0) {\n return false;\n }\n }\n return true;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }]);\n return Frustum;\n}();\nfunction WebGLAnimation() {\n var context = null;\n var isAnimating = false;\n var animationLoop = null;\n var requestId = null;\n function onAnimationFrame(time, frame) {\n animationLoop(time, frame);\n requestId = context.requestAnimationFrame(onAnimationFrame);\n }\n return {\n start: function start() {\n if (isAnimating === true) return;\n if (animationLoop === null) return;\n requestId = context.requestAnimationFrame(onAnimationFrame);\n isAnimating = true;\n },\n stop: function stop() {\n context.cancelAnimationFrame(requestId);\n isAnimating = false;\n },\n setAnimationLoop: function setAnimationLoop(callback) {\n animationLoop = callback;\n },\n setContext: function setContext(value) {\n context = value;\n }\n };\n}\nfunction WebGLAttributes(gl, capabilities) {\n var isWebGL2 = capabilities.isWebGL2;\n var buffers = new WeakMap();\n function createBuffer(attribute, bufferType) {\n var array = attribute.array;\n var usage = attribute.usage;\n var buffer = gl.createBuffer();\n gl.bindBuffer(bufferType, buffer);\n gl.bufferData(bufferType, array, usage);\n attribute.onUploadCallback();\n var type;\n if (array instanceof Float32Array) {\n type = 5126;\n } else if (array instanceof Uint16Array) {\n if (attribute.isFloat16BufferAttribute) {\n if (isWebGL2) {\n type = 5131;\n } else {\n throw new Error('THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.');\n }\n } else {\n type = 5123;\n }\n } else if (array instanceof Int16Array) {\n type = 5122;\n } else if (array instanceof Uint32Array) {\n type = 5125;\n } else if (array instanceof Int32Array) {\n type = 5124;\n } else if (array instanceof Int8Array) {\n type = 5120;\n } else if (array instanceof Uint8Array) {\n type = 5121;\n } else if (array instanceof Uint8ClampedArray) {\n type = 5121;\n } else {\n throw new Error('THREE.WebGLAttributes: Unsupported buffer data format: ' + array);\n }\n return {\n buffer: buffer,\n type: type,\n bytesPerElement: array.BYTES_PER_ELEMENT,\n version: attribute.version\n };\n }\n function updateBuffer(buffer, attribute, bufferType) {\n var array = attribute.array;\n var updateRange = attribute.updateRange;\n gl.bindBuffer(bufferType, buffer);\n if (updateRange.count === -1) {\n // Not using update ranges\n\n gl.bufferSubData(bufferType, 0, array);\n } else {\n if (isWebGL2) {\n gl.bufferSubData(bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, array, updateRange.offset, updateRange.count);\n } else {\n gl.bufferSubData(bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, array.subarray(updateRange.offset, updateRange.offset + updateRange.count));\n }\n updateRange.count = -1; // reset range\n }\n\n attribute.onUploadCallback();\n }\n\n //\n\n function get(attribute) {\n if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;\n return buffers.get(attribute);\n }\n function remove(attribute) {\n if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;\n var data = buffers.get(attribute);\n if (data) {\n gl.deleteBuffer(data.buffer);\n buffers[\"delete\"](attribute);\n }\n }\n function update(attribute, bufferType) {\n if (attribute.isGLBufferAttribute) {\n var cached = buffers.get(attribute);\n if (!cached || cached.version < attribute.version) {\n buffers.set(attribute, {\n buffer: attribute.buffer,\n type: attribute.type,\n bytesPerElement: attribute.elementSize,\n version: attribute.version\n });\n }\n return;\n }\n if (attribute.isInterleavedBufferAttribute) attribute = attribute.data;\n var data = buffers.get(attribute);\n if (data === undefined) {\n buffers.set(attribute, createBuffer(attribute, bufferType));\n } else if (data.version < attribute.version) {\n updateBuffer(data.buffer, attribute, bufferType);\n data.version = attribute.version;\n }\n }\n return {\n get: get,\n remove: remove,\n update: update\n };\n}\nvar PlaneGeometry = /*#__PURE__*/function (_BufferGeometry2) {\n _inherits(PlaneGeometry, _BufferGeometry2);\n var _super30 = _createSuper(PlaneGeometry);\n function PlaneGeometry() {\n var _this22;\n var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var widthSegments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var heightSegments = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n _classCallCheck(this, PlaneGeometry);\n _this22 = _super30.call(this);\n _this22.type = 'PlaneGeometry';\n _this22.parameters = {\n width: width,\n height: height,\n widthSegments: widthSegments,\n heightSegments: heightSegments\n };\n var width_half = width / 2;\n var height_half = height / 2;\n var gridX = Math.floor(widthSegments);\n var gridY = Math.floor(heightSegments);\n var gridX1 = gridX + 1;\n var gridY1 = gridY + 1;\n var segment_width = width / gridX;\n var segment_height = height / gridY;\n\n //\n\n var indices = [];\n var vertices = [];\n var normals = [];\n var uvs = [];\n for (var iy = 0; iy < gridY1; iy++) {\n var y = iy * segment_height - height_half;\n for (var ix = 0; ix < gridX1; ix++) {\n var x = ix * segment_width - width_half;\n vertices.push(x, -y, 0);\n normals.push(0, 0, 1);\n uvs.push(ix / gridX);\n uvs.push(1 - iy / gridY);\n }\n }\n for (var _iy2 = 0; _iy2 < gridY; _iy2++) {\n for (var _ix2 = 0; _ix2 < gridX; _ix2++) {\n var a = _ix2 + gridX1 * _iy2;\n var b = _ix2 + gridX1 * (_iy2 + 1);\n var c = _ix2 + 1 + gridX1 * (_iy2 + 1);\n var d = _ix2 + 1 + gridX1 * _iy2;\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n }\n _this22.setIndex(indices);\n _this22.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n _this22.setAttribute('normal', new Float32BufferAttribute(normals, 3));\n _this22.setAttribute('uv', new Float32BufferAttribute(uvs, 2));\n return _this22;\n }\n _createClass(PlaneGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(PlaneGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new PlaneGeometry(data.width, data.height, data.widthSegments, data.heightSegments);\n }\n }]);\n return PlaneGeometry;\n}(BufferGeometry);\nvar alphamap_fragment = \"#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\\n#endif\";\nvar alphamap_pars_fragment = \"#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\nvar alphatest_fragment = \"#ifdef USE_ALPHATEST\\n\\tif ( diffuseColor.a < alphaTest ) discard;\\n#endif\";\nvar alphatest_pars_fragment = \"#ifdef USE_ALPHATEST\\n\\tuniform float alphaTest;\\n#endif\";\nvar aomap_fragment = \"#ifdef USE_AOMAP\\n\\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\\n\\treflectedLight.indirectDiffuse *= ambientOcclusion;\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD )\\n\\t\\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\\n\\t\\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\\n\\t#endif\\n#endif\";\nvar aomap_pars_fragment = \"#ifdef USE_AOMAP\\n\\tuniform sampler2D aoMap;\\n\\tuniform float aoMapIntensity;\\n#endif\";\nvar begin_vertex = \"vec3 transformed = vec3( position );\";\nvar beginnormal_vertex = \"vec3 objectNormal = vec3( normal );\\n#ifdef USE_TANGENT\\n\\tvec3 objectTangent = vec3( tangent.xyz );\\n#endif\";\nvar bsdfs = \"float 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_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\\n\\tfloat G = G_BlinnPhong_Implicit( );\\n\\tfloat D = D_BlinnPhong( shininess, dotNH );\\n\\treturn F * ( G * D );\\n} // validated\";\nvar iridescence_fragment = \"#ifdef USE_IRIDESCENCE\\n\\tconst mat3 XYZ_TO_REC709 = mat3(\\n\\t\\t 3.2404542, -0.9692660, 0.0556434,\\n\\t\\t-1.5371385, 1.8760108, -0.2040259,\\n\\t\\t-0.4985314, 0.0415560, 1.0572252\\n\\t);\\n\\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\\n\\t\\tvec3 sqrtF0 = sqrt( fresnel0 );\\n\\t\\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\\n\\t}\\n\\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\\n\\t}\\n\\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\\n\\t\\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\\n\\t}\\n\\tvec3 evalSensitivity( float OPD, vec3 shift ) {\\n\\t\\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\\n\\t\\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\\n\\t\\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\\n\\t\\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\\n\\t\\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\\n\\t\\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\\n\\t\\txyz /= 1.0685e-7;\\n\\t\\tvec3 rgb = XYZ_TO_REC709 * xyz;\\n\\t\\treturn rgb;\\n\\t}\\n\\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\\n\\t\\tvec3 I;\\n\\t\\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\\n\\t\\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\\n\\t\\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\\n\\t\\tif ( cosTheta2Sq < 0.0 ) {\\n\\t\\t\\t return vec3( 1.0 );\\n\\t\\t}\\n\\t\\tfloat cosTheta2 = sqrt( cosTheta2Sq );\\n\\t\\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\\n\\t\\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\\n\\t\\tfloat R21 = R12;\\n\\t\\tfloat T121 = 1.0 - R12;\\n\\t\\tfloat phi12 = 0.0;\\n\\t\\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\\n\\t\\tfloat phi21 = PI - phi12;\\n\\t\\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\\t\\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\\n\\t\\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\\n\\t\\tvec3 phi23 = vec3( 0.0 );\\n\\t\\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\\n\\t\\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\\n\\t\\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\\n\\t\\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\\n\\t\\tvec3 phi = vec3( phi21 ) + phi23;\\n\\t\\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\\n\\t\\tvec3 r123 = sqrt( R123 );\\n\\t\\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\\n\\t\\tvec3 C0 = R12 + Rs;\\n\\t\\tI = C0;\\n\\t\\tvec3 Cm = Rs - T121;\\n\\t\\tfor ( int m = 1; m <= 2; ++ m ) {\\n\\t\\t\\tCm *= r123;\\n\\t\\t\\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\\n\\t\\t\\tI += Cm * Sm;\\n\\t\\t}\\n\\t\\treturn max( I, vec3( 0.0 ) );\\n\\t}\\n#endif\";\nvar bumpmap_pars_fragment = \"#ifdef USE_BUMPMAP\\n\\tuniform sampler2D bumpMap;\\n\\tuniform float bumpScale;\\n\\tvec2 dHdxy_fwd() {\\n\\t\\tvec2 dSTdx = dFdx( vBumpMapUv );\\n\\t\\tvec2 dSTdy = dFdy( vBumpMapUv );\\n\\t\\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\\n\\t\\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\\n\\t\\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\\n\\t\\treturn vec2( dBx, dBy );\\n\\t}\\n\\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\\n\\t\\tvec3 vSigmaX = dFdx( surf_pos.xyz );\\n\\t\\tvec3 vSigmaY = dFdy( surf_pos.xyz );\\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 ) * faceDirection;\\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\";\nvar clipping_planes_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvec4 plane;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\\n\\t\\tplane = clippingPlanes[ i ];\\n\\t\\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\\n\\t\\tbool clipped = true;\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\\n\\t\\t\\tplane = clippingPlanes[ i ];\\n\\t\\t\\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t\\tif ( clipped ) discard;\\n\\t#endif\\n#endif\";\nvar clipping_planes_pars_fragment = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n\\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\\n#endif\";\nvar clipping_planes_pars_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvarying vec3 vClipPosition;\\n#endif\";\nvar clipping_planes_vertex = \"#if NUM_CLIPPING_PLANES > 0\\n\\tvClipPosition = - mvPosition.xyz;\\n#endif\";\nvar color_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tdiffuseColor *= vColor;\\n#elif defined( USE_COLOR )\\n\\tdiffuseColor.rgb *= vColor;\\n#endif\";\nvar color_pars_fragment = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\nvar color_pars_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvarying vec4 vColor;\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvarying vec3 vColor;\\n#endif\";\nvar color_vertex = \"#if defined( USE_COLOR_ALPHA )\\n\\tvColor = vec4( 1.0 );\\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\\n\\tvColor = vec3( 1.0 );\\n#endif\\n#ifdef USE_COLOR\\n\\tvColor *= color;\\n#endif\\n#ifdef USE_INSTANCING_COLOR\\n\\tvColor.xyz *= instanceColor.xyz;\\n#endif\";\nvar common = \"#define PI 3.141592653589793\\n#define PI2 6.283185307179586\\n#define PI_HALF 1.5707963267948966\\n#define RECIPROCAL_PI 0.3183098861837907\\n#define RECIPROCAL_PI2 0.15915494309189535\\n#define EPSILON 1e-6\\n#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\\nfloat pow2( const in float x ) { return x*x; }\\nvec3 pow2( const in vec3 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 max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\\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}\\n#ifdef HIGH_PRECISION\\n\\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\\n#else\\n\\tfloat precisionSafeLength( vec3 v ) {\\n\\t\\tfloat maxComponent = max3( abs( v ) );\\n\\t\\treturn length( v / maxComponent ) * maxComponent;\\n\\t}\\n#endif\\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#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal;\\n#endif\\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}\\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 luminance( const in vec3 rgb ) {\\n\\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\\n\\treturn dot( weights, rgb );\\n}\\nbool isPerspectiveMatrix( mat4 m ) {\\n\\treturn m[ 2 ][ 3 ] == - 1.0;\\n}\\nvec2 equirectUv( in vec3 dir ) {\\n\\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\\n\\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\\n\\treturn vec2( u, v );\\n}\\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\\n\\treturn RECIPROCAL_PI * diffuseColor;\\n}\\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n}\\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\\n\\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\\n\\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\\n} // validated\";\nvar cube_uv_reflection_fragment = \"#ifdef ENVMAP_TYPE_CUBE_UV\\n\\t#define cubeUV_minMipLevel 4.0\\n\\t#define cubeUV_minTileSize 16.0\\n\\tfloat getFace( vec3 direction ) {\\n\\t\\tvec3 absDirection = abs( direction );\\n\\t\\tfloat face = - 1.0;\\n\\t\\tif ( absDirection.x > absDirection.z ) {\\n\\t\\t\\tif ( absDirection.x > absDirection.y )\\n\\t\\t\\t\\tface = direction.x > 0.0 ? 0.0 : 3.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t} else {\\n\\t\\t\\tif ( absDirection.z > absDirection.y )\\n\\t\\t\\t\\tface = direction.z > 0.0 ? 2.0 : 5.0;\\n\\t\\t\\telse\\n\\t\\t\\t\\tface = direction.y > 0.0 ? 1.0 : 4.0;\\n\\t\\t}\\n\\t\\treturn face;\\n\\t}\\n\\tvec2 getUV( vec3 direction, float face ) {\\n\\t\\tvec2 uv;\\n\\t\\tif ( face == 0.0 ) {\\n\\t\\t\\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 1.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\\n\\t\\t} else if ( face == 2.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\\n\\t\\t} else if ( face == 3.0 ) {\\n\\t\\t\\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\\n\\t\\t} else if ( face == 4.0 ) {\\n\\t\\t\\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\\n\\t\\t} else {\\n\\t\\t\\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\\n\\t\\t}\\n\\t\\treturn 0.5 * ( uv + 1.0 );\\n\\t}\\n\\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\\n\\t\\tfloat face = getFace( direction );\\n\\t\\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\\n\\t\\tmipInt = max( mipInt, cubeUV_minMipLevel );\\n\\t\\tfloat faceSize = exp2( mipInt );\\n\\t\\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\\n\\t\\tif ( face > 2.0 ) {\\n\\t\\t\\tuv.y += faceSize;\\n\\t\\t\\tface -= 3.0;\\n\\t\\t}\\n\\t\\tuv.x += face * faceSize;\\n\\t\\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\\n\\t\\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\\n\\t\\tuv.x *= CUBEUV_TEXEL_WIDTH;\\n\\t\\tuv.y *= CUBEUV_TEXEL_HEIGHT;\\n\\t\\t#ifdef texture2DGradEXT\\n\\t\\t\\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\\n\\t\\t#else\\n\\t\\t\\treturn texture2D( envMap, uv ).rgb;\\n\\t\\t#endif\\n\\t}\\n\\t#define cubeUV_r0 1.0\\n\\t#define cubeUV_v0 0.339\\n\\t#define cubeUV_m0 - 2.0\\n\\t#define cubeUV_r1 0.8\\n\\t#define cubeUV_v1 0.276\\n\\t#define cubeUV_m1 - 1.0\\n\\t#define cubeUV_r4 0.4\\n\\t#define cubeUV_v4 0.046\\n\\t#define cubeUV_m4 2.0\\n\\t#define cubeUV_r5 0.305\\n\\t#define cubeUV_v5 0.016\\n\\t#define cubeUV_m5 3.0\\n\\t#define cubeUV_r6 0.21\\n\\t#define cubeUV_v6 0.0038\\n\\t#define cubeUV_m6 4.0\\n\\tfloat roughnessToMip( float roughness ) {\\n\\t\\tfloat mip = 0.0;\\n\\t\\tif ( roughness >= cubeUV_r1 ) {\\n\\t\\t\\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\\n\\t\\t} else if ( roughness >= cubeUV_r4 ) {\\n\\t\\t\\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\\n\\t\\t} else if ( roughness >= cubeUV_r5 ) {\\n\\t\\t\\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\\n\\t\\t} else if ( roughness >= cubeUV_r6 ) {\\n\\t\\t\\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\\n\\t\\t} else {\\n\\t\\t\\tmip = - 2.0 * log2( 1.16 * roughness );\\t\\t}\\n\\t\\treturn mip;\\n\\t}\\n\\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\\n\\t\\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\\n\\t\\tfloat mipF = fract( mip );\\n\\t\\tfloat mipInt = floor( mip );\\n\\t\\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\\n\\t\\tif ( mipF == 0.0 ) {\\n\\t\\t\\treturn vec4( color0, 1.0 );\\n\\t\\t} else {\\n\\t\\t\\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\\n\\t\\t\\treturn vec4( mix( color0, color1, mipF ), 1.0 );\\n\\t\\t}\\n\\t}\\n#endif\";\nvar defaultnormal_vertex = \"vec3 transformedNormal = objectNormal;\\n#ifdef USE_INSTANCING\\n\\tmat3 m = mat3( instanceMatrix );\\n\\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\\n\\ttransformedNormal = m * transformedNormal;\\n#endif\\ntransformedNormal = normalMatrix * transformedNormal;\\n#ifdef FLIP_SIDED\\n\\ttransformedNormal = - transformedNormal;\\n#endif\\n#ifdef USE_TANGENT\\n\\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\n\\t#ifdef FLIP_SIDED\\n\\t\\ttransformedTangent = - transformedTangent;\\n\\t#endif\\n#endif\";\nvar displacementmap_pars_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\tuniform sampler2D displacementMap;\\n\\tuniform float displacementScale;\\n\\tuniform float displacementBias;\\n#endif\";\nvar displacementmap_vertex = \"#ifdef USE_DISPLACEMENTMAP\\n\\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\\n#endif\";\nvar emissivemap_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\\n\\ttotalEmissiveRadiance *= emissiveColor.rgb;\\n#endif\";\nvar emissivemap_pars_fragment = \"#ifdef USE_EMISSIVEMAP\\n\\tuniform sampler2D emissiveMap;\\n#endif\";\nvar encodings_fragment = \"gl_FragColor = linearToOutputTexel( gl_FragColor );\";\nvar encodings_pars_fragment = \"vec4 LinearToLinear( in vec4 value ) {\\n\\treturn value;\\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.a );\\n}\";\nvar envmap_fragment = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvec3 cameraToFrag;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\\n\\t\\t}\\n\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t#ifdef ENVMAP_MODE_REFLECTION\\n\\t\\t\\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\\n\\t\\t#else\\n\\t\\t\\tvec3 reflectVec = refract( cameraToFrag, 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#else\\n\\t\\tvec4 envColor = vec4( 0.0 );\\n\\t#endif\\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\";\nvar envmap_common_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float envMapIntensity;\\n\\tuniform float flipEnvMap;\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tuniform samplerCube envMap;\\n\\t#else\\n\\t\\tuniform sampler2D envMap;\\n\\t#endif\\n\\t\\n#endif\";\nvar envmap_pars_fragment = \"#ifdef USE_ENVMAP\\n\\tuniform float reflectivity;\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t\\tuniform float refractionRatio;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t#endif\\n#endif\";\nvar envmap_pars_vertex = \"#ifdef USE_ENVMAP\\n\\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\\n\\t\\t#define ENV_WORLDPOS\\n\\t#endif\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\t\\n\\t\\tvarying vec3 vWorldPosition;\\n\\t#else\\n\\t\\tvarying vec3 vReflect;\\n\\t\\tuniform float refractionRatio;\\n\\t#endif\\n#endif\";\nvar envmap_vertex = \"#ifdef USE_ENVMAP\\n\\t#ifdef ENV_WORLDPOS\\n\\t\\tvWorldPosition = worldPosition.xyz;\\n\\t#else\\n\\t\\tvec3 cameraToVertex;\\n\\t\\tif ( isOrthographic ) {\\n\\t\\t\\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\\n\\t\\t} else {\\n\\t\\t\\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\\n\\t\\t}\\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\";\nvar fog_vertex = \"#ifdef USE_FOG\\n\\tvFogDepth = - mvPosition.z;\\n#endif\";\nvar fog_pars_vertex = \"#ifdef USE_FOG\\n\\tvarying float vFogDepth;\\n#endif\";\nvar fog_fragment = \"#ifdef USE_FOG\\n\\t#ifdef FOG_EXP2\\n\\t\\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\\n\\t#else\\n\\t\\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\\n\\t#endif\\n\\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\\n#endif\";\nvar fog_pars_fragment = \"#ifdef USE_FOG\\n\\tuniform vec3 fogColor;\\n\\tvarying float vFogDepth;\\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\";\nvar gradientmap_pars_fragment = \"#ifdef USE_GRADIENTMAP\\n\\tuniform sampler2D gradientMap;\\n#endif\\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\\n\\tfloat dotNL = dot( normal, lightDirection );\\n\\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\\n\\t#ifdef USE_GRADIENTMAP\\n\\t\\treturn vec3( texture2D( gradientMap, coord ).r );\\n\\t#else\\n\\t\\tvec2 fw = fwidth( coord ) * 0.5;\\n\\t\\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\\n\\t#endif\\n}\";\nvar lightmap_fragment = \"#ifdef USE_LIGHTMAP\\n\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\treflectedLight.indirectDiffuse += lightMapIrradiance;\\n#endif\";\nvar lightmap_pars_fragment = \"#ifdef USE_LIGHTMAP\\n\\tuniform sampler2D lightMap;\\n\\tuniform float lightMapIntensity;\\n#endif\";\nvar lights_lambert_fragment = \"LambertMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularStrength = specularStrength;\";\nvar lights_lambert_pars_fragment = \"varying vec3 vViewPosition;\\nstruct LambertMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Lambert\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Lambert\";\nvar lights_pars_begin = \"uniform bool receiveShadow;\\nuniform vec3 ambientLightColor;\\nuniform vec3 lightProbe[ 9 ];\\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\\n\\tfloat x = normal.x, y = normal.y, z = normal.z;\\n\\tvec3 result = shCoefficients[ 0 ] * 0.886227;\\n\\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\\n\\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\\n\\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\\n\\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\\n\\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\\n\\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\\n\\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\\n\\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\\n\\treturn result;\\n}\\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\\n\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\\n\\treturn irradiance;\\n}\\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\\n\\tvec3 irradiance = ambientLightColor;\\n\\treturn irradiance;\\n}\\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\\n\\t#if defined ( LEGACY_LIGHTS )\\n\\t\\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\\n\\t\\t\\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\\n\\t\\t}\\n\\t\\treturn 1.0;\\n\\t#else\\n\\t\\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\\n\\t\\tif ( cutoffDistance > 0.0 ) {\\n\\t\\t\\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\\n\\t\\t}\\n\\t\\treturn distanceFalloff;\\n\\t#endif\\n}\\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\\n\\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\\n}\\n#if NUM_DIR_LIGHTS > 0\\n\\tstruct DirectionalLight {\\n\\t\\tvec3 direction;\\n\\t\\tvec3 color;\\n\\t};\\n\\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\\n\\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\\t\\tlight.color = directionalLight.color;\\n\\t\\tlight.direction = directionalLight.direction;\\n\\t\\tlight.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};\\n\\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\\n\\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\\t\\tvec3 lVector = pointLight.position - geometry.position;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat lightDistance = length( lVector );\\n\\t\\tlight.color = pointLight.color;\\n\\t\\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\\n\\t\\tlight.visible = ( light.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};\\n\\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\\n\\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\\n\\t\\tvec3 lVector = spotLight.position - geometry.position;\\n\\t\\tlight.direction = normalize( lVector );\\n\\t\\tfloat angleCos = dot( light.direction, spotLight.direction );\\n\\t\\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\\n\\t\\tif ( spotAttenuation > 0.0 ) {\\n\\t\\t\\tfloat lightDistance = length( lVector );\\n\\t\\t\\tlight.color = spotLight.color * spotAttenuation;\\n\\t\\t\\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\\n\\t\\t\\tlight.visible = ( light.color != vec3( 0.0 ) );\\n\\t\\t} else {\\n\\t\\t\\tlight.color = vec3( 0.0 );\\n\\t\\t\\tlight.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 vec3 normal ) {\\n\\t\\tfloat dotNL = dot( normal, hemiLight.direction );\\n\\t\\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\\n\\t\\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\\n\\t\\treturn irradiance;\\n\\t}\\n#endif\";\nvar envmap_physical_pars_fragment = \"#if defined( USE_ENVMAP )\\n\\tvec3 getIBLIrradiance( const in vec3 normal ) {\\n\\t\\t#if defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\t\\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\\n\\t\\t\\treturn PI * envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n\\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\\n\\t\\t#if defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\t\\tvec3 reflectVec = reflect( - viewDir, normal );\\n\\t\\t\\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\\n\\t\\t\\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\\n\\t\\t\\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\\n\\t\\t\\treturn envMapColor.rgb * envMapIntensity;\\n\\t\\t#else\\n\\t\\t\\treturn vec3( 0.0 );\\n\\t\\t#endif\\n\\t}\\n#endif\";\nvar lights_toon_fragment = \"ToonMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\";\nvar lights_toon_pars_fragment = \"varying vec3 vViewPosition;\\nstruct ToonMaterial {\\n\\tvec3 diffuseColor;\\n};\\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\\n\\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_Toon\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_Toon\";\nvar lights_phong_fragment = \"BlinnPhongMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb;\\nmaterial.specularColor = specular;\\nmaterial.specularShininess = shininess;\\nmaterial.specularStrength = specularStrength;\";\nvar lights_phong_pars_fragment = \"varying vec3 vViewPosition;\\nstruct BlinnPhongMaterial {\\n\\tvec3 diffuseColor;\\n\\tvec3 specularColor;\\n\\tfloat specularShininess;\\n\\tfloat specularStrength;\\n};\\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\\n\\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\\n\\tvec3 irradiance = dotNL * directLight.color;\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\n\\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, 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_Lambert( material.diffuseColor );\\n}\\n#define RE_Direct\\t\\t\\t\\tRE_Direct_BlinnPhong\\n#define RE_IndirectDiffuse\\t\\tRE_IndirectDiffuse_BlinnPhong\";\nvar lights_physical_fragment = \"PhysicalMaterial material;\\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\\nmaterial.roughness = min( material.roughness, 1.0 );\\n#ifdef IOR\\n\\tmaterial.ior = ior;\\n\\t#ifdef USE_SPECULAR\\n\\t\\tfloat specularIntensityFactor = specularIntensity;\\n\\t\\tvec3 specularColorFactor = specularColor;\\n\\t\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\t\\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\\n\\t\\t#endif\\n\\t\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\t\\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\\n\\t\\t#endif\\n\\t\\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\\n\\t#else\\n\\t\\tfloat specularIntensityFactor = 1.0;\\n\\t\\tvec3 specularColorFactor = vec3( 1.0 );\\n\\t\\tmaterial.specularF90 = 1.0;\\n\\t#endif\\n\\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\\n#else\\n\\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\\n\\tmaterial.specularF90 = 1.0;\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tmaterial.clearcoat = clearcoat;\\n\\tmaterial.clearcoatRoughness = clearcoatRoughness;\\n\\tmaterial.clearcoatF0 = vec3( 0.04 );\\n\\tmaterial.clearcoatF90 = 1.0;\\n\\t#ifdef USE_CLEARCOATMAP\\n\\t\\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\t\\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\\n\\t#endif\\n\\tmaterial.clearcoat = saturate( material.clearcoat );\\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\\n\\tmaterial.clearcoatRoughness += geometryRoughness;\\n\\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tmaterial.iridescence = iridescence;\\n\\tmaterial.iridescenceIOR = iridescenceIOR;\\n\\t#ifdef USE_IRIDESCENCEMAP\\n\\t\\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\t\\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\\n\\t#else\\n\\t\\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\\n\\t#endif\\n#endif\\n#ifdef USE_SHEEN\\n\\tmaterial.sheenColor = sheenColor;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\\n\\t#endif\\n\\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\\n\\t#endif\\n#endif\";\nvar lights_physical_pars_fragment = \"struct PhysicalMaterial {\\n\\tvec3 diffuseColor;\\n\\tfloat roughness;\\n\\tvec3 specularColor;\\n\\tfloat specularF90;\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat clearcoat;\\n\\t\\tfloat clearcoatRoughness;\\n\\t\\tvec3 clearcoatF0;\\n\\t\\tfloat clearcoatF90;\\n\\t#endif\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tfloat iridescence;\\n\\t\\tfloat iridescenceIOR;\\n\\t\\tfloat iridescenceThickness;\\n\\t\\tvec3 iridescenceFresnel;\\n\\t\\tvec3 iridescenceF0;\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tvec3 sheenColor;\\n\\t\\tfloat sheenRoughness;\\n\\t#endif\\n\\t#ifdef IOR\\n\\t\\tfloat ior;\\n\\t#endif\\n\\t#ifdef USE_TRANSMISSION\\n\\t\\tfloat transmission;\\n\\t\\tfloat transmissionAlpha;\\n\\t\\tfloat thickness;\\n\\t\\tfloat attenuationDistance;\\n\\t\\tvec3 attenuationColor;\\n\\t#endif\\n};\\nvec3 clearcoatSpecular = vec3( 0.0 );\\nvec3 sheenSpecular = vec3( 0.0 );\\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\\n float x2 = x * x;\\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\\n}\\nfloat V_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}\\n#ifdef USE_CLEARCOAT\\n\\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\\n\\t\\tvec3 f0 = material.clearcoatF0;\\n\\t\\tfloat f90 = material.clearcoatF90;\\n\\t\\tfloat roughness = material.clearcoatRoughness;\\n\\t\\tfloat alpha = pow2( roughness );\\n\\t\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\t\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\t\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\t\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\t\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\t\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\t\\tfloat D = D_GGX( alpha, dotNH );\\n\\t\\treturn F * ( V * D );\\n\\t}\\n#endif\\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\\n\\tvec3 f0 = material.specularColor;\\n\\tfloat f90 = material.specularF90;\\n\\tfloat roughness = material.roughness;\\n\\tfloat alpha = pow2( roughness );\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\\n\\tvec3 F = F_Schlick( f0, f90, dotVH );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tF = mix( F, material.iridescenceFresnel, material.iridescence );\\n\\t#endif\\n\\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\\n\\tfloat D = D_GGX( alpha, dotNH );\\n\\treturn F * ( V * 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}\\n#if defined( USE_SHEEN )\\nfloat D_Charlie( float roughness, float dotNH ) {\\n\\tfloat alpha = pow2( roughness );\\n\\tfloat invAlpha = 1.0 / alpha;\\n\\tfloat cos2h = dotNH * dotNH;\\n\\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\\n\\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\\n}\\nfloat V_Neubelt( float dotNV, float dotNL ) {\\n\\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\\n}\\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\\n\\tvec3 halfDir = normalize( lightDir + viewDir );\\n\\tfloat dotNL = saturate( dot( normal, lightDir ) );\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat dotNH = saturate( dot( normal, halfDir ) );\\n\\tfloat D = D_Charlie( sheenRoughness, dotNH );\\n\\tfloat V = V_Neubelt( dotNV, dotNL );\\n\\treturn sheenColor * ( D * V );\\n}\\n#endif\\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, viewDir ) );\\n\\tfloat r2 = roughness * roughness;\\n\\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\\n\\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\\n\\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\\n\\treturn saturate( DG * RECIPROCAL_PI );\\n}\\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\\n\\tfloat dotNV = saturate( dot( normal, 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 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\\n\\treturn fab;\\n}\\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\treturn specularColor * fab.x + specularF90 * fab.y;\\n}\\n#ifdef USE_IRIDESCENCE\\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#else\\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\\n#endif\\n\\tvec2 fab = DFGApprox( normal, viewDir, roughness );\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\\n\\t#else\\n\\t\\tvec3 Fr = specularColor;\\n\\t#endif\\n\\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\\n\\tfloat Ess = fab.x + fab.y;\\n\\tfloat Ems = 1.0 - Ess;\\n\\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\\n\\tsingleScatter += FssEss;\\n\\tmultiScatter += Fms * Ems;\\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.roughness;\\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#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\\n\\t\\tvec3 ccIrradiance = dotNLcc * directLight.color;\\n\\t\\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\\n\\t#endif\\n\\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\\n\\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\\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_Lambert( material.diffuseColor );\\n}\\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\\n\\t#endif\\n\\t#ifdef USE_SHEEN\\n\\t\\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\\n\\t#endif\\n\\tvec3 singleScattering = vec3( 0.0 );\\n\\tvec3 multiScattering = vec3( 0.0 );\\n\\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\\n\\t#ifdef USE_IRIDESCENCE\\n\\t\\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\\n\\t#else\\n\\t\\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\\n\\t#endif\\n\\tvec3 totalScattering = singleScattering + multiScattering;\\n\\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\\n\\treflectedLight.indirectSpecular += radiance * singleScattering;\\n\\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\\n\\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\\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\\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}\";\nvar lights_fragment_begin = \"\\nGeometricContext geometry;\\ngeometry.position = - vViewPosition;\\ngeometry.normal = normal;\\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\\n#ifdef USE_CLEARCOAT\\n\\tgeometry.clearcoatNormal = clearcoatNormal;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\\n\\tif ( material.iridescenceThickness == 0.0 ) {\\n\\t\\tmaterial.iridescence = 0.0;\\n\\t} else {\\n\\t\\tmaterial.iridescence = saturate( material.iridescence );\\n\\t}\\n\\tif ( material.iridescence > 0.0 ) {\\n\\t\\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\\n\\t\\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\\n\\t}\\n#endif\\nIncidentLight directLight;\\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tPointLight pointLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\\n\\t\\tpointLight = pointLights[ i ];\\n\\t\\tgetPointLightInfo( pointLight, geometry, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\\n\\t\\tpointLightShadow = pointLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tSpotLight spotLight;\\n\\tvec4 spotColor;\\n\\tvec3 spotLightCoord;\\n\\tbool inSpotLightMap;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\\n\\t\\tspotLight = spotLights[ i ];\\n\\t\\tgetSpotLightInfo( spotLight, geometry, directLight );\\n\\t\\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\\n\\t\\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\\n\\t\\t#else\\n\\t\\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\\n\\t\\t#endif\\n\\t\\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\\n\\t\\t\\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\\n\\t\\t\\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\\n\\t\\t\\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\\n\\t\\t\\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\\n\\t\\t#endif\\n\\t\\t#undef SPOT_LIGHT_MAP_INDEX\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\tspotLightShadow = spotLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\\n\\tDirectionalLight directionalLight;\\n\\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLightShadow;\\n\\t#endif\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLights[ i ];\\n\\t\\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\\n\\t\\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\\n\\t\\tdirectionalLightShadow = directionalLightShadows[ i ];\\n\\t\\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t\\t#endif\\n\\t\\tRE_Direct( directLight, geometry, material, reflectedLight );\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\\n\\tRectAreaLight rectAreaLight;\\n\\t#pragma unroll_loop_start\\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\\t#pragma unroll_loop_end\\n#endif\\n#if defined( RE_IndirectDiffuse )\\n\\tvec3 iblIrradiance = vec3( 0.0 );\\n\\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\\n\\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\\n\\t#if ( NUM_HEMI_LIGHTS > 0 )\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\\n\\t\\t\\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if defined( RE_IndirectSpecular )\\n\\tvec3 radiance = vec3( 0.0 );\\n\\tvec3 clearcoatRadiance = vec3( 0.0 );\\n#endif\";\nvar lights_fragment_maps = \"#if defined( RE_IndirectDiffuse )\\n\\t#ifdef USE_LIGHTMAP\\n\\t\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\\n\\t\\tirradiance += lightMapIrradiance;\\n\\t#endif\\n\\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tiblIrradiance += getIBLIrradiance( geometry.normal );\\n\\t#endif\\n#endif\\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\\n\\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\\n\\t#endif\\n#endif\";\nvar 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, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\\n#endif\";\nvar logdepthbuf_fragment = \"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\\n\\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\\n#endif\";\nvar logdepthbuf_pars_fragment = \"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\\n\\tuniform float logDepthBufFC;\\n\\tvarying float vFragDepth;\\n\\tvarying float vIsPerspective;\\n#endif\";\nvar logdepthbuf_pars_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\t\\tvarying float vFragDepth;\\n\\t\\tvarying float vIsPerspective;\\n\\t#else\\n\\t\\tuniform float logDepthBufFC;\\n\\t#endif\\n#endif\";\nvar logdepthbuf_vertex = \"#ifdef USE_LOGDEPTHBUF\\n\\t#ifdef USE_LOGDEPTHBUF_EXT\\n\\t\\tvFragDepth = 1.0 + gl_Position.w;\\n\\t\\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\\n\\t#else\\n\\t\\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\\n\\t\\t\\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\\n\\t\\t\\tgl_Position.z *= gl_Position.w;\\n\\t\\t}\\n\\t#endif\\n#endif\";\nvar map_fragment = \"#ifdef USE_MAP\\n\\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\\n\\t#endif\\n\\tdiffuseColor *= sampledDiffuseColor;\\n#endif\";\nvar map_pars_fragment = \"#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\";\nvar map_particle_fragment = \"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t#if defined( USE_POINTS_UV )\\n\\t\\tvec2 uv = vUv;\\n\\t#else\\n\\t\\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tdiffuseColor *= texture2D( map, uv );\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\\n#endif\";\nvar map_particle_pars_fragment = \"#if defined( USE_POINTS_UV )\\n\\tvarying vec2 vUv;\\n#else\\n\\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\\n\\t\\tuniform mat3 uvTransform;\\n\\t#endif\\n#endif\\n#ifdef USE_MAP\\n\\tuniform sampler2D map;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform sampler2D alphaMap;\\n#endif\";\nvar metalnessmap_fragment = \"float metalnessFactor = metalness;\\n#ifdef USE_METALNESSMAP\\n\\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\\n\\tmetalnessFactor *= texelMetalness.b;\\n#endif\";\nvar metalnessmap_pars_fragment = \"#ifdef USE_METALNESSMAP\\n\\tuniform sampler2D metalnessMap;\\n#endif\";\nvar morphcolor_vertex = \"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\\n\\tvColor *= morphTargetBaseInfluence;\\n\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t#if defined( USE_COLOR_ALPHA )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\\n\\t\\t#elif defined( USE_COLOR )\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\\n\\t\\t#endif\\n\\t}\\n#endif\";\nvar morphnormal_vertex = \"#ifdef USE_MORPHNORMALS\\n\\tobjectNormal *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\\n\\t\\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\\n\\t\\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\\n\\t\\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\\n\\t#endif\\n#endif\";\nvar morphtarget_pars_vertex = \"#ifdef USE_MORPHTARGETS\\n\\tuniform float morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\\n\\t\\tuniform sampler2DArray morphTargetsTexture;\\n\\t\\tuniform ivec2 morphTargetsTextureSize;\\n\\t\\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\\n\\t\\t\\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\\n\\t\\t\\tint y = texelIndex / morphTargetsTextureSize.x;\\n\\t\\t\\tint x = texelIndex - y * morphTargetsTextureSize.x;\\n\\t\\t\\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\\n\\t\\t\\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\\n\\t\\t}\\n\\t#else\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\tuniform float morphTargetInfluences[ 8 ];\\n\\t\\t#else\\n\\t\\t\\tuniform float morphTargetInfluences[ 4 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\nvar morphtarget_vertex = \"#ifdef USE_MORPHTARGETS\\n\\ttransformed *= morphTargetBaseInfluence;\\n\\t#ifdef MORPHTARGETS_TEXTURE\\n\\t\\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\\n\\t\\t\\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\\n\\t\\t}\\n\\t#else\\n\\t\\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\\n\\t\\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\\n\\t\\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\\n\\t\\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\\n\\t\\t#ifndef USE_MORPHNORMALS\\n\\t\\t\\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\\n\\t\\t\\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\\n\\t\\t\\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\\n\\t\\t\\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\\n\\t\\t#endif\\n\\t#endif\\n#endif\";\nvar normal_fragment_begin = \"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\\n#ifdef FLAT_SHADED\\n\\tvec3 fdx = dFdx( vViewPosition );\\n\\tvec3 fdy = dFdy( vViewPosition );\\n\\tvec3 normal = normalize( cross( fdx, fdy ) );\\n#else\\n\\tvec3 normal = normalize( vNormal );\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal *= faceDirection;\\n\\t#endif\\n#endif\\n#ifdef USE_NORMALMAP_TANGENTSPACE\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn = getTangentFrame( - vViewPosition, normal, vNormalMapUv );\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn[0] *= faceDirection;\\n\\t\\ttbn[1] *= faceDirection;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\t#ifdef USE_TANGENT\\n\\t\\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\\n\\t#else\\n\\t\\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\\n\\t#endif\\n\\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\\n\\t\\ttbn2[0] *= faceDirection;\\n\\t\\ttbn2[1] *= faceDirection;\\n\\t#endif\\n#endif\\nvec3 geometryNormal = normal;\";\nvar normal_fragment_maps = \"#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\t#ifdef FLIP_SIDED\\n\\t\\tnormal = - normal;\\n\\t#endif\\n\\t#ifdef DOUBLE_SIDED\\n\\t\\tnormal = normal * faceDirection;\\n\\t#endif\\n\\tnormal = normalize( normalMatrix * normal );\\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tmapN.xy *= normalScale;\\n\\tnormal = normalize( tbn * mapN );\\n#elif defined( USE_BUMPMAP )\\n\\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\\n#endif\";\nvar normal_pars_fragment = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\nvar normal_pars_vertex = \"#ifndef FLAT_SHADED\\n\\tvarying vec3 vNormal;\\n\\t#ifdef USE_TANGENT\\n\\t\\tvarying vec3 vTangent;\\n\\t\\tvarying vec3 vBitangent;\\n\\t#endif\\n#endif\";\nvar normal_vertex = \"#ifndef FLAT_SHADED\\n\\tvNormal = normalize( transformedNormal );\\n\\t#ifdef USE_TANGENT\\n\\t\\tvTangent = normalize( transformedTangent );\\n\\t\\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\\n\\t#endif\\n#endif\";\nvar normalmap_pars_fragment = \"#ifdef USE_NORMALMAP\\n\\tuniform sampler2D normalMap;\\n\\tuniform vec2 normalScale;\\n#endif\\n#ifdef USE_NORMALMAP_OBJECTSPACE\\n\\tuniform mat3 normalMatrix;\\n#endif\\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\\n\\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\\n\\t\\tvec3 q0 = dFdx( eye_pos.xyz );\\n\\t\\tvec3 q1 = dFdy( eye_pos.xyz );\\n\\t\\tvec2 st0 = dFdx( uv.st );\\n\\t\\tvec2 st1 = dFdy( uv.st );\\n\\t\\tvec3 N = surf_norm;\\n\\t\\tvec3 q1perp = cross( q1, N );\\n\\t\\tvec3 q0perp = cross( N, q0 );\\n\\t\\tvec3 T = q1perp * st0.x + q0perp * st1.x;\\n\\t\\tvec3 B = q1perp * st0.y + q0perp * st1.y;\\n\\t\\tfloat det = max( dot( T, T ), dot( B, B ) );\\n\\t\\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\\n\\t\\treturn mat3( T * scale, B * scale, N );\\n\\t}\\n#endif\";\nvar clearcoat_normal_fragment_begin = \"#ifdef USE_CLEARCOAT\\n\\tvec3 clearcoatNormal = geometryNormal;\\n#endif\";\nvar clearcoat_normal_fragment_maps = \"#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\\n\\tclearcoatMapN.xy *= clearcoatNormalScale;\\n\\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\\n#endif\";\nvar clearcoat_pars_fragment = \"#ifdef USE_CLEARCOATMAP\\n\\tuniform sampler2D clearcoatMap;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform sampler2D clearcoatNormalMap;\\n\\tuniform vec2 clearcoatNormalScale;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform sampler2D clearcoatRoughnessMap;\\n#endif\";\nvar iridescence_pars_fragment = \"#ifdef USE_IRIDESCENCEMAP\\n\\tuniform sampler2D iridescenceMap;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform sampler2D iridescenceThicknessMap;\\n#endif\";\nvar output_fragment = \"#ifdef OPAQUE\\ndiffuseColor.a = 1.0;\\n#endif\\n#ifdef USE_TRANSMISSION\\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\\n#endif\\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\";\nvar 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}\\nvec2 packDepthToRG( in highp float v ) {\\n\\treturn packDepthToRGBA( v ).yx;\\n}\\nfloat unpackRGToDepth( const in highp vec2 v ) {\\n\\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\\n}\\nvec4 pack2HalfToRGBA( vec2 v ) {\\n\\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\\n\\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\\n}\\nvec2 unpackRGBATo2Half( vec4 v ) {\\n\\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\\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 depth, const in float near, const in float far ) {\\n\\treturn depth * ( 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 depth, const in float near, const in float far ) {\\n\\treturn ( near * far ) / ( ( far - near ) * depth - far );\\n}\";\nvar premultiplied_alpha_fragment = \"#ifdef PREMULTIPLIED_ALPHA\\n\\tgl_FragColor.rgb *= gl_FragColor.a;\\n#endif\";\nvar project_vertex = \"vec4 mvPosition = vec4( transformed, 1.0 );\\n#ifdef USE_INSTANCING\\n\\tmvPosition = instanceMatrix * mvPosition;\\n#endif\\nmvPosition = modelViewMatrix * mvPosition;\\ngl_Position = projectionMatrix * mvPosition;\";\nvar dithering_fragment = \"#ifdef DITHERING\\n\\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\\n#endif\";\nvar dithering_pars_fragment = \"#ifdef 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\";\nvar roughnessmap_fragment = \"float roughnessFactor = roughness;\\n#ifdef USE_ROUGHNESSMAP\\n\\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\\n\\troughnessFactor *= texelRoughness.g;\\n#endif\";\nvar roughnessmap_pars_fragment = \"#ifdef USE_ROUGHNESSMAP\\n\\tuniform sampler2D roughnessMap;\\n#endif\";\nvar shadowmap_pars_fragment = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#if NUM_SPOT_LIGHT_MAPS > 0\\n\\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\\n\\t\\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\\n\\t}\\n\\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\\n\\t\\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\\n\\t}\\n\\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\\n\\t\\tfloat occlusion = 1.0;\\n\\t\\tvec2 distribution = texture2DDistribution( shadow, uv );\\n\\t\\tfloat hard_shadow = step( compare , distribution.x );\\n\\t\\tif (hard_shadow != 1.0 ) {\\n\\t\\t\\tfloat distance = compare - distribution.x ;\\n\\t\\t\\tfloat variance = max( 0.00000, distribution.y * distribution.y );\\n\\t\\t\\tfloat softness_probability = variance / (variance + distance * distance );\\t\\t\\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\\t\\t\\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\\n\\t\\t}\\n\\t\\treturn occlusion;\\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\\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\\n\\t\\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\\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\\tfloat dx2 = dx0 / 2.0;\\n\\t\\t\\tfloat dy2 = dy0 / 2.0;\\n\\t\\t\\tfloat dx3 = dx1 / 2.0;\\n\\t\\t\\tfloat dy3 = dy1 / 2.0;\\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( dx2, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), 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( dx2, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), 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 / 17.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\\n\\t\\t\\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\\n\\t\\t\\tfloat dx = texelSize.x;\\n\\t\\t\\tfloat dy = texelSize.y;\\n\\t\\t\\tvec2 uv = shadowCoord.xy;\\n\\t\\t\\tvec2 f = fract( uv * shadowMapSize + 0.5 );\\n\\t\\t\\tuv -= f * texelSize;\\n\\t\\t\\tshadow = (\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\\n\\t\\t\\t\\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.x ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t f.y ) +\\n\\t\\t\\t\\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\\n\\t\\t\\t\\t\\t\\t f.x ),\\n\\t\\t\\t\\t\\t f.y )\\n\\t\\t\\t) * ( 1.0 / 9.0 );\\n\\t\\t#elif defined( SHADOWMAP_TYPE_VSM )\\n\\t\\t\\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\\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 ) || defined( SHADOWMAP_TYPE_VSM )\\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\";\nvar shadowmap_pars_vertex = \"#if NUM_SPOT_LIGHT_COORDS > 0\\n\\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\\n\\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\\n#endif\\n#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t\\tstruct DirectionalLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\t\\tstruct SpotLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t};\\n\\t\\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t\\tstruct PointLightShadow {\\n\\t\\t\\tfloat shadowBias;\\n\\t\\t\\tfloat shadowNormalBias;\\n\\t\\t\\tfloat shadowRadius;\\n\\t\\t\\tvec2 shadowMapSize;\\n\\t\\t\\tfloat shadowCameraNear;\\n\\t\\t\\tfloat shadowCameraFar;\\n\\t\\t};\\n\\t\\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\\n\\t#endif\\n#endif\";\nvar shadowmap_vertex = \"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\\n\\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\\n\\tvec4 shadowWorldPosition;\\n#endif\\n#if defined( USE_SHADOWMAP )\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\t\\t#pragma unroll_loop_start\\n\\t\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\t\\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\\n\\t\\t\\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\\n\\t\\t}\\n\\t\\t#pragma unroll_loop_end\\n\\t#endif\\n#endif\\n#if NUM_SPOT_LIGHT_COORDS > 0\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\\n\\t\\tshadowWorldPosition = worldPosition;\\n\\t\\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\\n\\t\\t\\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\\n\\t\\t#endif\\n\\t\\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\\n\\t}\\n\\t#pragma unroll_loop_end\\n#endif\";\nvar shadowmask_pars_fragment = \"float getShadowMask() {\\n\\tfloat shadow = 1.0;\\n\\t#ifdef USE_SHADOWMAP\\n\\t#if NUM_DIR_LIGHT_SHADOWS > 0\\n\\tDirectionalLightShadow directionalLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tdirectionalLight = directionalLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_SPOT_LIGHT_SHADOWS > 0\\n\\tSpotLightShadow spotLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tspotLight = spotLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#if NUM_POINT_LIGHT_SHADOWS > 0\\n\\tPointLightShadow pointLight;\\n\\t#pragma unroll_loop_start\\n\\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\\n\\t\\tpointLight = pointLightShadows[ i ];\\n\\t\\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\\n\\t}\\n\\t#pragma unroll_loop_end\\n\\t#endif\\n\\t#endif\\n\\treturn shadow;\\n}\";\nvar 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\";\nvar skinning_pars_vertex = \"#ifdef USE_SKINNING\\n\\tuniform mat4 bindMatrix;\\n\\tuniform mat4 bindMatrixInverse;\\n\\tuniform highp sampler2D boneTexture;\\n\\tuniform int boneTextureSize;\\n\\tmat4 getBoneMatrix( const in float i ) {\\n\\t\\tfloat j = i * 4.0;\\n\\t\\tfloat x = mod( j, float( boneTextureSize ) );\\n\\t\\tfloat y = floor( j / float( boneTextureSize ) );\\n\\t\\tfloat dx = 1.0 / float( boneTextureSize );\\n\\t\\tfloat dy = 1.0 / float( boneTextureSize );\\n\\t\\ty = dy * ( y + 0.5 );\\n\\t\\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\\n\\t\\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\\n\\t\\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\\n\\t\\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\\n\\t\\tmat4 bone = mat4( v1, v2, v3, v4 );\\n\\t\\treturn bone;\\n\\t}\\n#endif\";\nvar 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\";\nvar 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\\t#ifdef USE_TANGENT\\n\\t\\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\\n\\t#endif\\n#endif\";\nvar specularmap_fragment = \"float specularStrength;\\n#ifdef USE_SPECULARMAP\\n\\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\\n\\tspecularStrength = texelSpecular.r;\\n#else\\n\\tspecularStrength = 1.0;\\n#endif\";\nvar specularmap_pars_fragment = \"#ifdef USE_SPECULARMAP\\n\\tuniform sampler2D specularMap;\\n#endif\";\nvar tonemapping_fragment = \"#if defined( TONE_MAPPING )\\n\\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\\n#endif\";\nvar tonemapping_pars_fragment = \"#ifndef saturate\\n#define saturate( a ) clamp( a, 0.0, 1.0 )\\n#endif\\nuniform float toneMappingExposure;\\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}\\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}\\nvec3 RRTAndODTFit( vec3 v ) {\\n\\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\\n\\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\\n\\treturn a / b;\\n}\\nvec3 ACESFilmicToneMapping( vec3 color ) {\\n\\tconst mat3 ACESInputMat = mat3(\\n\\t\\tvec3( 0.59719, 0.07600, 0.02840 ),\\t\\tvec3( 0.35458, 0.90834, 0.13383 ),\\n\\t\\tvec3( 0.04823, 0.01566, 0.83777 )\\n\\t);\\n\\tconst mat3 ACESOutputMat = mat3(\\n\\t\\tvec3( 1.60475, -0.10208, -0.00327 ),\\t\\tvec3( -0.53108, 1.10813, -0.07276 ),\\n\\t\\tvec3( -0.07367, -0.00605, 1.07602 )\\n\\t);\\n\\tcolor *= toneMappingExposure / 0.6;\\n\\tcolor = ACESInputMat * color;\\n\\tcolor = RRTAndODTFit( color );\\n\\tcolor = ACESOutputMat * color;\\n\\treturn saturate( color );\\n}\\nvec3 CustomToneMapping( vec3 color ) { return color; }\";\nvar transmission_fragment = \"#ifdef USE_TRANSMISSION\\n\\tmaterial.transmission = transmission;\\n\\tmaterial.transmissionAlpha = 1.0;\\n\\tmaterial.thickness = thickness;\\n\\tmaterial.attenuationDistance = attenuationDistance;\\n\\tmaterial.attenuationColor = attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\\n\\t#endif\\n\\tvec3 pos = vWorldPosition;\\n\\tvec3 v = normalize( cameraPosition - pos );\\n\\tvec3 n = inverseTransformDirection( normal, viewMatrix );\\n\\tvec4 transmission = getIBLVolumeRefraction(\\n\\t\\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\\n\\t\\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\\n\\t\\tmaterial.attenuationColor, material.attenuationDistance );\\n\\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\\n\\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\\n#endif\";\nvar transmission_pars_fragment = \"#ifdef USE_TRANSMISSION\\n\\tuniform float transmission;\\n\\tuniform float thickness;\\n\\tuniform float attenuationDistance;\\n\\tuniform vec3 attenuationColor;\\n\\t#ifdef USE_TRANSMISSIONMAP\\n\\t\\tuniform sampler2D transmissionMap;\\n\\t#endif\\n\\t#ifdef USE_THICKNESSMAP\\n\\t\\tuniform sampler2D thicknessMap;\\n\\t#endif\\n\\tuniform vec2 transmissionSamplerSize;\\n\\tuniform sampler2D transmissionSamplerMap;\\n\\tuniform mat4 modelMatrix;\\n\\tuniform mat4 projectionMatrix;\\n\\tvarying vec3 vWorldPosition;\\n\\tfloat w0( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w1( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\\n\\t}\\n\\tfloat w2( float a ){\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\\n\\t}\\n\\tfloat w3( float a ) {\\n\\t\\treturn ( 1.0 / 6.0 ) * ( a * a * a );\\n\\t}\\n\\tfloat g0( float a ) {\\n\\t\\treturn w0( a ) + w1( a );\\n\\t}\\n\\tfloat g1( float a ) {\\n\\t\\treturn w2( a ) + w3( a );\\n\\t}\\n\\tfloat h0( float a ) {\\n\\t\\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\\n\\t}\\n\\tfloat h1( float a ) {\\n\\t\\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\\n\\t}\\n\\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, vec2 fullSize, float lod ) {\\n\\t\\tuv = uv * texelSize.zw + 0.5;\\n\\t\\tvec2 iuv = floor( uv );\\n\\t\\tvec2 fuv = fract( uv );\\n\\t\\tfloat g0x = g0( fuv.x );\\n\\t\\tfloat g1x = g1( fuv.x );\\n\\t\\tfloat h0x = h0( fuv.x );\\n\\t\\tfloat h1x = h1( fuv.x );\\n\\t\\tfloat h0y = h0( fuv.y );\\n\\t\\tfloat h1y = h1( fuv.y );\\n\\t\\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\\n\\t\\t\\n\\t\\tvec2 lodFudge = pow( 1.95, lod ) / fullSize;\\n\\t\\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\\n\\t\\t\\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\\n\\t}\\n\\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\\n\\t\\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\\n\\t\\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\\n\\t\\tvec2 fLodSizeInv = 1.0 / fLodSize;\\n\\t\\tvec2 cLodSizeInv = 1.0 / cLodSize;\\n\\t\\tvec2 fullSize = vec2( textureSize( sampler, 0 ) );\\n\\t\\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), fullSize, floor( lod ) );\\n\\t\\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), fullSize, ceil( lod ) );\\n\\t\\treturn mix( fSample, cSample, fract( lod ) );\\n\\t}\\n\\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\\n\\t\\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\\n\\t\\tvec3 modelScale;\\n\\t\\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\\n\\t\\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\\n\\t\\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\\n\\t\\treturn normalize( refractionVector ) * thickness * modelScale;\\n\\t}\\n\\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\\n\\t\\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\\n\\t}\\n\\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\\n\\t\\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\\n\\t\\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\\n\\t}\\n\\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tif ( isinf( attenuationDistance ) ) {\\n\\t\\t\\treturn radiance;\\n\\t\\t} else {\\n\\t\\t\\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\\n\\t\\t\\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\\t\\t\\treturn transmittance * radiance;\\n\\t\\t}\\n\\t}\\n\\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\\n\\t\\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\\n\\t\\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\\n\\t\\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\\n\\t\\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\\n\\t\\tvec3 refractedRayExit = position + transmissionRay;\\n\\t\\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\\n\\t\\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\\n\\t\\trefractionCoords += 1.0;\\n\\t\\trefractionCoords /= 2.0;\\n\\t\\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\\n\\t\\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\\n\\t\\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\\n\\t\\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\\n\\t}\\n#endif\";\nvar uv_pars_fragment = \"#ifdef USE_UV\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_MAP\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\nvar uv_pars_vertex = \"#ifdef USE_UV\\n\\tvarying vec2 vUv;\\n#endif\\n#ifdef USE_UV2\\n\\tattribute vec2 uv2;\\n#endif\\n#ifdef USE_MAP\\n\\tuniform mat3 mapTransform;\\n\\tvarying vec2 vMapUv;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tuniform mat3 alphaMapTransform;\\n\\tvarying vec2 vAlphaMapUv;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tuniform mat3 lightMapTransform;\\n\\tvarying vec2 vLightMapUv;\\n#endif\\n#ifdef USE_AOMAP\\n\\tuniform mat3 aoMapTransform;\\n\\tvarying vec2 vAoMapUv;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tuniform mat3 bumpMapTransform;\\n\\tvarying vec2 vBumpMapUv;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tuniform mat3 normalMapTransform;\\n\\tvarying vec2 vNormalMapUv;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tuniform mat3 displacementMapTransform;\\n\\tvarying vec2 vDisplacementMapUv;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tuniform mat3 emissiveMapTransform;\\n\\tvarying vec2 vEmissiveMapUv;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tuniform mat3 metalnessMapTransform;\\n\\tvarying vec2 vMetalnessMapUv;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tuniform mat3 roughnessMapTransform;\\n\\tvarying vec2 vRoughnessMapUv;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tuniform mat3 clearcoatMapTransform;\\n\\tvarying vec2 vClearcoatMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tuniform mat3 clearcoatNormalMapTransform;\\n\\tvarying vec2 vClearcoatNormalMapUv;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tuniform mat3 clearcoatRoughnessMapTransform;\\n\\tvarying vec2 vClearcoatRoughnessMapUv;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tuniform mat3 sheenColorMapTransform;\\n\\tvarying vec2 vSheenColorMapUv;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tuniform mat3 sheenRoughnessMapTransform;\\n\\tvarying vec2 vSheenRoughnessMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tuniform mat3 iridescenceMapTransform;\\n\\tvarying vec2 vIridescenceMapUv;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tuniform mat3 iridescenceThicknessMapTransform;\\n\\tvarying vec2 vIridescenceThicknessMapUv;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tuniform mat3 specularMapTransform;\\n\\tvarying vec2 vSpecularMapUv;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tuniform mat3 specularColorMapTransform;\\n\\tvarying vec2 vSpecularColorMapUv;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tuniform mat3 specularIntensityMapTransform;\\n\\tvarying vec2 vSpecularIntensityMapUv;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tuniform mat3 transmissionMapTransform;\\n\\tvarying vec2 vTransmissionMapUv;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tuniform mat3 thicknessMapTransform;\\n\\tvarying vec2 vThicknessMapUv;\\n#endif\";\nvar uv_vertex = \"#ifdef USE_UV\\n\\tvUv = vec3( uv, 1 ).xy;\\n#endif\\n#ifdef USE_MAP\\n\\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ALPHAMAP\\n\\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_LIGHTMAP\\n\\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_AOMAP\\n\\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_BUMPMAP\\n\\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_NORMALMAP\\n\\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_DISPLACEMENTMAP\\n\\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_EMISSIVEMAP\\n\\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_METALNESSMAP\\n\\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_ROUGHNESSMAP\\n\\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOATMAP\\n\\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_NORMALMAP\\n\\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\\n\\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCEMAP\\n\\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\\n\\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_COLORMAP\\n\\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULARMAP\\n\\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_COLORMAP\\n\\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_SPECULAR_INTENSITYMAP\\n\\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_TRANSMISSIONMAP\\n\\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\\n#endif\\n#ifdef USE_THICKNESSMAP\\n\\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\\n#endif\";\nvar worldpos_vertex = \"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\\n\\tvec4 worldPosition = vec4( transformed, 1.0 );\\n\\t#ifdef USE_INSTANCING\\n\\t\\tworldPosition = instanceMatrix * worldPosition;\\n\\t#endif\\n\\tworldPosition = modelMatrix * worldPosition;\\n#endif\";\nvar vertex$h = \"varying vec2 vUv;\\nuniform mat3 uvTransform;\\nvoid main() {\\n\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\tgl_Position = vec4( position.xy, 1.0, 1.0 );\\n}\";\nvar fragment$h = \"uniform sampler2D t2D;\\nuniform float backgroundIntensity;\\nvarying vec2 vUv;\\nvoid main() {\\n\\tvec4 texColor = texture2D( t2D, vUv );\\n\\t#ifdef DECODE_VIDEO_TEXTURE\\n\\t\\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\nvar vertex$g = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\nvar fragment$g = \"#ifdef ENVMAP_TYPE_CUBE\\n\\tuniform samplerCube envMap;\\n#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\tuniform sampler2D envMap;\\n#endif\\nuniform float flipEnvMap;\\nuniform float backgroundBlurriness;\\nuniform float backgroundIntensity;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\t#ifdef ENVMAP_TYPE_CUBE\\n\\t\\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\\n\\t#elif defined( ENVMAP_TYPE_CUBE_UV )\\n\\t\\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\\n\\t#else\\n\\t\\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\t#endif\\n\\ttexColor.rgb *= backgroundIntensity;\\n\\tgl_FragColor = texColor;\\n\\t#include \\n\\t#include \\n}\";\nvar vertex$f = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n\\tgl_Position.z = gl_Position.w;\\n}\";\nvar fragment$f = \"uniform samplerCube tCube;\\nuniform float tFlip;\\nuniform float opacity;\\nvarying vec3 vWorldDirection;\\nvoid main() {\\n\\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\\n\\tgl_FragColor = texColor;\\n\\tgl_FragColor.a *= opacity;\\n\\t#include \\n\\t#include \\n}\";\nvar vertex$e = \"#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\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\\tvHighPrecisionZW = gl_Position.zw;\\n}\";\nvar fragment$e = \"#if DEPTH_PACKING == 3200\\n\\tuniform float opacity;\\n#endif\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvarying vec2 vHighPrecisionZW;\\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\\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\\n\\t#if DEPTH_PACKING == 3200\\n\\t\\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\\n\\t#elif DEPTH_PACKING == 3201\\n\\t\\tgl_FragColor = packDepthToRGBA( fragCoordZ );\\n\\t#endif\\n}\";\nvar vertex$d = \"#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}\";\nvar fragment$d = \"#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 \\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}\";\nvar vertex$c = \"varying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvWorldDirection = transformDirection( position, modelMatrix );\\n\\t#include \\n\\t#include \\n}\";\nvar fragment$c = \"uniform sampler2D tEquirect;\\nvarying vec3 vWorldDirection;\\n#include \\nvoid main() {\\n\\tvec3 direction = normalize( vWorldDirection );\\n\\tvec2 sampleUV = equirectUv( direction );\\n\\tgl_FragColor = texture2D( tEquirect, sampleUV );\\n\\t#include \\n\\t#include \\n}\";\nvar vertex$b = \"uniform float scale;\\nattribute float lineDistance;\\nvarying float vLineDistance;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\tvLineDistance = scale * lineDistance;\\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}\";\nvar fragment$b = \"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 \\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\\t#include \\n\\toutgoingLight = diffuseColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar vertex$a = \"#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#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\\n\\t\\t#include \\n\\t\\t#include \\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\\t#include \\n\\t#include \\n}\";\nvar fragment$a = \"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 \\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\\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\\n\\t\\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\\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\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar vertex$9 = \"#define LAMBERT\\nvarying vec3 vViewPosition;\\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\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar fragment$9 = \"#define LAMBERT\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\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 \\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 + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar vertex$8 = \"#define MATCAP\\nvarying vec3 vViewPosition;\\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\\tvViewPosition = - mvPosition.xyz;\\n}\";\nvar fragment$8 = \"#define MATCAP\\nuniform vec3 diffuse;\\nuniform float opacity;\\nuniform sampler2D matcap;\\nvarying vec3 vViewPosition;\\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\\t#include \\n\\tvec3 viewDir = normalize( vViewPosition );\\n\\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\\n\\tvec3 y = cross( viewDir, x );\\n\\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\\n\\t#ifdef USE_MATCAP\\n\\t\\tvec4 matcapColor = texture2D( matcap, uv );\\n\\t#else\\n\\t\\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\\n\\t#endif\\n\\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar vertex$7 = \"#define NORMAL\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvViewPosition = - mvPosition.xyz;\\n#endif\\n}\";\nvar fragment$7 = \"#define NORMAL\\nuniform float opacity;\\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\\n\\tvarying vec3 vViewPosition;\\n#endif\\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\\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\\n\\t#ifdef OPAQUE\\n\\t\\tgl_FragColor.a = 1.0;\\n\\t#endif\\n}\";\nvar vertex$6 = \"#define PHONG\\nvarying vec3 vViewPosition;\\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\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar fragment$6 = \"#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 \\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\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar vertex$5 = \"#define STANDARD\\nvarying vec3 vViewPosition;\\n#ifdef USE_TRANSMISSION\\n\\tvarying vec3 vWorldPosition;\\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\\t#include \\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#ifdef USE_TRANSMISSION\\n\\tvWorldPosition = worldPosition.xyz;\\n#endif\\n}\";\nvar fragment$5 = \"#define STANDARD\\n#ifdef PHYSICAL\\n\\t#define IOR\\n\\t#define USE_SPECULAR\\n#endif\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\nuniform float roughness;\\nuniform float metalness;\\nuniform float opacity;\\n#ifdef IOR\\n\\tuniform float ior;\\n#endif\\n#ifdef USE_SPECULAR\\n\\tuniform float specularIntensity;\\n\\tuniform vec3 specularColor;\\n\\t#ifdef USE_SPECULAR_COLORMAP\\n\\t\\tuniform sampler2D specularColorMap;\\n\\t#endif\\n\\t#ifdef USE_SPECULAR_INTENSITYMAP\\n\\t\\tuniform sampler2D specularIntensityMap;\\n\\t#endif\\n#endif\\n#ifdef USE_CLEARCOAT\\n\\tuniform float clearcoat;\\n\\tuniform float clearcoatRoughness;\\n#endif\\n#ifdef USE_IRIDESCENCE\\n\\tuniform float iridescence;\\n\\tuniform float iridescenceIOR;\\n\\tuniform float iridescenceThicknessMinimum;\\n\\tuniform float iridescenceThicknessMaximum;\\n#endif\\n#ifdef USE_SHEEN\\n\\tuniform vec3 sheenColor;\\n\\tuniform float sheenRoughness;\\n\\t#ifdef USE_SHEEN_COLORMAP\\n\\t\\tuniform sampler2D sheenColorMap;\\n\\t#endif\\n\\t#ifdef USE_SHEEN_ROUGHNESSMAP\\n\\t\\tuniform sampler2D sheenRoughnessMap;\\n\\t#endif\\n#endif\\nvarying vec3 vViewPosition;\\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 \\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\\t#include \\n\\t#include \\n\\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\\n\\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\\n\\t#include \\n\\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\\n\\t#ifdef USE_SHEEN\\n\\t\\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\\n\\t\\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\\n\\t#endif\\n\\t#ifdef USE_CLEARCOAT\\n\\t\\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\\n\\t\\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\\n\\t\\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar vertex$4 = \"#define TOON\\nvarying vec3 vViewPosition;\\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\\tvViewPosition = - mvPosition.xyz;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar fragment$4 = \"#define TOON\\nuniform vec3 diffuse;\\nuniform vec3 emissive;\\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 \\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\\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar vertex$3 = \"uniform float size;\\nuniform float scale;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#ifdef USE_POINTS_UV\\n\\tvarying vec2 vUv;\\n\\tuniform mat3 uvTransform;\\n#endif\\nvoid main() {\\n\\t#ifdef USE_POINTS_UV\\n\\t\\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\tgl_PointSize = size;\\n\\t#ifdef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\\n\\t#endif\\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar fragment$3 = \"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\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar vertex$2 = \"#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}\";\nvar fragment$2 = \"uniform vec3 color;\\nuniform float opacity;\\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar vertex$1 = \"uniform float rotation;\\nuniform vec2 center;\\n#include \\n#include \\n#include \\n#include \\n#include \\nvoid main() {\\n\\t#include \\n\\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\tvec2 scale;\\n\\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\\n\\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\\n\\t#ifndef USE_SIZEATTENUATION\\n\\t\\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\\n\\t\\tif ( isPerspective ) scale *= - mvPosition.z;\\n\\t#endif\\n\\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\\n\\tvec2 rotatedPosition;\\n\\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\\n\\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\\n\\tmvPosition.xy += rotatedPosition;\\n\\tgl_Position = projectionMatrix * mvPosition;\\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar fragment$1 = \"uniform vec3 diffuse;\\nuniform float opacity;\\n#include \\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\\t#include \\n\\t#include \\n\\t#include \\n\\t#include \\n}\";\nvar ShaderChunk = {\n alphamap_fragment: alphamap_fragment,\n alphamap_pars_fragment: alphamap_pars_fragment,\n alphatest_fragment: alphatest_fragment,\n alphatest_pars_fragment: alphatest_pars_fragment,\n aomap_fragment: aomap_fragment,\n aomap_pars_fragment: aomap_pars_fragment,\n begin_vertex: begin_vertex,\n beginnormal_vertex: beginnormal_vertex,\n bsdfs: bsdfs,\n iridescence_fragment: iridescence_fragment,\n bumpmap_pars_fragment: bumpmap_pars_fragment,\n clipping_planes_fragment: clipping_planes_fragment,\n clipping_planes_pars_fragment: clipping_planes_pars_fragment,\n clipping_planes_pars_vertex: clipping_planes_pars_vertex,\n clipping_planes_vertex: clipping_planes_vertex,\n color_fragment: color_fragment,\n color_pars_fragment: color_pars_fragment,\n color_pars_vertex: color_pars_vertex,\n color_vertex: color_vertex,\n common: common,\n cube_uv_reflection_fragment: cube_uv_reflection_fragment,\n defaultnormal_vertex: defaultnormal_vertex,\n displacementmap_pars_vertex: displacementmap_pars_vertex,\n displacementmap_vertex: displacementmap_vertex,\n emissivemap_fragment: emissivemap_fragment,\n emissivemap_pars_fragment: emissivemap_pars_fragment,\n encodings_fragment: encodings_fragment,\n encodings_pars_fragment: encodings_pars_fragment,\n envmap_fragment: envmap_fragment,\n envmap_common_pars_fragment: envmap_common_pars_fragment,\n envmap_pars_fragment: envmap_pars_fragment,\n envmap_pars_vertex: envmap_pars_vertex,\n envmap_physical_pars_fragment: envmap_physical_pars_fragment,\n envmap_vertex: envmap_vertex,\n fog_vertex: fog_vertex,\n fog_pars_vertex: fog_pars_vertex,\n fog_fragment: fog_fragment,\n fog_pars_fragment: fog_pars_fragment,\n gradientmap_pars_fragment: gradientmap_pars_fragment,\n lightmap_fragment: lightmap_fragment,\n lightmap_pars_fragment: lightmap_pars_fragment,\n lights_lambert_fragment: lights_lambert_fragment,\n lights_lambert_pars_fragment: lights_lambert_pars_fragment,\n lights_pars_begin: lights_pars_begin,\n lights_toon_fragment: lights_toon_fragment,\n lights_toon_pars_fragment: lights_toon_pars_fragment,\n lights_phong_fragment: lights_phong_fragment,\n lights_phong_pars_fragment: lights_phong_pars_fragment,\n lights_physical_fragment: lights_physical_fragment,\n lights_physical_pars_fragment: lights_physical_pars_fragment,\n lights_fragment_begin: lights_fragment_begin,\n lights_fragment_maps: lights_fragment_maps,\n lights_fragment_end: lights_fragment_end,\n logdepthbuf_fragment: logdepthbuf_fragment,\n logdepthbuf_pars_fragment: logdepthbuf_pars_fragment,\n logdepthbuf_pars_vertex: logdepthbuf_pars_vertex,\n logdepthbuf_vertex: logdepthbuf_vertex,\n map_fragment: map_fragment,\n map_pars_fragment: map_pars_fragment,\n map_particle_fragment: map_particle_fragment,\n map_particle_pars_fragment: map_particle_pars_fragment,\n metalnessmap_fragment: metalnessmap_fragment,\n metalnessmap_pars_fragment: metalnessmap_pars_fragment,\n morphcolor_vertex: morphcolor_vertex,\n morphnormal_vertex: morphnormal_vertex,\n morphtarget_pars_vertex: morphtarget_pars_vertex,\n morphtarget_vertex: morphtarget_vertex,\n normal_fragment_begin: normal_fragment_begin,\n normal_fragment_maps: normal_fragment_maps,\n normal_pars_fragment: normal_pars_fragment,\n normal_pars_vertex: normal_pars_vertex,\n normal_vertex: normal_vertex,\n normalmap_pars_fragment: normalmap_pars_fragment,\n clearcoat_normal_fragment_begin: clearcoat_normal_fragment_begin,\n clearcoat_normal_fragment_maps: clearcoat_normal_fragment_maps,\n clearcoat_pars_fragment: clearcoat_pars_fragment,\n iridescence_pars_fragment: iridescence_pars_fragment,\n output_fragment: output_fragment,\n packing: packing,\n premultiplied_alpha_fragment: premultiplied_alpha_fragment,\n project_vertex: project_vertex,\n dithering_fragment: dithering_fragment,\n dithering_pars_fragment: dithering_pars_fragment,\n roughnessmap_fragment: roughnessmap_fragment,\n roughnessmap_pars_fragment: roughnessmap_pars_fragment,\n shadowmap_pars_fragment: shadowmap_pars_fragment,\n shadowmap_pars_vertex: shadowmap_pars_vertex,\n shadowmap_vertex: shadowmap_vertex,\n shadowmask_pars_fragment: shadowmask_pars_fragment,\n skinbase_vertex: skinbase_vertex,\n skinning_pars_vertex: skinning_pars_vertex,\n skinning_vertex: skinning_vertex,\n skinnormal_vertex: skinnormal_vertex,\n specularmap_fragment: specularmap_fragment,\n specularmap_pars_fragment: specularmap_pars_fragment,\n tonemapping_fragment: tonemapping_fragment,\n tonemapping_pars_fragment: tonemapping_pars_fragment,\n transmission_fragment: transmission_fragment,\n transmission_pars_fragment: transmission_pars_fragment,\n uv_pars_fragment: uv_pars_fragment,\n uv_pars_vertex: uv_pars_vertex,\n uv_vertex: uv_vertex,\n worldpos_vertex: worldpos_vertex,\n background_vert: vertex$h,\n background_frag: fragment$h,\n backgroundCube_vert: vertex$g,\n backgroundCube_frag: fragment$g,\n cube_vert: vertex$f,\n cube_frag: fragment$f,\n depth_vert: vertex$e,\n depth_frag: fragment$e,\n distanceRGBA_vert: vertex$d,\n distanceRGBA_frag: fragment$d,\n equirect_vert: vertex$c,\n equirect_frag: fragment$c,\n linedashed_vert: vertex$b,\n linedashed_frag: fragment$b,\n meshbasic_vert: vertex$a,\n meshbasic_frag: fragment$a,\n meshlambert_vert: vertex$9,\n meshlambert_frag: fragment$9,\n meshmatcap_vert: vertex$8,\n meshmatcap_frag: fragment$8,\n meshnormal_vert: vertex$7,\n meshnormal_frag: fragment$7,\n meshphong_vert: vertex$6,\n meshphong_frag: fragment$6,\n meshphysical_vert: vertex$5,\n meshphysical_frag: fragment$5,\n meshtoon_vert: vertex$4,\n meshtoon_frag: fragment$4,\n points_vert: vertex$3,\n points_frag: fragment$3,\n shadow_vert: vertex$2,\n shadow_frag: fragment$2,\n sprite_vert: vertex$1,\n sprite_frag: fragment$1\n};\n\n/**\n * Uniforms library for shared webgl shaders\n */\n\nvar UniformsLib = {\n common: {\n diffuse: {\n value: /*@__PURE__*/new Color(0xffffff)\n },\n opacity: {\n value: 1.0\n },\n map: {\n value: null\n },\n mapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n alphaMap: {\n value: null\n },\n alphaMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n alphaTest: {\n value: 0\n }\n },\n specularmap: {\n specularMap: {\n value: null\n },\n specularMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n }\n },\n envmap: {\n envMap: {\n value: null\n },\n flipEnvMap: {\n value: -1\n },\n reflectivity: {\n value: 1.0\n },\n // basic, lambert, phong\n ior: {\n value: 1.5\n },\n // physical\n refractionRatio: {\n value: 0.98\n } // basic, lambert, phong\n },\n\n aomap: {\n aoMap: {\n value: null\n },\n aoMapIntensity: {\n value: 1\n },\n aoMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n }\n },\n lightmap: {\n lightMap: {\n value: null\n },\n lightMapIntensity: {\n value: 1\n },\n lightMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n }\n },\n bumpmap: {\n bumpMap: {\n value: null\n },\n bumpMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n bumpScale: {\n value: 1\n }\n },\n normalmap: {\n normalMap: {\n value: null\n },\n normalMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n normalScale: {\n value: /*@__PURE__*/new Vector2(1, 1)\n }\n },\n displacementmap: {\n displacementMap: {\n value: null\n },\n displacementMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n displacementScale: {\n value: 1\n },\n displacementBias: {\n value: 0\n }\n },\n emissivemap: {\n emissiveMap: {\n value: null\n },\n emissiveMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n }\n },\n metalnessmap: {\n metalnessMap: {\n value: null\n },\n metalnessMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n }\n },\n roughnessmap: {\n roughnessMap: {\n value: null\n },\n roughnessMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n }\n },\n gradientmap: {\n gradientMap: {\n value: null\n }\n },\n fog: {\n fogDensity: {\n value: 0.00025\n },\n fogNear: {\n value: 1\n },\n fogFar: {\n value: 2000\n },\n fogColor: {\n value: /*@__PURE__*/new Color(0xffffff)\n }\n },\n lights: {\n ambientLightColor: {\n value: []\n },\n lightProbe: {\n value: []\n },\n directionalLights: {\n value: [],\n properties: {\n direction: {},\n color: {}\n }\n },\n directionalLightShadows: {\n value: [],\n properties: {\n shadowBias: {},\n shadowNormalBias: {},\n shadowRadius: {},\n shadowMapSize: {}\n }\n },\n directionalShadowMap: {\n value: []\n },\n directionalShadowMatrix: {\n value: []\n },\n spotLights: {\n value: [],\n properties: {\n color: {},\n position: {},\n direction: {},\n distance: {},\n coneCos: {},\n penumbraCos: {},\n decay: {}\n }\n },\n spotLightShadows: {\n value: [],\n properties: {\n shadowBias: {},\n shadowNormalBias: {},\n shadowRadius: {},\n shadowMapSize: {}\n }\n },\n spotLightMap: {\n value: []\n },\n spotShadowMap: {\n value: []\n },\n spotLightMatrix: {\n value: []\n },\n pointLights: {\n value: [],\n properties: {\n color: {},\n position: {},\n decay: {},\n distance: {}\n }\n },\n pointLightShadows: {\n value: [],\n properties: {\n shadowBias: {},\n shadowNormalBias: {},\n shadowRadius: {},\n shadowMapSize: {},\n shadowCameraNear: {},\n shadowCameraFar: {}\n }\n },\n pointShadowMap: {\n value: []\n },\n pointShadowMatrix: {\n value: []\n },\n hemisphereLights: {\n value: [],\n properties: {\n direction: {},\n skyColor: {},\n groundColor: {}\n }\n },\n // TODO (abelnation): RectAreaLight BRDF data needs to be moved from example to main src\n rectAreaLights: {\n value: [],\n properties: {\n color: {},\n position: {},\n width: {},\n height: {}\n }\n },\n ltc_1: {\n value: null\n },\n ltc_2: {\n value: null\n }\n },\n points: {\n diffuse: {\n value: /*@__PURE__*/new Color(0xffffff)\n },\n opacity: {\n value: 1.0\n },\n size: {\n value: 1.0\n },\n scale: {\n value: 1.0\n },\n map: {\n value: null\n },\n alphaMap: {\n value: null\n },\n alphaTest: {\n value: 0\n },\n uvTransform: {\n value: /*@__PURE__*/new Matrix3()\n }\n },\n sprite: {\n diffuse: {\n value: /*@__PURE__*/new Color(0xffffff)\n },\n opacity: {\n value: 1.0\n },\n center: {\n value: /*@__PURE__*/new Vector2(0.5, 0.5)\n },\n rotation: {\n value: 0.0\n },\n map: {\n value: null\n },\n mapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n alphaMap: {\n value: null\n },\n alphaTest: {\n value: 0\n }\n }\n};\nvar ShaderLib = {\n basic: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.fog]),\n vertexShader: ShaderChunk.meshbasic_vert,\n fragmentShader: ShaderChunk.meshbasic_frag\n },\n lambert: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, UniformsLib.lights, {\n emissive: {\n value: /*@__PURE__*/new Color(0x000000)\n }\n }]),\n vertexShader: ShaderChunk.meshlambert_vert,\n fragmentShader: ShaderChunk.meshlambert_frag\n },\n phong: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, UniformsLib.lights, {\n emissive: {\n value: /*@__PURE__*/new Color(0x000000)\n },\n specular: {\n value: /*@__PURE__*/new Color(0x111111)\n },\n shininess: {\n value: 30\n }\n }]),\n vertexShader: ShaderChunk.meshphong_vert,\n fragmentShader: ShaderChunk.meshphong_frag\n },\n standard: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.roughnessmap, UniformsLib.metalnessmap, UniformsLib.fog, UniformsLib.lights, {\n emissive: {\n value: /*@__PURE__*/new Color(0x000000)\n },\n roughness: {\n value: 1.0\n },\n metalness: {\n value: 0.0\n },\n envMapIntensity: {\n value: 1\n } // temporary\n }]),\n\n vertexShader: ShaderChunk.meshphysical_vert,\n fragmentShader: ShaderChunk.meshphysical_frag\n },\n toon: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.gradientmap, UniformsLib.fog, UniformsLib.lights, {\n emissive: {\n value: /*@__PURE__*/new Color(0x000000)\n }\n }]),\n vertexShader: ShaderChunk.meshtoon_vert,\n fragmentShader: ShaderChunk.meshtoon_frag\n },\n matcap: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, {\n matcap: {\n value: null\n }\n }]),\n vertexShader: ShaderChunk.meshmatcap_vert,\n fragmentShader: ShaderChunk.meshmatcap_frag\n },\n points: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.points, UniformsLib.fog]),\n vertexShader: ShaderChunk.points_vert,\n fragmentShader: ShaderChunk.points_frag\n },\n dashed: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.fog, {\n scale: {\n value: 1\n },\n dashSize: {\n value: 1\n },\n totalSize: {\n value: 2\n }\n }]),\n vertexShader: ShaderChunk.linedashed_vert,\n fragmentShader: ShaderChunk.linedashed_frag\n },\n depth: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.displacementmap]),\n vertexShader: ShaderChunk.depth_vert,\n fragmentShader: ShaderChunk.depth_frag\n },\n normal: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, {\n opacity: {\n value: 1.0\n }\n }]),\n vertexShader: ShaderChunk.meshnormal_vert,\n fragmentShader: ShaderChunk.meshnormal_frag\n },\n sprite: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.sprite, UniformsLib.fog]),\n vertexShader: ShaderChunk.sprite_vert,\n fragmentShader: ShaderChunk.sprite_frag\n },\n background: {\n uniforms: {\n uvTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n t2D: {\n value: null\n },\n backgroundIntensity: {\n value: 1\n }\n },\n vertexShader: ShaderChunk.background_vert,\n fragmentShader: ShaderChunk.background_frag\n },\n backgroundCube: {\n uniforms: {\n envMap: {\n value: null\n },\n flipEnvMap: {\n value: -1\n },\n backgroundBlurriness: {\n value: 0\n },\n backgroundIntensity: {\n value: 1\n }\n },\n vertexShader: ShaderChunk.backgroundCube_vert,\n fragmentShader: ShaderChunk.backgroundCube_frag\n },\n cube: {\n uniforms: {\n tCube: {\n value: null\n },\n tFlip: {\n value: -1\n },\n opacity: {\n value: 1.0\n }\n },\n vertexShader: ShaderChunk.cube_vert,\n fragmentShader: ShaderChunk.cube_frag\n },\n equirect: {\n uniforms: {\n tEquirect: {\n value: null\n }\n },\n vertexShader: ShaderChunk.equirect_vert,\n fragmentShader: ShaderChunk.equirect_frag\n },\n distanceRGBA: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.displacementmap, {\n referencePosition: {\n value: /*@__PURE__*/new Vector3()\n },\n nearDistance: {\n value: 1\n },\n farDistance: {\n value: 1000\n }\n }]),\n vertexShader: ShaderChunk.distanceRGBA_vert,\n fragmentShader: ShaderChunk.distanceRGBA_frag\n },\n shadow: {\n uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.lights, UniformsLib.fog, {\n color: {\n value: /*@__PURE__*/new Color(0x00000)\n },\n opacity: {\n value: 1.0\n }\n }]),\n vertexShader: ShaderChunk.shadow_vert,\n fragmentShader: ShaderChunk.shadow_frag\n }\n};\nShaderLib.physical = {\n uniforms: /*@__PURE__*/mergeUniforms([ShaderLib.standard.uniforms, {\n clearcoat: {\n value: 0\n },\n clearcoatMap: {\n value: null\n },\n clearcoatMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n clearcoatNormalMap: {\n value: null\n },\n clearcoatNormalMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n clearcoatNormalScale: {\n value: /*@__PURE__*/new Vector2(1, 1)\n },\n clearcoatRoughness: {\n value: 0\n },\n clearcoatRoughnessMap: {\n value: null\n },\n clearcoatRoughnessMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n iridescence: {\n value: 0\n },\n iridescenceMap: {\n value: null\n },\n iridescenceMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n iridescenceIOR: {\n value: 1.3\n },\n iridescenceThicknessMinimum: {\n value: 100\n },\n iridescenceThicknessMaximum: {\n value: 400\n },\n iridescenceThicknessMap: {\n value: null\n },\n iridescenceThicknessMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n sheen: {\n value: 0\n },\n sheenColor: {\n value: /*@__PURE__*/new Color(0x000000)\n },\n sheenColorMap: {\n value: null\n },\n sheenColorMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n sheenRoughness: {\n value: 1\n },\n sheenRoughnessMap: {\n value: null\n },\n sheenRoughnessMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n transmission: {\n value: 0\n },\n transmissionMap: {\n value: null\n },\n transmissionMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n transmissionSamplerSize: {\n value: /*@__PURE__*/new Vector2()\n },\n transmissionSamplerMap: {\n value: null\n },\n thickness: {\n value: 0\n },\n thicknessMap: {\n value: null\n },\n thicknessMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n attenuationDistance: {\n value: 0\n },\n attenuationColor: {\n value: /*@__PURE__*/new Color(0x000000)\n },\n specularColor: {\n value: /*@__PURE__*/new Color(1, 1, 1)\n },\n specularColorMap: {\n value: null\n },\n specularColorMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n },\n specularIntensity: {\n value: 1\n },\n specularIntensityMap: {\n value: null\n },\n specularIntensityMapTransform: {\n value: /*@__PURE__*/new Matrix3()\n }\n }]),\n vertexShader: ShaderChunk.meshphysical_vert,\n fragmentShader: ShaderChunk.meshphysical_frag\n};\nvar _rgb = {\n r: 0,\n b: 0,\n g: 0\n};\nfunction WebGLBackground(renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha) {\n var clearColor = new Color(0x000000);\n var clearAlpha = alpha === true ? 0 : 1;\n var planeMesh;\n var boxMesh;\n var currentBackground = null;\n var currentBackgroundVersion = 0;\n var currentTonemapping = null;\n function render(renderList, scene) {\n var forceClear = false;\n var background = scene.isScene === true ? scene.background : null;\n if (background && background.isTexture) {\n var usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background\n background = (usePMREM ? cubeuvmaps : cubemaps).get(background);\n }\n\n // Ignore background in AR\n // TODO: Reconsider this.\n\n var xr = renderer.xr;\n var session = xr.getSession && xr.getSession();\n if (session && session.environmentBlendMode === 'additive') {\n background = null;\n }\n if (background === null) {\n setClear(clearColor, clearAlpha);\n } else if (background && background.isColor) {\n setClear(background, 1);\n forceClear = true;\n }\n if (renderer.autoClear || forceClear) {\n renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil);\n }\n if (background && (background.isCubeTexture || background.mapping === CubeUVReflectionMapping)) {\n if (boxMesh === undefined) {\n boxMesh = new Mesh(new BoxGeometry(1, 1, 1), new ShaderMaterial({\n name: 'BackgroundCubeMaterial',\n uniforms: cloneUniforms(ShaderLib.backgroundCube.uniforms),\n vertexShader: ShaderLib.backgroundCube.vertexShader,\n fragmentShader: ShaderLib.backgroundCube.fragmentShader,\n side: BackSide,\n depthTest: false,\n depthWrite: false,\n fog: false\n }));\n boxMesh.geometry.deleteAttribute('normal');\n boxMesh.geometry.deleteAttribute('uv');\n boxMesh.onBeforeRender = function (renderer, scene, camera) {\n this.matrixWorld.copyPosition(camera.matrixWorld);\n };\n\n // add \"envMap\" material property so the renderer can evaluate it like for built-in materials\n Object.defineProperty(boxMesh.material, 'envMap', {\n get: function get() {\n return this.uniforms.envMap.value;\n }\n });\n objects.update(boxMesh);\n }\n boxMesh.material.uniforms.envMap.value = background;\n boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;\n boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;\n boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n boxMesh.material.toneMapped = background.encoding === sRGBEncoding ? false : true;\n if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {\n boxMesh.material.needsUpdate = true;\n currentBackground = background;\n currentBackgroundVersion = background.version;\n currentTonemapping = renderer.toneMapping;\n }\n boxMesh.layers.enableAll();\n\n // push to the pre-sorted opaque render list\n renderList.unshift(boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null);\n } else if (background && background.isTexture) {\n if (planeMesh === undefined) {\n planeMesh = new Mesh(new PlaneGeometry(2, 2), new ShaderMaterial({\n name: 'BackgroundMaterial',\n uniforms: cloneUniforms(ShaderLib.background.uniforms),\n vertexShader: ShaderLib.background.vertexShader,\n fragmentShader: ShaderLib.background.fragmentShader,\n side: FrontSide,\n depthTest: false,\n depthWrite: false,\n fog: false\n }));\n planeMesh.geometry.deleteAttribute('normal');\n\n // add \"map\" material property so the renderer can evaluate it like for built-in materials\n Object.defineProperty(planeMesh.material, 'map', {\n get: function get() {\n return this.uniforms.t2D.value;\n }\n });\n objects.update(planeMesh);\n }\n planeMesh.material.uniforms.t2D.value = background;\n planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;\n planeMesh.material.toneMapped = background.encoding === sRGBEncoding ? false : true;\n if (background.matrixAutoUpdate === true) {\n background.updateMatrix();\n }\n planeMesh.material.uniforms.uvTransform.value.copy(background.matrix);\n if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {\n planeMesh.material.needsUpdate = true;\n currentBackground = background;\n currentBackgroundVersion = background.version;\n currentTonemapping = renderer.toneMapping;\n }\n planeMesh.layers.enableAll();\n\n // push to the pre-sorted opaque render list\n renderList.unshift(planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null);\n }\n }\n function setClear(color, alpha) {\n color.getRGB(_rgb, getUnlitUniformColorSpace(renderer));\n state.buffers.color.setClear(_rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha);\n }\n return {\n getClearColor: function getClearColor() {\n return clearColor;\n },\n setClearColor: function setClearColor(color) {\n var alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n clearColor.set(color);\n clearAlpha = alpha;\n setClear(clearColor, clearAlpha);\n },\n getClearAlpha: function getClearAlpha() {\n return clearAlpha;\n },\n setClearAlpha: function setClearAlpha(alpha) {\n clearAlpha = alpha;\n setClear(clearColor, clearAlpha);\n },\n render: render\n };\n}\nfunction WebGLBindingStates(gl, extensions, attributes, capabilities) {\n var maxVertexAttributes = gl.getParameter(34921);\n var extension = capabilities.isWebGL2 ? null : extensions.get('OES_vertex_array_object');\n var vaoAvailable = capabilities.isWebGL2 || extension !== null;\n var bindingStates = {};\n var defaultState = createBindingState(null);\n var currentState = defaultState;\n var forceUpdate = false;\n function setup(object, material, program, geometry, index) {\n var updateBuffers = false;\n if (vaoAvailable) {\n var state = getBindingState(geometry, program, material);\n if (currentState !== state) {\n currentState = state;\n bindVertexArrayObject(currentState.object);\n }\n updateBuffers = needsUpdate(object, geometry, program, index);\n if (updateBuffers) saveCache(object, geometry, program, index);\n } else {\n var wireframe = material.wireframe === true;\n if (currentState.geometry !== geometry.id || currentState.program !== program.id || currentState.wireframe !== wireframe) {\n currentState.geometry = geometry.id;\n currentState.program = program.id;\n currentState.wireframe = wireframe;\n updateBuffers = true;\n }\n }\n if (index !== null) {\n attributes.update(index, 34963);\n }\n if (updateBuffers || forceUpdate) {\n forceUpdate = false;\n setupVertexAttributes(object, material, program, geometry);\n if (index !== null) {\n gl.bindBuffer(34963, attributes.get(index).buffer);\n }\n }\n }\n function createVertexArrayObject() {\n if (capabilities.isWebGL2) return gl.createVertexArray();\n return extension.createVertexArrayOES();\n }\n function bindVertexArrayObject(vao) {\n if (capabilities.isWebGL2) return gl.bindVertexArray(vao);\n return extension.bindVertexArrayOES(vao);\n }\n function deleteVertexArrayObject(vao) {\n if (capabilities.isWebGL2) return gl.deleteVertexArray(vao);\n return extension.deleteVertexArrayOES(vao);\n }\n function getBindingState(geometry, program, material) {\n var wireframe = material.wireframe === true;\n var programMap = bindingStates[geometry.id];\n if (programMap === undefined) {\n programMap = {};\n bindingStates[geometry.id] = programMap;\n }\n var stateMap = programMap[program.id];\n if (stateMap === undefined) {\n stateMap = {};\n programMap[program.id] = stateMap;\n }\n var state = stateMap[wireframe];\n if (state === undefined) {\n state = createBindingState(createVertexArrayObject());\n stateMap[wireframe] = state;\n }\n return state;\n }\n function createBindingState(vao) {\n var newAttributes = [];\n var enabledAttributes = [];\n var attributeDivisors = [];\n for (var i = 0; i < maxVertexAttributes; i++) {\n newAttributes[i] = 0;\n enabledAttributes[i] = 0;\n attributeDivisors[i] = 0;\n }\n return {\n // for backward compatibility on non-VAO support browser\n geometry: null,\n program: null,\n wireframe: false,\n newAttributes: newAttributes,\n enabledAttributes: enabledAttributes,\n attributeDivisors: attributeDivisors,\n object: vao,\n attributes: {},\n index: null\n };\n }\n function needsUpdate(object, geometry, program, index) {\n var cachedAttributes = currentState.attributes;\n var geometryAttributes = geometry.attributes;\n var attributesNum = 0;\n var programAttributes = program.getAttributes();\n for (var name in programAttributes) {\n var programAttribute = programAttributes[name];\n if (programAttribute.location >= 0) {\n var cachedAttribute = cachedAttributes[name];\n var geometryAttribute = geometryAttributes[name];\n if (geometryAttribute === undefined) {\n if (name === 'instanceMatrix' && object.instanceMatrix) geometryAttribute = object.instanceMatrix;\n if (name === 'instanceColor' && object.instanceColor) geometryAttribute = object.instanceColor;\n }\n if (cachedAttribute === undefined) return true;\n if (cachedAttribute.attribute !== geometryAttribute) return true;\n if (geometryAttribute && cachedAttribute.data !== geometryAttribute.data) return true;\n attributesNum++;\n }\n }\n if (currentState.attributesNum !== attributesNum) return true;\n if (currentState.index !== index) return true;\n return false;\n }\n function saveCache(object, geometry, program, index) {\n var cache = {};\n var attributes = geometry.attributes;\n var attributesNum = 0;\n var programAttributes = program.getAttributes();\n for (var name in programAttributes) {\n var programAttribute = programAttributes[name];\n if (programAttribute.location >= 0) {\n var attribute = attributes[name];\n if (attribute === undefined) {\n if (name === 'instanceMatrix' && object.instanceMatrix) attribute = object.instanceMatrix;\n if (name === 'instanceColor' && object.instanceColor) attribute = object.instanceColor;\n }\n var data = {};\n data.attribute = attribute;\n if (attribute && attribute.data) {\n data.data = attribute.data;\n }\n cache[name] = data;\n attributesNum++;\n }\n }\n currentState.attributes = cache;\n currentState.attributesNum = attributesNum;\n currentState.index = index;\n }\n function initAttributes() {\n var newAttributes = currentState.newAttributes;\n for (var i = 0, il = newAttributes.length; i < il; i++) {\n newAttributes[i] = 0;\n }\n }\n function enableAttribute(attribute) {\n enableAttributeAndDivisor(attribute, 0);\n }\n function enableAttributeAndDivisor(attribute, meshPerAttribute) {\n var newAttributes = currentState.newAttributes;\n var enabledAttributes = currentState.enabledAttributes;\n var attributeDivisors = currentState.attributeDivisors;\n newAttributes[attribute] = 1;\n if (enabledAttributes[attribute] === 0) {\n gl.enableVertexAttribArray(attribute);\n enabledAttributes[attribute] = 1;\n }\n if (attributeDivisors[attribute] !== meshPerAttribute) {\n var _extension = capabilities.isWebGL2 ? gl : extensions.get('ANGLE_instanced_arrays');\n _extension[capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE'](attribute, meshPerAttribute);\n attributeDivisors[attribute] = meshPerAttribute;\n }\n }\n function disableUnusedAttributes() {\n var newAttributes = currentState.newAttributes;\n var enabledAttributes = currentState.enabledAttributes;\n for (var i = 0, il = enabledAttributes.length; i < il; i++) {\n if (enabledAttributes[i] !== newAttributes[i]) {\n gl.disableVertexAttribArray(i);\n enabledAttributes[i] = 0;\n }\n }\n }\n function vertexAttribPointer(index, size, type, normalized, stride, offset) {\n if (capabilities.isWebGL2 === true && (type === 5124 || type === 5125)) {\n gl.vertexAttribIPointer(index, size, type, stride, offset);\n } else {\n gl.vertexAttribPointer(index, size, type, normalized, stride, offset);\n }\n }\n function setupVertexAttributes(object, material, program, geometry) {\n if (capabilities.isWebGL2 === false && (object.isInstancedMesh || geometry.isInstancedBufferGeometry)) {\n if (extensions.get('ANGLE_instanced_arrays') === null) return;\n }\n initAttributes();\n var geometryAttributes = geometry.attributes;\n var programAttributes = program.getAttributes();\n var materialDefaultAttributeValues = material.defaultAttributeValues;\n for (var name in programAttributes) {\n var programAttribute = programAttributes[name];\n if (programAttribute.location >= 0) {\n var geometryAttribute = geometryAttributes[name];\n if (geometryAttribute === undefined) {\n if (name === 'instanceMatrix' && object.instanceMatrix) geometryAttribute = object.instanceMatrix;\n if (name === 'instanceColor' && object.instanceColor) geometryAttribute = object.instanceColor;\n }\n if (geometryAttribute !== undefined) {\n var normalized = geometryAttribute.normalized;\n var size = geometryAttribute.itemSize;\n var attribute = attributes.get(geometryAttribute);\n\n // TODO Attribute may not be available on context restore\n\n if (attribute === undefined) continue;\n var buffer = attribute.buffer;\n var type = attribute.type;\n var bytesPerElement = attribute.bytesPerElement;\n if (geometryAttribute.isInterleavedBufferAttribute) {\n var data = geometryAttribute.data;\n var stride = data.stride;\n var offset = geometryAttribute.offset;\n if (data.isInstancedInterleavedBuffer) {\n for (var i = 0; i < programAttribute.locationSize; i++) {\n enableAttributeAndDivisor(programAttribute.location + i, data.meshPerAttribute);\n }\n if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) {\n geometry._maxInstanceCount = data.meshPerAttribute * data.count;\n }\n } else {\n for (var _i23 = 0; _i23 < programAttribute.locationSize; _i23++) {\n enableAttribute(programAttribute.location + _i23);\n }\n }\n gl.bindBuffer(34962, buffer);\n for (var _i24 = 0; _i24 < programAttribute.locationSize; _i24++) {\n vertexAttribPointer(programAttribute.location + _i24, size / programAttribute.locationSize, type, normalized, stride * bytesPerElement, (offset + size / programAttribute.locationSize * _i24) * bytesPerElement);\n }\n } else {\n if (geometryAttribute.isInstancedBufferAttribute) {\n for (var _i25 = 0; _i25 < programAttribute.locationSize; _i25++) {\n enableAttributeAndDivisor(programAttribute.location + _i25, geometryAttribute.meshPerAttribute);\n }\n if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) {\n geometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count;\n }\n } else {\n for (var _i26 = 0; _i26 < programAttribute.locationSize; _i26++) {\n enableAttribute(programAttribute.location + _i26);\n }\n }\n gl.bindBuffer(34962, buffer);\n for (var _i27 = 0; _i27 < programAttribute.locationSize; _i27++) {\n vertexAttribPointer(programAttribute.location + _i27, size / programAttribute.locationSize, type, normalized, size * bytesPerElement, size / programAttribute.locationSize * _i27 * bytesPerElement);\n }\n }\n } else if (materialDefaultAttributeValues !== undefined) {\n var _value2 = materialDefaultAttributeValues[name];\n if (_value2 !== undefined) {\n switch (_value2.length) {\n case 2:\n gl.vertexAttrib2fv(programAttribute.location, _value2);\n break;\n case 3:\n gl.vertexAttrib3fv(programAttribute.location, _value2);\n break;\n case 4:\n gl.vertexAttrib4fv(programAttribute.location, _value2);\n break;\n default:\n gl.vertexAttrib1fv(programAttribute.location, _value2);\n }\n }\n }\n }\n }\n disableUnusedAttributes();\n }\n function dispose() {\n reset();\n for (var geometryId in bindingStates) {\n var programMap = bindingStates[geometryId];\n for (var programId in programMap) {\n var stateMap = programMap[programId];\n for (var wireframe in stateMap) {\n deleteVertexArrayObject(stateMap[wireframe].object);\n delete stateMap[wireframe];\n }\n delete programMap[programId];\n }\n delete bindingStates[geometryId];\n }\n }\n function releaseStatesOfGeometry(geometry) {\n if (bindingStates[geometry.id] === undefined) return;\n var programMap = bindingStates[geometry.id];\n for (var programId in programMap) {\n var stateMap = programMap[programId];\n for (var wireframe in stateMap) {\n deleteVertexArrayObject(stateMap[wireframe].object);\n delete stateMap[wireframe];\n }\n delete programMap[programId];\n }\n delete bindingStates[geometry.id];\n }\n function releaseStatesOfProgram(program) {\n for (var geometryId in bindingStates) {\n var programMap = bindingStates[geometryId];\n if (programMap[program.id] === undefined) continue;\n var stateMap = programMap[program.id];\n for (var wireframe in stateMap) {\n deleteVertexArrayObject(stateMap[wireframe].object);\n delete stateMap[wireframe];\n }\n delete programMap[program.id];\n }\n }\n function reset() {\n resetDefaultState();\n forceUpdate = true;\n if (currentState === defaultState) return;\n currentState = defaultState;\n bindVertexArrayObject(currentState.object);\n }\n\n // for backward-compatibility\n\n function resetDefaultState() {\n defaultState.geometry = null;\n defaultState.program = null;\n defaultState.wireframe = false;\n }\n return {\n setup: setup,\n reset: reset,\n resetDefaultState: resetDefaultState,\n dispose: dispose,\n releaseStatesOfGeometry: releaseStatesOfGeometry,\n releaseStatesOfProgram: releaseStatesOfProgram,\n initAttributes: initAttributes,\n enableAttribute: enableAttribute,\n disableUnusedAttributes: disableUnusedAttributes\n };\n}\nfunction WebGLBufferRenderer(gl, extensions, info, capabilities) {\n var isWebGL2 = capabilities.isWebGL2;\n var mode;\n function setMode(value) {\n mode = value;\n }\n function render(start, count) {\n gl.drawArrays(mode, start, count);\n info.update(count, mode, 1);\n }\n function renderInstances(start, count, primcount) {\n if (primcount === 0) return;\n var extension, methodName;\n if (isWebGL2) {\n extension = gl;\n methodName = 'drawArraysInstanced';\n } else {\n extension = extensions.get('ANGLE_instanced_arrays');\n methodName = 'drawArraysInstancedANGLE';\n if (extension === null) {\n console.error('THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.');\n return;\n }\n }\n extension[methodName](mode, start, count, primcount);\n info.update(count, mode, primcount);\n }\n\n //\n\n this.setMode = setMode;\n this.render = render;\n this.renderInstances = renderInstances;\n}\nfunction WebGLCapabilities(gl, extensions, parameters) {\n var maxAnisotropy;\n function getMaxAnisotropy() {\n if (maxAnisotropy !== undefined) return maxAnisotropy;\n if (extensions.has('EXT_texture_filter_anisotropic') === true) {\n var extension = extensions.get('EXT_texture_filter_anisotropic');\n maxAnisotropy = gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT);\n } else {\n maxAnisotropy = 0;\n }\n return maxAnisotropy;\n }\n function getMaxPrecision(precision) {\n if (precision === 'highp') {\n if (gl.getShaderPrecisionFormat(35633, 36338).precision > 0 && gl.getShaderPrecisionFormat(35632, 36338).precision > 0) {\n return 'highp';\n }\n precision = 'mediump';\n }\n if (precision === 'mediump') {\n if (gl.getShaderPrecisionFormat(35633, 36337).precision > 0 && gl.getShaderPrecisionFormat(35632, 36337).precision > 0) {\n return 'mediump';\n }\n }\n return 'lowp';\n }\n var isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl.constructor.name === 'WebGL2RenderingContext';\n var precision = parameters.precision !== undefined ? parameters.precision : 'highp';\n var maxPrecision = getMaxPrecision(precision);\n if (maxPrecision !== precision) {\n console.warn('THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.');\n precision = maxPrecision;\n }\n var drawBuffers = isWebGL2 || extensions.has('WEBGL_draw_buffers');\n var logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;\n var maxTextures = gl.getParameter(34930);\n var maxVertexTextures = gl.getParameter(35660);\n var maxTextureSize = gl.getParameter(3379);\n var maxCubemapSize = gl.getParameter(34076);\n var maxAttributes = gl.getParameter(34921);\n var maxVertexUniforms = gl.getParameter(36347);\n var maxVaryings = gl.getParameter(36348);\n var maxFragmentUniforms = gl.getParameter(36349);\n var vertexTextures = maxVertexTextures > 0;\n var floatFragmentTextures = isWebGL2 || extensions.has('OES_texture_float');\n var floatVertexTextures = vertexTextures && floatFragmentTextures;\n var maxSamples = isWebGL2 ? gl.getParameter(36183) : 0;\n return {\n isWebGL2: isWebGL2,\n drawBuffers: drawBuffers,\n getMaxAnisotropy: getMaxAnisotropy,\n getMaxPrecision: getMaxPrecision,\n precision: precision,\n logarithmicDepthBuffer: logarithmicDepthBuffer,\n maxTextures: maxTextures,\n maxVertexTextures: maxVertexTextures,\n maxTextureSize: maxTextureSize,\n maxCubemapSize: maxCubemapSize,\n maxAttributes: maxAttributes,\n maxVertexUniforms: maxVertexUniforms,\n maxVaryings: maxVaryings,\n maxFragmentUniforms: maxFragmentUniforms,\n vertexTextures: vertexTextures,\n floatFragmentTextures: floatFragmentTextures,\n floatVertexTextures: floatVertexTextures,\n maxSamples: maxSamples\n };\n}\nfunction WebGLClipping(properties) {\n var scope = this;\n var globalState = null,\n numGlobalPlanes = 0,\n localClippingEnabled = false,\n renderingShadows = false;\n var plane = new Plane(),\n viewNormalMatrix = new Matrix3(),\n uniform = {\n value: null,\n needsUpdate: false\n };\n this.uniform = uniform;\n this.numPlanes = 0;\n this.numIntersection = 0;\n this.init = function (planes, enableLocalClipping) {\n var enabled = planes.length !== 0 || enableLocalClipping ||\n // enable state of previous frame - the clipping code has to\n // run another frame in order to reset the state:\n numGlobalPlanes !== 0 || localClippingEnabled;\n localClippingEnabled = enableLocalClipping;\n numGlobalPlanes = planes.length;\n return enabled;\n };\n this.beginShadows = function () {\n renderingShadows = true;\n projectPlanes(null);\n };\n this.endShadows = function () {\n renderingShadows = false;\n };\n this.setGlobalState = function (planes, camera) {\n globalState = projectPlanes(planes, camera, 0);\n };\n this.setState = function (material, camera, useCache) {\n var planes = material.clippingPlanes,\n clipIntersection = material.clipIntersection,\n clipShadows = material.clipShadows;\n var materialProperties = properties.get(material);\n if (!localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && !clipShadows) {\n // there's no local clipping\n\n if (renderingShadows) {\n // there's no global clipping\n\n projectPlanes(null);\n } else {\n resetGlobalState();\n }\n } else {\n var nGlobal = renderingShadows ? 0 : numGlobalPlanes,\n lGlobal = nGlobal * 4;\n var dstArray = materialProperties.clippingState || null;\n uniform.value = dstArray; // ensure unique state\n\n dstArray = projectPlanes(planes, camera, lGlobal, useCache);\n for (var i = 0; i !== lGlobal; ++i) {\n dstArray[i] = globalState[i];\n }\n materialProperties.clippingState = dstArray;\n this.numIntersection = clipIntersection ? this.numPlanes : 0;\n this.numPlanes += nGlobal;\n }\n };\n function resetGlobalState() {\n if (uniform.value !== globalState) {\n uniform.value = globalState;\n uniform.needsUpdate = numGlobalPlanes > 0;\n }\n scope.numPlanes = numGlobalPlanes;\n scope.numIntersection = 0;\n }\n function projectPlanes(planes, camera, dstOffset, skipTransform) {\n var nPlanes = planes !== null ? planes.length : 0;\n var dstArray = null;\n if (nPlanes !== 0) {\n dstArray = uniform.value;\n if (skipTransform !== true || dstArray === null) {\n var flatSize = dstOffset + nPlanes * 4,\n viewMatrix = camera.matrixWorldInverse;\n viewNormalMatrix.getNormalMatrix(viewMatrix);\n if (dstArray === null || dstArray.length < flatSize) {\n dstArray = new Float32Array(flatSize);\n }\n for (var i = 0, i4 = dstOffset; i !== nPlanes; ++i, i4 += 4) {\n plane.copy(planes[i]).applyMatrix4(viewMatrix, viewNormalMatrix);\n plane.normal.toArray(dstArray, i4);\n dstArray[i4 + 3] = plane.constant;\n }\n }\n uniform.value = dstArray;\n uniform.needsUpdate = true;\n }\n scope.numPlanes = nPlanes;\n scope.numIntersection = 0;\n return dstArray;\n }\n}\nfunction WebGLCubeMaps(renderer) {\n var cubemaps = new WeakMap();\n function mapTextureMapping(texture, mapping) {\n if (mapping === EquirectangularReflectionMapping) {\n texture.mapping = CubeReflectionMapping;\n } else if (mapping === EquirectangularRefractionMapping) {\n texture.mapping = CubeRefractionMapping;\n }\n return texture;\n }\n function get(texture) {\n if (texture && texture.isTexture && texture.isRenderTargetTexture === false) {\n var mapping = texture.mapping;\n if (mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping) {\n if (cubemaps.has(texture)) {\n var cubemap = cubemaps.get(texture).texture;\n return mapTextureMapping(cubemap, texture.mapping);\n } else {\n var image = texture.image;\n if (image && image.height > 0) {\n var renderTarget = new WebGLCubeRenderTarget(image.height / 2);\n renderTarget.fromEquirectangularTexture(renderer, texture);\n cubemaps.set(texture, renderTarget);\n texture.addEventListener('dispose', onTextureDispose);\n return mapTextureMapping(renderTarget.texture, texture.mapping);\n } else {\n // image not yet ready. try the conversion next frame\n\n return null;\n }\n }\n }\n }\n return texture;\n }\n function onTextureDispose(event) {\n var texture = event.target;\n texture.removeEventListener('dispose', onTextureDispose);\n var cubemap = cubemaps.get(texture);\n if (cubemap !== undefined) {\n cubemaps[\"delete\"](texture);\n cubemap.dispose();\n }\n }\n function dispose() {\n cubemaps = new WeakMap();\n }\n return {\n get: get,\n dispose: dispose\n };\n}\nvar OrthographicCamera = /*#__PURE__*/function (_Camera2) {\n _inherits(OrthographicCamera, _Camera2);\n var _super31 = _createSuper(OrthographicCamera);\n function OrthographicCamera() {\n var _this23;\n var left = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;\n var right = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var top = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var bottom = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1;\n var near = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0.1;\n var far = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 2000;\n _classCallCheck(this, OrthographicCamera);\n _this23 = _super31.call(this);\n _this23.isOrthographicCamera = true;\n _this23.type = 'OrthographicCamera';\n _this23.zoom = 1;\n _this23.view = null;\n _this23.left = left;\n _this23.right = right;\n _this23.top = top;\n _this23.bottom = bottom;\n _this23.near = near;\n _this23.far = far;\n _this23.updateProjectionMatrix();\n return _this23;\n }\n _createClass(OrthographicCamera, [{\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(OrthographicCamera.prototype), \"copy\", this).call(this, source, recursive);\n this.left = source.left;\n this.right = source.right;\n this.top = source.top;\n this.bottom = source.bottom;\n this.near = source.near;\n this.far = source.far;\n this.zoom = source.zoom;\n this.view = source.view === null ? null : Object.assign({}, source.view);\n return this;\n }\n }, {\n key: \"setViewOffset\",\n value: function setViewOffset(fullWidth, fullHeight, x, y, width, height) {\n if (this.view === null) {\n this.view = {\n enabled: true,\n fullWidth: 1,\n fullHeight: 1,\n offsetX: 0,\n offsetY: 0,\n width: 1,\n height: 1\n };\n }\n this.view.enabled = true;\n this.view.fullWidth = fullWidth;\n this.view.fullHeight = fullHeight;\n this.view.offsetX = x;\n this.view.offsetY = y;\n this.view.width = width;\n this.view.height = height;\n this.updateProjectionMatrix();\n }\n }, {\n key: \"clearViewOffset\",\n value: function clearViewOffset() {\n if (this.view !== null) {\n this.view.enabled = false;\n }\n this.updateProjectionMatrix();\n }\n }, {\n key: \"updateProjectionMatrix\",\n value: function updateProjectionMatrix() {\n var dx = (this.right - this.left) / (2 * this.zoom);\n var dy = (this.top - this.bottom) / (2 * this.zoom);\n var cx = (this.right + this.left) / 2;\n var cy = (this.top + this.bottom) / 2;\n var left = cx - dx;\n var right = cx + dx;\n var top = cy + dy;\n var bottom = cy - dy;\n if (this.view !== null && this.view.enabled) {\n var scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom;\n var scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom;\n left += scaleW * this.view.offsetX;\n right = left + scaleW * this.view.width;\n top -= scaleH * this.view.offsetY;\n bottom = top - scaleH * this.view.height;\n }\n this.projectionMatrix.makeOrthographic(left, right, top, bottom, this.near, this.far);\n this.projectionMatrixInverse.copy(this.projectionMatrix).invert();\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(meta) {\n var data = _get(_getPrototypeOf(OrthographicCamera.prototype), \"toJSON\", this).call(this, meta);\n data.object.zoom = this.zoom;\n data.object.left = this.left;\n data.object.right = this.right;\n data.object.top = this.top;\n data.object.bottom = this.bottom;\n data.object.near = this.near;\n data.object.far = this.far;\n if (this.view !== null) data.object.view = Object.assign({}, this.view);\n return data;\n }\n }]);\n return OrthographicCamera;\n}(Camera);\nvar LOD_MIN = 4;\n\n// The standard deviations (radians) associated with the extra mips. These are\n// chosen to approximate a Trowbridge-Reitz distribution function times the\n// geometric shadowing function. These sigma values squared must match the\n// variance #defines in cube_uv_reflection_fragment.glsl.js.\nvar EXTRA_LOD_SIGMA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582];\n\n// The maximum length of the blur for loop. Smaller sigmas will use fewer\n// samples and exit early, but not recompile the shader.\nvar MAX_SAMPLES = 20;\nvar _flatCamera = /*@__PURE__*/new OrthographicCamera();\nvar _clearColor = /*@__PURE__*/new Color();\nvar _oldTarget = null;\n\n// Golden Ratio\nvar PHI = (1 + Math.sqrt(5)) / 2;\nvar INV_PHI = 1 / PHI;\n\n// Vertices of a dodecahedron (except the opposites, which represent the\n// same axis), used as axis directions evenly spread on a sphere.\nvar _axisDirections = [/*@__PURE__*/new Vector3(1, 1, 1), /*@__PURE__*/new Vector3(-1, 1, 1), /*@__PURE__*/new Vector3(1, 1, -1), /*@__PURE__*/new Vector3(-1, 1, -1), /*@__PURE__*/new Vector3(0, PHI, INV_PHI), /*@__PURE__*/new Vector3(0, PHI, -INV_PHI), /*@__PURE__*/new Vector3(INV_PHI, 0, PHI), /*@__PURE__*/new Vector3(-INV_PHI, 0, PHI), /*@__PURE__*/new Vector3(PHI, INV_PHI, 0), /*@__PURE__*/new Vector3(-PHI, INV_PHI, 0)];\n\n/**\n * This class generates a Prefiltered, Mipmapped Radiance Environment Map\n * (PMREM) from a cubeMap environment texture. This allows different levels of\n * blur to be quickly accessed based on material roughness. It is packed into a\n * special CubeUV format that allows us to perform custom interpolation so that\n * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap\n * chain, it only goes down to the LOD_MIN level (above), and then creates extra\n * even more filtered 'mips' at the same LOD_MIN resolution, associated with\n * higher roughness levels. In this way we maintain resolution to smoothly\n * interpolate diffuse lighting while limiting sampling computation.\n *\n * Paper: Fast, Accurate Image-Based Lighting\n * https://drive.google.com/file/d/15y8r_UpKlU9SvV4ILb0C3qCPecS8pvLz/view\n*/\nvar PMREMGenerator = /*#__PURE__*/function () {\n function PMREMGenerator(renderer) {\n _classCallCheck(this, PMREMGenerator);\n this._renderer = renderer;\n this._pingPongRenderTarget = null;\n this._lodMax = 0;\n this._cubeSize = 0;\n this._lodPlanes = [];\n this._sizeLods = [];\n this._sigmas = [];\n this._blurMaterial = null;\n this._cubemapMaterial = null;\n this._equirectMaterial = null;\n this._compileMaterial(this._blurMaterial);\n }\n\n /**\n * Generates a PMREM from a supplied Scene, which can be faster than using an\n * image if networking bandwidth is low. Optional sigma specifies a blur radius\n * in radians to be applied to the scene before PMREM generation. Optional near\n * and far planes ensure the scene is rendered in its entirety (the cubeCamera\n * is placed at the origin).\n */\n _createClass(PMREMGenerator, [{\n key: \"fromScene\",\n value: function fromScene(scene) {\n var sigma = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var near = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1;\n var far = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 100;\n _oldTarget = this._renderer.getRenderTarget();\n this._setSize(256);\n var cubeUVRenderTarget = this._allocateTargets();\n cubeUVRenderTarget.depthBuffer = true;\n this._sceneToCubeUV(scene, near, far, cubeUVRenderTarget);\n if (sigma > 0) {\n this._blur(cubeUVRenderTarget, 0, 0, sigma);\n }\n this._applyPMREM(cubeUVRenderTarget);\n this._cleanup(cubeUVRenderTarget);\n return cubeUVRenderTarget;\n }\n\n /**\n * Generates a PMREM from an equirectangular texture, which can be either LDR\n * or HDR. The ideal input image size is 1k (1024 x 512),\n * as this matches best with the 256 x 256 cubemap output.\n */\n }, {\n key: \"fromEquirectangular\",\n value: function fromEquirectangular(equirectangular) {\n var renderTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return this._fromTexture(equirectangular, renderTarget);\n }\n\n /**\n * Generates a PMREM from an cubemap texture, which can be either LDR\n * or HDR. The ideal input cube size is 256 x 256,\n * as this matches best with the 256 x 256 cubemap output.\n */\n }, {\n key: \"fromCubemap\",\n value: function fromCubemap(cubemap) {\n var renderTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return this._fromTexture(cubemap, renderTarget);\n }\n\n /**\n * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during\n * your texture's network fetch for increased concurrency.\n */\n }, {\n key: \"compileCubemapShader\",\n value: function compileCubemapShader() {\n if (this._cubemapMaterial === null) {\n this._cubemapMaterial = _getCubemapMaterial();\n this._compileMaterial(this._cubemapMaterial);\n }\n }\n\n /**\n * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during\n * your texture's network fetch for increased concurrency.\n */\n }, {\n key: \"compileEquirectangularShader\",\n value: function compileEquirectangularShader() {\n if (this._equirectMaterial === null) {\n this._equirectMaterial = _getEquirectMaterial();\n this._compileMaterial(this._equirectMaterial);\n }\n }\n\n /**\n * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class,\n * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on\n * one of them will cause any others to also become unusable.\n */\n }, {\n key: \"dispose\",\n value: function dispose() {\n this._dispose();\n if (this._cubemapMaterial !== null) this._cubemapMaterial.dispose();\n if (this._equirectMaterial !== null) this._equirectMaterial.dispose();\n }\n\n // private interface\n }, {\n key: \"_setSize\",\n value: function _setSize(cubeSize) {\n this._lodMax = Math.floor(Math.log2(cubeSize));\n this._cubeSize = Math.pow(2, this._lodMax);\n }\n }, {\n key: \"_dispose\",\n value: function _dispose() {\n if (this._blurMaterial !== null) this._blurMaterial.dispose();\n if (this._pingPongRenderTarget !== null) this._pingPongRenderTarget.dispose();\n for (var i = 0; i < this._lodPlanes.length; i++) {\n this._lodPlanes[i].dispose();\n }\n }\n }, {\n key: \"_cleanup\",\n value: function _cleanup(outputTarget) {\n this._renderer.setRenderTarget(_oldTarget);\n outputTarget.scissorTest = false;\n _setViewport(outputTarget, 0, 0, outputTarget.width, outputTarget.height);\n }\n }, {\n key: \"_fromTexture\",\n value: function _fromTexture(texture, renderTarget) {\n if (texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping) {\n this._setSize(texture.image.length === 0 ? 16 : texture.image[0].width || texture.image[0].image.width);\n } else {\n // Equirectangular\n\n this._setSize(texture.image.width / 4);\n }\n _oldTarget = this._renderer.getRenderTarget();\n var cubeUVRenderTarget = renderTarget || this._allocateTargets();\n this._textureToCubeUV(texture, cubeUVRenderTarget);\n this._applyPMREM(cubeUVRenderTarget);\n this._cleanup(cubeUVRenderTarget);\n return cubeUVRenderTarget;\n }\n }, {\n key: \"_allocateTargets\",\n value: function _allocateTargets() {\n var width = 3 * Math.max(this._cubeSize, 16 * 7);\n var height = 4 * this._cubeSize;\n var params = {\n magFilter: LinearFilter,\n minFilter: LinearFilter,\n generateMipmaps: false,\n type: HalfFloatType,\n format: RGBAFormat,\n encoding: LinearEncoding,\n depthBuffer: false\n };\n var cubeUVRenderTarget = _createRenderTarget(width, height, params);\n if (this._pingPongRenderTarget === null || this._pingPongRenderTarget.width !== width || this._pingPongRenderTarget.height !== height) {\n if (this._pingPongRenderTarget !== null) {\n this._dispose();\n }\n this._pingPongRenderTarget = _createRenderTarget(width, height, params);\n var _lodMax = this._lodMax;\n var _createPlanes2 = _createPlanes(_lodMax);\n this._sizeLods = _createPlanes2.sizeLods;\n this._lodPlanes = _createPlanes2.lodPlanes;\n this._sigmas = _createPlanes2.sigmas;\n this._blurMaterial = _getBlurShader(_lodMax, width, height);\n }\n return cubeUVRenderTarget;\n }\n }, {\n key: \"_compileMaterial\",\n value: function _compileMaterial(material) {\n var tmpMesh = new Mesh(this._lodPlanes[0], material);\n this._renderer.compile(tmpMesh, _flatCamera);\n }\n }, {\n key: \"_sceneToCubeUV\",\n value: function _sceneToCubeUV(scene, near, far, cubeUVRenderTarget) {\n var fov = 90;\n var aspect = 1;\n var cubeCamera = new PerspectiveCamera(fov, aspect, near, far);\n var upSign = [1, -1, 1, 1, 1, 1];\n var forwardSign = [1, 1, 1, -1, -1, -1];\n var renderer = this._renderer;\n var originalAutoClear = renderer.autoClear;\n var toneMapping = renderer.toneMapping;\n renderer.getClearColor(_clearColor);\n renderer.toneMapping = NoToneMapping;\n renderer.autoClear = false;\n var backgroundMaterial = new MeshBasicMaterial({\n name: 'PMREM.Background',\n side: BackSide,\n depthWrite: false,\n depthTest: false\n });\n var backgroundBox = new Mesh(new BoxGeometry(), backgroundMaterial);\n var useSolidColor = false;\n var background = scene.background;\n if (background) {\n if (background.isColor) {\n backgroundMaterial.color.copy(background);\n scene.background = null;\n useSolidColor = true;\n }\n } else {\n backgroundMaterial.color.copy(_clearColor);\n useSolidColor = true;\n }\n for (var i = 0; i < 6; i++) {\n var col = i % 3;\n if (col === 0) {\n cubeCamera.up.set(0, upSign[i], 0);\n cubeCamera.lookAt(forwardSign[i], 0, 0);\n } else if (col === 1) {\n cubeCamera.up.set(0, 0, upSign[i]);\n cubeCamera.lookAt(0, forwardSign[i], 0);\n } else {\n cubeCamera.up.set(0, upSign[i], 0);\n cubeCamera.lookAt(0, 0, forwardSign[i]);\n }\n var size = this._cubeSize;\n _setViewport(cubeUVRenderTarget, col * size, i > 2 ? size : 0, size, size);\n renderer.setRenderTarget(cubeUVRenderTarget);\n if (useSolidColor) {\n renderer.render(backgroundBox, cubeCamera);\n }\n renderer.render(scene, cubeCamera);\n }\n backgroundBox.geometry.dispose();\n backgroundBox.material.dispose();\n renderer.toneMapping = toneMapping;\n renderer.autoClear = originalAutoClear;\n scene.background = background;\n }\n }, {\n key: \"_textureToCubeUV\",\n value: function _textureToCubeUV(texture, cubeUVRenderTarget) {\n var renderer = this._renderer;\n var isCubeTexture = texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping;\n if (isCubeTexture) {\n if (this._cubemapMaterial === null) {\n this._cubemapMaterial = _getCubemapMaterial();\n }\n this._cubemapMaterial.uniforms.flipEnvMap.value = texture.isRenderTargetTexture === false ? -1 : 1;\n } else {\n if (this._equirectMaterial === null) {\n this._equirectMaterial = _getEquirectMaterial();\n }\n }\n var material = isCubeTexture ? this._cubemapMaterial : this._equirectMaterial;\n var mesh = new Mesh(this._lodPlanes[0], material);\n var uniforms = material.uniforms;\n uniforms['envMap'].value = texture;\n var size = this._cubeSize;\n _setViewport(cubeUVRenderTarget, 0, 0, 3 * size, 2 * size);\n renderer.setRenderTarget(cubeUVRenderTarget);\n renderer.render(mesh, _flatCamera);\n }\n }, {\n key: \"_applyPMREM\",\n value: function _applyPMREM(cubeUVRenderTarget) {\n var renderer = this._renderer;\n var autoClear = renderer.autoClear;\n renderer.autoClear = false;\n for (var i = 1; i < this._lodPlanes.length; i++) {\n var sigma = Math.sqrt(this._sigmas[i] * this._sigmas[i] - this._sigmas[i - 1] * this._sigmas[i - 1]);\n var poleAxis = _axisDirections[(i - 1) % _axisDirections.length];\n this._blur(cubeUVRenderTarget, i - 1, i, sigma, poleAxis);\n }\n renderer.autoClear = autoClear;\n }\n\n /**\n * This is a two-pass Gaussian blur for a cubemap. Normally this is done\n * vertically and horizontally, but this breaks down on a cube. Here we apply\n * the blur latitudinally (around the poles), and then longitudinally (towards\n * the poles) to approximate the orthogonally-separable blur. It is least\n * accurate at the poles, but still does a decent job.\n */\n }, {\n key: \"_blur\",\n value: function _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) {\n var pingPongRenderTarget = this._pingPongRenderTarget;\n this._halfBlur(cubeUVRenderTarget, pingPongRenderTarget, lodIn, lodOut, sigma, 'latitudinal', poleAxis);\n this._halfBlur(pingPongRenderTarget, cubeUVRenderTarget, lodOut, lodOut, sigma, 'longitudinal', poleAxis);\n }\n }, {\n key: \"_halfBlur\",\n value: function _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) {\n var renderer = this._renderer;\n var blurMaterial = this._blurMaterial;\n if (direction !== 'latitudinal' && direction !== 'longitudinal') {\n console.error('blur direction must be either latitudinal or longitudinal!');\n }\n\n // Number of standard deviations at which to cut off the discrete approximation.\n var STANDARD_DEVIATIONS = 3;\n var blurMesh = new Mesh(this._lodPlanes[lodOut], blurMaterial);\n var blurUniforms = blurMaterial.uniforms;\n var pixels = this._sizeLods[lodIn] - 1;\n var radiansPerPixel = isFinite(sigmaRadians) ? Math.PI / (2 * pixels) : 2 * Math.PI / (2 * MAX_SAMPLES - 1);\n var sigmaPixels = sigmaRadians / radiansPerPixel;\n var samples = isFinite(sigmaRadians) ? 1 + Math.floor(STANDARD_DEVIATIONS * sigmaPixels) : MAX_SAMPLES;\n if (samples > MAX_SAMPLES) {\n console.warn(\"sigmaRadians, \".concat(sigmaRadians, \", is too large and will clip, as it requested \").concat(samples, \" samples when the maximum is set to \").concat(MAX_SAMPLES));\n }\n var weights = [];\n var sum = 0;\n for (var i = 0; i < MAX_SAMPLES; ++i) {\n var _x2 = i / sigmaPixels;\n var weight = Math.exp(-_x2 * _x2 / 2);\n weights.push(weight);\n if (i === 0) {\n sum += weight;\n } else if (i < samples) {\n sum += 2 * weight;\n }\n }\n for (var _i28 = 0; _i28 < weights.length; _i28++) {\n weights[_i28] = weights[_i28] / sum;\n }\n blurUniforms['envMap'].value = targetIn.texture;\n blurUniforms['samples'].value = samples;\n blurUniforms['weights'].value = weights;\n blurUniforms['latitudinal'].value = direction === 'latitudinal';\n if (poleAxis) {\n blurUniforms['poleAxis'].value = poleAxis;\n }\n var _lodMax = this._lodMax;\n blurUniforms['dTheta'].value = radiansPerPixel;\n blurUniforms['mipInt'].value = _lodMax - lodIn;\n var outputSize = this._sizeLods[lodOut];\n var x = 3 * outputSize * (lodOut > _lodMax - LOD_MIN ? lodOut - _lodMax + LOD_MIN : 0);\n var y = 4 * (this._cubeSize - outputSize);\n _setViewport(targetOut, x, y, 3 * outputSize, 2 * outputSize);\n renderer.setRenderTarget(targetOut);\n renderer.render(blurMesh, _flatCamera);\n }\n }]);\n return PMREMGenerator;\n}();\nfunction _createPlanes(lodMax) {\n var lodPlanes = [];\n var sizeLods = [];\n var sigmas = [];\n var lod = lodMax;\n var totalLods = lodMax - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length;\n for (var i = 0; i < totalLods; i++) {\n var sizeLod = Math.pow(2, lod);\n sizeLods.push(sizeLod);\n var sigma = 1.0 / sizeLod;\n if (i > lodMax - LOD_MIN) {\n sigma = EXTRA_LOD_SIGMA[i - lodMax + LOD_MIN - 1];\n } else if (i === 0) {\n sigma = 0;\n }\n sigmas.push(sigma);\n var texelSize = 1.0 / (sizeLod - 2);\n var min = -texelSize;\n var max = 1 + texelSize;\n var uv1 = [min, min, max, min, max, max, min, min, max, max, min, max];\n var cubeFaces = 6;\n var vertices = 6;\n var positionSize = 3;\n var uvSize = 2;\n var faceIndexSize = 1;\n var position = new Float32Array(positionSize * vertices * cubeFaces);\n var uv = new Float32Array(uvSize * vertices * cubeFaces);\n var faceIndex = new Float32Array(faceIndexSize * vertices * cubeFaces);\n for (var face = 0; face < cubeFaces; face++) {\n var x = face % 3 * 2 / 3 - 1;\n var y = face > 2 ? 0 : -1;\n var coordinates = [x, y, 0, x + 2 / 3, y, 0, x + 2 / 3, y + 1, 0, x, y, 0, x + 2 / 3, y + 1, 0, x, y + 1, 0];\n position.set(coordinates, positionSize * vertices * face);\n uv.set(uv1, uvSize * vertices * face);\n var fill = [face, face, face, face, face, face];\n faceIndex.set(fill, faceIndexSize * vertices * face);\n }\n var planes = new BufferGeometry();\n planes.setAttribute('position', new BufferAttribute(position, positionSize));\n planes.setAttribute('uv', new BufferAttribute(uv, uvSize));\n planes.setAttribute('faceIndex', new BufferAttribute(faceIndex, faceIndexSize));\n lodPlanes.push(planes);\n if (lod > LOD_MIN) {\n lod--;\n }\n }\n return {\n lodPlanes: lodPlanes,\n sizeLods: sizeLods,\n sigmas: sigmas\n };\n}\nfunction _createRenderTarget(width, height, params) {\n var cubeUVRenderTarget = new WebGLRenderTarget(width, height, params);\n cubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping;\n cubeUVRenderTarget.texture.name = 'PMREM.cubeUv';\n cubeUVRenderTarget.scissorTest = true;\n return cubeUVRenderTarget;\n}\nfunction _setViewport(target, x, y, width, height) {\n target.viewport.set(x, y, width, height);\n target.scissor.set(x, y, width, height);\n}\nfunction _getBlurShader(lodMax, width, height) {\n var weights = new Float32Array(MAX_SAMPLES);\n var poleAxis = new Vector3(0, 1, 0);\n var shaderMaterial = new ShaderMaterial({\n name: 'SphericalGaussianBlur',\n defines: {\n 'n': MAX_SAMPLES,\n 'CUBEUV_TEXEL_WIDTH': 1.0 / width,\n 'CUBEUV_TEXEL_HEIGHT': 1.0 / height,\n 'CUBEUV_MAX_MIP': \"\".concat(lodMax, \".0\")\n },\n uniforms: {\n 'envMap': {\n value: null\n },\n 'samples': {\n value: 1\n },\n 'weights': {\n value: weights\n },\n 'latitudinal': {\n value: false\n },\n 'dTheta': {\n value: 0\n },\n 'mipInt': {\n value: 0\n },\n 'poleAxis': {\n value: poleAxis\n }\n },\n vertexShader: _getCommonVertexShader(),\n fragmentShader: /* glsl */\"\\n\\n\\t\\t\\tprecision mediump float;\\n\\t\\t\\tprecision mediump int;\\n\\n\\t\\t\\tvarying vec3 vOutputDirection;\\n\\n\\t\\t\\tuniform sampler2D envMap;\\n\\t\\t\\tuniform int samples;\\n\\t\\t\\tuniform float weights[ n ];\\n\\t\\t\\tuniform bool latitudinal;\\n\\t\\t\\tuniform float dTheta;\\n\\t\\t\\tuniform float mipInt;\\n\\t\\t\\tuniform vec3 poleAxis;\\n\\n\\t\\t\\t#define ENVMAP_TYPE_CUBE_UV\\n\\t\\t\\t#include \\n\\n\\t\\t\\tvec3 getSample( float theta, vec3 axis ) {\\n\\n\\t\\t\\t\\tfloat cosTheta = cos( theta );\\n\\t\\t\\t\\t// Rodrigues' axis-angle rotation\\n\\t\\t\\t\\tvec3 sampleDirection = vOutputDirection * cosTheta\\n\\t\\t\\t\\t\\t+ cross( axis, vOutputDirection ) * sin( theta )\\n\\t\\t\\t\\t\\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\\n\\n\\t\\t\\t\\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\\n\\n\\t\\t\\t}\\n\\n\\t\\t\\tvoid main() {\\n\\n\\t\\t\\t\\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\\n\\n\\t\\t\\t\\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\\n\\n\\t\\t\\t\\t\\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\\n\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\taxis = normalize( axis );\\n\\n\\t\\t\\t\\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\\n\\t\\t\\t\\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\\n\\n\\t\\t\\t\\tfor ( int i = 1; i < n; i++ ) {\\n\\n\\t\\t\\t\\t\\tif ( i >= samples ) {\\n\\n\\t\\t\\t\\t\\t\\tbreak;\\n\\n\\t\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\t\\tfloat theta = dTheta * float( i );\\n\\t\\t\\t\\t\\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\\n\\t\\t\\t\\t\\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\\n\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t}\\n\\t\\t\",\n blending: NoBlending,\n depthTest: false,\n depthWrite: false\n });\n return shaderMaterial;\n}\nfunction _getEquirectMaterial() {\n return new ShaderMaterial({\n name: 'EquirectangularToCubeUV',\n uniforms: {\n 'envMap': {\n value: null\n }\n },\n vertexShader: _getCommonVertexShader(),\n fragmentShader: /* glsl */\"\\n\\n\\t\\t\\tprecision mediump float;\\n\\t\\t\\tprecision mediump int;\\n\\n\\t\\t\\tvarying vec3 vOutputDirection;\\n\\n\\t\\t\\tuniform sampler2D envMap;\\n\\n\\t\\t\\t#include \\n\\n\\t\\t\\tvoid main() {\\n\\n\\t\\t\\t\\tvec3 outputDirection = normalize( vOutputDirection );\\n\\t\\t\\t\\tvec2 uv = equirectUv( outputDirection );\\n\\n\\t\\t\\t\\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\\n\\n\\t\\t\\t}\\n\\t\\t\",\n blending: NoBlending,\n depthTest: false,\n depthWrite: false\n });\n}\nfunction _getCubemapMaterial() {\n return new ShaderMaterial({\n name: 'CubemapToCubeUV',\n uniforms: {\n 'envMap': {\n value: null\n },\n 'flipEnvMap': {\n value: -1\n }\n },\n vertexShader: _getCommonVertexShader(),\n fragmentShader: /* glsl */\"\\n\\n\\t\\t\\tprecision mediump float;\\n\\t\\t\\tprecision mediump int;\\n\\n\\t\\t\\tuniform float flipEnvMap;\\n\\n\\t\\t\\tvarying vec3 vOutputDirection;\\n\\n\\t\\t\\tuniform samplerCube envMap;\\n\\n\\t\\t\\tvoid main() {\\n\\n\\t\\t\\t\\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\\n\\n\\t\\t\\t}\\n\\t\\t\",\n blending: NoBlending,\n depthTest: false,\n depthWrite: false\n });\n}\nfunction _getCommonVertexShader() {\n return (/* glsl */\"\\n\\n\\t\\tprecision mediump float;\\n\\t\\tprecision mediump int;\\n\\n\\t\\tattribute float faceIndex;\\n\\n\\t\\tvarying vec3 vOutputDirection;\\n\\n\\t\\t// RH coordinate system; PMREM face-indexing convention\\n\\t\\tvec3 getDirection( vec2 uv, float face ) {\\n\\n\\t\\t\\tuv = 2.0 * uv - 1.0;\\n\\n\\t\\t\\tvec3 direction = vec3( uv, 1.0 );\\n\\n\\t\\t\\tif ( face == 0.0 ) {\\n\\n\\t\\t\\t\\tdirection = direction.zyx; // ( 1, v, u ) pos x\\n\\n\\t\\t\\t} else if ( face == 1.0 ) {\\n\\n\\t\\t\\t\\tdirection = direction.xzy;\\n\\t\\t\\t\\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\\n\\n\\t\\t\\t} else if ( face == 2.0 ) {\\n\\n\\t\\t\\t\\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\\n\\n\\t\\t\\t} else if ( face == 3.0 ) {\\n\\n\\t\\t\\t\\tdirection = direction.zyx;\\n\\t\\t\\t\\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\\n\\n\\t\\t\\t} else if ( face == 4.0 ) {\\n\\n\\t\\t\\t\\tdirection = direction.xzy;\\n\\t\\t\\t\\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\\n\\n\\t\\t\\t} else if ( face == 5.0 ) {\\n\\n\\t\\t\\t\\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\\n\\n\\t\\t\\t}\\n\\n\\t\\t\\treturn direction;\\n\\n\\t\\t}\\n\\n\\t\\tvoid main() {\\n\\n\\t\\t\\tvOutputDirection = getDirection( uv, faceIndex );\\n\\t\\t\\tgl_Position = vec4( position, 1.0 );\\n\\n\\t\\t}\\n\\t\"\n );\n}\nfunction WebGLCubeUVMaps(renderer) {\n var cubeUVmaps = new WeakMap();\n var pmremGenerator = null;\n function get(texture) {\n if (texture && texture.isTexture) {\n var mapping = texture.mapping;\n var isEquirectMap = mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping;\n var isCubeMap = mapping === CubeReflectionMapping || mapping === CubeRefractionMapping;\n\n // equirect/cube map to cubeUV conversion\n\n if (isEquirectMap || isCubeMap) {\n if (texture.isRenderTargetTexture && texture.needsPMREMUpdate === true) {\n texture.needsPMREMUpdate = false;\n var renderTarget = cubeUVmaps.get(texture);\n if (pmremGenerator === null) pmremGenerator = new PMREMGenerator(renderer);\n renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture, renderTarget) : pmremGenerator.fromCubemap(texture, renderTarget);\n cubeUVmaps.set(texture, renderTarget);\n return renderTarget.texture;\n } else {\n if (cubeUVmaps.has(texture)) {\n return cubeUVmaps.get(texture).texture;\n } else {\n var image = texture.image;\n if (isEquirectMap && image && image.height > 0 || isCubeMap && image && isCubeTextureComplete(image)) {\n if (pmremGenerator === null) pmremGenerator = new PMREMGenerator(renderer);\n var _renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture) : pmremGenerator.fromCubemap(texture);\n cubeUVmaps.set(texture, _renderTarget);\n texture.addEventListener('dispose', onTextureDispose);\n return _renderTarget.texture;\n } else {\n // image not yet ready. try the conversion next frame\n\n return null;\n }\n }\n }\n }\n }\n return texture;\n }\n function isCubeTextureComplete(image) {\n var count = 0;\n var length = 6;\n for (var i = 0; i < length; i++) {\n if (image[i] !== undefined) count++;\n }\n return count === length;\n }\n function onTextureDispose(event) {\n var texture = event.target;\n texture.removeEventListener('dispose', onTextureDispose);\n var cubemapUV = cubeUVmaps.get(texture);\n if (cubemapUV !== undefined) {\n cubeUVmaps[\"delete\"](texture);\n cubemapUV.dispose();\n }\n }\n function dispose() {\n cubeUVmaps = new WeakMap();\n if (pmremGenerator !== null) {\n pmremGenerator.dispose();\n pmremGenerator = null;\n }\n }\n return {\n get: get,\n dispose: dispose\n };\n}\nfunction WebGLExtensions(gl) {\n var extensions = {};\n function getExtension(name) {\n if (extensions[name] !== undefined) {\n return extensions[name];\n }\n var extension;\n switch (name) {\n case 'WEBGL_depth_texture':\n extension = gl.getExtension('WEBGL_depth_texture') || gl.getExtension('MOZ_WEBGL_depth_texture') || gl.getExtension('WEBKIT_WEBGL_depth_texture');\n break;\n case 'EXT_texture_filter_anisotropic':\n extension = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('MOZ_EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic');\n break;\n case 'WEBGL_compressed_texture_s3tc':\n extension = gl.getExtension('WEBGL_compressed_texture_s3tc') || gl.getExtension('MOZ_WEBGL_compressed_texture_s3tc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc');\n break;\n case 'WEBGL_compressed_texture_pvrtc':\n extension = gl.getExtension('WEBGL_compressed_texture_pvrtc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc');\n break;\n default:\n extension = gl.getExtension(name);\n }\n extensions[name] = extension;\n return extension;\n }\n return {\n has: function has(name) {\n return getExtension(name) !== null;\n },\n init: function init(capabilities) {\n if (capabilities.isWebGL2) {\n getExtension('EXT_color_buffer_float');\n } else {\n getExtension('WEBGL_depth_texture');\n getExtension('OES_texture_float');\n getExtension('OES_texture_half_float');\n getExtension('OES_texture_half_float_linear');\n getExtension('OES_standard_derivatives');\n getExtension('OES_element_index_uint');\n getExtension('OES_vertex_array_object');\n getExtension('ANGLE_instanced_arrays');\n }\n getExtension('OES_texture_float_linear');\n getExtension('EXT_color_buffer_half_float');\n getExtension('WEBGL_multisampled_render_to_texture');\n },\n get: function get(name) {\n var extension = getExtension(name);\n if (extension === null) {\n console.warn('THREE.WebGLRenderer: ' + name + ' extension not supported.');\n }\n return extension;\n }\n };\n}\nfunction WebGLGeometries(gl, attributes, info, bindingStates) {\n var geometries = {};\n var wireframeAttributes = new WeakMap();\n function onGeometryDispose(event) {\n var geometry = event.target;\n if (geometry.index !== null) {\n attributes.remove(geometry.index);\n }\n for (var name in geometry.attributes) {\n attributes.remove(geometry.attributes[name]);\n }\n geometry.removeEventListener('dispose', onGeometryDispose);\n delete geometries[geometry.id];\n var attribute = wireframeAttributes.get(geometry);\n if (attribute) {\n attributes.remove(attribute);\n wireframeAttributes[\"delete\"](geometry);\n }\n bindingStates.releaseStatesOfGeometry(geometry);\n if (geometry.isInstancedBufferGeometry === true) {\n delete geometry._maxInstanceCount;\n }\n\n //\n\n info.memory.geometries--;\n }\n function get(object, geometry) {\n if (geometries[geometry.id] === true) return geometry;\n geometry.addEventListener('dispose', onGeometryDispose);\n geometries[geometry.id] = true;\n info.memory.geometries++;\n return geometry;\n }\n function update(geometry) {\n var geometryAttributes = geometry.attributes;\n\n // Updating index buffer in VAO now. See WebGLBindingStates.\n\n for (var name in geometryAttributes) {\n attributes.update(geometryAttributes[name], 34962);\n }\n\n // morph targets\n\n var morphAttributes = geometry.morphAttributes;\n for (var _name3 in morphAttributes) {\n var array = morphAttributes[_name3];\n for (var i = 0, l = array.length; i < l; i++) {\n attributes.update(array[i], 34962);\n }\n }\n }\n function updateWireframeAttribute(geometry) {\n var indices = [];\n var geometryIndex = geometry.index;\n var geometryPosition = geometry.attributes.position;\n var version = 0;\n if (geometryIndex !== null) {\n var array = geometryIndex.array;\n version = geometryIndex.version;\n for (var i = 0, l = array.length; i < l; i += 3) {\n var a = array[i + 0];\n var b = array[i + 1];\n var c = array[i + 2];\n indices.push(a, b, b, c, c, a);\n }\n } else {\n var _array = geometryPosition.array;\n version = geometryPosition.version;\n for (var _i29 = 0, _l5 = _array.length / 3 - 1; _i29 < _l5; _i29 += 3) {\n var _a4 = _i29 + 0;\n var _b4 = _i29 + 1;\n var _c4 = _i29 + 2;\n indices.push(_a4, _b4, _b4, _c4, _c4, _a4);\n }\n }\n var attribute = new (arrayNeedsUint32(indices) ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1);\n attribute.version = version;\n\n // Updating index buffer in VAO now. See WebGLBindingStates\n\n //\n\n var previousAttribute = wireframeAttributes.get(geometry);\n if (previousAttribute) attributes.remove(previousAttribute);\n\n //\n\n wireframeAttributes.set(geometry, attribute);\n }\n function getWireframeAttribute(geometry) {\n var currentAttribute = wireframeAttributes.get(geometry);\n if (currentAttribute) {\n var geometryIndex = geometry.index;\n if (geometryIndex !== null) {\n // if the attribute is obsolete, create a new one\n\n if (currentAttribute.version < geometryIndex.version) {\n updateWireframeAttribute(geometry);\n }\n }\n } else {\n updateWireframeAttribute(geometry);\n }\n return wireframeAttributes.get(geometry);\n }\n return {\n get: get,\n update: update,\n getWireframeAttribute: getWireframeAttribute\n };\n}\nfunction WebGLIndexedBufferRenderer(gl, extensions, info, capabilities) {\n var isWebGL2 = capabilities.isWebGL2;\n var mode;\n function setMode(value) {\n mode = value;\n }\n var type, bytesPerElement;\n function setIndex(value) {\n type = value.type;\n bytesPerElement = value.bytesPerElement;\n }\n function render(start, count) {\n gl.drawElements(mode, count, type, start * bytesPerElement);\n info.update(count, mode, 1);\n }\n function renderInstances(start, count, primcount) {\n if (primcount === 0) return;\n var extension, methodName;\n if (isWebGL2) {\n extension = gl;\n methodName = 'drawElementsInstanced';\n } else {\n extension = extensions.get('ANGLE_instanced_arrays');\n methodName = 'drawElementsInstancedANGLE';\n if (extension === null) {\n console.error('THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.');\n return;\n }\n }\n extension[methodName](mode, count, type, start * bytesPerElement, primcount);\n info.update(count, mode, primcount);\n }\n\n //\n\n this.setMode = setMode;\n this.setIndex = setIndex;\n this.render = render;\n this.renderInstances = renderInstances;\n}\nfunction WebGLInfo(gl) {\n var memory = {\n geometries: 0,\n textures: 0\n };\n var render = {\n frame: 0,\n calls: 0,\n triangles: 0,\n points: 0,\n lines: 0\n };\n function update(count, mode, instanceCount) {\n render.calls++;\n switch (mode) {\n case 4:\n render.triangles += instanceCount * (count / 3);\n break;\n case 1:\n render.lines += instanceCount * (count / 2);\n break;\n case 3:\n render.lines += instanceCount * (count - 1);\n break;\n case 2:\n render.lines += instanceCount * count;\n break;\n case 0:\n render.points += instanceCount * count;\n break;\n default:\n console.error('THREE.WebGLInfo: Unknown draw mode:', mode);\n break;\n }\n }\n function reset() {\n render.frame++;\n render.calls = 0;\n render.triangles = 0;\n render.points = 0;\n render.lines = 0;\n }\n return {\n memory: memory,\n render: render,\n programs: null,\n autoReset: true,\n reset: reset,\n update: update\n };\n}\nfunction numericalSort(a, b) {\n return a[0] - b[0];\n}\nfunction absNumericalSort(a, b) {\n return Math.abs(b[1]) - Math.abs(a[1]);\n}\nfunction WebGLMorphtargets(gl, capabilities, textures) {\n var influencesList = {};\n var morphInfluences = new Float32Array(8);\n var morphTextures = new WeakMap();\n var morph = new Vector4();\n var workInfluences = [];\n for (var i = 0; i < 8; i++) {\n workInfluences[i] = [i, 0];\n }\n function update(object, geometry, program) {\n var objectInfluences = object.morphTargetInfluences;\n if (capabilities.isWebGL2 === true) {\n // instead of using attributes, the WebGL 2 code path encodes morph targets\n // into an array of data textures. Each layer represents a single morph target.\n\n var morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n var morphTargetsCount = morphAttribute !== undefined ? morphAttribute.length : 0;\n var entry = morphTextures.get(geometry);\n if (entry === undefined || entry.count !== morphTargetsCount) {\n var disposeTexture = function disposeTexture() {\n texture.dispose();\n morphTextures[\"delete\"](geometry);\n geometry.removeEventListener('dispose', disposeTexture);\n };\n if (entry !== undefined) entry.texture.dispose();\n var hasMorphPosition = geometry.morphAttributes.position !== undefined;\n var hasMorphNormals = geometry.morphAttributes.normal !== undefined;\n var hasMorphColors = geometry.morphAttributes.color !== undefined;\n var morphTargets = geometry.morphAttributes.position || [];\n var morphNormals = geometry.morphAttributes.normal || [];\n var morphColors = geometry.morphAttributes.color || [];\n var vertexDataCount = 0;\n if (hasMorphPosition === true) vertexDataCount = 1;\n if (hasMorphNormals === true) vertexDataCount = 2;\n if (hasMorphColors === true) vertexDataCount = 3;\n var width = geometry.attributes.position.count * vertexDataCount;\n var height = 1;\n if (width > capabilities.maxTextureSize) {\n height = Math.ceil(width / capabilities.maxTextureSize);\n width = capabilities.maxTextureSize;\n }\n var buffer = new Float32Array(width * height * 4 * morphTargetsCount);\n var texture = new DataArrayTexture(buffer, width, height, morphTargetsCount);\n texture.type = FloatType;\n texture.needsUpdate = true;\n\n // fill buffer\n\n var vertexDataStride = vertexDataCount * 4;\n for (var _i30 = 0; _i30 < morphTargetsCount; _i30++) {\n var morphTarget = morphTargets[_i30];\n var morphNormal = morphNormals[_i30];\n var morphColor = morphColors[_i30];\n var offset = width * height * 4 * _i30;\n for (var j = 0; j < morphTarget.count; j++) {\n var stride = j * vertexDataStride;\n if (hasMorphPosition === true) {\n morph.fromBufferAttribute(morphTarget, j);\n buffer[offset + stride + 0] = morph.x;\n buffer[offset + stride + 1] = morph.y;\n buffer[offset + stride + 2] = morph.z;\n buffer[offset + stride + 3] = 0;\n }\n if (hasMorphNormals === true) {\n morph.fromBufferAttribute(morphNormal, j);\n buffer[offset + stride + 4] = morph.x;\n buffer[offset + stride + 5] = morph.y;\n buffer[offset + stride + 6] = morph.z;\n buffer[offset + stride + 7] = 0;\n }\n if (hasMorphColors === true) {\n morph.fromBufferAttribute(morphColor, j);\n buffer[offset + stride + 8] = morph.x;\n buffer[offset + stride + 9] = morph.y;\n buffer[offset + stride + 10] = morph.z;\n buffer[offset + stride + 11] = morphColor.itemSize === 4 ? morph.w : 1;\n }\n }\n }\n entry = {\n count: morphTargetsCount,\n texture: texture,\n size: new Vector2(width, height)\n };\n morphTextures.set(geometry, entry);\n geometry.addEventListener('dispose', disposeTexture);\n }\n\n //\n\n var morphInfluencesSum = 0;\n for (var _i31 = 0; _i31 < objectInfluences.length; _i31++) {\n morphInfluencesSum += objectInfluences[_i31];\n }\n var morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;\n program.getUniforms().setValue(gl, 'morphTargetBaseInfluence', morphBaseInfluence);\n program.getUniforms().setValue(gl, 'morphTargetInfluences', objectInfluences);\n program.getUniforms().setValue(gl, 'morphTargetsTexture', entry.texture, textures);\n program.getUniforms().setValue(gl, 'morphTargetsTextureSize', entry.size);\n } else {\n // When object doesn't have morph target influences defined, we treat it as a 0-length array\n // This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences\n\n var length = objectInfluences === undefined ? 0 : objectInfluences.length;\n var influences = influencesList[geometry.id];\n if (influences === undefined || influences.length !== length) {\n // initialise list\n\n influences = [];\n for (var _i32 = 0; _i32 < length; _i32++) {\n influences[_i32] = [_i32, 0];\n }\n influencesList[geometry.id] = influences;\n }\n\n // Collect influences\n\n for (var _i33 = 0; _i33 < length; _i33++) {\n var influence = influences[_i33];\n influence[0] = _i33;\n influence[1] = objectInfluences[_i33];\n }\n influences.sort(absNumericalSort);\n for (var _i34 = 0; _i34 < 8; _i34++) {\n if (_i34 < length && influences[_i34][1]) {\n workInfluences[_i34][0] = influences[_i34][0];\n workInfluences[_i34][1] = influences[_i34][1];\n } else {\n workInfluences[_i34][0] = Number.MAX_SAFE_INTEGER;\n workInfluences[_i34][1] = 0;\n }\n }\n workInfluences.sort(numericalSort);\n var _morphTargets = geometry.morphAttributes.position;\n var _morphNormals = geometry.morphAttributes.normal;\n var _morphInfluencesSum = 0;\n for (var _i35 = 0; _i35 < 8; _i35++) {\n var _influence = workInfluences[_i35];\n var index = _influence[0];\n var _value3 = _influence[1];\n if (index !== Number.MAX_SAFE_INTEGER && _value3) {\n if (_morphTargets && geometry.getAttribute('morphTarget' + _i35) !== _morphTargets[index]) {\n geometry.setAttribute('morphTarget' + _i35, _morphTargets[index]);\n }\n if (_morphNormals && geometry.getAttribute('morphNormal' + _i35) !== _morphNormals[index]) {\n geometry.setAttribute('morphNormal' + _i35, _morphNormals[index]);\n }\n morphInfluences[_i35] = _value3;\n _morphInfluencesSum += _value3;\n } else {\n if (_morphTargets && geometry.hasAttribute('morphTarget' + _i35) === true) {\n geometry.deleteAttribute('morphTarget' + _i35);\n }\n if (_morphNormals && geometry.hasAttribute('morphNormal' + _i35) === true) {\n geometry.deleteAttribute('morphNormal' + _i35);\n }\n morphInfluences[_i35] = 0;\n }\n }\n\n // GLSL shader uses formula baseinfluence * base + sum(target * influence)\n // This allows us to switch between absolute morphs and relative morphs without changing shader code\n // When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)\n var _morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - _morphInfluencesSum;\n program.getUniforms().setValue(gl, 'morphTargetBaseInfluence', _morphBaseInfluence);\n program.getUniforms().setValue(gl, 'morphTargetInfluences', morphInfluences);\n }\n }\n return {\n update: update\n };\n}\nfunction WebGLObjects(gl, geometries, attributes, info) {\n var updateMap = new WeakMap();\n function update(object) {\n var frame = info.render.frame;\n var geometry = object.geometry;\n var buffergeometry = geometries.get(object, geometry);\n\n // Update once per frame\n\n if (updateMap.get(buffergeometry) !== frame) {\n geometries.update(buffergeometry);\n updateMap.set(buffergeometry, frame);\n }\n if (object.isInstancedMesh) {\n if (object.hasEventListener('dispose', onInstancedMeshDispose) === false) {\n object.addEventListener('dispose', onInstancedMeshDispose);\n }\n attributes.update(object.instanceMatrix, 34962);\n if (object.instanceColor !== null) {\n attributes.update(object.instanceColor, 34962);\n }\n }\n return buffergeometry;\n }\n function dispose() {\n updateMap = new WeakMap();\n }\n function onInstancedMeshDispose(event) {\n var instancedMesh = event.target;\n instancedMesh.removeEventListener('dispose', onInstancedMeshDispose);\n attributes.remove(instancedMesh.instanceMatrix);\n if (instancedMesh.instanceColor !== null) attributes.remove(instancedMesh.instanceColor);\n }\n return {\n update: update,\n dispose: dispose\n };\n}\n\n/**\n * Uniforms of a program.\n * Those form a tree structure with a special top-level container for the root,\n * which you get by calling 'new WebGLUniforms( gl, program )'.\n *\n *\n * Properties of inner nodes including the top-level container:\n *\n * .seq - array of nested uniforms\n * .map - nested uniforms by name\n *\n *\n * Methods of all nodes except the top-level container:\n *\n * .setValue( gl, value, [textures] )\n *\n * \t\tuploads a uniform value(s)\n * \tthe 'textures' parameter is needed for sampler uniforms\n *\n *\n * Static methods of the top-level container (textures factorizations):\n *\n * .upload( gl, seq, values, textures )\n *\n * \t\tsets uniforms in 'seq' to 'values[id].value'\n *\n * .seqWithValue( seq, values ) : filteredSeq\n *\n * \t\tfilters 'seq' entries with corresponding entry in values\n *\n *\n * Methods of the top-level container (textures factorizations):\n *\n * .setValue( gl, name, value, textures )\n *\n * \t\tsets uniform with name 'name' to 'value'\n *\n * .setOptional( gl, obj, prop )\n *\n * \t\tlike .set for an optional property of the object\n *\n */\n\nvar emptyTexture = /*@__PURE__*/new Texture();\nvar emptyArrayTexture = /*@__PURE__*/new DataArrayTexture();\nvar empty3dTexture = /*@__PURE__*/new Data3DTexture();\nvar emptyCubeTexture = /*@__PURE__*/new CubeTexture();\n\n// --- Utilities ---\n\n// Array Caches (provide typed arrays for temporary by size)\n\nvar arrayCacheF32 = [];\nvar arrayCacheI32 = [];\n\n// Float32Array caches used for uploading Matrix uniforms\n\nvar mat4array = new Float32Array(16);\nvar mat3array = new Float32Array(9);\nvar mat2array = new Float32Array(4);\n\n// Flattening for arrays of vectors and matrices\n\nfunction flatten(array, nBlocks, blockSize) {\n var firstElem = array[0];\n if (firstElem <= 0 || firstElem > 0) return array;\n // unoptimized: ! isNaN( firstElem )\n // see http://jacksondunstan.com/articles/983\n\n var n = nBlocks * blockSize;\n var r = arrayCacheF32[n];\n if (r === undefined) {\n r = new Float32Array(n);\n arrayCacheF32[n] = r;\n }\n if (nBlocks !== 0) {\n firstElem.toArray(r, 0);\n for (var i = 1, offset = 0; i !== nBlocks; ++i) {\n offset += blockSize;\n array[i].toArray(r, offset);\n }\n }\n return r;\n}\nfunction arraysEqual(a, b) {\n if (a.length !== b.length) return false;\n for (var i = 0, l = a.length; i < l; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\nfunction copyArray(a, b) {\n for (var i = 0, l = b.length; i < l; i++) {\n a[i] = b[i];\n }\n}\n\n// Texture unit allocation\n\nfunction allocTexUnits(textures, n) {\n var r = arrayCacheI32[n];\n if (r === undefined) {\n r = new Int32Array(n);\n arrayCacheI32[n] = r;\n }\n for (var i = 0; i !== n; ++i) {\n r[i] = textures.allocateTextureUnit();\n }\n return r;\n}\n\n// --- Setters ---\n\n// Note: Defining these methods externally, because they come in a bunch\n// and this way their names minify.\n\n// Single scalar\n\nfunction setValueV1f(gl, v) {\n var cache = this.cache;\n if (cache[0] === v) return;\n gl.uniform1f(this.addr, v);\n cache[0] = v;\n}\n\n// Single float vector (from flat array or THREE.VectorN)\n\nfunction setValueV2f(gl, v) {\n var cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y) {\n gl.uniform2f(this.addr, v.x, v.y);\n cache[0] = v.x;\n cache[1] = v.y;\n }\n } else {\n if (arraysEqual(cache, v)) return;\n gl.uniform2fv(this.addr, v);\n copyArray(cache, v);\n }\n}\nfunction setValueV3f(gl, v) {\n var cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {\n gl.uniform3f(this.addr, v.x, v.y, v.z);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n }\n } else if (v.r !== undefined) {\n if (cache[0] !== v.r || cache[1] !== v.g || cache[2] !== v.b) {\n gl.uniform3f(this.addr, v.r, v.g, v.b);\n cache[0] = v.r;\n cache[1] = v.g;\n cache[2] = v.b;\n }\n } else {\n if (arraysEqual(cache, v)) return;\n gl.uniform3fv(this.addr, v);\n copyArray(cache, v);\n }\n}\nfunction setValueV4f(gl, v) {\n var cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {\n gl.uniform4f(this.addr, v.x, v.y, v.z, v.w);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n cache[3] = v.w;\n }\n } else {\n if (arraysEqual(cache, v)) return;\n gl.uniform4fv(this.addr, v);\n copyArray(cache, v);\n }\n}\n\n// Single matrix (from flat array or THREE.MatrixN)\n\nfunction setValueM2(gl, v) {\n var cache = this.cache;\n var elements = v.elements;\n if (elements === undefined) {\n if (arraysEqual(cache, v)) return;\n gl.uniformMatrix2fv(this.addr, false, v);\n copyArray(cache, v);\n } else {\n if (arraysEqual(cache, elements)) return;\n mat2array.set(elements);\n gl.uniformMatrix2fv(this.addr, false, mat2array);\n copyArray(cache, elements);\n }\n}\nfunction setValueM3(gl, v) {\n var cache = this.cache;\n var elements = v.elements;\n if (elements === undefined) {\n if (arraysEqual(cache, v)) return;\n gl.uniformMatrix3fv(this.addr, false, v);\n copyArray(cache, v);\n } else {\n if (arraysEqual(cache, elements)) return;\n mat3array.set(elements);\n gl.uniformMatrix3fv(this.addr, false, mat3array);\n copyArray(cache, elements);\n }\n}\nfunction setValueM4(gl, v) {\n var cache = this.cache;\n var elements = v.elements;\n if (elements === undefined) {\n if (arraysEqual(cache, v)) return;\n gl.uniformMatrix4fv(this.addr, false, v);\n copyArray(cache, v);\n } else {\n if (arraysEqual(cache, elements)) return;\n mat4array.set(elements);\n gl.uniformMatrix4fv(this.addr, false, mat4array);\n copyArray(cache, elements);\n }\n}\n\n// Single integer / boolean\n\nfunction setValueV1i(gl, v) {\n var cache = this.cache;\n if (cache[0] === v) return;\n gl.uniform1i(this.addr, v);\n cache[0] = v;\n}\n\n// Single integer / boolean vector (from flat array or THREE.VectorN)\n\nfunction setValueV2i(gl, v) {\n var cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y) {\n gl.uniform2i(this.addr, v.x, v.y);\n cache[0] = v.x;\n cache[1] = v.y;\n }\n } else {\n if (arraysEqual(cache, v)) return;\n gl.uniform2iv(this.addr, v);\n copyArray(cache, v);\n }\n}\nfunction setValueV3i(gl, v) {\n var cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {\n gl.uniform3i(this.addr, v.x, v.y, v.z);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n }\n } else {\n if (arraysEqual(cache, v)) return;\n gl.uniform3iv(this.addr, v);\n copyArray(cache, v);\n }\n}\nfunction setValueV4i(gl, v) {\n var cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {\n gl.uniform4i(this.addr, v.x, v.y, v.z, v.w);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n cache[3] = v.w;\n }\n } else {\n if (arraysEqual(cache, v)) return;\n gl.uniform4iv(this.addr, v);\n copyArray(cache, v);\n }\n}\n\n// Single unsigned integer\n\nfunction setValueV1ui(gl, v) {\n var cache = this.cache;\n if (cache[0] === v) return;\n gl.uniform1ui(this.addr, v);\n cache[0] = v;\n}\n\n// Single unsigned integer vector (from flat array or THREE.VectorN)\n\nfunction setValueV2ui(gl, v) {\n var cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y) {\n gl.uniform2ui(this.addr, v.x, v.y);\n cache[0] = v.x;\n cache[1] = v.y;\n }\n } else {\n if (arraysEqual(cache, v)) return;\n gl.uniform2uiv(this.addr, v);\n copyArray(cache, v);\n }\n}\nfunction setValueV3ui(gl, v) {\n var cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {\n gl.uniform3ui(this.addr, v.x, v.y, v.z);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n }\n } else {\n if (arraysEqual(cache, v)) return;\n gl.uniform3uiv(this.addr, v);\n copyArray(cache, v);\n }\n}\nfunction setValueV4ui(gl, v) {\n var cache = this.cache;\n if (v.x !== undefined) {\n if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {\n gl.uniform4ui(this.addr, v.x, v.y, v.z, v.w);\n cache[0] = v.x;\n cache[1] = v.y;\n cache[2] = v.z;\n cache[3] = v.w;\n }\n } else {\n if (arraysEqual(cache, v)) return;\n gl.uniform4uiv(this.addr, v);\n copyArray(cache, v);\n }\n}\n\n// Single texture (2D / Cube)\n\nfunction setValueT1(gl, v, textures) {\n var cache = this.cache;\n var unit = textures.allocateTextureUnit();\n if (cache[0] !== unit) {\n gl.uniform1i(this.addr, unit);\n cache[0] = unit;\n }\n textures.setTexture2D(v || emptyTexture, unit);\n}\nfunction setValueT3D1(gl, v, textures) {\n var cache = this.cache;\n var unit = textures.allocateTextureUnit();\n if (cache[0] !== unit) {\n gl.uniform1i(this.addr, unit);\n cache[0] = unit;\n }\n textures.setTexture3D(v || empty3dTexture, unit);\n}\nfunction setValueT6(gl, v, textures) {\n var cache = this.cache;\n var unit = textures.allocateTextureUnit();\n if (cache[0] !== unit) {\n gl.uniform1i(this.addr, unit);\n cache[0] = unit;\n }\n textures.setTextureCube(v || emptyCubeTexture, unit);\n}\nfunction setValueT2DArray1(gl, v, textures) {\n var cache = this.cache;\n var unit = textures.allocateTextureUnit();\n if (cache[0] !== unit) {\n gl.uniform1i(this.addr, unit);\n cache[0] = unit;\n }\n textures.setTexture2DArray(v || emptyArrayTexture, unit);\n}\n\n// Helper to pick the right setter for the singular case\n\nfunction getSingularSetter(type) {\n switch (type) {\n case 0x1406:\n return setValueV1f;\n // FLOAT\n case 0x8b50:\n return setValueV2f;\n // _VEC2\n case 0x8b51:\n return setValueV3f;\n // _VEC3\n case 0x8b52:\n return setValueV4f;\n // _VEC4\n\n case 0x8b5a:\n return setValueM2;\n // _MAT2\n case 0x8b5b:\n return setValueM3;\n // _MAT3\n case 0x8b5c:\n return setValueM4;\n // _MAT4\n\n case 0x1404:\n case 0x8b56:\n return setValueV1i;\n // INT, BOOL\n case 0x8b53:\n case 0x8b57:\n return setValueV2i;\n // _VEC2\n case 0x8b54:\n case 0x8b58:\n return setValueV3i;\n // _VEC3\n case 0x8b55:\n case 0x8b59:\n return setValueV4i;\n // _VEC4\n\n case 0x1405:\n return setValueV1ui;\n // UINT\n case 0x8dc6:\n return setValueV2ui;\n // _VEC2\n case 0x8dc7:\n return setValueV3ui;\n // _VEC3\n case 0x8dc8:\n return setValueV4ui;\n // _VEC4\n\n case 0x8b5e: // SAMPLER_2D\n case 0x8d66: // SAMPLER_EXTERNAL_OES\n case 0x8dca: // INT_SAMPLER_2D\n case 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n case 0x8b62:\n // SAMPLER_2D_SHADOW\n return setValueT1;\n case 0x8b5f: // SAMPLER_3D\n case 0x8dcb: // INT_SAMPLER_3D\n case 0x8dd3:\n // UNSIGNED_INT_SAMPLER_3D\n return setValueT3D1;\n case 0x8b60: // SAMPLER_CUBE\n case 0x8dcc: // INT_SAMPLER_CUBE\n case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n case 0x8dc5:\n // SAMPLER_CUBE_SHADOW\n return setValueT6;\n case 0x8dc1: // SAMPLER_2D_ARRAY\n case 0x8dcf: // INT_SAMPLER_2D_ARRAY\n case 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n case 0x8dc4:\n // SAMPLER_2D_ARRAY_SHADOW\n return setValueT2DArray1;\n }\n}\n\n// Array of scalars\n\nfunction setValueV1fArray(gl, v) {\n gl.uniform1fv(this.addr, v);\n}\n\n// Array of vectors (from flat array or array of THREE.VectorN)\n\nfunction setValueV2fArray(gl, v) {\n var data = flatten(v, this.size, 2);\n gl.uniform2fv(this.addr, data);\n}\nfunction setValueV3fArray(gl, v) {\n var data = flatten(v, this.size, 3);\n gl.uniform3fv(this.addr, data);\n}\nfunction setValueV4fArray(gl, v) {\n var data = flatten(v, this.size, 4);\n gl.uniform4fv(this.addr, data);\n}\n\n// Array of matrices (from flat array or array of THREE.MatrixN)\n\nfunction setValueM2Array(gl, v) {\n var data = flatten(v, this.size, 4);\n gl.uniformMatrix2fv(this.addr, false, data);\n}\nfunction setValueM3Array(gl, v) {\n var data = flatten(v, this.size, 9);\n gl.uniformMatrix3fv(this.addr, false, data);\n}\nfunction setValueM4Array(gl, v) {\n var data = flatten(v, this.size, 16);\n gl.uniformMatrix4fv(this.addr, false, data);\n}\n\n// Array of integer / boolean\n\nfunction setValueV1iArray(gl, v) {\n gl.uniform1iv(this.addr, v);\n}\n\n// Array of integer / boolean vectors (from flat array)\n\nfunction setValueV2iArray(gl, v) {\n gl.uniform2iv(this.addr, v);\n}\nfunction setValueV3iArray(gl, v) {\n gl.uniform3iv(this.addr, v);\n}\nfunction setValueV4iArray(gl, v) {\n gl.uniform4iv(this.addr, v);\n}\n\n// Array of unsigned integer\n\nfunction setValueV1uiArray(gl, v) {\n gl.uniform1uiv(this.addr, v);\n}\n\n// Array of unsigned integer vectors (from flat array)\n\nfunction setValueV2uiArray(gl, v) {\n gl.uniform2uiv(this.addr, v);\n}\nfunction setValueV3uiArray(gl, v) {\n gl.uniform3uiv(this.addr, v);\n}\nfunction setValueV4uiArray(gl, v) {\n gl.uniform4uiv(this.addr, v);\n}\n\n// Array of textures (2D / 3D / Cube / 2DArray)\n\nfunction setValueT1Array(gl, v, textures) {\n var cache = this.cache;\n var n = v.length;\n var units = allocTexUnits(textures, n);\n if (!arraysEqual(cache, units)) {\n gl.uniform1iv(this.addr, units);\n copyArray(cache, units);\n }\n for (var i = 0; i !== n; ++i) {\n textures.setTexture2D(v[i] || emptyTexture, units[i]);\n }\n}\nfunction setValueT3DArray(gl, v, textures) {\n var cache = this.cache;\n var n = v.length;\n var units = allocTexUnits(textures, n);\n if (!arraysEqual(cache, units)) {\n gl.uniform1iv(this.addr, units);\n copyArray(cache, units);\n }\n for (var i = 0; i !== n; ++i) {\n textures.setTexture3D(v[i] || empty3dTexture, units[i]);\n }\n}\nfunction setValueT6Array(gl, v, textures) {\n var cache = this.cache;\n var n = v.length;\n var units = allocTexUnits(textures, n);\n if (!arraysEqual(cache, units)) {\n gl.uniform1iv(this.addr, units);\n copyArray(cache, units);\n }\n for (var i = 0; i !== n; ++i) {\n textures.setTextureCube(v[i] || emptyCubeTexture, units[i]);\n }\n}\nfunction setValueT2DArrayArray(gl, v, textures) {\n var cache = this.cache;\n var n = v.length;\n var units = allocTexUnits(textures, n);\n if (!arraysEqual(cache, units)) {\n gl.uniform1iv(this.addr, units);\n copyArray(cache, units);\n }\n for (var i = 0; i !== n; ++i) {\n textures.setTexture2DArray(v[i] || emptyArrayTexture, units[i]);\n }\n}\n\n// Helper to pick the right setter for a pure (bottom-level) array\n\nfunction getPureArraySetter(type) {\n switch (type) {\n case 0x1406:\n return setValueV1fArray;\n // FLOAT\n case 0x8b50:\n return setValueV2fArray;\n // _VEC2\n case 0x8b51:\n return setValueV3fArray;\n // _VEC3\n case 0x8b52:\n return setValueV4fArray;\n // _VEC4\n\n case 0x8b5a:\n return setValueM2Array;\n // _MAT2\n case 0x8b5b:\n return setValueM3Array;\n // _MAT3\n case 0x8b5c:\n return setValueM4Array;\n // _MAT4\n\n case 0x1404:\n case 0x8b56:\n return setValueV1iArray;\n // INT, BOOL\n case 0x8b53:\n case 0x8b57:\n return setValueV2iArray;\n // _VEC2\n case 0x8b54:\n case 0x8b58:\n return setValueV3iArray;\n // _VEC3\n case 0x8b55:\n case 0x8b59:\n return setValueV4iArray;\n // _VEC4\n\n case 0x1405:\n return setValueV1uiArray;\n // UINT\n case 0x8dc6:\n return setValueV2uiArray;\n // _VEC2\n case 0x8dc7:\n return setValueV3uiArray;\n // _VEC3\n case 0x8dc8:\n return setValueV4uiArray;\n // _VEC4\n\n case 0x8b5e: // SAMPLER_2D\n case 0x8d66: // SAMPLER_EXTERNAL_OES\n case 0x8dca: // INT_SAMPLER_2D\n case 0x8dd2: // UNSIGNED_INT_SAMPLER_2D\n case 0x8b62:\n // SAMPLER_2D_SHADOW\n return setValueT1Array;\n case 0x8b5f: // SAMPLER_3D\n case 0x8dcb: // INT_SAMPLER_3D\n case 0x8dd3:\n // UNSIGNED_INT_SAMPLER_3D\n return setValueT3DArray;\n case 0x8b60: // SAMPLER_CUBE\n case 0x8dcc: // INT_SAMPLER_CUBE\n case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE\n case 0x8dc5:\n // SAMPLER_CUBE_SHADOW\n return setValueT6Array;\n case 0x8dc1: // SAMPLER_2D_ARRAY\n case 0x8dcf: // INT_SAMPLER_2D_ARRAY\n case 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY\n case 0x8dc4:\n // SAMPLER_2D_ARRAY_SHADOW\n return setValueT2DArrayArray;\n }\n}\n\n// --- Uniform Classes ---\nvar SingleUniform = /*#__PURE__*/_createClass(function SingleUniform(id, activeInfo, addr) {\n _classCallCheck(this, SingleUniform);\n this.id = id;\n this.addr = addr;\n this.cache = [];\n this.setValue = getSingularSetter(activeInfo.type);\n\n // this.path = activeInfo.name; // DEBUG\n});\nvar PureArrayUniform = /*#__PURE__*/_createClass(function PureArrayUniform(id, activeInfo, addr) {\n _classCallCheck(this, PureArrayUniform);\n this.id = id;\n this.addr = addr;\n this.cache = [];\n this.size = activeInfo.size;\n this.setValue = getPureArraySetter(activeInfo.type);\n\n // this.path = activeInfo.name; // DEBUG\n});\nvar StructuredUniform = /*#__PURE__*/function () {\n function StructuredUniform(id) {\n _classCallCheck(this, StructuredUniform);\n this.id = id;\n this.seq = [];\n this.map = {};\n }\n _createClass(StructuredUniform, [{\n key: \"setValue\",\n value: function setValue(gl, value, textures) {\n var seq = this.seq;\n for (var i = 0, n = seq.length; i !== n; ++i) {\n var u = seq[i];\n u.setValue(gl, value[u.id], textures);\n }\n }\n }]);\n return StructuredUniform;\n}(); // --- Top-level ---\n// Parser - builds up the property tree from the path strings\nvar RePathPart = /(\\w+)(\\])?(\\[|\\.)?/g;\n\n// extracts\n// \t- the identifier (member name or array index)\n// - followed by an optional right bracket (found when array index)\n// - followed by an optional left bracket or dot (type of subscript)\n//\n// Note: These portions can be read in a non-overlapping fashion and\n// allow straightforward parsing of the hierarchy that WebGL encodes\n// in the uniform names.\n\nfunction addUniform(container, uniformObject) {\n container.seq.push(uniformObject);\n container.map[uniformObject.id] = uniformObject;\n}\nfunction parseUniform(activeInfo, addr, container) {\n var path = activeInfo.name,\n pathLength = path.length;\n\n // reset RegExp object, because of the early exit of a previous run\n RePathPart.lastIndex = 0;\n while (true) {\n var match = RePathPart.exec(path),\n matchEnd = RePathPart.lastIndex;\n var _id2 = match[1];\n var idIsIndex = match[2] === ']',\n subscript = match[3];\n if (idIsIndex) _id2 = _id2 | 0; // convert to integer\n\n if (subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength) {\n // bare name or \"pure\" bottom-level array \"[0]\" suffix\n\n addUniform(container, subscript === undefined ? new SingleUniform(_id2, activeInfo, addr) : new PureArrayUniform(_id2, activeInfo, addr));\n break;\n } else {\n // step into inner node / create it in case it doesn't exist\n\n var map = container.map;\n var next = map[_id2];\n if (next === undefined) {\n next = new StructuredUniform(_id2);\n addUniform(container, next);\n }\n container = next;\n }\n }\n}\n\n// Root Container\nvar WebGLUniforms = /*#__PURE__*/function () {\n function WebGLUniforms(gl, program) {\n _classCallCheck(this, WebGLUniforms);\n this.seq = [];\n this.map = {};\n var n = gl.getProgramParameter(program, 35718);\n for (var i = 0; i < n; ++i) {\n var info = gl.getActiveUniform(program, i),\n addr = gl.getUniformLocation(program, info.name);\n parseUniform(info, addr, this);\n }\n }\n _createClass(WebGLUniforms, [{\n key: \"setValue\",\n value: function setValue(gl, name, value, textures) {\n var u = this.map[name];\n if (u !== undefined) u.setValue(gl, value, textures);\n }\n }, {\n key: \"setOptional\",\n value: function setOptional(gl, object, name) {\n var v = object[name];\n if (v !== undefined) this.setValue(gl, name, v);\n }\n }], [{\n key: \"upload\",\n value: function upload(gl, seq, values, textures) {\n for (var i = 0, n = seq.length; i !== n; ++i) {\n var u = seq[i],\n v = values[u.id];\n if (v.needsUpdate !== false) {\n // note: always updating when .needsUpdate is undefined\n u.setValue(gl, v.value, textures);\n }\n }\n }\n }, {\n key: \"seqWithValue\",\n value: function seqWithValue(seq, values) {\n var r = [];\n for (var i = 0, n = seq.length; i !== n; ++i) {\n var u = seq[i];\n if (u.id in values) r.push(u);\n }\n return r;\n }\n }]);\n return WebGLUniforms;\n}();\nfunction WebGLShader(gl, type, string) {\n var shader = gl.createShader(type);\n gl.shaderSource(shader, string);\n gl.compileShader(shader);\n return shader;\n}\nvar programIdCount = 0;\nfunction handleSource(string, errorLine) {\n var lines = string.split('\\n');\n var lines2 = [];\n var from = Math.max(errorLine - 6, 0);\n var to = Math.min(errorLine + 6, lines.length);\n for (var i = from; i < to; i++) {\n var line = i + 1;\n lines2.push(\"\".concat(line === errorLine ? '>' : ' ', \" \").concat(line, \": \").concat(lines[i]));\n }\n return lines2.join('\\n');\n}\nfunction getEncodingComponents(encoding) {\n switch (encoding) {\n case LinearEncoding:\n return ['Linear', '( value )'];\n case sRGBEncoding:\n return ['sRGB', '( value )'];\n default:\n console.warn('THREE.WebGLProgram: Unsupported encoding:', encoding);\n return ['Linear', '( value )'];\n }\n}\nfunction getShaderErrors(gl, shader, type) {\n var status = gl.getShaderParameter(shader, 35713);\n var errors = gl.getShaderInfoLog(shader).trim();\n if (status && errors === '') return '';\n var errorMatches = /ERROR: 0:(\\d+)/.exec(errors);\n if (errorMatches) {\n // --enable-privileged-webgl-extension\n // console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) );\n\n var errorLine = parseInt(errorMatches[1]);\n return type.toUpperCase() + '\\n\\n' + errors + '\\n\\n' + handleSource(gl.getShaderSource(shader), errorLine);\n } else {\n return errors;\n }\n}\nfunction getTexelEncodingFunction(functionName, encoding) {\n var components = getEncodingComponents(encoding);\n return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[0] + components[1] + '; }';\n}\nfunction getToneMappingFunction(functionName, toneMapping) {\n var toneMappingName;\n switch (toneMapping) {\n case LinearToneMapping:\n toneMappingName = 'Linear';\n break;\n case ReinhardToneMapping:\n toneMappingName = 'Reinhard';\n break;\n case CineonToneMapping:\n toneMappingName = 'OptimizedCineon';\n break;\n case ACESFilmicToneMapping:\n toneMappingName = 'ACESFilmic';\n break;\n case CustomToneMapping:\n toneMappingName = 'Custom';\n break;\n default:\n console.warn('THREE.WebGLProgram: Unsupported toneMapping:', toneMapping);\n toneMappingName = 'Linear';\n }\n return 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }';\n}\nfunction generateExtensions(parameters) {\n var chunks = [parameters.extensionDerivatives || !!parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ? '#extension GL_OES_standard_derivatives : enable' : '', (parameters.extensionFragDepth || parameters.logarithmicDepthBuffer) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '', parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ? '#extension GL_EXT_draw_buffers : require' : '', (parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''];\n return chunks.filter(filterEmptyLine).join('\\n');\n}\nfunction generateDefines(defines) {\n var chunks = [];\n for (var name in defines) {\n var _value4 = defines[name];\n if (_value4 === false) continue;\n chunks.push('#define ' + name + ' ' + _value4);\n }\n return chunks.join('\\n');\n}\nfunction fetchAttributeLocations(gl, program) {\n var attributes = {};\n var n = gl.getProgramParameter(program, 35721);\n for (var i = 0; i < n; i++) {\n var info = gl.getActiveAttrib(program, i);\n var name = info.name;\n var locationSize = 1;\n if (info.type === 35674) locationSize = 2;\n if (info.type === 35675) locationSize = 3;\n if (info.type === 35676) locationSize = 4;\n\n // console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i );\n\n attributes[name] = {\n type: info.type,\n location: gl.getAttribLocation(program, name),\n locationSize: locationSize\n };\n }\n return attributes;\n}\nfunction filterEmptyLine(string) {\n return string !== '';\n}\nfunction replaceLightNums(string, parameters) {\n var numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;\n return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows);\n}\nfunction replaceClippingPlaneNums(string, parameters) {\n return string.replace(/NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, parameters.numClippingPlanes - parameters.numClipIntersection);\n}\n\n// Resolve Includes\n\nvar includePattern = /^[ \\t]*#include +<([\\w\\d./]+)>/gm;\nfunction resolveIncludes(string) {\n return string.replace(includePattern, includeReplacer);\n}\nfunction includeReplacer(match, include) {\n var string = ShaderChunk[include];\n if (string === undefined) {\n throw new Error('Can not resolve #include <' + include + '>');\n }\n return resolveIncludes(string);\n}\n\n// Unroll Loops\n\nvar unrollLoopPattern = /#pragma unroll_loop_start\\s+for\\s*\\(\\s*int\\s+i\\s*=\\s*(\\d+)\\s*;\\s*i\\s*<\\s*(\\d+)\\s*;\\s*i\\s*\\+\\+\\s*\\)\\s*{([\\s\\S]+?)}\\s+#pragma unroll_loop_end/g;\nfunction unrollLoops(string) {\n return string.replace(unrollLoopPattern, loopReplacer);\n}\nfunction loopReplacer(match, start, end, snippet) {\n var string = '';\n for (var i = parseInt(start); i < parseInt(end); i++) {\n string += snippet.replace(/\\[\\s*i\\s*\\]/g, '[ ' + i + ' ]').replace(/UNROLLED_LOOP_INDEX/g, i);\n }\n return string;\n}\n\n//\n\nfunction generatePrecision(parameters) {\n var precisionstring = 'precision ' + parameters.precision + ' float;\\nprecision ' + parameters.precision + ' int;';\n if (parameters.precision === 'highp') {\n precisionstring += '\\n#define HIGH_PRECISION';\n } else if (parameters.precision === 'mediump') {\n precisionstring += '\\n#define MEDIUM_PRECISION';\n } else if (parameters.precision === 'lowp') {\n precisionstring += '\\n#define LOW_PRECISION';\n }\n return precisionstring;\n}\nfunction generateShadowMapTypeDefine(parameters) {\n var shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC';\n if (parameters.shadowMapType === PCFShadowMap) {\n shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF';\n } else if (parameters.shadowMapType === PCFSoftShadowMap) {\n shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF_SOFT';\n } else if (parameters.shadowMapType === VSMShadowMap) {\n shadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM';\n }\n return shadowMapTypeDefine;\n}\nfunction generateEnvMapTypeDefine(parameters) {\n var envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n if (parameters.envMap) {\n switch (parameters.envMapMode) {\n case CubeReflectionMapping:\n case CubeRefractionMapping:\n envMapTypeDefine = 'ENVMAP_TYPE_CUBE';\n break;\n case CubeUVReflectionMapping:\n envMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV';\n break;\n }\n }\n return envMapTypeDefine;\n}\nfunction generateEnvMapModeDefine(parameters) {\n var envMapModeDefine = 'ENVMAP_MODE_REFLECTION';\n if (parameters.envMap) {\n switch (parameters.envMapMode) {\n case CubeRefractionMapping:\n envMapModeDefine = 'ENVMAP_MODE_REFRACTION';\n break;\n }\n }\n return envMapModeDefine;\n}\nfunction generateEnvMapBlendingDefine(parameters) {\n var envMapBlendingDefine = 'ENVMAP_BLENDING_NONE';\n if (parameters.envMap) {\n switch (parameters.combine) {\n case MultiplyOperation:\n envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY';\n break;\n case MixOperation:\n envMapBlendingDefine = 'ENVMAP_BLENDING_MIX';\n break;\n case AddOperation:\n envMapBlendingDefine = 'ENVMAP_BLENDING_ADD';\n break;\n }\n }\n return envMapBlendingDefine;\n}\nfunction generateCubeUVSize(parameters) {\n var imageHeight = parameters.envMapCubeUVHeight;\n if (imageHeight === null) return null;\n var maxMip = Math.log2(imageHeight) - 2;\n var texelHeight = 1.0 / imageHeight;\n var texelWidth = 1.0 / (3 * Math.max(Math.pow(2, maxMip), 7 * 16));\n return {\n texelWidth: texelWidth,\n texelHeight: texelHeight,\n maxMip: maxMip\n };\n}\nfunction WebGLProgram(renderer, cacheKey, parameters, bindingStates) {\n // TODO Send this event to Three.js DevTools\n // console.log( 'WebGLProgram', cacheKey );\n\n var gl = renderer.getContext();\n var defines = parameters.defines;\n var vertexShader = parameters.vertexShader;\n var fragmentShader = parameters.fragmentShader;\n var shadowMapTypeDefine = generateShadowMapTypeDefine(parameters);\n var envMapTypeDefine = generateEnvMapTypeDefine(parameters);\n var envMapModeDefine = generateEnvMapModeDefine(parameters);\n var envMapBlendingDefine = generateEnvMapBlendingDefine(parameters);\n var envMapCubeUVSize = generateCubeUVSize(parameters);\n var customExtensions = parameters.isWebGL2 ? '' : generateExtensions(parameters);\n var customDefines = generateDefines(defines);\n var program = gl.createProgram();\n var prefixVertex, prefixFragment;\n var versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\\n' : '';\n if (parameters.isRawShaderMaterial) {\n prefixVertex = [customDefines].filter(filterEmptyLine).join('\\n');\n if (prefixVertex.length > 0) {\n prefixVertex += '\\n';\n }\n prefixFragment = [customExtensions, customDefines].filter(filterEmptyLine).join('\\n');\n if (prefixFragment.length > 0) {\n prefixFragment += '\\n';\n }\n } else {\n prefixVertex = [generatePrecision(parameters), '#define SHADER_NAME ' + parameters.shaderName, customDefines, parameters.instancing ? '#define USE_INSTANCING' : '', parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '', parameters.useFog && parameters.fog ? '#define USE_FOG' : '', parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '', parameters.map ? '#define USE_MAP' : '', parameters.envMap ? '#define USE_ENVMAP' : '', parameters.envMap ? '#define ' + envMapModeDefine : '', parameters.lightMap ? '#define USE_LIGHTMAP' : '', parameters.aoMap ? '#define USE_AOMAP' : '', parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', parameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '', parameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '', parameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '', parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '', parameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '', parameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', parameters.alphaMap ? '#define USE_ALPHAMAP' : '', parameters.transmission ? '#define USE_TRANSMISSION' : '', parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '', parameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '', parameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '',\n //\n\n parameters.mapUv ? '#define MAP_UV ' + parameters.mapUv : '', parameters.alphaMapUv ? '#define ALPHAMAP_UV ' + parameters.alphaMapUv : '', parameters.lightMapUv ? '#define LIGHTMAP_UV ' + parameters.lightMapUv : '', parameters.aoMapUv ? '#define AOMAP_UV ' + parameters.aoMapUv : '', parameters.emissiveMapUv ? '#define EMISSIVEMAP_UV ' + parameters.emissiveMapUv : '', parameters.bumpMapUv ? '#define BUMPMAP_UV ' + parameters.bumpMapUv : '', parameters.normalMapUv ? '#define NORMALMAP_UV ' + parameters.normalMapUv : '', parameters.displacementMapUv ? '#define DISPLACEMENTMAP_UV ' + parameters.displacementMapUv : '', parameters.metalnessMapUv ? '#define METALNESSMAP_UV ' + parameters.metalnessMapUv : '', parameters.roughnessMapUv ? '#define ROUGHNESSMAP_UV ' + parameters.roughnessMapUv : '', parameters.clearcoatMapUv ? '#define CLEARCOATMAP_UV ' + parameters.clearcoatMapUv : '', parameters.clearcoatNormalMapUv ? '#define CLEARCOAT_NORMALMAP_UV ' + parameters.clearcoatNormalMapUv : '', parameters.clearcoatRoughnessMapUv ? '#define CLEARCOAT_ROUGHNESSMAP_UV ' + parameters.clearcoatRoughnessMapUv : '', parameters.iridescenceMapUv ? '#define IRIDESCENCEMAP_UV ' + parameters.iridescenceMapUv : '', parameters.iridescenceThicknessMapUv ? '#define IRIDESCENCE_THICKNESSMAP_UV ' + parameters.iridescenceThicknessMapUv : '', parameters.sheenColorMapUv ? '#define SHEEN_COLORMAP_UV ' + parameters.sheenColorMapUv : '', parameters.sheenRoughnessMapUv ? '#define SHEEN_ROUGHNESSMAP_UV ' + parameters.sheenRoughnessMapUv : '', parameters.specularMapUv ? '#define SPECULARMAP_UV ' + parameters.specularMapUv : '', parameters.specularColorMapUv ? '#define SPECULAR_COLORMAP_UV ' + parameters.specularColorMapUv : '', parameters.specularIntensityMapUv ? '#define SPECULAR_INTENSITYMAP_UV ' + parameters.specularIntensityMapUv : '', parameters.transmissionMapUv ? '#define TRANSMISSIONMAP_UV ' + parameters.transmissionMapUv : '', parameters.thicknessMapUv ? '#define THICKNESSMAP_UV ' + parameters.thicknessMapUv : '',\n //\n\n parameters.vertexTangents ? '#define USE_TANGENT' : '', parameters.vertexColors ? '#define USE_COLOR' : '', parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '', parameters.vertexUvs2 ? '#define USE_UV2' : '', parameters.pointsUvs ? '#define USE_POINTS_UV' : '', parameters.flatShading ? '#define FLAT_SHADED' : '', parameters.skinning ? '#define USE_SKINNING' : '', parameters.morphTargets ? '#define USE_MORPHTARGETS' : '', parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '', parameters.morphColors && parameters.isWebGL2 ? '#define USE_MORPHCOLORS' : '', parameters.morphTargetsCount > 0 && parameters.isWebGL2 ? '#define MORPHTARGETS_TEXTURE' : '', parameters.morphTargetsCount > 0 && parameters.isWebGL2 ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '', parameters.morphTargetsCount > 0 && parameters.isWebGL2 ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '', parameters.doubleSided ? '#define DOUBLE_SIDED' : '', parameters.flipSided ? '#define FLIP_SIDED' : '', parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '', parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '', 'uniform mat4 modelMatrix;', 'uniform mat4 modelViewMatrix;', 'uniform mat4 projectionMatrix;', 'uniform mat4 viewMatrix;', 'uniform mat3 normalMatrix;', 'uniform vec3 cameraPosition;', 'uniform bool isOrthographic;', '#ifdef USE_INSTANCING', '\tattribute mat4 instanceMatrix;', '#endif', '#ifdef USE_INSTANCING_COLOR', '\tattribute vec3 instanceColor;', '#endif', 'attribute vec3 position;', 'attribute vec3 normal;', 'attribute vec2 uv;', '#ifdef USE_TANGENT', '\tattribute vec4 tangent;', '#endif', '#if defined( USE_COLOR_ALPHA )', '\tattribute vec4 color;', '#elif defined( USE_COLOR )', '\tattribute vec3 color;', '#endif', '#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )', '\tattribute vec3 morphTarget0;', '\tattribute vec3 morphTarget1;', '\tattribute vec3 morphTarget2;', '\tattribute vec3 morphTarget3;', '\t#ifdef USE_MORPHNORMALS', '\t\tattribute vec3 morphNormal0;', '\t\tattribute vec3 morphNormal1;', '\t\tattribute vec3 morphNormal2;', '\t\tattribute vec3 morphNormal3;', '\t#else', '\t\tattribute vec3 morphTarget4;', '\t\tattribute vec3 morphTarget5;', '\t\tattribute vec3 morphTarget6;', '\t\tattribute vec3 morphTarget7;', '\t#endif', '#endif', '#ifdef USE_SKINNING', '\tattribute vec4 skinIndex;', '\tattribute vec4 skinWeight;', '#endif', '\\n'].filter(filterEmptyLine).join('\\n');\n prefixFragment = [customExtensions, generatePrecision(parameters), '#define SHADER_NAME ' + parameters.shaderName, customDefines, parameters.useFog && parameters.fog ? '#define USE_FOG' : '', parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '', parameters.map ? '#define USE_MAP' : '', parameters.matcap ? '#define USE_MATCAP' : '', parameters.envMap ? '#define USE_ENVMAP' : '', parameters.envMap ? '#define ' + envMapTypeDefine : '', parameters.envMap ? '#define ' + envMapModeDefine : '', parameters.envMap ? '#define ' + envMapBlendingDefine : '', envMapCubeUVSize ? '#define CUBEUV_TEXEL_WIDTH ' + envMapCubeUVSize.texelWidth : '', envMapCubeUVSize ? '#define CUBEUV_TEXEL_HEIGHT ' + envMapCubeUVSize.texelHeight : '', envMapCubeUVSize ? '#define CUBEUV_MAX_MIP ' + envMapCubeUVSize.maxMip + '.0' : '', parameters.lightMap ? '#define USE_LIGHTMAP' : '', parameters.aoMap ? '#define USE_AOMAP' : '', parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', parameters.normalMapObjectSpace ? '#define USE_NORMALMAP_OBJECTSPACE' : '', parameters.normalMapTangentSpace ? '#define USE_NORMALMAP_TANGENTSPACE' : '', parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', parameters.clearcoat ? '#define USE_CLEARCOAT' : '', parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.iridescence ? '#define USE_IRIDESCENCE' : '', parameters.iridescenceMap ? '#define USE_IRIDESCENCEMAP' : '', parameters.iridescenceThicknessMap ? '#define USE_IRIDESCENCE_THICKNESSMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.specularColorMap ? '#define USE_SPECULAR_COLORMAP' : '', parameters.specularIntensityMap ? '#define USE_SPECULAR_INTENSITYMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', parameters.alphaMap ? '#define USE_ALPHAMAP' : '', parameters.alphaTest ? '#define USE_ALPHATEST' : '', parameters.sheen ? '#define USE_SHEEN' : '', parameters.sheenColorMap ? '#define USE_SHEEN_COLORMAP' : '', parameters.sheenRoughnessMap ? '#define USE_SHEEN_ROUGHNESSMAP' : '', parameters.transmission ? '#define USE_TRANSMISSION' : '', parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '', parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '', parameters.vertexTangents ? '#define USE_TANGENT' : '', parameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '', parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '', parameters.vertexUvs2 ? '#define USE_UV2' : '', parameters.pointsUvs ? '#define USE_POINTS_UV' : '', parameters.gradientMap ? '#define USE_GRADIENTMAP' : '', parameters.flatShading ? '#define FLAT_SHADED' : '', parameters.doubleSided ? '#define DOUBLE_SIDED' : '', parameters.flipSided ? '#define FLIP_SIDED' : '', parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '', parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '', parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '', 'uniform mat4 viewMatrix;', 'uniform vec3 cameraPosition;', 'uniform bool isOrthographic;', parameters.toneMapping !== NoToneMapping ? '#define TONE_MAPPING' : '', parameters.toneMapping !== NoToneMapping ? ShaderChunk['tonemapping_pars_fragment'] : '',\n // this code is required here because it is used by the toneMapping() function defined below\n parameters.toneMapping !== NoToneMapping ? getToneMappingFunction('toneMapping', parameters.toneMapping) : '', parameters.dithering ? '#define DITHERING' : '', parameters.opaque ? '#define OPAQUE' : '', ShaderChunk['encodings_pars_fragment'],\n // this code is required here because it is used by the various encoding/decoding function defined below\n getTexelEncodingFunction('linearToOutputTexel', parameters.outputEncoding), parameters.useDepthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '', '\\n'].filter(filterEmptyLine).join('\\n');\n }\n vertexShader = resolveIncludes(vertexShader);\n vertexShader = replaceLightNums(vertexShader, parameters);\n vertexShader = replaceClippingPlaneNums(vertexShader, parameters);\n fragmentShader = resolveIncludes(fragmentShader);\n fragmentShader = replaceLightNums(fragmentShader, parameters);\n fragmentShader = replaceClippingPlaneNums(fragmentShader, parameters);\n vertexShader = unrollLoops(vertexShader);\n fragmentShader = unrollLoops(fragmentShader);\n if (parameters.isWebGL2 && parameters.isRawShaderMaterial !== true) {\n // GLSL 3.0 conversion for built-in materials and ShaderMaterial\n\n versionString = '#version 300 es\\n';\n prefixVertex = ['precision mediump sampler2DArray;', '#define attribute in', '#define varying out', '#define texture2D texture'].join('\\n') + '\\n' + prefixVertex;\n prefixFragment = ['#define varying in', parameters.glslVersion === GLSL3 ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;', parameters.glslVersion === GLSL3 ? '' : '#define gl_FragColor pc_fragColor', '#define gl_FragDepthEXT gl_FragDepth', '#define texture2D texture', '#define textureCube texture', '#define texture2DProj textureProj', '#define texture2DLodEXT textureLod', '#define texture2DProjLodEXT textureProjLod', '#define textureCubeLodEXT textureLod', '#define texture2DGradEXT textureGrad', '#define texture2DProjGradEXT textureProjGrad', '#define textureCubeGradEXT textureGrad'].join('\\n') + '\\n' + prefixFragment;\n }\n var vertexGlsl = versionString + prefixVertex + vertexShader;\n var fragmentGlsl = versionString + prefixFragment + fragmentShader;\n\n // console.log( '*VERTEX*', vertexGlsl );\n // console.log( '*FRAGMENT*', fragmentGlsl );\n\n var glVertexShader = WebGLShader(gl, 35633, vertexGlsl);\n var glFragmentShader = WebGLShader(gl, 35632, fragmentGlsl);\n gl.attachShader(program, glVertexShader);\n gl.attachShader(program, glFragmentShader);\n\n // Force a particular attribute to index 0.\n\n if (parameters.index0AttributeName !== undefined) {\n gl.bindAttribLocation(program, 0, parameters.index0AttributeName);\n } else if (parameters.morphTargets === true) {\n // programs with morphTargets displace position out of attribute 0\n gl.bindAttribLocation(program, 0, 'position');\n }\n gl.linkProgram(program);\n\n // check for link errors\n if (renderer.debug.checkShaderErrors) {\n var programLog = gl.getProgramInfoLog(program).trim();\n var vertexLog = gl.getShaderInfoLog(glVertexShader).trim();\n var fragmentLog = gl.getShaderInfoLog(glFragmentShader).trim();\n var runnable = true;\n var haveDiagnostics = true;\n if (gl.getProgramParameter(program, 35714) === false) {\n runnable = false;\n if (typeof renderer.debug.onShaderError === 'function') {\n renderer.debug.onShaderError(gl, program, glVertexShader, glFragmentShader);\n } else {\n // default error reporting\n\n var vertexErrors = getShaderErrors(gl, glVertexShader, 'vertex');\n var fragmentErrors = getShaderErrors(gl, glFragmentShader, 'fragment');\n console.error('THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' + 'VALIDATE_STATUS ' + gl.getProgramParameter(program, 35715) + '\\n\\n' + 'Program Info Log: ' + programLog + '\\n' + vertexErrors + '\\n' + fragmentErrors);\n }\n } else if (programLog !== '') {\n console.warn('THREE.WebGLProgram: Program Info Log:', programLog);\n } else if (vertexLog === '' || fragmentLog === '') {\n haveDiagnostics = false;\n }\n if (haveDiagnostics) {\n this.diagnostics = {\n runnable: runnable,\n programLog: programLog,\n vertexShader: {\n log: vertexLog,\n prefix: prefixVertex\n },\n fragmentShader: {\n log: fragmentLog,\n prefix: prefixFragment\n }\n };\n }\n }\n\n // Clean up\n\n // Crashes in iOS9 and iOS10. #18402\n // gl.detachShader( program, glVertexShader );\n // gl.detachShader( program, glFragmentShader );\n\n gl.deleteShader(glVertexShader);\n gl.deleteShader(glFragmentShader);\n\n // set up caching for uniform locations\n\n var cachedUniforms;\n this.getUniforms = function () {\n if (cachedUniforms === undefined) {\n cachedUniforms = new WebGLUniforms(gl, program);\n }\n return cachedUniforms;\n };\n\n // set up caching for attribute locations\n\n var cachedAttributes;\n this.getAttributes = function () {\n if (cachedAttributes === undefined) {\n cachedAttributes = fetchAttributeLocations(gl, program);\n }\n return cachedAttributes;\n };\n\n // free resource\n\n this.destroy = function () {\n bindingStates.releaseStatesOfProgram(this);\n gl.deleteProgram(program);\n this.program = undefined;\n };\n\n //\n\n this.name = parameters.shaderName;\n this.id = programIdCount++;\n this.cacheKey = cacheKey;\n this.usedTimes = 1;\n this.program = program;\n this.vertexShader = glVertexShader;\n this.fragmentShader = glFragmentShader;\n return this;\n}\nvar _id = 0;\nvar WebGLShaderCache = /*#__PURE__*/function () {\n function WebGLShaderCache() {\n _classCallCheck(this, WebGLShaderCache);\n this.shaderCache = new Map();\n this.materialCache = new Map();\n }\n _createClass(WebGLShaderCache, [{\n key: \"update\",\n value: function update(material) {\n var vertexShader = material.vertexShader;\n var fragmentShader = material.fragmentShader;\n var vertexShaderStage = this._getShaderStage(vertexShader);\n var fragmentShaderStage = this._getShaderStage(fragmentShader);\n var materialShaders = this._getShaderCacheForMaterial(material);\n if (materialShaders.has(vertexShaderStage) === false) {\n materialShaders.add(vertexShaderStage);\n vertexShaderStage.usedTimes++;\n }\n if (materialShaders.has(fragmentShaderStage) === false) {\n materialShaders.add(fragmentShaderStage);\n fragmentShaderStage.usedTimes++;\n }\n return this;\n }\n }, {\n key: \"remove\",\n value: function remove(material) {\n var materialShaders = this.materialCache.get(material);\n var _iterator = _createForOfIteratorHelper(materialShaders),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var shaderStage = _step.value;\n shaderStage.usedTimes--;\n if (shaderStage.usedTimes === 0) this.shaderCache[\"delete\"](shaderStage.code);\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n this.materialCache[\"delete\"](material);\n return this;\n }\n }, {\n key: \"getVertexShaderID\",\n value: function getVertexShaderID(material) {\n return this._getShaderStage(material.vertexShader).id;\n }\n }, {\n key: \"getFragmentShaderID\",\n value: function getFragmentShaderID(material) {\n return this._getShaderStage(material.fragmentShader).id;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.shaderCache.clear();\n this.materialCache.clear();\n }\n }, {\n key: \"_getShaderCacheForMaterial\",\n value: function _getShaderCacheForMaterial(material) {\n var cache = this.materialCache;\n var set = cache.get(material);\n if (set === undefined) {\n set = new Set();\n cache.set(material, set);\n }\n return set;\n }\n }, {\n key: \"_getShaderStage\",\n value: function _getShaderStage(code) {\n var cache = this.shaderCache;\n var stage = cache.get(code);\n if (stage === undefined) {\n stage = new WebGLShaderStage(code);\n cache.set(code, stage);\n }\n return stage;\n }\n }]);\n return WebGLShaderCache;\n}();\nvar WebGLShaderStage = /*#__PURE__*/_createClass(function WebGLShaderStage(code) {\n _classCallCheck(this, WebGLShaderStage);\n this.id = _id++;\n this.code = code;\n this.usedTimes = 0;\n});\nfunction WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping) {\n var _programLayers = new Layers();\n var _customShaders = new WebGLShaderCache();\n var programs = [];\n var IS_WEBGL2 = capabilities.isWebGL2;\n var logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;\n var SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;\n var precision = capabilities.precision;\n var shaderIDs = {\n MeshDepthMaterial: 'depth',\n MeshDistanceMaterial: 'distanceRGBA',\n MeshNormalMaterial: 'normal',\n MeshBasicMaterial: 'basic',\n MeshLambertMaterial: 'lambert',\n MeshPhongMaterial: 'phong',\n MeshToonMaterial: 'toon',\n MeshStandardMaterial: 'physical',\n MeshPhysicalMaterial: 'physical',\n MeshMatcapMaterial: 'matcap',\n LineBasicMaterial: 'basic',\n LineDashedMaterial: 'dashed',\n PointsMaterial: 'points',\n ShadowMaterial: 'shadow',\n SpriteMaterial: 'sprite'\n };\n function getChannel(value) {\n if (value === 1) return 'uv2';\n return 'uv';\n }\n function getParameters(material, lights, shadows, scene, object) {\n var fog = scene.fog;\n var geometry = object.geometry;\n var environment = material.isMeshStandardMaterial ? scene.environment : null;\n var envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment);\n var envMapCubeUVHeight = !!envMap && envMap.mapping === CubeUVReflectionMapping ? envMap.image.height : null;\n var shaderID = shaderIDs[material.type];\n\n // heuristics to create shader parameters according to lights in the scene\n // (not to blow over maxLights budget)\n\n if (material.precision !== null) {\n precision = capabilities.getMaxPrecision(material.precision);\n if (precision !== material.precision) {\n console.warn('THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.');\n }\n }\n\n //\n\n var morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n var morphTargetsCount = morphAttribute !== undefined ? morphAttribute.length : 0;\n var morphTextureStride = 0;\n if (geometry.morphAttributes.position !== undefined) morphTextureStride = 1;\n if (geometry.morphAttributes.normal !== undefined) morphTextureStride = 2;\n if (geometry.morphAttributes.color !== undefined) morphTextureStride = 3;\n\n //\n\n var vertexShader, fragmentShader;\n var customVertexShaderID, customFragmentShaderID;\n if (shaderID) {\n var shader = ShaderLib[shaderID];\n vertexShader = shader.vertexShader;\n fragmentShader = shader.fragmentShader;\n } else {\n vertexShader = material.vertexShader;\n fragmentShader = material.fragmentShader;\n _customShaders.update(material);\n customVertexShaderID = _customShaders.getVertexShaderID(material);\n customFragmentShaderID = _customShaders.getFragmentShaderID(material);\n }\n var currentRenderTarget = renderer.getRenderTarget();\n var IS_INSTANCEDMESH = object.isInstancedMesh === true;\n var HAS_MAP = !!material.map;\n var HAS_MATCAP = !!material.matcap;\n var HAS_ENVMAP = !!envMap;\n var HAS_AOMAP = !!material.aoMap;\n var HAS_LIGHTMAP = !!material.lightMap;\n var HAS_BUMPMAP = !!material.bumpMap;\n var HAS_NORMALMAP = !!material.normalMap;\n var HAS_DISPLACEMENTMAP = !!material.displacementMap;\n var HAS_EMISSIVEMAP = !!material.emissiveMap;\n var HAS_METALNESSMAP = !!material.metalnessMap;\n var HAS_ROUGHNESSMAP = !!material.roughnessMap;\n var HAS_CLEARCOAT = material.clearcoat > 0;\n var HAS_IRIDESCENCE = material.iridescence > 0;\n var HAS_SHEEN = material.sheen > 0;\n var HAS_TRANSMISSION = material.transmission > 0;\n var HAS_CLEARCOATMAP = HAS_CLEARCOAT && !!material.clearcoatMap;\n var HAS_CLEARCOAT_NORMALMAP = HAS_CLEARCOAT && !!material.clearcoatNormalMap;\n var HAS_CLEARCOAT_ROUGHNESSMAP = HAS_CLEARCOAT && !!material.clearcoatRoughnessMap;\n var HAS_IRIDESCENCEMAP = HAS_IRIDESCENCE && !!material.iridescenceMap;\n var HAS_IRIDESCENCE_THICKNESSMAP = HAS_IRIDESCENCE && !!material.iridescenceThicknessMap;\n var HAS_SHEEN_COLORMAP = HAS_SHEEN && !!material.sheenColorMap;\n var HAS_SHEEN_ROUGHNESSMAP = HAS_SHEEN && !!material.sheenRoughnessMap;\n var HAS_SPECULARMAP = !!material.specularMap;\n var HAS_SPECULAR_COLORMAP = !!material.specularColorMap;\n var HAS_SPECULAR_INTENSITYMAP = !!material.specularIntensityMap;\n var HAS_TRANSMISSIONMAP = HAS_TRANSMISSION && !!material.transmissionMap;\n var HAS_THICKNESSMAP = HAS_TRANSMISSION && !!material.thicknessMap;\n var HAS_GRADIENTMAP = !!material.gradientMap;\n var HAS_ALPHAMAP = !!material.alphaMap;\n var HAS_ALPHATEST = material.alphaTest > 0;\n var HAS_EXTENSIONS = !!material.extensions;\n var HAS_ATTRIBUTE_UV2 = !!geometry.attributes.uv2;\n var parameters = {\n isWebGL2: IS_WEBGL2,\n shaderID: shaderID,\n shaderName: material.type,\n vertexShader: vertexShader,\n fragmentShader: fragmentShader,\n defines: material.defines,\n customVertexShaderID: customVertexShaderID,\n customFragmentShaderID: customFragmentShaderID,\n isRawShaderMaterial: material.isRawShaderMaterial === true,\n glslVersion: material.glslVersion,\n precision: precision,\n instancing: IS_INSTANCEDMESH,\n instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,\n supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,\n outputEncoding: currentRenderTarget === null ? renderer.outputEncoding : currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.encoding : LinearEncoding,\n map: HAS_MAP,\n matcap: HAS_MATCAP,\n envMap: HAS_ENVMAP,\n envMapMode: HAS_ENVMAP && envMap.mapping,\n envMapCubeUVHeight: envMapCubeUVHeight,\n aoMap: HAS_AOMAP,\n lightMap: HAS_LIGHTMAP,\n bumpMap: HAS_BUMPMAP,\n normalMap: HAS_NORMALMAP,\n displacementMap: SUPPORTS_VERTEX_TEXTURES && HAS_DISPLACEMENTMAP,\n emissiveMap: HAS_EMISSIVEMAP,\n normalMapObjectSpace: HAS_NORMALMAP && material.normalMapType === ObjectSpaceNormalMap,\n normalMapTangentSpace: HAS_NORMALMAP && material.normalMapType === TangentSpaceNormalMap,\n decodeVideoTexture: HAS_MAP && material.map.isVideoTexture === true && material.map.encoding === sRGBEncoding,\n metalnessMap: HAS_METALNESSMAP,\n roughnessMap: HAS_ROUGHNESSMAP,\n clearcoat: HAS_CLEARCOAT,\n clearcoatMap: HAS_CLEARCOATMAP,\n clearcoatNormalMap: HAS_CLEARCOAT_NORMALMAP,\n clearcoatRoughnessMap: HAS_CLEARCOAT_ROUGHNESSMAP,\n iridescence: HAS_IRIDESCENCE,\n iridescenceMap: HAS_IRIDESCENCEMAP,\n iridescenceThicknessMap: HAS_IRIDESCENCE_THICKNESSMAP,\n sheen: HAS_SHEEN,\n sheenColorMap: HAS_SHEEN_COLORMAP,\n sheenRoughnessMap: HAS_SHEEN_ROUGHNESSMAP,\n specularMap: HAS_SPECULARMAP,\n specularColorMap: HAS_SPECULAR_COLORMAP,\n specularIntensityMap: HAS_SPECULAR_INTENSITYMAP,\n transmission: HAS_TRANSMISSION,\n transmissionMap: HAS_TRANSMISSIONMAP,\n thicknessMap: HAS_THICKNESSMAP,\n gradientMap: HAS_GRADIENTMAP,\n opaque: material.transparent === false && material.blending === NormalBlending,\n alphaMap: HAS_ALPHAMAP,\n alphaTest: HAS_ALPHATEST,\n combine: material.combine,\n //\n\n mapUv: HAS_MAP && getChannel(material.map.channel),\n aoMapUv: HAS_AOMAP && getChannel(material.aoMap.channel),\n lightMapUv: HAS_LIGHTMAP && getChannel(material.lightMap.channel),\n bumpMapUv: HAS_BUMPMAP && getChannel(material.bumpMap.channel),\n normalMapUv: HAS_NORMALMAP && getChannel(material.normalMap.channel),\n displacementMapUv: HAS_DISPLACEMENTMAP && getChannel(material.displacementMap.channel),\n emissiveMapUv: HAS_EMISSIVEMAP && getChannel(material.emissiveMap.channel),\n metalnessMapUv: HAS_METALNESSMAP && getChannel(material.metalnessMap.channel),\n roughnessMapUv: HAS_ROUGHNESSMAP && getChannel(material.roughnessMap.channel),\n clearcoatMapUv: HAS_CLEARCOATMAP && getChannel(material.clearcoatMap.channel),\n clearcoatNormalMapUv: HAS_CLEARCOAT_NORMALMAP && getChannel(material.clearcoatNormalMap.channel),\n clearcoatRoughnessMapUv: HAS_CLEARCOAT_ROUGHNESSMAP && getChannel(material.clearcoatRoughnessMap.channel),\n iridescenceMapUv: HAS_IRIDESCENCEMAP && getChannel(material.iridescenceMap.channel),\n iridescenceThicknessMapUv: HAS_IRIDESCENCE_THICKNESSMAP && getChannel(material.iridescenceThicknessMap.channel),\n sheenColorMapUv: HAS_SHEEN_COLORMAP && getChannel(material.sheenColorMap.channel),\n sheenRoughnessMapUv: HAS_SHEEN_ROUGHNESSMAP && getChannel(material.sheenRoughnessMap.channel),\n specularMapUv: HAS_SPECULARMAP && getChannel(material.specularMap.channel),\n specularColorMapUv: HAS_SPECULAR_COLORMAP && getChannel(material.specularColorMap.channel),\n specularIntensityMapUv: HAS_SPECULAR_INTENSITYMAP && getChannel(material.specularIntensityMap.channel),\n transmissionMapUv: HAS_TRANSMISSIONMAP && getChannel(material.transmissionMap.channel),\n thicknessMapUv: HAS_THICKNESSMAP && getChannel(material.thicknessMap.channel),\n alphaMapUv: HAS_ALPHAMAP && getChannel(material.alphaMap.channel),\n //\n\n vertexTangents: HAS_NORMALMAP && !!geometry.attributes.tangent,\n vertexColors: material.vertexColors,\n vertexAlphas: material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4,\n vertexUvs2: HAS_ATTRIBUTE_UV2,\n pointsUvs: object.isPoints === true && !!geometry.attributes.uv && (HAS_MAP || HAS_ALPHAMAP),\n fog: !!fog,\n useFog: material.fog === true,\n fogExp2: fog && fog.isFogExp2,\n flatShading: material.flatShading === true,\n sizeAttenuation: material.sizeAttenuation === true,\n logarithmicDepthBuffer: logarithmicDepthBuffer,\n skinning: object.isSkinnedMesh === true,\n morphTargets: geometry.morphAttributes.position !== undefined,\n morphNormals: geometry.morphAttributes.normal !== undefined,\n morphColors: geometry.morphAttributes.color !== undefined,\n morphTargetsCount: morphTargetsCount,\n morphTextureStride: morphTextureStride,\n numDirLights: lights.directional.length,\n numPointLights: lights.point.length,\n numSpotLights: lights.spot.length,\n numSpotLightMaps: lights.spotLightMap.length,\n numRectAreaLights: lights.rectArea.length,\n numHemiLights: lights.hemi.length,\n numDirLightShadows: lights.directionalShadowMap.length,\n numPointLightShadows: lights.pointShadowMap.length,\n numSpotLightShadows: lights.spotShadowMap.length,\n numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,\n numClippingPlanes: clipping.numPlanes,\n numClipIntersection: clipping.numIntersection,\n dithering: material.dithering,\n shadowMapEnabled: renderer.shadowMap.enabled && shadows.length > 0,\n shadowMapType: renderer.shadowMap.type,\n toneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping,\n useLegacyLights: renderer.useLegacyLights,\n premultipliedAlpha: material.premultipliedAlpha,\n doubleSided: material.side === DoubleSide,\n flipSided: material.side === BackSide,\n useDepthPacking: material.depthPacking >= 0,\n depthPacking: material.depthPacking || 0,\n index0AttributeName: material.index0AttributeName,\n extensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true,\n extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,\n extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,\n extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,\n rendererExtensionFragDepth: IS_WEBGL2 || extensions.has('EXT_frag_depth'),\n rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has('WEBGL_draw_buffers'),\n rendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has('EXT_shader_texture_lod'),\n customProgramCacheKey: material.customProgramCacheKey()\n };\n return parameters;\n }\n function getProgramCacheKey(parameters) {\n var array = [];\n if (parameters.shaderID) {\n array.push(parameters.shaderID);\n } else {\n array.push(parameters.customVertexShaderID);\n array.push(parameters.customFragmentShaderID);\n }\n if (parameters.defines !== undefined) {\n for (var name in parameters.defines) {\n array.push(name);\n array.push(parameters.defines[name]);\n }\n }\n if (parameters.isRawShaderMaterial === false) {\n getProgramCacheKeyParameters(array, parameters);\n getProgramCacheKeyBooleans(array, parameters);\n array.push(renderer.outputEncoding);\n }\n array.push(parameters.customProgramCacheKey);\n return array.join();\n }\n function getProgramCacheKeyParameters(array, parameters) {\n array.push(parameters.precision);\n array.push(parameters.outputEncoding);\n array.push(parameters.envMapMode);\n array.push(parameters.envMapCubeUVHeight);\n array.push(parameters.mapUv);\n array.push(parameters.alphaMapUv);\n array.push(parameters.lightMapUv);\n array.push(parameters.aoMapUv);\n array.push(parameters.bumpMapUv);\n array.push(parameters.normalMapUv);\n array.push(parameters.displacementMapUv);\n array.push(parameters.emissiveMapUv);\n array.push(parameters.metalnessMapUv);\n array.push(parameters.roughnessMapUv);\n array.push(parameters.clearcoatMapUv);\n array.push(parameters.clearcoatNormalMapUv);\n array.push(parameters.clearcoatRoughnessMapUv);\n array.push(parameters.iridescenceMapUv);\n array.push(parameters.iridescenceThicknessMapUv);\n array.push(parameters.sheenColorMapUv);\n array.push(parameters.sheenRoughnessMapUv);\n array.push(parameters.specularMapUv);\n array.push(parameters.specularColorMapUv);\n array.push(parameters.specularIntensityMapUv);\n array.push(parameters.transmissionMapUv);\n array.push(parameters.thicknessMapUv);\n array.push(parameters.combine);\n array.push(parameters.fogExp2);\n array.push(parameters.sizeAttenuation);\n array.push(parameters.morphTargetsCount);\n array.push(parameters.morphAttributeCount);\n array.push(parameters.numDirLights);\n array.push(parameters.numPointLights);\n array.push(parameters.numSpotLights);\n array.push(parameters.numSpotLightMaps);\n array.push(parameters.numHemiLights);\n array.push(parameters.numRectAreaLights);\n array.push(parameters.numDirLightShadows);\n array.push(parameters.numPointLightShadows);\n array.push(parameters.numSpotLightShadows);\n array.push(parameters.numSpotLightShadowsWithMaps);\n array.push(parameters.shadowMapType);\n array.push(parameters.toneMapping);\n array.push(parameters.numClippingPlanes);\n array.push(parameters.numClipIntersection);\n array.push(parameters.depthPacking);\n }\n function getProgramCacheKeyBooleans(array, parameters) {\n _programLayers.disableAll();\n if (parameters.isWebGL2) _programLayers.enable(0);\n if (parameters.supportsVertexTextures) _programLayers.enable(1);\n if (parameters.instancing) _programLayers.enable(2);\n if (parameters.instancingColor) _programLayers.enable(3);\n if (parameters.matcap) _programLayers.enable(4);\n if (parameters.envMap) _programLayers.enable(5);\n if (parameters.normalMapObjectSpace) _programLayers.enable(6);\n if (parameters.normalMapTangentSpace) _programLayers.enable(7);\n if (parameters.clearcoat) _programLayers.enable(8);\n if (parameters.iridescence) _programLayers.enable(9);\n if (parameters.alphaTest) _programLayers.enable(10);\n if (parameters.vertexColors) _programLayers.enable(11);\n if (parameters.vertexAlphas) _programLayers.enable(12);\n if (parameters.vertexUvs2) _programLayers.enable(13);\n if (parameters.vertexTangents) _programLayers.enable(14);\n array.push(_programLayers.mask);\n _programLayers.disableAll();\n if (parameters.fog) _programLayers.enable(0);\n if (parameters.useFog) _programLayers.enable(1);\n if (parameters.flatShading) _programLayers.enable(2);\n if (parameters.logarithmicDepthBuffer) _programLayers.enable(3);\n if (parameters.skinning) _programLayers.enable(4);\n if (parameters.morphTargets) _programLayers.enable(5);\n if (parameters.morphNormals) _programLayers.enable(6);\n if (parameters.morphColors) _programLayers.enable(7);\n if (parameters.premultipliedAlpha) _programLayers.enable(8);\n if (parameters.shadowMapEnabled) _programLayers.enable(9);\n if (parameters.useLegacyLights) _programLayers.enable(10);\n if (parameters.doubleSided) _programLayers.enable(11);\n if (parameters.flipSided) _programLayers.enable(12);\n if (parameters.useDepthPacking) _programLayers.enable(13);\n if (parameters.dithering) _programLayers.enable(14);\n if (parameters.transmission) _programLayers.enable(15);\n if (parameters.sheen) _programLayers.enable(16);\n if (parameters.decodeVideoTexture) _programLayers.enable(17);\n if (parameters.opaque) _programLayers.enable(18);\n if (parameters.pointsUvs) _programLayers.enable(19);\n array.push(_programLayers.mask);\n }\n function getUniforms(material) {\n var shaderID = shaderIDs[material.type];\n var uniforms;\n if (shaderID) {\n var shader = ShaderLib[shaderID];\n uniforms = UniformsUtils.clone(shader.uniforms);\n } else {\n uniforms = material.uniforms;\n }\n return uniforms;\n }\n function acquireProgram(parameters, cacheKey) {\n var program;\n\n // Check if code has been already compiled\n for (var p = 0, pl = programs.length; p < pl; p++) {\n var preexistingProgram = programs[p];\n if (preexistingProgram.cacheKey === cacheKey) {\n program = preexistingProgram;\n ++program.usedTimes;\n break;\n }\n }\n if (program === undefined) {\n program = new WebGLProgram(renderer, cacheKey, parameters, bindingStates);\n programs.push(program);\n }\n return program;\n }\n function releaseProgram(program) {\n if (--program.usedTimes === 0) {\n // Remove from unordered set\n var i = programs.indexOf(program);\n programs[i] = programs[programs.length - 1];\n programs.pop();\n\n // Free WebGL resources\n program.destroy();\n }\n }\n function releaseShaderCache(material) {\n _customShaders.remove(material);\n }\n function dispose() {\n _customShaders.dispose();\n }\n return {\n getParameters: getParameters,\n getProgramCacheKey: getProgramCacheKey,\n getUniforms: getUniforms,\n acquireProgram: acquireProgram,\n releaseProgram: releaseProgram,\n releaseShaderCache: releaseShaderCache,\n // Exposed for resource monitoring & error feedback via renderer.info:\n programs: programs,\n dispose: dispose\n };\n}\nfunction WebGLProperties() {\n var properties = new WeakMap();\n function get(object) {\n var map = properties.get(object);\n if (map === undefined) {\n map = {};\n properties.set(object, map);\n }\n return map;\n }\n function remove(object) {\n properties[\"delete\"](object);\n }\n function update(object, key, value) {\n properties.get(object)[key] = value;\n }\n function dispose() {\n properties = new WeakMap();\n }\n return {\n get: get,\n remove: remove,\n update: update,\n dispose: dispose\n };\n}\nfunction painterSortStable(a, b) {\n if (a.groupOrder !== b.groupOrder) {\n return a.groupOrder - b.groupOrder;\n } else if (a.renderOrder !== b.renderOrder) {\n return a.renderOrder - b.renderOrder;\n } else if (a.material.id !== b.material.id) {\n return a.material.id - b.material.id;\n } else if (a.z !== b.z) {\n return a.z - b.z;\n } else {\n return a.id - b.id;\n }\n}\nfunction reversePainterSortStable(a, b) {\n if (a.groupOrder !== b.groupOrder) {\n return a.groupOrder - b.groupOrder;\n } else if (a.renderOrder !== b.renderOrder) {\n return a.renderOrder - b.renderOrder;\n } else if (a.z !== b.z) {\n return b.z - a.z;\n } else {\n return a.id - b.id;\n }\n}\nfunction WebGLRenderList() {\n var renderItems = [];\n var renderItemsIndex = 0;\n var opaque = [];\n var transmissive = [];\n var transparent = [];\n function init() {\n renderItemsIndex = 0;\n opaque.length = 0;\n transmissive.length = 0;\n transparent.length = 0;\n }\n function getNextRenderItem(object, geometry, material, groupOrder, z, group) {\n var renderItem = renderItems[renderItemsIndex];\n if (renderItem === undefined) {\n renderItem = {\n id: object.id,\n object: object,\n geometry: geometry,\n material: material,\n groupOrder: groupOrder,\n renderOrder: object.renderOrder,\n z: z,\n group: group\n };\n renderItems[renderItemsIndex] = renderItem;\n } else {\n renderItem.id = object.id;\n renderItem.object = object;\n renderItem.geometry = geometry;\n renderItem.material = material;\n renderItem.groupOrder = groupOrder;\n renderItem.renderOrder = object.renderOrder;\n renderItem.z = z;\n renderItem.group = group;\n }\n renderItemsIndex++;\n return renderItem;\n }\n function push(object, geometry, material, groupOrder, z, group) {\n var renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group);\n if (material.transmission > 0.0) {\n transmissive.push(renderItem);\n } else if (material.transparent === true) {\n transparent.push(renderItem);\n } else {\n opaque.push(renderItem);\n }\n }\n function unshift(object, geometry, material, groupOrder, z, group) {\n var renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group);\n if (material.transmission > 0.0) {\n transmissive.unshift(renderItem);\n } else if (material.transparent === true) {\n transparent.unshift(renderItem);\n } else {\n opaque.unshift(renderItem);\n }\n }\n function sort(customOpaqueSort, customTransparentSort) {\n if (opaque.length > 1) opaque.sort(customOpaqueSort || painterSortStable);\n if (transmissive.length > 1) transmissive.sort(customTransparentSort || reversePainterSortStable);\n if (transparent.length > 1) transparent.sort(customTransparentSort || reversePainterSortStable);\n }\n function finish() {\n // Clear references from inactive renderItems in the list\n\n for (var i = renderItemsIndex, il = renderItems.length; i < il; i++) {\n var renderItem = renderItems[i];\n if (renderItem.id === null) break;\n renderItem.id = null;\n renderItem.object = null;\n renderItem.geometry = null;\n renderItem.material = null;\n renderItem.group = null;\n }\n }\n return {\n opaque: opaque,\n transmissive: transmissive,\n transparent: transparent,\n init: init,\n push: push,\n unshift: unshift,\n finish: finish,\n sort: sort\n };\n}\nfunction WebGLRenderLists() {\n var lists = new WeakMap();\n function get(scene, renderCallDepth) {\n var listArray = lists.get(scene);\n var list;\n if (listArray === undefined) {\n list = new WebGLRenderList();\n lists.set(scene, [list]);\n } else {\n if (renderCallDepth >= listArray.length) {\n list = new WebGLRenderList();\n listArray.push(list);\n } else {\n list = listArray[renderCallDepth];\n }\n }\n return list;\n }\n function dispose() {\n lists = new WeakMap();\n }\n return {\n get: get,\n dispose: dispose\n };\n}\nfunction UniformsCache() {\n var lights = {};\n return {\n get: function get(light) {\n if (lights[light.id] !== undefined) {\n return lights[light.id];\n }\n var uniforms;\n switch (light.type) {\n case 'DirectionalLight':\n uniforms = {\n direction: new Vector3(),\n color: new Color()\n };\n break;\n case 'SpotLight':\n uniforms = {\n position: new Vector3(),\n direction: new Vector3(),\n color: new Color(),\n distance: 0,\n coneCos: 0,\n penumbraCos: 0,\n decay: 0\n };\n break;\n case 'PointLight':\n uniforms = {\n position: new Vector3(),\n color: new Color(),\n distance: 0,\n decay: 0\n };\n break;\n case 'HemisphereLight':\n uniforms = {\n direction: new Vector3(),\n skyColor: new Color(),\n groundColor: new Color()\n };\n break;\n case 'RectAreaLight':\n uniforms = {\n color: new Color(),\n position: new Vector3(),\n halfWidth: new Vector3(),\n halfHeight: new Vector3()\n };\n break;\n }\n lights[light.id] = uniforms;\n return uniforms;\n }\n };\n}\nfunction ShadowUniformsCache() {\n var lights = {};\n return {\n get: function get(light) {\n if (lights[light.id] !== undefined) {\n return lights[light.id];\n }\n var uniforms;\n switch (light.type) {\n case 'DirectionalLight':\n uniforms = {\n shadowBias: 0,\n shadowNormalBias: 0,\n shadowRadius: 1,\n shadowMapSize: new Vector2()\n };\n break;\n case 'SpotLight':\n uniforms = {\n shadowBias: 0,\n shadowNormalBias: 0,\n shadowRadius: 1,\n shadowMapSize: new Vector2()\n };\n break;\n case 'PointLight':\n uniforms = {\n shadowBias: 0,\n shadowNormalBias: 0,\n shadowRadius: 1,\n shadowMapSize: new Vector2(),\n shadowCameraNear: 1,\n shadowCameraFar: 1000\n };\n break;\n\n // TODO (abelnation): set RectAreaLight shadow uniforms\n }\n\n lights[light.id] = uniforms;\n return uniforms;\n }\n };\n}\nvar nextVersion = 0;\nfunction shadowCastingAndTexturingLightsFirst(lightA, lightB) {\n return (lightB.castShadow ? 2 : 0) - (lightA.castShadow ? 2 : 0) + (lightB.map ? 1 : 0) - (lightA.map ? 1 : 0);\n}\nfunction WebGLLights(extensions, capabilities) {\n var cache = new UniformsCache();\n var shadowCache = ShadowUniformsCache();\n var state = {\n version: 0,\n hash: {\n directionalLength: -1,\n pointLength: -1,\n spotLength: -1,\n rectAreaLength: -1,\n hemiLength: -1,\n numDirectionalShadows: -1,\n numPointShadows: -1,\n numSpotShadows: -1,\n numSpotMaps: -1\n },\n ambient: [0, 0, 0],\n probe: [],\n directional: [],\n directionalShadow: [],\n directionalShadowMap: [],\n directionalShadowMatrix: [],\n spot: [],\n spotLightMap: [],\n spotShadow: [],\n spotShadowMap: [],\n spotLightMatrix: [],\n rectArea: [],\n rectAreaLTC1: null,\n rectAreaLTC2: null,\n point: [],\n pointShadow: [],\n pointShadowMap: [],\n pointShadowMatrix: [],\n hemi: [],\n numSpotLightShadowsWithMaps: 0\n };\n for (var i = 0; i < 9; i++) state.probe.push(new Vector3());\n var vector3 = new Vector3();\n var matrix4 = new Matrix4();\n var matrix42 = new Matrix4();\n function setup(lights, useLegacyLights) {\n var r = 0,\n g = 0,\n b = 0;\n for (var _i36 = 0; _i36 < 9; _i36++) state.probe[_i36].set(0, 0, 0);\n var directionalLength = 0;\n var pointLength = 0;\n var spotLength = 0;\n var rectAreaLength = 0;\n var hemiLength = 0;\n var numDirectionalShadows = 0;\n var numPointShadows = 0;\n var numSpotShadows = 0;\n var numSpotMaps = 0;\n var numSpotShadowsWithMaps = 0;\n\n // ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]\n lights.sort(shadowCastingAndTexturingLightsFirst);\n\n // artist-friendly light intensity scaling factor\n var scaleFactor = useLegacyLights === true ? Math.PI : 1;\n for (var _i37 = 0, l = lights.length; _i37 < l; _i37++) {\n var light = lights[_i37];\n var color = light.color;\n var intensity = light.intensity;\n var distance = light.distance;\n var shadowMap = light.shadow && light.shadow.map ? light.shadow.map.texture : null;\n if (light.isAmbientLight) {\n r += color.r * intensity * scaleFactor;\n g += color.g * intensity * scaleFactor;\n b += color.b * intensity * scaleFactor;\n } else if (light.isLightProbe) {\n for (var j = 0; j < 9; j++) {\n state.probe[j].addScaledVector(light.sh.coefficients[j], intensity);\n }\n } else if (light.isDirectionalLight) {\n var uniforms = cache.get(light);\n uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor);\n if (light.castShadow) {\n var shadow = light.shadow;\n var shadowUniforms = shadowCache.get(light);\n shadowUniforms.shadowBias = shadow.bias;\n shadowUniforms.shadowNormalBias = shadow.normalBias;\n shadowUniforms.shadowRadius = shadow.radius;\n shadowUniforms.shadowMapSize = shadow.mapSize;\n state.directionalShadow[directionalLength] = shadowUniforms;\n state.directionalShadowMap[directionalLength] = shadowMap;\n state.directionalShadowMatrix[directionalLength] = light.shadow.matrix;\n numDirectionalShadows++;\n }\n state.directional[directionalLength] = uniforms;\n directionalLength++;\n } else if (light.isSpotLight) {\n var _uniforms = cache.get(light);\n _uniforms.position.setFromMatrixPosition(light.matrixWorld);\n _uniforms.color.copy(color).multiplyScalar(intensity * scaleFactor);\n _uniforms.distance = distance;\n _uniforms.coneCos = Math.cos(light.angle);\n _uniforms.penumbraCos = Math.cos(light.angle * (1 - light.penumbra));\n _uniforms.decay = light.decay;\n state.spot[spotLength] = _uniforms;\n var _shadow = light.shadow;\n if (light.map) {\n state.spotLightMap[numSpotMaps] = light.map;\n numSpotMaps++;\n\n // make sure the lightMatrix is up to date\n // TODO : do it if required only\n _shadow.updateMatrices(light);\n if (light.castShadow) numSpotShadowsWithMaps++;\n }\n state.spotLightMatrix[spotLength] = _shadow.matrix;\n if (light.castShadow) {\n var _shadowUniforms = shadowCache.get(light);\n _shadowUniforms.shadowBias = _shadow.bias;\n _shadowUniforms.shadowNormalBias = _shadow.normalBias;\n _shadowUniforms.shadowRadius = _shadow.radius;\n _shadowUniforms.shadowMapSize = _shadow.mapSize;\n state.spotShadow[spotLength] = _shadowUniforms;\n state.spotShadowMap[spotLength] = shadowMap;\n numSpotShadows++;\n }\n spotLength++;\n } else if (light.isRectAreaLight) {\n var _uniforms2 = cache.get(light);\n _uniforms2.color.copy(color).multiplyScalar(intensity);\n _uniforms2.halfWidth.set(light.width * 0.5, 0.0, 0.0);\n _uniforms2.halfHeight.set(0.0, light.height * 0.5, 0.0);\n state.rectArea[rectAreaLength] = _uniforms2;\n rectAreaLength++;\n } else if (light.isPointLight) {\n var _uniforms3 = cache.get(light);\n _uniforms3.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor);\n _uniforms3.distance = light.distance;\n _uniforms3.decay = light.decay;\n if (light.castShadow) {\n var _shadow2 = light.shadow;\n var _shadowUniforms2 = shadowCache.get(light);\n _shadowUniforms2.shadowBias = _shadow2.bias;\n _shadowUniforms2.shadowNormalBias = _shadow2.normalBias;\n _shadowUniforms2.shadowRadius = _shadow2.radius;\n _shadowUniforms2.shadowMapSize = _shadow2.mapSize;\n _shadowUniforms2.shadowCameraNear = _shadow2.camera.near;\n _shadowUniforms2.shadowCameraFar = _shadow2.camera.far;\n state.pointShadow[pointLength] = _shadowUniforms2;\n state.pointShadowMap[pointLength] = shadowMap;\n state.pointShadowMatrix[pointLength] = light.shadow.matrix;\n numPointShadows++;\n }\n state.point[pointLength] = _uniforms3;\n pointLength++;\n } else if (light.isHemisphereLight) {\n var _uniforms4 = cache.get(light);\n _uniforms4.skyColor.copy(light.color).multiplyScalar(intensity * scaleFactor);\n _uniforms4.groundColor.copy(light.groundColor).multiplyScalar(intensity * scaleFactor);\n state.hemi[hemiLength] = _uniforms4;\n hemiLength++;\n }\n }\n if (rectAreaLength > 0) {\n if (capabilities.isWebGL2) {\n // WebGL 2\n\n state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n } else {\n // WebGL 1\n\n if (extensions.has('OES_texture_float_linear') === true) {\n state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;\n state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;\n } else if (extensions.has('OES_texture_half_float_linear') === true) {\n state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;\n state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;\n } else {\n console.error('THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.');\n }\n }\n }\n state.ambient[0] = r;\n state.ambient[1] = g;\n state.ambient[2] = b;\n var hash = state.hash;\n if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows || hash.numSpotMaps !== numSpotMaps) {\n state.directional.length = directionalLength;\n state.spot.length = spotLength;\n state.rectArea.length = rectAreaLength;\n state.point.length = pointLength;\n state.hemi.length = hemiLength;\n state.directionalShadow.length = numDirectionalShadows;\n state.directionalShadowMap.length = numDirectionalShadows;\n state.pointShadow.length = numPointShadows;\n state.pointShadowMap.length = numPointShadows;\n state.spotShadow.length = numSpotShadows;\n state.spotShadowMap.length = numSpotShadows;\n state.directionalShadowMatrix.length = numDirectionalShadows;\n state.pointShadowMatrix.length = numPointShadows;\n state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;\n state.spotLightMap.length = numSpotMaps;\n state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;\n hash.directionalLength = directionalLength;\n hash.pointLength = pointLength;\n hash.spotLength = spotLength;\n hash.rectAreaLength = rectAreaLength;\n hash.hemiLength = hemiLength;\n hash.numDirectionalShadows = numDirectionalShadows;\n hash.numPointShadows = numPointShadows;\n hash.numSpotShadows = numSpotShadows;\n hash.numSpotMaps = numSpotMaps;\n state.version = nextVersion++;\n }\n }\n function setupView(lights, camera) {\n var directionalLength = 0;\n var pointLength = 0;\n var spotLength = 0;\n var rectAreaLength = 0;\n var hemiLength = 0;\n var viewMatrix = camera.matrixWorldInverse;\n for (var _i38 = 0, l = lights.length; _i38 < l; _i38++) {\n var light = lights[_i38];\n if (light.isDirectionalLight) {\n var uniforms = state.directional[directionalLength];\n uniforms.direction.setFromMatrixPosition(light.matrixWorld);\n vector3.setFromMatrixPosition(light.target.matrixWorld);\n uniforms.direction.sub(vector3);\n uniforms.direction.transformDirection(viewMatrix);\n directionalLength++;\n } else if (light.isSpotLight) {\n var _uniforms5 = state.spot[spotLength];\n _uniforms5.position.setFromMatrixPosition(light.matrixWorld);\n _uniforms5.position.applyMatrix4(viewMatrix);\n _uniforms5.direction.setFromMatrixPosition(light.matrixWorld);\n vector3.setFromMatrixPosition(light.target.matrixWorld);\n _uniforms5.direction.sub(vector3);\n _uniforms5.direction.transformDirection(viewMatrix);\n spotLength++;\n } else if (light.isRectAreaLight) {\n var _uniforms6 = state.rectArea[rectAreaLength];\n _uniforms6.position.setFromMatrixPosition(light.matrixWorld);\n _uniforms6.position.applyMatrix4(viewMatrix);\n\n // extract local rotation of light to derive width/height half vectors\n matrix42.identity();\n matrix4.copy(light.matrixWorld);\n matrix4.premultiply(viewMatrix);\n matrix42.extractRotation(matrix4);\n _uniforms6.halfWidth.set(light.width * 0.5, 0.0, 0.0);\n _uniforms6.halfHeight.set(0.0, light.height * 0.5, 0.0);\n _uniforms6.halfWidth.applyMatrix4(matrix42);\n _uniforms6.halfHeight.applyMatrix4(matrix42);\n rectAreaLength++;\n } else if (light.isPointLight) {\n var _uniforms7 = state.point[pointLength];\n _uniforms7.position.setFromMatrixPosition(light.matrixWorld);\n _uniforms7.position.applyMatrix4(viewMatrix);\n pointLength++;\n } else if (light.isHemisphereLight) {\n var _uniforms8 = state.hemi[hemiLength];\n _uniforms8.direction.setFromMatrixPosition(light.matrixWorld);\n _uniforms8.direction.transformDirection(viewMatrix);\n hemiLength++;\n }\n }\n }\n return {\n setup: setup,\n setupView: setupView,\n state: state\n };\n}\nfunction WebGLRenderState(extensions, capabilities) {\n var lights = new WebGLLights(extensions, capabilities);\n var lightsArray = [];\n var shadowsArray = [];\n function init() {\n lightsArray.length = 0;\n shadowsArray.length = 0;\n }\n function pushLight(light) {\n lightsArray.push(light);\n }\n function pushShadow(shadowLight) {\n shadowsArray.push(shadowLight);\n }\n function setupLights(useLegacyLights) {\n lights.setup(lightsArray, useLegacyLights);\n }\n function setupLightsView(camera) {\n lights.setupView(lightsArray, camera);\n }\n var state = {\n lightsArray: lightsArray,\n shadowsArray: shadowsArray,\n lights: lights\n };\n return {\n init: init,\n state: state,\n setupLights: setupLights,\n setupLightsView: setupLightsView,\n pushLight: pushLight,\n pushShadow: pushShadow\n };\n}\nfunction WebGLRenderStates(extensions, capabilities) {\n var renderStates = new WeakMap();\n function get(scene) {\n var renderCallDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var renderStateArray = renderStates.get(scene);\n var renderState;\n if (renderStateArray === undefined) {\n renderState = new WebGLRenderState(extensions, capabilities);\n renderStates.set(scene, [renderState]);\n } else {\n if (renderCallDepth >= renderStateArray.length) {\n renderState = new WebGLRenderState(extensions, capabilities);\n renderStateArray.push(renderState);\n } else {\n renderState = renderStateArray[renderCallDepth];\n }\n }\n return renderState;\n }\n function dispose() {\n renderStates = new WeakMap();\n }\n return {\n get: get,\n dispose: dispose\n };\n}\nvar MeshDepthMaterial = /*#__PURE__*/function (_Material3) {\n _inherits(MeshDepthMaterial, _Material3);\n var _super32 = _createSuper(MeshDepthMaterial);\n function MeshDepthMaterial(parameters) {\n var _this24;\n _classCallCheck(this, MeshDepthMaterial);\n _this24 = _super32.call(this);\n _this24.isMeshDepthMaterial = true;\n _this24.type = 'MeshDepthMaterial';\n _this24.depthPacking = BasicDepthPacking;\n _this24.map = null;\n _this24.alphaMap = null;\n _this24.displacementMap = null;\n _this24.displacementScale = 1;\n _this24.displacementBias = 0;\n _this24.wireframe = false;\n _this24.wireframeLinewidth = 1;\n _this24.setValues(parameters);\n return _this24;\n }\n _createClass(MeshDepthMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(MeshDepthMaterial.prototype), \"copy\", this).call(this, source);\n this.depthPacking = source.depthPacking;\n this.map = source.map;\n this.alphaMap = source.alphaMap;\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n return this;\n }\n }]);\n return MeshDepthMaterial;\n}(Material);\nvar MeshDistanceMaterial = /*#__PURE__*/function (_Material4) {\n _inherits(MeshDistanceMaterial, _Material4);\n var _super33 = _createSuper(MeshDistanceMaterial);\n function MeshDistanceMaterial(parameters) {\n var _this25;\n _classCallCheck(this, MeshDistanceMaterial);\n _this25 = _super33.call(this);\n _this25.isMeshDistanceMaterial = true;\n _this25.type = 'MeshDistanceMaterial';\n _this25.map = null;\n _this25.alphaMap = null;\n _this25.displacementMap = null;\n _this25.displacementScale = 1;\n _this25.displacementBias = 0;\n _this25.setValues(parameters);\n return _this25;\n }\n _createClass(MeshDistanceMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(MeshDistanceMaterial.prototype), \"copy\", this).call(this, source);\n this.map = source.map;\n this.alphaMap = source.alphaMap;\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n return this;\n }\n }]);\n return MeshDistanceMaterial;\n}(Material);\nvar vertex = \"void main() {\\n\\tgl_Position = vec4( position, 1.0 );\\n}\";\nvar fragment = \"uniform sampler2D shadow_pass;\\nuniform vec2 resolution;\\nuniform float radius;\\n#include \\nvoid main() {\\n\\tconst float samples = float( VSM_SAMPLES );\\n\\tfloat mean = 0.0;\\n\\tfloat squared_mean = 0.0;\\n\\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\\n\\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\\n\\tfor ( float i = 0.0; i < samples; i ++ ) {\\n\\t\\tfloat uvOffset = uvStart + i * uvStride;\\n\\t\\t#ifdef HORIZONTAL_PASS\\n\\t\\t\\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\\n\\t\\t\\tmean += distribution.x;\\n\\t\\t\\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\\n\\t\\t#else\\n\\t\\t\\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\\n\\t\\t\\tmean += depth;\\n\\t\\t\\tsquared_mean += depth * depth;\\n\\t\\t#endif\\n\\t}\\n\\tmean = mean / samples;\\n\\tsquared_mean = squared_mean / samples;\\n\\tfloat std_dev = sqrt( squared_mean - mean * mean );\\n\\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\\n}\";\nfunction WebGLShadowMap(_renderer, _objects, _capabilities) {\n var _shadowSide;\n var _frustum = new Frustum();\n var _shadowMapSize = new Vector2(),\n _viewportSize = new Vector2(),\n _viewport = new Vector4(),\n _depthMaterial = new MeshDepthMaterial({\n depthPacking: RGBADepthPacking\n }),\n _distanceMaterial = new MeshDistanceMaterial(),\n _materialCache = {},\n _maxTextureSize = _capabilities.maxTextureSize;\n var shadowSide = (_shadowSide = {}, _defineProperty(_shadowSide, FrontSide, BackSide), _defineProperty(_shadowSide, BackSide, FrontSide), _defineProperty(_shadowSide, DoubleSide, DoubleSide), _shadowSide);\n var shadowMaterialVertical = new ShaderMaterial({\n defines: {\n VSM_SAMPLES: 8\n },\n uniforms: {\n shadow_pass: {\n value: null\n },\n resolution: {\n value: new Vector2()\n },\n radius: {\n value: 4.0\n }\n },\n vertexShader: vertex,\n fragmentShader: fragment\n });\n var shadowMaterialHorizontal = shadowMaterialVertical.clone();\n shadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1;\n var fullScreenTri = new BufferGeometry();\n fullScreenTri.setAttribute('position', new BufferAttribute(new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]), 3));\n var fullScreenMesh = new Mesh(fullScreenTri, shadowMaterialVertical);\n var scope = this;\n this.enabled = false;\n this.autoUpdate = true;\n this.needsUpdate = false;\n this.type = PCFShadowMap;\n this.render = function (lights, scene, camera) {\n if (scope.enabled === false) return;\n if (scope.autoUpdate === false && scope.needsUpdate === false) return;\n if (lights.length === 0) return;\n var currentRenderTarget = _renderer.getRenderTarget();\n var activeCubeFace = _renderer.getActiveCubeFace();\n var activeMipmapLevel = _renderer.getActiveMipmapLevel();\n var _state = _renderer.state;\n\n // Set GL state for depth map.\n _state.setBlending(NoBlending);\n _state.buffers.color.setClear(1, 1, 1, 1);\n _state.buffers.depth.setTest(true);\n _state.setScissorTest(false);\n\n // render depth map\n\n for (var i = 0, il = lights.length; i < il; i++) {\n var light = lights[i];\n var shadow = light.shadow;\n if (shadow === undefined) {\n console.warn('THREE.WebGLShadowMap:', light, 'has no shadow.');\n continue;\n }\n if (shadow.autoUpdate === false && shadow.needsUpdate === false) continue;\n _shadowMapSize.copy(shadow.mapSize);\n var shadowFrameExtents = shadow.getFrameExtents();\n _shadowMapSize.multiply(shadowFrameExtents);\n _viewportSize.copy(shadow.mapSize);\n if (_shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize) {\n if (_shadowMapSize.x > _maxTextureSize) {\n _viewportSize.x = Math.floor(_maxTextureSize / shadowFrameExtents.x);\n _shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x;\n shadow.mapSize.x = _viewportSize.x;\n }\n if (_shadowMapSize.y > _maxTextureSize) {\n _viewportSize.y = Math.floor(_maxTextureSize / shadowFrameExtents.y);\n _shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y;\n shadow.mapSize.y = _viewportSize.y;\n }\n }\n if (shadow.map === null) {\n var pars = this.type !== VSMShadowMap ? {\n minFilter: NearestFilter,\n magFilter: NearestFilter\n } : {};\n shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars);\n shadow.map.texture.name = light.name + '.shadowMap';\n shadow.camera.updateProjectionMatrix();\n }\n _renderer.setRenderTarget(shadow.map);\n _renderer.clear();\n var viewportCount = shadow.getViewportCount();\n for (var vp = 0; vp < viewportCount; vp++) {\n var viewport = shadow.getViewport(vp);\n _viewport.set(_viewportSize.x * viewport.x, _viewportSize.y * viewport.y, _viewportSize.x * viewport.z, _viewportSize.y * viewport.w);\n _state.viewport(_viewport);\n shadow.updateMatrices(light, vp);\n _frustum = shadow.getFrustum();\n renderObject(scene, camera, shadow.camera, light, this.type);\n }\n\n // do blur pass for VSM\n\n if (shadow.isPointLightShadow !== true && this.type === VSMShadowMap) {\n VSMPass(shadow, camera);\n }\n shadow.needsUpdate = false;\n }\n scope.needsUpdate = false;\n _renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel);\n };\n function VSMPass(shadow, camera) {\n var geometry = _objects.update(fullScreenMesh);\n if (shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples) {\n shadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;\n shadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;\n shadowMaterialVertical.needsUpdate = true;\n shadowMaterialHorizontal.needsUpdate = true;\n }\n if (shadow.mapPass === null) {\n shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y);\n }\n\n // vertical pass\n\n shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;\n shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;\n shadowMaterialVertical.uniforms.radius.value = shadow.radius;\n _renderer.setRenderTarget(shadow.mapPass);\n _renderer.clear();\n _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null);\n\n // horizontal pass\n\n shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;\n shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;\n shadowMaterialHorizontal.uniforms.radius.value = shadow.radius;\n _renderer.setRenderTarget(shadow.map);\n _renderer.clear();\n _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null);\n }\n function getDepthMaterial(object, material, light, type) {\n var result = null;\n var customMaterial = light.isPointLight === true ? object.customDistanceMaterial : object.customDepthMaterial;\n if (customMaterial !== undefined) {\n result = customMaterial;\n } else {\n result = light.isPointLight === true ? _distanceMaterial : _depthMaterial;\n if (_renderer.localClippingEnabled && material.clipShadows === true && Array.isArray(material.clippingPlanes) && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0 || material.map && material.alphaTest > 0) {\n // in this case we need a unique material instance reflecting the\n // appropriate state\n\n var keyA = result.uuid,\n keyB = material.uuid;\n var materialsForVariant = _materialCache[keyA];\n if (materialsForVariant === undefined) {\n materialsForVariant = {};\n _materialCache[keyA] = materialsForVariant;\n }\n var cachedMaterial = materialsForVariant[keyB];\n if (cachedMaterial === undefined) {\n cachedMaterial = result.clone();\n materialsForVariant[keyB] = cachedMaterial;\n }\n result = cachedMaterial;\n }\n }\n result.visible = material.visible;\n result.wireframe = material.wireframe;\n if (type === VSMShadowMap) {\n result.side = material.shadowSide !== null ? material.shadowSide : material.side;\n } else {\n result.side = material.shadowSide !== null ? material.shadowSide : shadowSide[material.side];\n }\n result.alphaMap = material.alphaMap;\n result.alphaTest = material.alphaTest;\n result.map = material.map;\n result.clipShadows = material.clipShadows;\n result.clippingPlanes = material.clippingPlanes;\n result.clipIntersection = material.clipIntersection;\n result.displacementMap = material.displacementMap;\n result.displacementScale = material.displacementScale;\n result.displacementBias = material.displacementBias;\n result.wireframeLinewidth = material.wireframeLinewidth;\n result.linewidth = material.linewidth;\n if (light.isPointLight === true && result.isMeshDistanceMaterial === true) {\n var materialProperties = _renderer.properties.get(result);\n materialProperties.light = light;\n }\n return result;\n }\n function renderObject(object, camera, shadowCamera, light, type) {\n if (object.visible === false) return;\n var visible = object.layers.test(camera.layers);\n if (visible && (object.isMesh || object.isLine || object.isPoints)) {\n if ((object.castShadow || object.receiveShadow && type === VSMShadowMap) && (!object.frustumCulled || _frustum.intersectsObject(object))) {\n object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse, object.matrixWorld);\n var geometry = _objects.update(object);\n var material = object.material;\n if (Array.isArray(material)) {\n var groups = geometry.groups;\n for (var k = 0, kl = groups.length; k < kl; k++) {\n var group = groups[k];\n var groupMaterial = material[group.materialIndex];\n if (groupMaterial && groupMaterial.visible) {\n var depthMaterial = getDepthMaterial(object, groupMaterial, light, type);\n _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, group);\n }\n }\n } else if (material.visible) {\n var _depthMaterial2 = getDepthMaterial(object, material, light, type);\n _renderer.renderBufferDirect(shadowCamera, null, geometry, _depthMaterial2, object, null);\n }\n }\n }\n var children = object.children;\n for (var i = 0, l = children.length; i < l; i++) {\n renderObject(children[i], camera, shadowCamera, light, type);\n }\n }\n}\nfunction WebGLState(gl, extensions, capabilities) {\n var _equationToGL, _factorToGL;\n var isWebGL2 = capabilities.isWebGL2;\n function ColorBuffer() {\n var locked = false;\n var color = new Vector4();\n var currentColorMask = null;\n var currentColorClear = new Vector4(0, 0, 0, 0);\n return {\n setMask: function setMask(colorMask) {\n if (currentColorMask !== colorMask && !locked) {\n gl.colorMask(colorMask, colorMask, colorMask, colorMask);\n currentColorMask = colorMask;\n }\n },\n setLocked: function setLocked(lock) {\n locked = lock;\n },\n setClear: function setClear(r, g, b, a, premultipliedAlpha) {\n if (premultipliedAlpha === true) {\n r *= a;\n g *= a;\n b *= a;\n }\n color.set(r, g, b, a);\n if (currentColorClear.equals(color) === false) {\n gl.clearColor(r, g, b, a);\n currentColorClear.copy(color);\n }\n },\n reset: function reset() {\n locked = false;\n currentColorMask = null;\n currentColorClear.set(-1, 0, 0, 0); // set to invalid state\n }\n };\n }\n\n function DepthBuffer() {\n var locked = false;\n var currentDepthMask = null;\n var currentDepthFunc = null;\n var currentDepthClear = null;\n return {\n setTest: function setTest(depthTest) {\n if (depthTest) {\n enable(2929);\n } else {\n disable(2929);\n }\n },\n setMask: function setMask(depthMask) {\n if (currentDepthMask !== depthMask && !locked) {\n gl.depthMask(depthMask);\n currentDepthMask = depthMask;\n }\n },\n setFunc: function setFunc(depthFunc) {\n if (currentDepthFunc !== depthFunc) {\n switch (depthFunc) {\n case NeverDepth:\n gl.depthFunc(512);\n break;\n case AlwaysDepth:\n gl.depthFunc(519);\n break;\n case LessDepth:\n gl.depthFunc(513);\n break;\n case LessEqualDepth:\n gl.depthFunc(515);\n break;\n case EqualDepth:\n gl.depthFunc(514);\n break;\n case GreaterEqualDepth:\n gl.depthFunc(518);\n break;\n case GreaterDepth:\n gl.depthFunc(516);\n break;\n case NotEqualDepth:\n gl.depthFunc(517);\n break;\n default:\n gl.depthFunc(515);\n }\n currentDepthFunc = depthFunc;\n }\n },\n setLocked: function setLocked(lock) {\n locked = lock;\n },\n setClear: function setClear(depth) {\n if (currentDepthClear !== depth) {\n gl.clearDepth(depth);\n currentDepthClear = depth;\n }\n },\n reset: function reset() {\n locked = false;\n currentDepthMask = null;\n currentDepthFunc = null;\n currentDepthClear = null;\n }\n };\n }\n function StencilBuffer() {\n var locked = false;\n var currentStencilMask = null;\n var currentStencilFunc = null;\n var currentStencilRef = null;\n var currentStencilFuncMask = null;\n var currentStencilFail = null;\n var currentStencilZFail = null;\n var currentStencilZPass = null;\n var currentStencilClear = null;\n return {\n setTest: function setTest(stencilTest) {\n if (!locked) {\n if (stencilTest) {\n enable(2960);\n } else {\n disable(2960);\n }\n }\n },\n setMask: function setMask(stencilMask) {\n if (currentStencilMask !== stencilMask && !locked) {\n gl.stencilMask(stencilMask);\n currentStencilMask = stencilMask;\n }\n },\n setFunc: function setFunc(stencilFunc, stencilRef, stencilMask) {\n if (currentStencilFunc !== stencilFunc || currentStencilRef !== stencilRef || currentStencilFuncMask !== stencilMask) {\n gl.stencilFunc(stencilFunc, stencilRef, stencilMask);\n currentStencilFunc = stencilFunc;\n currentStencilRef = stencilRef;\n currentStencilFuncMask = stencilMask;\n }\n },\n setOp: function setOp(stencilFail, stencilZFail, stencilZPass) {\n if (currentStencilFail !== stencilFail || currentStencilZFail !== stencilZFail || currentStencilZPass !== stencilZPass) {\n gl.stencilOp(stencilFail, stencilZFail, stencilZPass);\n currentStencilFail = stencilFail;\n currentStencilZFail = stencilZFail;\n currentStencilZPass = stencilZPass;\n }\n },\n setLocked: function setLocked(lock) {\n locked = lock;\n },\n setClear: function setClear(stencil) {\n if (currentStencilClear !== stencil) {\n gl.clearStencil(stencil);\n currentStencilClear = stencil;\n }\n },\n reset: function reset() {\n locked = false;\n currentStencilMask = null;\n currentStencilFunc = null;\n currentStencilRef = null;\n currentStencilFuncMask = null;\n currentStencilFail = null;\n currentStencilZFail = null;\n currentStencilZPass = null;\n currentStencilClear = null;\n }\n };\n }\n\n //\n\n var colorBuffer = new ColorBuffer();\n var depthBuffer = new DepthBuffer();\n var stencilBuffer = new StencilBuffer();\n var uboBindings = new WeakMap();\n var uboProgramMap = new WeakMap();\n var enabledCapabilities = {};\n var currentBoundFramebuffers = {};\n var currentDrawbuffers = new WeakMap();\n var defaultDrawbuffers = [];\n var currentProgram = null;\n var currentBlendingEnabled = false;\n var currentBlending = null;\n var currentBlendEquation = null;\n var currentBlendSrc = null;\n var currentBlendDst = null;\n var currentBlendEquationAlpha = null;\n var currentBlendSrcAlpha = null;\n var currentBlendDstAlpha = null;\n var currentPremultipledAlpha = false;\n var currentFlipSided = null;\n var currentCullFace = null;\n var currentLineWidth = null;\n var currentPolygonOffsetFactor = null;\n var currentPolygonOffsetUnits = null;\n var maxTextures = gl.getParameter(35661);\n var lineWidthAvailable = false;\n var version = 0;\n var glVersion = gl.getParameter(7938);\n if (glVersion.indexOf('WebGL') !== -1) {\n version = parseFloat(/^WebGL (\\d)/.exec(glVersion)[1]);\n lineWidthAvailable = version >= 1.0;\n } else if (glVersion.indexOf('OpenGL ES') !== -1) {\n version = parseFloat(/^OpenGL ES (\\d)/.exec(glVersion)[1]);\n lineWidthAvailable = version >= 2.0;\n }\n var currentTextureSlot = null;\n var currentBoundTextures = {};\n var scissorParam = gl.getParameter(3088);\n var viewportParam = gl.getParameter(2978);\n var currentScissor = new Vector4().fromArray(scissorParam);\n var currentViewport = new Vector4().fromArray(viewportParam);\n function createTexture(type, target, count) {\n var data = new Uint8Array(4); // 4 is required to match default unpack alignment of 4.\n var texture = gl.createTexture();\n gl.bindTexture(type, texture);\n gl.texParameteri(type, 10241, 9728);\n gl.texParameteri(type, 10240, 9728);\n for (var i = 0; i < count; i++) {\n gl.texImage2D(target + i, 0, 6408, 1, 1, 0, 6408, 5121, data);\n }\n return texture;\n }\n var emptyTextures = {};\n emptyTextures[3553] = createTexture(3553, 3553, 1);\n emptyTextures[34067] = createTexture(34067, 34069, 6);\n\n // init\n\n colorBuffer.setClear(0, 0, 0, 1);\n depthBuffer.setClear(1);\n stencilBuffer.setClear(0);\n enable(2929);\n depthBuffer.setFunc(LessEqualDepth);\n setFlipSided(false);\n setCullFace(CullFaceBack);\n enable(2884);\n setBlending(NoBlending);\n\n //\n\n function enable(id) {\n if (enabledCapabilities[id] !== true) {\n gl.enable(id);\n enabledCapabilities[id] = true;\n }\n }\n function disable(id) {\n if (enabledCapabilities[id] !== false) {\n gl.disable(id);\n enabledCapabilities[id] = false;\n }\n }\n function bindFramebuffer(target, framebuffer) {\n if (currentBoundFramebuffers[target] !== framebuffer) {\n gl.bindFramebuffer(target, framebuffer);\n currentBoundFramebuffers[target] = framebuffer;\n if (isWebGL2) {\n // 36009 is equivalent to 36160\n\n if (target === 36009) {\n currentBoundFramebuffers[36160] = framebuffer;\n }\n if (target === 36160) {\n currentBoundFramebuffers[36009] = framebuffer;\n }\n }\n return true;\n }\n return false;\n }\n function drawBuffers(renderTarget, framebuffer) {\n var drawBuffers = defaultDrawbuffers;\n var needsUpdate = false;\n if (renderTarget) {\n drawBuffers = currentDrawbuffers.get(framebuffer);\n if (drawBuffers === undefined) {\n drawBuffers = [];\n currentDrawbuffers.set(framebuffer, drawBuffers);\n }\n if (renderTarget.isWebGLMultipleRenderTargets) {\n var textures = renderTarget.texture;\n if (drawBuffers.length !== textures.length || drawBuffers[0] !== 36064) {\n for (var i = 0, il = textures.length; i < il; i++) {\n drawBuffers[i] = 36064 + i;\n }\n drawBuffers.length = textures.length;\n needsUpdate = true;\n }\n } else {\n if (drawBuffers[0] !== 36064) {\n drawBuffers[0] = 36064;\n needsUpdate = true;\n }\n }\n } else {\n if (drawBuffers[0] !== 1029) {\n drawBuffers[0] = 1029;\n needsUpdate = true;\n }\n }\n if (needsUpdate) {\n if (capabilities.isWebGL2) {\n gl.drawBuffers(drawBuffers);\n } else {\n extensions.get('WEBGL_draw_buffers').drawBuffersWEBGL(drawBuffers);\n }\n }\n }\n function useProgram(program) {\n if (currentProgram !== program) {\n gl.useProgram(program);\n currentProgram = program;\n return true;\n }\n return false;\n }\n var equationToGL = (_equationToGL = {}, _defineProperty(_equationToGL, AddEquation, 32774), _defineProperty(_equationToGL, SubtractEquation, 32778), _defineProperty(_equationToGL, ReverseSubtractEquation, 32779), _equationToGL);\n if (isWebGL2) {\n equationToGL[MinEquation] = 32775;\n equationToGL[MaxEquation] = 32776;\n } else {\n var extension = extensions.get('EXT_blend_minmax');\n if (extension !== null) {\n equationToGL[MinEquation] = extension.MIN_EXT;\n equationToGL[MaxEquation] = extension.MAX_EXT;\n }\n }\n var factorToGL = (_factorToGL = {}, _defineProperty(_factorToGL, ZeroFactor, 0), _defineProperty(_factorToGL, OneFactor, 1), _defineProperty(_factorToGL, SrcColorFactor, 768), _defineProperty(_factorToGL, SrcAlphaFactor, 770), _defineProperty(_factorToGL, SrcAlphaSaturateFactor, 776), _defineProperty(_factorToGL, DstColorFactor, 774), _defineProperty(_factorToGL, DstAlphaFactor, 772), _defineProperty(_factorToGL, OneMinusSrcColorFactor, 769), _defineProperty(_factorToGL, OneMinusSrcAlphaFactor, 771), _defineProperty(_factorToGL, OneMinusDstColorFactor, 775), _defineProperty(_factorToGL, OneMinusDstAlphaFactor, 773), _factorToGL);\n function setBlending(blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha) {\n if (blending === NoBlending) {\n if (currentBlendingEnabled === true) {\n disable(3042);\n currentBlendingEnabled = false;\n }\n return;\n }\n if (currentBlendingEnabled === false) {\n enable(3042);\n currentBlendingEnabled = true;\n }\n if (blending !== CustomBlending) {\n if (blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha) {\n if (currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation) {\n gl.blendEquation(32774);\n currentBlendEquation = AddEquation;\n currentBlendEquationAlpha = AddEquation;\n }\n if (premultipliedAlpha) {\n switch (blending) {\n case NormalBlending:\n gl.blendFuncSeparate(1, 771, 1, 771);\n break;\n case AdditiveBlending:\n gl.blendFunc(1, 1);\n break;\n case SubtractiveBlending:\n gl.blendFuncSeparate(0, 769, 0, 1);\n break;\n case MultiplyBlending:\n gl.blendFuncSeparate(0, 768, 0, 770);\n break;\n default:\n console.error('THREE.WebGLState: Invalid blending: ', blending);\n break;\n }\n } else {\n switch (blending) {\n case NormalBlending:\n gl.blendFuncSeparate(770, 771, 1, 771);\n break;\n case AdditiveBlending:\n gl.blendFunc(770, 1);\n break;\n case SubtractiveBlending:\n gl.blendFuncSeparate(0, 769, 0, 1);\n break;\n case MultiplyBlending:\n gl.blendFunc(0, 768);\n break;\n default:\n console.error('THREE.WebGLState: Invalid blending: ', blending);\n break;\n }\n }\n currentBlendSrc = null;\n currentBlendDst = null;\n currentBlendSrcAlpha = null;\n currentBlendDstAlpha = null;\n currentBlending = blending;\n currentPremultipledAlpha = premultipliedAlpha;\n }\n return;\n }\n\n // custom blending\n\n blendEquationAlpha = blendEquationAlpha || blendEquation;\n blendSrcAlpha = blendSrcAlpha || blendSrc;\n blendDstAlpha = blendDstAlpha || blendDst;\n if (blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha) {\n gl.blendEquationSeparate(equationToGL[blendEquation], equationToGL[blendEquationAlpha]);\n currentBlendEquation = blendEquation;\n currentBlendEquationAlpha = blendEquationAlpha;\n }\n if (blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha) {\n gl.blendFuncSeparate(factorToGL[blendSrc], factorToGL[blendDst], factorToGL[blendSrcAlpha], factorToGL[blendDstAlpha]);\n currentBlendSrc = blendSrc;\n currentBlendDst = blendDst;\n currentBlendSrcAlpha = blendSrcAlpha;\n currentBlendDstAlpha = blendDstAlpha;\n }\n currentBlending = blending;\n currentPremultipledAlpha = false;\n }\n function setMaterial(material, frontFaceCW) {\n material.side === DoubleSide ? disable(2884) : enable(2884);\n var flipSided = material.side === BackSide;\n if (frontFaceCW) flipSided = !flipSided;\n setFlipSided(flipSided);\n material.blending === NormalBlending && material.transparent === false ? setBlending(NoBlending) : setBlending(material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha);\n depthBuffer.setFunc(material.depthFunc);\n depthBuffer.setTest(material.depthTest);\n depthBuffer.setMask(material.depthWrite);\n colorBuffer.setMask(material.colorWrite);\n var stencilWrite = material.stencilWrite;\n stencilBuffer.setTest(stencilWrite);\n if (stencilWrite) {\n stencilBuffer.setMask(material.stencilWriteMask);\n stencilBuffer.setFunc(material.stencilFunc, material.stencilRef, material.stencilFuncMask);\n stencilBuffer.setOp(material.stencilFail, material.stencilZFail, material.stencilZPass);\n }\n setPolygonOffset(material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits);\n material.alphaToCoverage === true ? enable(32926) : disable(32926);\n }\n\n //\n\n function setFlipSided(flipSided) {\n if (currentFlipSided !== flipSided) {\n if (flipSided) {\n gl.frontFace(2304);\n } else {\n gl.frontFace(2305);\n }\n currentFlipSided = flipSided;\n }\n }\n function setCullFace(cullFace) {\n if (cullFace !== CullFaceNone) {\n enable(2884);\n if (cullFace !== currentCullFace) {\n if (cullFace === CullFaceBack) {\n gl.cullFace(1029);\n } else if (cullFace === CullFaceFront) {\n gl.cullFace(1028);\n } else {\n gl.cullFace(1032);\n }\n }\n } else {\n disable(2884);\n }\n currentCullFace = cullFace;\n }\n function setLineWidth(width) {\n if (width !== currentLineWidth) {\n if (lineWidthAvailable) gl.lineWidth(width);\n currentLineWidth = width;\n }\n }\n function setPolygonOffset(polygonOffset, factor, units) {\n if (polygonOffset) {\n enable(32823);\n if (currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units) {\n gl.polygonOffset(factor, units);\n currentPolygonOffsetFactor = factor;\n currentPolygonOffsetUnits = units;\n }\n } else {\n disable(32823);\n }\n }\n function setScissorTest(scissorTest) {\n if (scissorTest) {\n enable(3089);\n } else {\n disable(3089);\n }\n }\n\n // texture\n\n function activeTexture(webglSlot) {\n if (webglSlot === undefined) webglSlot = 33984 + maxTextures - 1;\n if (currentTextureSlot !== webglSlot) {\n gl.activeTexture(webglSlot);\n currentTextureSlot = webglSlot;\n }\n }\n function bindTexture(webglType, webglTexture, webglSlot) {\n if (webglSlot === undefined) {\n if (currentTextureSlot === null) {\n webglSlot = 33984 + maxTextures - 1;\n } else {\n webglSlot = currentTextureSlot;\n }\n }\n var boundTexture = currentBoundTextures[webglSlot];\n if (boundTexture === undefined) {\n boundTexture = {\n type: undefined,\n texture: undefined\n };\n currentBoundTextures[webglSlot] = boundTexture;\n }\n if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) {\n if (currentTextureSlot !== webglSlot) {\n gl.activeTexture(webglSlot);\n currentTextureSlot = webglSlot;\n }\n gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]);\n boundTexture.type = webglType;\n boundTexture.texture = webglTexture;\n }\n }\n function unbindTexture() {\n var boundTexture = currentBoundTextures[currentTextureSlot];\n if (boundTexture !== undefined && boundTexture.type !== undefined) {\n gl.bindTexture(boundTexture.type, null);\n boundTexture.type = undefined;\n boundTexture.texture = undefined;\n }\n }\n function compressedTexImage2D() {\n try {\n gl.compressedTexImage2D.apply(gl, arguments);\n } catch (error) {\n console.error('THREE.WebGLState:', error);\n }\n }\n function compressedTexImage3D() {\n try {\n gl.compressedTexImage3D.apply(gl, arguments);\n } catch (error) {\n console.error('THREE.WebGLState:', error);\n }\n }\n function texSubImage2D() {\n try {\n gl.texSubImage2D.apply(gl, arguments);\n } catch (error) {\n console.error('THREE.WebGLState:', error);\n }\n }\n function texSubImage3D() {\n try {\n gl.texSubImage3D.apply(gl, arguments);\n } catch (error) {\n console.error('THREE.WebGLState:', error);\n }\n }\n function compressedTexSubImage2D() {\n try {\n gl.compressedTexSubImage2D.apply(gl, arguments);\n } catch (error) {\n console.error('THREE.WebGLState:', error);\n }\n }\n function compressedTexSubImage3D() {\n try {\n gl.compressedTexSubImage3D.apply(gl, arguments);\n } catch (error) {\n console.error('THREE.WebGLState:', error);\n }\n }\n function texStorage2D() {\n try {\n gl.texStorage2D.apply(gl, arguments);\n } catch (error) {\n console.error('THREE.WebGLState:', error);\n }\n }\n function texStorage3D() {\n try {\n gl.texStorage3D.apply(gl, arguments);\n } catch (error) {\n console.error('THREE.WebGLState:', error);\n }\n }\n function texImage2D() {\n try {\n gl.texImage2D.apply(gl, arguments);\n } catch (error) {\n console.error('THREE.WebGLState:', error);\n }\n }\n function texImage3D() {\n try {\n gl.texImage3D.apply(gl, arguments);\n } catch (error) {\n console.error('THREE.WebGLState:', error);\n }\n }\n\n //\n\n function scissor(scissor) {\n if (currentScissor.equals(scissor) === false) {\n gl.scissor(scissor.x, scissor.y, scissor.z, scissor.w);\n currentScissor.copy(scissor);\n }\n }\n function viewport(viewport) {\n if (currentViewport.equals(viewport) === false) {\n gl.viewport(viewport.x, viewport.y, viewport.z, viewport.w);\n currentViewport.copy(viewport);\n }\n }\n function updateUBOMapping(uniformsGroup, program) {\n var mapping = uboProgramMap.get(program);\n if (mapping === undefined) {\n mapping = new WeakMap();\n uboProgramMap.set(program, mapping);\n }\n var blockIndex = mapping.get(uniformsGroup);\n if (blockIndex === undefined) {\n blockIndex = gl.getUniformBlockIndex(program, uniformsGroup.name);\n mapping.set(uniformsGroup, blockIndex);\n }\n }\n function uniformBlockBinding(uniformsGroup, program) {\n var mapping = uboProgramMap.get(program);\n var blockIndex = mapping.get(uniformsGroup);\n if (uboBindings.get(program) !== blockIndex) {\n // bind shader specific block index to global block point\n gl.uniformBlockBinding(program, blockIndex, uniformsGroup.__bindingPointIndex);\n uboBindings.set(program, blockIndex);\n }\n }\n\n //\n\n function reset() {\n // reset state\n\n gl.disable(3042);\n gl.disable(2884);\n gl.disable(2929);\n gl.disable(32823);\n gl.disable(3089);\n gl.disable(2960);\n gl.disable(32926);\n gl.blendEquation(32774);\n gl.blendFunc(1, 0);\n gl.blendFuncSeparate(1, 0, 1, 0);\n gl.colorMask(true, true, true, true);\n gl.clearColor(0, 0, 0, 0);\n gl.depthMask(true);\n gl.depthFunc(513);\n gl.clearDepth(1);\n gl.stencilMask(0xffffffff);\n gl.stencilFunc(519, 0, 0xffffffff);\n gl.stencilOp(7680, 7680, 7680);\n gl.clearStencil(0);\n gl.cullFace(1029);\n gl.frontFace(2305);\n gl.polygonOffset(0, 0);\n gl.activeTexture(33984);\n gl.bindFramebuffer(36160, null);\n if (isWebGL2 === true) {\n gl.bindFramebuffer(36009, null);\n gl.bindFramebuffer(36008, null);\n }\n gl.useProgram(null);\n gl.lineWidth(1);\n gl.scissor(0, 0, gl.canvas.width, gl.canvas.height);\n gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);\n\n // reset internals\n\n enabledCapabilities = {};\n currentTextureSlot = null;\n currentBoundTextures = {};\n currentBoundFramebuffers = {};\n currentDrawbuffers = new WeakMap();\n defaultDrawbuffers = [];\n currentProgram = null;\n currentBlendingEnabled = false;\n currentBlending = null;\n currentBlendEquation = null;\n currentBlendSrc = null;\n currentBlendDst = null;\n currentBlendEquationAlpha = null;\n currentBlendSrcAlpha = null;\n currentBlendDstAlpha = null;\n currentPremultipledAlpha = false;\n currentFlipSided = null;\n currentCullFace = null;\n currentLineWidth = null;\n currentPolygonOffsetFactor = null;\n currentPolygonOffsetUnits = null;\n currentScissor.set(0, 0, gl.canvas.width, gl.canvas.height);\n currentViewport.set(0, 0, gl.canvas.width, gl.canvas.height);\n colorBuffer.reset();\n depthBuffer.reset();\n stencilBuffer.reset();\n }\n return {\n buffers: {\n color: colorBuffer,\n depth: depthBuffer,\n stencil: stencilBuffer\n },\n enable: enable,\n disable: disable,\n bindFramebuffer: bindFramebuffer,\n drawBuffers: drawBuffers,\n useProgram: useProgram,\n setBlending: setBlending,\n setMaterial: setMaterial,\n setFlipSided: setFlipSided,\n setCullFace: setCullFace,\n setLineWidth: setLineWidth,\n setPolygonOffset: setPolygonOffset,\n setScissorTest: setScissorTest,\n activeTexture: activeTexture,\n bindTexture: bindTexture,\n unbindTexture: unbindTexture,\n compressedTexImage2D: compressedTexImage2D,\n compressedTexImage3D: compressedTexImage3D,\n texImage2D: texImage2D,\n texImage3D: texImage3D,\n updateUBOMapping: updateUBOMapping,\n uniformBlockBinding: uniformBlockBinding,\n texStorage2D: texStorage2D,\n texStorage3D: texStorage3D,\n texSubImage2D: texSubImage2D,\n texSubImage3D: texSubImage3D,\n compressedTexSubImage2D: compressedTexSubImage2D,\n compressedTexSubImage3D: compressedTexSubImage3D,\n scissor: scissor,\n viewport: viewport,\n reset: reset\n };\n}\nfunction WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info) {\n var _wrappingToGL, _filterToGL;\n var isWebGL2 = capabilities.isWebGL2;\n var maxTextures = capabilities.maxTextures;\n var maxCubemapSize = capabilities.maxCubemapSize;\n var maxTextureSize = capabilities.maxTextureSize;\n var maxSamples = capabilities.maxSamples;\n var multisampledRTTExt = extensions.has('WEBGL_multisampled_render_to_texture') ? extensions.get('WEBGL_multisampled_render_to_texture') : null;\n var supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test(navigator.userAgent);\n var _videoTextures = new WeakMap();\n var _canvas;\n var _sources = new WeakMap(); // maps WebglTexture objects to instances of Source\n\n // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,\n // also OffscreenCanvas.getContext(\"webgl\"), but not OffscreenCanvas.getContext(\"2d\")!\n // Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).\n\n var useOffscreenCanvas = false;\n try {\n useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'\n // eslint-disable-next-line compat/compat\n && new OffscreenCanvas(1, 1).getContext('2d') !== null;\n } catch (err) {\n\n // Ignore any errors\n }\n function createCanvas(width, height) {\n // Use OffscreenCanvas when available. Specially needed in web workers\n\n return useOffscreenCanvas ?\n // eslint-disable-next-line compat/compat\n new OffscreenCanvas(width, height) : createElementNS('canvas');\n }\n function resizeImage(image, needsPowerOfTwo, needsNewCanvas, maxSize) {\n var scale = 1;\n\n // handle case if texture exceeds max size\n\n if (image.width > maxSize || image.height > maxSize) {\n scale = maxSize / Math.max(image.width, image.height);\n }\n\n // only perform resize if necessary\n\n if (scale < 1 || needsPowerOfTwo === true) {\n // only perform resize for certain image types\n\n if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) {\n var floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;\n var width = floor(scale * image.width);\n var height = floor(scale * image.height);\n if (_canvas === undefined) _canvas = createCanvas(width, height);\n\n // cube textures can't reuse the same canvas\n\n var canvas = needsNewCanvas ? createCanvas(width, height) : _canvas;\n canvas.width = width;\n canvas.height = height;\n var context = canvas.getContext('2d');\n context.drawImage(image, 0, 0, width, height);\n console.warn('THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').');\n return canvas;\n } else {\n if ('data' in image) {\n console.warn('THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').');\n }\n return image;\n }\n }\n return image;\n }\n function isPowerOfTwo$1(image) {\n return isPowerOfTwo(image.width) && isPowerOfTwo(image.height);\n }\n function textureNeedsPowerOfTwo(texture) {\n if (isWebGL2) return false;\n return texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping || texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;\n }\n function textureNeedsGenerateMipmaps(texture, supportsMips) {\n return texture.generateMipmaps && supportsMips && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;\n }\n function generateMipmap(target) {\n _gl.generateMipmap(target);\n }\n function getInternalFormat(internalFormatName, glFormat, glType, encoding) {\n var forceLinearEncoding = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n if (isWebGL2 === false) return glFormat;\n if (internalFormatName !== null) {\n if (_gl[internalFormatName] !== undefined) return _gl[internalFormatName];\n console.warn('THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \\'' + internalFormatName + '\\'');\n }\n var internalFormat = glFormat;\n if (glFormat === 6403) {\n if (glType === 5126) internalFormat = 33326;\n if (glType === 5131) internalFormat = 33325;\n if (glType === 5121) internalFormat = 33321;\n }\n if (glFormat === 33319) {\n if (glType === 5126) internalFormat = 33328;\n if (glType === 5131) internalFormat = 33327;\n if (glType === 5121) internalFormat = 33323;\n }\n if (glFormat === 6408) {\n if (glType === 5126) internalFormat = 34836;\n if (glType === 5131) internalFormat = 34842;\n if (glType === 5121) internalFormat = encoding === sRGBEncoding && forceLinearEncoding === false ? 35907 : 32856;\n if (glType === 32819) internalFormat = 32854;\n if (glType === 32820) internalFormat = 32855;\n }\n if (internalFormat === 33325 || internalFormat === 33326 || internalFormat === 33327 || internalFormat === 33328 || internalFormat === 34842 || internalFormat === 34836) {\n extensions.get('EXT_color_buffer_float');\n }\n return internalFormat;\n }\n function getMipLevels(texture, image, supportsMips) {\n if (textureNeedsGenerateMipmaps(texture, supportsMips) === true || texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter) {\n return Math.log2(Math.max(image.width, image.height)) + 1;\n } else if (texture.mipmaps !== undefined && texture.mipmaps.length > 0) {\n // user-defined mipmaps\n\n return texture.mipmaps.length;\n } else if (texture.isCompressedTexture && Array.isArray(texture.image)) {\n return image.mipmaps.length;\n } else {\n // texture without mipmaps (only base level)\n\n return 1;\n }\n }\n\n // Fallback filters for non-power-of-2 textures\n\n function filterFallback(f) {\n if (f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter) {\n return 9728;\n }\n return 9729;\n }\n\n //\n\n function onTextureDispose(event) {\n var texture = event.target;\n texture.removeEventListener('dispose', onTextureDispose);\n deallocateTexture(texture);\n if (texture.isVideoTexture) {\n _videoTextures[\"delete\"](texture);\n }\n }\n function onRenderTargetDispose(event) {\n var renderTarget = event.target;\n renderTarget.removeEventListener('dispose', onRenderTargetDispose);\n deallocateRenderTarget(renderTarget);\n }\n\n //\n\n function deallocateTexture(texture) {\n var textureProperties = properties.get(texture);\n if (textureProperties.__webglInit === undefined) return;\n\n // check if it's necessary to remove the WebGLTexture object\n\n var source = texture.source;\n var webglTextures = _sources.get(source);\n if (webglTextures) {\n var webglTexture = webglTextures[textureProperties.__cacheKey];\n webglTexture.usedTimes--;\n\n // the WebGLTexture object is not used anymore, remove it\n\n if (webglTexture.usedTimes === 0) {\n deleteTexture(texture);\n }\n\n // remove the weak map entry if no WebGLTexture uses the source anymore\n\n if (Object.keys(webglTextures).length === 0) {\n _sources[\"delete\"](source);\n }\n }\n properties.remove(texture);\n }\n function deleteTexture(texture) {\n var textureProperties = properties.get(texture);\n _gl.deleteTexture(textureProperties.__webglTexture);\n var source = texture.source;\n var webglTextures = _sources.get(source);\n delete webglTextures[textureProperties.__cacheKey];\n info.memory.textures--;\n }\n function deallocateRenderTarget(renderTarget) {\n var texture = renderTarget.texture;\n var renderTargetProperties = properties.get(renderTarget);\n var textureProperties = properties.get(texture);\n if (textureProperties.__webglTexture !== undefined) {\n _gl.deleteTexture(textureProperties.__webglTexture);\n info.memory.textures--;\n }\n if (renderTarget.depthTexture) {\n renderTarget.depthTexture.dispose();\n }\n if (renderTarget.isWebGLCubeRenderTarget) {\n for (var i = 0; i < 6; i++) {\n _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]);\n if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]);\n }\n } else {\n _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer);\n if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer);\n if (renderTargetProperties.__webglMultisampledFramebuffer) _gl.deleteFramebuffer(renderTargetProperties.__webglMultisampledFramebuffer);\n if (renderTargetProperties.__webglColorRenderbuffer) {\n for (var _i39 = 0; _i39 < renderTargetProperties.__webglColorRenderbuffer.length; _i39++) {\n if (renderTargetProperties.__webglColorRenderbuffer[_i39]) _gl.deleteRenderbuffer(renderTargetProperties.__webglColorRenderbuffer[_i39]);\n }\n }\n if (renderTargetProperties.__webglDepthRenderbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthRenderbuffer);\n }\n if (renderTarget.isWebGLMultipleRenderTargets) {\n for (var _i40 = 0, il = texture.length; _i40 < il; _i40++) {\n var attachmentProperties = properties.get(texture[_i40]);\n if (attachmentProperties.__webglTexture) {\n _gl.deleteTexture(attachmentProperties.__webglTexture);\n info.memory.textures--;\n }\n properties.remove(texture[_i40]);\n }\n }\n properties.remove(texture);\n properties.remove(renderTarget);\n }\n\n //\n\n var textureUnits = 0;\n function resetTextureUnits() {\n textureUnits = 0;\n }\n function allocateTextureUnit() {\n var textureUnit = textureUnits;\n if (textureUnit >= maxTextures) {\n console.warn('THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures);\n }\n textureUnits += 1;\n return textureUnit;\n }\n function getTextureCacheKey(texture) {\n var array = [];\n array.push(texture.wrapS);\n array.push(texture.wrapT);\n array.push(texture.wrapR || 0);\n array.push(texture.magFilter);\n array.push(texture.minFilter);\n array.push(texture.anisotropy);\n array.push(texture.internalFormat);\n array.push(texture.format);\n array.push(texture.type);\n array.push(texture.generateMipmaps);\n array.push(texture.premultiplyAlpha);\n array.push(texture.flipY);\n array.push(texture.unpackAlignment);\n array.push(texture.encoding);\n return array.join();\n }\n\n //\n\n function setTexture2D(texture, slot) {\n var textureProperties = properties.get(texture);\n if (texture.isVideoTexture) updateVideoTexture(texture);\n if (texture.isRenderTargetTexture === false && texture.version > 0 && textureProperties.__version !== texture.version) {\n var image = texture.image;\n if (image === null) {\n console.warn('THREE.WebGLRenderer: Texture marked for update but no image data found.');\n } else if (image.complete === false) {\n console.warn('THREE.WebGLRenderer: Texture marked for update but image is incomplete');\n } else {\n uploadTexture(textureProperties, texture, slot);\n return;\n }\n }\n state.bindTexture(3553, textureProperties.__webglTexture, 33984 + slot);\n }\n function setTexture2DArray(texture, slot) {\n var textureProperties = properties.get(texture);\n if (texture.version > 0 && textureProperties.__version !== texture.version) {\n uploadTexture(textureProperties, texture, slot);\n return;\n }\n state.bindTexture(35866, textureProperties.__webglTexture, 33984 + slot);\n }\n function setTexture3D(texture, slot) {\n var textureProperties = properties.get(texture);\n if (texture.version > 0 && textureProperties.__version !== texture.version) {\n uploadTexture(textureProperties, texture, slot);\n return;\n }\n state.bindTexture(32879, textureProperties.__webglTexture, 33984 + slot);\n }\n function setTextureCube(texture, slot) {\n var textureProperties = properties.get(texture);\n if (texture.version > 0 && textureProperties.__version !== texture.version) {\n uploadCubeTexture(textureProperties, texture, slot);\n return;\n }\n state.bindTexture(34067, textureProperties.__webglTexture, 33984 + slot);\n }\n var wrappingToGL = (_wrappingToGL = {}, _defineProperty(_wrappingToGL, RepeatWrapping, 10497), _defineProperty(_wrappingToGL, ClampToEdgeWrapping, 33071), _defineProperty(_wrappingToGL, MirroredRepeatWrapping, 33648), _wrappingToGL);\n var filterToGL = (_filterToGL = {}, _defineProperty(_filterToGL, NearestFilter, 9728), _defineProperty(_filterToGL, NearestMipmapNearestFilter, 9984), _defineProperty(_filterToGL, NearestMipmapLinearFilter, 9986), _defineProperty(_filterToGL, LinearFilter, 9729), _defineProperty(_filterToGL, LinearMipmapNearestFilter, 9985), _defineProperty(_filterToGL, LinearMipmapLinearFilter, 9987), _filterToGL);\n function setTextureParameters(textureType, texture, supportsMips) {\n if (supportsMips) {\n _gl.texParameteri(textureType, 10242, wrappingToGL[texture.wrapS]);\n _gl.texParameteri(textureType, 10243, wrappingToGL[texture.wrapT]);\n if (textureType === 32879 || textureType === 35866) {\n _gl.texParameteri(textureType, 32882, wrappingToGL[texture.wrapR]);\n }\n _gl.texParameteri(textureType, 10240, filterToGL[texture.magFilter]);\n _gl.texParameteri(textureType, 10241, filterToGL[texture.minFilter]);\n } else {\n _gl.texParameteri(textureType, 10242, 33071);\n _gl.texParameteri(textureType, 10243, 33071);\n if (textureType === 32879 || textureType === 35866) {\n _gl.texParameteri(textureType, 32882, 33071);\n }\n if (texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping) {\n console.warn('THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.');\n }\n _gl.texParameteri(textureType, 10240, filterFallback(texture.magFilter));\n _gl.texParameteri(textureType, 10241, filterFallback(texture.minFilter));\n if (texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter) {\n console.warn('THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.');\n }\n }\n if (extensions.has('EXT_texture_filter_anisotropic') === true) {\n var extension = extensions.get('EXT_texture_filter_anisotropic');\n if (texture.magFilter === NearestFilter) return;\n if (texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter) return;\n if (texture.type === FloatType && extensions.has('OES_texture_float_linear') === false) return; // verify extension for WebGL 1 and WebGL 2\n if (isWebGL2 === false && texture.type === HalfFloatType && extensions.has('OES_texture_half_float_linear') === false) return; // verify extension for WebGL 1 only\n\n if (texture.anisotropy > 1 || properties.get(texture).__currentAnisotropy) {\n _gl.texParameterf(textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(texture.anisotropy, capabilities.getMaxAnisotropy()));\n properties.get(texture).__currentAnisotropy = texture.anisotropy;\n }\n }\n }\n function initTexture(textureProperties, texture) {\n var forceUpload = false;\n if (textureProperties.__webglInit === undefined) {\n textureProperties.__webglInit = true;\n texture.addEventListener('dispose', onTextureDispose);\n }\n\n // create Source <-> WebGLTextures mapping if necessary\n\n var source = texture.source;\n var webglTextures = _sources.get(source);\n if (webglTextures === undefined) {\n webglTextures = {};\n _sources.set(source, webglTextures);\n }\n\n // check if there is already a WebGLTexture object for the given texture parameters\n\n var textureCacheKey = getTextureCacheKey(texture);\n if (textureCacheKey !== textureProperties.__cacheKey) {\n // if not, create a new instance of WebGLTexture\n\n if (webglTextures[textureCacheKey] === undefined) {\n // create new entry\n\n webglTextures[textureCacheKey] = {\n texture: _gl.createTexture(),\n usedTimes: 0\n };\n info.memory.textures++;\n\n // when a new instance of WebGLTexture was created, a texture upload is required\n // even if the image contents are identical\n\n forceUpload = true;\n }\n webglTextures[textureCacheKey].usedTimes++;\n\n // every time the texture cache key changes, it's necessary to check if an instance of\n // WebGLTexture can be deleted in order to avoid a memory leak.\n\n var webglTexture = webglTextures[textureProperties.__cacheKey];\n if (webglTexture !== undefined) {\n webglTextures[textureProperties.__cacheKey].usedTimes--;\n if (webglTexture.usedTimes === 0) {\n deleteTexture(texture);\n }\n }\n\n // store references to cache key and WebGLTexture object\n\n textureProperties.__cacheKey = textureCacheKey;\n textureProperties.__webglTexture = webglTextures[textureCacheKey].texture;\n }\n return forceUpload;\n }\n function uploadTexture(textureProperties, texture, slot) {\n var textureType = 3553;\n if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) textureType = 35866;\n if (texture.isData3DTexture) textureType = 32879;\n var forceUpload = initTexture(textureProperties, texture);\n var source = texture.source;\n state.bindTexture(textureType, textureProperties.__webglTexture, 33984 + slot);\n var sourceProperties = properties.get(source);\n if (source.version !== sourceProperties.__version || forceUpload === true) {\n state.activeTexture(33984 + slot);\n _gl.pixelStorei(37440, texture.flipY);\n _gl.pixelStorei(37441, texture.premultiplyAlpha);\n _gl.pixelStorei(3317, texture.unpackAlignment);\n _gl.pixelStorei(37443, 0);\n var needsPowerOfTwo = textureNeedsPowerOfTwo(texture) && isPowerOfTwo$1(texture.image) === false;\n var image = resizeImage(texture.image, needsPowerOfTwo, false, maxTextureSize);\n image = verifyColorSpace(texture, image);\n var supportsMips = isPowerOfTwo$1(image) || isWebGL2,\n glFormat = utils.convert(texture.format, texture.encoding);\n var glType = utils.convert(texture.type),\n glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.isVideoTexture);\n setTextureParameters(textureType, texture, supportsMips);\n var mipmap;\n var mipmaps = texture.mipmaps;\n var useTexStorage = isWebGL2 && texture.isVideoTexture !== true;\n var allocateMemory = sourceProperties.__version === undefined || forceUpload === true;\n var levels = getMipLevels(texture, image, supportsMips);\n if (texture.isDepthTexture) {\n // populate depth texture with dummy data\n\n glInternalFormat = 6402;\n if (isWebGL2) {\n if (texture.type === FloatType) {\n glInternalFormat = 36012;\n } else if (texture.type === UnsignedIntType) {\n glInternalFormat = 33190;\n } else if (texture.type === UnsignedInt248Type) {\n glInternalFormat = 35056;\n } else {\n glInternalFormat = 33189; // WebGL2 requires sized internalformat for glTexImage2D\n }\n } else {\n if (texture.type === FloatType) {\n console.error('WebGLRenderer: Floating point depth texture requires WebGL2.');\n }\n }\n\n // validation checks for WebGL 1\n\n if (texture.format === DepthFormat && glInternalFormat === 6402) {\n // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n // DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT\n // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n if (texture.type !== UnsignedShortType && texture.type !== UnsignedIntType) {\n console.warn('THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.');\n texture.type = UnsignedIntType;\n glType = utils.convert(texture.type);\n }\n }\n if (texture.format === DepthStencilFormat && glInternalFormat === 6402) {\n // Depth stencil textures need the DEPTH_STENCIL internal format\n // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n glInternalFormat = 34041;\n\n // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are\n // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.\n // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)\n if (texture.type !== UnsignedInt248Type) {\n console.warn('THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.');\n texture.type = UnsignedInt248Type;\n glType = utils.convert(texture.type);\n }\n }\n\n //\n\n if (allocateMemory) {\n if (useTexStorage) {\n state.texStorage2D(3553, 1, glInternalFormat, image.width, image.height);\n } else {\n state.texImage2D(3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, null);\n }\n }\n } else if (texture.isDataTexture) {\n // use manually created mipmaps if available\n // if there are no manual mipmaps\n // set 0 level mipmap and then use GL to generate other mipmap levels\n\n if (mipmaps.length > 0 && supportsMips) {\n if (useTexStorage && allocateMemory) {\n state.texStorage2D(3553, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);\n }\n for (var i = 0, il = mipmaps.length; i < il; i++) {\n mipmap = mipmaps[i];\n if (useTexStorage) {\n state.texSubImage2D(3553, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);\n } else {\n state.texImage2D(3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);\n }\n }\n texture.generateMipmaps = false;\n } else {\n if (useTexStorage) {\n if (allocateMemory) {\n state.texStorage2D(3553, levels, glInternalFormat, image.width, image.height);\n }\n state.texSubImage2D(3553, 0, 0, 0, image.width, image.height, glFormat, glType, image.data);\n } else {\n state.texImage2D(3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data);\n }\n }\n } else if (texture.isCompressedTexture) {\n if (texture.isCompressedArrayTexture) {\n if (useTexStorage && allocateMemory) {\n state.texStorage3D(35866, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height, image.depth);\n }\n for (var _i41 = 0, _il9 = mipmaps.length; _i41 < _il9; _i41++) {\n mipmap = mipmaps[_i41];\n if (texture.format !== RGBAFormat) {\n if (glFormat !== null) {\n if (useTexStorage) {\n state.compressedTexSubImage3D(35866, _i41, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0);\n } else {\n state.compressedTexImage3D(35866, _i41, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0);\n }\n } else {\n console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');\n }\n } else {\n if (useTexStorage) {\n state.texSubImage3D(35866, _i41, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data);\n } else {\n state.texImage3D(35866, _i41, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data);\n }\n }\n }\n } else {\n if (useTexStorage && allocateMemory) {\n state.texStorage2D(3553, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);\n }\n for (var _i42 = 0, _il10 = mipmaps.length; _i42 < _il10; _i42++) {\n mipmap = mipmaps[_i42];\n if (texture.format !== RGBAFormat) {\n if (glFormat !== null) {\n if (useTexStorage) {\n state.compressedTexSubImage2D(3553, _i42, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);\n } else {\n state.compressedTexImage2D(3553, _i42, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);\n }\n } else {\n console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');\n }\n } else {\n if (useTexStorage) {\n state.texSubImage2D(3553, _i42, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);\n } else {\n state.texImage2D(3553, _i42, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);\n }\n }\n }\n }\n } else if (texture.isDataArrayTexture) {\n if (useTexStorage) {\n if (allocateMemory) {\n state.texStorage3D(35866, levels, glInternalFormat, image.width, image.height, image.depth);\n }\n state.texSubImage3D(35866, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data);\n } else {\n state.texImage3D(35866, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data);\n }\n } else if (texture.isData3DTexture) {\n if (useTexStorage) {\n if (allocateMemory) {\n state.texStorage3D(32879, levels, glInternalFormat, image.width, image.height, image.depth);\n }\n state.texSubImage3D(32879, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data);\n } else {\n state.texImage3D(32879, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data);\n }\n } else if (texture.isFramebufferTexture) {\n if (allocateMemory) {\n if (useTexStorage) {\n state.texStorage2D(3553, levels, glInternalFormat, image.width, image.height);\n } else {\n var width = image.width,\n height = image.height;\n for (var _i43 = 0; _i43 < levels; _i43++) {\n state.texImage2D(3553, _i43, glInternalFormat, width, height, 0, glFormat, glType, null);\n width >>= 1;\n height >>= 1;\n }\n }\n }\n } else {\n // regular Texture (image, video, canvas)\n\n // use manually created mipmaps if available\n // if there are no manual mipmaps\n // set 0 level mipmap and then use GL to generate other mipmap levels\n\n if (mipmaps.length > 0 && supportsMips) {\n if (useTexStorage && allocateMemory) {\n state.texStorage2D(3553, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);\n }\n for (var _i44 = 0, _il11 = mipmaps.length; _i44 < _il11; _i44++) {\n mipmap = mipmaps[_i44];\n if (useTexStorage) {\n state.texSubImage2D(3553, _i44, 0, 0, glFormat, glType, mipmap);\n } else {\n state.texImage2D(3553, _i44, glInternalFormat, glFormat, glType, mipmap);\n }\n }\n texture.generateMipmaps = false;\n } else {\n if (useTexStorage) {\n if (allocateMemory) {\n state.texStorage2D(3553, levels, glInternalFormat, image.width, image.height);\n }\n state.texSubImage2D(3553, 0, 0, 0, glFormat, glType, image);\n } else {\n state.texImage2D(3553, 0, glInternalFormat, glFormat, glType, image);\n }\n }\n }\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) {\n generateMipmap(textureType);\n }\n sourceProperties.__version = source.version;\n if (texture.onUpdate) texture.onUpdate(texture);\n }\n textureProperties.__version = texture.version;\n }\n function uploadCubeTexture(textureProperties, texture, slot) {\n if (texture.image.length !== 6) return;\n var forceUpload = initTexture(textureProperties, texture);\n var source = texture.source;\n state.bindTexture(34067, textureProperties.__webglTexture, 33984 + slot);\n var sourceProperties = properties.get(source);\n if (source.version !== sourceProperties.__version || forceUpload === true) {\n state.activeTexture(33984 + slot);\n _gl.pixelStorei(37440, texture.flipY);\n _gl.pixelStorei(37441, texture.premultiplyAlpha);\n _gl.pixelStorei(3317, texture.unpackAlignment);\n _gl.pixelStorei(37443, 0);\n var isCompressed = texture.isCompressedTexture || texture.image[0].isCompressedTexture;\n var isDataTexture = texture.image[0] && texture.image[0].isDataTexture;\n var cubeImage = [];\n for (var i = 0; i < 6; i++) {\n if (!isCompressed && !isDataTexture) {\n cubeImage[i] = resizeImage(texture.image[i], false, true, maxCubemapSize);\n } else {\n cubeImage[i] = isDataTexture ? texture.image[i].image : texture.image[i];\n }\n cubeImage[i] = verifyColorSpace(texture, cubeImage[i]);\n }\n var image = cubeImage[0],\n supportsMips = isPowerOfTwo$1(image) || isWebGL2,\n glFormat = utils.convert(texture.format, texture.encoding),\n glType = utils.convert(texture.type),\n glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding);\n var useTexStorage = isWebGL2 && texture.isVideoTexture !== true;\n var allocateMemory = sourceProperties.__version === undefined || forceUpload === true;\n var levels = getMipLevels(texture, image, supportsMips);\n setTextureParameters(34067, texture, supportsMips);\n var mipmaps;\n if (isCompressed) {\n if (useTexStorage && allocateMemory) {\n state.texStorage2D(34067, levels, glInternalFormat, image.width, image.height);\n }\n for (var _i45 = 0; _i45 < 6; _i45++) {\n mipmaps = cubeImage[_i45].mipmaps;\n for (var j = 0; j < mipmaps.length; j++) {\n var mipmap = mipmaps[j];\n if (texture.format !== RGBAFormat) {\n if (glFormat !== null) {\n if (useTexStorage) {\n state.compressedTexSubImage2D(34069 + _i45, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);\n } else {\n state.compressedTexImage2D(34069 + _i45, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);\n }\n } else {\n console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()');\n }\n } else {\n if (useTexStorage) {\n state.texSubImage2D(34069 + _i45, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);\n } else {\n state.texImage2D(34069 + _i45, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);\n }\n }\n }\n }\n } else {\n mipmaps = texture.mipmaps;\n if (useTexStorage && allocateMemory) {\n // TODO: Uniformly handle mipmap definitions\n // Normal textures and compressed cube textures define base level + mips with their mipmap array\n // Uncompressed cube textures use their mipmap array only for mips (no base level)\n\n if (mipmaps.length > 0) levels++;\n state.texStorage2D(34067, levels, glInternalFormat, cubeImage[0].width, cubeImage[0].height);\n }\n for (var _i46 = 0; _i46 < 6; _i46++) {\n if (isDataTexture) {\n if (useTexStorage) {\n state.texSubImage2D(34069 + _i46, 0, 0, 0, cubeImage[_i46].width, cubeImage[_i46].height, glFormat, glType, cubeImage[_i46].data);\n } else {\n state.texImage2D(34069 + _i46, 0, glInternalFormat, cubeImage[_i46].width, cubeImage[_i46].height, 0, glFormat, glType, cubeImage[_i46].data);\n }\n for (var _j3 = 0; _j3 < mipmaps.length; _j3++) {\n var _mipmap = mipmaps[_j3];\n var mipmapImage = _mipmap.image[_i46].image;\n if (useTexStorage) {\n state.texSubImage2D(34069 + _i46, _j3 + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data);\n } else {\n state.texImage2D(34069 + _i46, _j3 + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data);\n }\n }\n } else {\n if (useTexStorage) {\n state.texSubImage2D(34069 + _i46, 0, 0, 0, glFormat, glType, cubeImage[_i46]);\n } else {\n state.texImage2D(34069 + _i46, 0, glInternalFormat, glFormat, glType, cubeImage[_i46]);\n }\n for (var _j4 = 0; _j4 < mipmaps.length; _j4++) {\n var _mipmap2 = mipmaps[_j4];\n if (useTexStorage) {\n state.texSubImage2D(34069 + _i46, _j4 + 1, 0, 0, glFormat, glType, _mipmap2.image[_i46]);\n } else {\n state.texImage2D(34069 + _i46, _j4 + 1, glInternalFormat, glFormat, glType, _mipmap2.image[_i46]);\n }\n }\n }\n }\n }\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) {\n // We assume images for cube map have the same size.\n generateMipmap(34067);\n }\n sourceProperties.__version = source.version;\n if (texture.onUpdate) texture.onUpdate(texture);\n }\n textureProperties.__version = texture.version;\n }\n\n // Render targets\n\n // Setup storage for target texture and bind it to correct framebuffer\n function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget) {\n var glFormat = utils.convert(texture.format, texture.encoding);\n var glType = utils.convert(texture.type);\n var glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding);\n var renderTargetProperties = properties.get(renderTarget);\n if (!renderTargetProperties.__hasExternalTextures) {\n if (textureTarget === 32879 || textureTarget === 35866) {\n state.texImage3D(textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.depth, 0, glFormat, glType, null);\n } else {\n state.texImage2D(textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null);\n }\n }\n state.bindFramebuffer(36160, framebuffer);\n if (useMultisampledRTT(renderTarget)) {\n multisampledRTTExt.framebufferTexture2DMultisampleEXT(36160, attachment, textureTarget, properties.get(texture).__webglTexture, 0, getRenderTargetSamples(renderTarget));\n } else if (textureTarget === 3553 || textureTarget >= 34069 && textureTarget <= 34074) {\n // see #24753\n\n _gl.framebufferTexture2D(36160, attachment, textureTarget, properties.get(texture).__webglTexture, 0);\n }\n state.bindFramebuffer(36160, null);\n }\n\n // Setup storage for internal depth/stencil buffers and bind to correct framebuffer\n function setupRenderBufferStorage(renderbuffer, renderTarget, isMultisample) {\n _gl.bindRenderbuffer(36161, renderbuffer);\n if (renderTarget.depthBuffer && !renderTarget.stencilBuffer) {\n var glInternalFormat = 33189;\n if (isMultisample || useMultisampledRTT(renderTarget)) {\n var depthTexture = renderTarget.depthTexture;\n if (depthTexture && depthTexture.isDepthTexture) {\n if (depthTexture.type === FloatType) {\n glInternalFormat = 36012;\n } else if (depthTexture.type === UnsignedIntType) {\n glInternalFormat = 33190;\n }\n }\n var samples = getRenderTargetSamples(renderTarget);\n if (useMultisampledRTT(renderTarget)) {\n multisampledRTTExt.renderbufferStorageMultisampleEXT(36161, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n } else {\n _gl.renderbufferStorageMultisample(36161, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n }\n } else {\n _gl.renderbufferStorage(36161, glInternalFormat, renderTarget.width, renderTarget.height);\n }\n _gl.framebufferRenderbuffer(36160, 36096, 36161, renderbuffer);\n } else if (renderTarget.depthBuffer && renderTarget.stencilBuffer) {\n var _samples = getRenderTargetSamples(renderTarget);\n if (isMultisample && useMultisampledRTT(renderTarget) === false) {\n _gl.renderbufferStorageMultisample(36161, _samples, 35056, renderTarget.width, renderTarget.height);\n } else if (useMultisampledRTT(renderTarget)) {\n multisampledRTTExt.renderbufferStorageMultisampleEXT(36161, _samples, 35056, renderTarget.width, renderTarget.height);\n } else {\n _gl.renderbufferStorage(36161, 34041, renderTarget.width, renderTarget.height);\n }\n _gl.framebufferRenderbuffer(36160, 33306, 36161, renderbuffer);\n } else {\n var textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [renderTarget.texture];\n for (var i = 0; i < textures.length; i++) {\n var texture = textures[i];\n var glFormat = utils.convert(texture.format, texture.encoding);\n var glType = utils.convert(texture.type);\n var _glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding);\n var _samples2 = getRenderTargetSamples(renderTarget);\n if (isMultisample && useMultisampledRTT(renderTarget) === false) {\n _gl.renderbufferStorageMultisample(36161, _samples2, _glInternalFormat, renderTarget.width, renderTarget.height);\n } else if (useMultisampledRTT(renderTarget)) {\n multisampledRTTExt.renderbufferStorageMultisampleEXT(36161, _samples2, _glInternalFormat, renderTarget.width, renderTarget.height);\n } else {\n _gl.renderbufferStorage(36161, _glInternalFormat, renderTarget.width, renderTarget.height);\n }\n }\n }\n _gl.bindRenderbuffer(36161, null);\n }\n\n // Setup resources for a Depth Texture for a FBO (needs an extension)\n function setupDepthTexture(framebuffer, renderTarget) {\n var isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget;\n if (isCube) throw new Error('Depth Texture with cube render targets is not supported');\n state.bindFramebuffer(36160, framebuffer);\n if (!(renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture)) {\n throw new Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture');\n }\n\n // upload an empty depth texture with framebuffer size\n if (!properties.get(renderTarget.depthTexture).__webglTexture || renderTarget.depthTexture.image.width !== renderTarget.width || renderTarget.depthTexture.image.height !== renderTarget.height) {\n renderTarget.depthTexture.image.width = renderTarget.width;\n renderTarget.depthTexture.image.height = renderTarget.height;\n renderTarget.depthTexture.needsUpdate = true;\n }\n setTexture2D(renderTarget.depthTexture, 0);\n var webglDepthTexture = properties.get(renderTarget.depthTexture).__webglTexture;\n var samples = getRenderTargetSamples(renderTarget);\n if (renderTarget.depthTexture.format === DepthFormat) {\n if (useMultisampledRTT(renderTarget)) {\n multisampledRTTExt.framebufferTexture2DMultisampleEXT(36160, 36096, 3553, webglDepthTexture, 0, samples);\n } else {\n _gl.framebufferTexture2D(36160, 36096, 3553, webglDepthTexture, 0);\n }\n } else if (renderTarget.depthTexture.format === DepthStencilFormat) {\n if (useMultisampledRTT(renderTarget)) {\n multisampledRTTExt.framebufferTexture2DMultisampleEXT(36160, 33306, 3553, webglDepthTexture, 0, samples);\n } else {\n _gl.framebufferTexture2D(36160, 33306, 3553, webglDepthTexture, 0);\n }\n } else {\n throw new Error('Unknown depthTexture format');\n }\n }\n\n // Setup GL resources for a non-texture depth buffer\n function setupDepthRenderbuffer(renderTarget) {\n var renderTargetProperties = properties.get(renderTarget);\n var isCube = renderTarget.isWebGLCubeRenderTarget === true;\n if (renderTarget.depthTexture && !renderTargetProperties.__autoAllocateDepthBuffer) {\n if (isCube) throw new Error('target.depthTexture not supported in Cube render targets');\n setupDepthTexture(renderTargetProperties.__webglFramebuffer, renderTarget);\n } else {\n if (isCube) {\n renderTargetProperties.__webglDepthbuffer = [];\n for (var i = 0; i < 6; i++) {\n state.bindFramebuffer(36160, renderTargetProperties.__webglFramebuffer[i]);\n renderTargetProperties.__webglDepthbuffer[i] = _gl.createRenderbuffer();\n setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer[i], renderTarget, false);\n }\n } else {\n state.bindFramebuffer(36160, renderTargetProperties.__webglFramebuffer);\n renderTargetProperties.__webglDepthbuffer = _gl.createRenderbuffer();\n setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer, renderTarget, false);\n }\n }\n state.bindFramebuffer(36160, null);\n }\n\n // rebind framebuffer with external textures\n function rebindTextures(renderTarget, colorTexture, depthTexture) {\n var renderTargetProperties = properties.get(renderTarget);\n if (colorTexture !== undefined) {\n setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, 36064, 3553);\n }\n if (depthTexture !== undefined) {\n setupDepthRenderbuffer(renderTarget);\n }\n }\n\n // Set up GL resources for the render target\n function setupRenderTarget(renderTarget) {\n var texture = renderTarget.texture;\n var renderTargetProperties = properties.get(renderTarget);\n var textureProperties = properties.get(texture);\n renderTarget.addEventListener('dispose', onRenderTargetDispose);\n if (renderTarget.isWebGLMultipleRenderTargets !== true) {\n if (textureProperties.__webglTexture === undefined) {\n textureProperties.__webglTexture = _gl.createTexture();\n }\n textureProperties.__version = texture.version;\n info.memory.textures++;\n }\n var isCube = renderTarget.isWebGLCubeRenderTarget === true;\n var isMultipleRenderTargets = renderTarget.isWebGLMultipleRenderTargets === true;\n var supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2;\n\n // Setup framebuffer\n\n if (isCube) {\n renderTargetProperties.__webglFramebuffer = [];\n for (var i = 0; i < 6; i++) {\n renderTargetProperties.__webglFramebuffer[i] = _gl.createFramebuffer();\n }\n } else {\n renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer();\n if (isMultipleRenderTargets) {\n if (capabilities.drawBuffers) {\n var textures = renderTarget.texture;\n for (var _i47 = 0, il = textures.length; _i47 < il; _i47++) {\n var attachmentProperties = properties.get(textures[_i47]);\n if (attachmentProperties.__webglTexture === undefined) {\n attachmentProperties.__webglTexture = _gl.createTexture();\n info.memory.textures++;\n }\n }\n } else {\n console.warn('THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.');\n }\n }\n if (isWebGL2 && renderTarget.samples > 0 && useMultisampledRTT(renderTarget) === false) {\n var _textures = isMultipleRenderTargets ? texture : [texture];\n renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();\n renderTargetProperties.__webglColorRenderbuffer = [];\n state.bindFramebuffer(36160, renderTargetProperties.__webglMultisampledFramebuffer);\n for (var _i48 = 0; _i48 < _textures.length; _i48++) {\n var _texture = _textures[_i48];\n renderTargetProperties.__webglColorRenderbuffer[_i48] = _gl.createRenderbuffer();\n _gl.bindRenderbuffer(36161, renderTargetProperties.__webglColorRenderbuffer[_i48]);\n var glFormat = utils.convert(_texture.format, _texture.encoding);\n var glType = utils.convert(_texture.type);\n var glInternalFormat = getInternalFormat(_texture.internalFormat, glFormat, glType, _texture.encoding, renderTarget.isXRRenderTarget === true);\n var samples = getRenderTargetSamples(renderTarget);\n _gl.renderbufferStorageMultisample(36161, samples, glInternalFormat, renderTarget.width, renderTarget.height);\n _gl.framebufferRenderbuffer(36160, 36064 + _i48, 36161, renderTargetProperties.__webglColorRenderbuffer[_i48]);\n }\n _gl.bindRenderbuffer(36161, null);\n if (renderTarget.depthBuffer) {\n renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer();\n setupRenderBufferStorage(renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true);\n }\n state.bindFramebuffer(36160, null);\n }\n }\n\n // Setup color buffer\n\n if (isCube) {\n state.bindTexture(34067, textureProperties.__webglTexture);\n setTextureParameters(34067, texture, supportsMips);\n for (var _i49 = 0; _i49 < 6; _i49++) {\n setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[_i49], renderTarget, texture, 36064, 34069 + _i49);\n }\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) {\n generateMipmap(34067);\n }\n state.unbindTexture();\n } else if (isMultipleRenderTargets) {\n var _textures2 = renderTarget.texture;\n for (var _i50 = 0, _il12 = _textures2.length; _i50 < _il12; _i50++) {\n var attachment = _textures2[_i50];\n var _attachmentProperties = properties.get(attachment);\n state.bindTexture(3553, _attachmentProperties.__webglTexture);\n setTextureParameters(3553, attachment, supportsMips);\n setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, attachment, 36064 + _i50, 3553);\n if (textureNeedsGenerateMipmaps(attachment, supportsMips)) {\n generateMipmap(3553);\n }\n }\n state.unbindTexture();\n } else {\n var glTextureType = 3553;\n if (renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget) {\n if (isWebGL2) {\n glTextureType = renderTarget.isWebGL3DRenderTarget ? 32879 : 35866;\n } else {\n console.error('THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.');\n }\n }\n state.bindTexture(glTextureType, textureProperties.__webglTexture);\n setTextureParameters(glTextureType, texture, supportsMips);\n setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, texture, 36064, glTextureType);\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) {\n generateMipmap(glTextureType);\n }\n state.unbindTexture();\n }\n\n // Setup depth and stencil buffers\n\n if (renderTarget.depthBuffer) {\n setupDepthRenderbuffer(renderTarget);\n }\n }\n function updateRenderTargetMipmap(renderTarget) {\n var supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2;\n var textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [renderTarget.texture];\n for (var i = 0, il = textures.length; i < il; i++) {\n var texture = textures[i];\n if (textureNeedsGenerateMipmaps(texture, supportsMips)) {\n var target = renderTarget.isWebGLCubeRenderTarget ? 34067 : 3553;\n var webglTexture = properties.get(texture).__webglTexture;\n state.bindTexture(target, webglTexture);\n generateMipmap(target);\n state.unbindTexture();\n }\n }\n }\n function updateMultisampleRenderTarget(renderTarget) {\n if (isWebGL2 && renderTarget.samples > 0 && useMultisampledRTT(renderTarget) === false) {\n var textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [renderTarget.texture];\n var width = renderTarget.width;\n var height = renderTarget.height;\n var mask = 16384;\n var invalidationArray = [];\n var depthStyle = renderTarget.stencilBuffer ? 33306 : 36096;\n var renderTargetProperties = properties.get(renderTarget);\n var isMultipleRenderTargets = renderTarget.isWebGLMultipleRenderTargets === true;\n\n // If MRT we need to remove FBO attachments\n if (isMultipleRenderTargets) {\n for (var i = 0; i < textures.length; i++) {\n state.bindFramebuffer(36160, renderTargetProperties.__webglMultisampledFramebuffer);\n _gl.framebufferRenderbuffer(36160, 36064 + i, 36161, null);\n state.bindFramebuffer(36160, renderTargetProperties.__webglFramebuffer);\n _gl.framebufferTexture2D(36009, 36064 + i, 3553, null, 0);\n }\n }\n state.bindFramebuffer(36008, renderTargetProperties.__webglMultisampledFramebuffer);\n state.bindFramebuffer(36009, renderTargetProperties.__webglFramebuffer);\n for (var _i51 = 0; _i51 < textures.length; _i51++) {\n invalidationArray.push(36064 + _i51);\n if (renderTarget.depthBuffer) {\n invalidationArray.push(depthStyle);\n }\n var ignoreDepthValues = renderTargetProperties.__ignoreDepthValues !== undefined ? renderTargetProperties.__ignoreDepthValues : false;\n if (ignoreDepthValues === false) {\n if (renderTarget.depthBuffer) mask |= 256;\n if (renderTarget.stencilBuffer) mask |= 1024;\n }\n if (isMultipleRenderTargets) {\n _gl.framebufferRenderbuffer(36008, 36064, 36161, renderTargetProperties.__webglColorRenderbuffer[_i51]);\n }\n if (ignoreDepthValues === true) {\n _gl.invalidateFramebuffer(36008, [depthStyle]);\n _gl.invalidateFramebuffer(36009, [depthStyle]);\n }\n if (isMultipleRenderTargets) {\n var webglTexture = properties.get(textures[_i51]).__webglTexture;\n _gl.framebufferTexture2D(36009, 36064, 3553, webglTexture, 0);\n }\n _gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, mask, 9728);\n if (supportsInvalidateFramebuffer) {\n _gl.invalidateFramebuffer(36008, invalidationArray);\n }\n }\n state.bindFramebuffer(36008, null);\n state.bindFramebuffer(36009, null);\n\n // If MRT since pre-blit we removed the FBO we need to reconstruct the attachments\n if (isMultipleRenderTargets) {\n for (var _i52 = 0; _i52 < textures.length; _i52++) {\n state.bindFramebuffer(36160, renderTargetProperties.__webglMultisampledFramebuffer);\n _gl.framebufferRenderbuffer(36160, 36064 + _i52, 36161, renderTargetProperties.__webglColorRenderbuffer[_i52]);\n var _webglTexture = properties.get(textures[_i52]).__webglTexture;\n state.bindFramebuffer(36160, renderTargetProperties.__webglFramebuffer);\n _gl.framebufferTexture2D(36009, 36064 + _i52, 3553, _webglTexture, 0);\n }\n }\n state.bindFramebuffer(36009, renderTargetProperties.__webglMultisampledFramebuffer);\n }\n }\n function getRenderTargetSamples(renderTarget) {\n return Math.min(maxSamples, renderTarget.samples);\n }\n function useMultisampledRTT(renderTarget) {\n var renderTargetProperties = properties.get(renderTarget);\n return isWebGL2 && renderTarget.samples > 0 && extensions.has('WEBGL_multisampled_render_to_texture') === true && renderTargetProperties.__useRenderToTexture !== false;\n }\n function updateVideoTexture(texture) {\n var frame = info.render.frame;\n\n // Check the last frame we updated the VideoTexture\n\n if (_videoTextures.get(texture) !== frame) {\n _videoTextures.set(texture, frame);\n texture.update();\n }\n }\n function verifyColorSpace(texture, image) {\n var encoding = texture.encoding;\n var format = texture.format;\n var type = texture.type;\n if (texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat) return image;\n if (encoding !== LinearEncoding) {\n // sRGB\n\n if (encoding === sRGBEncoding) {\n if (isWebGL2 === false) {\n // in WebGL 1, try to use EXT_sRGB extension and unsized formats\n\n if (extensions.has('EXT_sRGB') === true && format === RGBAFormat) {\n texture.format = _SRGBAFormat;\n\n // it's not possible to generate mips in WebGL 1 with this extension\n\n texture.minFilter = LinearFilter;\n texture.generateMipmaps = false;\n } else {\n // slow fallback (CPU decode)\n\n image = ImageUtils.sRGBToLinear(image);\n }\n } else {\n // in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format\n\n if (format !== RGBAFormat || type !== UnsignedByteType) {\n console.warn('THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.');\n }\n }\n } else {\n console.error('THREE.WebGLTextures: Unsupported texture encoding:', encoding);\n }\n }\n return image;\n }\n\n //\n\n this.allocateTextureUnit = allocateTextureUnit;\n this.resetTextureUnits = resetTextureUnits;\n this.setTexture2D = setTexture2D;\n this.setTexture2DArray = setTexture2DArray;\n this.setTexture3D = setTexture3D;\n this.setTextureCube = setTextureCube;\n this.rebindTextures = rebindTextures;\n this.setupRenderTarget = setupRenderTarget;\n this.updateRenderTargetMipmap = updateRenderTargetMipmap;\n this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;\n this.setupDepthRenderbuffer = setupDepthRenderbuffer;\n this.setupFrameBufferTexture = setupFrameBufferTexture;\n this.useMultisampledRTT = useMultisampledRTT;\n}\nfunction WebGLUtils(gl, extensions, capabilities) {\n var isWebGL2 = capabilities.isWebGL2;\n function convert(p) {\n var encoding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var extension;\n if (p === UnsignedByteType) return 5121;\n if (p === UnsignedShort4444Type) return 32819;\n if (p === UnsignedShort5551Type) return 32820;\n if (p === ByteType) return 5120;\n if (p === ShortType) return 5122;\n if (p === UnsignedShortType) return 5123;\n if (p === IntType) return 5124;\n if (p === UnsignedIntType) return 5125;\n if (p === FloatType) return 5126;\n if (p === HalfFloatType) {\n if (isWebGL2) return 5131;\n extension = extensions.get('OES_texture_half_float');\n if (extension !== null) {\n return extension.HALF_FLOAT_OES;\n } else {\n return null;\n }\n }\n if (p === AlphaFormat) return 6406;\n if (p === RGBAFormat) return 6408;\n if (p === LuminanceFormat) return 6409;\n if (p === LuminanceAlphaFormat) return 6410;\n if (p === DepthFormat) return 6402;\n if (p === DepthStencilFormat) return 34041;\n\n // WebGL 1 sRGB fallback\n\n if (p === _SRGBAFormat) {\n extension = extensions.get('EXT_sRGB');\n if (extension !== null) {\n return extension.SRGB_ALPHA_EXT;\n } else {\n return null;\n }\n }\n\n // WebGL2 formats.\n\n if (p === RedFormat) return 6403;\n if (p === RedIntegerFormat) return 36244;\n if (p === RGFormat) return 33319;\n if (p === RGIntegerFormat) return 33320;\n if (p === RGBAIntegerFormat) return 36249;\n\n // S3TC\n\n if (p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format) {\n if (encoding === sRGBEncoding) {\n extension = extensions.get('WEBGL_compressed_texture_s3tc_srgb');\n if (extension !== null) {\n if (p === RGB_S3TC_DXT1_Format) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT;\n if (p === RGBA_S3TC_DXT1_Format) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;\n if (p === RGBA_S3TC_DXT3_Format) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;\n if (p === RGBA_S3TC_DXT5_Format) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;\n } else {\n return null;\n }\n } else {\n extension = extensions.get('WEBGL_compressed_texture_s3tc');\n if (extension !== null) {\n if (p === RGB_S3TC_DXT1_Format) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT;\n if (p === RGBA_S3TC_DXT1_Format) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT;\n if (p === RGBA_S3TC_DXT3_Format) return extension.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n if (p === RGBA_S3TC_DXT5_Format) return extension.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n } else {\n return null;\n }\n }\n }\n\n // PVRTC\n\n if (p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format) {\n extension = extensions.get('WEBGL_compressed_texture_pvrtc');\n if (extension !== null) {\n if (p === RGB_PVRTC_4BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;\n if (p === RGB_PVRTC_2BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;\n if (p === RGBA_PVRTC_4BPPV1_Format) return extension.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;\n if (p === RGBA_PVRTC_2BPPV1_Format) return extension.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;\n } else {\n return null;\n }\n }\n\n // ETC1\n\n if (p === RGB_ETC1_Format) {\n extension = extensions.get('WEBGL_compressed_texture_etc1');\n if (extension !== null) {\n return extension.COMPRESSED_RGB_ETC1_WEBGL;\n } else {\n return null;\n }\n }\n\n // ETC2\n\n if (p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format) {\n extension = extensions.get('WEBGL_compressed_texture_etc');\n if (extension !== null) {\n if (p === RGB_ETC2_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;\n if (p === RGBA_ETC2_EAC_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;\n } else {\n return null;\n }\n }\n\n // ASTC\n\n if (p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format || p === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format || p === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format || p === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format || p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format) {\n extension = extensions.get('WEBGL_compressed_texture_astc');\n if (extension !== null) {\n if (p === RGBA_ASTC_4x4_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;\n if (p === RGBA_ASTC_5x4_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;\n if (p === RGBA_ASTC_5x5_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;\n if (p === RGBA_ASTC_6x5_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;\n if (p === RGBA_ASTC_6x6_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;\n if (p === RGBA_ASTC_8x5_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;\n if (p === RGBA_ASTC_8x6_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;\n if (p === RGBA_ASTC_8x8_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;\n if (p === RGBA_ASTC_10x5_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;\n if (p === RGBA_ASTC_10x6_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;\n if (p === RGBA_ASTC_10x8_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;\n if (p === RGBA_ASTC_10x10_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;\n if (p === RGBA_ASTC_12x10_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;\n if (p === RGBA_ASTC_12x12_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;\n } else {\n return null;\n }\n }\n\n // BPTC\n\n if (p === RGBA_BPTC_Format) {\n extension = extensions.get('EXT_texture_compression_bptc');\n if (extension !== null) {\n if (p === RGBA_BPTC_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;\n } else {\n return null;\n }\n }\n\n // RGTC\n\n if (p === RED_RGTC1_Format || p === SIGNED_RED_RGTC1_Format || p === RED_GREEN_RGTC2_Format || p === SIGNED_RED_GREEN_RGTC2_Format) {\n extension = extensions.get('EXT_texture_compression_rgtc');\n if (extension !== null) {\n if (p === RGBA_BPTC_Format) return extension.COMPRESSED_RED_RGTC1_EXT;\n if (p === SIGNED_RED_RGTC1_Format) return extension.COMPRESSED_SIGNED_RED_RGTC1_EXT;\n if (p === RED_GREEN_RGTC2_Format) return extension.COMPRESSED_RED_GREEN_RGTC2_EXT;\n if (p === SIGNED_RED_GREEN_RGTC2_Format) return extension.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;\n } else {\n return null;\n }\n }\n\n //\n\n if (p === UnsignedInt248Type) {\n if (isWebGL2) return 34042;\n extension = extensions.get('WEBGL_depth_texture');\n if (extension !== null) {\n return extension.UNSIGNED_INT_24_8_WEBGL;\n } else {\n return null;\n }\n }\n\n // if \"p\" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)\n\n return gl[p] !== undefined ? gl[p] : null;\n }\n return {\n convert: convert\n };\n}\nvar ArrayCamera = /*#__PURE__*/function (_PerspectiveCamera) {\n _inherits(ArrayCamera, _PerspectiveCamera);\n var _super34 = _createSuper(ArrayCamera);\n function ArrayCamera() {\n var _this26;\n var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n _classCallCheck(this, ArrayCamera);\n _this26 = _super34.call(this);\n _this26.isArrayCamera = true;\n _this26.cameras = array;\n return _this26;\n }\n return _createClass(ArrayCamera);\n}(PerspectiveCamera);\nvar Group = /*#__PURE__*/function (_Object3D4) {\n _inherits(Group, _Object3D4);\n var _super35 = _createSuper(Group);\n function Group() {\n var _this27;\n _classCallCheck(this, Group);\n _this27 = _super35.call(this);\n _this27.isGroup = true;\n _this27.type = 'Group';\n return _this27;\n }\n return _createClass(Group);\n}(Object3D);\nvar _moveEvent = {\n type: 'move'\n};\nvar WebXRController = /*#__PURE__*/function () {\n function WebXRController() {\n _classCallCheck(this, WebXRController);\n this._targetRay = null;\n this._grip = null;\n this._hand = null;\n }\n _createClass(WebXRController, [{\n key: \"getHandSpace\",\n value: function getHandSpace() {\n if (this._hand === null) {\n this._hand = new Group();\n this._hand.matrixAutoUpdate = false;\n this._hand.visible = false;\n this._hand.joints = {};\n this._hand.inputState = {\n pinching: false\n };\n }\n return this._hand;\n }\n }, {\n key: \"getTargetRaySpace\",\n value: function getTargetRaySpace() {\n if (this._targetRay === null) {\n this._targetRay = new Group();\n this._targetRay.matrixAutoUpdate = false;\n this._targetRay.visible = false;\n this._targetRay.hasLinearVelocity = false;\n this._targetRay.linearVelocity = new Vector3();\n this._targetRay.hasAngularVelocity = false;\n this._targetRay.angularVelocity = new Vector3();\n }\n return this._targetRay;\n }\n }, {\n key: \"getGripSpace\",\n value: function getGripSpace() {\n if (this._grip === null) {\n this._grip = new Group();\n this._grip.matrixAutoUpdate = false;\n this._grip.visible = false;\n this._grip.hasLinearVelocity = false;\n this._grip.linearVelocity = new Vector3();\n this._grip.hasAngularVelocity = false;\n this._grip.angularVelocity = new Vector3();\n }\n return this._grip;\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (this._targetRay !== null) {\n this._targetRay.dispatchEvent(event);\n }\n if (this._grip !== null) {\n this._grip.dispatchEvent(event);\n }\n if (this._hand !== null) {\n this._hand.dispatchEvent(event);\n }\n return this;\n }\n }, {\n key: \"connect\",\n value: function connect(inputSource) {\n if (inputSource && inputSource.hand) {\n var hand = this._hand;\n if (hand) {\n var _iterator2 = _createForOfIteratorHelper(inputSource.hand.values()),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var inputjoint = _step2.value;\n // Initialize hand with joints when connected\n this._getHandJoint(hand, inputjoint);\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n }\n this.dispatchEvent({\n type: 'connected',\n data: inputSource\n });\n return this;\n }\n }, {\n key: \"disconnect\",\n value: function disconnect(inputSource) {\n this.dispatchEvent({\n type: 'disconnected',\n data: inputSource\n });\n if (this._targetRay !== null) {\n this._targetRay.visible = false;\n }\n if (this._grip !== null) {\n this._grip.visible = false;\n }\n if (this._hand !== null) {\n this._hand.visible = false;\n }\n return this;\n }\n }, {\n key: \"update\",\n value: function update(inputSource, frame, referenceSpace) {\n var inputPose = null;\n var gripPose = null;\n var handPose = null;\n var targetRay = this._targetRay;\n var grip = this._grip;\n var hand = this._hand;\n if (inputSource && frame.session.visibilityState !== 'visible-blurred') {\n if (hand && inputSource.hand) {\n handPose = true;\n var _iterator3 = _createForOfIteratorHelper(inputSource.hand.values()),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var inputjoint = _step3.value;\n // Update the joints groups with the XRJoint poses\n var jointPose = frame.getJointPose(inputjoint, referenceSpace);\n\n // The transform of this joint will be updated with the joint pose on each frame\n var joint = this._getHandJoint(hand, inputjoint);\n if (jointPose !== null) {\n joint.matrix.fromArray(jointPose.transform.matrix);\n joint.matrix.decompose(joint.position, joint.rotation, joint.scale);\n joint.jointRadius = jointPose.radius;\n }\n joint.visible = jointPose !== null;\n }\n\n // Custom events\n\n // Check pinchz\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n var indexTip = hand.joints['index-finger-tip'];\n var thumbTip = hand.joints['thumb-tip'];\n var distance = indexTip.position.distanceTo(thumbTip.position);\n var distanceToPinch = 0.02;\n var threshold = 0.005;\n if (hand.inputState.pinching && distance > distanceToPinch + threshold) {\n hand.inputState.pinching = false;\n this.dispatchEvent({\n type: 'pinchend',\n handedness: inputSource.handedness,\n target: this\n });\n } else if (!hand.inputState.pinching && distance <= distanceToPinch - threshold) {\n hand.inputState.pinching = true;\n this.dispatchEvent({\n type: 'pinchstart',\n handedness: inputSource.handedness,\n target: this\n });\n }\n } else {\n if (grip !== null && inputSource.gripSpace) {\n gripPose = frame.getPose(inputSource.gripSpace, referenceSpace);\n if (gripPose !== null) {\n grip.matrix.fromArray(gripPose.transform.matrix);\n grip.matrix.decompose(grip.position, grip.rotation, grip.scale);\n if (gripPose.linearVelocity) {\n grip.hasLinearVelocity = true;\n grip.linearVelocity.copy(gripPose.linearVelocity);\n } else {\n grip.hasLinearVelocity = false;\n }\n if (gripPose.angularVelocity) {\n grip.hasAngularVelocity = true;\n grip.angularVelocity.copy(gripPose.angularVelocity);\n } else {\n grip.hasAngularVelocity = false;\n }\n }\n }\n }\n if (targetRay !== null) {\n inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace);\n\n // Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it\n if (inputPose === null && gripPose !== null) {\n inputPose = gripPose;\n }\n if (inputPose !== null) {\n targetRay.matrix.fromArray(inputPose.transform.matrix);\n targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale);\n if (inputPose.linearVelocity) {\n targetRay.hasLinearVelocity = true;\n targetRay.linearVelocity.copy(inputPose.linearVelocity);\n } else {\n targetRay.hasLinearVelocity = false;\n }\n if (inputPose.angularVelocity) {\n targetRay.hasAngularVelocity = true;\n targetRay.angularVelocity.copy(inputPose.angularVelocity);\n } else {\n targetRay.hasAngularVelocity = false;\n }\n this.dispatchEvent(_moveEvent);\n }\n }\n }\n if (targetRay !== null) {\n targetRay.visible = inputPose !== null;\n }\n if (grip !== null) {\n grip.visible = gripPose !== null;\n }\n if (hand !== null) {\n hand.visible = handPose !== null;\n }\n return this;\n }\n\n // private method\n }, {\n key: \"_getHandJoint\",\n value: function _getHandJoint(hand, inputjoint) {\n if (hand.joints[inputjoint.jointName] === undefined) {\n var joint = new Group();\n joint.matrixAutoUpdate = false;\n joint.visible = false;\n hand.joints[inputjoint.jointName] = joint;\n hand.add(joint);\n }\n return hand.joints[inputjoint.jointName];\n }\n }]);\n return WebXRController;\n}();\nvar DepthTexture = /*#__PURE__*/function (_Texture4) {\n _inherits(DepthTexture, _Texture4);\n var _super36 = _createSuper(DepthTexture);\n function DepthTexture(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format) {\n var _this28;\n _classCallCheck(this, DepthTexture);\n format = format !== undefined ? format : DepthFormat;\n if (format !== DepthFormat && format !== DepthStencilFormat) {\n throw new Error('DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat');\n }\n if (type === undefined && format === DepthFormat) type = UnsignedIntType;\n if (type === undefined && format === DepthStencilFormat) type = UnsignedInt248Type;\n _this28 = _super36.call(this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);\n _this28.isDepthTexture = true;\n _this28.image = {\n width: width,\n height: height\n };\n _this28.magFilter = magFilter !== undefined ? magFilter : NearestFilter;\n _this28.minFilter = minFilter !== undefined ? minFilter : NearestFilter;\n _this28.flipY = false;\n _this28.generateMipmaps = false;\n return _this28;\n }\n return _createClass(DepthTexture);\n}(Texture);\nvar WebXRManager = /*#__PURE__*/function (_EventDispatcher6) {\n _inherits(WebXRManager, _EventDispatcher6);\n var _super37 = _createSuper(WebXRManager);\n function WebXRManager(renderer, gl) {\n var _this29;\n _classCallCheck(this, WebXRManager);\n _this29 = _super37.call(this);\n var scope = _assertThisInitialized(_this29);\n var session = null;\n var framebufferScaleFactor = 1.0;\n var referenceSpace = null;\n var referenceSpaceType = 'local-floor';\n // Set default foveation to maximum.\n var foveation = 1.0;\n var customReferenceSpace = null;\n var pose = null;\n var glBinding = null;\n var glProjLayer = null;\n var glBaseLayer = null;\n var xrFrame = null;\n var attributes = gl.getContextAttributes();\n var initialRenderTarget = null;\n var newRenderTarget = null;\n var controllers = [];\n var controllerInputSources = [];\n var planes = new Set();\n var planesLastChangedTimes = new Map();\n\n //\n\n var cameraL = new PerspectiveCamera();\n cameraL.layers.enable(1);\n cameraL.viewport = new Vector4();\n var cameraR = new PerspectiveCamera();\n cameraR.layers.enable(2);\n cameraR.viewport = new Vector4();\n var cameras = [cameraL, cameraR];\n var cameraVR = new ArrayCamera();\n cameraVR.layers.enable(1);\n cameraVR.layers.enable(2);\n var _currentDepthNear = null;\n var _currentDepthFar = null;\n\n //\n\n _this29.cameraAutoUpdate = true;\n _this29.enabled = false;\n _this29.isPresenting = false;\n _this29.getController = function (index) {\n var controller = controllers[index];\n if (controller === undefined) {\n controller = new WebXRController();\n controllers[index] = controller;\n }\n return controller.getTargetRaySpace();\n };\n _this29.getControllerGrip = function (index) {\n var controller = controllers[index];\n if (controller === undefined) {\n controller = new WebXRController();\n controllers[index] = controller;\n }\n return controller.getGripSpace();\n };\n _this29.getHand = function (index) {\n var controller = controllers[index];\n if (controller === undefined) {\n controller = new WebXRController();\n controllers[index] = controller;\n }\n return controller.getHandSpace();\n };\n\n //\n\n function onSessionEvent(event) {\n var controllerIndex = controllerInputSources.indexOf(event.inputSource);\n if (controllerIndex === -1) {\n return;\n }\n var controller = controllers[controllerIndex];\n if (controller !== undefined) {\n controller.dispatchEvent({\n type: event.type,\n data: event.inputSource\n });\n }\n }\n function onSessionEnd() {\n session.removeEventListener('select', onSessionEvent);\n session.removeEventListener('selectstart', onSessionEvent);\n session.removeEventListener('selectend', onSessionEvent);\n session.removeEventListener('squeeze', onSessionEvent);\n session.removeEventListener('squeezestart', onSessionEvent);\n session.removeEventListener('squeezeend', onSessionEvent);\n session.removeEventListener('end', onSessionEnd);\n session.removeEventListener('inputsourceschange', onInputSourcesChange);\n for (var i = 0; i < controllers.length; i++) {\n var inputSource = controllerInputSources[i];\n if (inputSource === null) continue;\n controllerInputSources[i] = null;\n controllers[i].disconnect(inputSource);\n }\n _currentDepthNear = null;\n _currentDepthFar = null;\n\n // restore framebuffer/rendering state\n\n renderer.setRenderTarget(initialRenderTarget);\n glBaseLayer = null;\n glProjLayer = null;\n glBinding = null;\n session = null;\n newRenderTarget = null;\n\n //\n\n animation.stop();\n scope.isPresenting = false;\n scope.dispatchEvent({\n type: 'sessionend'\n });\n }\n _this29.setFramebufferScaleFactor = function (value) {\n framebufferScaleFactor = value;\n if (scope.isPresenting === true) {\n console.warn('THREE.WebXRManager: Cannot change framebuffer scale while presenting.');\n }\n };\n _this29.setReferenceSpaceType = function (value) {\n referenceSpaceType = value;\n if (scope.isPresenting === true) {\n console.warn('THREE.WebXRManager: Cannot change reference space type while presenting.');\n }\n };\n _this29.getReferenceSpace = function () {\n return customReferenceSpace || referenceSpace;\n };\n _this29.setReferenceSpace = function (space) {\n customReferenceSpace = space;\n };\n _this29.getBaseLayer = function () {\n return glProjLayer !== null ? glProjLayer : glBaseLayer;\n };\n _this29.getBinding = function () {\n return glBinding;\n };\n _this29.getFrame = function () {\n return xrFrame;\n };\n _this29.getSession = function () {\n return session;\n };\n _this29.setSession = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {\n var layerInit, depthFormat, depthType, glDepthFormat, projectionlayerInit, renderTargetProperties;\n return _regeneratorRuntime().wrap(function _callee$(_context8) {\n while (1) switch (_context8.prev = _context8.next) {\n case 0:\n session = value;\n if (!(session !== null)) {\n _context8.next = 25;\n break;\n }\n initialRenderTarget = renderer.getRenderTarget();\n session.addEventListener('select', onSessionEvent);\n session.addEventListener('selectstart', onSessionEvent);\n session.addEventListener('selectend', onSessionEvent);\n session.addEventListener('squeeze', onSessionEvent);\n session.addEventListener('squeezestart', onSessionEvent);\n session.addEventListener('squeezeend', onSessionEvent);\n session.addEventListener('end', onSessionEnd);\n session.addEventListener('inputsourceschange', onInputSourcesChange);\n if (!(attributes.xrCompatible !== true)) {\n _context8.next = 14;\n break;\n }\n _context8.next = 14;\n return gl.makeXRCompatible();\n case 14:\n if (session.renderState.layers === undefined || renderer.capabilities.isWebGL2 === false) {\n layerInit = {\n antialias: session.renderState.layers === undefined ? attributes.antialias : true,\n alpha: attributes.alpha,\n depth: attributes.depth,\n stencil: attributes.stencil,\n framebufferScaleFactor: framebufferScaleFactor\n };\n glBaseLayer = new XRWebGLLayer(session, gl, layerInit);\n session.updateRenderState({\n baseLayer: glBaseLayer\n });\n newRenderTarget = new WebGLRenderTarget(glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, {\n format: RGBAFormat,\n type: UnsignedByteType,\n encoding: renderer.outputEncoding,\n stencilBuffer: attributes.stencil\n });\n } else {\n depthFormat = null;\n depthType = null;\n glDepthFormat = null;\n if (attributes.depth) {\n glDepthFormat = attributes.stencil ? 35056 : 33190;\n depthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;\n depthType = attributes.stencil ? UnsignedInt248Type : UnsignedIntType;\n }\n projectionlayerInit = {\n colorFormat: 32856,\n depthFormat: glDepthFormat,\n scaleFactor: framebufferScaleFactor\n };\n glBinding = new XRWebGLBinding(session, gl);\n glProjLayer = glBinding.createProjectionLayer(projectionlayerInit);\n session.updateRenderState({\n layers: [glProjLayer]\n });\n newRenderTarget = new WebGLRenderTarget(glProjLayer.textureWidth, glProjLayer.textureHeight, {\n format: RGBAFormat,\n type: UnsignedByteType,\n depthTexture: new DepthTexture(glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat),\n stencilBuffer: attributes.stencil,\n encoding: renderer.outputEncoding,\n samples: attributes.antialias ? 4 : 0\n });\n renderTargetProperties = renderer.properties.get(newRenderTarget);\n renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues;\n }\n newRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278\n\n this.setFoveation(foveation);\n customReferenceSpace = null;\n _context8.next = 20;\n return session.requestReferenceSpace(referenceSpaceType);\n case 20:\n referenceSpace = _context8.sent;\n animation.setContext(session);\n animation.start();\n scope.isPresenting = true;\n scope.dispatchEvent({\n type: 'sessionstart'\n });\n case 25:\n case \"end\":\n return _context8.stop();\n }\n }, _callee, this);\n }));\n return function (_x3) {\n return _ref.apply(this, arguments);\n };\n }();\n function onInputSourcesChange(event) {\n // Notify disconnected\n\n for (var i = 0; i < event.removed.length; i++) {\n var inputSource = event.removed[i];\n var index = controllerInputSources.indexOf(inputSource);\n if (index >= 0) {\n controllerInputSources[index] = null;\n controllers[index].disconnect(inputSource);\n }\n }\n\n // Notify connected\n\n for (var _i53 = 0; _i53 < event.added.length; _i53++) {\n var _inputSource = event.added[_i53];\n var controllerIndex = controllerInputSources.indexOf(_inputSource);\n if (controllerIndex === -1) {\n // Assign input source a controller that currently has no input source\n\n for (var _i54 = 0; _i54 < controllers.length; _i54++) {\n if (_i54 >= controllerInputSources.length) {\n controllerInputSources.push(_inputSource);\n controllerIndex = _i54;\n break;\n } else if (controllerInputSources[_i54] === null) {\n controllerInputSources[_i54] = _inputSource;\n controllerIndex = _i54;\n break;\n }\n }\n\n // If all controllers do currently receive input we ignore new ones\n\n if (controllerIndex === -1) break;\n }\n var controller = controllers[controllerIndex];\n if (controller) {\n controller.connect(_inputSource);\n }\n }\n }\n\n //\n\n var cameraLPos = new Vector3();\n var cameraRPos = new Vector3();\n\n /**\n * Assumes 2 cameras that are parallel and share an X-axis, and that\n * the cameras' projection and world matrices have already been set.\n * And that near and far planes are identical for both cameras.\n * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765\n */\n function setProjectionFromUnion(camera, cameraL, cameraR) {\n cameraLPos.setFromMatrixPosition(cameraL.matrixWorld);\n cameraRPos.setFromMatrixPosition(cameraR.matrixWorld);\n var ipd = cameraLPos.distanceTo(cameraRPos);\n var projL = cameraL.projectionMatrix.elements;\n var projR = cameraR.projectionMatrix.elements;\n\n // VR systems will have identical far and near planes, and\n // most likely identical top and bottom frustum extents.\n // Use the left camera for these values.\n var near = projL[14] / (projL[10] - 1);\n var far = projL[14] / (projL[10] + 1);\n var topFov = (projL[9] + 1) / projL[5];\n var bottomFov = (projL[9] - 1) / projL[5];\n var leftFov = (projL[8] - 1) / projL[0];\n var rightFov = (projR[8] + 1) / projR[0];\n var left = near * leftFov;\n var right = near * rightFov;\n\n // Calculate the new camera's position offset from the\n // left camera. xOffset should be roughly half `ipd`.\n var zOffset = ipd / (-leftFov + rightFov);\n var xOffset = zOffset * -leftFov;\n\n // TODO: Better way to apply this offset?\n cameraL.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale);\n camera.translateX(xOffset);\n camera.translateZ(zOffset);\n camera.matrixWorld.compose(camera.position, camera.quaternion, camera.scale);\n camera.matrixWorldInverse.copy(camera.matrixWorld).invert();\n\n // Find the union of the frustum values of the cameras and scale\n // the values so that the near plane's position does not change in world space,\n // although must now be relative to the new union camera.\n var near2 = near + zOffset;\n var far2 = far + zOffset;\n var left2 = left - xOffset;\n var right2 = right + (ipd - xOffset);\n var top2 = topFov * far / far2 * near2;\n var bottom2 = bottomFov * far / far2 * near2;\n camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2);\n camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();\n }\n function updateCamera(camera, parent) {\n if (parent === null) {\n camera.matrixWorld.copy(camera.matrix);\n } else {\n camera.matrixWorld.multiplyMatrices(parent.matrixWorld, camera.matrix);\n }\n camera.matrixWorldInverse.copy(camera.matrixWorld).invert();\n }\n _this29.updateCamera = function (camera) {\n if (session === null) return;\n cameraVR.near = cameraR.near = cameraL.near = camera.near;\n cameraVR.far = cameraR.far = cameraL.far = camera.far;\n if (_currentDepthNear !== cameraVR.near || _currentDepthFar !== cameraVR.far) {\n // Note that the new renderState won't apply until the next frame. See #18320\n\n session.updateRenderState({\n depthNear: cameraVR.near,\n depthFar: cameraVR.far\n });\n _currentDepthNear = cameraVR.near;\n _currentDepthFar = cameraVR.far;\n }\n var parent = camera.parent;\n var cameras = cameraVR.cameras;\n updateCamera(cameraVR, parent);\n for (var i = 0; i < cameras.length; i++) {\n updateCamera(cameras[i], parent);\n }\n\n // update projection matrix for proper view frustum culling\n\n if (cameras.length === 2) {\n setProjectionFromUnion(cameraVR, cameraL, cameraR);\n } else {\n // assume single camera setup (AR)\n\n cameraVR.projectionMatrix.copy(cameraL.projectionMatrix);\n }\n\n // update user camera and its children\n\n updateUserCamera(camera, cameraVR, parent);\n };\n function updateUserCamera(camera, cameraVR, parent) {\n if (parent === null) {\n camera.matrix.copy(cameraVR.matrixWorld);\n } else {\n camera.matrix.copy(parent.matrixWorld);\n camera.matrix.invert();\n camera.matrix.multiply(cameraVR.matrixWorld);\n }\n camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);\n camera.updateMatrixWorld(true);\n var children = camera.children;\n for (var i = 0, l = children.length; i < l; i++) {\n children[i].updateMatrixWorld(true);\n }\n camera.projectionMatrix.copy(cameraVR.projectionMatrix);\n camera.projectionMatrixInverse.copy(cameraVR.projectionMatrixInverse);\n if (camera.isPerspectiveCamera) {\n camera.fov = RAD2DEG * 2 * Math.atan(1 / camera.projectionMatrix.elements[5]);\n camera.zoom = 1;\n }\n }\n _this29.getCamera = function () {\n return cameraVR;\n };\n _this29.getFoveation = function () {\n if (glProjLayer === null && glBaseLayer === null) {\n return undefined;\n }\n return foveation;\n };\n _this29.setFoveation = function (value) {\n // 0 = no foveation = full resolution\n // 1 = maximum foveation = the edges render at lower resolution\n\n foveation = value;\n if (glProjLayer !== null) {\n glProjLayer.fixedFoveation = value;\n }\n if (glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined) {\n glBaseLayer.fixedFoveation = value;\n }\n };\n _this29.getPlanes = function () {\n return planes;\n };\n\n // Animation Loop\n\n var onAnimationFrameCallback = null;\n function onAnimationFrame(time, frame) {\n pose = frame.getViewerPose(customReferenceSpace || referenceSpace);\n xrFrame = frame;\n if (pose !== null) {\n var views = pose.views;\n if (glBaseLayer !== null) {\n renderer.setRenderTargetFramebuffer(newRenderTarget, glBaseLayer.framebuffer);\n renderer.setRenderTarget(newRenderTarget);\n }\n var cameraVRNeedsUpdate = false;\n\n // check if it's necessary to rebuild cameraVR's camera list\n\n if (views.length !== cameraVR.cameras.length) {\n cameraVR.cameras.length = 0;\n cameraVRNeedsUpdate = true;\n }\n for (var i = 0; i < views.length; i++) {\n var view = views[i];\n var viewport = null;\n if (glBaseLayer !== null) {\n viewport = glBaseLayer.getViewport(view);\n } else {\n var glSubImage = glBinding.getViewSubImage(glProjLayer, view);\n viewport = glSubImage.viewport;\n\n // For side-by-side projection, we only produce a single texture for both eyes.\n if (i === 0) {\n renderer.setRenderTargetTextures(newRenderTarget, glSubImage.colorTexture, glProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture);\n renderer.setRenderTarget(newRenderTarget);\n }\n }\n var camera = cameras[i];\n if (camera === undefined) {\n camera = new PerspectiveCamera();\n camera.layers.enable(i);\n camera.viewport = new Vector4();\n cameras[i] = camera;\n }\n camera.matrix.fromArray(view.transform.matrix);\n camera.matrix.decompose(camera.position, camera.quaternion, camera.scale);\n camera.projectionMatrix.fromArray(view.projectionMatrix);\n camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();\n camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height);\n if (i === 0) {\n cameraVR.matrix.copy(camera.matrix);\n cameraVR.matrix.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale);\n }\n if (cameraVRNeedsUpdate === true) {\n cameraVR.cameras.push(camera);\n }\n }\n }\n\n //\n\n for (var _i55 = 0; _i55 < controllers.length; _i55++) {\n var inputSource = controllerInputSources[_i55];\n var controller = controllers[_i55];\n if (inputSource !== null && controller !== undefined) {\n controller.update(inputSource, frame, customReferenceSpace || referenceSpace);\n }\n }\n if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame);\n if (frame.detectedPlanes) {\n scope.dispatchEvent({\n type: 'planesdetected',\n data: frame.detectedPlanes\n });\n var planesToRemove = null;\n var _iterator4 = _createForOfIteratorHelper(planes),\n _step4;\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var _plane = _step4.value;\n if (!frame.detectedPlanes.has(_plane)) {\n if (planesToRemove === null) {\n planesToRemove = [];\n }\n planesToRemove.push(_plane);\n }\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n if (planesToRemove !== null) {\n var _iterator5 = _createForOfIteratorHelper(planesToRemove),\n _step5;\n try {\n for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {\n var plane = _step5.value;\n planes[\"delete\"](plane);\n planesLastChangedTimes[\"delete\"](plane);\n scope.dispatchEvent({\n type: 'planeremoved',\n data: plane\n });\n }\n } catch (err) {\n _iterator5.e(err);\n } finally {\n _iterator5.f();\n }\n }\n var _iterator6 = _createForOfIteratorHelper(frame.detectedPlanes),\n _step6;\n try {\n for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {\n var _plane2 = _step6.value;\n if (!planes.has(_plane2)) {\n planes.add(_plane2);\n planesLastChangedTimes.set(_plane2, frame.lastChangedTime);\n scope.dispatchEvent({\n type: 'planeadded',\n data: _plane2\n });\n } else {\n var lastKnownTime = planesLastChangedTimes.get(_plane2);\n if (_plane2.lastChangedTime > lastKnownTime) {\n planesLastChangedTimes.set(_plane2, _plane2.lastChangedTime);\n scope.dispatchEvent({\n type: 'planechanged',\n data: _plane2\n });\n }\n }\n }\n } catch (err) {\n _iterator6.e(err);\n } finally {\n _iterator6.f();\n }\n }\n xrFrame = null;\n }\n var animation = new WebGLAnimation();\n animation.setAnimationLoop(onAnimationFrame);\n _this29.setAnimationLoop = function (callback) {\n onAnimationFrameCallback = callback;\n };\n _this29.dispose = function () {};\n return _this29;\n }\n return _createClass(WebXRManager);\n}(EventDispatcher);\nfunction WebGLMaterials(renderer, properties) {\n function refreshTransformUniform(map, uniform) {\n if (map.matrixAutoUpdate === true) {\n map.updateMatrix();\n }\n uniform.value.copy(map.matrix);\n }\n function refreshFogUniforms(uniforms, fog) {\n fog.color.getRGB(uniforms.fogColor.value, getUnlitUniformColorSpace(renderer));\n if (fog.isFog) {\n uniforms.fogNear.value = fog.near;\n uniforms.fogFar.value = fog.far;\n } else if (fog.isFogExp2) {\n uniforms.fogDensity.value = fog.density;\n }\n }\n function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) {\n if (material.isMeshBasicMaterial) {\n refreshUniformsCommon(uniforms, material);\n } else if (material.isMeshLambertMaterial) {\n refreshUniformsCommon(uniforms, material);\n } else if (material.isMeshToonMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsToon(uniforms, material);\n } else if (material.isMeshPhongMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsPhong(uniforms, material);\n } else if (material.isMeshStandardMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsStandard(uniforms, material);\n if (material.isMeshPhysicalMaterial) {\n refreshUniformsPhysical(uniforms, material, transmissionRenderTarget);\n }\n } else if (material.isMeshMatcapMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsMatcap(uniforms, material);\n } else if (material.isMeshDepthMaterial) {\n refreshUniformsCommon(uniforms, material);\n } else if (material.isMeshDistanceMaterial) {\n refreshUniformsCommon(uniforms, material);\n refreshUniformsDistance(uniforms, material);\n } else if (material.isMeshNormalMaterial) {\n refreshUniformsCommon(uniforms, material);\n } else if (material.isLineBasicMaterial) {\n refreshUniformsLine(uniforms, material);\n if (material.isLineDashedMaterial) {\n refreshUniformsDash(uniforms, material);\n }\n } else if (material.isPointsMaterial) {\n refreshUniformsPoints(uniforms, material, pixelRatio, height);\n } else if (material.isSpriteMaterial) {\n refreshUniformsSprites(uniforms, material);\n } else if (material.isShadowMaterial) {\n uniforms.color.value.copy(material.color);\n uniforms.opacity.value = material.opacity;\n } else if (material.isShaderMaterial) {\n material.uniformsNeedUpdate = false; // #15581\n }\n }\n\n function refreshUniformsCommon(uniforms, material) {\n uniforms.opacity.value = material.opacity;\n if (material.color) {\n uniforms.diffuse.value.copy(material.color);\n }\n if (material.emissive) {\n uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity);\n }\n if (material.map) {\n uniforms.map.value = material.map;\n refreshTransformUniform(material.map, uniforms.mapTransform);\n }\n if (material.alphaMap) {\n uniforms.alphaMap.value = material.alphaMap;\n refreshTransformUniform(material.alphaMap, uniforms.alphaMapTransform);\n }\n if (material.bumpMap) {\n uniforms.bumpMap.value = material.bumpMap;\n refreshTransformUniform(material.bumpMap, uniforms.bumpMapTransform);\n uniforms.bumpScale.value = material.bumpScale;\n if (material.side === BackSide) {\n uniforms.bumpScale.value *= -1;\n }\n }\n if (material.normalMap) {\n uniforms.normalMap.value = material.normalMap;\n refreshTransformUniform(material.normalMap, uniforms.normalMapTransform);\n uniforms.normalScale.value.copy(material.normalScale);\n if (material.side === BackSide) {\n uniforms.normalScale.value.negate();\n }\n }\n if (material.displacementMap) {\n uniforms.displacementMap.value = material.displacementMap;\n refreshTransformUniform(material.displacementMap, uniforms.displacementMapTransform);\n uniforms.displacementScale.value = material.displacementScale;\n uniforms.displacementBias.value = material.displacementBias;\n }\n if (material.emissiveMap) {\n uniforms.emissiveMap.value = material.emissiveMap;\n refreshTransformUniform(material.emissiveMap, uniforms.emissiveMapTransform);\n }\n if (material.specularMap) {\n uniforms.specularMap.value = material.specularMap;\n refreshTransformUniform(material.specularMap, uniforms.specularMapTransform);\n }\n if (material.alphaTest > 0) {\n uniforms.alphaTest.value = material.alphaTest;\n }\n var envMap = properties.get(material).envMap;\n if (envMap) {\n uniforms.envMap.value = envMap;\n uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;\n uniforms.reflectivity.value = material.reflectivity;\n uniforms.ior.value = material.ior;\n uniforms.refractionRatio.value = material.refractionRatio;\n }\n if (material.lightMap) {\n uniforms.lightMap.value = material.lightMap;\n\n // artist-friendly light intensity scaling factor\n var scaleFactor = renderer.useLegacyLights === true ? Math.PI : 1;\n uniforms.lightMapIntensity.value = material.lightMapIntensity * scaleFactor;\n refreshTransformUniform(material.lightMap, uniforms.lightMapTransform);\n }\n if (material.aoMap) {\n uniforms.aoMap.value = material.aoMap;\n uniforms.aoMapIntensity.value = material.aoMapIntensity;\n refreshTransformUniform(material.aoMap, uniforms.aoMapTransform);\n }\n }\n function refreshUniformsLine(uniforms, material) {\n uniforms.diffuse.value.copy(material.color);\n uniforms.opacity.value = material.opacity;\n if (material.map) {\n uniforms.map.value = material.map;\n refreshTransformUniform(material.map, uniforms.mapTransform);\n }\n }\n function refreshUniformsDash(uniforms, material) {\n uniforms.dashSize.value = material.dashSize;\n uniforms.totalSize.value = material.dashSize + material.gapSize;\n uniforms.scale.value = material.scale;\n }\n function refreshUniformsPoints(uniforms, material, pixelRatio, height) {\n uniforms.diffuse.value.copy(material.color);\n uniforms.opacity.value = material.opacity;\n uniforms.size.value = material.size * pixelRatio;\n uniforms.scale.value = height * 0.5;\n if (material.map) {\n uniforms.map.value = material.map;\n refreshTransformUniform(material.map, uniforms.uvTransform);\n }\n if (material.alphaMap) {\n uniforms.alphaMap.value = material.alphaMap;\n }\n if (material.alphaTest > 0) {\n uniforms.alphaTest.value = material.alphaTest;\n }\n }\n function refreshUniformsSprites(uniforms, material) {\n uniforms.diffuse.value.copy(material.color);\n uniforms.opacity.value = material.opacity;\n uniforms.rotation.value = material.rotation;\n if (material.map) {\n uniforms.map.value = material.map;\n refreshTransformUniform(material.map, uniforms.mapTransform);\n }\n if (material.alphaMap) {\n uniforms.alphaMap.value = material.alphaMap;\n }\n if (material.alphaTest > 0) {\n uniforms.alphaTest.value = material.alphaTest;\n }\n }\n function refreshUniformsPhong(uniforms, material) {\n uniforms.specular.value.copy(material.specular);\n uniforms.shininess.value = Math.max(material.shininess, 1e-4); // to prevent pow( 0.0, 0.0 )\n }\n\n function refreshUniformsToon(uniforms, material) {\n if (material.gradientMap) {\n uniforms.gradientMap.value = material.gradientMap;\n }\n }\n function refreshUniformsStandard(uniforms, material) {\n uniforms.metalness.value = material.metalness;\n if (material.metalnessMap) {\n uniforms.metalnessMap.value = material.metalnessMap;\n refreshTransformUniform(material.metalnessMap, uniforms.metalnessMapTransform);\n }\n uniforms.roughness.value = material.roughness;\n if (material.roughnessMap) {\n uniforms.roughnessMap.value = material.roughnessMap;\n refreshTransformUniform(material.roughnessMap, uniforms.roughnessMapTransform);\n }\n var envMap = properties.get(material).envMap;\n if (envMap) {\n //uniforms.envMap.value = material.envMap; // part of uniforms common\n uniforms.envMapIntensity.value = material.envMapIntensity;\n }\n }\n function refreshUniformsPhysical(uniforms, material, transmissionRenderTarget) {\n uniforms.ior.value = material.ior; // also part of uniforms common\n\n if (material.sheen > 0) {\n uniforms.sheenColor.value.copy(material.sheenColor).multiplyScalar(material.sheen);\n uniforms.sheenRoughness.value = material.sheenRoughness;\n if (material.sheenColorMap) {\n uniforms.sheenColorMap.value = material.sheenColorMap;\n refreshTransformUniform(material.sheenColorMap, uniforms.sheenColorMapTransform);\n }\n if (material.sheenRoughnessMap) {\n uniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;\n refreshTransformUniform(material.sheenRoughnessMap, uniforms.sheenRoughnessMapTransform);\n }\n }\n if (material.clearcoat > 0) {\n uniforms.clearcoat.value = material.clearcoat;\n uniforms.clearcoatRoughness.value = material.clearcoatRoughness;\n if (material.clearcoatMap) {\n uniforms.clearcoatMap.value = material.clearcoatMap;\n refreshTransformUniform(material.clearcoatMap, uniforms.clearcoatMapTransform);\n }\n if (material.clearcoatRoughnessMap) {\n uniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap;\n refreshTransformUniform(material.clearcoatRoughnessMap, uniforms.clearcoatRoughnessMapTransform);\n }\n if (material.clearcoatNormalMap) {\n uniforms.clearcoatNormalMap.value = material.clearcoatNormalMap;\n refreshTransformUniform(material.clearcoatNormalMap, uniforms.clearcoatNormalMapTransform);\n uniforms.clearcoatNormalScale.value.copy(material.clearcoatNormalScale);\n if (material.side === BackSide) {\n uniforms.clearcoatNormalScale.value.negate();\n }\n }\n }\n if (material.iridescence > 0) {\n uniforms.iridescence.value = material.iridescence;\n uniforms.iridescenceIOR.value = material.iridescenceIOR;\n uniforms.iridescenceThicknessMinimum.value = material.iridescenceThicknessRange[0];\n uniforms.iridescenceThicknessMaximum.value = material.iridescenceThicknessRange[1];\n if (material.iridescenceMap) {\n uniforms.iridescenceMap.value = material.iridescenceMap;\n refreshTransformUniform(material.iridescenceMap, uniforms.iridescenceMapTransform);\n }\n if (material.iridescenceThicknessMap) {\n uniforms.iridescenceThicknessMap.value = material.iridescenceThicknessMap;\n refreshTransformUniform(material.iridescenceThicknessMap, uniforms.iridescenceThicknessMapTransform);\n }\n }\n if (material.transmission > 0) {\n uniforms.transmission.value = material.transmission;\n uniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture;\n uniforms.transmissionSamplerSize.value.set(transmissionRenderTarget.width, transmissionRenderTarget.height);\n if (material.transmissionMap) {\n uniforms.transmissionMap.value = material.transmissionMap;\n refreshTransformUniform(material.transmissionMap, uniforms.transmissionMapTransform);\n }\n uniforms.thickness.value = material.thickness;\n if (material.thicknessMap) {\n uniforms.thicknessMap.value = material.thicknessMap;\n refreshTransformUniform(material.thicknessMap, uniforms.thicknessMapTransform);\n }\n uniforms.attenuationDistance.value = material.attenuationDistance;\n uniforms.attenuationColor.value.copy(material.attenuationColor);\n }\n uniforms.specularIntensity.value = material.specularIntensity;\n uniforms.specularColor.value.copy(material.specularColor);\n if (material.specularColorMap) {\n uniforms.specularColorMap.value = material.specularColorMap;\n refreshTransformUniform(material.specularColorMap, uniforms.specularColorMapTransform);\n }\n if (material.specularIntensityMap) {\n uniforms.specularIntensityMap.value = material.specularIntensityMap;\n refreshTransformUniform(material.specularIntensityMap, uniforms.specularIntensityMapTransform);\n }\n }\n function refreshUniformsMatcap(uniforms, material) {\n if (material.matcap) {\n uniforms.matcap.value = material.matcap;\n }\n }\n function refreshUniformsDistance(uniforms, material) {\n var light = properties.get(material).light;\n uniforms.referencePosition.value.setFromMatrixPosition(light.matrixWorld);\n uniforms.nearDistance.value = light.shadow.camera.near;\n uniforms.farDistance.value = light.shadow.camera.far;\n }\n return {\n refreshFogUniforms: refreshFogUniforms,\n refreshMaterialUniforms: refreshMaterialUniforms\n };\n}\nfunction WebGLUniformsGroups(gl, info, capabilities, state) {\n var buffers = {};\n var updateList = {};\n var allocatedBindingPoints = [];\n var maxBindingPoints = capabilities.isWebGL2 ? gl.getParameter(35375) : 0; // binding points are global whereas block indices are per shader program\n\n function bind(uniformsGroup, program) {\n var webglProgram = program.program;\n state.uniformBlockBinding(uniformsGroup, webglProgram);\n }\n function update(uniformsGroup, program) {\n var buffer = buffers[uniformsGroup.id];\n if (buffer === undefined) {\n prepareUniformsGroup(uniformsGroup);\n buffer = createBuffer(uniformsGroup);\n buffers[uniformsGroup.id] = buffer;\n uniformsGroup.addEventListener('dispose', onUniformsGroupsDispose);\n }\n\n // ensure to update the binding points/block indices mapping for this program\n\n var webglProgram = program.program;\n state.updateUBOMapping(uniformsGroup, webglProgram);\n\n // update UBO once per frame\n\n var frame = info.render.frame;\n if (updateList[uniformsGroup.id] !== frame) {\n updateBufferData(uniformsGroup);\n updateList[uniformsGroup.id] = frame;\n }\n }\n function createBuffer(uniformsGroup) {\n // the setup of an UBO is independent of a particular shader program but global\n\n var bindingPointIndex = allocateBindingPointIndex();\n uniformsGroup.__bindingPointIndex = bindingPointIndex;\n var buffer = gl.createBuffer();\n var size = uniformsGroup.__size;\n var usage = uniformsGroup.usage;\n gl.bindBuffer(35345, buffer);\n gl.bufferData(35345, size, usage);\n gl.bindBuffer(35345, null);\n gl.bindBufferBase(35345, bindingPointIndex, buffer);\n return buffer;\n }\n function allocateBindingPointIndex() {\n for (var i = 0; i < maxBindingPoints; i++) {\n if (allocatedBindingPoints.indexOf(i) === -1) {\n allocatedBindingPoints.push(i);\n return i;\n }\n }\n console.error('THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.');\n return 0;\n }\n function updateBufferData(uniformsGroup) {\n var buffer = buffers[uniformsGroup.id];\n var uniforms = uniformsGroup.uniforms;\n var cache = uniformsGroup.__cache;\n gl.bindBuffer(35345, buffer);\n for (var i = 0, il = uniforms.length; i < il; i++) {\n var uniform = uniforms[i];\n\n // partly update the buffer if necessary\n\n if (hasUniformChanged(uniform, i, cache) === true) {\n var offset = uniform.__offset;\n var values = Array.isArray(uniform.value) ? uniform.value : [uniform.value];\n var arrayOffset = 0;\n for (var _i56 = 0; _i56 < values.length; _i56++) {\n var _value5 = values[_i56];\n var _info = getUniformSize(_value5);\n if (typeof _value5 === 'number') {\n uniform.__data[0] = _value5;\n gl.bufferSubData(35345, offset + arrayOffset, uniform.__data);\n } else if (_value5.isMatrix3) {\n // manually converting 3x3 to 3x4\n\n uniform.__data[0] = _value5.elements[0];\n uniform.__data[1] = _value5.elements[1];\n uniform.__data[2] = _value5.elements[2];\n uniform.__data[3] = _value5.elements[0];\n uniform.__data[4] = _value5.elements[3];\n uniform.__data[5] = _value5.elements[4];\n uniform.__data[6] = _value5.elements[5];\n uniform.__data[7] = _value5.elements[0];\n uniform.__data[8] = _value5.elements[6];\n uniform.__data[9] = _value5.elements[7];\n uniform.__data[10] = _value5.elements[8];\n uniform.__data[11] = _value5.elements[0];\n } else {\n _value5.toArray(uniform.__data, arrayOffset);\n arrayOffset += _info.storage / Float32Array.BYTES_PER_ELEMENT;\n }\n }\n gl.bufferSubData(35345, offset, uniform.__data);\n }\n }\n gl.bindBuffer(35345, null);\n }\n function hasUniformChanged(uniform, index, cache) {\n var value = uniform.value;\n if (cache[index] === undefined) {\n // cache entry does not exist so far\n\n if (typeof value === 'number') {\n cache[index] = value;\n } else {\n var values = Array.isArray(value) ? value : [value];\n var tempValues = [];\n for (var i = 0; i < values.length; i++) {\n tempValues.push(values[i].clone());\n }\n cache[index] = tempValues;\n }\n return true;\n } else {\n // compare current value with cached entry\n\n if (typeof value === 'number') {\n if (cache[index] !== value) {\n cache[index] = value;\n return true;\n }\n } else {\n var cachedObjects = Array.isArray(cache[index]) ? cache[index] : [cache[index]];\n var _values = Array.isArray(value) ? value : [value];\n for (var _i57 = 0; _i57 < cachedObjects.length; _i57++) {\n var cachedObject = cachedObjects[_i57];\n if (cachedObject.equals(_values[_i57]) === false) {\n cachedObject.copy(_values[_i57]);\n return true;\n }\n }\n }\n }\n return false;\n }\n function prepareUniformsGroup(uniformsGroup) {\n // determine total buffer size according to the STD140 layout\n // Hint: STD140 is the only supported layout in WebGL 2\n\n var uniforms = uniformsGroup.uniforms;\n var offset = 0; // global buffer offset in bytes\n var chunkSize = 16; // size of a chunk in bytes\n var chunkOffset = 0; // offset within a single chunk in bytes\n\n for (var i = 0, l = uniforms.length; i < l; i++) {\n var uniform = uniforms[i];\n var infos = {\n boundary: 0,\n // bytes\n storage: 0 // bytes\n };\n\n var values = Array.isArray(uniform.value) ? uniform.value : [uniform.value];\n for (var j = 0, jl = values.length; j < jl; j++) {\n var _value6 = values[j];\n var _info2 = getUniformSize(_value6);\n infos.boundary += _info2.boundary;\n infos.storage += _info2.storage;\n }\n\n // the following two properties will be used for partial buffer updates\n\n uniform.__data = new Float32Array(infos.storage / Float32Array.BYTES_PER_ELEMENT);\n uniform.__offset = offset;\n\n //\n\n if (i > 0) {\n chunkOffset = offset % chunkSize;\n var remainingSizeInChunk = chunkSize - chunkOffset;\n\n // check for chunk overflow\n\n if (chunkOffset !== 0 && remainingSizeInChunk - infos.boundary < 0) {\n // add padding and adjust offset\n\n offset += chunkSize - chunkOffset;\n uniform.__offset = offset;\n }\n }\n offset += infos.storage;\n }\n\n // ensure correct final padding\n\n chunkOffset = offset % chunkSize;\n if (chunkOffset > 0) offset += chunkSize - chunkOffset;\n\n //\n\n uniformsGroup.__size = offset;\n uniformsGroup.__cache = {};\n return this;\n }\n function getUniformSize(value) {\n var info = {\n boundary: 0,\n // bytes\n storage: 0 // bytes\n };\n\n // determine sizes according to STD140\n\n if (typeof value === 'number') {\n // float/int\n\n info.boundary = 4;\n info.storage = 4;\n } else if (value.isVector2) {\n // vec2\n\n info.boundary = 8;\n info.storage = 8;\n } else if (value.isVector3 || value.isColor) {\n // vec3\n\n info.boundary = 16;\n info.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes\n } else if (value.isVector4) {\n // vec4\n\n info.boundary = 16;\n info.storage = 16;\n } else if (value.isMatrix3) {\n // mat3 (in STD140 a 3x3 matrix is represented as 3x4)\n\n info.boundary = 48;\n info.storage = 48;\n } else if (value.isMatrix4) {\n // mat4\n\n info.boundary = 64;\n info.storage = 64;\n } else if (value.isTexture) {\n console.warn('THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.');\n } else {\n console.warn('THREE.WebGLRenderer: Unsupported uniform value type.', value);\n }\n return info;\n }\n function onUniformsGroupsDispose(event) {\n var uniformsGroup = event.target;\n uniformsGroup.removeEventListener('dispose', onUniformsGroupsDispose);\n var index = allocatedBindingPoints.indexOf(uniformsGroup.__bindingPointIndex);\n allocatedBindingPoints.splice(index, 1);\n gl.deleteBuffer(buffers[uniformsGroup.id]);\n delete buffers[uniformsGroup.id];\n delete updateList[uniformsGroup.id];\n }\n function dispose() {\n for (var _id3 in buffers) {\n gl.deleteBuffer(buffers[_id3]);\n }\n allocatedBindingPoints = [];\n buffers = {};\n updateList = {};\n }\n return {\n bind: bind,\n update: update,\n dispose: dispose\n };\n}\nfunction createCanvasElement() {\n var canvas = createElementNS('canvas');\n canvas.style.display = 'block';\n return canvas;\n}\nvar WebGLRenderer = /*#__PURE__*/function () {\n function WebGLRenderer() {\n var parameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, WebGLRenderer);\n var _parameters$canvas = parameters.canvas,\n canvas = _parameters$canvas === void 0 ? createCanvasElement() : _parameters$canvas,\n _parameters$context = parameters.context,\n context = _parameters$context === void 0 ? null : _parameters$context,\n _parameters$depth = parameters.depth,\n depth = _parameters$depth === void 0 ? true : _parameters$depth,\n _parameters$stencil = parameters.stencil,\n stencil = _parameters$stencil === void 0 ? true : _parameters$stencil,\n _parameters$alpha = parameters.alpha,\n alpha = _parameters$alpha === void 0 ? false : _parameters$alpha,\n _parameters$antialias = parameters.antialias,\n antialias = _parameters$antialias === void 0 ? false : _parameters$antialias,\n _parameters$premultip = parameters.premultipliedAlpha,\n premultipliedAlpha = _parameters$premultip === void 0 ? true : _parameters$premultip,\n _parameters$preserveD = parameters.preserveDrawingBuffer,\n preserveDrawingBuffer = _parameters$preserveD === void 0 ? false : _parameters$preserveD,\n _parameters$powerPref = parameters.powerPreference,\n powerPreference = _parameters$powerPref === void 0 ? 'default' : _parameters$powerPref,\n _parameters$failIfMaj = parameters.failIfMajorPerformanceCaveat,\n failIfMajorPerformanceCaveat = _parameters$failIfMaj === void 0 ? false : _parameters$failIfMaj;\n this.isWebGLRenderer = true;\n var _alpha;\n if (context !== null) {\n _alpha = context.getContextAttributes().alpha;\n } else {\n _alpha = alpha;\n }\n var currentRenderList = null;\n var currentRenderState = null;\n\n // render() can be called from within a callback triggered by another render.\n // We track this so that the nested render call gets its list and state isolated from the parent render call.\n\n var renderListStack = [];\n var renderStateStack = [];\n\n // public properties\n\n this.domElement = canvas;\n\n // Debug configuration container\n this.debug = {\n /**\n * Enables error checking and reporting when shader programs are being compiled\n * @type {boolean}\n */\n checkShaderErrors: true,\n /**\n * Callback for custom error reporting.\n * @type {?Function}\n */\n onShaderError: null\n };\n\n // clearing\n\n this.autoClear = true;\n this.autoClearColor = true;\n this.autoClearDepth = true;\n this.autoClearStencil = true;\n\n // scene graph\n\n this.sortObjects = true;\n\n // user-defined clipping\n\n this.clippingPlanes = [];\n this.localClippingEnabled = false;\n\n // physically based shading\n\n this.outputEncoding = LinearEncoding;\n\n // physical lights\n\n this.useLegacyLights = true;\n\n // tone mapping\n\n this.toneMapping = NoToneMapping;\n this.toneMappingExposure = 1.0;\n\n // internal properties\n\n var _this = this;\n var _isContextLost = false;\n\n // internal state cache\n\n var _currentActiveCubeFace = 0;\n var _currentActiveMipmapLevel = 0;\n var _currentRenderTarget = null;\n var _currentMaterialId = -1;\n var _currentCamera = null;\n var _currentViewport = new Vector4();\n var _currentScissor = new Vector4();\n var _currentScissorTest = null;\n\n //\n\n var _width = canvas.width;\n var _height = canvas.height;\n var _pixelRatio = 1;\n var _opaqueSort = null;\n var _transparentSort = null;\n var _viewport = new Vector4(0, 0, _width, _height);\n var _scissor = new Vector4(0, 0, _width, _height);\n var _scissorTest = false;\n\n // frustum\n\n var _frustum = new Frustum();\n\n // clipping\n\n var _clippingEnabled = false;\n var _localClippingEnabled = false;\n\n // transmission\n\n var _transmissionRenderTarget = null;\n\n // camera matrices cache\n\n var _projScreenMatrix = new Matrix4();\n var _vector3 = new Vector3();\n var _emptyScene = {\n background: null,\n fog: null,\n environment: null,\n overrideMaterial: null,\n isScene: true\n };\n function getTargetPixelRatio() {\n return _currentRenderTarget === null ? _pixelRatio : 1;\n }\n\n // initialize\n\n var _gl = context;\n function getContext(contextNames, contextAttributes) {\n for (var i = 0; i < contextNames.length; i++) {\n var contextName = contextNames[i];\n var _context9 = canvas.getContext(contextName, contextAttributes);\n if (_context9 !== null) return _context9;\n }\n return null;\n }\n try {\n var contextAttributes = {\n alpha: true,\n depth: depth,\n stencil: stencil,\n antialias: antialias,\n premultipliedAlpha: premultipliedAlpha,\n preserveDrawingBuffer: preserveDrawingBuffer,\n powerPreference: powerPreference,\n failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat\n };\n\n // OffscreenCanvas does not have setAttribute, see #22811\n if ('setAttribute' in canvas) canvas.setAttribute('data-engine', \"three.js r\".concat(REVISION));\n\n // event listeners must be registered before WebGL context is created, see #12753\n canvas.addEventListener('webglcontextlost', onContextLost, false);\n canvas.addEventListener('webglcontextrestored', onContextRestore, false);\n canvas.addEventListener('webglcontextcreationerror', onContextCreationError, false);\n if (_gl === null) {\n var contextNames = ['webgl2', 'webgl', 'experimental-webgl'];\n if (_this.isWebGL1Renderer === true) {\n contextNames.shift();\n }\n _gl = getContext(contextNames, contextAttributes);\n if (_gl === null) {\n if (getContext(contextNames)) {\n throw new Error('Error creating WebGL context with your selected attributes.');\n } else {\n throw new Error('Error creating WebGL context.');\n }\n }\n }\n\n // Some experimental-webgl implementations do not have getShaderPrecisionFormat\n\n if (_gl.getShaderPrecisionFormat === undefined) {\n _gl.getShaderPrecisionFormat = function () {\n return {\n 'rangeMin': 1,\n 'rangeMax': 1,\n 'precision': 1\n };\n };\n }\n } catch (error) {\n console.error('THREE.WebGLRenderer: ' + error.message);\n throw error;\n }\n var extensions, capabilities, state, info;\n var properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;\n var programCache, materials, renderLists, renderStates, clipping, shadowMap;\n var background, morphtargets, bufferRenderer, indexedBufferRenderer;\n var utils, bindingStates, uniformsGroups;\n function initGLContext() {\n extensions = new WebGLExtensions(_gl);\n capabilities = new WebGLCapabilities(_gl, extensions, parameters);\n extensions.init(capabilities);\n utils = new WebGLUtils(_gl, extensions, capabilities);\n state = new WebGLState(_gl, extensions, capabilities);\n info = new WebGLInfo();\n properties = new WebGLProperties();\n textures = new WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info);\n cubemaps = new WebGLCubeMaps(_this);\n cubeuvmaps = new WebGLCubeUVMaps(_this);\n attributes = new WebGLAttributes(_gl, capabilities);\n bindingStates = new WebGLBindingStates(_gl, extensions, attributes, capabilities);\n geometries = new WebGLGeometries(_gl, attributes, info, bindingStates);\n objects = new WebGLObjects(_gl, geometries, attributes, info);\n morphtargets = new WebGLMorphtargets(_gl, capabilities, textures);\n clipping = new WebGLClipping(properties);\n programCache = new WebGLPrograms(_this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping);\n materials = new WebGLMaterials(_this, properties);\n renderLists = new WebGLRenderLists();\n renderStates = new WebGLRenderStates(extensions, capabilities);\n background = new WebGLBackground(_this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha);\n shadowMap = new WebGLShadowMap(_this, objects, capabilities);\n uniformsGroups = new WebGLUniformsGroups(_gl, info, capabilities, state);\n bufferRenderer = new WebGLBufferRenderer(_gl, extensions, info, capabilities);\n indexedBufferRenderer = new WebGLIndexedBufferRenderer(_gl, extensions, info, capabilities);\n info.programs = programCache.programs;\n _this.capabilities = capabilities;\n _this.extensions = extensions;\n _this.properties = properties;\n _this.renderLists = renderLists;\n _this.shadowMap = shadowMap;\n _this.state = state;\n _this.info = info;\n }\n initGLContext();\n\n // xr\n\n var xr = new WebXRManager(_this, _gl);\n this.xr = xr;\n\n // API\n\n this.getContext = function () {\n return _gl;\n };\n this.getContextAttributes = function () {\n return _gl.getContextAttributes();\n };\n this.forceContextLoss = function () {\n var extension = extensions.get('WEBGL_lose_context');\n if (extension) extension.loseContext();\n };\n this.forceContextRestore = function () {\n var extension = extensions.get('WEBGL_lose_context');\n if (extension) extension.restoreContext();\n };\n this.getPixelRatio = function () {\n return _pixelRatio;\n };\n this.setPixelRatio = function (value) {\n if (value === undefined) return;\n _pixelRatio = value;\n this.setSize(_width, _height, false);\n };\n this.getSize = function (target) {\n return target.set(_width, _height);\n };\n this.setSize = function (width, height) {\n var updateStyle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n if (xr.isPresenting) {\n console.warn('THREE.WebGLRenderer: Can\\'t change size while VR device is presenting.');\n return;\n }\n _width = width;\n _height = height;\n canvas.width = Math.floor(width * _pixelRatio);\n canvas.height = Math.floor(height * _pixelRatio);\n if (updateStyle === true) {\n canvas.style.width = width + 'px';\n canvas.style.height = height + 'px';\n }\n this.setViewport(0, 0, width, height);\n };\n this.getDrawingBufferSize = function (target) {\n return target.set(_width * _pixelRatio, _height * _pixelRatio).floor();\n };\n this.setDrawingBufferSize = function (width, height, pixelRatio) {\n _width = width;\n _height = height;\n _pixelRatio = pixelRatio;\n canvas.width = Math.floor(width * pixelRatio);\n canvas.height = Math.floor(height * pixelRatio);\n this.setViewport(0, 0, width, height);\n };\n this.getCurrentViewport = function (target) {\n return target.copy(_currentViewport);\n };\n this.getViewport = function (target) {\n return target.copy(_viewport);\n };\n this.setViewport = function (x, y, width, height) {\n if (x.isVector4) {\n _viewport.set(x.x, x.y, x.z, x.w);\n } else {\n _viewport.set(x, y, width, height);\n }\n state.viewport(_currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor());\n };\n this.getScissor = function (target) {\n return target.copy(_scissor);\n };\n this.setScissor = function (x, y, width, height) {\n if (x.isVector4) {\n _scissor.set(x.x, x.y, x.z, x.w);\n } else {\n _scissor.set(x, y, width, height);\n }\n state.scissor(_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor());\n };\n this.getScissorTest = function () {\n return _scissorTest;\n };\n this.setScissorTest = function (_boolean) {\n state.setScissorTest(_scissorTest = _boolean);\n };\n this.setOpaqueSort = function (method) {\n _opaqueSort = method;\n };\n this.setTransparentSort = function (method) {\n _transparentSort = method;\n };\n\n // Clearing\n\n this.getClearColor = function (target) {\n return target.copy(background.getClearColor());\n };\n this.setClearColor = function () {\n background.setClearColor.apply(background, arguments);\n };\n this.getClearAlpha = function () {\n return background.getClearAlpha();\n };\n this.setClearAlpha = function () {\n background.setClearAlpha.apply(background, arguments);\n };\n this.clear = function () {\n var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var stencil = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n var bits = 0;\n if (color) bits |= 16384;\n if (depth) bits |= 256;\n if (stencil) bits |= 1024;\n _gl.clear(bits);\n };\n this.clearColor = function () {\n this.clear(true, false, false);\n };\n this.clearDepth = function () {\n this.clear(false, true, false);\n };\n this.clearStencil = function () {\n this.clear(false, false, true);\n };\n\n //\n\n this.dispose = function () {\n canvas.removeEventListener('webglcontextlost', onContextLost, false);\n canvas.removeEventListener('webglcontextrestored', onContextRestore, false);\n canvas.removeEventListener('webglcontextcreationerror', onContextCreationError, false);\n renderLists.dispose();\n renderStates.dispose();\n properties.dispose();\n cubemaps.dispose();\n cubeuvmaps.dispose();\n objects.dispose();\n bindingStates.dispose();\n uniformsGroups.dispose();\n programCache.dispose();\n xr.dispose();\n xr.removeEventListener('sessionstart', onXRSessionStart);\n xr.removeEventListener('sessionend', onXRSessionEnd);\n if (_transmissionRenderTarget) {\n _transmissionRenderTarget.dispose();\n _transmissionRenderTarget = null;\n }\n animation.stop();\n };\n\n // Events\n\n function onContextLost(event) {\n event.preventDefault();\n console.log('THREE.WebGLRenderer: Context Lost.');\n _isContextLost = true;\n }\n function onContextRestore( /* event */\n ) {\n console.log('THREE.WebGLRenderer: Context Restored.');\n _isContextLost = false;\n var infoAutoReset = info.autoReset;\n var shadowMapEnabled = shadowMap.enabled;\n var shadowMapAutoUpdate = shadowMap.autoUpdate;\n var shadowMapNeedsUpdate = shadowMap.needsUpdate;\n var shadowMapType = shadowMap.type;\n initGLContext();\n info.autoReset = infoAutoReset;\n shadowMap.enabled = shadowMapEnabled;\n shadowMap.autoUpdate = shadowMapAutoUpdate;\n shadowMap.needsUpdate = shadowMapNeedsUpdate;\n shadowMap.type = shadowMapType;\n }\n function onContextCreationError(event) {\n console.error('THREE.WebGLRenderer: A WebGL context could not be created. Reason: ', event.statusMessage);\n }\n function onMaterialDispose(event) {\n var material = event.target;\n material.removeEventListener('dispose', onMaterialDispose);\n deallocateMaterial(material);\n }\n\n // Buffer deallocation\n\n function deallocateMaterial(material) {\n releaseMaterialProgramReferences(material);\n properties.remove(material);\n }\n function releaseMaterialProgramReferences(material) {\n var programs = properties.get(material).programs;\n if (programs !== undefined) {\n programs.forEach(function (program) {\n programCache.releaseProgram(program);\n });\n if (material.isShaderMaterial) {\n programCache.releaseShaderCache(material);\n }\n }\n }\n\n // Buffer rendering\n\n this.renderBufferDirect = function (camera, scene, geometry, material, object, group) {\n if (scene === null) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)\n\n var frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0;\n var program = setProgram(camera, scene, geometry, material, object);\n state.setMaterial(material, frontFaceCW);\n\n //\n\n var index = geometry.index;\n var rangeFactor = 1;\n if (material.wireframe === true) {\n index = geometries.getWireframeAttribute(geometry);\n rangeFactor = 2;\n }\n\n //\n\n var drawRange = geometry.drawRange;\n var position = geometry.attributes.position;\n var drawStart = drawRange.start * rangeFactor;\n var drawEnd = (drawRange.start + drawRange.count) * rangeFactor;\n if (group !== null) {\n drawStart = Math.max(drawStart, group.start * rangeFactor);\n drawEnd = Math.min(drawEnd, (group.start + group.count) * rangeFactor);\n }\n if (index !== null) {\n drawStart = Math.max(drawStart, 0);\n drawEnd = Math.min(drawEnd, index.count);\n } else if (position !== undefined && position !== null) {\n drawStart = Math.max(drawStart, 0);\n drawEnd = Math.min(drawEnd, position.count);\n }\n var drawCount = drawEnd - drawStart;\n if (drawCount < 0 || drawCount === Infinity) return;\n\n //\n\n bindingStates.setup(object, material, program, geometry, index);\n var attribute;\n var renderer = bufferRenderer;\n if (index !== null) {\n attribute = attributes.get(index);\n renderer = indexedBufferRenderer;\n renderer.setIndex(attribute);\n }\n\n //\n\n if (object.isMesh) {\n if (material.wireframe === true) {\n state.setLineWidth(material.wireframeLinewidth * getTargetPixelRatio());\n renderer.setMode(1);\n } else {\n renderer.setMode(4);\n }\n } else if (object.isLine) {\n var lineWidth = material.linewidth;\n if (lineWidth === undefined) lineWidth = 1; // Not using Line*Material\n\n state.setLineWidth(lineWidth * getTargetPixelRatio());\n if (object.isLineSegments) {\n renderer.setMode(1);\n } else if (object.isLineLoop) {\n renderer.setMode(2);\n } else {\n renderer.setMode(3);\n }\n } else if (object.isPoints) {\n renderer.setMode(0);\n } else if (object.isSprite) {\n renderer.setMode(4);\n }\n if (object.isInstancedMesh) {\n renderer.renderInstances(drawStart, drawCount, object.count);\n } else if (geometry.isInstancedBufferGeometry) {\n var maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;\n var instanceCount = Math.min(geometry.instanceCount, maxInstanceCount);\n renderer.renderInstances(drawStart, drawCount, instanceCount);\n } else {\n renderer.render(drawStart, drawCount);\n }\n };\n\n // Compile\n\n this.compile = function (scene, camera) {\n function prepare(material, scene, object) {\n if (material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false) {\n material.side = BackSide;\n material.needsUpdate = true;\n getProgram(material, scene, object);\n material.side = FrontSide;\n material.needsUpdate = true;\n getProgram(material, scene, object);\n material.side = DoubleSide;\n } else {\n getProgram(material, scene, object);\n }\n }\n currentRenderState = renderStates.get(scene);\n currentRenderState.init();\n renderStateStack.push(currentRenderState);\n scene.traverseVisible(function (object) {\n if (object.isLight && object.layers.test(camera.layers)) {\n currentRenderState.pushLight(object);\n if (object.castShadow) {\n currentRenderState.pushShadow(object);\n }\n }\n });\n currentRenderState.setupLights(_this.useLegacyLights);\n scene.traverse(function (object) {\n var material = object.material;\n if (material) {\n if (Array.isArray(material)) {\n for (var i = 0; i < material.length; i++) {\n var material2 = material[i];\n prepare(material2, scene, object);\n }\n } else {\n prepare(material, scene, object);\n }\n }\n });\n renderStateStack.pop();\n currentRenderState = null;\n };\n\n // Animation Loop\n\n var onAnimationFrameCallback = null;\n function onAnimationFrame(time) {\n if (onAnimationFrameCallback) onAnimationFrameCallback(time);\n }\n function onXRSessionStart() {\n animation.stop();\n }\n function onXRSessionEnd() {\n animation.start();\n }\n var animation = new WebGLAnimation();\n animation.setAnimationLoop(onAnimationFrame);\n if (typeof self !== 'undefined') animation.setContext(self);\n this.setAnimationLoop = function (callback) {\n onAnimationFrameCallback = callback;\n xr.setAnimationLoop(callback);\n callback === null ? animation.stop() : animation.start();\n };\n xr.addEventListener('sessionstart', onXRSessionStart);\n xr.addEventListener('sessionend', onXRSessionEnd);\n\n // Rendering\n\n this.render = function (scene, camera) {\n if (camera !== undefined && camera.isCamera !== true) {\n console.error('THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.');\n return;\n }\n if (_isContextLost === true) return;\n\n // update scene graph\n\n if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld();\n\n // update camera matrices and frustum\n\n if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld();\n if (xr.enabled === true && xr.isPresenting === true) {\n if (xr.cameraAutoUpdate === true) xr.updateCamera(camera);\n camera = xr.getCamera(); // use XR camera for rendering\n }\n\n //\n if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget);\n currentRenderState = renderStates.get(scene, renderStateStack.length);\n currentRenderState.init();\n renderStateStack.push(currentRenderState);\n _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n _frustum.setFromProjectionMatrix(_projScreenMatrix);\n _localClippingEnabled = this.localClippingEnabled;\n _clippingEnabled = clipping.init(this.clippingPlanes, _localClippingEnabled);\n currentRenderList = renderLists.get(scene, renderListStack.length);\n currentRenderList.init();\n renderListStack.push(currentRenderList);\n projectObject(scene, camera, 0, _this.sortObjects);\n currentRenderList.finish();\n if (_this.sortObjects === true) {\n currentRenderList.sort(_opaqueSort, _transparentSort);\n }\n\n //\n\n if (_clippingEnabled === true) clipping.beginShadows();\n var shadowsArray = currentRenderState.state.shadowsArray;\n shadowMap.render(shadowsArray, scene, camera);\n if (_clippingEnabled === true) clipping.endShadows();\n\n //\n\n if (this.info.autoReset === true) this.info.reset();\n\n //\n\n background.render(currentRenderList, scene);\n\n // render scene\n\n currentRenderState.setupLights(_this.useLegacyLights);\n if (camera.isArrayCamera) {\n var cameras = camera.cameras;\n for (var i = 0, l = cameras.length; i < l; i++) {\n var camera2 = cameras[i];\n renderScene(currentRenderList, scene, camera2, camera2.viewport);\n }\n } else {\n renderScene(currentRenderList, scene, camera);\n }\n\n //\n\n if (_currentRenderTarget !== null) {\n // resolve multisample renderbuffers to a single-sample texture if necessary\n\n textures.updateMultisampleRenderTarget(_currentRenderTarget);\n\n // Generate mipmap if we're using any kind of mipmap filtering\n\n textures.updateRenderTargetMipmap(_currentRenderTarget);\n }\n\n //\n\n if (scene.isScene === true) scene.onAfterRender(_this, scene, camera);\n\n // _gl.finish();\n\n bindingStates.resetDefaultState();\n _currentMaterialId = -1;\n _currentCamera = null;\n renderStateStack.pop();\n if (renderStateStack.length > 0) {\n currentRenderState = renderStateStack[renderStateStack.length - 1];\n } else {\n currentRenderState = null;\n }\n renderListStack.pop();\n if (renderListStack.length > 0) {\n currentRenderList = renderListStack[renderListStack.length - 1];\n } else {\n currentRenderList = null;\n }\n };\n function projectObject(object, camera, groupOrder, sortObjects) {\n if (object.visible === false) return;\n var visible = object.layers.test(camera.layers);\n if (visible) {\n if (object.isGroup) {\n groupOrder = object.renderOrder;\n } else if (object.isLOD) {\n if (object.autoUpdate === true) object.update(camera);\n } else if (object.isLight) {\n currentRenderState.pushLight(object);\n if (object.castShadow) {\n currentRenderState.pushShadow(object);\n }\n } else if (object.isSprite) {\n if (!object.frustumCulled || _frustum.intersectsSprite(object)) {\n if (sortObjects) {\n _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);\n }\n var geometry = objects.update(object);\n var material = object.material;\n if (material.visible) {\n currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null);\n }\n }\n } else if (object.isMesh || object.isLine || object.isPoints) {\n if (object.isSkinnedMesh) {\n // update skeleton only once in a frame\n\n if (object.skeleton.frame !== info.render.frame) {\n object.skeleton.update();\n object.skeleton.frame = info.render.frame;\n }\n }\n if (!object.frustumCulled || _frustum.intersectsObject(object)) {\n if (sortObjects) {\n _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix);\n }\n var _geometry2 = objects.update(object);\n var _material = object.material;\n if (Array.isArray(_material)) {\n var groups = _geometry2.groups;\n for (var i = 0, l = groups.length; i < l; i++) {\n var group = groups[i];\n var groupMaterial = _material[group.materialIndex];\n if (groupMaterial && groupMaterial.visible) {\n currentRenderList.push(object, _geometry2, groupMaterial, groupOrder, _vector3.z, group);\n }\n }\n } else if (_material.visible) {\n currentRenderList.push(object, _geometry2, _material, groupOrder, _vector3.z, null);\n }\n }\n }\n }\n var children = object.children;\n for (var _i58 = 0, _l6 = children.length; _i58 < _l6; _i58++) {\n projectObject(children[_i58], camera, groupOrder, sortObjects);\n }\n }\n function renderScene(currentRenderList, scene, camera, viewport) {\n var opaqueObjects = currentRenderList.opaque;\n var transmissiveObjects = currentRenderList.transmissive;\n var transparentObjects = currentRenderList.transparent;\n currentRenderState.setupLightsView(camera);\n if (_clippingEnabled === true) clipping.setGlobalState(_this.clippingPlanes, camera);\n if (transmissiveObjects.length > 0) renderTransmissionPass(opaqueObjects, transmissiveObjects, scene, camera);\n if (viewport) state.viewport(_currentViewport.copy(viewport));\n if (opaqueObjects.length > 0) renderObjects(opaqueObjects, scene, camera);\n if (transmissiveObjects.length > 0) renderObjects(transmissiveObjects, scene, camera);\n if (transparentObjects.length > 0) renderObjects(transparentObjects, scene, camera);\n\n // Ensure depth buffer writing is enabled so it can be cleared on next render\n\n state.buffers.depth.setTest(true);\n state.buffers.depth.setMask(true);\n state.buffers.color.setMask(true);\n state.setPolygonOffset(false);\n }\n function renderTransmissionPass(opaqueObjects, transmissiveObjects, scene, camera) {\n if (_transmissionRenderTarget === null) {\n var isWebGL2 = capabilities.isWebGL2;\n _transmissionRenderTarget = new WebGLRenderTarget(1024, 1024, {\n generateMipmaps: true,\n type: extensions.has('EXT_color_buffer_half_float') ? HalfFloatType : UnsignedByteType,\n minFilter: LinearMipmapLinearFilter,\n samples: isWebGL2 && antialias === true ? 4 : 0\n });\n\n // debug\n\n /*\n const geometry = new PlaneGeometry();\n const material = new MeshBasicMaterial( { map: _transmissionRenderTarget.texture } );\n \tconst mesh = new Mesh( geometry, material );\n scene.add( mesh );\n */\n }\n\n //\n\n var currentRenderTarget = _this.getRenderTarget();\n _this.setRenderTarget(_transmissionRenderTarget);\n _this.clear();\n\n // Turn off the features which can affect the frag color for opaque objects pass.\n // Otherwise they are applied twice in opaque objects pass and transmission objects pass.\n var currentToneMapping = _this.toneMapping;\n _this.toneMapping = NoToneMapping;\n renderObjects(opaqueObjects, scene, camera);\n textures.updateMultisampleRenderTarget(_transmissionRenderTarget);\n textures.updateRenderTargetMipmap(_transmissionRenderTarget);\n var renderTargetNeedsUpdate = false;\n for (var i = 0, l = transmissiveObjects.length; i < l; i++) {\n var renderItem = transmissiveObjects[i];\n var object = renderItem.object;\n var geometry = renderItem.geometry;\n var material = renderItem.material;\n var group = renderItem.group;\n if (material.side === DoubleSide && object.layers.test(camera.layers)) {\n var currentSide = material.side;\n material.side = BackSide;\n material.needsUpdate = true;\n renderObject(object, scene, camera, geometry, material, group);\n material.side = currentSide;\n material.needsUpdate = true;\n renderTargetNeedsUpdate = true;\n }\n }\n if (renderTargetNeedsUpdate === true) {\n textures.updateMultisampleRenderTarget(_transmissionRenderTarget);\n textures.updateRenderTargetMipmap(_transmissionRenderTarget);\n }\n _this.setRenderTarget(currentRenderTarget);\n _this.toneMapping = currentToneMapping;\n }\n function renderObjects(renderList, scene, camera) {\n var overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null;\n for (var i = 0, l = renderList.length; i < l; i++) {\n var renderItem = renderList[i];\n var object = renderItem.object;\n var geometry = renderItem.geometry;\n var material = overrideMaterial === null ? renderItem.material : overrideMaterial;\n var group = renderItem.group;\n if (object.layers.test(camera.layers)) {\n renderObject(object, scene, camera, geometry, material, group);\n }\n }\n }\n function renderObject(object, scene, camera, geometry, material, group) {\n object.onBeforeRender(_this, scene, camera, geometry, material, group);\n object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld);\n object.normalMatrix.getNormalMatrix(object.modelViewMatrix);\n material.onBeforeRender(_this, scene, camera, geometry, object, group);\n if (material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false) {\n material.side = BackSide;\n material.needsUpdate = true;\n _this.renderBufferDirect(camera, scene, geometry, material, object, group);\n material.side = FrontSide;\n material.needsUpdate = true;\n _this.renderBufferDirect(camera, scene, geometry, material, object, group);\n material.side = DoubleSide;\n } else {\n _this.renderBufferDirect(camera, scene, geometry, material, object, group);\n }\n object.onAfterRender(_this, scene, camera, geometry, material, group);\n }\n function getProgram(material, scene, object) {\n if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n var materialProperties = properties.get(material);\n var lights = currentRenderState.state.lights;\n var shadowsArray = currentRenderState.state.shadowsArray;\n var lightsStateVersion = lights.state.version;\n var parameters = programCache.getParameters(material, lights.state, shadowsArray, scene, object);\n var programCacheKey = programCache.getProgramCacheKey(parameters);\n var programs = materialProperties.programs;\n\n // always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change\n\n materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;\n materialProperties.fog = scene.fog;\n materialProperties.envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || materialProperties.environment);\n if (programs === undefined) {\n // new material\n\n material.addEventListener('dispose', onMaterialDispose);\n programs = new Map();\n materialProperties.programs = programs;\n }\n var program = programs.get(programCacheKey);\n if (program !== undefined) {\n // early out if program and light state is identical\n\n if (materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion) {\n updateCommonMaterialProperties(material, parameters);\n return program;\n }\n } else {\n parameters.uniforms = programCache.getUniforms(material);\n material.onBuild(object, parameters, _this);\n material.onBeforeCompile(parameters, _this);\n program = programCache.acquireProgram(parameters, programCacheKey);\n programs.set(programCacheKey, program);\n materialProperties.uniforms = parameters.uniforms;\n }\n var uniforms = materialProperties.uniforms;\n if (!material.isShaderMaterial && !material.isRawShaderMaterial || material.clipping === true) {\n uniforms.clippingPlanes = clipping.uniform;\n }\n updateCommonMaterialProperties(material, parameters);\n\n // store the light setup it was created for\n\n materialProperties.needsLights = materialNeedsLights(material);\n materialProperties.lightsStateVersion = lightsStateVersion;\n if (materialProperties.needsLights) {\n // wire up the material to this renderer's lighting state\n\n uniforms.ambientLightColor.value = lights.state.ambient;\n uniforms.lightProbe.value = lights.state.probe;\n uniforms.directionalLights.value = lights.state.directional;\n uniforms.directionalLightShadows.value = lights.state.directionalShadow;\n uniforms.spotLights.value = lights.state.spot;\n uniforms.spotLightShadows.value = lights.state.spotShadow;\n uniforms.rectAreaLights.value = lights.state.rectArea;\n uniforms.ltc_1.value = lights.state.rectAreaLTC1;\n uniforms.ltc_2.value = lights.state.rectAreaLTC2;\n uniforms.pointLights.value = lights.state.point;\n uniforms.pointLightShadows.value = lights.state.pointShadow;\n uniforms.hemisphereLights.value = lights.state.hemi;\n uniforms.directionalShadowMap.value = lights.state.directionalShadowMap;\n uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;\n uniforms.spotShadowMap.value = lights.state.spotShadowMap;\n uniforms.spotLightMatrix.value = lights.state.spotLightMatrix;\n uniforms.spotLightMap.value = lights.state.spotLightMap;\n uniforms.pointShadowMap.value = lights.state.pointShadowMap;\n uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix;\n // TODO (abelnation): add area lights shadow info to uniforms\n }\n\n var progUniforms = program.getUniforms();\n var uniformsList = WebGLUniforms.seqWithValue(progUniforms.seq, uniforms);\n materialProperties.currentProgram = program;\n materialProperties.uniformsList = uniformsList;\n return program;\n }\n function updateCommonMaterialProperties(material, parameters) {\n var materialProperties = properties.get(material);\n materialProperties.outputEncoding = parameters.outputEncoding;\n materialProperties.instancing = parameters.instancing;\n materialProperties.skinning = parameters.skinning;\n materialProperties.morphTargets = parameters.morphTargets;\n materialProperties.morphNormals = parameters.morphNormals;\n materialProperties.morphColors = parameters.morphColors;\n materialProperties.morphTargetsCount = parameters.morphTargetsCount;\n materialProperties.numClippingPlanes = parameters.numClippingPlanes;\n materialProperties.numIntersection = parameters.numClipIntersection;\n materialProperties.vertexAlphas = parameters.vertexAlphas;\n materialProperties.vertexTangents = parameters.vertexTangents;\n materialProperties.toneMapping = parameters.toneMapping;\n }\n function setProgram(camera, scene, geometry, material, object) {\n if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ...\n\n textures.resetTextureUnits();\n var fog = scene.fog;\n var environment = material.isMeshStandardMaterial ? scene.environment : null;\n var encoding = _currentRenderTarget === null ? _this.outputEncoding : _currentRenderTarget.isXRRenderTarget === true ? _currentRenderTarget.texture.encoding : LinearEncoding;\n var envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment);\n var vertexAlphas = material.vertexColors === true && !!geometry.attributes.color && geometry.attributes.color.itemSize === 4;\n var vertexTangents = !!material.normalMap && !!geometry.attributes.tangent;\n var morphTargets = !!geometry.morphAttributes.position;\n var morphNormals = !!geometry.morphAttributes.normal;\n var morphColors = !!geometry.morphAttributes.color;\n var toneMapping = material.toneMapped ? _this.toneMapping : NoToneMapping;\n var morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;\n var morphTargetsCount = morphAttribute !== undefined ? morphAttribute.length : 0;\n var materialProperties = properties.get(material);\n var lights = currentRenderState.state.lights;\n if (_clippingEnabled === true) {\n if (_localClippingEnabled === true || camera !== _currentCamera) {\n var useCache = camera === _currentCamera && material.id === _currentMaterialId;\n\n // we might want to call this function with some ClippingGroup\n // object instead of the material, once it becomes feasible\n // (#8465, #8379)\n clipping.setState(material, camera, useCache);\n }\n }\n\n //\n\n var needsProgramChange = false;\n if (material.version === materialProperties.__version) {\n if (materialProperties.needsLights && materialProperties.lightsStateVersion !== lights.state.version) {\n needsProgramChange = true;\n } else if (materialProperties.outputEncoding !== encoding) {\n needsProgramChange = true;\n } else if (object.isInstancedMesh && materialProperties.instancing === false) {\n needsProgramChange = true;\n } else if (!object.isInstancedMesh && materialProperties.instancing === true) {\n needsProgramChange = true;\n } else if (object.isSkinnedMesh && materialProperties.skinning === false) {\n needsProgramChange = true;\n } else if (!object.isSkinnedMesh && materialProperties.skinning === true) {\n needsProgramChange = true;\n } else if (materialProperties.envMap !== envMap) {\n needsProgramChange = true;\n } else if (material.fog === true && materialProperties.fog !== fog) {\n needsProgramChange = true;\n } else if (materialProperties.numClippingPlanes !== undefined && (materialProperties.numClippingPlanes !== clipping.numPlanes || materialProperties.numIntersection !== clipping.numIntersection)) {\n needsProgramChange = true;\n } else if (materialProperties.vertexAlphas !== vertexAlphas) {\n needsProgramChange = true;\n } else if (materialProperties.vertexTangents !== vertexTangents) {\n needsProgramChange = true;\n } else if (materialProperties.morphTargets !== morphTargets) {\n needsProgramChange = true;\n } else if (materialProperties.morphNormals !== morphNormals) {\n needsProgramChange = true;\n } else if (materialProperties.morphColors !== morphColors) {\n needsProgramChange = true;\n } else if (materialProperties.toneMapping !== toneMapping) {\n needsProgramChange = true;\n } else if (capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount) {\n needsProgramChange = true;\n }\n } else {\n needsProgramChange = true;\n materialProperties.__version = material.version;\n }\n\n //\n\n var program = materialProperties.currentProgram;\n if (needsProgramChange === true) {\n program = getProgram(material, scene, object);\n }\n var refreshProgram = false;\n var refreshMaterial = false;\n var refreshLights = false;\n var p_uniforms = program.getUniforms(),\n m_uniforms = materialProperties.uniforms;\n if (state.useProgram(program.program)) {\n refreshProgram = true;\n refreshMaterial = true;\n refreshLights = true;\n }\n if (material.id !== _currentMaterialId) {\n _currentMaterialId = material.id;\n refreshMaterial = true;\n }\n if (refreshProgram || _currentCamera !== camera) {\n p_uniforms.setValue(_gl, 'projectionMatrix', camera.projectionMatrix);\n if (capabilities.logarithmicDepthBuffer) {\n p_uniforms.setValue(_gl, 'logDepthBufFC', 2.0 / (Math.log(camera.far + 1.0) / Math.LN2));\n }\n if (_currentCamera !== camera) {\n _currentCamera = camera;\n\n // lighting uniforms depend on the camera so enforce an update\n // now, in case this material supports lights - or later, when\n // the next material that does gets activated:\n\n refreshMaterial = true; // set to true on material change\n refreshLights = true; // remains set until update done\n }\n\n // load material specific uniforms\n // (shader material also gets them for the sake of genericity)\n\n if (material.isShaderMaterial || material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshStandardMaterial || material.envMap) {\n var uCamPos = p_uniforms.map.cameraPosition;\n if (uCamPos !== undefined) {\n uCamPos.setValue(_gl, _vector3.setFromMatrixPosition(camera.matrixWorld));\n }\n }\n if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial) {\n p_uniforms.setValue(_gl, 'isOrthographic', camera.isOrthographicCamera === true);\n }\n if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial || material.isShadowMaterial || object.isSkinnedMesh) {\n p_uniforms.setValue(_gl, 'viewMatrix', camera.matrixWorldInverse);\n }\n }\n\n // skinning and morph target uniforms must be set even if material didn't change\n // auto-setting of texture unit for bone and morph texture must go before other textures\n // otherwise textures used for skinning and morphing can take over texture units reserved for other material textures\n\n if (object.isSkinnedMesh) {\n p_uniforms.setOptional(_gl, object, 'bindMatrix');\n p_uniforms.setOptional(_gl, object, 'bindMatrixInverse');\n var skeleton = object.skeleton;\n if (skeleton) {\n if (capabilities.floatVertexTextures) {\n if (skeleton.boneTexture === null) skeleton.computeBoneTexture();\n p_uniforms.setValue(_gl, 'boneTexture', skeleton.boneTexture, textures);\n p_uniforms.setValue(_gl, 'boneTextureSize', skeleton.boneTextureSize);\n } else {\n console.warn('THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.');\n }\n }\n }\n var morphAttributes = geometry.morphAttributes;\n if (morphAttributes.position !== undefined || morphAttributes.normal !== undefined || morphAttributes.color !== undefined && capabilities.isWebGL2 === true) {\n morphtargets.update(object, geometry, program);\n }\n if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) {\n materialProperties.receiveShadow = object.receiveShadow;\n p_uniforms.setValue(_gl, 'receiveShadow', object.receiveShadow);\n }\n\n // https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512\n\n if (material.isMeshGouraudMaterial && material.envMap !== null) {\n m_uniforms.envMap.value = envMap;\n m_uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;\n }\n if (refreshMaterial) {\n p_uniforms.setValue(_gl, 'toneMappingExposure', _this.toneMappingExposure);\n if (materialProperties.needsLights) {\n // the current material requires lighting info\n\n // note: all lighting uniforms are always set correctly\n // they simply reference the renderer's state for their\n // values\n //\n // use the current material's .needsUpdate flags to set\n // the GL state when required\n\n markUniformsLightsNeedsUpdate(m_uniforms, refreshLights);\n }\n\n // refresh uniforms common to several materials\n\n if (fog && material.fog === true) {\n materials.refreshFogUniforms(m_uniforms, fog);\n }\n materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget);\n WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures);\n }\n if (material.isShaderMaterial && material.uniformsNeedUpdate === true) {\n WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures);\n material.uniformsNeedUpdate = false;\n }\n if (material.isSpriteMaterial) {\n p_uniforms.setValue(_gl, 'center', object.center);\n }\n\n // common matrices\n\n p_uniforms.setValue(_gl, 'modelViewMatrix', object.modelViewMatrix);\n p_uniforms.setValue(_gl, 'normalMatrix', object.normalMatrix);\n p_uniforms.setValue(_gl, 'modelMatrix', object.matrixWorld);\n\n // UBOs\n\n if (material.isShaderMaterial || material.isRawShaderMaterial) {\n var groups = material.uniformsGroups;\n for (var i = 0, l = groups.length; i < l; i++) {\n if (capabilities.isWebGL2) {\n var group = groups[i];\n uniformsGroups.update(group, program);\n uniformsGroups.bind(group, program);\n } else {\n console.warn('THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.');\n }\n }\n }\n return program;\n }\n\n // If uniforms are marked as clean, they don't need to be loaded to the GPU.\n\n function markUniformsLightsNeedsUpdate(uniforms, value) {\n uniforms.ambientLightColor.needsUpdate = value;\n uniforms.lightProbe.needsUpdate = value;\n uniforms.directionalLights.needsUpdate = value;\n uniforms.directionalLightShadows.needsUpdate = value;\n uniforms.pointLights.needsUpdate = value;\n uniforms.pointLightShadows.needsUpdate = value;\n uniforms.spotLights.needsUpdate = value;\n uniforms.spotLightShadows.needsUpdate = value;\n uniforms.rectAreaLights.needsUpdate = value;\n uniforms.hemisphereLights.needsUpdate = value;\n }\n function materialNeedsLights(material) {\n return material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial || material.isMeshStandardMaterial || material.isShadowMaterial || material.isShaderMaterial && material.lights === true;\n }\n this.getActiveCubeFace = function () {\n return _currentActiveCubeFace;\n };\n this.getActiveMipmapLevel = function () {\n return _currentActiveMipmapLevel;\n };\n this.getRenderTarget = function () {\n return _currentRenderTarget;\n };\n this.setRenderTargetTextures = function (renderTarget, colorTexture, depthTexture) {\n properties.get(renderTarget.texture).__webglTexture = colorTexture;\n properties.get(renderTarget.depthTexture).__webglTexture = depthTexture;\n var renderTargetProperties = properties.get(renderTarget);\n renderTargetProperties.__hasExternalTextures = true;\n if (renderTargetProperties.__hasExternalTextures) {\n renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;\n if (!renderTargetProperties.__autoAllocateDepthBuffer) {\n // The multisample_render_to_texture extension doesn't work properly if there\n // are midframe flushes and an external depth buffer. Disable use of the extension.\n if (extensions.has('WEBGL_multisampled_render_to_texture') === true) {\n console.warn('THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided');\n renderTargetProperties.__useRenderToTexture = false;\n }\n }\n }\n };\n this.setRenderTargetFramebuffer = function (renderTarget, defaultFramebuffer) {\n var renderTargetProperties = properties.get(renderTarget);\n renderTargetProperties.__webglFramebuffer = defaultFramebuffer;\n renderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;\n };\n this.setRenderTarget = function (renderTarget) {\n var activeCubeFace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var activeMipmapLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n _currentRenderTarget = renderTarget;\n _currentActiveCubeFace = activeCubeFace;\n _currentActiveMipmapLevel = activeMipmapLevel;\n var useDefaultFramebuffer = true;\n var framebuffer = null;\n var isCube = false;\n var isRenderTarget3D = false;\n if (renderTarget) {\n var renderTargetProperties = properties.get(renderTarget);\n if (renderTargetProperties.__useDefaultFramebuffer !== undefined) {\n // We need to make sure to rebind the framebuffer.\n state.bindFramebuffer(36160, null);\n useDefaultFramebuffer = false;\n } else if (renderTargetProperties.__webglFramebuffer === undefined) {\n textures.setupRenderTarget(renderTarget);\n } else if (renderTargetProperties.__hasExternalTextures) {\n // Color and depth texture must be rebound in order for the swapchain to update.\n textures.rebindTextures(renderTarget, properties.get(renderTarget.texture).__webglTexture, properties.get(renderTarget.depthTexture).__webglTexture);\n }\n var texture = renderTarget.texture;\n if (texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture) {\n isRenderTarget3D = true;\n }\n var __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer;\n if (renderTarget.isWebGLCubeRenderTarget) {\n framebuffer = __webglFramebuffer[activeCubeFace];\n isCube = true;\n } else if (capabilities.isWebGL2 && renderTarget.samples > 0 && textures.useMultisampledRTT(renderTarget) === false) {\n framebuffer = properties.get(renderTarget).__webglMultisampledFramebuffer;\n } else {\n framebuffer = __webglFramebuffer;\n }\n _currentViewport.copy(renderTarget.viewport);\n _currentScissor.copy(renderTarget.scissor);\n _currentScissorTest = renderTarget.scissorTest;\n } else {\n _currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor();\n _currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor();\n _currentScissorTest = _scissorTest;\n }\n var framebufferBound = state.bindFramebuffer(36160, framebuffer);\n if (framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer) {\n state.drawBuffers(renderTarget, framebuffer);\n }\n state.viewport(_currentViewport);\n state.scissor(_currentScissor);\n state.setScissorTest(_currentScissorTest);\n if (isCube) {\n var textureProperties = properties.get(renderTarget.texture);\n _gl.framebufferTexture2D(36160, 36064, 34069 + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel);\n } else if (isRenderTarget3D) {\n var _textureProperties = properties.get(renderTarget.texture);\n var layer = activeCubeFace || 0;\n _gl.framebufferTextureLayer(36160, 36064, _textureProperties.__webglTexture, activeMipmapLevel || 0, layer);\n }\n _currentMaterialId = -1; // reset current material to ensure correct uniform bindings\n };\n\n this.readRenderTargetPixels = function (renderTarget, x, y, width, height, buffer, activeCubeFaceIndex) {\n if (!(renderTarget && renderTarget.isWebGLRenderTarget)) {\n console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.');\n return;\n }\n var framebuffer = properties.get(renderTarget).__webglFramebuffer;\n if (renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined) {\n framebuffer = framebuffer[activeCubeFaceIndex];\n }\n if (framebuffer) {\n state.bindFramebuffer(36160, framebuffer);\n try {\n var texture = renderTarget.texture;\n var textureFormat = texture.format;\n var textureType = texture.type;\n if (textureFormat !== RGBAFormat && utils.convert(textureFormat) !== _gl.getParameter(35739)) {\n console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.');\n return;\n }\n var halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has('EXT_color_buffer_half_float') || capabilities.isWebGL2 && extensions.has('EXT_color_buffer_float'));\n if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(35738) &&\n // Edge and Chrome Mac < 52 (#9513)\n !(textureType === FloatType && (capabilities.isWebGL2 || extensions.has('OES_texture_float') || extensions.has('WEBGL_color_buffer_float'))) &&\n // Chrome Mac >= 52 and Firefox\n !halfFloatSupportedByExt) {\n console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.');\n return;\n }\n\n // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)\n\n if (x >= 0 && x <= renderTarget.width - width && y >= 0 && y <= renderTarget.height - height) {\n _gl.readPixels(x, y, width, height, utils.convert(textureFormat), utils.convert(textureType), buffer);\n }\n } finally {\n // restore framebuffer of current render target if necessary\n\n var _framebuffer = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null;\n state.bindFramebuffer(36160, _framebuffer);\n }\n }\n };\n this.copyFramebufferToTexture = function (position, texture) {\n var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var levelScale = Math.pow(2, -level);\n var width = Math.floor(texture.image.width * levelScale);\n var height = Math.floor(texture.image.height * levelScale);\n textures.setTexture2D(texture, 0);\n _gl.copyTexSubImage2D(3553, level, 0, 0, position.x, position.y, width, height);\n state.unbindTexture();\n };\n this.copyTextureToTexture = function (position, srcTexture, dstTexture) {\n var level = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n var width = srcTexture.image.width;\n var height = srcTexture.image.height;\n var glFormat = utils.convert(dstTexture.format);\n var glType = utils.convert(dstTexture.type);\n textures.setTexture2D(dstTexture, 0);\n\n // As another texture upload may have changed pixelStorei\n // parameters, make sure they are correct for the dstTexture\n _gl.pixelStorei(37440, dstTexture.flipY);\n _gl.pixelStorei(37441, dstTexture.premultiplyAlpha);\n _gl.pixelStorei(3317, dstTexture.unpackAlignment);\n if (srcTexture.isDataTexture) {\n _gl.texSubImage2D(3553, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data);\n } else {\n if (srcTexture.isCompressedTexture) {\n _gl.compressedTexSubImage2D(3553, level, position.x, position.y, srcTexture.mipmaps[0].width, srcTexture.mipmaps[0].height, glFormat, srcTexture.mipmaps[0].data);\n } else {\n _gl.texSubImage2D(3553, level, position.x, position.y, glFormat, glType, srcTexture.image);\n }\n }\n\n // Generate mipmaps only when copying level 0\n if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(3553);\n state.unbindTexture();\n };\n this.copyTextureToTexture3D = function (sourceBox, position, srcTexture, dstTexture) {\n var level = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n if (_this.isWebGL1Renderer) {\n console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.');\n return;\n }\n var width = sourceBox.max.x - sourceBox.min.x + 1;\n var height = sourceBox.max.y - sourceBox.min.y + 1;\n var depth = sourceBox.max.z - sourceBox.min.z + 1;\n var glFormat = utils.convert(dstTexture.format);\n var glType = utils.convert(dstTexture.type);\n var glTarget;\n if (dstTexture.isData3DTexture) {\n textures.setTexture3D(dstTexture, 0);\n glTarget = 32879;\n } else if (dstTexture.isDataArrayTexture) {\n textures.setTexture2DArray(dstTexture, 0);\n glTarget = 35866;\n } else {\n console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.');\n return;\n }\n _gl.pixelStorei(37440, dstTexture.flipY);\n _gl.pixelStorei(37441, dstTexture.premultiplyAlpha);\n _gl.pixelStorei(3317, dstTexture.unpackAlignment);\n var unpackRowLen = _gl.getParameter(3314);\n var unpackImageHeight = _gl.getParameter(32878);\n var unpackSkipPixels = _gl.getParameter(3316);\n var unpackSkipRows = _gl.getParameter(3315);\n var unpackSkipImages = _gl.getParameter(32877);\n var image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[0] : srcTexture.image;\n _gl.pixelStorei(3314, image.width);\n _gl.pixelStorei(32878, image.height);\n _gl.pixelStorei(3316, sourceBox.min.x);\n _gl.pixelStorei(3315, sourceBox.min.y);\n _gl.pixelStorei(32877, sourceBox.min.z);\n if (srcTexture.isDataTexture || srcTexture.isData3DTexture) {\n _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data);\n } else {\n if (srcTexture.isCompressedArrayTexture) {\n console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.');\n _gl.compressedTexSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data);\n } else {\n _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image);\n }\n }\n _gl.pixelStorei(3314, unpackRowLen);\n _gl.pixelStorei(32878, unpackImageHeight);\n _gl.pixelStorei(3316, unpackSkipPixels);\n _gl.pixelStorei(3315, unpackSkipRows);\n _gl.pixelStorei(32877, unpackSkipImages);\n\n // Generate mipmaps only when copying level 0\n if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(glTarget);\n state.unbindTexture();\n };\n this.initTexture = function (texture) {\n if (texture.isCubeTexture) {\n textures.setTextureCube(texture, 0);\n } else if (texture.isData3DTexture) {\n textures.setTexture3D(texture, 0);\n } else if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) {\n textures.setTexture2DArray(texture, 0);\n } else {\n textures.setTexture2D(texture, 0);\n }\n state.unbindTexture();\n };\n this.resetState = function () {\n _currentActiveCubeFace = 0;\n _currentActiveMipmapLevel = 0;\n _currentRenderTarget = null;\n state.reset();\n bindingStates.reset();\n };\n if (typeof __THREE_DEVTOOLS__ !== 'undefined') {\n __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', {\n detail: this\n }));\n }\n }\n _createClass(WebGLRenderer, [{\n key: \"physicallyCorrectLights\",\n get: function get() {\n // @deprecated, r150\n\n console.warn('THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.');\n return !this.useLegacyLights;\n },\n set: function set(value) {\n // @deprecated, r150\n\n console.warn('THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.');\n this.useLegacyLights = !value;\n }\n }]);\n return WebGLRenderer;\n}();\nvar WebGL1Renderer = /*#__PURE__*/function (_WebGLRenderer) {\n _inherits(WebGL1Renderer, _WebGLRenderer);\n var _super38 = _createSuper(WebGL1Renderer);\n function WebGL1Renderer() {\n _classCallCheck(this, WebGL1Renderer);\n return _super38.apply(this, arguments);\n }\n return _createClass(WebGL1Renderer);\n}(WebGLRenderer);\nWebGL1Renderer.prototype.isWebGL1Renderer = true;\nvar FogExp2 = /*#__PURE__*/function () {\n function FogExp2(color) {\n var density = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.00025;\n _classCallCheck(this, FogExp2);\n this.isFogExp2 = true;\n this.name = '';\n this.color = new Color(color);\n this.density = density;\n }\n _createClass(FogExp2, [{\n key: \"clone\",\n value: function clone() {\n return new FogExp2(this.color, this.density);\n }\n }, {\n key: \"toJSON\",\n value: function toJSON( /* meta */\n ) {\n return {\n type: 'FogExp2',\n color: this.color.getHex(),\n density: this.density\n };\n }\n }]);\n return FogExp2;\n}();\nvar Fog = /*#__PURE__*/function () {\n function Fog(color) {\n var near = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var far = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;\n _classCallCheck(this, Fog);\n this.isFog = true;\n this.name = '';\n this.color = new Color(color);\n this.near = near;\n this.far = far;\n }\n _createClass(Fog, [{\n key: \"clone\",\n value: function clone() {\n return new Fog(this.color, this.near, this.far);\n }\n }, {\n key: \"toJSON\",\n value: function toJSON( /* meta */\n ) {\n return {\n type: 'Fog',\n color: this.color.getHex(),\n near: this.near,\n far: this.far\n };\n }\n }]);\n return Fog;\n}();\nvar Scene = /*#__PURE__*/function (_Object3D5) {\n _inherits(Scene, _Object3D5);\n var _super39 = _createSuper(Scene);\n function Scene() {\n var _this30;\n _classCallCheck(this, Scene);\n _this30 = _super39.call(this);\n _this30.isScene = true;\n _this30.type = 'Scene';\n _this30.background = null;\n _this30.environment = null;\n _this30.fog = null;\n _this30.backgroundBlurriness = 0;\n _this30.backgroundIntensity = 1;\n _this30.overrideMaterial = null;\n if (typeof __THREE_DEVTOOLS__ !== 'undefined') {\n __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', {\n detail: _assertThisInitialized(_this30)\n }));\n }\n return _this30;\n }\n _createClass(Scene, [{\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(Scene.prototype), \"copy\", this).call(this, source, recursive);\n if (source.background !== null) this.background = source.background.clone();\n if (source.environment !== null) this.environment = source.environment.clone();\n if (source.fog !== null) this.fog = source.fog.clone();\n this.backgroundBlurriness = source.backgroundBlurriness;\n this.backgroundIntensity = source.backgroundIntensity;\n if (source.overrideMaterial !== null) this.overrideMaterial = source.overrideMaterial.clone();\n this.matrixAutoUpdate = source.matrixAutoUpdate;\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(meta) {\n var data = _get(_getPrototypeOf(Scene.prototype), \"toJSON\", this).call(this, meta);\n if (this.fog !== null) data.object.fog = this.fog.toJSON();\n if (this.backgroundBlurriness > 0) data.object.backgroundBlurriness = this.backgroundBlurriness;\n if (this.backgroundIntensity !== 1) data.object.backgroundIntensity = this.backgroundIntensity;\n return data;\n }\n }, {\n key: \"autoUpdate\",\n get: function get() {\n // @deprecated, r144\n\n console.warn('THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144.');\n return this.matrixWorldAutoUpdate;\n },\n set: function set(value) {\n // @deprecated, r144\n\n console.warn('THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144.');\n this.matrixWorldAutoUpdate = value;\n }\n }]);\n return Scene;\n}(Object3D);\nvar InterleavedBuffer = /*#__PURE__*/function () {\n function InterleavedBuffer(array, stride) {\n _classCallCheck(this, InterleavedBuffer);\n this.isInterleavedBuffer = true;\n this.array = array;\n this.stride = stride;\n this.count = array !== undefined ? array.length / stride : 0;\n this.usage = StaticDrawUsage;\n this.updateRange = {\n offset: 0,\n count: -1\n };\n this.version = 0;\n this.uuid = generateUUID();\n }\n _createClass(InterleavedBuffer, [{\n key: \"onUploadCallback\",\n value: function onUploadCallback() {}\n }, {\n key: \"needsUpdate\",\n set: function set(value) {\n if (value === true) this.version++;\n }\n }, {\n key: \"setUsage\",\n value: function setUsage(value) {\n this.usage = value;\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n this.array = new source.array.constructor(source.array);\n this.count = source.count;\n this.stride = source.stride;\n this.usage = source.usage;\n return this;\n }\n }, {\n key: \"copyAt\",\n value: function copyAt(index1, attribute, index2) {\n index1 *= this.stride;\n index2 *= attribute.stride;\n for (var i = 0, l = this.stride; i < l; i++) {\n this.array[index1 + i] = attribute.array[index2 + i];\n }\n return this;\n }\n }, {\n key: \"set\",\n value: function set(value) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n this.array.set(value, offset);\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone(data) {\n if (data.arrayBuffers === undefined) {\n data.arrayBuffers = {};\n }\n if (this.array.buffer._uuid === undefined) {\n this.array.buffer._uuid = generateUUID();\n }\n if (data.arrayBuffers[this.array.buffer._uuid] === undefined) {\n data.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer;\n }\n var array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]);\n var ib = new this.constructor(array, this.stride);\n ib.setUsage(this.usage);\n return ib;\n }\n }, {\n key: \"onUpload\",\n value: function onUpload(callback) {\n this.onUploadCallback = callback;\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(data) {\n if (data.arrayBuffers === undefined) {\n data.arrayBuffers = {};\n }\n\n // generate UUID for array buffer if necessary\n\n if (this.array.buffer._uuid === undefined) {\n this.array.buffer._uuid = generateUUID();\n }\n if (data.arrayBuffers[this.array.buffer._uuid] === undefined) {\n data.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer));\n }\n\n //\n\n return {\n uuid: this.uuid,\n buffer: this.array.buffer._uuid,\n type: this.array.constructor.name,\n stride: this.stride\n };\n }\n }]);\n return InterleavedBuffer;\n}();\nvar _vector$5 = /*@__PURE__*/new Vector3();\nvar InterleavedBufferAttribute = /*#__PURE__*/function () {\n function InterleavedBufferAttribute(interleavedBuffer, itemSize, offset) {\n var normalized = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n _classCallCheck(this, InterleavedBufferAttribute);\n this.isInterleavedBufferAttribute = true;\n this.name = '';\n this.data = interleavedBuffer;\n this.itemSize = itemSize;\n this.offset = offset;\n this.normalized = normalized;\n }\n _createClass(InterleavedBufferAttribute, [{\n key: \"count\",\n get: function get() {\n return this.data.count;\n }\n }, {\n key: \"array\",\n get: function get() {\n return this.data.array;\n }\n }, {\n key: \"needsUpdate\",\n set: function set(value) {\n this.data.needsUpdate = value;\n }\n }, {\n key: \"applyMatrix4\",\n value: function applyMatrix4(m) {\n for (var i = 0, l = this.data.count; i < l; i++) {\n _vector$5.fromBufferAttribute(this, i);\n _vector$5.applyMatrix4(m);\n this.setXYZ(i, _vector$5.x, _vector$5.y, _vector$5.z);\n }\n return this;\n }\n }, {\n key: \"applyNormalMatrix\",\n value: function applyNormalMatrix(m) {\n for (var i = 0, l = this.count; i < l; i++) {\n _vector$5.fromBufferAttribute(this, i);\n _vector$5.applyNormalMatrix(m);\n this.setXYZ(i, _vector$5.x, _vector$5.y, _vector$5.z);\n }\n return this;\n }\n }, {\n key: \"transformDirection\",\n value: function transformDirection(m) {\n for (var i = 0, l = this.count; i < l; i++) {\n _vector$5.fromBufferAttribute(this, i);\n _vector$5.transformDirection(m);\n this.setXYZ(i, _vector$5.x, _vector$5.y, _vector$5.z);\n }\n return this;\n }\n }, {\n key: \"setX\",\n value: function setX(index, x) {\n if (this.normalized) x = normalize(x, this.array);\n this.data.array[index * this.data.stride + this.offset] = x;\n return this;\n }\n }, {\n key: \"setY\",\n value: function setY(index, y) {\n if (this.normalized) y = normalize(y, this.array);\n this.data.array[index * this.data.stride + this.offset + 1] = y;\n return this;\n }\n }, {\n key: \"setZ\",\n value: function setZ(index, z) {\n if (this.normalized) z = normalize(z, this.array);\n this.data.array[index * this.data.stride + this.offset + 2] = z;\n return this;\n }\n }, {\n key: \"setW\",\n value: function setW(index, w) {\n if (this.normalized) w = normalize(w, this.array);\n this.data.array[index * this.data.stride + this.offset + 3] = w;\n return this;\n }\n }, {\n key: \"getX\",\n value: function getX(index) {\n var x = this.data.array[index * this.data.stride + this.offset];\n if (this.normalized) x = denormalize(x, this.array);\n return x;\n }\n }, {\n key: \"getY\",\n value: function getY(index) {\n var y = this.data.array[index * this.data.stride + this.offset + 1];\n if (this.normalized) y = denormalize(y, this.array);\n return y;\n }\n }, {\n key: \"getZ\",\n value: function getZ(index) {\n var z = this.data.array[index * this.data.stride + this.offset + 2];\n if (this.normalized) z = denormalize(z, this.array);\n return z;\n }\n }, {\n key: \"getW\",\n value: function getW(index) {\n var w = this.data.array[index * this.data.stride + this.offset + 3];\n if (this.normalized) w = denormalize(w, this.array);\n return w;\n }\n }, {\n key: \"setXY\",\n value: function setXY(index, x, y) {\n index = index * this.data.stride + this.offset;\n if (this.normalized) {\n x = normalize(x, this.array);\n y = normalize(y, this.array);\n }\n this.data.array[index + 0] = x;\n this.data.array[index + 1] = y;\n return this;\n }\n }, {\n key: \"setXYZ\",\n value: function setXYZ(index, x, y, z) {\n index = index * this.data.stride + this.offset;\n if (this.normalized) {\n x = normalize(x, this.array);\n y = normalize(y, this.array);\n z = normalize(z, this.array);\n }\n this.data.array[index + 0] = x;\n this.data.array[index + 1] = y;\n this.data.array[index + 2] = z;\n return this;\n }\n }, {\n key: \"setXYZW\",\n value: function setXYZW(index, x, y, z, w) {\n index = index * this.data.stride + this.offset;\n if (this.normalized) {\n x = normalize(x, this.array);\n y = normalize(y, this.array);\n z = normalize(z, this.array);\n w = normalize(w, this.array);\n }\n this.data.array[index + 0] = x;\n this.data.array[index + 1] = y;\n this.data.array[index + 2] = z;\n this.data.array[index + 3] = w;\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone(data) {\n if (data === undefined) {\n console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.');\n var array = [];\n for (var i = 0; i < this.count; i++) {\n var index = i * this.data.stride + this.offset;\n for (var j = 0; j < this.itemSize; j++) {\n array.push(this.data.array[index + j]);\n }\n }\n return new BufferAttribute(new this.array.constructor(array), this.itemSize, this.normalized);\n } else {\n if (data.interleavedBuffers === undefined) {\n data.interleavedBuffers = {};\n }\n if (data.interleavedBuffers[this.data.uuid] === undefined) {\n data.interleavedBuffers[this.data.uuid] = this.data.clone(data);\n }\n return new InterleavedBufferAttribute(data.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized);\n }\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(data) {\n if (data === undefined) {\n console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.');\n var array = [];\n for (var i = 0; i < this.count; i++) {\n var index = i * this.data.stride + this.offset;\n for (var j = 0; j < this.itemSize; j++) {\n array.push(this.data.array[index + j]);\n }\n }\n\n // de-interleave data and save it as an ordinary buffer attribute for now\n\n return {\n itemSize: this.itemSize,\n type: this.array.constructor.name,\n array: array,\n normalized: this.normalized\n };\n } else {\n // save as true interleaved attribute\n\n if (data.interleavedBuffers === undefined) {\n data.interleavedBuffers = {};\n }\n if (data.interleavedBuffers[this.data.uuid] === undefined) {\n data.interleavedBuffers[this.data.uuid] = this.data.toJSON(data);\n }\n return {\n isInterleavedBufferAttribute: true,\n itemSize: this.itemSize,\n data: this.data.uuid,\n offset: this.offset,\n normalized: this.normalized\n };\n }\n }\n }]);\n return InterleavedBufferAttribute;\n}();\nvar SpriteMaterial = /*#__PURE__*/function (_Material5) {\n _inherits(SpriteMaterial, _Material5);\n var _super40 = _createSuper(SpriteMaterial);\n function SpriteMaterial(parameters) {\n var _this31;\n _classCallCheck(this, SpriteMaterial);\n _this31 = _super40.call(this);\n _this31.isSpriteMaterial = true;\n _this31.type = 'SpriteMaterial';\n _this31.color = new Color(0xffffff);\n _this31.map = null;\n _this31.alphaMap = null;\n _this31.rotation = 0;\n _this31.sizeAttenuation = true;\n _this31.transparent = true;\n _this31.fog = true;\n _this31.setValues(parameters);\n return _this31;\n }\n _createClass(SpriteMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(SpriteMaterial.prototype), \"copy\", this).call(this, source);\n this.color.copy(source.color);\n this.map = source.map;\n this.alphaMap = source.alphaMap;\n this.rotation = source.rotation;\n this.sizeAttenuation = source.sizeAttenuation;\n this.fog = source.fog;\n return this;\n }\n }]);\n return SpriteMaterial;\n}(Material);\nvar _geometry;\nvar _intersectPoint = /*@__PURE__*/new Vector3();\nvar _worldScale = /*@__PURE__*/new Vector3();\nvar _mvPosition = /*@__PURE__*/new Vector3();\nvar _alignedPosition = /*@__PURE__*/new Vector2();\nvar _rotatedPosition = /*@__PURE__*/new Vector2();\nvar _viewWorldMatrix = /*@__PURE__*/new Matrix4();\nvar _vA = /*@__PURE__*/new Vector3();\nvar _vB = /*@__PURE__*/new Vector3();\nvar _vC = /*@__PURE__*/new Vector3();\nvar _uvA = /*@__PURE__*/new Vector2();\nvar _uvB = /*@__PURE__*/new Vector2();\nvar _uvC = /*@__PURE__*/new Vector2();\nvar Sprite = /*#__PURE__*/function (_Object3D6) {\n _inherits(Sprite, _Object3D6);\n var _super41 = _createSuper(Sprite);\n function Sprite(material) {\n var _this32;\n _classCallCheck(this, Sprite);\n _this32 = _super41.call(this);\n _this32.isSprite = true;\n _this32.type = 'Sprite';\n if (_geometry === undefined) {\n _geometry = new BufferGeometry();\n var float32Array = new Float32Array([-0.5, -0.5, 0, 0, 0, 0.5, -0.5, 0, 1, 0, 0.5, 0.5, 0, 1, 1, -0.5, 0.5, 0, 0, 1]);\n var interleavedBuffer = new InterleavedBuffer(float32Array, 5);\n _geometry.setIndex([0, 1, 2, 0, 2, 3]);\n _geometry.setAttribute('position', new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false));\n _geometry.setAttribute('uv', new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false));\n }\n _this32.geometry = _geometry;\n _this32.material = material !== undefined ? material : new SpriteMaterial();\n _this32.center = new Vector2(0.5, 0.5);\n return _this32;\n }\n _createClass(Sprite, [{\n key: \"raycast\",\n value: function raycast(raycaster, intersects) {\n if (raycaster.camera === null) {\n console.error('THREE.Sprite: \"Raycaster.camera\" needs to be set in order to raycast against sprites.');\n }\n _worldScale.setFromMatrixScale(this.matrixWorld);\n _viewWorldMatrix.copy(raycaster.camera.matrixWorld);\n this.modelViewMatrix.multiplyMatrices(raycaster.camera.matrixWorldInverse, this.matrixWorld);\n _mvPosition.setFromMatrixPosition(this.modelViewMatrix);\n if (raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false) {\n _worldScale.multiplyScalar(-_mvPosition.z);\n }\n var rotation = this.material.rotation;\n var sin, cos;\n if (rotation !== 0) {\n cos = Math.cos(rotation);\n sin = Math.sin(rotation);\n }\n var center = this.center;\n transformVertex(_vA.set(-0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos);\n transformVertex(_vB.set(0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos);\n transformVertex(_vC.set(0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos);\n _uvA.set(0, 0);\n _uvB.set(1, 0);\n _uvC.set(1, 1);\n\n // check first triangle\n var intersect = raycaster.ray.intersectTriangle(_vA, _vB, _vC, false, _intersectPoint);\n if (intersect === null) {\n // check second triangle\n transformVertex(_vB.set(-0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos);\n _uvB.set(0, 1);\n intersect = raycaster.ray.intersectTriangle(_vA, _vC, _vB, false, _intersectPoint);\n if (intersect === null) {\n return;\n }\n }\n var distance = raycaster.ray.origin.distanceTo(_intersectPoint);\n if (distance < raycaster.near || distance > raycaster.far) return;\n intersects.push({\n distance: distance,\n point: _intersectPoint.clone(),\n uv: Triangle.getInterpolation(_intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2()),\n face: null,\n object: this\n });\n }\n }, {\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(Sprite.prototype), \"copy\", this).call(this, source, recursive);\n if (source.center !== undefined) this.center.copy(source.center);\n this.material = source.material;\n return this;\n }\n }]);\n return Sprite;\n}(Object3D);\nfunction transformVertex(vertexPosition, mvPosition, center, scale, sin, cos) {\n // compute position in camera space\n _alignedPosition.subVectors(vertexPosition, center).addScalar(0.5).multiply(scale);\n\n // to check if rotation is not zero\n if (sin !== undefined) {\n _rotatedPosition.x = cos * _alignedPosition.x - sin * _alignedPosition.y;\n _rotatedPosition.y = sin * _alignedPosition.x + cos * _alignedPosition.y;\n } else {\n _rotatedPosition.copy(_alignedPosition);\n }\n vertexPosition.copy(mvPosition);\n vertexPosition.x += _rotatedPosition.x;\n vertexPosition.y += _rotatedPosition.y;\n\n // transform to world space\n vertexPosition.applyMatrix4(_viewWorldMatrix);\n}\nvar _v1$2 = /*@__PURE__*/new Vector3();\nvar _v2$1 = /*@__PURE__*/new Vector3();\nvar LOD = /*#__PURE__*/function (_Object3D7) {\n _inherits(LOD, _Object3D7);\n var _super42 = _createSuper(LOD);\n function LOD() {\n var _this33;\n _classCallCheck(this, LOD);\n _this33 = _super42.call(this);\n _this33._currentLevel = 0;\n _this33.type = 'LOD';\n Object.defineProperties(_assertThisInitialized(_this33), {\n levels: {\n enumerable: true,\n value: []\n },\n isLOD: {\n value: true\n }\n });\n _this33.autoUpdate = true;\n return _this33;\n }\n _createClass(LOD, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(LOD.prototype), \"copy\", this).call(this, source, false);\n var levels = source.levels;\n for (var i = 0, l = levels.length; i < l; i++) {\n var level = levels[i];\n this.addLevel(level.object.clone(), level.distance, level.hysteresis);\n }\n this.autoUpdate = source.autoUpdate;\n return this;\n }\n }, {\n key: \"addLevel\",\n value: function addLevel(object) {\n var distance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var hysteresis = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n distance = Math.abs(distance);\n var levels = this.levels;\n var l;\n for (l = 0; l < levels.length; l++) {\n if (distance < levels[l].distance) {\n break;\n }\n }\n levels.splice(l, 0, {\n distance: distance,\n hysteresis: hysteresis,\n object: object\n });\n this.add(object);\n return this;\n }\n }, {\n key: \"getCurrentLevel\",\n value: function getCurrentLevel() {\n return this._currentLevel;\n }\n }, {\n key: \"getObjectForDistance\",\n value: function getObjectForDistance(distance) {\n var levels = this.levels;\n if (levels.length > 0) {\n var i, l;\n for (i = 1, l = levels.length; i < l; i++) {\n var levelDistance = levels[i].distance;\n if (levels[i].object.visible) {\n levelDistance -= levelDistance * levels[i].hysteresis;\n }\n if (distance < levelDistance) {\n break;\n }\n }\n return levels[i - 1].object;\n }\n return null;\n }\n }, {\n key: \"raycast\",\n value: function raycast(raycaster, intersects) {\n var levels = this.levels;\n if (levels.length > 0) {\n _v1$2.setFromMatrixPosition(this.matrixWorld);\n var distance = raycaster.ray.origin.distanceTo(_v1$2);\n this.getObjectForDistance(distance).raycast(raycaster, intersects);\n }\n }\n }, {\n key: \"update\",\n value: function update(camera) {\n var levels = this.levels;\n if (levels.length > 1) {\n _v1$2.setFromMatrixPosition(camera.matrixWorld);\n _v2$1.setFromMatrixPosition(this.matrixWorld);\n var distance = _v1$2.distanceTo(_v2$1) / camera.zoom;\n levels[0].object.visible = true;\n var i, l;\n for (i = 1, l = levels.length; i < l; i++) {\n var levelDistance = levels[i].distance;\n if (levels[i].object.visible) {\n levelDistance -= levelDistance * levels[i].hysteresis;\n }\n if (distance >= levelDistance) {\n levels[i - 1].object.visible = false;\n levels[i].object.visible = true;\n } else {\n break;\n }\n }\n this._currentLevel = i - 1;\n for (; i < l; i++) {\n levels[i].object.visible = false;\n }\n }\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(meta) {\n var data = _get(_getPrototypeOf(LOD.prototype), \"toJSON\", this).call(this, meta);\n if (this.autoUpdate === false) data.object.autoUpdate = false;\n data.object.levels = [];\n var levels = this.levels;\n for (var i = 0, l = levels.length; i < l; i++) {\n var level = levels[i];\n data.object.levels.push({\n object: level.object.uuid,\n distance: level.distance,\n hysteresis: level.hysteresis\n });\n }\n return data;\n }\n }]);\n return LOD;\n}(Object3D);\nvar _basePosition = /*@__PURE__*/new Vector3();\nvar _skinIndex = /*@__PURE__*/new Vector4();\nvar _skinWeight = /*@__PURE__*/new Vector4();\nvar _vector3 = /*@__PURE__*/new Vector3();\nvar _matrix4 = /*@__PURE__*/new Matrix4();\nvar _vertex = /*@__PURE__*/new Vector3();\nvar SkinnedMesh = /*#__PURE__*/function (_Mesh) {\n _inherits(SkinnedMesh, _Mesh);\n var _super43 = _createSuper(SkinnedMesh);\n function SkinnedMesh(geometry, material) {\n var _this34;\n _classCallCheck(this, SkinnedMesh);\n _this34 = _super43.call(this, geometry, material);\n _this34.isSkinnedMesh = true;\n _this34.type = 'SkinnedMesh';\n _this34.bindMode = 'attached';\n _this34.bindMatrix = new Matrix4();\n _this34.bindMatrixInverse = new Matrix4();\n _this34.boundingBox = null;\n _this34.boundingSphere = null;\n return _this34;\n }\n _createClass(SkinnedMesh, [{\n key: \"computeBoundingBox\",\n value: function computeBoundingBox() {\n var geometry = this.geometry;\n if (this.boundingBox === null) {\n this.boundingBox = new Box3();\n }\n this.boundingBox.makeEmpty();\n var positionAttribute = geometry.getAttribute('position');\n for (var i = 0; i < positionAttribute.count; i++) {\n _vertex.fromBufferAttribute(positionAttribute, i);\n this.applyBoneTransform(i, _vertex);\n this.boundingBox.expandByPoint(_vertex);\n }\n }\n }, {\n key: \"computeBoundingSphere\",\n value: function computeBoundingSphere() {\n var geometry = this.geometry;\n if (this.boundingSphere === null) {\n this.boundingSphere = new Sphere();\n }\n this.boundingSphere.makeEmpty();\n var positionAttribute = geometry.getAttribute('position');\n for (var i = 0; i < positionAttribute.count; i++) {\n _vertex.fromBufferAttribute(positionAttribute, i);\n this.applyBoneTransform(i, _vertex);\n this.boundingSphere.expandByPoint(_vertex);\n }\n }\n }, {\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(SkinnedMesh.prototype), \"copy\", this).call(this, source, recursive);\n this.bindMode = source.bindMode;\n this.bindMatrix.copy(source.bindMatrix);\n this.bindMatrixInverse.copy(source.bindMatrixInverse);\n this.skeleton = source.skeleton;\n return this;\n }\n }, {\n key: \"bind\",\n value: function bind(skeleton, bindMatrix) {\n this.skeleton = skeleton;\n if (bindMatrix === undefined) {\n this.updateMatrixWorld(true);\n this.skeleton.calculateInverses();\n bindMatrix = this.matrixWorld;\n }\n this.bindMatrix.copy(bindMatrix);\n this.bindMatrixInverse.copy(bindMatrix).invert();\n }\n }, {\n key: \"pose\",\n value: function pose() {\n this.skeleton.pose();\n }\n }, {\n key: \"normalizeSkinWeights\",\n value: function normalizeSkinWeights() {\n var vector = new Vector4();\n var skinWeight = this.geometry.attributes.skinWeight;\n for (var i = 0, l = skinWeight.count; i < l; i++) {\n vector.fromBufferAttribute(skinWeight, i);\n var scale = 1.0 / vector.manhattanLength();\n if (scale !== Infinity) {\n vector.multiplyScalar(scale);\n } else {\n vector.set(1, 0, 0, 0); // do something reasonable\n }\n\n skinWeight.setXYZW(i, vector.x, vector.y, vector.z, vector.w);\n }\n }\n }, {\n key: \"updateMatrixWorld\",\n value: function updateMatrixWorld(force) {\n _get(_getPrototypeOf(SkinnedMesh.prototype), \"updateMatrixWorld\", this).call(this, force);\n if (this.bindMode === 'attached') {\n this.bindMatrixInverse.copy(this.matrixWorld).invert();\n } else if (this.bindMode === 'detached') {\n this.bindMatrixInverse.copy(this.bindMatrix).invert();\n } else {\n console.warn('THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode);\n }\n }\n }, {\n key: \"applyBoneTransform\",\n value: function applyBoneTransform(index, vector) {\n var skeleton = this.skeleton;\n var geometry = this.geometry;\n _skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index);\n _skinWeight.fromBufferAttribute(geometry.attributes.skinWeight, index);\n _basePosition.copy(vector).applyMatrix4(this.bindMatrix);\n vector.set(0, 0, 0);\n for (var i = 0; i < 4; i++) {\n var weight = _skinWeight.getComponent(i);\n if (weight !== 0) {\n var boneIndex = _skinIndex.getComponent(i);\n _matrix4.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]);\n vector.addScaledVector(_vector3.copy(_basePosition).applyMatrix4(_matrix4), weight);\n }\n }\n return vector.applyMatrix4(this.bindMatrixInverse);\n }\n }, {\n key: \"boneTransform\",\n value: function boneTransform(index, vector) {\n // @deprecated, r151\n\n console.warn('THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151.');\n return this.applyBoneTransform(index, vector);\n }\n }]);\n return SkinnedMesh;\n}(Mesh);\nvar Bone = /*#__PURE__*/function (_Object3D8) {\n _inherits(Bone, _Object3D8);\n var _super44 = _createSuper(Bone);\n function Bone() {\n var _this35;\n _classCallCheck(this, Bone);\n _this35 = _super44.call(this);\n _this35.isBone = true;\n _this35.type = 'Bone';\n return _this35;\n }\n return _createClass(Bone);\n}(Object3D);\nvar DataTexture = /*#__PURE__*/function (_Texture5) {\n _inherits(DataTexture, _Texture5);\n var _super45 = _createSuper(DataTexture);\n function DataTexture() {\n var _this36;\n var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var format = arguments.length > 3 ? arguments[3] : undefined;\n var type = arguments.length > 4 ? arguments[4] : undefined;\n var mapping = arguments.length > 5 ? arguments[5] : undefined;\n var wrapS = arguments.length > 6 ? arguments[6] : undefined;\n var wrapT = arguments.length > 7 ? arguments[7] : undefined;\n var magFilter = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : NearestFilter;\n var minFilter = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : NearestFilter;\n var anisotropy = arguments.length > 10 ? arguments[10] : undefined;\n var encoding = arguments.length > 11 ? arguments[11] : undefined;\n _classCallCheck(this, DataTexture);\n _this36 = _super45.call(this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding);\n _this36.isDataTexture = true;\n _this36.image = {\n data: data,\n width: width,\n height: height\n };\n _this36.generateMipmaps = false;\n _this36.flipY = false;\n _this36.unpackAlignment = 1;\n return _this36;\n }\n return _createClass(DataTexture);\n}(Texture);\nvar _offsetMatrix = /*@__PURE__*/new Matrix4();\nvar _identityMatrix = /*@__PURE__*/new Matrix4();\nvar Skeleton = /*#__PURE__*/function () {\n function Skeleton() {\n var bones = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var boneInverses = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n _classCallCheck(this, Skeleton);\n this.uuid = generateUUID();\n this.bones = bones.slice(0);\n this.boneInverses = boneInverses;\n this.boneMatrices = null;\n this.boneTexture = null;\n this.boneTextureSize = 0;\n this.frame = -1;\n this.init();\n }\n _createClass(Skeleton, [{\n key: \"init\",\n value: function init() {\n var bones = this.bones;\n var boneInverses = this.boneInverses;\n this.boneMatrices = new Float32Array(bones.length * 16);\n\n // calculate inverse bone matrices if necessary\n\n if (boneInverses.length === 0) {\n this.calculateInverses();\n } else {\n // handle special case\n\n if (bones.length !== boneInverses.length) {\n console.warn('THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.');\n this.boneInverses = [];\n for (var i = 0, il = this.bones.length; i < il; i++) {\n this.boneInverses.push(new Matrix4());\n }\n }\n }\n }\n }, {\n key: \"calculateInverses\",\n value: function calculateInverses() {\n this.boneInverses.length = 0;\n for (var i = 0, il = this.bones.length; i < il; i++) {\n var inverse = new Matrix4();\n if (this.bones[i]) {\n inverse.copy(this.bones[i].matrixWorld).invert();\n }\n this.boneInverses.push(inverse);\n }\n }\n }, {\n key: \"pose\",\n value: function pose() {\n // recover the bind-time world matrices\n\n for (var i = 0, il = this.bones.length; i < il; i++) {\n var bone = this.bones[i];\n if (bone) {\n bone.matrixWorld.copy(this.boneInverses[i]).invert();\n }\n }\n\n // compute the local matrices, positions, rotations and scales\n\n for (var _i59 = 0, _il13 = this.bones.length; _i59 < _il13; _i59++) {\n var _bone = this.bones[_i59];\n if (_bone) {\n if (_bone.parent && _bone.parent.isBone) {\n _bone.matrix.copy(_bone.parent.matrixWorld).invert();\n _bone.matrix.multiply(_bone.matrixWorld);\n } else {\n _bone.matrix.copy(_bone.matrixWorld);\n }\n _bone.matrix.decompose(_bone.position, _bone.quaternion, _bone.scale);\n }\n }\n }\n }, {\n key: \"update\",\n value: function update() {\n var bones = this.bones;\n var boneInverses = this.boneInverses;\n var boneMatrices = this.boneMatrices;\n var boneTexture = this.boneTexture;\n\n // flatten bone matrices to array\n\n for (var i = 0, il = bones.length; i < il; i++) {\n // compute the offset between the current and the original transform\n\n var matrix = bones[i] ? bones[i].matrixWorld : _identityMatrix;\n _offsetMatrix.multiplyMatrices(matrix, boneInverses[i]);\n _offsetMatrix.toArray(boneMatrices, i * 16);\n }\n if (boneTexture !== null) {\n boneTexture.needsUpdate = true;\n }\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new Skeleton(this.bones, this.boneInverses);\n }\n }, {\n key: \"computeBoneTexture\",\n value: function computeBoneTexture() {\n // layout (1 matrix = 4 pixels)\n // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)\n // with 8x8 pixel texture max 16 bones * 4 pixels = (8 * 8)\n // 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16)\n // 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32)\n // 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)\n\n var size = Math.sqrt(this.bones.length * 4); // 4 pixels needed for 1 matrix\n size = ceilPowerOfTwo(size);\n size = Math.max(size, 4);\n var boneMatrices = new Float32Array(size * size * 4); // 4 floats per RGBA pixel\n boneMatrices.set(this.boneMatrices); // copy current values\n\n var boneTexture = new DataTexture(boneMatrices, size, size, RGBAFormat, FloatType);\n boneTexture.needsUpdate = true;\n this.boneMatrices = boneMatrices;\n this.boneTexture = boneTexture;\n this.boneTextureSize = size;\n return this;\n }\n }, {\n key: \"getBoneByName\",\n value: function getBoneByName(name) {\n for (var i = 0, il = this.bones.length; i < il; i++) {\n var bone = this.bones[i];\n if (bone.name === name) {\n return bone;\n }\n }\n return undefined;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n if (this.boneTexture !== null) {\n this.boneTexture.dispose();\n this.boneTexture = null;\n }\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json, bones) {\n this.uuid = json.uuid;\n for (var i = 0, l = json.bones.length; i < l; i++) {\n var uuid = json.bones[i];\n var bone = bones[uuid];\n if (bone === undefined) {\n console.warn('THREE.Skeleton: No bone found with UUID:', uuid);\n bone = new Bone();\n }\n this.bones.push(bone);\n this.boneInverses.push(new Matrix4().fromArray(json.boneInverses[i]));\n }\n this.init();\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = {\n metadata: {\n version: 4.5,\n type: 'Skeleton',\n generator: 'Skeleton.toJSON'\n },\n bones: [],\n boneInverses: []\n };\n data.uuid = this.uuid;\n var bones = this.bones;\n var boneInverses = this.boneInverses;\n for (var i = 0, l = bones.length; i < l; i++) {\n var bone = bones[i];\n data.bones.push(bone.uuid);\n var boneInverse = boneInverses[i];\n data.boneInverses.push(boneInverse.toArray());\n }\n return data;\n }\n }]);\n return Skeleton;\n}();\nvar InstancedBufferAttribute = /*#__PURE__*/function (_BufferAttribute11) {\n _inherits(InstancedBufferAttribute, _BufferAttribute11);\n var _super46 = _createSuper(InstancedBufferAttribute);\n function InstancedBufferAttribute(array, itemSize, normalized) {\n var _this37;\n var meshPerAttribute = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n _classCallCheck(this, InstancedBufferAttribute);\n _this37 = _super46.call(this, array, itemSize, normalized);\n _this37.isInstancedBufferAttribute = true;\n _this37.meshPerAttribute = meshPerAttribute;\n return _this37;\n }\n _createClass(InstancedBufferAttribute, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(InstancedBufferAttribute.prototype), \"copy\", this).call(this, source);\n this.meshPerAttribute = source.meshPerAttribute;\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(InstancedBufferAttribute.prototype), \"toJSON\", this).call(this);\n data.meshPerAttribute = this.meshPerAttribute;\n data.isInstancedBufferAttribute = true;\n return data;\n }\n }]);\n return InstancedBufferAttribute;\n}(BufferAttribute);\nvar _instanceLocalMatrix = /*@__PURE__*/new Matrix4();\nvar _instanceWorldMatrix = /*@__PURE__*/new Matrix4();\nvar _instanceIntersects = [];\nvar _box3 = /*@__PURE__*/new Box3();\nvar _identity = /*@__PURE__*/new Matrix4();\nvar _mesh = /*@__PURE__*/new Mesh();\nvar _sphere$2 = /*@__PURE__*/new Sphere();\nvar InstancedMesh = /*#__PURE__*/function (_Mesh2) {\n _inherits(InstancedMesh, _Mesh2);\n var _super47 = _createSuper(InstancedMesh);\n function InstancedMesh(geometry, material, count) {\n var _this38;\n _classCallCheck(this, InstancedMesh);\n _this38 = _super47.call(this, geometry, material);\n _this38.isInstancedMesh = true;\n _this38.instanceMatrix = new InstancedBufferAttribute(new Float32Array(count * 16), 16);\n _this38.instanceColor = null;\n _this38.count = count;\n _this38.boundingBox = null;\n _this38.boundingSphere = null;\n for (var i = 0; i < count; i++) {\n _this38.setMatrixAt(i, _identity);\n }\n return _this38;\n }\n _createClass(InstancedMesh, [{\n key: \"computeBoundingBox\",\n value: function computeBoundingBox() {\n var geometry = this.geometry;\n var count = this.count;\n if (this.boundingBox === null) {\n this.boundingBox = new Box3();\n }\n if (geometry.boundingBox === null) {\n geometry.computeBoundingBox();\n }\n this.boundingBox.makeEmpty();\n for (var i = 0; i < count; i++) {\n this.getMatrixAt(i, _instanceLocalMatrix);\n _box3.copy(geometry.boundingBox).applyMatrix4(_instanceLocalMatrix);\n this.boundingBox.union(_box3);\n }\n }\n }, {\n key: \"computeBoundingSphere\",\n value: function computeBoundingSphere() {\n var geometry = this.geometry;\n var count = this.count;\n if (this.boundingSphere === null) {\n this.boundingSphere = new Sphere();\n }\n if (geometry.boundingSphere === null) {\n geometry.computeBoundingSphere();\n }\n this.boundingSphere.makeEmpty();\n for (var i = 0; i < count; i++) {\n this.getMatrixAt(i, _instanceLocalMatrix);\n _sphere$2.copy(geometry.boundingSphere).applyMatrix4(_instanceLocalMatrix);\n this.boundingSphere.union(_sphere$2);\n }\n }\n }, {\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(InstancedMesh.prototype), \"copy\", this).call(this, source, recursive);\n this.instanceMatrix.copy(source.instanceMatrix);\n if (source.instanceColor !== null) this.instanceColor = source.instanceColor.clone();\n this.count = source.count;\n return this;\n }\n }, {\n key: \"getColorAt\",\n value: function getColorAt(index, color) {\n color.fromArray(this.instanceColor.array, index * 3);\n }\n }, {\n key: \"getMatrixAt\",\n value: function getMatrixAt(index, matrix) {\n matrix.fromArray(this.instanceMatrix.array, index * 16);\n }\n }, {\n key: \"raycast\",\n value: function raycast(raycaster, intersects) {\n var matrixWorld = this.matrixWorld;\n var raycastTimes = this.count;\n _mesh.geometry = this.geometry;\n _mesh.material = this.material;\n if (_mesh.material === undefined) return;\n\n // test with bounding sphere first\n\n if (this.boundingSphere === null) this.computeBoundingSphere();\n _sphere$2.copy(this.boundingSphere);\n _sphere$2.applyMatrix4(matrixWorld);\n if (raycaster.ray.intersectsSphere(_sphere$2) === false) return;\n\n // now test each instance\n\n for (var instanceId = 0; instanceId < raycastTimes; instanceId++) {\n // calculate the world matrix for each instance\n\n this.getMatrixAt(instanceId, _instanceLocalMatrix);\n _instanceWorldMatrix.multiplyMatrices(matrixWorld, _instanceLocalMatrix);\n\n // the mesh represents this single instance\n\n _mesh.matrixWorld = _instanceWorldMatrix;\n _mesh.raycast(raycaster, _instanceIntersects);\n\n // process the result of raycast\n\n for (var i = 0, l = _instanceIntersects.length; i < l; i++) {\n var intersect = _instanceIntersects[i];\n intersect.instanceId = instanceId;\n intersect.object = this;\n intersects.push(intersect);\n }\n _instanceIntersects.length = 0;\n }\n }\n }, {\n key: \"setColorAt\",\n value: function setColorAt(index, color) {\n if (this.instanceColor === null) {\n this.instanceColor = new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count * 3), 3);\n }\n color.toArray(this.instanceColor.array, index * 3);\n }\n }, {\n key: \"setMatrixAt\",\n value: function setMatrixAt(index, matrix) {\n matrix.toArray(this.instanceMatrix.array, index * 16);\n }\n }, {\n key: \"updateMorphTargets\",\n value: function updateMorphTargets() {}\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.dispatchEvent({\n type: 'dispose'\n });\n }\n }]);\n return InstancedMesh;\n}(Mesh);\nvar LineBasicMaterial = /*#__PURE__*/function (_Material6) {\n _inherits(LineBasicMaterial, _Material6);\n var _super48 = _createSuper(LineBasicMaterial);\n function LineBasicMaterial(parameters) {\n var _this39;\n _classCallCheck(this, LineBasicMaterial);\n _this39 = _super48.call(this);\n _this39.isLineBasicMaterial = true;\n _this39.type = 'LineBasicMaterial';\n _this39.color = new Color(0xffffff);\n _this39.map = null;\n _this39.linewidth = 1;\n _this39.linecap = 'round';\n _this39.linejoin = 'round';\n _this39.fog = true;\n _this39.setValues(parameters);\n return _this39;\n }\n _createClass(LineBasicMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(LineBasicMaterial.prototype), \"copy\", this).call(this, source);\n this.color.copy(source.color);\n this.map = source.map;\n this.linewidth = source.linewidth;\n this.linecap = source.linecap;\n this.linejoin = source.linejoin;\n this.fog = source.fog;\n return this;\n }\n }]);\n return LineBasicMaterial;\n}(Material);\nvar _start$1 = /*@__PURE__*/new Vector3();\nvar _end$1 = /*@__PURE__*/new Vector3();\nvar _inverseMatrix$1 = /*@__PURE__*/new Matrix4();\nvar _ray$1 = /*@__PURE__*/new Ray();\nvar _sphere$1 = /*@__PURE__*/new Sphere();\nvar Line = /*#__PURE__*/function (_Object3D9) {\n _inherits(Line, _Object3D9);\n var _super49 = _createSuper(Line);\n function Line() {\n var _this40;\n var geometry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new BufferGeometry();\n var material = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new LineBasicMaterial();\n _classCallCheck(this, Line);\n _this40 = _super49.call(this);\n _this40.isLine = true;\n _this40.type = 'Line';\n _this40.geometry = geometry;\n _this40.material = material;\n _this40.updateMorphTargets();\n return _this40;\n }\n _createClass(Line, [{\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(Line.prototype), \"copy\", this).call(this, source, recursive);\n this.material = source.material;\n this.geometry = source.geometry;\n return this;\n }\n }, {\n key: \"computeLineDistances\",\n value: function computeLineDistances() {\n var geometry = this.geometry;\n\n // we assume non-indexed geometry\n\n if (geometry.index === null) {\n var positionAttribute = geometry.attributes.position;\n var lineDistances = [0];\n for (var i = 1, l = positionAttribute.count; i < l; i++) {\n _start$1.fromBufferAttribute(positionAttribute, i - 1);\n _end$1.fromBufferAttribute(positionAttribute, i);\n lineDistances[i] = lineDistances[i - 1];\n lineDistances[i] += _start$1.distanceTo(_end$1);\n }\n geometry.setAttribute('lineDistance', new Float32BufferAttribute(lineDistances, 1));\n } else {\n console.warn('THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.');\n }\n return this;\n }\n }, {\n key: \"raycast\",\n value: function raycast(raycaster, intersects) {\n var geometry = this.geometry;\n var matrixWorld = this.matrixWorld;\n var threshold = raycaster.params.Line.threshold;\n var drawRange = geometry.drawRange;\n\n // Checking boundingSphere distance to ray\n\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n _sphere$1.copy(geometry.boundingSphere);\n _sphere$1.applyMatrix4(matrixWorld);\n _sphere$1.radius += threshold;\n if (raycaster.ray.intersectsSphere(_sphere$1) === false) return;\n\n //\n\n _inverseMatrix$1.copy(matrixWorld).invert();\n _ray$1.copy(raycaster.ray).applyMatrix4(_inverseMatrix$1);\n var localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);\n var localThresholdSq = localThreshold * localThreshold;\n var vStart = new Vector3();\n var vEnd = new Vector3();\n var interSegment = new Vector3();\n var interRay = new Vector3();\n var step = this.isLineSegments ? 2 : 1;\n var index = geometry.index;\n var attributes = geometry.attributes;\n var positionAttribute = attributes.position;\n if (index !== null) {\n var start = Math.max(0, drawRange.start);\n var end = Math.min(index.count, drawRange.start + drawRange.count);\n for (var i = start, l = end - 1; i < l; i += step) {\n var a = index.getX(i);\n var b = index.getX(i + 1);\n vStart.fromBufferAttribute(positionAttribute, a);\n vEnd.fromBufferAttribute(positionAttribute, b);\n var distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment);\n if (distSq > localThresholdSq) continue;\n interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation\n\n var distance = raycaster.ray.origin.distanceTo(interRay);\n if (distance < raycaster.near || distance > raycaster.far) continue;\n intersects.push({\n distance: distance,\n // What do we want? intersection point on the ray or on the segment??\n // point: raycaster.ray.at( distance ),\n point: interSegment.clone().applyMatrix4(this.matrixWorld),\n index: i,\n face: null,\n faceIndex: null,\n object: this\n });\n }\n } else {\n var _start6 = Math.max(0, drawRange.start);\n var _end5 = Math.min(positionAttribute.count, drawRange.start + drawRange.count);\n for (var _i60 = _start6, _l7 = _end5 - 1; _i60 < _l7; _i60 += step) {\n vStart.fromBufferAttribute(positionAttribute, _i60);\n vEnd.fromBufferAttribute(positionAttribute, _i60 + 1);\n var _distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment);\n if (_distSq > localThresholdSq) continue;\n interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation\n\n var _distance = raycaster.ray.origin.distanceTo(interRay);\n if (_distance < raycaster.near || _distance > raycaster.far) continue;\n intersects.push({\n distance: _distance,\n // What do we want? intersection point on the ray or on the segment??\n // point: raycaster.ray.at( distance ),\n point: interSegment.clone().applyMatrix4(this.matrixWorld),\n index: _i60,\n face: null,\n faceIndex: null,\n object: this\n });\n }\n }\n }\n }, {\n key: \"updateMorphTargets\",\n value: function updateMorphTargets() {\n var geometry = this.geometry;\n var morphAttributes = geometry.morphAttributes;\n var keys = Object.keys(morphAttributes);\n if (keys.length > 0) {\n var morphAttribute = morphAttributes[keys[0]];\n if (morphAttribute !== undefined) {\n this.morphTargetInfluences = [];\n this.morphTargetDictionary = {};\n for (var m = 0, ml = morphAttribute.length; m < ml; m++) {\n var name = morphAttribute[m].name || String(m);\n this.morphTargetInfluences.push(0);\n this.morphTargetDictionary[name] = m;\n }\n }\n }\n }\n }]);\n return Line;\n}(Object3D);\nvar _start = /*@__PURE__*/new Vector3();\nvar _end = /*@__PURE__*/new Vector3();\nvar LineSegments = /*#__PURE__*/function (_Line) {\n _inherits(LineSegments, _Line);\n var _super50 = _createSuper(LineSegments);\n function LineSegments(geometry, material) {\n var _this41;\n _classCallCheck(this, LineSegments);\n _this41 = _super50.call(this, geometry, material);\n _this41.isLineSegments = true;\n _this41.type = 'LineSegments';\n return _this41;\n }\n _createClass(LineSegments, [{\n key: \"computeLineDistances\",\n value: function computeLineDistances() {\n var geometry = this.geometry;\n\n // we assume non-indexed geometry\n\n if (geometry.index === null) {\n var positionAttribute = geometry.attributes.position;\n var lineDistances = [];\n for (var i = 0, l = positionAttribute.count; i < l; i += 2) {\n _start.fromBufferAttribute(positionAttribute, i);\n _end.fromBufferAttribute(positionAttribute, i + 1);\n lineDistances[i] = i === 0 ? 0 : lineDistances[i - 1];\n lineDistances[i + 1] = lineDistances[i] + _start.distanceTo(_end);\n }\n geometry.setAttribute('lineDistance', new Float32BufferAttribute(lineDistances, 1));\n } else {\n console.warn('THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.');\n }\n return this;\n }\n }]);\n return LineSegments;\n}(Line);\nvar LineLoop = /*#__PURE__*/function (_Line2) {\n _inherits(LineLoop, _Line2);\n var _super51 = _createSuper(LineLoop);\n function LineLoop(geometry, material) {\n var _this42;\n _classCallCheck(this, LineLoop);\n _this42 = _super51.call(this, geometry, material);\n _this42.isLineLoop = true;\n _this42.type = 'LineLoop';\n return _this42;\n }\n return _createClass(LineLoop);\n}(Line);\nvar PointsMaterial = /*#__PURE__*/function (_Material7) {\n _inherits(PointsMaterial, _Material7);\n var _super52 = _createSuper(PointsMaterial);\n function PointsMaterial(parameters) {\n var _this43;\n _classCallCheck(this, PointsMaterial);\n _this43 = _super52.call(this);\n _this43.isPointsMaterial = true;\n _this43.type = 'PointsMaterial';\n _this43.color = new Color(0xffffff);\n _this43.map = null;\n _this43.alphaMap = null;\n _this43.size = 1;\n _this43.sizeAttenuation = true;\n _this43.fog = true;\n _this43.setValues(parameters);\n return _this43;\n }\n _createClass(PointsMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(PointsMaterial.prototype), \"copy\", this).call(this, source);\n this.color.copy(source.color);\n this.map = source.map;\n this.alphaMap = source.alphaMap;\n this.size = source.size;\n this.sizeAttenuation = source.sizeAttenuation;\n this.fog = source.fog;\n return this;\n }\n }]);\n return PointsMaterial;\n}(Material);\nvar _inverseMatrix = /*@__PURE__*/new Matrix4();\nvar _ray = /*@__PURE__*/new Ray();\nvar _sphere = /*@__PURE__*/new Sphere();\nvar _position$2 = /*@__PURE__*/new Vector3();\nvar Points = /*#__PURE__*/function (_Object3D10) {\n _inherits(Points, _Object3D10);\n var _super53 = _createSuper(Points);\n function Points() {\n var _this44;\n var geometry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new BufferGeometry();\n var material = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new PointsMaterial();\n _classCallCheck(this, Points);\n _this44 = _super53.call(this);\n _this44.isPoints = true;\n _this44.type = 'Points';\n _this44.geometry = geometry;\n _this44.material = material;\n _this44.updateMorphTargets();\n return _this44;\n }\n _createClass(Points, [{\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(Points.prototype), \"copy\", this).call(this, source, recursive);\n this.material = source.material;\n this.geometry = source.geometry;\n return this;\n }\n }, {\n key: \"raycast\",\n value: function raycast(raycaster, intersects) {\n var geometry = this.geometry;\n var matrixWorld = this.matrixWorld;\n var threshold = raycaster.params.Points.threshold;\n var drawRange = geometry.drawRange;\n\n // Checking boundingSphere distance to ray\n\n if (geometry.boundingSphere === null) geometry.computeBoundingSphere();\n _sphere.copy(geometry.boundingSphere);\n _sphere.applyMatrix4(matrixWorld);\n _sphere.radius += threshold;\n if (raycaster.ray.intersectsSphere(_sphere) === false) return;\n\n //\n\n _inverseMatrix.copy(matrixWorld).invert();\n _ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix);\n var localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3);\n var localThresholdSq = localThreshold * localThreshold;\n var index = geometry.index;\n var attributes = geometry.attributes;\n var positionAttribute = attributes.position;\n if (index !== null) {\n var start = Math.max(0, drawRange.start);\n var end = Math.min(index.count, drawRange.start + drawRange.count);\n for (var i = start, il = end; i < il; i++) {\n var a = index.getX(i);\n _position$2.fromBufferAttribute(positionAttribute, a);\n testPoint(_position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this);\n }\n } else {\n var _start7 = Math.max(0, drawRange.start);\n var _end6 = Math.min(positionAttribute.count, drawRange.start + drawRange.count);\n for (var _i61 = _start7, l = _end6; _i61 < l; _i61++) {\n _position$2.fromBufferAttribute(positionAttribute, _i61);\n testPoint(_position$2, _i61, localThresholdSq, matrixWorld, raycaster, intersects, this);\n }\n }\n }\n }, {\n key: \"updateMorphTargets\",\n value: function updateMorphTargets() {\n var geometry = this.geometry;\n var morphAttributes = geometry.morphAttributes;\n var keys = Object.keys(morphAttributes);\n if (keys.length > 0) {\n var morphAttribute = morphAttributes[keys[0]];\n if (morphAttribute !== undefined) {\n this.morphTargetInfluences = [];\n this.morphTargetDictionary = {};\n for (var m = 0, ml = morphAttribute.length; m < ml; m++) {\n var name = morphAttribute[m].name || String(m);\n this.morphTargetInfluences.push(0);\n this.morphTargetDictionary[name] = m;\n }\n }\n }\n }\n }]);\n return Points;\n}(Object3D);\nfunction testPoint(point, index, localThresholdSq, matrixWorld, raycaster, intersects, object) {\n var rayPointDistanceSq = _ray.distanceSqToPoint(point);\n if (rayPointDistanceSq < localThresholdSq) {\n var intersectPoint = new Vector3();\n _ray.closestPointToPoint(point, intersectPoint);\n intersectPoint.applyMatrix4(matrixWorld);\n var distance = raycaster.ray.origin.distanceTo(intersectPoint);\n if (distance < raycaster.near || distance > raycaster.far) return;\n intersects.push({\n distance: distance,\n distanceToRay: Math.sqrt(rayPointDistanceSq),\n point: intersectPoint,\n index: index,\n face: null,\n object: object\n });\n }\n}\nvar VideoTexture = /*#__PURE__*/function (_Texture6) {\n _inherits(VideoTexture, _Texture6);\n var _super54 = _createSuper(VideoTexture);\n function VideoTexture(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {\n var _this45;\n _classCallCheck(this, VideoTexture);\n _this45 = _super54.call(this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);\n _this45.isVideoTexture = true;\n _this45.minFilter = minFilter !== undefined ? minFilter : LinearFilter;\n _this45.magFilter = magFilter !== undefined ? magFilter : LinearFilter;\n _this45.generateMipmaps = false;\n var scope = _assertThisInitialized(_this45);\n function updateVideo() {\n scope.needsUpdate = true;\n video.requestVideoFrameCallback(updateVideo);\n }\n if ('requestVideoFrameCallback' in video) {\n video.requestVideoFrameCallback(updateVideo);\n }\n return _this45;\n }\n _createClass(VideoTexture, [{\n key: \"clone\",\n value: function clone() {\n return new this.constructor(this.image).copy(this);\n }\n }, {\n key: \"update\",\n value: function update() {\n var video = this.image;\n var hasVideoFrameCallback = ('requestVideoFrameCallback' in video);\n if (hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA) {\n this.needsUpdate = true;\n }\n }\n }]);\n return VideoTexture;\n}(Texture);\nvar FramebufferTexture = /*#__PURE__*/function (_Texture7) {\n _inherits(FramebufferTexture, _Texture7);\n var _super55 = _createSuper(FramebufferTexture);\n function FramebufferTexture(width, height, format) {\n var _this46;\n _classCallCheck(this, FramebufferTexture);\n _this46 = _super55.call(this, {\n width: width,\n height: height\n });\n _this46.isFramebufferTexture = true;\n _this46.format = format;\n _this46.magFilter = NearestFilter;\n _this46.minFilter = NearestFilter;\n _this46.generateMipmaps = false;\n _this46.needsUpdate = true;\n return _this46;\n }\n return _createClass(FramebufferTexture);\n}(Texture);\nvar CompressedTexture = /*#__PURE__*/function (_Texture8) {\n _inherits(CompressedTexture, _Texture8);\n var _super56 = _createSuper(CompressedTexture);\n function CompressedTexture(mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding) {\n var _this47;\n _classCallCheck(this, CompressedTexture);\n _this47 = _super56.call(this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding);\n _this47.isCompressedTexture = true;\n _this47.image = {\n width: width,\n height: height\n };\n _this47.mipmaps = mipmaps;\n\n // no flipping for cube textures\n // (also flipping doesn't work for compressed textures )\n\n _this47.flipY = false;\n\n // can't generate mipmaps for compressed textures\n // mips must be embedded in DDS files\n\n _this47.generateMipmaps = false;\n return _this47;\n }\n return _createClass(CompressedTexture);\n}(Texture);\nvar CompressedArrayTexture = /*#__PURE__*/function (_CompressedTexture) {\n _inherits(CompressedArrayTexture, _CompressedTexture);\n var _super57 = _createSuper(CompressedArrayTexture);\n function CompressedArrayTexture(mipmaps, width, height, depth, format, type) {\n var _this48;\n _classCallCheck(this, CompressedArrayTexture);\n _this48 = _super57.call(this, mipmaps, width, height, format, type);\n _this48.isCompressedArrayTexture = true;\n _this48.image.depth = depth;\n _this48.wrapR = ClampToEdgeWrapping;\n return _this48;\n }\n return _createClass(CompressedArrayTexture);\n}(CompressedTexture);\nvar CanvasTexture = /*#__PURE__*/function (_Texture9) {\n _inherits(CanvasTexture, _Texture9);\n var _super58 = _createSuper(CanvasTexture);\n function CanvasTexture(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {\n var _this49;\n _classCallCheck(this, CanvasTexture);\n _this49 = _super58.call(this, canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);\n _this49.isCanvasTexture = true;\n _this49.needsUpdate = true;\n return _this49;\n }\n return _createClass(CanvasTexture);\n}(Texture);\n/**\n * Extensible curve object.\n *\n * Some common of curve methods:\n * .getPoint( t, optionalTarget ), .getTangent( t, optionalTarget )\n * .getPointAt( u, optionalTarget ), .getTangentAt( u, optionalTarget )\n * .getPoints(), .getSpacedPoints()\n * .getLength()\n * .updateArcLengths()\n *\n * This following curves inherit from THREE.Curve:\n *\n * -- 2D curves --\n * THREE.ArcCurve\n * THREE.CubicBezierCurve\n * THREE.EllipseCurve\n * THREE.LineCurve\n * THREE.QuadraticBezierCurve\n * THREE.SplineCurve\n *\n * -- 3D curves --\n * THREE.CatmullRomCurve3\n * THREE.CubicBezierCurve3\n * THREE.LineCurve3\n * THREE.QuadraticBezierCurve3\n *\n * A series of curves can be represented as a THREE.CurvePath.\n *\n **/\nvar Curve = /*#__PURE__*/function () {\n function Curve() {\n _classCallCheck(this, Curve);\n this.type = 'Curve';\n this.arcLengthDivisions = 200;\n }\n\n // Virtual base class method to overwrite and implement in subclasses\n //\t- t [0 .. 1]\n _createClass(Curve, [{\n key: \"getPoint\",\n value: function getPoint( /* t, optionalTarget */\n ) {\n console.warn('THREE.Curve: .getPoint() not implemented.');\n return null;\n }\n\n // Get point at relative position in curve according to arc length\n // - u [0 .. 1]\n }, {\n key: \"getPointAt\",\n value: function getPointAt(u, optionalTarget) {\n var t = this.getUtoTmapping(u);\n return this.getPoint(t, optionalTarget);\n }\n\n // Get sequence of points using getPoint( t )\n }, {\n key: \"getPoints\",\n value: function getPoints() {\n var divisions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 5;\n var points = [];\n for (var d = 0; d <= divisions; d++) {\n points.push(this.getPoint(d / divisions));\n }\n return points;\n }\n\n // Get sequence of points using getPointAt( u )\n }, {\n key: \"getSpacedPoints\",\n value: function getSpacedPoints() {\n var divisions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 5;\n var points = [];\n for (var d = 0; d <= divisions; d++) {\n points.push(this.getPointAt(d / divisions));\n }\n return points;\n }\n\n // Get total curve arc length\n }, {\n key: \"getLength\",\n value: function getLength() {\n var lengths = this.getLengths();\n return lengths[lengths.length - 1];\n }\n\n // Get list of cumulative segment lengths\n }, {\n key: \"getLengths\",\n value: function getLengths() {\n var divisions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.arcLengthDivisions;\n if (this.cacheArcLengths && this.cacheArcLengths.length === divisions + 1 && !this.needsUpdate) {\n return this.cacheArcLengths;\n }\n this.needsUpdate = false;\n var cache = [];\n var current,\n last = this.getPoint(0);\n var sum = 0;\n cache.push(0);\n for (var p = 1; p <= divisions; p++) {\n current = this.getPoint(p / divisions);\n sum += current.distanceTo(last);\n cache.push(sum);\n last = current;\n }\n this.cacheArcLengths = cache;\n return cache; // { sums: cache, sum: sum }; Sum is in the last element.\n }\n }, {\n key: \"updateArcLengths\",\n value: function updateArcLengths() {\n this.needsUpdate = true;\n this.getLengths();\n }\n\n // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant\n }, {\n key: \"getUtoTmapping\",\n value: function getUtoTmapping(u, distance) {\n var arcLengths = this.getLengths();\n var i = 0;\n var il = arcLengths.length;\n var targetArcLength; // The targeted u distance value to get\n\n if (distance) {\n targetArcLength = distance;\n } else {\n targetArcLength = u * arcLengths[il - 1];\n }\n\n // binary search for the index with largest value smaller than target u distance\n\n var low = 0,\n high = il - 1,\n comparison;\n while (low <= high) {\n i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats\n\n comparison = arcLengths[i] - targetArcLength;\n if (comparison < 0) {\n low = i + 1;\n } else if (comparison > 0) {\n high = i - 1;\n } else {\n high = i;\n break;\n\n // DONE\n }\n }\n\n i = high;\n if (arcLengths[i] === targetArcLength) {\n return i / (il - 1);\n }\n\n // we could get finer grain at lengths, or use simple interpolation between two points\n\n var lengthBefore = arcLengths[i];\n var lengthAfter = arcLengths[i + 1];\n var segmentLength = lengthAfter - lengthBefore;\n\n // determine where we are between the 'before' and 'after' points\n\n var segmentFraction = (targetArcLength - lengthBefore) / segmentLength;\n\n // add that fractional amount to t\n\n var t = (i + segmentFraction) / (il - 1);\n return t;\n }\n\n // Returns a unit vector tangent at t\n // In case any sub curve does not implement its tangent derivation,\n // 2 points a small delta apart will be used to find its gradient\n // which seems to give a reasonable approximation\n }, {\n key: \"getTangent\",\n value: function getTangent(t, optionalTarget) {\n var delta = 0.0001;\n var t1 = t - delta;\n var t2 = t + delta;\n\n // Capping in case of danger\n\n if (t1 < 0) t1 = 0;\n if (t2 > 1) t2 = 1;\n var pt1 = this.getPoint(t1);\n var pt2 = this.getPoint(t2);\n var tangent = optionalTarget || (pt1.isVector2 ? new Vector2() : new Vector3());\n tangent.copy(pt2).sub(pt1).normalize();\n return tangent;\n }\n }, {\n key: \"getTangentAt\",\n value: function getTangentAt(u, optionalTarget) {\n var t = this.getUtoTmapping(u);\n return this.getTangent(t, optionalTarget);\n }\n }, {\n key: \"computeFrenetFrames\",\n value: function computeFrenetFrames(segments, closed) {\n // see http://www.cs.indiana.edu/pub/techreports/TR425.pdf\n\n var normal = new Vector3();\n var tangents = [];\n var normals = [];\n var binormals = [];\n var vec = new Vector3();\n var mat = new Matrix4();\n\n // compute the tangent vectors for each segment on the curve\n\n for (var i = 0; i <= segments; i++) {\n var u = i / segments;\n tangents[i] = this.getTangentAt(u, new Vector3());\n }\n\n // select an initial normal vector perpendicular to the first tangent vector,\n // and in the direction of the minimum tangent xyz component\n\n normals[0] = new Vector3();\n binormals[0] = new Vector3();\n var min = Number.MAX_VALUE;\n var tx = Math.abs(tangents[0].x);\n var ty = Math.abs(tangents[0].y);\n var tz = Math.abs(tangents[0].z);\n if (tx <= min) {\n min = tx;\n normal.set(1, 0, 0);\n }\n if (ty <= min) {\n min = ty;\n normal.set(0, 1, 0);\n }\n if (tz <= min) {\n normal.set(0, 0, 1);\n }\n vec.crossVectors(tangents[0], normal).normalize();\n normals[0].crossVectors(tangents[0], vec);\n binormals[0].crossVectors(tangents[0], normals[0]);\n\n // compute the slowly-varying normal and binormal vectors for each segment on the curve\n\n for (var _i62 = 1; _i62 <= segments; _i62++) {\n normals[_i62] = normals[_i62 - 1].clone();\n binormals[_i62] = binormals[_i62 - 1].clone();\n vec.crossVectors(tangents[_i62 - 1], tangents[_i62]);\n if (vec.length() > Number.EPSILON) {\n vec.normalize();\n var theta = Math.acos(clamp(tangents[_i62 - 1].dot(tangents[_i62]), -1, 1)); // clamp for floating pt errors\n\n normals[_i62].applyMatrix4(mat.makeRotationAxis(vec, theta));\n }\n binormals[_i62].crossVectors(tangents[_i62], normals[_i62]);\n }\n\n // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same\n\n if (closed === true) {\n var _theta = Math.acos(clamp(normals[0].dot(normals[segments]), -1, 1));\n _theta /= segments;\n if (tangents[0].dot(vec.crossVectors(normals[0], normals[segments])) > 0) {\n _theta = -_theta;\n }\n for (var _i63 = 1; _i63 <= segments; _i63++) {\n // twist a little...\n normals[_i63].applyMatrix4(mat.makeRotationAxis(tangents[_i63], _theta * _i63));\n binormals[_i63].crossVectors(tangents[_i63], normals[_i63]);\n }\n }\n return {\n tangents: tangents,\n normals: normals,\n binormals: binormals\n };\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n this.arcLengthDivisions = source.arcLengthDivisions;\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = {\n metadata: {\n version: 4.5,\n type: 'Curve',\n generator: 'Curve.toJSON'\n }\n };\n data.arcLengthDivisions = this.arcLengthDivisions;\n data.type = this.type;\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n this.arcLengthDivisions = json.arcLengthDivisions;\n return this;\n }\n }]);\n return Curve;\n}();\nvar EllipseCurve = /*#__PURE__*/function (_Curve) {\n _inherits(EllipseCurve, _Curve);\n var _super59 = _createSuper(EllipseCurve);\n function EllipseCurve() {\n var _this50;\n var aX = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var aY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var xRadius = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var yRadius = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n var aStartAngle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n var aEndAngle = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : Math.PI * 2;\n var aClockwise = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;\n var aRotation = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0;\n _classCallCheck(this, EllipseCurve);\n _this50 = _super59.call(this);\n _this50.isEllipseCurve = true;\n _this50.type = 'EllipseCurve';\n _this50.aX = aX;\n _this50.aY = aY;\n _this50.xRadius = xRadius;\n _this50.yRadius = yRadius;\n _this50.aStartAngle = aStartAngle;\n _this50.aEndAngle = aEndAngle;\n _this50.aClockwise = aClockwise;\n _this50.aRotation = aRotation;\n return _this50;\n }\n _createClass(EllipseCurve, [{\n key: \"getPoint\",\n value: function getPoint(t, optionalTarget) {\n var point = optionalTarget || new Vector2();\n var twoPi = Math.PI * 2;\n var deltaAngle = this.aEndAngle - this.aStartAngle;\n var samePoints = Math.abs(deltaAngle) < Number.EPSILON;\n\n // ensures that deltaAngle is 0 .. 2 PI\n while (deltaAngle < 0) deltaAngle += twoPi;\n while (deltaAngle > twoPi) deltaAngle -= twoPi;\n if (deltaAngle < Number.EPSILON) {\n if (samePoints) {\n deltaAngle = 0;\n } else {\n deltaAngle = twoPi;\n }\n }\n if (this.aClockwise === true && !samePoints) {\n if (deltaAngle === twoPi) {\n deltaAngle = -twoPi;\n } else {\n deltaAngle = deltaAngle - twoPi;\n }\n }\n var angle = this.aStartAngle + t * deltaAngle;\n var x = this.aX + this.xRadius * Math.cos(angle);\n var y = this.aY + this.yRadius * Math.sin(angle);\n if (this.aRotation !== 0) {\n var cos = Math.cos(this.aRotation);\n var sin = Math.sin(this.aRotation);\n var tx = x - this.aX;\n var ty = y - this.aY;\n\n // Rotate the point about the center of the ellipse.\n x = tx * cos - ty * sin + this.aX;\n y = tx * sin + ty * cos + this.aY;\n }\n return point.set(x, y);\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(EllipseCurve.prototype), \"copy\", this).call(this, source);\n this.aX = source.aX;\n this.aY = source.aY;\n this.xRadius = source.xRadius;\n this.yRadius = source.yRadius;\n this.aStartAngle = source.aStartAngle;\n this.aEndAngle = source.aEndAngle;\n this.aClockwise = source.aClockwise;\n this.aRotation = source.aRotation;\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(EllipseCurve.prototype), \"toJSON\", this).call(this);\n data.aX = this.aX;\n data.aY = this.aY;\n data.xRadius = this.xRadius;\n data.yRadius = this.yRadius;\n data.aStartAngle = this.aStartAngle;\n data.aEndAngle = this.aEndAngle;\n data.aClockwise = this.aClockwise;\n data.aRotation = this.aRotation;\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n _get(_getPrototypeOf(EllipseCurve.prototype), \"fromJSON\", this).call(this, json);\n this.aX = json.aX;\n this.aY = json.aY;\n this.xRadius = json.xRadius;\n this.yRadius = json.yRadius;\n this.aStartAngle = json.aStartAngle;\n this.aEndAngle = json.aEndAngle;\n this.aClockwise = json.aClockwise;\n this.aRotation = json.aRotation;\n return this;\n }\n }]);\n return EllipseCurve;\n}(Curve);\nvar ArcCurve = /*#__PURE__*/function (_EllipseCurve) {\n _inherits(ArcCurve, _EllipseCurve);\n var _super60 = _createSuper(ArcCurve);\n function ArcCurve(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {\n var _this51;\n _classCallCheck(this, ArcCurve);\n _this51 = _super60.call(this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise);\n _this51.isArcCurve = true;\n _this51.type = 'ArcCurve';\n return _this51;\n }\n return _createClass(ArcCurve);\n}(EllipseCurve);\n/**\n * Centripetal CatmullRom Curve - which is useful for avoiding\n * cusps and self-intersections in non-uniform catmull rom curves.\n * http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf\n *\n * curve.type accepts centripetal(default), chordal and catmullrom\n * curve.tension is used for catmullrom which defaults to 0.5\n */\n/*\nBased on an optimized c++ solution in\n - http://stackoverflow.com/questions/9489736/catmull-rom-curve-with-no-cusps-and-no-self-intersections/\n - http://ideone.com/NoEbVM\n\nThis CubicPoly class could be used for reusing some variables and calculations,\nbut for three.js curve use, it could be possible inlined and flatten into a single function call\nwhich can be placed in CurveUtils.\n*/\nfunction CubicPoly() {\n var c0 = 0,\n c1 = 0,\n c2 = 0,\n c3 = 0;\n\n /*\n * Compute coefficients for a cubic polynomial\n * p(s) = c0 + c1*s + c2*s^2 + c3*s^3\n * such that\n * p(0) = x0, p(1) = x1\n * and\n * p'(0) = t0, p'(1) = t1.\n */\n function init(x0, x1, t0, t1) {\n c0 = x0;\n c1 = t0;\n c2 = -3 * x0 + 3 * x1 - 2 * t0 - t1;\n c3 = 2 * x0 - 2 * x1 + t0 + t1;\n }\n return {\n initCatmullRom: function initCatmullRom(x0, x1, x2, x3, tension) {\n init(x1, x2, tension * (x2 - x0), tension * (x3 - x1));\n },\n initNonuniformCatmullRom: function initNonuniformCatmullRom(x0, x1, x2, x3, dt0, dt1, dt2) {\n // compute tangents when parameterized in [t1,t2]\n var t1 = (x1 - x0) / dt0 - (x2 - x0) / (dt0 + dt1) + (x2 - x1) / dt1;\n var t2 = (x2 - x1) / dt1 - (x3 - x1) / (dt1 + dt2) + (x3 - x2) / dt2;\n\n // rescale tangents for parametrization in [0,1]\n t1 *= dt1;\n t2 *= dt1;\n init(x1, x2, t1, t2);\n },\n calc: function calc(t) {\n var t2 = t * t;\n var t3 = t2 * t;\n return c0 + c1 * t + c2 * t2 + c3 * t3;\n }\n };\n}\n\n//\n\nvar tmp = /*@__PURE__*/new Vector3();\nvar px = /*@__PURE__*/new CubicPoly();\nvar py = /*@__PURE__*/new CubicPoly();\nvar pz = /*@__PURE__*/new CubicPoly();\nvar CatmullRomCurve3 = /*#__PURE__*/function (_Curve2) {\n _inherits(CatmullRomCurve3, _Curve2);\n var _super61 = _createSuper(CatmullRomCurve3);\n function CatmullRomCurve3() {\n var _this52;\n var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var closed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var curveType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'centripetal';\n var tension = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0.5;\n _classCallCheck(this, CatmullRomCurve3);\n _this52 = _super61.call(this);\n _this52.isCatmullRomCurve3 = true;\n _this52.type = 'CatmullRomCurve3';\n _this52.points = points;\n _this52.closed = closed;\n _this52.curveType = curveType;\n _this52.tension = tension;\n return _this52;\n }\n _createClass(CatmullRomCurve3, [{\n key: \"getPoint\",\n value: function getPoint(t) {\n var optionalTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3();\n var point = optionalTarget;\n var points = this.points;\n var l = points.length;\n var p = (l - (this.closed ? 0 : 1)) * t;\n var intPoint = Math.floor(p);\n var weight = p - intPoint;\n if (this.closed) {\n intPoint += intPoint > 0 ? 0 : (Math.floor(Math.abs(intPoint) / l) + 1) * l;\n } else if (weight === 0 && intPoint === l - 1) {\n intPoint = l - 2;\n weight = 1;\n }\n var p0, p3; // 4 points (p1 & p2 defined below)\n\n if (this.closed || intPoint > 0) {\n p0 = points[(intPoint - 1) % l];\n } else {\n // extrapolate first point\n tmp.subVectors(points[0], points[1]).add(points[0]);\n p0 = tmp;\n }\n var p1 = points[intPoint % l];\n var p2 = points[(intPoint + 1) % l];\n if (this.closed || intPoint + 2 < l) {\n p3 = points[(intPoint + 2) % l];\n } else {\n // extrapolate last point\n tmp.subVectors(points[l - 1], points[l - 2]).add(points[l - 1]);\n p3 = tmp;\n }\n if (this.curveType === 'centripetal' || this.curveType === 'chordal') {\n // init Centripetal / Chordal Catmull-Rom\n var pow = this.curveType === 'chordal' ? 0.5 : 0.25;\n var dt0 = Math.pow(p0.distanceToSquared(p1), pow);\n var dt1 = Math.pow(p1.distanceToSquared(p2), pow);\n var dt2 = Math.pow(p2.distanceToSquared(p3), pow);\n\n // safety check for repeated points\n if (dt1 < 1e-4) dt1 = 1.0;\n if (dt0 < 1e-4) dt0 = dt1;\n if (dt2 < 1e-4) dt2 = dt1;\n px.initNonuniformCatmullRom(p0.x, p1.x, p2.x, p3.x, dt0, dt1, dt2);\n py.initNonuniformCatmullRom(p0.y, p1.y, p2.y, p3.y, dt0, dt1, dt2);\n pz.initNonuniformCatmullRom(p0.z, p1.z, p2.z, p3.z, dt0, dt1, dt2);\n } else if (this.curveType === 'catmullrom') {\n px.initCatmullRom(p0.x, p1.x, p2.x, p3.x, this.tension);\n py.initCatmullRom(p0.y, p1.y, p2.y, p3.y, this.tension);\n pz.initCatmullRom(p0.z, p1.z, p2.z, p3.z, this.tension);\n }\n point.set(px.calc(weight), py.calc(weight), pz.calc(weight));\n return point;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(CatmullRomCurve3.prototype), \"copy\", this).call(this, source);\n this.points = [];\n for (var i = 0, l = source.points.length; i < l; i++) {\n var point = source.points[i];\n this.points.push(point.clone());\n }\n this.closed = source.closed;\n this.curveType = source.curveType;\n this.tension = source.tension;\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(CatmullRomCurve3.prototype), \"toJSON\", this).call(this);\n data.points = [];\n for (var i = 0, l = this.points.length; i < l; i++) {\n var point = this.points[i];\n data.points.push(point.toArray());\n }\n data.closed = this.closed;\n data.curveType = this.curveType;\n data.tension = this.tension;\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n _get(_getPrototypeOf(CatmullRomCurve3.prototype), \"fromJSON\", this).call(this, json);\n this.points = [];\n for (var i = 0, l = json.points.length; i < l; i++) {\n var point = json.points[i];\n this.points.push(new Vector3().fromArray(point));\n }\n this.closed = json.closed;\n this.curveType = json.curveType;\n this.tension = json.tension;\n return this;\n }\n }]);\n return CatmullRomCurve3;\n}(Curve);\n/**\n * Bezier Curves formulas obtained from\n * https://en.wikipedia.org/wiki/B%C3%A9zier_curve\n */\nfunction CatmullRom(t, p0, p1, p2, p3) {\n var v0 = (p2 - p0) * 0.5;\n var v1 = (p3 - p1) * 0.5;\n var t2 = t * t;\n var t3 = t * t2;\n return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;\n}\n\n//\n\nfunction QuadraticBezierP0(t, p) {\n var k = 1 - t;\n return k * k * p;\n}\nfunction QuadraticBezierP1(t, p) {\n return 2 * (1 - t) * t * p;\n}\nfunction QuadraticBezierP2(t, p) {\n return t * t * p;\n}\nfunction QuadraticBezier(t, p0, p1, p2) {\n return QuadraticBezierP0(t, p0) + QuadraticBezierP1(t, p1) + QuadraticBezierP2(t, p2);\n}\n\n//\n\nfunction CubicBezierP0(t, p) {\n var k = 1 - t;\n return k * k * k * p;\n}\nfunction CubicBezierP1(t, p) {\n var k = 1 - t;\n return 3 * k * k * t * p;\n}\nfunction CubicBezierP2(t, p) {\n return 3 * (1 - t) * t * t * p;\n}\nfunction CubicBezierP3(t, p) {\n return t * t * t * p;\n}\nfunction CubicBezier(t, p0, p1, p2, p3) {\n return CubicBezierP0(t, p0) + CubicBezierP1(t, p1) + CubicBezierP2(t, p2) + CubicBezierP3(t, p3);\n}\nvar CubicBezierCurve = /*#__PURE__*/function (_Curve3) {\n _inherits(CubicBezierCurve, _Curve3);\n var _super62 = _createSuper(CubicBezierCurve);\n function CubicBezierCurve() {\n var _this53;\n var v0 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector2();\n var v1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector2();\n var v2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Vector2();\n var v3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Vector2();\n _classCallCheck(this, CubicBezierCurve);\n _this53 = _super62.call(this);\n _this53.isCubicBezierCurve = true;\n _this53.type = 'CubicBezierCurve';\n _this53.v0 = v0;\n _this53.v1 = v1;\n _this53.v2 = v2;\n _this53.v3 = v3;\n return _this53;\n }\n _createClass(CubicBezierCurve, [{\n key: \"getPoint\",\n value: function getPoint(t) {\n var optionalTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector2();\n var point = optionalTarget;\n var v0 = this.v0,\n v1 = this.v1,\n v2 = this.v2,\n v3 = this.v3;\n point.set(CubicBezier(t, v0.x, v1.x, v2.x, v3.x), CubicBezier(t, v0.y, v1.y, v2.y, v3.y));\n return point;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(CubicBezierCurve.prototype), \"copy\", this).call(this, source);\n this.v0.copy(source.v0);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n this.v3.copy(source.v3);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(CubicBezierCurve.prototype), \"toJSON\", this).call(this);\n data.v0 = this.v0.toArray();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n data.v3 = this.v3.toArray();\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n _get(_getPrototypeOf(CubicBezierCurve.prototype), \"fromJSON\", this).call(this, json);\n this.v0.fromArray(json.v0);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n this.v3.fromArray(json.v3);\n return this;\n }\n }]);\n return CubicBezierCurve;\n}(Curve);\nvar CubicBezierCurve3 = /*#__PURE__*/function (_Curve4) {\n _inherits(CubicBezierCurve3, _Curve4);\n var _super63 = _createSuper(CubicBezierCurve3);\n function CubicBezierCurve3() {\n var _this54;\n var v0 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector3();\n var v1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3();\n var v2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Vector3();\n var v3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Vector3();\n _classCallCheck(this, CubicBezierCurve3);\n _this54 = _super63.call(this);\n _this54.isCubicBezierCurve3 = true;\n _this54.type = 'CubicBezierCurve3';\n _this54.v0 = v0;\n _this54.v1 = v1;\n _this54.v2 = v2;\n _this54.v3 = v3;\n return _this54;\n }\n _createClass(CubicBezierCurve3, [{\n key: \"getPoint\",\n value: function getPoint(t) {\n var optionalTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3();\n var point = optionalTarget;\n var v0 = this.v0,\n v1 = this.v1,\n v2 = this.v2,\n v3 = this.v3;\n point.set(CubicBezier(t, v0.x, v1.x, v2.x, v3.x), CubicBezier(t, v0.y, v1.y, v2.y, v3.y), CubicBezier(t, v0.z, v1.z, v2.z, v3.z));\n return point;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(CubicBezierCurve3.prototype), \"copy\", this).call(this, source);\n this.v0.copy(source.v0);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n this.v3.copy(source.v3);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(CubicBezierCurve3.prototype), \"toJSON\", this).call(this);\n data.v0 = this.v0.toArray();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n data.v3 = this.v3.toArray();\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n _get(_getPrototypeOf(CubicBezierCurve3.prototype), \"fromJSON\", this).call(this, json);\n this.v0.fromArray(json.v0);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n this.v3.fromArray(json.v3);\n return this;\n }\n }]);\n return CubicBezierCurve3;\n}(Curve);\nvar LineCurve = /*#__PURE__*/function (_Curve5) {\n _inherits(LineCurve, _Curve5);\n var _super64 = _createSuper(LineCurve);\n function LineCurve() {\n var _this55;\n var v1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector2();\n var v2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector2();\n _classCallCheck(this, LineCurve);\n _this55 = _super64.call(this);\n _this55.isLineCurve = true;\n _this55.type = 'LineCurve';\n _this55.v1 = v1;\n _this55.v2 = v2;\n return _this55;\n }\n _createClass(LineCurve, [{\n key: \"getPoint\",\n value: function getPoint(t) {\n var optionalTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector2();\n var point = optionalTarget;\n if (t === 1) {\n point.copy(this.v2);\n } else {\n point.copy(this.v2).sub(this.v1);\n point.multiplyScalar(t).add(this.v1);\n }\n return point;\n }\n\n // Line curve is linear, so we can overwrite default getPointAt\n }, {\n key: \"getPointAt\",\n value: function getPointAt(u, optionalTarget) {\n return this.getPoint(u, optionalTarget);\n }\n }, {\n key: \"getTangent\",\n value: function getTangent(t) {\n var optionalTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector2();\n return optionalTarget.subVectors(this.v2, this.v1).normalize();\n }\n }, {\n key: \"getTangentAt\",\n value: function getTangentAt(u, optionalTarget) {\n return this.getTangent(u, optionalTarget);\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(LineCurve.prototype), \"copy\", this).call(this, source);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(LineCurve.prototype), \"toJSON\", this).call(this);\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n _get(_getPrototypeOf(LineCurve.prototype), \"fromJSON\", this).call(this, json);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n return this;\n }\n }]);\n return LineCurve;\n}(Curve);\nvar LineCurve3 = /*#__PURE__*/function (_Curve6) {\n _inherits(LineCurve3, _Curve6);\n var _super65 = _createSuper(LineCurve3);\n function LineCurve3() {\n var _this56;\n var v1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector3();\n var v2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3();\n _classCallCheck(this, LineCurve3);\n _this56 = _super65.call(this);\n _this56.isLineCurve3 = true;\n _this56.type = 'LineCurve3';\n _this56.v1 = v1;\n _this56.v2 = v2;\n return _this56;\n }\n _createClass(LineCurve3, [{\n key: \"getPoint\",\n value: function getPoint(t) {\n var optionalTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3();\n var point = optionalTarget;\n if (t === 1) {\n point.copy(this.v2);\n } else {\n point.copy(this.v2).sub(this.v1);\n point.multiplyScalar(t).add(this.v1);\n }\n return point;\n }\n // Line curve is linear, so we can overwrite default getPointAt\n }, {\n key: \"getPointAt\",\n value: function getPointAt(u, optionalTarget) {\n return this.getPoint(u, optionalTarget);\n }\n }, {\n key: \"getTangent\",\n value: function getTangent(t) {\n var optionalTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3();\n return optionalTarget.subVectors(this.v2, this.v1).normalize();\n }\n }, {\n key: \"getTangentAt\",\n value: function getTangentAt(u, optionalTarget) {\n return this.getTangent(u, optionalTarget);\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(LineCurve3.prototype), \"copy\", this).call(this, source);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(LineCurve3.prototype), \"toJSON\", this).call(this);\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n _get(_getPrototypeOf(LineCurve3.prototype), \"fromJSON\", this).call(this, json);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n return this;\n }\n }]);\n return LineCurve3;\n}(Curve);\nvar QuadraticBezierCurve = /*#__PURE__*/function (_Curve7) {\n _inherits(QuadraticBezierCurve, _Curve7);\n var _super66 = _createSuper(QuadraticBezierCurve);\n function QuadraticBezierCurve() {\n var _this57;\n var v0 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector2();\n var v1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector2();\n var v2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Vector2();\n _classCallCheck(this, QuadraticBezierCurve);\n _this57 = _super66.call(this);\n _this57.isQuadraticBezierCurve = true;\n _this57.type = 'QuadraticBezierCurve';\n _this57.v0 = v0;\n _this57.v1 = v1;\n _this57.v2 = v2;\n return _this57;\n }\n _createClass(QuadraticBezierCurve, [{\n key: \"getPoint\",\n value: function getPoint(t) {\n var optionalTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector2();\n var point = optionalTarget;\n var v0 = this.v0,\n v1 = this.v1,\n v2 = this.v2;\n point.set(QuadraticBezier(t, v0.x, v1.x, v2.x), QuadraticBezier(t, v0.y, v1.y, v2.y));\n return point;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(QuadraticBezierCurve.prototype), \"copy\", this).call(this, source);\n this.v0.copy(source.v0);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(QuadraticBezierCurve.prototype), \"toJSON\", this).call(this);\n data.v0 = this.v0.toArray();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n _get(_getPrototypeOf(QuadraticBezierCurve.prototype), \"fromJSON\", this).call(this, json);\n this.v0.fromArray(json.v0);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n return this;\n }\n }]);\n return QuadraticBezierCurve;\n}(Curve);\nvar QuadraticBezierCurve3 = /*#__PURE__*/function (_Curve8) {\n _inherits(QuadraticBezierCurve3, _Curve8);\n var _super67 = _createSuper(QuadraticBezierCurve3);\n function QuadraticBezierCurve3() {\n var _this58;\n var v0 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector3();\n var v1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3();\n var v2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Vector3();\n _classCallCheck(this, QuadraticBezierCurve3);\n _this58 = _super67.call(this);\n _this58.isQuadraticBezierCurve3 = true;\n _this58.type = 'QuadraticBezierCurve3';\n _this58.v0 = v0;\n _this58.v1 = v1;\n _this58.v2 = v2;\n return _this58;\n }\n _createClass(QuadraticBezierCurve3, [{\n key: \"getPoint\",\n value: function getPoint(t) {\n var optionalTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3();\n var point = optionalTarget;\n var v0 = this.v0,\n v1 = this.v1,\n v2 = this.v2;\n point.set(QuadraticBezier(t, v0.x, v1.x, v2.x), QuadraticBezier(t, v0.y, v1.y, v2.y), QuadraticBezier(t, v0.z, v1.z, v2.z));\n return point;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(QuadraticBezierCurve3.prototype), \"copy\", this).call(this, source);\n this.v0.copy(source.v0);\n this.v1.copy(source.v1);\n this.v2.copy(source.v2);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(QuadraticBezierCurve3.prototype), \"toJSON\", this).call(this);\n data.v0 = this.v0.toArray();\n data.v1 = this.v1.toArray();\n data.v2 = this.v2.toArray();\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n _get(_getPrototypeOf(QuadraticBezierCurve3.prototype), \"fromJSON\", this).call(this, json);\n this.v0.fromArray(json.v0);\n this.v1.fromArray(json.v1);\n this.v2.fromArray(json.v2);\n return this;\n }\n }]);\n return QuadraticBezierCurve3;\n}(Curve);\nvar SplineCurve = /*#__PURE__*/function (_Curve9) {\n _inherits(SplineCurve, _Curve9);\n var _super68 = _createSuper(SplineCurve);\n function SplineCurve() {\n var _this59;\n var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n _classCallCheck(this, SplineCurve);\n _this59 = _super68.call(this);\n _this59.isSplineCurve = true;\n _this59.type = 'SplineCurve';\n _this59.points = points;\n return _this59;\n }\n _createClass(SplineCurve, [{\n key: \"getPoint\",\n value: function getPoint(t) {\n var optionalTarget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector2();\n var point = optionalTarget;\n var points = this.points;\n var p = (points.length - 1) * t;\n var intPoint = Math.floor(p);\n var weight = p - intPoint;\n var p0 = points[intPoint === 0 ? intPoint : intPoint - 1];\n var p1 = points[intPoint];\n var p2 = points[intPoint > points.length - 2 ? points.length - 1 : intPoint + 1];\n var p3 = points[intPoint > points.length - 3 ? points.length - 1 : intPoint + 2];\n point.set(CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), CatmullRom(weight, p0.y, p1.y, p2.y, p3.y));\n return point;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(SplineCurve.prototype), \"copy\", this).call(this, source);\n this.points = [];\n for (var i = 0, l = source.points.length; i < l; i++) {\n var point = source.points[i];\n this.points.push(point.clone());\n }\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(SplineCurve.prototype), \"toJSON\", this).call(this);\n data.points = [];\n for (var i = 0, l = this.points.length; i < l; i++) {\n var point = this.points[i];\n data.points.push(point.toArray());\n }\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n _get(_getPrototypeOf(SplineCurve.prototype), \"fromJSON\", this).call(this, json);\n this.points = [];\n for (var i = 0, l = json.points.length; i < l; i++) {\n var point = json.points[i];\n this.points.push(new Vector2().fromArray(point));\n }\n return this;\n }\n }]);\n return SplineCurve;\n}(Curve);\nvar Curves = /*#__PURE__*/Object.freeze({\n __proto__: null,\n ArcCurve: ArcCurve,\n CatmullRomCurve3: CatmullRomCurve3,\n CubicBezierCurve: CubicBezierCurve,\n CubicBezierCurve3: CubicBezierCurve3,\n EllipseCurve: EllipseCurve,\n LineCurve: LineCurve,\n LineCurve3: LineCurve3,\n QuadraticBezierCurve: QuadraticBezierCurve,\n QuadraticBezierCurve3: QuadraticBezierCurve3,\n SplineCurve: SplineCurve\n});\n\n/**************************************************************\n *\tCurved Path - a curve path is simply a array of connected\n * curves, but retains the api of a curve\n **************************************************************/\nvar CurvePath = /*#__PURE__*/function (_Curve10) {\n _inherits(CurvePath, _Curve10);\n var _super69 = _createSuper(CurvePath);\n function CurvePath() {\n var _this60;\n _classCallCheck(this, CurvePath);\n _this60 = _super69.call(this);\n _this60.type = 'CurvePath';\n _this60.curves = [];\n _this60.autoClose = false; // Automatically closes the path\n return _this60;\n }\n _createClass(CurvePath, [{\n key: \"add\",\n value: function add(curve) {\n this.curves.push(curve);\n }\n }, {\n key: \"closePath\",\n value: function closePath() {\n // Add a line curve if start and end of lines are not connected\n var startPoint = this.curves[0].getPoint(0);\n var endPoint = this.curves[this.curves.length - 1].getPoint(1);\n if (!startPoint.equals(endPoint)) {\n this.curves.push(new LineCurve(endPoint, startPoint));\n }\n }\n\n // To get accurate point with reference to\n // entire path distance at time t,\n // following has to be done:\n\n // 1. Length of each sub path have to be known\n // 2. Locate and identify type of curve\n // 3. Get t for the curve\n // 4. Return curve.getPointAt(t')\n }, {\n key: \"getPoint\",\n value: function getPoint(t, optionalTarget) {\n var d = t * this.getLength();\n var curveLengths = this.getCurveLengths();\n var i = 0;\n\n // To think about boundaries points.\n\n while (i < curveLengths.length) {\n if (curveLengths[i] >= d) {\n var diff = curveLengths[i] - d;\n var curve = this.curves[i];\n var segmentLength = curve.getLength();\n var u = segmentLength === 0 ? 0 : 1 - diff / segmentLength;\n return curve.getPointAt(u, optionalTarget);\n }\n i++;\n }\n return null;\n\n // loop where sum != 0, sum > d , sum+1 0 && arguments[0] !== undefined ? arguments[0] : 40;\n var points = [];\n for (var i = 0; i <= divisions; i++) {\n points.push(this.getPoint(i / divisions));\n }\n if (this.autoClose) {\n points.push(points[0]);\n }\n return points;\n }\n }, {\n key: \"getPoints\",\n value: function getPoints() {\n var divisions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 12;\n var points = [];\n var last;\n for (var i = 0, curves = this.curves; i < curves.length; i++) {\n var curve = curves[i];\n var resolution = curve.isEllipseCurve ? divisions * 2 : curve.isLineCurve || curve.isLineCurve3 ? 1 : curve.isSplineCurve ? divisions * curve.points.length : divisions;\n var pts = curve.getPoints(resolution);\n for (var j = 0; j < pts.length; j++) {\n var point = pts[j];\n if (last && last.equals(point)) continue; // ensures no consecutive points are duplicates\n\n points.push(point);\n last = point;\n }\n }\n if (this.autoClose && points.length > 1 && !points[points.length - 1].equals(points[0])) {\n points.push(points[0]);\n }\n return points;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(CurvePath.prototype), \"copy\", this).call(this, source);\n this.curves = [];\n for (var i = 0, l = source.curves.length; i < l; i++) {\n var curve = source.curves[i];\n this.curves.push(curve.clone());\n }\n this.autoClose = source.autoClose;\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(CurvePath.prototype), \"toJSON\", this).call(this);\n data.autoClose = this.autoClose;\n data.curves = [];\n for (var i = 0, l = this.curves.length; i < l; i++) {\n var curve = this.curves[i];\n data.curves.push(curve.toJSON());\n }\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n _get(_getPrototypeOf(CurvePath.prototype), \"fromJSON\", this).call(this, json);\n this.autoClose = json.autoClose;\n this.curves = [];\n for (var i = 0, l = json.curves.length; i < l; i++) {\n var curve = json.curves[i];\n this.curves.push(new Curves[curve.type]().fromJSON(curve));\n }\n return this;\n }\n }]);\n return CurvePath;\n}(Curve);\nvar Path = /*#__PURE__*/function (_CurvePath) {\n _inherits(Path, _CurvePath);\n var _super70 = _createSuper(Path);\n function Path(points) {\n var _this61;\n _classCallCheck(this, Path);\n _this61 = _super70.call(this);\n _this61.type = 'Path';\n _this61.currentPoint = new Vector2();\n if (points) {\n _this61.setFromPoints(points);\n }\n return _this61;\n }\n _createClass(Path, [{\n key: \"setFromPoints\",\n value: function setFromPoints(points) {\n this.moveTo(points[0].x, points[0].y);\n for (var i = 1, l = points.length; i < l; i++) {\n this.lineTo(points[i].x, points[i].y);\n }\n return this;\n }\n }, {\n key: \"moveTo\",\n value: function moveTo(x, y) {\n this.currentPoint.set(x, y); // TODO consider referencing vectors instead of copying?\n\n return this;\n }\n }, {\n key: \"lineTo\",\n value: function lineTo(x, y) {\n var curve = new LineCurve(this.currentPoint.clone(), new Vector2(x, y));\n this.curves.push(curve);\n this.currentPoint.set(x, y);\n return this;\n }\n }, {\n key: \"quadraticCurveTo\",\n value: function quadraticCurveTo(aCPx, aCPy, aX, aY) {\n var curve = new QuadraticBezierCurve(this.currentPoint.clone(), new Vector2(aCPx, aCPy), new Vector2(aX, aY));\n this.curves.push(curve);\n this.currentPoint.set(aX, aY);\n return this;\n }\n }, {\n key: \"bezierCurveTo\",\n value: function bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) {\n var curve = new CubicBezierCurve(this.currentPoint.clone(), new Vector2(aCP1x, aCP1y), new Vector2(aCP2x, aCP2y), new Vector2(aX, aY));\n this.curves.push(curve);\n this.currentPoint.set(aX, aY);\n return this;\n }\n }, {\n key: \"splineThru\",\n value: function splineThru(pts /*Array of Vector*/) {\n var npts = [this.currentPoint.clone()].concat(pts);\n var curve = new SplineCurve(npts);\n this.curves.push(curve);\n this.currentPoint.copy(pts[pts.length - 1]);\n return this;\n }\n }, {\n key: \"arc\",\n value: function arc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {\n var x0 = this.currentPoint.x;\n var y0 = this.currentPoint.y;\n this.absarc(aX + x0, aY + y0, aRadius, aStartAngle, aEndAngle, aClockwise);\n return this;\n }\n }, {\n key: \"absarc\",\n value: function absarc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {\n this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise);\n return this;\n }\n }, {\n key: \"ellipse\",\n value: function ellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) {\n var x0 = this.currentPoint.x;\n var y0 = this.currentPoint.y;\n this.absellipse(aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation);\n return this;\n }\n }, {\n key: \"absellipse\",\n value: function absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) {\n var curve = new EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation);\n if (this.curves.length > 0) {\n // if a previous curve is present, attempt to join\n var firstPoint = curve.getPoint(0);\n if (!firstPoint.equals(this.currentPoint)) {\n this.lineTo(firstPoint.x, firstPoint.y);\n }\n }\n this.curves.push(curve);\n var lastPoint = curve.getPoint(1);\n this.currentPoint.copy(lastPoint);\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(Path.prototype), \"copy\", this).call(this, source);\n this.currentPoint.copy(source.currentPoint);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(Path.prototype), \"toJSON\", this).call(this);\n data.currentPoint = this.currentPoint.toArray();\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n _get(_getPrototypeOf(Path.prototype), \"fromJSON\", this).call(this, json);\n this.currentPoint.fromArray(json.currentPoint);\n return this;\n }\n }]);\n return Path;\n}(CurvePath);\nvar LatheGeometry = /*#__PURE__*/function (_BufferGeometry3) {\n _inherits(LatheGeometry, _BufferGeometry3);\n var _super71 = _createSuper(LatheGeometry);\n function LatheGeometry() {\n var _this62;\n var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [new Vector2(0, -0.5), new Vector2(0.5, 0), new Vector2(0, 0.5)];\n var segments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 12;\n var phiStart = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var phiLength = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Math.PI * 2;\n _classCallCheck(this, LatheGeometry);\n _this62 = _super71.call(this);\n _this62.type = 'LatheGeometry';\n _this62.parameters = {\n points: points,\n segments: segments,\n phiStart: phiStart,\n phiLength: phiLength\n };\n segments = Math.floor(segments);\n\n // clamp phiLength so it's in range of [ 0, 2PI ]\n\n phiLength = clamp(phiLength, 0, Math.PI * 2);\n\n // buffers\n\n var indices = [];\n var vertices = [];\n var uvs = [];\n var initNormals = [];\n var normals = [];\n\n // helper variables\n\n var inverseSegments = 1.0 / segments;\n var vertex = new Vector3();\n var uv = new Vector2();\n var normal = new Vector3();\n var curNormal = new Vector3();\n var prevNormal = new Vector3();\n var dx = 0;\n var dy = 0;\n\n // pre-compute normals for initial \"meridian\"\n\n for (var j = 0; j <= points.length - 1; j++) {\n switch (j) {\n case 0:\n // special handling for 1st vertex on path\n\n dx = points[j + 1].x - points[j].x;\n dy = points[j + 1].y - points[j].y;\n normal.x = dy * 1.0;\n normal.y = -dx;\n normal.z = dy * 0.0;\n prevNormal.copy(normal);\n normal.normalize();\n initNormals.push(normal.x, normal.y, normal.z);\n break;\n case points.length - 1:\n // special handling for last Vertex on path\n\n initNormals.push(prevNormal.x, prevNormal.y, prevNormal.z);\n break;\n default:\n // default handling for all vertices in between\n\n dx = points[j + 1].x - points[j].x;\n dy = points[j + 1].y - points[j].y;\n normal.x = dy * 1.0;\n normal.y = -dx;\n normal.z = dy * 0.0;\n curNormal.copy(normal);\n normal.x += prevNormal.x;\n normal.y += prevNormal.y;\n normal.z += prevNormal.z;\n normal.normalize();\n initNormals.push(normal.x, normal.y, normal.z);\n prevNormal.copy(curNormal);\n }\n }\n\n // generate vertices, uvs and normals\n\n for (var i = 0; i <= segments; i++) {\n var phi = phiStart + i * inverseSegments * phiLength;\n var sin = Math.sin(phi);\n var cos = Math.cos(phi);\n for (var _j5 = 0; _j5 <= points.length - 1; _j5++) {\n // vertex\n\n vertex.x = points[_j5].x * sin;\n vertex.y = points[_j5].y;\n vertex.z = points[_j5].x * cos;\n vertices.push(vertex.x, vertex.y, vertex.z);\n\n // uv\n\n uv.x = i / segments;\n uv.y = _j5 / (points.length - 1);\n uvs.push(uv.x, uv.y);\n\n // normal\n\n var x = initNormals[3 * _j5 + 0] * sin;\n var y = initNormals[3 * _j5 + 1];\n var z = initNormals[3 * _j5 + 0] * cos;\n normals.push(x, y, z);\n }\n }\n\n // indices\n\n for (var _i64 = 0; _i64 < segments; _i64++) {\n for (var _j6 = 0; _j6 < points.length - 1; _j6++) {\n var base = _j6 + _i64 * points.length;\n var a = base;\n var b = base + points.length;\n var c = base + points.length + 1;\n var d = base + 1;\n\n // faces\n\n indices.push(a, b, d);\n indices.push(c, d, b);\n }\n }\n\n // build geometry\n\n _this62.setIndex(indices);\n _this62.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n _this62.setAttribute('uv', new Float32BufferAttribute(uvs, 2));\n _this62.setAttribute('normal', new Float32BufferAttribute(normals, 3));\n return _this62;\n }\n _createClass(LatheGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(LatheGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new LatheGeometry(data.points, data.segments, data.phiStart, data.phiLength);\n }\n }]);\n return LatheGeometry;\n}(BufferGeometry);\nvar CapsuleGeometry = /*#__PURE__*/function (_LatheGeometry) {\n _inherits(CapsuleGeometry, _LatheGeometry);\n var _super72 = _createSuper(CapsuleGeometry);\n function CapsuleGeometry() {\n var _this63;\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var capSegments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 4;\n var radialSegments = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 8;\n _classCallCheck(this, CapsuleGeometry);\n var path = new Path();\n path.absarc(0, -length / 2, radius, Math.PI * 1.5, 0);\n path.absarc(0, length / 2, radius, 0, Math.PI * 0.5);\n _this63 = _super72.call(this, path.getPoints(capSegments), radialSegments);\n _this63.type = 'CapsuleGeometry';\n _this63.parameters = {\n radius: radius,\n height: length,\n capSegments: capSegments,\n radialSegments: radialSegments\n };\n return _this63;\n }\n _createClass(CapsuleGeometry, null, [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new CapsuleGeometry(data.radius, data.length, data.capSegments, data.radialSegments);\n }\n }]);\n return CapsuleGeometry;\n}(LatheGeometry);\nvar CircleGeometry = /*#__PURE__*/function (_BufferGeometry4) {\n _inherits(CircleGeometry, _BufferGeometry4);\n var _super73 = _createSuper(CircleGeometry);\n function CircleGeometry() {\n var _this64;\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var segments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 32;\n var thetaStart = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var thetaLength = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Math.PI * 2;\n _classCallCheck(this, CircleGeometry);\n _this64 = _super73.call(this);\n _this64.type = 'CircleGeometry';\n _this64.parameters = {\n radius: radius,\n segments: segments,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n segments = Math.max(3, segments);\n\n // buffers\n\n var indices = [];\n var vertices = [];\n var normals = [];\n var uvs = [];\n\n // helper variables\n\n var vertex = new Vector3();\n var uv = new Vector2();\n\n // center point\n\n vertices.push(0, 0, 0);\n normals.push(0, 0, 1);\n uvs.push(0.5, 0.5);\n for (var s = 0, i = 3; s <= segments; s++, i += 3) {\n var segment = thetaStart + s / segments * thetaLength;\n\n // vertex\n\n vertex.x = radius * Math.cos(segment);\n vertex.y = radius * Math.sin(segment);\n vertices.push(vertex.x, vertex.y, vertex.z);\n\n // normal\n\n normals.push(0, 0, 1);\n\n // uvs\n\n uv.x = (vertices[i] / radius + 1) / 2;\n uv.y = (vertices[i + 1] / radius + 1) / 2;\n uvs.push(uv.x, uv.y);\n }\n\n // indices\n\n for (var _i65 = 1; _i65 <= segments; _i65++) {\n indices.push(_i65, _i65 + 1, 0);\n }\n\n // build geometry\n\n _this64.setIndex(indices);\n _this64.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n _this64.setAttribute('normal', new Float32BufferAttribute(normals, 3));\n _this64.setAttribute('uv', new Float32BufferAttribute(uvs, 2));\n return _this64;\n }\n _createClass(CircleGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(CircleGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new CircleGeometry(data.radius, data.segments, data.thetaStart, data.thetaLength);\n }\n }]);\n return CircleGeometry;\n}(BufferGeometry);\nvar CylinderGeometry = /*#__PURE__*/function (_BufferGeometry5) {\n _inherits(CylinderGeometry, _BufferGeometry5);\n var _super74 = _createSuper(CylinderGeometry);\n function CylinderGeometry() {\n var _this65;\n var radiusTop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var radiusBottom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var radialSegments = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 32;\n var heightSegments = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;\n var openEnded = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;\n var thetaStart = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;\n var thetaLength = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : Math.PI * 2;\n _classCallCheck(this, CylinderGeometry);\n _this65 = _super74.call(this);\n _this65.type = 'CylinderGeometry';\n _this65.parameters = {\n radiusTop: radiusTop,\n radiusBottom: radiusBottom,\n height: height,\n radialSegments: radialSegments,\n heightSegments: heightSegments,\n openEnded: openEnded,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n var scope = _assertThisInitialized(_this65);\n radialSegments = Math.floor(radialSegments);\n heightSegments = Math.floor(heightSegments);\n\n // buffers\n\n var indices = [];\n var vertices = [];\n var normals = [];\n var uvs = [];\n\n // helper variables\n\n var index = 0;\n var indexArray = [];\n var halfHeight = height / 2;\n var groupStart = 0;\n\n // generate geometry\n\n generateTorso();\n if (openEnded === false) {\n if (radiusTop > 0) generateCap(true);\n if (radiusBottom > 0) generateCap(false);\n }\n\n // build geometry\n\n _this65.setIndex(indices);\n _this65.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n _this65.setAttribute('normal', new Float32BufferAttribute(normals, 3));\n _this65.setAttribute('uv', new Float32BufferAttribute(uvs, 2));\n function generateTorso() {\n var normal = new Vector3();\n var vertex = new Vector3();\n var groupCount = 0;\n\n // this will be used to calculate the normal\n var slope = (radiusBottom - radiusTop) / height;\n\n // generate vertices, normals and uvs\n\n for (var y = 0; y <= heightSegments; y++) {\n var indexRow = [];\n var v = y / heightSegments;\n\n // calculate the radius of the current row\n\n var radius = v * (radiusBottom - radiusTop) + radiusTop;\n for (var x = 0; x <= radialSegments; x++) {\n var u = x / radialSegments;\n var theta = u * thetaLength + thetaStart;\n var sinTheta = Math.sin(theta);\n var cosTheta = Math.cos(theta);\n\n // vertex\n\n vertex.x = radius * sinTheta;\n vertex.y = -v * height + halfHeight;\n vertex.z = radius * cosTheta;\n vertices.push(vertex.x, vertex.y, vertex.z);\n\n // normal\n\n normal.set(sinTheta, slope, cosTheta).normalize();\n normals.push(normal.x, normal.y, normal.z);\n\n // uv\n\n uvs.push(u, 1 - v);\n\n // save index of vertex in respective row\n\n indexRow.push(index++);\n }\n\n // now save vertices of the row in our index array\n\n indexArray.push(indexRow);\n }\n\n // generate indices\n\n for (var _x4 = 0; _x4 < radialSegments; _x4++) {\n for (var _y2 = 0; _y2 < heightSegments; _y2++) {\n // we use the index array to access the correct indices\n\n var a = indexArray[_y2][_x4];\n var b = indexArray[_y2 + 1][_x4];\n var c = indexArray[_y2 + 1][_x4 + 1];\n var d = indexArray[_y2][_x4 + 1];\n\n // faces\n\n indices.push(a, b, d);\n indices.push(b, c, d);\n\n // update group counter\n\n groupCount += 6;\n }\n }\n\n // add a group to the geometry. this will ensure multi material support\n\n scope.addGroup(groupStart, groupCount, 0);\n\n // calculate new start value for groups\n\n groupStart += groupCount;\n }\n function generateCap(top) {\n // save the index of the first center vertex\n var centerIndexStart = index;\n var uv = new Vector2();\n var vertex = new Vector3();\n var groupCount = 0;\n var radius = top === true ? radiusTop : radiusBottom;\n var sign = top === true ? 1 : -1;\n\n // first we generate the center vertex data of the cap.\n // because the geometry needs one set of uvs per face,\n // we must generate a center vertex per face/segment\n\n for (var x = 1; x <= radialSegments; x++) {\n // vertex\n\n vertices.push(0, halfHeight * sign, 0);\n\n // normal\n\n normals.push(0, sign, 0);\n\n // uv\n\n uvs.push(0.5, 0.5);\n\n // increase index\n\n index++;\n }\n\n // save the index of the last center vertex\n var centerIndexEnd = index;\n\n // now we generate the surrounding vertices, normals and uvs\n\n for (var _x5 = 0; _x5 <= radialSegments; _x5++) {\n var u = _x5 / radialSegments;\n var theta = u * thetaLength + thetaStart;\n var cosTheta = Math.cos(theta);\n var sinTheta = Math.sin(theta);\n\n // vertex\n\n vertex.x = radius * sinTheta;\n vertex.y = halfHeight * sign;\n vertex.z = radius * cosTheta;\n vertices.push(vertex.x, vertex.y, vertex.z);\n\n // normal\n\n normals.push(0, sign, 0);\n\n // uv\n\n uv.x = cosTheta * 0.5 + 0.5;\n uv.y = sinTheta * 0.5 * sign + 0.5;\n uvs.push(uv.x, uv.y);\n\n // increase index\n\n index++;\n }\n\n // generate indices\n\n for (var _x6 = 0; _x6 < radialSegments; _x6++) {\n var c = centerIndexStart + _x6;\n var i = centerIndexEnd + _x6;\n if (top === true) {\n // face top\n\n indices.push(i, i + 1, c);\n } else {\n // face bottom\n\n indices.push(i + 1, i, c);\n }\n groupCount += 3;\n }\n\n // add a group to the geometry. this will ensure multi material support\n\n scope.addGroup(groupStart, groupCount, top === true ? 1 : 2);\n\n // calculate new start value for groups\n\n groupStart += groupCount;\n }\n return _this65;\n }\n _createClass(CylinderGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(CylinderGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new CylinderGeometry(data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength);\n }\n }]);\n return CylinderGeometry;\n}(BufferGeometry);\nvar ConeGeometry = /*#__PURE__*/function (_CylinderGeometry) {\n _inherits(ConeGeometry, _CylinderGeometry);\n var _super75 = _createSuper(ConeGeometry);\n function ConeGeometry() {\n var _this66;\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var radialSegments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 32;\n var heightSegments = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n var openEnded = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n var thetaStart = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;\n var thetaLength = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : Math.PI * 2;\n _classCallCheck(this, ConeGeometry);\n _this66 = _super75.call(this, 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);\n _this66.type = 'ConeGeometry';\n _this66.parameters = {\n radius: radius,\n height: height,\n radialSegments: radialSegments,\n heightSegments: heightSegments,\n openEnded: openEnded,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n return _this66;\n }\n _createClass(ConeGeometry, null, [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new ConeGeometry(data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength);\n }\n }]);\n return ConeGeometry;\n}(CylinderGeometry);\nvar PolyhedronGeometry = /*#__PURE__*/function (_BufferGeometry6) {\n _inherits(PolyhedronGeometry, _BufferGeometry6);\n var _super76 = _createSuper(PolyhedronGeometry);\n function PolyhedronGeometry() {\n var _this67;\n var vertices = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var indices = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var radius = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var detail = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n _classCallCheck(this, PolyhedronGeometry);\n _this67 = _super76.call(this);\n _this67.type = 'PolyhedronGeometry';\n _this67.parameters = {\n vertices: vertices,\n indices: indices,\n radius: radius,\n detail: detail\n };\n\n // default buffer data\n\n var vertexBuffer = [];\n var uvBuffer = [];\n\n // the subdivision creates the vertex buffer data\n\n subdivide(detail);\n\n // all vertices should lie on a conceptual sphere with a given radius\n\n applyRadius(radius);\n\n // finally, create the uv data\n\n generateUVs();\n\n // build non-indexed geometry\n\n _this67.setAttribute('position', new Float32BufferAttribute(vertexBuffer, 3));\n _this67.setAttribute('normal', new Float32BufferAttribute(vertexBuffer.slice(), 3));\n _this67.setAttribute('uv', new Float32BufferAttribute(uvBuffer, 2));\n if (detail === 0) {\n _this67.computeVertexNormals(); // flat normals\n } else {\n _this67.normalizeNormals(); // smooth normals\n }\n\n // helper functions\n\n function subdivide(detail) {\n var a = new Vector3();\n var b = new Vector3();\n var c = new Vector3();\n\n // iterate over all faces and apply a subdivision with the given detail value\n\n for (var i = 0; i < indices.length; i += 3) {\n // get the vertices of the face\n\n getVertexByIndex(indices[i + 0], a);\n getVertexByIndex(indices[i + 1], b);\n getVertexByIndex(indices[i + 2], c);\n\n // perform subdivision\n\n subdivideFace(a, b, c, detail);\n }\n }\n function subdivideFace(a, b, c, detail) {\n var cols = detail + 1;\n\n // we use this multidimensional array as a data structure for creating the subdivision\n\n var v = [];\n\n // construct all of the vertices for this subdivision\n\n for (var i = 0; i <= cols; i++) {\n v[i] = [];\n var aj = a.clone().lerp(c, i / cols);\n var bj = b.clone().lerp(c, i / cols);\n var rows = cols - i;\n for (var j = 0; j <= rows; j++) {\n if (j === 0 && i === cols) {\n v[i][j] = aj;\n } else {\n v[i][j] = aj.clone().lerp(bj, j / rows);\n }\n }\n }\n\n // construct all of the faces\n\n for (var _i66 = 0; _i66 < cols; _i66++) {\n for (var _j7 = 0; _j7 < 2 * (cols - _i66) - 1; _j7++) {\n var k = Math.floor(_j7 / 2);\n if (_j7 % 2 === 0) {\n pushVertex(v[_i66][k + 1]);\n pushVertex(v[_i66 + 1][k]);\n pushVertex(v[_i66][k]);\n } else {\n pushVertex(v[_i66][k + 1]);\n pushVertex(v[_i66 + 1][k + 1]);\n pushVertex(v[_i66 + 1][k]);\n }\n }\n }\n }\n function applyRadius(radius) {\n var vertex = new Vector3();\n\n // iterate over the entire buffer and apply the radius to each vertex\n\n for (var i = 0; i < vertexBuffer.length; i += 3) {\n vertex.x = vertexBuffer[i + 0];\n vertex.y = vertexBuffer[i + 1];\n vertex.z = vertexBuffer[i + 2];\n vertex.normalize().multiplyScalar(radius);\n vertexBuffer[i + 0] = vertex.x;\n vertexBuffer[i + 1] = vertex.y;\n vertexBuffer[i + 2] = vertex.z;\n }\n }\n function generateUVs() {\n var vertex = new Vector3();\n for (var i = 0; i < vertexBuffer.length; i += 3) {\n vertex.x = vertexBuffer[i + 0];\n vertex.y = vertexBuffer[i + 1];\n vertex.z = vertexBuffer[i + 2];\n var u = azimuth(vertex) / 2 / Math.PI + 0.5;\n var v = inclination(vertex) / Math.PI + 0.5;\n uvBuffer.push(u, 1 - v);\n }\n correctUVs();\n correctSeam();\n }\n function correctSeam() {\n // handle case when face straddles the seam, see #3269\n\n for (var i = 0; i < uvBuffer.length; i += 6) {\n // uv data of a single face\n\n var x0 = uvBuffer[i + 0];\n var x1 = uvBuffer[i + 2];\n var x2 = uvBuffer[i + 4];\n var max = Math.max(x0, x1, x2);\n var min = Math.min(x0, x1, x2);\n\n // 0.9 is somewhat arbitrary\n\n if (max > 0.9 && min < 0.1) {\n if (x0 < 0.2) uvBuffer[i + 0] += 1;\n if (x1 < 0.2) uvBuffer[i + 2] += 1;\n if (x2 < 0.2) uvBuffer[i + 4] += 1;\n }\n }\n }\n function pushVertex(vertex) {\n vertexBuffer.push(vertex.x, vertex.y, vertex.z);\n }\n function getVertexByIndex(index, vertex) {\n var stride = index * 3;\n vertex.x = vertices[stride + 0];\n vertex.y = vertices[stride + 1];\n vertex.z = vertices[stride + 2];\n }\n function correctUVs() {\n var a = new Vector3();\n var b = new Vector3();\n var c = new Vector3();\n var centroid = new Vector3();\n var uvA = new Vector2();\n var uvB = new Vector2();\n var uvC = new Vector2();\n for (var i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6) {\n a.set(vertexBuffer[i + 0], vertexBuffer[i + 1], vertexBuffer[i + 2]);\n b.set(vertexBuffer[i + 3], vertexBuffer[i + 4], vertexBuffer[i + 5]);\n c.set(vertexBuffer[i + 6], vertexBuffer[i + 7], vertexBuffer[i + 8]);\n uvA.set(uvBuffer[j + 0], uvBuffer[j + 1]);\n uvB.set(uvBuffer[j + 2], uvBuffer[j + 3]);\n uvC.set(uvBuffer[j + 4], uvBuffer[j + 5]);\n centroid.copy(a).add(b).add(c).divideScalar(3);\n var azi = azimuth(centroid);\n correctUV(uvA, j + 0, a, azi);\n correctUV(uvB, j + 2, b, azi);\n correctUV(uvC, j + 4, c, azi);\n }\n }\n function correctUV(uv, stride, vector, azimuth) {\n if (azimuth < 0 && uv.x === 1) {\n uvBuffer[stride] = uv.x - 1;\n }\n if (vector.x === 0 && vector.z === 0) {\n uvBuffer[stride] = azimuth / 2 / Math.PI + 0.5;\n }\n }\n\n // Angle around the Y axis, counter-clockwise when looking from above.\n\n function azimuth(vector) {\n return Math.atan2(vector.z, -vector.x);\n }\n\n // Angle above the XZ plane.\n\n function inclination(vector) {\n return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z));\n }\n return _this67;\n }\n _createClass(PolyhedronGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(PolyhedronGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new PolyhedronGeometry(data.vertices, data.indices, data.radius, data.details);\n }\n }]);\n return PolyhedronGeometry;\n}(BufferGeometry);\nvar DodecahedronGeometry = /*#__PURE__*/function (_PolyhedronGeometry) {\n _inherits(DodecahedronGeometry, _PolyhedronGeometry);\n var _super77 = _createSuper(DodecahedronGeometry);\n function DodecahedronGeometry() {\n var _this68;\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n _classCallCheck(this, DodecahedronGeometry);\n var t = (1 + Math.sqrt(5)) / 2;\n var r = 1 / t;\n var vertices = [\n // (±1, ±1, ±1)\n -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1,\n // (0, ±1/φ, ±φ)\n 0, -r, -t, 0, -r, t, 0, r, -t, 0, r, t,\n // (±1/φ, ±φ, 0)\n -r, -t, 0, -r, t, 0, r, -t, 0, r, t, 0,\n // (±φ, 0, ±1/φ)\n -t, 0, -r, t, 0, -r, -t, 0, r, t, 0, r];\n var indices = [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];\n _this68 = _super77.call(this, vertices, indices, radius, detail);\n _this68.type = 'DodecahedronGeometry';\n _this68.parameters = {\n radius: radius,\n detail: detail\n };\n return _this68;\n }\n _createClass(DodecahedronGeometry, null, [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new DodecahedronGeometry(data.radius, data.detail);\n }\n }]);\n return DodecahedronGeometry;\n}(PolyhedronGeometry);\nvar _v0 = /*@__PURE__*/new Vector3();\nvar _v1$1 = /*@__PURE__*/new Vector3();\nvar _normal = /*@__PURE__*/new Vector3();\nvar _triangle = /*@__PURE__*/new Triangle();\nvar EdgesGeometry = /*#__PURE__*/function (_BufferGeometry7) {\n _inherits(EdgesGeometry, _BufferGeometry7);\n var _super78 = _createSuper(EdgesGeometry);\n function EdgesGeometry() {\n var _this69;\n var geometry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var thresholdAngle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n _classCallCheck(this, EdgesGeometry);\n _this69 = _super78.call(this);\n _this69.type = 'EdgesGeometry';\n _this69.parameters = {\n geometry: geometry,\n thresholdAngle: thresholdAngle\n };\n if (geometry !== null) {\n var precisionPoints = 4;\n var precision = Math.pow(10, precisionPoints);\n var thresholdDot = Math.cos(DEG2RAD * thresholdAngle);\n var indexAttr = geometry.getIndex();\n var positionAttr = geometry.getAttribute('position');\n var indexCount = indexAttr ? indexAttr.count : positionAttr.count;\n var indexArr = [0, 0, 0];\n var vertKeys = ['a', 'b', 'c'];\n var hashes = new Array(3);\n var edgeData = {};\n var vertices = [];\n for (var i = 0; i < indexCount; i += 3) {\n if (indexAttr) {\n indexArr[0] = indexAttr.getX(i);\n indexArr[1] = indexAttr.getX(i + 1);\n indexArr[2] = indexAttr.getX(i + 2);\n } else {\n indexArr[0] = i;\n indexArr[1] = i + 1;\n indexArr[2] = i + 2;\n }\n var a = _triangle.a,\n b = _triangle.b,\n c = _triangle.c;\n a.fromBufferAttribute(positionAttr, indexArr[0]);\n b.fromBufferAttribute(positionAttr, indexArr[1]);\n c.fromBufferAttribute(positionAttr, indexArr[2]);\n _triangle.getNormal(_normal);\n\n // create hashes for the edge from the vertices\n hashes[0] = \"\".concat(Math.round(a.x * precision), \",\").concat(Math.round(a.y * precision), \",\").concat(Math.round(a.z * precision));\n hashes[1] = \"\".concat(Math.round(b.x * precision), \",\").concat(Math.round(b.y * precision), \",\").concat(Math.round(b.z * precision));\n hashes[2] = \"\".concat(Math.round(c.x * precision), \",\").concat(Math.round(c.y * precision), \",\").concat(Math.round(c.z * precision));\n\n // skip degenerate triangles\n if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) {\n continue;\n }\n\n // iterate over every edge\n for (var j = 0; j < 3; j++) {\n // get the first and next vertex making up the edge\n var jNext = (j + 1) % 3;\n var vecHash0 = hashes[j];\n var vecHash1 = hashes[jNext];\n var v0 = _triangle[vertKeys[j]];\n var v1 = _triangle[vertKeys[jNext]];\n var hash = \"\".concat(vecHash0, \"_\").concat(vecHash1);\n var reverseHash = \"\".concat(vecHash1, \"_\").concat(vecHash0);\n if (reverseHash in edgeData && edgeData[reverseHash]) {\n // if we found a sibling edge add it into the vertex array if\n // it meets the angle threshold and delete the edge from the map.\n if (_normal.dot(edgeData[reverseHash].normal) <= thresholdDot) {\n vertices.push(v0.x, v0.y, v0.z);\n vertices.push(v1.x, v1.y, v1.z);\n }\n edgeData[reverseHash] = null;\n } else if (!(hash in edgeData)) {\n // if we've already got an edge here then skip adding a new one\n edgeData[hash] = {\n index0: indexArr[j],\n index1: indexArr[jNext],\n normal: _normal.clone()\n };\n }\n }\n }\n\n // iterate over all remaining, unmatched edges and add them to the vertex array\n for (var key in edgeData) {\n if (edgeData[key]) {\n var _edgeData$key = edgeData[key],\n index0 = _edgeData$key.index0,\n index1 = _edgeData$key.index1;\n _v0.fromBufferAttribute(positionAttr, index0);\n _v1$1.fromBufferAttribute(positionAttr, index1);\n vertices.push(_v0.x, _v0.y, _v0.z);\n vertices.push(_v1$1.x, _v1$1.y, _v1$1.z);\n }\n }\n _this69.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n }\n return _this69;\n }\n _createClass(EdgesGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(EdgesGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }]);\n return EdgesGeometry;\n}(BufferGeometry);\nvar Shape = /*#__PURE__*/function (_Path) {\n _inherits(Shape, _Path);\n var _super79 = _createSuper(Shape);\n function Shape(points) {\n var _this70;\n _classCallCheck(this, Shape);\n _this70 = _super79.call(this, points);\n _this70.uuid = generateUUID();\n _this70.type = 'Shape';\n _this70.holes = [];\n return _this70;\n }\n _createClass(Shape, [{\n key: \"getPointsHoles\",\n value: function getPointsHoles(divisions) {\n var holesPts = [];\n for (var i = 0, l = this.holes.length; i < l; i++) {\n holesPts[i] = this.holes[i].getPoints(divisions);\n }\n return holesPts;\n }\n\n // get points of shape and holes (keypoints based on segments parameter)\n }, {\n key: \"extractPoints\",\n value: function extractPoints(divisions) {\n return {\n shape: this.getPoints(divisions),\n holes: this.getPointsHoles(divisions)\n };\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(Shape.prototype), \"copy\", this).call(this, source);\n this.holes = [];\n for (var i = 0, l = source.holes.length; i < l; i++) {\n var hole = source.holes[i];\n this.holes.push(hole.clone());\n }\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(Shape.prototype), \"toJSON\", this).call(this);\n data.uuid = this.uuid;\n data.holes = [];\n for (var i = 0, l = this.holes.length; i < l; i++) {\n var hole = this.holes[i];\n data.holes.push(hole.toJSON());\n }\n return data;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n _get(_getPrototypeOf(Shape.prototype), \"fromJSON\", this).call(this, json);\n this.uuid = json.uuid;\n this.holes = [];\n for (var i = 0, l = json.holes.length; i < l; i++) {\n var hole = json.holes[i];\n this.holes.push(new Path().fromJSON(hole));\n }\n return this;\n }\n }]);\n return Shape;\n}(Path);\n/**\n * Port from https://github.com/mapbox/earcut (v2.2.4)\n */\nvar Earcut = {\n triangulate: function triangulate(data, holeIndices) {\n var dim = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n var outerNode = linkedList(data, 0, outerLen, dim, true);\n var triangles = [];\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n var minX, minY, maxX, maxY, x, y, invSize;\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 32767 / invSize : 0;\n }\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\n return triangles;\n }\n};\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n if (clockwise === signedArea(data, start, end, dim) > 0) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n var p = start,\n again;\n do {\n again = false;\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n var stop = ear,\n prev,\n next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim | 0);\n triangles.push(ear.i / dim | 0);\n triangles.push(next.i / dim | 0);\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n continue;\n }\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var ax = a.x,\n bx = b.x,\n cx = c.x,\n ay = a.y,\n by = b.y,\n cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx,\n y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy,\n x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx,\n y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;\n var p = c.next;\n while (p !== a) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n return true;\n}\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n var ax = a.x,\n bx = b.x,\n cx = c.x,\n ay = a.y,\n by = b.y,\n cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx,\n y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy,\n x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx,\n y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(x0, y0, minX, minY, invSize),\n maxZ = zOrder(x1, y1, minX, minY, invSize);\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n triangles.push(a.i / dim | 0);\n triangles.push(p.i / dim | 0);\n triangles.push(b.i / dim | 0);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize, 0);\n earcutLinked(c, triangles, dim, minX, minY, invSize, 0);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [];\n var i, len, start, end, list;\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n }\n return outerNode;\n}\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and link it\nfunction eliminateHole(hole, outerNode) {\n var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n var bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n filterPoints(bridgeReverse, bridgeReverse.next);\n return filterPoints(bridge, bridge.next);\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n qx = -Infinity,\n m;\n var hx = hole.x,\n hy = hole.y;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint\n }\n }\n\n p = p.next;\n } while (p !== outerNode);\n if (!m) return null;\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y;\n var tanMin = Infinity,\n tan;\n p = m;\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) && (tan < tanMin || tan === tanMin && (p.x > m.x || p.x === m.x && sectorContainsSector(m, p)))) {\n m = p;\n tanMin = tan;\n }\n }\n p = p.next;\n } while (p !== stop);\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n p.prevZ.nextZ = null;\n p.prevZ = null;\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i,\n p,\n q,\n e,\n tail,\n numMerges,\n pSize,\n qSize,\n inSize = 1;\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n while (pSize > 0 || qSize > 0 && q) {\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n if (tail) tail.nextZ = e;else list = e;\n e.prevZ = tail;\n tail = e;\n }\n p = q;\n }\n tail.nextZ = null;\n inSize *= 2;\n } while (numMerges > 1);\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\n x = (x | x << 8) & 0x00FF00FF;\n x = (x | x << 4) & 0x0F0F0F0F;\n x = (x | x << 2) & 0x33333333;\n x = (x | x << 1) & 0x55555555;\n y = (y | y << 8) & 0x00FF00FF;\n y = (y | y << 4) & 0x0F0F0F0F;\n y = (y | y << 2) & 0x33333333;\n y = (y | y << 1) & 0x55555555;\n return x | y << 1;\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p;\n p = p.next;\n } while (p !== start);\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && (\n // dones't intersect other edges\n locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && (\n // locally visible\n area(a.prev, a, b.prev) || area(a, b.prev, b)) ||\n // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false;\n var px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x) inside = !inside;\n p = p.next;\n } while (p !== a);\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n a.next = b;\n b.prev = a;\n a2.next = an;\n an.prev = a2;\n b2.next = a2;\n a2.prev = b2;\n bp.next = b2;\n b2.prev = bp;\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n if (!last) {\n p.prev = p;\n p.next = p;\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = 0;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\nvar ShapeUtils = /*#__PURE__*/function () {\n function ShapeUtils() {\n _classCallCheck(this, ShapeUtils);\n }\n _createClass(ShapeUtils, null, [{\n key: \"area\",\n value:\n // calculate area of the contour polygon\n\n function area(contour) {\n var n = contour.length;\n var a = 0.0;\n for (var p = n - 1, q = 0; q < n; p = q++) {\n a += contour[p].x * contour[q].y - contour[q].x * contour[p].y;\n }\n return a * 0.5;\n }\n }, {\n key: \"isClockWise\",\n value: function isClockWise(pts) {\n return ShapeUtils.area(pts) < 0;\n }\n }, {\n key: \"triangulateShape\",\n value: function triangulateShape(contour, holes) {\n var vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ]\n var holeIndices = []; // array of hole indices\n var faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ]\n\n removeDupEndPts(contour);\n addContour(vertices, contour);\n\n //\n\n var holeIndex = contour.length;\n holes.forEach(removeDupEndPts);\n for (var i = 0; i < holes.length; i++) {\n holeIndices.push(holeIndex);\n holeIndex += holes[i].length;\n addContour(vertices, holes[i]);\n }\n\n //\n\n var triangles = Earcut.triangulate(vertices, holeIndices);\n\n //\n\n for (var _i67 = 0; _i67 < triangles.length; _i67 += 3) {\n faces.push(triangles.slice(_i67, _i67 + 3));\n }\n return faces;\n }\n }]);\n return ShapeUtils;\n}();\nfunction removeDupEndPts(points) {\n var l = points.length;\n if (l > 2 && points[l - 1].equals(points[0])) {\n points.pop();\n }\n}\nfunction addContour(vertices, contour) {\n for (var i = 0; i < contour.length; i++) {\n vertices.push(contour[i].x);\n vertices.push(contour[i].y);\n }\n}\n\n/**\n * Creates extruded geometry from a path shape.\n *\n * parameters = {\n *\n * curveSegments: , // number of points on the curves\n * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too\n * depth: , // Depth to extrude the shape\n *\n * bevelEnabled: , // turn on bevel\n * bevelThickness: , // how deep into the original shape bevel goes\n * bevelSize: , // how far from shape outline (including bevelOffset) is bevel\n * bevelOffset: , // how far from shape outline does bevel start\n * bevelSegments: , // number of bevel layers\n *\n * extrudePath: // curve to extrude shape along\n *\n * UVGenerator: // object that provides UV generator functions\n *\n * }\n */\nvar ExtrudeGeometry = /*#__PURE__*/function (_BufferGeometry8) {\n _inherits(ExtrudeGeometry, _BufferGeometry8);\n var _super80 = _createSuper(ExtrudeGeometry);\n function ExtrudeGeometry() {\n var _this71;\n var shapes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Shape([new Vector2(0.5, 0.5), new Vector2(-0.5, 0.5), new Vector2(-0.5, -0.5), new Vector2(0.5, -0.5)]);\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, ExtrudeGeometry);\n _this71 = _super80.call(this);\n _this71.type = 'ExtrudeGeometry';\n _this71.parameters = {\n shapes: shapes,\n options: options\n };\n shapes = Array.isArray(shapes) ? shapes : [shapes];\n var scope = _assertThisInitialized(_this71);\n var verticesArray = [];\n var uvArray = [];\n for (var i = 0, l = shapes.length; i < l; i++) {\n var shape = shapes[i];\n addShape(shape);\n }\n\n // build geometry\n\n _this71.setAttribute('position', new Float32BufferAttribute(verticesArray, 3));\n _this71.setAttribute('uv', new Float32BufferAttribute(uvArray, 2));\n _this71.computeVertexNormals();\n\n // functions\n\n function addShape(shape) {\n var placeholder = [];\n\n // options\n\n var curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;\n var steps = options.steps !== undefined ? options.steps : 1;\n var depth = options.depth !== undefined ? options.depth : 1;\n var bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;\n var bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;\n var bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;\n var bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;\n var bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;\n var extrudePath = options.extrudePath;\n var uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator;\n\n //\n\n var extrudePts,\n extrudeByPath = false;\n var splineTube, binormal, normal, position2;\n if (extrudePath) {\n extrudePts = extrudePath.getSpacedPoints(steps);\n extrudeByPath = true;\n bevelEnabled = false; // bevels not supported for path extrusion\n\n // SETUP TNB variables\n\n // TODO1 - have a .isClosed in spline?\n\n splineTube = extrudePath.computeFrenetFrames(steps, false);\n\n // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length);\n\n binormal = new Vector3();\n normal = new Vector3();\n position2 = new Vector3();\n }\n\n // Safeguards if bevels are not enabled\n\n if (!bevelEnabled) {\n bevelSegments = 0;\n bevelThickness = 0;\n bevelSize = 0;\n bevelOffset = 0;\n }\n\n // Variables initialization\n\n var shapePoints = shape.extractPoints(curveSegments);\n var vertices = shapePoints.shape;\n var holes = shapePoints.holes;\n var reverse = !ShapeUtils.isClockWise(vertices);\n if (reverse) {\n vertices = vertices.reverse();\n\n // Maybe we should also check if holes are in the opposite direction, just to be safe ...\n\n for (var h = 0, hl = holes.length; h < hl; h++) {\n var ahole = holes[h];\n if (ShapeUtils.isClockWise(ahole)) {\n holes[h] = ahole.reverse();\n }\n }\n }\n var faces = ShapeUtils.triangulateShape(vertices, holes);\n\n /* Vertices */\n\n var contour = vertices; // vertices has all points but contour has only points of circumference\n\n for (var _h = 0, _hl = holes.length; _h < _hl; _h++) {\n var _ahole = holes[_h];\n vertices = vertices.concat(_ahole);\n }\n function scalePt2(pt, vec, size) {\n if (!vec) console.error('THREE.ExtrudeGeometry: vec does not exist');\n return pt.clone().addScaledVector(vec, size);\n }\n var vlen = vertices.length,\n flen = faces.length;\n\n // Find directions for point movement\n\n function getBevelVec(inPt, inPrev, inNext) {\n // computes for inPt the corresponding point inPt' on a new contour\n // shifted by 1 unit (length of normalized vector) to the left\n // if we walk along contour clockwise, this new contour is outside the old one\n //\n // inPt' is the intersection of the two lines parallel to the two\n // adjacent edges of inPt at a distance of 1 unit on the left side.\n\n var v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt\n\n // good reading for geometry algorithms (here: line-line intersection)\n // http://geomalgorithms.com/a05-_intersect-1.html\n\n var v_prev_x = inPt.x - inPrev.x,\n v_prev_y = inPt.y - inPrev.y;\n var v_next_x = inNext.x - inPt.x,\n v_next_y = inNext.y - inPt.y;\n var v_prev_lensq = v_prev_x * v_prev_x + v_prev_y * v_prev_y;\n\n // check for collinear edges\n var collinear0 = v_prev_x * v_next_y - v_prev_y * v_next_x;\n if (Math.abs(collinear0) > Number.EPSILON) {\n // not collinear\n\n // length of vectors for normalizing\n\n var v_prev_len = Math.sqrt(v_prev_lensq);\n var v_next_len = Math.sqrt(v_next_x * v_next_x + v_next_y * v_next_y);\n\n // shift adjacent points by unit vectors to the left\n\n var ptPrevShift_x = inPrev.x - v_prev_y / v_prev_len;\n var ptPrevShift_y = inPrev.y + v_prev_x / v_prev_len;\n var ptNextShift_x = inNext.x - v_next_y / v_next_len;\n var ptNextShift_y = inNext.y + v_next_x / v_next_len;\n\n // scaling factor for v_prev to intersection point\n\n var sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x);\n\n // vector from inPt to intersection point\n\n v_trans_x = ptPrevShift_x + v_prev_x * sf - inPt.x;\n v_trans_y = ptPrevShift_y + v_prev_y * sf - inPt.y;\n\n // Don't normalize!, otherwise sharp corners become ugly\n // but prevent crazy spikes\n var v_trans_lensq = v_trans_x * v_trans_x + v_trans_y * v_trans_y;\n if (v_trans_lensq <= 2) {\n return new Vector2(v_trans_x, v_trans_y);\n } else {\n shrink_by = Math.sqrt(v_trans_lensq / 2);\n }\n } else {\n // handle special case of collinear edges\n\n var direction_eq = false; // assumes: opposite\n\n if (v_prev_x > Number.EPSILON) {\n if (v_next_x > Number.EPSILON) {\n direction_eq = true;\n }\n } else {\n if (v_prev_x < -Number.EPSILON) {\n if (v_next_x < -Number.EPSILON) {\n direction_eq = true;\n }\n } else {\n if (Math.sign(v_prev_y) === Math.sign(v_next_y)) {\n direction_eq = true;\n }\n }\n }\n if (direction_eq) {\n // console.log(\"Warning: lines are a straight sequence\");\n v_trans_x = -v_prev_y;\n v_trans_y = v_prev_x;\n shrink_by = Math.sqrt(v_prev_lensq);\n } else {\n // console.log(\"Warning: lines are a straight spike\");\n v_trans_x = v_prev_x;\n v_trans_y = v_prev_y;\n shrink_by = Math.sqrt(v_prev_lensq / 2);\n }\n }\n return new Vector2(v_trans_x / shrink_by, v_trans_y / shrink_by);\n }\n var contourMovements = [];\n for (var _i68 = 0, il = contour.length, j = il - 1, k = _i68 + 1; _i68 < il; _i68++, j++, k++) {\n if (j === il) j = 0;\n if (k === il) k = 0;\n\n // (j)---(i)---(k)\n // console.log('i,j,k', i, j , k)\n\n contourMovements[_i68] = getBevelVec(contour[_i68], contour[j], contour[k]);\n }\n var holesMovements = [];\n var oneHoleMovements,\n verticesMovements = contourMovements.concat();\n for (var _h2 = 0, _hl2 = holes.length; _h2 < _hl2; _h2++) {\n var _ahole2 = holes[_h2];\n oneHoleMovements = [];\n for (var _i69 = 0, _il14 = _ahole2.length, _j8 = _il14 - 1, _k = _i69 + 1; _i69 < _il14; _i69++, _j8++, _k++) {\n if (_j8 === _il14) _j8 = 0;\n if (_k === _il14) _k = 0;\n\n // (j)---(i)---(k)\n oneHoleMovements[_i69] = getBevelVec(_ahole2[_i69], _ahole2[_j8], _ahole2[_k]);\n }\n holesMovements.push(oneHoleMovements);\n verticesMovements = verticesMovements.concat(oneHoleMovements);\n }\n\n // Loop bevelSegments, 1 for the front, 1 for the back\n\n for (var b = 0; b < bevelSegments; b++) {\n //for ( b = bevelSegments; b > 0; b -- ) {\n\n var t = b / bevelSegments;\n var z = bevelThickness * Math.cos(t * Math.PI / 2);\n var _bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset;\n\n // contract shape\n\n for (var _i70 = 0, _il15 = contour.length; _i70 < _il15; _i70++) {\n var vert = scalePt2(contour[_i70], contourMovements[_i70], _bs);\n v(vert.x, vert.y, -z);\n }\n\n // expand holes\n\n for (var _h3 = 0, _hl3 = holes.length; _h3 < _hl3; _h3++) {\n var _ahole3 = holes[_h3];\n oneHoleMovements = holesMovements[_h3];\n for (var _i71 = 0, _il16 = _ahole3.length; _i71 < _il16; _i71++) {\n var _vert = scalePt2(_ahole3[_i71], oneHoleMovements[_i71], _bs);\n v(_vert.x, _vert.y, -z);\n }\n }\n }\n var bs = bevelSize + bevelOffset;\n\n // Back facing vertices\n\n for (var _i72 = 0; _i72 < vlen; _i72++) {\n var _vert2 = bevelEnabled ? scalePt2(vertices[_i72], verticesMovements[_i72], bs) : vertices[_i72];\n if (!extrudeByPath) {\n v(_vert2.x, _vert2.y, 0);\n } else {\n // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x );\n\n normal.copy(splineTube.normals[0]).multiplyScalar(_vert2.x);\n binormal.copy(splineTube.binormals[0]).multiplyScalar(_vert2.y);\n position2.copy(extrudePts[0]).add(normal).add(binormal);\n v(position2.x, position2.y, position2.z);\n }\n }\n\n // Add stepped vertices...\n // Including front facing vertices\n\n for (var s = 1; s <= steps; s++) {\n for (var _i73 = 0; _i73 < vlen; _i73++) {\n var _vert3 = bevelEnabled ? scalePt2(vertices[_i73], verticesMovements[_i73], bs) : vertices[_i73];\n if (!extrudeByPath) {\n v(_vert3.x, _vert3.y, depth / steps * s);\n } else {\n // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x );\n\n normal.copy(splineTube.normals[s]).multiplyScalar(_vert3.x);\n binormal.copy(splineTube.binormals[s]).multiplyScalar(_vert3.y);\n position2.copy(extrudePts[s]).add(normal).add(binormal);\n v(position2.x, position2.y, position2.z);\n }\n }\n }\n\n // Add bevel segments planes\n\n //for ( b = 1; b <= bevelSegments; b ++ ) {\n for (var _b5 = bevelSegments - 1; _b5 >= 0; _b5--) {\n var _t = _b5 / bevelSegments;\n var _z2 = bevelThickness * Math.cos(_t * Math.PI / 2);\n var _bs2 = bevelSize * Math.sin(_t * Math.PI / 2) + bevelOffset;\n\n // contract shape\n\n for (var _i74 = 0, _il17 = contour.length; _i74 < _il17; _i74++) {\n var _vert4 = scalePt2(contour[_i74], contourMovements[_i74], _bs2);\n v(_vert4.x, _vert4.y, depth + _z2);\n }\n\n // expand holes\n\n for (var _h4 = 0, _hl4 = holes.length; _h4 < _hl4; _h4++) {\n var _ahole4 = holes[_h4];\n oneHoleMovements = holesMovements[_h4];\n for (var _i75 = 0, _il18 = _ahole4.length; _i75 < _il18; _i75++) {\n var _vert5 = scalePt2(_ahole4[_i75], oneHoleMovements[_i75], _bs2);\n if (!extrudeByPath) {\n v(_vert5.x, _vert5.y, depth + _z2);\n } else {\n v(_vert5.x, _vert5.y + extrudePts[steps - 1].y, extrudePts[steps - 1].x + _z2);\n }\n }\n }\n }\n\n /* Faces */\n\n // Top and bottom faces\n\n buildLidFaces();\n\n // Sides faces\n\n buildSideFaces();\n\n ///// Internal functions\n\n function buildLidFaces() {\n var start = verticesArray.length / 3;\n if (bevelEnabled) {\n var layer = 0; // steps + 1\n var offset = vlen * layer;\n\n // Bottom faces\n\n for (var _i76 = 0; _i76 < flen; _i76++) {\n var face = faces[_i76];\n f3(face[2] + offset, face[1] + offset, face[0] + offset);\n }\n layer = steps + bevelSegments * 2;\n offset = vlen * layer;\n\n // Top faces\n\n for (var _i77 = 0; _i77 < flen; _i77++) {\n var _face = faces[_i77];\n f3(_face[0] + offset, _face[1] + offset, _face[2] + offset);\n }\n } else {\n // Bottom faces\n\n for (var _i78 = 0; _i78 < flen; _i78++) {\n var _face2 = faces[_i78];\n f3(_face2[2], _face2[1], _face2[0]);\n }\n\n // Top faces\n\n for (var _i79 = 0; _i79 < flen; _i79++) {\n var _face3 = faces[_i79];\n f3(_face3[0] + vlen * steps, _face3[1] + vlen * steps, _face3[2] + vlen * steps);\n }\n }\n scope.addGroup(start, verticesArray.length / 3 - start, 0);\n }\n\n // Create faces for the z-sides of the shape\n\n function buildSideFaces() {\n var start = verticesArray.length / 3;\n var layeroffset = 0;\n sidewalls(contour, layeroffset);\n layeroffset += contour.length;\n for (var _h5 = 0, _hl5 = holes.length; _h5 < _hl5; _h5++) {\n var _ahole5 = holes[_h5];\n sidewalls(_ahole5, layeroffset);\n\n //, true\n layeroffset += _ahole5.length;\n }\n scope.addGroup(start, verticesArray.length / 3 - start, 1);\n }\n function sidewalls(contour, layeroffset) {\n var i = contour.length;\n while (--i >= 0) {\n var _j9 = i;\n var _k2 = i - 1;\n if (_k2 < 0) _k2 = contour.length - 1;\n\n //console.log('b', i,j, i-1, k,vertices.length);\n\n for (var _s4 = 0, sl = steps + bevelSegments * 2; _s4 < sl; _s4++) {\n var slen1 = vlen * _s4;\n var slen2 = vlen * (_s4 + 1);\n var a = layeroffset + _j9 + slen1,\n _b6 = layeroffset + _k2 + slen1,\n c = layeroffset + _k2 + slen2,\n d = layeroffset + _j9 + slen2;\n f4(a, _b6, c, d);\n }\n }\n }\n function v(x, y, z) {\n placeholder.push(x);\n placeholder.push(y);\n placeholder.push(z);\n }\n function f3(a, b, c) {\n addVertex(a);\n addVertex(b);\n addVertex(c);\n var nextIndex = verticesArray.length / 3;\n var uvs = uvgen.generateTopUV(scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1);\n addUV(uvs[0]);\n addUV(uvs[1]);\n addUV(uvs[2]);\n }\n function f4(a, b, c, d) {\n addVertex(a);\n addVertex(b);\n addVertex(d);\n addVertex(b);\n addVertex(c);\n addVertex(d);\n var nextIndex = verticesArray.length / 3;\n var uvs = uvgen.generateSideWallUV(scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1);\n addUV(uvs[0]);\n addUV(uvs[1]);\n addUV(uvs[3]);\n addUV(uvs[1]);\n addUV(uvs[2]);\n addUV(uvs[3]);\n }\n function addVertex(index) {\n verticesArray.push(placeholder[index * 3 + 0]);\n verticesArray.push(placeholder[index * 3 + 1]);\n verticesArray.push(placeholder[index * 3 + 2]);\n }\n function addUV(vector2) {\n uvArray.push(vector2.x);\n uvArray.push(vector2.y);\n }\n }\n return _this71;\n }\n _createClass(ExtrudeGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(ExtrudeGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(ExtrudeGeometry.prototype), \"toJSON\", this).call(this);\n var shapes = this.parameters.shapes;\n var options = this.parameters.options;\n return toJSON$1(shapes, options, data);\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data, shapes) {\n var geometryShapes = [];\n for (var j = 0, jl = data.shapes.length; j < jl; j++) {\n var shape = shapes[data.shapes[j]];\n geometryShapes.push(shape);\n }\n var extrudePath = data.options.extrudePath;\n if (extrudePath !== undefined) {\n data.options.extrudePath = new Curves[extrudePath.type]().fromJSON(extrudePath);\n }\n return new ExtrudeGeometry(geometryShapes, data.options);\n }\n }]);\n return ExtrudeGeometry;\n}(BufferGeometry);\nvar WorldUVGenerator = {\n generateTopUV: function generateTopUV(geometry, vertices, indexA, indexB, indexC) {\n var a_x = vertices[indexA * 3];\n var a_y = vertices[indexA * 3 + 1];\n var b_x = vertices[indexB * 3];\n var b_y = vertices[indexB * 3 + 1];\n var c_x = vertices[indexC * 3];\n var c_y = vertices[indexC * 3 + 1];\n return [new Vector2(a_x, a_y), new Vector2(b_x, b_y), new Vector2(c_x, c_y)];\n },\n generateSideWallUV: function generateSideWallUV(geometry, vertices, indexA, indexB, indexC, indexD) {\n var a_x = vertices[indexA * 3];\n var a_y = vertices[indexA * 3 + 1];\n var a_z = vertices[indexA * 3 + 2];\n var b_x = vertices[indexB * 3];\n var b_y = vertices[indexB * 3 + 1];\n var b_z = vertices[indexB * 3 + 2];\n var c_x = vertices[indexC * 3];\n var c_y = vertices[indexC * 3 + 1];\n var c_z = vertices[indexC * 3 + 2];\n var d_x = vertices[indexD * 3];\n var d_y = vertices[indexD * 3 + 1];\n var d_z = vertices[indexD * 3 + 2];\n if (Math.abs(a_y - b_y) < Math.abs(a_x - b_x)) {\n return [new Vector2(a_x, 1 - a_z), new Vector2(b_x, 1 - b_z), new Vector2(c_x, 1 - c_z), new Vector2(d_x, 1 - d_z)];\n } else {\n return [new Vector2(a_y, 1 - a_z), new Vector2(b_y, 1 - b_z), new Vector2(c_y, 1 - c_z), new Vector2(d_y, 1 - d_z)];\n }\n }\n};\nfunction toJSON$1(shapes, options, data) {\n data.shapes = [];\n if (Array.isArray(shapes)) {\n for (var i = 0, l = shapes.length; i < l; i++) {\n var shape = shapes[i];\n data.shapes.push(shape.uuid);\n }\n } else {\n data.shapes.push(shapes.uuid);\n }\n data.options = Object.assign({}, options);\n if (options.extrudePath !== undefined) data.options.extrudePath = options.extrudePath.toJSON();\n return data;\n}\nvar IcosahedronGeometry = /*#__PURE__*/function (_PolyhedronGeometry2) {\n _inherits(IcosahedronGeometry, _PolyhedronGeometry2);\n var _super81 = _createSuper(IcosahedronGeometry);\n function IcosahedronGeometry() {\n var _this72;\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n _classCallCheck(this, IcosahedronGeometry);\n var t = (1 + Math.sqrt(5)) / 2;\n var vertices = [-1, t, 0, 1, t, 0, -1, -t, 0, 1, -t, 0, 0, -1, t, 0, 1, t, 0, -1, -t, 0, 1, -t, t, 0, -1, t, 0, 1, -t, 0, -1, -t, 0, 1];\n var indices = [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];\n _this72 = _super81.call(this, vertices, indices, radius, detail);\n _this72.type = 'IcosahedronGeometry';\n _this72.parameters = {\n radius: radius,\n detail: detail\n };\n return _this72;\n }\n _createClass(IcosahedronGeometry, null, [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new IcosahedronGeometry(data.radius, data.detail);\n }\n }]);\n return IcosahedronGeometry;\n}(PolyhedronGeometry);\nvar OctahedronGeometry = /*#__PURE__*/function (_PolyhedronGeometry3) {\n _inherits(OctahedronGeometry, _PolyhedronGeometry3);\n var _super82 = _createSuper(OctahedronGeometry);\n function OctahedronGeometry() {\n var _this73;\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n _classCallCheck(this, OctahedronGeometry);\n var vertices = [1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1];\n var indices = [0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2];\n _this73 = _super82.call(this, vertices, indices, radius, detail);\n _this73.type = 'OctahedronGeometry';\n _this73.parameters = {\n radius: radius,\n detail: detail\n };\n return _this73;\n }\n _createClass(OctahedronGeometry, null, [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new OctahedronGeometry(data.radius, data.detail);\n }\n }]);\n return OctahedronGeometry;\n}(PolyhedronGeometry);\nvar RingGeometry = /*#__PURE__*/function (_BufferGeometry9) {\n _inherits(RingGeometry, _BufferGeometry9);\n var _super83 = _createSuper(RingGeometry);\n function RingGeometry() {\n var _this74;\n var innerRadius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.5;\n var outerRadius = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var thetaSegments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 32;\n var phiSegments = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n var thetaStart = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n var thetaLength = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : Math.PI * 2;\n _classCallCheck(this, RingGeometry);\n _this74 = _super83.call(this);\n _this74.type = 'RingGeometry';\n _this74.parameters = {\n innerRadius: innerRadius,\n outerRadius: outerRadius,\n thetaSegments: thetaSegments,\n phiSegments: phiSegments,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n thetaSegments = Math.max(3, thetaSegments);\n phiSegments = Math.max(1, phiSegments);\n\n // buffers\n\n var indices = [];\n var vertices = [];\n var normals = [];\n var uvs = [];\n\n // some helper variables\n\n var radius = innerRadius;\n var radiusStep = (outerRadius - innerRadius) / phiSegments;\n var vertex = new Vector3();\n var uv = new Vector2();\n\n // generate vertices, normals and uvs\n\n for (var j = 0; j <= phiSegments; j++) {\n for (var i = 0; i <= thetaSegments; i++) {\n // values are generate from the inside of the ring to the outside\n\n var segment = thetaStart + i / thetaSegments * thetaLength;\n\n // vertex\n\n vertex.x = radius * Math.cos(segment);\n vertex.y = radius * Math.sin(segment);\n vertices.push(vertex.x, vertex.y, vertex.z);\n\n // normal\n\n normals.push(0, 0, 1);\n\n // uv\n\n uv.x = (vertex.x / outerRadius + 1) / 2;\n uv.y = (vertex.y / outerRadius + 1) / 2;\n uvs.push(uv.x, uv.y);\n }\n\n // increase the radius for next row of vertices\n\n radius += radiusStep;\n }\n\n // indices\n\n for (var _j10 = 0; _j10 < phiSegments; _j10++) {\n var thetaSegmentLevel = _j10 * (thetaSegments + 1);\n for (var _i80 = 0; _i80 < thetaSegments; _i80++) {\n var _segment = _i80 + thetaSegmentLevel;\n var a = _segment;\n var b = _segment + thetaSegments + 1;\n var c = _segment + thetaSegments + 2;\n var d = _segment + 1;\n\n // faces\n\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n }\n\n // build geometry\n\n _this74.setIndex(indices);\n _this74.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n _this74.setAttribute('normal', new Float32BufferAttribute(normals, 3));\n _this74.setAttribute('uv', new Float32BufferAttribute(uvs, 2));\n return _this74;\n }\n _createClass(RingGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(RingGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new RingGeometry(data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength);\n }\n }]);\n return RingGeometry;\n}(BufferGeometry);\nvar ShapeGeometry = /*#__PURE__*/function (_BufferGeometry10) {\n _inherits(ShapeGeometry, _BufferGeometry10);\n var _super84 = _createSuper(ShapeGeometry);\n function ShapeGeometry() {\n var _this75;\n var shapes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Shape([new Vector2(0, 0.5), new Vector2(-0.5, -0.5), new Vector2(0.5, -0.5)]);\n var curveSegments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 12;\n _classCallCheck(this, ShapeGeometry);\n _this75 = _super84.call(this);\n _this75.type = 'ShapeGeometry';\n _this75.parameters = {\n shapes: shapes,\n curveSegments: curveSegments\n };\n\n // buffers\n\n var indices = [];\n var vertices = [];\n var normals = [];\n var uvs = [];\n\n // helper variables\n\n var groupStart = 0;\n var groupCount = 0;\n\n // allow single and array values for \"shapes\" parameter\n\n if (Array.isArray(shapes) === false) {\n addShape(shapes);\n } else {\n for (var i = 0; i < shapes.length; i++) {\n addShape(shapes[i]);\n _this75.addGroup(groupStart, groupCount, i); // enables MultiMaterial support\n\n groupStart += groupCount;\n groupCount = 0;\n }\n }\n\n // build geometry\n\n _this75.setIndex(indices);\n _this75.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n _this75.setAttribute('normal', new Float32BufferAttribute(normals, 3));\n _this75.setAttribute('uv', new Float32BufferAttribute(uvs, 2));\n\n // helper functions\n\n function addShape(shape) {\n var indexOffset = vertices.length / 3;\n var points = shape.extractPoints(curveSegments);\n var shapeVertices = points.shape;\n var shapeHoles = points.holes;\n\n // check direction of vertices\n\n if (ShapeUtils.isClockWise(shapeVertices) === false) {\n shapeVertices = shapeVertices.reverse();\n }\n for (var _i81 = 0, l = shapeHoles.length; _i81 < l; _i81++) {\n var shapeHole = shapeHoles[_i81];\n if (ShapeUtils.isClockWise(shapeHole) === true) {\n shapeHoles[_i81] = shapeHole.reverse();\n }\n }\n var faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles);\n\n // join vertices of inner and outer paths to a single array\n\n for (var _i82 = 0, _l8 = shapeHoles.length; _i82 < _l8; _i82++) {\n var _shapeHole = shapeHoles[_i82];\n shapeVertices = shapeVertices.concat(_shapeHole);\n }\n\n // vertices, normals, uvs\n\n for (var _i83 = 0, _l9 = shapeVertices.length; _i83 < _l9; _i83++) {\n var _vertex2 = shapeVertices[_i83];\n vertices.push(_vertex2.x, _vertex2.y, 0);\n normals.push(0, 0, 1);\n uvs.push(_vertex2.x, _vertex2.y); // world uvs\n }\n\n // indices\n\n for (var _i84 = 0, _l10 = faces.length; _i84 < _l10; _i84++) {\n var face = faces[_i84];\n var a = face[0] + indexOffset;\n var b = face[1] + indexOffset;\n var c = face[2] + indexOffset;\n indices.push(a, b, c);\n groupCount += 3;\n }\n }\n return _this75;\n }\n _createClass(ShapeGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(ShapeGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(ShapeGeometry.prototype), \"toJSON\", this).call(this);\n var shapes = this.parameters.shapes;\n return _toJSON(shapes, data);\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data, shapes) {\n var geometryShapes = [];\n for (var j = 0, jl = data.shapes.length; j < jl; j++) {\n var shape = shapes[data.shapes[j]];\n geometryShapes.push(shape);\n }\n return new ShapeGeometry(geometryShapes, data.curveSegments);\n }\n }]);\n return ShapeGeometry;\n}(BufferGeometry);\nfunction _toJSON(shapes, data) {\n data.shapes = [];\n if (Array.isArray(shapes)) {\n for (var i = 0, l = shapes.length; i < l; i++) {\n var shape = shapes[i];\n data.shapes.push(shape.uuid);\n }\n } else {\n data.shapes.push(shapes.uuid);\n }\n return data;\n}\nvar SphereGeometry = /*#__PURE__*/function (_BufferGeometry11) {\n _inherits(SphereGeometry, _BufferGeometry11);\n var _super85 = _createSuper(SphereGeometry);\n function SphereGeometry() {\n var _this76;\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var widthSegments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 32;\n var heightSegments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 16;\n var phiStart = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n var phiLength = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Math.PI * 2;\n var thetaStart = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;\n var thetaLength = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : Math.PI;\n _classCallCheck(this, SphereGeometry);\n _this76 = _super85.call(this);\n _this76.type = 'SphereGeometry';\n _this76.parameters = {\n radius: radius,\n widthSegments: widthSegments,\n heightSegments: heightSegments,\n phiStart: phiStart,\n phiLength: phiLength,\n thetaStart: thetaStart,\n thetaLength: thetaLength\n };\n widthSegments = Math.max(3, Math.floor(widthSegments));\n heightSegments = Math.max(2, Math.floor(heightSegments));\n var thetaEnd = Math.min(thetaStart + thetaLength, Math.PI);\n var index = 0;\n var grid = [];\n var vertex = new Vector3();\n var normal = new Vector3();\n\n // buffers\n\n var indices = [];\n var vertices = [];\n var normals = [];\n var uvs = [];\n\n // generate vertices, normals and uvs\n\n for (var iy = 0; iy <= heightSegments; iy++) {\n var verticesRow = [];\n var v = iy / heightSegments;\n\n // special case for the poles\n\n var uOffset = 0;\n if (iy === 0 && thetaStart === 0) {\n uOffset = 0.5 / widthSegments;\n } else if (iy === heightSegments && thetaEnd === Math.PI) {\n uOffset = -0.5 / widthSegments;\n }\n for (var ix = 0; ix <= widthSegments; ix++) {\n var u = ix / widthSegments;\n\n // vertex\n\n vertex.x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);\n vertex.y = radius * Math.cos(thetaStart + v * thetaLength);\n vertex.z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);\n vertices.push(vertex.x, vertex.y, vertex.z);\n\n // normal\n\n normal.copy(vertex).normalize();\n normals.push(normal.x, normal.y, normal.z);\n\n // uv\n\n uvs.push(u + uOffset, 1 - v);\n verticesRow.push(index++);\n }\n grid.push(verticesRow);\n }\n\n // indices\n\n for (var _iy3 = 0; _iy3 < heightSegments; _iy3++) {\n for (var _ix3 = 0; _ix3 < widthSegments; _ix3++) {\n var a = grid[_iy3][_ix3 + 1];\n var b = grid[_iy3][_ix3];\n var c = grid[_iy3 + 1][_ix3];\n var d = grid[_iy3 + 1][_ix3 + 1];\n if (_iy3 !== 0 || thetaStart > 0) indices.push(a, b, d);\n if (_iy3 !== heightSegments - 1 || thetaEnd < Math.PI) indices.push(b, c, d);\n }\n }\n\n // build geometry\n\n _this76.setIndex(indices);\n _this76.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n _this76.setAttribute('normal', new Float32BufferAttribute(normals, 3));\n _this76.setAttribute('uv', new Float32BufferAttribute(uvs, 2));\n return _this76;\n }\n _createClass(SphereGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(SphereGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new SphereGeometry(data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength);\n }\n }]);\n return SphereGeometry;\n}(BufferGeometry);\nvar TetrahedronGeometry = /*#__PURE__*/function (_PolyhedronGeometry4) {\n _inherits(TetrahedronGeometry, _PolyhedronGeometry4);\n var _super86 = _createSuper(TetrahedronGeometry);\n function TetrahedronGeometry() {\n var _this77;\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n _classCallCheck(this, TetrahedronGeometry);\n var vertices = [1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1];\n var indices = [2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1];\n _this77 = _super86.call(this, vertices, indices, radius, detail);\n _this77.type = 'TetrahedronGeometry';\n _this77.parameters = {\n radius: radius,\n detail: detail\n };\n return _this77;\n }\n _createClass(TetrahedronGeometry, null, [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new TetrahedronGeometry(data.radius, data.detail);\n }\n }]);\n return TetrahedronGeometry;\n}(PolyhedronGeometry);\nvar TorusGeometry = /*#__PURE__*/function (_BufferGeometry12) {\n _inherits(TorusGeometry, _BufferGeometry12);\n var _super87 = _createSuper(TorusGeometry);\n function TorusGeometry() {\n var _this78;\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var tube = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.4;\n var radialSegments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 12;\n var tubularSegments = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 48;\n var arc = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Math.PI * 2;\n _classCallCheck(this, TorusGeometry);\n _this78 = _super87.call(this);\n _this78.type = 'TorusGeometry';\n _this78.parameters = {\n radius: radius,\n tube: tube,\n radialSegments: radialSegments,\n tubularSegments: tubularSegments,\n arc: arc\n };\n radialSegments = Math.floor(radialSegments);\n tubularSegments = Math.floor(tubularSegments);\n\n // buffers\n\n var indices = [];\n var vertices = [];\n var normals = [];\n var uvs = [];\n\n // helper variables\n\n var center = new Vector3();\n var vertex = new Vector3();\n var normal = new Vector3();\n\n // generate vertices, normals and uvs\n\n for (var j = 0; j <= radialSegments; j++) {\n for (var i = 0; i <= tubularSegments; i++) {\n var u = i / tubularSegments * arc;\n var v = j / radialSegments * Math.PI * 2;\n\n // vertex\n\n vertex.x = (radius + tube * Math.cos(v)) * Math.cos(u);\n vertex.y = (radius + tube * Math.cos(v)) * Math.sin(u);\n vertex.z = tube * Math.sin(v);\n vertices.push(vertex.x, vertex.y, vertex.z);\n\n // normal\n\n center.x = radius * Math.cos(u);\n center.y = radius * Math.sin(u);\n normal.subVectors(vertex, center).normalize();\n normals.push(normal.x, normal.y, normal.z);\n\n // uv\n\n uvs.push(i / tubularSegments);\n uvs.push(j / radialSegments);\n }\n }\n\n // generate indices\n\n for (var _j11 = 1; _j11 <= radialSegments; _j11++) {\n for (var _i85 = 1; _i85 <= tubularSegments; _i85++) {\n // indices\n\n var a = (tubularSegments + 1) * _j11 + _i85 - 1;\n var b = (tubularSegments + 1) * (_j11 - 1) + _i85 - 1;\n var c = (tubularSegments + 1) * (_j11 - 1) + _i85;\n var d = (tubularSegments + 1) * _j11 + _i85;\n\n // faces\n\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n }\n\n // build geometry\n\n _this78.setIndex(indices);\n _this78.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n _this78.setAttribute('normal', new Float32BufferAttribute(normals, 3));\n _this78.setAttribute('uv', new Float32BufferAttribute(uvs, 2));\n return _this78;\n }\n _createClass(TorusGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(TorusGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new TorusGeometry(data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc);\n }\n }]);\n return TorusGeometry;\n}(BufferGeometry);\nvar TorusKnotGeometry = /*#__PURE__*/function (_BufferGeometry13) {\n _inherits(TorusKnotGeometry, _BufferGeometry13);\n var _super88 = _createSuper(TorusKnotGeometry);\n function TorusKnotGeometry() {\n var _this79;\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var tube = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.4;\n var tubularSegments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 64;\n var radialSegments = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 8;\n var p = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;\n var q = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 3;\n _classCallCheck(this, TorusKnotGeometry);\n _this79 = _super88.call(this);\n _this79.type = 'TorusKnotGeometry';\n _this79.parameters = {\n radius: radius,\n tube: tube,\n tubularSegments: tubularSegments,\n radialSegments: radialSegments,\n p: p,\n q: q\n };\n tubularSegments = Math.floor(tubularSegments);\n radialSegments = Math.floor(radialSegments);\n\n // buffers\n\n var indices = [];\n var vertices = [];\n var normals = [];\n var uvs = [];\n\n // helper variables\n\n var vertex = new Vector3();\n var normal = new Vector3();\n var P1 = new Vector3();\n var P2 = new Vector3();\n var B = new Vector3();\n var T = new Vector3();\n var N = new Vector3();\n\n // generate vertices, normals and uvs\n\n for (var i = 0; i <= tubularSegments; ++i) {\n // the radian \"u\" is used to calculate the position on the torus curve of the current tubular segment\n\n var u = i / tubularSegments * p * Math.PI * 2;\n\n // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead.\n // these points are used to create a special \"coordinate space\", which is necessary to calculate the correct vertex positions\n\n calculatePositionOnCurve(u, p, q, radius, P1);\n calculatePositionOnCurve(u + 0.01, p, q, radius, P2);\n\n // calculate orthonormal basis\n\n T.subVectors(P2, P1);\n N.addVectors(P2, P1);\n B.crossVectors(T, N);\n N.crossVectors(B, T);\n\n // normalize B, N. T can be ignored, we don't use it\n\n B.normalize();\n N.normalize();\n for (var j = 0; j <= radialSegments; ++j) {\n // now calculate the vertices. they are nothing more than an extrusion of the torus curve.\n // because we extrude a shape in the xy-plane, there is no need to calculate a z-value.\n\n var v = j / radialSegments * Math.PI * 2;\n var cx = -tube * Math.cos(v);\n var cy = tube * Math.sin(v);\n\n // now calculate the final vertex position.\n // first we orient the extrusion with our basis vectors, then we add it to the current position on the curve\n\n vertex.x = P1.x + (cx * N.x + cy * B.x);\n vertex.y = P1.y + (cx * N.y + cy * B.y);\n vertex.z = P1.z + (cx * N.z + cy * B.z);\n vertices.push(vertex.x, vertex.y, vertex.z);\n\n // normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)\n\n normal.subVectors(vertex, P1).normalize();\n normals.push(normal.x, normal.y, normal.z);\n\n // uv\n\n uvs.push(i / tubularSegments);\n uvs.push(j / radialSegments);\n }\n }\n\n // generate indices\n\n for (var _j12 = 1; _j12 <= tubularSegments; _j12++) {\n for (var _i86 = 1; _i86 <= radialSegments; _i86++) {\n // indices\n\n var a = (radialSegments + 1) * (_j12 - 1) + (_i86 - 1);\n var b = (radialSegments + 1) * _j12 + (_i86 - 1);\n var c = (radialSegments + 1) * _j12 + _i86;\n var d = (radialSegments + 1) * (_j12 - 1) + _i86;\n\n // faces\n\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n }\n\n // build geometry\n\n _this79.setIndex(indices);\n _this79.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n _this79.setAttribute('normal', new Float32BufferAttribute(normals, 3));\n _this79.setAttribute('uv', new Float32BufferAttribute(uvs, 2));\n\n // this function calculates the current position on the torus curve\n\n function calculatePositionOnCurve(u, p, q, radius, position) {\n var cu = Math.cos(u);\n var su = Math.sin(u);\n var quOverP = q / p * u;\n var cs = Math.cos(quOverP);\n position.x = radius * (2 + cs) * 0.5 * cu;\n position.y = radius * (2 + cs) * su * 0.5;\n position.z = radius * Math.sin(quOverP) * 0.5;\n }\n return _this79;\n }\n _createClass(TorusKnotGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(TorusKnotGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n return new TorusKnotGeometry(data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q);\n }\n }]);\n return TorusKnotGeometry;\n}(BufferGeometry);\nvar TubeGeometry = /*#__PURE__*/function (_BufferGeometry14) {\n _inherits(TubeGeometry, _BufferGeometry14);\n var _super89 = _createSuper(TubeGeometry);\n function TubeGeometry() {\n var _this80;\n var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new QuadraticBezierCurve3(new Vector3(-1, -1, 0), new Vector3(-1, 1, 0), new Vector3(1, 1, 0));\n var tubularSegments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 64;\n var radius = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var radialSegments = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 8;\n var closed = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n _classCallCheck(this, TubeGeometry);\n _this80 = _super89.call(this);\n _this80.type = 'TubeGeometry';\n _this80.parameters = {\n path: path,\n tubularSegments: tubularSegments,\n radius: radius,\n radialSegments: radialSegments,\n closed: closed\n };\n var frames = path.computeFrenetFrames(tubularSegments, closed);\n\n // expose internals\n\n _this80.tangents = frames.tangents;\n _this80.normals = frames.normals;\n _this80.binormals = frames.binormals;\n\n // helper variables\n\n var vertex = new Vector3();\n var normal = new Vector3();\n var uv = new Vector2();\n var P = new Vector3();\n\n // buffer\n\n var vertices = [];\n var normals = [];\n var uvs = [];\n var indices = [];\n\n // create buffer data\n\n generateBufferData();\n\n // build geometry\n\n _this80.setIndex(indices);\n _this80.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n _this80.setAttribute('normal', new Float32BufferAttribute(normals, 3));\n _this80.setAttribute('uv', new Float32BufferAttribute(uvs, 2));\n\n // functions\n\n function generateBufferData() {\n for (var i = 0; i < tubularSegments; i++) {\n generateSegment(i);\n }\n\n // if the geometry is not closed, generate the last row of vertices and normals\n // at the regular position on the given path\n //\n // if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ)\n\n generateSegment(closed === false ? tubularSegments : 0);\n\n // uvs are generated in a separate function.\n // this makes it easy compute correct values for closed geometries\n\n generateUVs();\n\n // finally create faces\n\n generateIndices();\n }\n function generateSegment(i) {\n // we use getPointAt to sample evenly distributed points from the given path\n\n P = path.getPointAt(i / tubularSegments, P);\n\n // retrieve corresponding normal and binormal\n\n var N = frames.normals[i];\n var B = frames.binormals[i];\n\n // generate normals and vertices for the current segment\n\n for (var j = 0; j <= radialSegments; j++) {\n var v = j / radialSegments * Math.PI * 2;\n var sin = Math.sin(v);\n var cos = -Math.cos(v);\n\n // normal\n\n normal.x = cos * N.x + sin * B.x;\n normal.y = cos * N.y + sin * B.y;\n normal.z = cos * N.z + sin * B.z;\n normal.normalize();\n normals.push(normal.x, normal.y, normal.z);\n\n // vertex\n\n vertex.x = P.x + radius * normal.x;\n vertex.y = P.y + radius * normal.y;\n vertex.z = P.z + radius * normal.z;\n vertices.push(vertex.x, vertex.y, vertex.z);\n }\n }\n function generateIndices() {\n for (var j = 1; j <= tubularSegments; j++) {\n for (var i = 1; i <= radialSegments; i++) {\n var a = (radialSegments + 1) * (j - 1) + (i - 1);\n var b = (radialSegments + 1) * j + (i - 1);\n var c = (radialSegments + 1) * j + i;\n var d = (radialSegments + 1) * (j - 1) + i;\n\n // faces\n\n indices.push(a, b, d);\n indices.push(b, c, d);\n }\n }\n }\n function generateUVs() {\n for (var i = 0; i <= tubularSegments; i++) {\n for (var j = 0; j <= radialSegments; j++) {\n uv.x = i / tubularSegments;\n uv.y = j / radialSegments;\n uvs.push(uv.x, uv.y);\n }\n }\n }\n return _this80;\n }\n _createClass(TubeGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(TubeGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(TubeGeometry.prototype), \"toJSON\", this).call(this);\n data.path = this.parameters.path.toJSON();\n return data;\n }\n }], [{\n key: \"fromJSON\",\n value: function fromJSON(data) {\n // This only works for built-in curves (e.g. CatmullRomCurve3).\n // User defined curves or instances of CurvePath will not be deserialized.\n return new TubeGeometry(new Curves[data.path.type]().fromJSON(data.path), data.tubularSegments, data.radius, data.radialSegments, data.closed);\n }\n }]);\n return TubeGeometry;\n}(BufferGeometry);\nvar WireframeGeometry = /*#__PURE__*/function (_BufferGeometry15) {\n _inherits(WireframeGeometry, _BufferGeometry15);\n var _super90 = _createSuper(WireframeGeometry);\n function WireframeGeometry() {\n var _this81;\n var geometry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n _classCallCheck(this, WireframeGeometry);\n _this81 = _super90.call(this);\n _this81.type = 'WireframeGeometry';\n _this81.parameters = {\n geometry: geometry\n };\n if (geometry !== null) {\n // buffer\n\n var vertices = [];\n var edges = new Set();\n\n // helper variables\n\n var start = new Vector3();\n var end = new Vector3();\n if (geometry.index !== null) {\n // indexed BufferGeometry\n\n var position = geometry.attributes.position;\n var indices = geometry.index;\n var groups = geometry.groups;\n if (groups.length === 0) {\n groups = [{\n start: 0,\n count: indices.count,\n materialIndex: 0\n }];\n }\n\n // create a data structure that contains all edges without duplicates\n\n for (var o = 0, ol = groups.length; o < ol; ++o) {\n var group = groups[o];\n var groupStart = group.start;\n var groupCount = group.count;\n for (var i = groupStart, l = groupStart + groupCount; i < l; i += 3) {\n for (var j = 0; j < 3; j++) {\n var index1 = indices.getX(i + j);\n var index2 = indices.getX(i + (j + 1) % 3);\n start.fromBufferAttribute(position, index1);\n end.fromBufferAttribute(position, index2);\n if (isUniqueEdge(start, end, edges) === true) {\n vertices.push(start.x, start.y, start.z);\n vertices.push(end.x, end.y, end.z);\n }\n }\n }\n }\n } else {\n // non-indexed BufferGeometry\n\n var _position2 = geometry.attributes.position;\n for (var _i87 = 0, _l11 = _position2.count / 3; _i87 < _l11; _i87++) {\n for (var _j13 = 0; _j13 < 3; _j13++) {\n // three edges per triangle, an edge is represented as (index1, index2)\n // e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)\n\n var _index = 3 * _i87 + _j13;\n var _index2 = 3 * _i87 + (_j13 + 1) % 3;\n start.fromBufferAttribute(_position2, _index);\n end.fromBufferAttribute(_position2, _index2);\n if (isUniqueEdge(start, end, edges) === true) {\n vertices.push(start.x, start.y, start.z);\n vertices.push(end.x, end.y, end.z);\n }\n }\n }\n }\n\n // build geometry\n\n _this81.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n }\n return _this81;\n }\n _createClass(WireframeGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(WireframeGeometry.prototype), \"copy\", this).call(this, source);\n this.parameters = Object.assign({}, source.parameters);\n return this;\n }\n }]);\n return WireframeGeometry;\n}(BufferGeometry);\nfunction isUniqueEdge(start, end, edges) {\n var hash1 = \"\".concat(start.x, \",\").concat(start.y, \",\").concat(start.z, \"-\").concat(end.x, \",\").concat(end.y, \",\").concat(end.z);\n var hash2 = \"\".concat(end.x, \",\").concat(end.y, \",\").concat(end.z, \"-\").concat(start.x, \",\").concat(start.y, \",\").concat(start.z); // coincident edge\n\n if (edges.has(hash1) === true || edges.has(hash2) === true) {\n return false;\n } else {\n edges.add(hash1);\n edges.add(hash2);\n return true;\n }\n}\nvar Geometries = /*#__PURE__*/Object.freeze({\n __proto__: null,\n BoxGeometry: BoxGeometry,\n CapsuleGeometry: CapsuleGeometry,\n CircleGeometry: CircleGeometry,\n ConeGeometry: ConeGeometry,\n CylinderGeometry: CylinderGeometry,\n DodecahedronGeometry: DodecahedronGeometry,\n EdgesGeometry: EdgesGeometry,\n ExtrudeGeometry: ExtrudeGeometry,\n IcosahedronGeometry: IcosahedronGeometry,\n LatheGeometry: LatheGeometry,\n OctahedronGeometry: OctahedronGeometry,\n PlaneGeometry: PlaneGeometry,\n PolyhedronGeometry: PolyhedronGeometry,\n RingGeometry: RingGeometry,\n ShapeGeometry: ShapeGeometry,\n SphereGeometry: SphereGeometry,\n TetrahedronGeometry: TetrahedronGeometry,\n TorusGeometry: TorusGeometry,\n TorusKnotGeometry: TorusKnotGeometry,\n TubeGeometry: TubeGeometry,\n WireframeGeometry: WireframeGeometry\n});\nvar ShadowMaterial = /*#__PURE__*/function (_Material8) {\n _inherits(ShadowMaterial, _Material8);\n var _super91 = _createSuper(ShadowMaterial);\n function ShadowMaterial(parameters) {\n var _this82;\n _classCallCheck(this, ShadowMaterial);\n _this82 = _super91.call(this);\n _this82.isShadowMaterial = true;\n _this82.type = 'ShadowMaterial';\n _this82.color = new Color(0x000000);\n _this82.transparent = true;\n _this82.fog = true;\n _this82.setValues(parameters);\n return _this82;\n }\n _createClass(ShadowMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(ShadowMaterial.prototype), \"copy\", this).call(this, source);\n this.color.copy(source.color);\n this.fog = source.fog;\n return this;\n }\n }]);\n return ShadowMaterial;\n}(Material);\nvar RawShaderMaterial = /*#__PURE__*/function (_ShaderMaterial) {\n _inherits(RawShaderMaterial, _ShaderMaterial);\n var _super92 = _createSuper(RawShaderMaterial);\n function RawShaderMaterial(parameters) {\n var _this83;\n _classCallCheck(this, RawShaderMaterial);\n _this83 = _super92.call(this, parameters);\n _this83.isRawShaderMaterial = true;\n _this83.type = 'RawShaderMaterial';\n return _this83;\n }\n return _createClass(RawShaderMaterial);\n}(ShaderMaterial);\nvar MeshStandardMaterial = /*#__PURE__*/function (_Material9) {\n _inherits(MeshStandardMaterial, _Material9);\n var _super93 = _createSuper(MeshStandardMaterial);\n function MeshStandardMaterial(parameters) {\n var _this84;\n _classCallCheck(this, MeshStandardMaterial);\n _this84 = _super93.call(this);\n _this84.isMeshStandardMaterial = true;\n _this84.defines = {\n 'STANDARD': ''\n };\n _this84.type = 'MeshStandardMaterial';\n _this84.color = new Color(0xffffff); // diffuse\n _this84.roughness = 1.0;\n _this84.metalness = 0.0;\n _this84.map = null;\n _this84.lightMap = null;\n _this84.lightMapIntensity = 1.0;\n _this84.aoMap = null;\n _this84.aoMapIntensity = 1.0;\n _this84.emissive = new Color(0x000000);\n _this84.emissiveIntensity = 1.0;\n _this84.emissiveMap = null;\n _this84.bumpMap = null;\n _this84.bumpScale = 1;\n _this84.normalMap = null;\n _this84.normalMapType = TangentSpaceNormalMap;\n _this84.normalScale = new Vector2(1, 1);\n _this84.displacementMap = null;\n _this84.displacementScale = 1;\n _this84.displacementBias = 0;\n _this84.roughnessMap = null;\n _this84.metalnessMap = null;\n _this84.alphaMap = null;\n _this84.envMap = null;\n _this84.envMapIntensity = 1.0;\n _this84.wireframe = false;\n _this84.wireframeLinewidth = 1;\n _this84.wireframeLinecap = 'round';\n _this84.wireframeLinejoin = 'round';\n _this84.flatShading = false;\n _this84.fog = true;\n _this84.setValues(parameters);\n return _this84;\n }\n _createClass(MeshStandardMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(MeshStandardMaterial.prototype), \"copy\", this).call(this, source);\n this.defines = {\n 'STANDARD': ''\n };\n this.color.copy(source.color);\n this.roughness = source.roughness;\n this.metalness = source.metalness;\n this.map = source.map;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.emissive.copy(source.emissive);\n this.emissiveMap = source.emissiveMap;\n this.emissiveIntensity = source.emissiveIntensity;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.roughnessMap = source.roughnessMap;\n this.metalnessMap = source.metalnessMap;\n this.alphaMap = source.alphaMap;\n this.envMap = source.envMap;\n this.envMapIntensity = source.envMapIntensity;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.flatShading = source.flatShading;\n this.fog = source.fog;\n return this;\n }\n }]);\n return MeshStandardMaterial;\n}(Material);\nvar MeshPhysicalMaterial = /*#__PURE__*/function (_MeshStandardMaterial) {\n _inherits(MeshPhysicalMaterial, _MeshStandardMaterial);\n var _super94 = _createSuper(MeshPhysicalMaterial);\n function MeshPhysicalMaterial(parameters) {\n var _this85;\n _classCallCheck(this, MeshPhysicalMaterial);\n _this85 = _super94.call(this);\n _this85.isMeshPhysicalMaterial = true;\n _this85.defines = {\n 'STANDARD': '',\n 'PHYSICAL': ''\n };\n _this85.type = 'MeshPhysicalMaterial';\n _this85.clearcoatMap = null;\n _this85.clearcoatRoughness = 0.0;\n _this85.clearcoatRoughnessMap = null;\n _this85.clearcoatNormalScale = new Vector2(1, 1);\n _this85.clearcoatNormalMap = null;\n _this85.ior = 1.5;\n Object.defineProperty(_assertThisInitialized(_this85), 'reflectivity', {\n get: function get() {\n return clamp(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1);\n },\n set: function set(reflectivity) {\n this.ior = (1 + 0.4 * reflectivity) / (1 - 0.4 * reflectivity);\n }\n });\n _this85.iridescenceMap = null;\n _this85.iridescenceIOR = 1.3;\n _this85.iridescenceThicknessRange = [100, 400];\n _this85.iridescenceThicknessMap = null;\n _this85.sheenColor = new Color(0x000000);\n _this85.sheenColorMap = null;\n _this85.sheenRoughness = 1.0;\n _this85.sheenRoughnessMap = null;\n _this85.transmissionMap = null;\n _this85.thickness = 0;\n _this85.thicknessMap = null;\n _this85.attenuationDistance = Infinity;\n _this85.attenuationColor = new Color(1, 1, 1);\n _this85.specularIntensity = 1.0;\n _this85.specularIntensityMap = null;\n _this85.specularColor = new Color(1, 1, 1);\n _this85.specularColorMap = null;\n _this85._sheen = 0.0;\n _this85._clearcoat = 0;\n _this85._iridescence = 0;\n _this85._transmission = 0;\n _this85.setValues(parameters);\n return _this85;\n }\n _createClass(MeshPhysicalMaterial, [{\n key: \"sheen\",\n get: function get() {\n return this._sheen;\n },\n set: function set(value) {\n if (this._sheen > 0 !== value > 0) {\n this.version++;\n }\n this._sheen = value;\n }\n }, {\n key: \"clearcoat\",\n get: function get() {\n return this._clearcoat;\n },\n set: function set(value) {\n if (this._clearcoat > 0 !== value > 0) {\n this.version++;\n }\n this._clearcoat = value;\n }\n }, {\n key: \"iridescence\",\n get: function get() {\n return this._iridescence;\n },\n set: function set(value) {\n if (this._iridescence > 0 !== value > 0) {\n this.version++;\n }\n this._iridescence = value;\n }\n }, {\n key: \"transmission\",\n get: function get() {\n return this._transmission;\n },\n set: function set(value) {\n if (this._transmission > 0 !== value > 0) {\n this.version++;\n }\n this._transmission = value;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(MeshPhysicalMaterial.prototype), \"copy\", this).call(this, source);\n this.defines = {\n 'STANDARD': '',\n 'PHYSICAL': ''\n };\n this.clearcoat = source.clearcoat;\n this.clearcoatMap = source.clearcoatMap;\n this.clearcoatRoughness = source.clearcoatRoughness;\n this.clearcoatRoughnessMap = source.clearcoatRoughnessMap;\n this.clearcoatNormalMap = source.clearcoatNormalMap;\n this.clearcoatNormalScale.copy(source.clearcoatNormalScale);\n this.ior = source.ior;\n this.iridescence = source.iridescence;\n this.iridescenceMap = source.iridescenceMap;\n this.iridescenceIOR = source.iridescenceIOR;\n this.iridescenceThicknessRange = _toConsumableArray(source.iridescenceThicknessRange);\n this.iridescenceThicknessMap = source.iridescenceThicknessMap;\n this.sheen = source.sheen;\n this.sheenColor.copy(source.sheenColor);\n this.sheenColorMap = source.sheenColorMap;\n this.sheenRoughness = source.sheenRoughness;\n this.sheenRoughnessMap = source.sheenRoughnessMap;\n this.transmission = source.transmission;\n this.transmissionMap = source.transmissionMap;\n this.thickness = source.thickness;\n this.thicknessMap = source.thicknessMap;\n this.attenuationDistance = source.attenuationDistance;\n this.attenuationColor.copy(source.attenuationColor);\n this.specularIntensity = source.specularIntensity;\n this.specularIntensityMap = source.specularIntensityMap;\n this.specularColor.copy(source.specularColor);\n this.specularColorMap = source.specularColorMap;\n return this;\n }\n }]);\n return MeshPhysicalMaterial;\n}(MeshStandardMaterial);\nvar MeshPhongMaterial = /*#__PURE__*/function (_Material10) {\n _inherits(MeshPhongMaterial, _Material10);\n var _super95 = _createSuper(MeshPhongMaterial);\n function MeshPhongMaterial(parameters) {\n var _this86;\n _classCallCheck(this, MeshPhongMaterial);\n _this86 = _super95.call(this);\n _this86.isMeshPhongMaterial = true;\n _this86.type = 'MeshPhongMaterial';\n _this86.color = new Color(0xffffff); // diffuse\n _this86.specular = new Color(0x111111);\n _this86.shininess = 30;\n _this86.map = null;\n _this86.lightMap = null;\n _this86.lightMapIntensity = 1.0;\n _this86.aoMap = null;\n _this86.aoMapIntensity = 1.0;\n _this86.emissive = new Color(0x000000);\n _this86.emissiveIntensity = 1.0;\n _this86.emissiveMap = null;\n _this86.bumpMap = null;\n _this86.bumpScale = 1;\n _this86.normalMap = null;\n _this86.normalMapType = TangentSpaceNormalMap;\n _this86.normalScale = new Vector2(1, 1);\n _this86.displacementMap = null;\n _this86.displacementScale = 1;\n _this86.displacementBias = 0;\n _this86.specularMap = null;\n _this86.alphaMap = null;\n _this86.envMap = null;\n _this86.combine = MultiplyOperation;\n _this86.reflectivity = 1;\n _this86.refractionRatio = 0.98;\n _this86.wireframe = false;\n _this86.wireframeLinewidth = 1;\n _this86.wireframeLinecap = 'round';\n _this86.wireframeLinejoin = 'round';\n _this86.flatShading = false;\n _this86.fog = true;\n _this86.setValues(parameters);\n return _this86;\n }\n _createClass(MeshPhongMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(MeshPhongMaterial.prototype), \"copy\", this).call(this, source);\n this.color.copy(source.color);\n this.specular.copy(source.specular);\n this.shininess = source.shininess;\n this.map = source.map;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.emissive.copy(source.emissive);\n this.emissiveMap = source.emissiveMap;\n this.emissiveIntensity = source.emissiveIntensity;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.specularMap = source.specularMap;\n this.alphaMap = source.alphaMap;\n this.envMap = source.envMap;\n this.combine = source.combine;\n this.reflectivity = source.reflectivity;\n this.refractionRatio = source.refractionRatio;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.flatShading = source.flatShading;\n this.fog = source.fog;\n return this;\n }\n }]);\n return MeshPhongMaterial;\n}(Material);\nvar MeshToonMaterial = /*#__PURE__*/function (_Material11) {\n _inherits(MeshToonMaterial, _Material11);\n var _super96 = _createSuper(MeshToonMaterial);\n function MeshToonMaterial(parameters) {\n var _this87;\n _classCallCheck(this, MeshToonMaterial);\n _this87 = _super96.call(this);\n _this87.isMeshToonMaterial = true;\n _this87.defines = {\n 'TOON': ''\n };\n _this87.type = 'MeshToonMaterial';\n _this87.color = new Color(0xffffff);\n _this87.map = null;\n _this87.gradientMap = null;\n _this87.lightMap = null;\n _this87.lightMapIntensity = 1.0;\n _this87.aoMap = null;\n _this87.aoMapIntensity = 1.0;\n _this87.emissive = new Color(0x000000);\n _this87.emissiveIntensity = 1.0;\n _this87.emissiveMap = null;\n _this87.bumpMap = null;\n _this87.bumpScale = 1;\n _this87.normalMap = null;\n _this87.normalMapType = TangentSpaceNormalMap;\n _this87.normalScale = new Vector2(1, 1);\n _this87.displacementMap = null;\n _this87.displacementScale = 1;\n _this87.displacementBias = 0;\n _this87.alphaMap = null;\n _this87.wireframe = false;\n _this87.wireframeLinewidth = 1;\n _this87.wireframeLinecap = 'round';\n _this87.wireframeLinejoin = 'round';\n _this87.fog = true;\n _this87.setValues(parameters);\n return _this87;\n }\n _createClass(MeshToonMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(MeshToonMaterial.prototype), \"copy\", this).call(this, source);\n this.color.copy(source.color);\n this.map = source.map;\n this.gradientMap = source.gradientMap;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.emissive.copy(source.emissive);\n this.emissiveMap = source.emissiveMap;\n this.emissiveIntensity = source.emissiveIntensity;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.alphaMap = source.alphaMap;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.fog = source.fog;\n return this;\n }\n }]);\n return MeshToonMaterial;\n}(Material);\nvar MeshNormalMaterial = /*#__PURE__*/function (_Material12) {\n _inherits(MeshNormalMaterial, _Material12);\n var _super97 = _createSuper(MeshNormalMaterial);\n function MeshNormalMaterial(parameters) {\n var _this88;\n _classCallCheck(this, MeshNormalMaterial);\n _this88 = _super97.call(this);\n _this88.isMeshNormalMaterial = true;\n _this88.type = 'MeshNormalMaterial';\n _this88.bumpMap = null;\n _this88.bumpScale = 1;\n _this88.normalMap = null;\n _this88.normalMapType = TangentSpaceNormalMap;\n _this88.normalScale = new Vector2(1, 1);\n _this88.displacementMap = null;\n _this88.displacementScale = 1;\n _this88.displacementBias = 0;\n _this88.wireframe = false;\n _this88.wireframeLinewidth = 1;\n _this88.flatShading = false;\n _this88.setValues(parameters);\n return _this88;\n }\n _createClass(MeshNormalMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(MeshNormalMaterial.prototype), \"copy\", this).call(this, source);\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.flatShading = source.flatShading;\n return this;\n }\n }]);\n return MeshNormalMaterial;\n}(Material);\nvar MeshLambertMaterial = /*#__PURE__*/function (_Material13) {\n _inherits(MeshLambertMaterial, _Material13);\n var _super98 = _createSuper(MeshLambertMaterial);\n function MeshLambertMaterial(parameters) {\n var _this89;\n _classCallCheck(this, MeshLambertMaterial);\n _this89 = _super98.call(this);\n _this89.isMeshLambertMaterial = true;\n _this89.type = 'MeshLambertMaterial';\n _this89.color = new Color(0xffffff); // diffuse\n\n _this89.map = null;\n _this89.lightMap = null;\n _this89.lightMapIntensity = 1.0;\n _this89.aoMap = null;\n _this89.aoMapIntensity = 1.0;\n _this89.emissive = new Color(0x000000);\n _this89.emissiveIntensity = 1.0;\n _this89.emissiveMap = null;\n _this89.bumpMap = null;\n _this89.bumpScale = 1;\n _this89.normalMap = null;\n _this89.normalMapType = TangentSpaceNormalMap;\n _this89.normalScale = new Vector2(1, 1);\n _this89.displacementMap = null;\n _this89.displacementScale = 1;\n _this89.displacementBias = 0;\n _this89.specularMap = null;\n _this89.alphaMap = null;\n _this89.envMap = null;\n _this89.combine = MultiplyOperation;\n _this89.reflectivity = 1;\n _this89.refractionRatio = 0.98;\n _this89.wireframe = false;\n _this89.wireframeLinewidth = 1;\n _this89.wireframeLinecap = 'round';\n _this89.wireframeLinejoin = 'round';\n _this89.flatShading = false;\n _this89.fog = true;\n _this89.setValues(parameters);\n return _this89;\n }\n _createClass(MeshLambertMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(MeshLambertMaterial.prototype), \"copy\", this).call(this, source);\n this.color.copy(source.color);\n this.map = source.map;\n this.lightMap = source.lightMap;\n this.lightMapIntensity = source.lightMapIntensity;\n this.aoMap = source.aoMap;\n this.aoMapIntensity = source.aoMapIntensity;\n this.emissive.copy(source.emissive);\n this.emissiveMap = source.emissiveMap;\n this.emissiveIntensity = source.emissiveIntensity;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.specularMap = source.specularMap;\n this.alphaMap = source.alphaMap;\n this.envMap = source.envMap;\n this.combine = source.combine;\n this.reflectivity = source.reflectivity;\n this.refractionRatio = source.refractionRatio;\n this.wireframe = source.wireframe;\n this.wireframeLinewidth = source.wireframeLinewidth;\n this.wireframeLinecap = source.wireframeLinecap;\n this.wireframeLinejoin = source.wireframeLinejoin;\n this.flatShading = source.flatShading;\n this.fog = source.fog;\n return this;\n }\n }]);\n return MeshLambertMaterial;\n}(Material);\nvar MeshMatcapMaterial = /*#__PURE__*/function (_Material14) {\n _inherits(MeshMatcapMaterial, _Material14);\n var _super99 = _createSuper(MeshMatcapMaterial);\n function MeshMatcapMaterial(parameters) {\n var _this90;\n _classCallCheck(this, MeshMatcapMaterial);\n _this90 = _super99.call(this);\n _this90.isMeshMatcapMaterial = true;\n _this90.defines = {\n 'MATCAP': ''\n };\n _this90.type = 'MeshMatcapMaterial';\n _this90.color = new Color(0xffffff); // diffuse\n\n _this90.matcap = null;\n _this90.map = null;\n _this90.bumpMap = null;\n _this90.bumpScale = 1;\n _this90.normalMap = null;\n _this90.normalMapType = TangentSpaceNormalMap;\n _this90.normalScale = new Vector2(1, 1);\n _this90.displacementMap = null;\n _this90.displacementScale = 1;\n _this90.displacementBias = 0;\n _this90.alphaMap = null;\n _this90.flatShading = false;\n _this90.fog = true;\n _this90.setValues(parameters);\n return _this90;\n }\n _createClass(MeshMatcapMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(MeshMatcapMaterial.prototype), \"copy\", this).call(this, source);\n this.defines = {\n 'MATCAP': ''\n };\n this.color.copy(source.color);\n this.matcap = source.matcap;\n this.map = source.map;\n this.bumpMap = source.bumpMap;\n this.bumpScale = source.bumpScale;\n this.normalMap = source.normalMap;\n this.normalMapType = source.normalMapType;\n this.normalScale.copy(source.normalScale);\n this.displacementMap = source.displacementMap;\n this.displacementScale = source.displacementScale;\n this.displacementBias = source.displacementBias;\n this.alphaMap = source.alphaMap;\n this.flatShading = source.flatShading;\n this.fog = source.fog;\n return this;\n }\n }]);\n return MeshMatcapMaterial;\n}(Material);\nvar LineDashedMaterial = /*#__PURE__*/function (_LineBasicMaterial) {\n _inherits(LineDashedMaterial, _LineBasicMaterial);\n var _super100 = _createSuper(LineDashedMaterial);\n function LineDashedMaterial(parameters) {\n var _this91;\n _classCallCheck(this, LineDashedMaterial);\n _this91 = _super100.call(this);\n _this91.isLineDashedMaterial = true;\n _this91.type = 'LineDashedMaterial';\n _this91.scale = 1;\n _this91.dashSize = 3;\n _this91.gapSize = 1;\n _this91.setValues(parameters);\n return _this91;\n }\n _createClass(LineDashedMaterial, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(LineDashedMaterial.prototype), \"copy\", this).call(this, source);\n this.scale = source.scale;\n this.dashSize = source.dashSize;\n this.gapSize = source.gapSize;\n return this;\n }\n }]);\n return LineDashedMaterial;\n}(LineBasicMaterial); // same as Array.prototype.slice, but also works on typed arrays\nfunction arraySlice(array, from, to) {\n if (isTypedArray(array)) {\n // in ios9 array.subarray(from, undefined) will return empty array\n // but array.subarray(from) or array.subarray(from, len) is correct\n return new array.constructor(array.subarray(from, to !== undefined ? to : array.length));\n }\n return array.slice(from, to);\n}\n\n// converts an array to a specific type\nfunction convertArray(array, type, forceClone) {\n if (!array ||\n // let 'undefined' and 'null' pass\n !forceClone && array.constructor === type) return array;\n if (typeof type.BYTES_PER_ELEMENT === 'number') {\n return new type(array); // create typed array\n }\n\n return Array.prototype.slice.call(array); // create Array\n}\n\nfunction isTypedArray(object) {\n return ArrayBuffer.isView(object) && !(object instanceof DataView);\n}\n\n// returns an array by which times and values can be sorted\nfunction getKeyframeOrder(times) {\n function compareTime(i, j) {\n return times[i] - times[j];\n }\n var n = times.length;\n var result = new Array(n);\n for (var i = 0; i !== n; ++i) result[i] = i;\n result.sort(compareTime);\n return result;\n}\n\n// uses the array previously returned by 'getKeyframeOrder' to sort data\nfunction sortedArray(values, stride, order) {\n var nValues = values.length;\n var result = new values.constructor(nValues);\n for (var i = 0, dstOffset = 0; dstOffset !== nValues; ++i) {\n var srcOffset = order[i] * stride;\n for (var j = 0; j !== stride; ++j) {\n result[dstOffset++] = values[srcOffset + j];\n }\n }\n return result;\n}\n\n// function for parsing AOS keyframe formats\nfunction flattenJSON(jsonKeys, times, values, valuePropertyName) {\n var i = 1,\n key = jsonKeys[0];\n while (key !== undefined && key[valuePropertyName] === undefined) {\n key = jsonKeys[i++];\n }\n if (key === undefined) return; // no data\n\n var value = key[valuePropertyName];\n if (value === undefined) return; // no data\n\n if (Array.isArray(value)) {\n do {\n value = key[valuePropertyName];\n if (value !== undefined) {\n times.push(key.time);\n values.push.apply(values, value); // push all elements\n }\n\n key = jsonKeys[i++];\n } while (key !== undefined);\n } else if (value.toArray !== undefined) {\n // ...assume THREE.Math-ish\n\n do {\n value = key[valuePropertyName];\n if (value !== undefined) {\n times.push(key.time);\n value.toArray(values, values.length);\n }\n key = jsonKeys[i++];\n } while (key !== undefined);\n } else {\n // otherwise push as-is\n\n do {\n value = key[valuePropertyName];\n if (value !== undefined) {\n times.push(key.time);\n values.push(value);\n }\n key = jsonKeys[i++];\n } while (key !== undefined);\n }\n}\nfunction subclip(sourceClip, name, startFrame, endFrame) {\n var fps = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 30;\n var clip = sourceClip.clone();\n clip.name = name;\n var tracks = [];\n for (var i = 0; i < clip.tracks.length; ++i) {\n var track = clip.tracks[i];\n var valueSize = track.getValueSize();\n var times = [];\n var values = [];\n for (var j = 0; j < track.times.length; ++j) {\n var frame = track.times[j] * fps;\n if (frame < startFrame || frame >= endFrame) continue;\n times.push(track.times[j]);\n for (var k = 0; k < valueSize; ++k) {\n values.push(track.values[j * valueSize + k]);\n }\n }\n if (times.length === 0) continue;\n track.times = convertArray(times, track.times.constructor);\n track.values = convertArray(values, track.values.constructor);\n tracks.push(track);\n }\n clip.tracks = tracks;\n\n // find minimum .times value across all tracks in the trimmed clip\n\n var minStartTime = Infinity;\n for (var _i88 = 0; _i88 < clip.tracks.length; ++_i88) {\n if (minStartTime > clip.tracks[_i88].times[0]) {\n minStartTime = clip.tracks[_i88].times[0];\n }\n }\n\n // shift all tracks such that clip begins at t=0\n\n for (var _i89 = 0; _i89 < clip.tracks.length; ++_i89) {\n clip.tracks[_i89].shift(-1 * minStartTime);\n }\n clip.resetDuration();\n return clip;\n}\nfunction makeClipAdditive(targetClip) {\n var referenceFrame = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var referenceClip = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : targetClip;\n var fps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 30;\n if (fps <= 0) fps = 30;\n var numTracks = referenceClip.tracks.length;\n var referenceTime = referenceFrame / fps;\n\n // Make each track's values relative to the values at the reference frame\n var _loop = function _loop() {\n var referenceTrack = referenceClip.tracks[i];\n var referenceTrackType = referenceTrack.ValueTypeName;\n\n // Skip this track if it's non-numeric\n if (referenceTrackType === 'bool' || referenceTrackType === 'string') return \"continue\";\n\n // Find the track in the target clip whose name and type matches the reference track\n var targetTrack = targetClip.tracks.find(function (track) {\n return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType;\n });\n if (targetTrack === undefined) return \"continue\";\n var referenceOffset = 0;\n var referenceValueSize = referenceTrack.getValueSize();\n if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {\n referenceOffset = referenceValueSize / 3;\n }\n var targetOffset = 0;\n var targetValueSize = targetTrack.getValueSize();\n if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {\n targetOffset = targetValueSize / 3;\n }\n var lastIndex = referenceTrack.times.length - 1;\n var referenceValue;\n\n // Find the value to subtract out of the track\n if (referenceTime <= referenceTrack.times[0]) {\n // Reference frame is earlier than the first keyframe, so just use the first keyframe\n var startIndex = referenceOffset;\n var endIndex = referenceValueSize - referenceOffset;\n referenceValue = arraySlice(referenceTrack.values, startIndex, endIndex);\n } else if (referenceTime >= referenceTrack.times[lastIndex]) {\n // Reference frame is after the last keyframe, so just use the last keyframe\n var _startIndex = lastIndex * referenceValueSize + referenceOffset;\n var _endIndex = _startIndex + referenceValueSize - referenceOffset;\n referenceValue = arraySlice(referenceTrack.values, _startIndex, _endIndex);\n } else {\n // Interpolate to the reference value\n var interpolant = referenceTrack.createInterpolant();\n var _startIndex2 = referenceOffset;\n var _endIndex2 = referenceValueSize - referenceOffset;\n interpolant.evaluate(referenceTime);\n referenceValue = arraySlice(interpolant.resultBuffer, _startIndex2, _endIndex2);\n }\n\n // Conjugate the quaternion\n if (referenceTrackType === 'quaternion') {\n var referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate();\n referenceQuat.toArray(referenceValue);\n }\n\n // Subtract the reference value from all of the track values\n\n var numTimes = targetTrack.times.length;\n for (var j = 0; j < numTimes; ++j) {\n var valueStart = j * targetValueSize + targetOffset;\n if (referenceTrackType === 'quaternion') {\n // Multiply the conjugate for quaternion track types\n Quaternion.multiplyQuaternionsFlat(targetTrack.values, valueStart, referenceValue, 0, targetTrack.values, valueStart);\n } else {\n var valueEnd = targetValueSize - targetOffset * 2;\n\n // Subtract each value for all other numeric track types\n for (var k = 0; k < valueEnd; ++k) {\n targetTrack.values[valueStart + k] -= referenceValue[k];\n }\n }\n }\n };\n for (var i = 0; i < numTracks; ++i) {\n var _ret = _loop();\n if (_ret === \"continue\") continue;\n }\n targetClip.blendMode = AdditiveAnimationBlendMode;\n return targetClip;\n}\nvar AnimationUtils = {\n arraySlice: arraySlice,\n convertArray: convertArray,\n isTypedArray: isTypedArray,\n getKeyframeOrder: getKeyframeOrder,\n sortedArray: sortedArray,\n flattenJSON: flattenJSON,\n subclip: subclip,\n makeClipAdditive: makeClipAdditive\n};\n\n/**\n * Abstract base class of interpolants over parametric samples.\n *\n * The parameter domain is one dimensional, typically the time or a path\n * along a curve defined by the data.\n *\n * The sample values can have any dimensionality and derived classes may\n * apply special interpretations to the data.\n *\n * This class provides the interval seek in a Template Method, deferring\n * the actual interpolation to derived classes.\n *\n * Time complexity is O(1) for linear access crossing at most two points\n * and O(log N) for random access, where N is the number of positions.\n *\n * References:\n *\n * \t\thttp://www.oodesign.com/template-method-pattern.html\n *\n */\nvar Interpolant = /*#__PURE__*/function () {\n function Interpolant(parameterPositions, sampleValues, sampleSize, resultBuffer) {\n _classCallCheck(this, Interpolant);\n this.parameterPositions = parameterPositions;\n this._cachedIndex = 0;\n this.resultBuffer = resultBuffer !== undefined ? resultBuffer : new sampleValues.constructor(sampleSize);\n this.sampleValues = sampleValues;\n this.valueSize = sampleSize;\n this.settings = null;\n this.DefaultSettings_ = {};\n }\n _createClass(Interpolant, [{\n key: \"evaluate\",\n value: function evaluate(t) {\n var pp = this.parameterPositions;\n var i1 = this._cachedIndex,\n t1 = pp[i1],\n t0 = pp[i1 - 1];\n validate_interval: {\n seek: {\n var right;\n linear_scan: {\n //- See http://jsperf.com/comparison-to-undefined/3\n //- slower code:\n //-\n //- \t\t\t\tif ( t >= t1 || t1 === undefined ) {\n forward_scan: if (!(t < t1)) {\n for (var giveUpAt = i1 + 2;;) {\n if (t1 === undefined) {\n if (t < t0) break forward_scan;\n\n // after end\n\n i1 = pp.length;\n this._cachedIndex = i1;\n return this.copySampleValue_(i1 - 1);\n }\n if (i1 === giveUpAt) break; // this loop\n\n t0 = t1;\n t1 = pp[++i1];\n if (t < t1) {\n // we have arrived at the sought interval\n break seek;\n }\n }\n\n // prepare binary search on the right side of the index\n right = pp.length;\n break linear_scan;\n }\n\n //- slower code:\n //-\t\t\t\t\tif ( t < t0 || t0 === undefined ) {\n if (!(t >= t0)) {\n // looping?\n\n var t1global = pp[1];\n if (t < t1global) {\n i1 = 2; // + 1, using the scan for the details\n t0 = t1global;\n }\n\n // linear reverse scan\n\n for (var _giveUpAt = i1 - 2;;) {\n if (t0 === undefined) {\n // before start\n\n this._cachedIndex = 0;\n return this.copySampleValue_(0);\n }\n if (i1 === _giveUpAt) break; // this loop\n\n t1 = t0;\n t0 = pp[--i1 - 1];\n if (t >= t0) {\n // we have arrived at the sought interval\n break seek;\n }\n }\n\n // prepare binary search on the left side of the index\n right = i1;\n i1 = 0;\n break linear_scan;\n }\n\n // the interval is valid\n\n break validate_interval;\n } // linear scan\n\n // binary search\n\n while (i1 < right) {\n var mid = i1 + right >>> 1;\n if (t < pp[mid]) {\n right = mid;\n } else {\n i1 = mid + 1;\n }\n }\n t1 = pp[i1];\n t0 = pp[i1 - 1];\n\n // check boundary cases, again\n\n if (t0 === undefined) {\n this._cachedIndex = 0;\n return this.copySampleValue_(0);\n }\n if (t1 === undefined) {\n i1 = pp.length;\n this._cachedIndex = i1;\n return this.copySampleValue_(i1 - 1);\n }\n } // seek\n\n this._cachedIndex = i1;\n this.intervalChanged_(i1, t0, t1);\n } // validate_interval\n\n return this.interpolate_(i1, t0, t, t1);\n }\n }, {\n key: \"getSettings_\",\n value: function getSettings_() {\n return this.settings || this.DefaultSettings_;\n }\n }, {\n key: \"copySampleValue_\",\n value: function copySampleValue_(index) {\n // copies a sample value to the result buffer\n\n var result = this.resultBuffer,\n values = this.sampleValues,\n stride = this.valueSize,\n offset = index * stride;\n for (var i = 0; i !== stride; ++i) {\n result[i] = values[offset + i];\n }\n return result;\n }\n\n // Template methods for derived classes:\n }, {\n key: \"interpolate_\",\n value: function interpolate_( /* i1, t0, t, t1 */\n ) {\n throw new Error('call to abstract method');\n // implementations shall return this.resultBuffer\n }\n }, {\n key: \"intervalChanged_\",\n value: function intervalChanged_( /* i1, t0, t1 */\n ) {\n\n // empty\n }\n }]);\n return Interpolant;\n}();\n/**\n * Fast and simple cubic spline interpolant.\n *\n * It was derived from a Hermitian construction setting the first derivative\n * at each sample position to the linear slope between neighboring positions\n * over their parameter interval.\n */\nvar CubicInterpolant = /*#__PURE__*/function (_Interpolant) {\n _inherits(CubicInterpolant, _Interpolant);\n var _super101 = _createSuper(CubicInterpolant);\n function CubicInterpolant(parameterPositions, sampleValues, sampleSize, resultBuffer) {\n var _this92;\n _classCallCheck(this, CubicInterpolant);\n _this92 = _super101.call(this, parameterPositions, sampleValues, sampleSize, resultBuffer);\n _this92._weightPrev = -0;\n _this92._offsetPrev = -0;\n _this92._weightNext = -0;\n _this92._offsetNext = -0;\n _this92.DefaultSettings_ = {\n endingStart: ZeroCurvatureEnding,\n endingEnd: ZeroCurvatureEnding\n };\n return _this92;\n }\n _createClass(CubicInterpolant, [{\n key: \"intervalChanged_\",\n value: function intervalChanged_(i1, t0, t1) {\n var pp = this.parameterPositions;\n var iPrev = i1 - 2,\n iNext = i1 + 1,\n tPrev = pp[iPrev],\n tNext = pp[iNext];\n if (tPrev === undefined) {\n switch (this.getSettings_().endingStart) {\n case ZeroSlopeEnding:\n // f'(t0) = 0\n iPrev = i1;\n tPrev = 2 * t0 - t1;\n break;\n case WrapAroundEnding:\n // use the other end of the curve\n iPrev = pp.length - 2;\n tPrev = t0 + pp[iPrev] - pp[iPrev + 1];\n break;\n default:\n // ZeroCurvatureEnding\n\n // f''(t0) = 0 a.k.a. Natural Spline\n iPrev = i1;\n tPrev = t1;\n }\n }\n if (tNext === undefined) {\n switch (this.getSettings_().endingEnd) {\n case ZeroSlopeEnding:\n // f'(tN) = 0\n iNext = i1;\n tNext = 2 * t1 - t0;\n break;\n case WrapAroundEnding:\n // use the other end of the curve\n iNext = 1;\n tNext = t1 + pp[1] - pp[0];\n break;\n default:\n // ZeroCurvatureEnding\n\n // f''(tN) = 0, a.k.a. Natural Spline\n iNext = i1 - 1;\n tNext = t0;\n }\n }\n var halfDt = (t1 - t0) * 0.5,\n stride = this.valueSize;\n this._weightPrev = halfDt / (t0 - tPrev);\n this._weightNext = halfDt / (tNext - t1);\n this._offsetPrev = iPrev * stride;\n this._offsetNext = iNext * stride;\n }\n }, {\n key: \"interpolate_\",\n value: function interpolate_(i1, t0, t, t1) {\n var result = this.resultBuffer,\n values = this.sampleValues,\n stride = this.valueSize,\n o1 = i1 * stride,\n o0 = o1 - stride,\n oP = this._offsetPrev,\n oN = this._offsetNext,\n wP = this._weightPrev,\n wN = this._weightNext,\n p = (t - t0) / (t1 - t0),\n pp = p * p,\n ppp = pp * p;\n\n // evaluate polynomials\n\n var sP = -wP * ppp + 2 * wP * pp - wP * p;\n var s0 = (1 + wP) * ppp + (-1.5 - 2 * wP) * pp + (-0.5 + wP) * p + 1;\n var s1 = (-1 - wN) * ppp + (1.5 + wN) * pp + 0.5 * p;\n var sN = wN * ppp - wN * pp;\n\n // combine data linearly\n\n for (var i = 0; i !== stride; ++i) {\n result[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i];\n }\n return result;\n }\n }]);\n return CubicInterpolant;\n}(Interpolant);\nvar LinearInterpolant = /*#__PURE__*/function (_Interpolant2) {\n _inherits(LinearInterpolant, _Interpolant2);\n var _super102 = _createSuper(LinearInterpolant);\n function LinearInterpolant(parameterPositions, sampleValues, sampleSize, resultBuffer) {\n _classCallCheck(this, LinearInterpolant);\n return _super102.call(this, parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n _createClass(LinearInterpolant, [{\n key: \"interpolate_\",\n value: function interpolate_(i1, t0, t, t1) {\n var result = this.resultBuffer,\n values = this.sampleValues,\n stride = this.valueSize,\n offset1 = i1 * stride,\n offset0 = offset1 - stride,\n weight1 = (t - t0) / (t1 - t0),\n weight0 = 1 - weight1;\n for (var i = 0; i !== stride; ++i) {\n result[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1;\n }\n return result;\n }\n }]);\n return LinearInterpolant;\n}(Interpolant);\n/**\n *\n * Interpolant that evaluates to the sample value at the position preceding\n * the parameter.\n */\nvar DiscreteInterpolant = /*#__PURE__*/function (_Interpolant3) {\n _inherits(DiscreteInterpolant, _Interpolant3);\n var _super103 = _createSuper(DiscreteInterpolant);\n function DiscreteInterpolant(parameterPositions, sampleValues, sampleSize, resultBuffer) {\n _classCallCheck(this, DiscreteInterpolant);\n return _super103.call(this, parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n _createClass(DiscreteInterpolant, [{\n key: \"interpolate_\",\n value: function interpolate_(i1 /*, t0, t, t1 */) {\n return this.copySampleValue_(i1 - 1);\n }\n }]);\n return DiscreteInterpolant;\n}(Interpolant);\nvar KeyframeTrack = /*#__PURE__*/function () {\n function KeyframeTrack(name, times, values, interpolation) {\n _classCallCheck(this, KeyframeTrack);\n if (name === undefined) throw new Error('THREE.KeyframeTrack: track name is undefined');\n if (times === undefined || times.length === 0) throw new Error('THREE.KeyframeTrack: no keyframes in track named ' + name);\n this.name = name;\n this.times = convertArray(times, this.TimeBufferType);\n this.values = convertArray(values, this.ValueBufferType);\n this.setInterpolation(interpolation || this.DefaultInterpolation);\n }\n\n // Serialization (in static context, because of constructor invocation\n // and automatic invocation of .toJSON):\n _createClass(KeyframeTrack, [{\n key: \"InterpolantFactoryMethodDiscrete\",\n value: function InterpolantFactoryMethodDiscrete(result) {\n return new DiscreteInterpolant(this.times, this.values, this.getValueSize(), result);\n }\n }, {\n key: \"InterpolantFactoryMethodLinear\",\n value: function InterpolantFactoryMethodLinear(result) {\n return new LinearInterpolant(this.times, this.values, this.getValueSize(), result);\n }\n }, {\n key: \"InterpolantFactoryMethodSmooth\",\n value: function InterpolantFactoryMethodSmooth(result) {\n return new CubicInterpolant(this.times, this.values, this.getValueSize(), result);\n }\n }, {\n key: \"setInterpolation\",\n value: function setInterpolation(interpolation) {\n var factoryMethod;\n switch (interpolation) {\n case InterpolateDiscrete:\n factoryMethod = this.InterpolantFactoryMethodDiscrete;\n break;\n case InterpolateLinear:\n factoryMethod = this.InterpolantFactoryMethodLinear;\n break;\n case InterpolateSmooth:\n factoryMethod = this.InterpolantFactoryMethodSmooth;\n break;\n }\n if (factoryMethod === undefined) {\n var message = 'unsupported interpolation for ' + this.ValueTypeName + ' keyframe track named ' + this.name;\n if (this.createInterpolant === undefined) {\n // fall back to default, unless the default itself is messed up\n if (interpolation !== this.DefaultInterpolation) {\n this.setInterpolation(this.DefaultInterpolation);\n } else {\n throw new Error(message); // fatal, in this case\n }\n }\n\n console.warn('THREE.KeyframeTrack:', message);\n return this;\n }\n this.createInterpolant = factoryMethod;\n return this;\n }\n }, {\n key: \"getInterpolation\",\n value: function getInterpolation() {\n switch (this.createInterpolant) {\n case this.InterpolantFactoryMethodDiscrete:\n return InterpolateDiscrete;\n case this.InterpolantFactoryMethodLinear:\n return InterpolateLinear;\n case this.InterpolantFactoryMethodSmooth:\n return InterpolateSmooth;\n }\n }\n }, {\n key: \"getValueSize\",\n value: function getValueSize() {\n return this.values.length / this.times.length;\n }\n\n // move all keyframes either forwards or backwards in time\n }, {\n key: \"shift\",\n value: function shift(timeOffset) {\n if (timeOffset !== 0.0) {\n var times = this.times;\n for (var i = 0, n = times.length; i !== n; ++i) {\n times[i] += timeOffset;\n }\n }\n return this;\n }\n\n // scale all keyframe times by a factor (useful for frame <-> seconds conversions)\n }, {\n key: \"scale\",\n value: function scale(timeScale) {\n if (timeScale !== 1.0) {\n var times = this.times;\n for (var i = 0, n = times.length; i !== n; ++i) {\n times[i] *= timeScale;\n }\n }\n return this;\n }\n\n // removes keyframes before and after animation without changing any values within the range [startTime, endTime].\n // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values\n }, {\n key: \"trim\",\n value: function trim(startTime, endTime) {\n var times = this.times,\n nKeys = times.length;\n var from = 0,\n to = nKeys - 1;\n while (from !== nKeys && times[from] < startTime) {\n ++from;\n }\n while (to !== -1 && times[to] > endTime) {\n --to;\n }\n ++to; // inclusive -> exclusive bound\n\n if (from !== 0 || to !== nKeys) {\n // empty tracks are forbidden, so keep at least one keyframe\n if (from >= to) {\n to = Math.max(to, 1);\n from = to - 1;\n }\n var stride = this.getValueSize();\n this.times = arraySlice(times, from, to);\n this.values = arraySlice(this.values, from * stride, to * stride);\n }\n return this;\n }\n\n // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable\n }, {\n key: \"validate\",\n value: function validate() {\n var valid = true;\n var valueSize = this.getValueSize();\n if (valueSize - Math.floor(valueSize) !== 0) {\n console.error('THREE.KeyframeTrack: Invalid value size in track.', this);\n valid = false;\n }\n var times = this.times,\n values = this.values,\n nKeys = times.length;\n if (nKeys === 0) {\n console.error('THREE.KeyframeTrack: Track is empty.', this);\n valid = false;\n }\n var prevTime = null;\n for (var i = 0; i !== nKeys; i++) {\n var currTime = times[i];\n if (typeof currTime === 'number' && isNaN(currTime)) {\n console.error('THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime);\n valid = false;\n break;\n }\n if (prevTime !== null && prevTime > currTime) {\n console.error('THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime);\n valid = false;\n break;\n }\n prevTime = currTime;\n }\n if (values !== undefined) {\n if (isTypedArray(values)) {\n for (var _i90 = 0, n = values.length; _i90 !== n; ++_i90) {\n var _value7 = values[_i90];\n if (isNaN(_value7)) {\n console.error('THREE.KeyframeTrack: Value is not a valid number.', this, _i90, _value7);\n valid = false;\n break;\n }\n }\n }\n }\n return valid;\n }\n\n // removes equivalent sequential keys as common in morph target sequences\n // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0)\n }, {\n key: \"optimize\",\n value: function optimize() {\n // times or values may be shared with other tracks, so overwriting is unsafe\n var times = arraySlice(this.times),\n values = arraySlice(this.values),\n stride = this.getValueSize(),\n smoothInterpolation = this.getInterpolation() === InterpolateSmooth,\n lastIndex = times.length - 1;\n var writeIndex = 1;\n for (var i = 1; i < lastIndex; ++i) {\n var keep = false;\n var time = times[i];\n var timeNext = times[i + 1];\n\n // remove adjacent keyframes scheduled at the same time\n\n if (time !== timeNext && (i !== 1 || time !== times[0])) {\n if (!smoothInterpolation) {\n // remove unnecessary keyframes same as their neighbors\n\n var offset = i * stride,\n offsetP = offset - stride,\n offsetN = offset + stride;\n for (var j = 0; j !== stride; ++j) {\n var _value8 = values[offset + j];\n if (_value8 !== values[offsetP + j] || _value8 !== values[offsetN + j]) {\n keep = true;\n break;\n }\n }\n } else {\n keep = true;\n }\n }\n\n // in-place compaction\n\n if (keep) {\n if (i !== writeIndex) {\n times[writeIndex] = times[i];\n var readOffset = i * stride,\n writeOffset = writeIndex * stride;\n for (var _j14 = 0; _j14 !== stride; ++_j14) {\n values[writeOffset + _j14] = values[readOffset + _j14];\n }\n }\n ++writeIndex;\n }\n }\n\n // flush last keyframe (compaction looks ahead)\n\n if (lastIndex > 0) {\n times[writeIndex] = times[lastIndex];\n for (var _readOffset = lastIndex * stride, _writeOffset = writeIndex * stride, _j15 = 0; _j15 !== stride; ++_j15) {\n values[_writeOffset + _j15] = values[_readOffset + _j15];\n }\n ++writeIndex;\n }\n if (writeIndex !== times.length) {\n this.times = arraySlice(times, 0, writeIndex);\n this.values = arraySlice(values, 0, writeIndex * stride);\n } else {\n this.times = times;\n this.values = values;\n }\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n var times = arraySlice(this.times, 0);\n var values = arraySlice(this.values, 0);\n var TypedKeyframeTrack = this.constructor;\n var track = new TypedKeyframeTrack(this.name, times, values);\n\n // Interpolant argument to constructor is not saved, so copy the factory method directly.\n track.createInterpolant = this.createInterpolant;\n return track;\n }\n }], [{\n key: \"toJSON\",\n value: function toJSON(track) {\n var trackType = track.constructor;\n var json;\n\n // derived classes can define a static toJSON method\n if (trackType.toJSON !== this.toJSON) {\n json = trackType.toJSON(track);\n } else {\n // by default, we assume the data can be serialized as-is\n json = {\n 'name': track.name,\n 'times': convertArray(track.times, Array),\n 'values': convertArray(track.values, Array)\n };\n var interpolation = track.getInterpolation();\n if (interpolation !== track.DefaultInterpolation) {\n json.interpolation = interpolation;\n }\n }\n json.type = track.ValueTypeName; // mandatory\n\n return json;\n }\n }]);\n return KeyframeTrack;\n}();\nKeyframeTrack.prototype.TimeBufferType = Float32Array;\nKeyframeTrack.prototype.ValueBufferType = Float32Array;\nKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\n\n/**\n * A Track of Boolean keyframe values.\n */\nvar BooleanKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack) {\n _inherits(BooleanKeyframeTrack, _KeyframeTrack);\n var _super104 = _createSuper(BooleanKeyframeTrack);\n function BooleanKeyframeTrack() {\n _classCallCheck(this, BooleanKeyframeTrack);\n return _super104.apply(this, arguments);\n }\n return _createClass(BooleanKeyframeTrack);\n}(KeyframeTrack);\nBooleanKeyframeTrack.prototype.ValueTypeName = 'bool';\nBooleanKeyframeTrack.prototype.ValueBufferType = Array;\nBooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nBooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of keyframe values that represent color.\n */\nvar ColorKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack2) {\n _inherits(ColorKeyframeTrack, _KeyframeTrack2);\n var _super105 = _createSuper(ColorKeyframeTrack);\n function ColorKeyframeTrack() {\n _classCallCheck(this, ColorKeyframeTrack);\n return _super105.apply(this, arguments);\n }\n return _createClass(ColorKeyframeTrack);\n}(KeyframeTrack);\nColorKeyframeTrack.prototype.ValueTypeName = 'color';\n\n/**\n * A Track of numeric keyframe values.\n */\nvar NumberKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack3) {\n _inherits(NumberKeyframeTrack, _KeyframeTrack3);\n var _super106 = _createSuper(NumberKeyframeTrack);\n function NumberKeyframeTrack() {\n _classCallCheck(this, NumberKeyframeTrack);\n return _super106.apply(this, arguments);\n }\n return _createClass(NumberKeyframeTrack);\n}(KeyframeTrack);\nNumberKeyframeTrack.prototype.ValueTypeName = 'number';\n\n/**\n * Spherical linear unit quaternion interpolant.\n */\nvar QuaternionLinearInterpolant = /*#__PURE__*/function (_Interpolant4) {\n _inherits(QuaternionLinearInterpolant, _Interpolant4);\n var _super107 = _createSuper(QuaternionLinearInterpolant);\n function QuaternionLinearInterpolant(parameterPositions, sampleValues, sampleSize, resultBuffer) {\n _classCallCheck(this, QuaternionLinearInterpolant);\n return _super107.call(this, parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n _createClass(QuaternionLinearInterpolant, [{\n key: \"interpolate_\",\n value: function interpolate_(i1, t0, t, t1) {\n var result = this.resultBuffer,\n values = this.sampleValues,\n stride = this.valueSize,\n alpha = (t - t0) / (t1 - t0);\n var offset = i1 * stride;\n for (var end = offset + stride; offset !== end; offset += 4) {\n Quaternion.slerpFlat(result, 0, values, offset - stride, values, offset, alpha);\n }\n return result;\n }\n }]);\n return QuaternionLinearInterpolant;\n}(Interpolant);\n/**\n * A Track of quaternion keyframe values.\n */\nvar QuaternionKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack4) {\n _inherits(QuaternionKeyframeTrack, _KeyframeTrack4);\n var _super108 = _createSuper(QuaternionKeyframeTrack);\n function QuaternionKeyframeTrack() {\n _classCallCheck(this, QuaternionKeyframeTrack);\n return _super108.apply(this, arguments);\n }\n _createClass(QuaternionKeyframeTrack, [{\n key: \"InterpolantFactoryMethodLinear\",\n value: function InterpolantFactoryMethodLinear(result) {\n return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result);\n }\n }]);\n return QuaternionKeyframeTrack;\n}(KeyframeTrack);\nQuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion';\n// ValueBufferType is inherited\nQuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear;\nQuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track that interpolates Strings\n */\nvar StringKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack5) {\n _inherits(StringKeyframeTrack, _KeyframeTrack5);\n var _super109 = _createSuper(StringKeyframeTrack);\n function StringKeyframeTrack() {\n _classCallCheck(this, StringKeyframeTrack);\n return _super109.apply(this, arguments);\n }\n return _createClass(StringKeyframeTrack);\n}(KeyframeTrack);\nStringKeyframeTrack.prototype.ValueTypeName = 'string';\nStringKeyframeTrack.prototype.ValueBufferType = Array;\nStringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined;\nStringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined;\n\n/**\n * A Track of vectored keyframe values.\n */\nvar VectorKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack6) {\n _inherits(VectorKeyframeTrack, _KeyframeTrack6);\n var _super110 = _createSuper(VectorKeyframeTrack);\n function VectorKeyframeTrack() {\n _classCallCheck(this, VectorKeyframeTrack);\n return _super110.apply(this, arguments);\n }\n return _createClass(VectorKeyframeTrack);\n}(KeyframeTrack);\nVectorKeyframeTrack.prototype.ValueTypeName = 'vector';\nvar AnimationClip = /*#__PURE__*/function () {\n function AnimationClip(name) {\n var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;\n var tracks = arguments.length > 2 ? arguments[2] : undefined;\n var blendMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : NormalAnimationBlendMode;\n _classCallCheck(this, AnimationClip);\n this.name = name;\n this.tracks = tracks;\n this.duration = duration;\n this.blendMode = blendMode;\n this.uuid = generateUUID();\n\n // this means it should figure out its duration by scanning the tracks\n if (this.duration < 0) {\n this.resetDuration();\n }\n }\n _createClass(AnimationClip, [{\n key: \"resetDuration\",\n value: function resetDuration() {\n var tracks = this.tracks;\n var duration = 0;\n for (var i = 0, n = tracks.length; i !== n; ++i) {\n var track = this.tracks[i];\n duration = Math.max(duration, track.times[track.times.length - 1]);\n }\n this.duration = duration;\n return this;\n }\n }, {\n key: \"trim\",\n value: function trim() {\n for (var i = 0; i < this.tracks.length; i++) {\n this.tracks[i].trim(0, this.duration);\n }\n return this;\n }\n }, {\n key: \"validate\",\n value: function validate() {\n var valid = true;\n for (var i = 0; i < this.tracks.length; i++) {\n valid = valid && this.tracks[i].validate();\n }\n return valid;\n }\n }, {\n key: \"optimize\",\n value: function optimize() {\n for (var i = 0; i < this.tracks.length; i++) {\n this.tracks[i].optimize();\n }\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n var tracks = [];\n for (var i = 0; i < this.tracks.length; i++) {\n tracks.push(this.tracks[i].clone());\n }\n return new this.constructor(this.name, this.duration, tracks, this.blendMode);\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n return this.constructor.toJSON(this);\n }\n }], [{\n key: \"parse\",\n value: function parse(json) {\n var tracks = [],\n jsonTracks = json.tracks,\n frameTime = 1.0 / (json.fps || 1.0);\n for (var i = 0, n = jsonTracks.length; i !== n; ++i) {\n tracks.push(parseKeyframeTrack(jsonTracks[i]).scale(frameTime));\n }\n var clip = new this(json.name, json.duration, tracks, json.blendMode);\n clip.uuid = json.uuid;\n return clip;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(clip) {\n var tracks = [],\n clipTracks = clip.tracks;\n var json = {\n 'name': clip.name,\n 'duration': clip.duration,\n 'tracks': tracks,\n 'uuid': clip.uuid,\n 'blendMode': clip.blendMode\n };\n for (var i = 0, n = clipTracks.length; i !== n; ++i) {\n tracks.push(KeyframeTrack.toJSON(clipTracks[i]));\n }\n return json;\n }\n }, {\n key: \"CreateFromMorphTargetSequence\",\n value: function CreateFromMorphTargetSequence(name, morphTargetSequence, fps, noLoop) {\n var numMorphTargets = morphTargetSequence.length;\n var tracks = [];\n for (var i = 0; i < numMorphTargets; i++) {\n var times = [];\n var values = [];\n times.push((i + numMorphTargets - 1) % numMorphTargets, i, (i + 1) % numMorphTargets);\n values.push(0, 1, 0);\n var order = getKeyframeOrder(times);\n times = sortedArray(times, 1, order);\n values = sortedArray(values, 1, order);\n\n // if there is a key at the first frame, duplicate it as the\n // last frame as well for perfect loop.\n if (!noLoop && times[0] === 0) {\n times.push(numMorphTargets);\n values.push(values[0]);\n }\n tracks.push(new NumberKeyframeTrack('.morphTargetInfluences[' + morphTargetSequence[i].name + ']', times, values).scale(1.0 / fps));\n }\n return new this(name, -1, tracks);\n }\n }, {\n key: \"findByName\",\n value: function findByName(objectOrClipArray, name) {\n var clipArray = objectOrClipArray;\n if (!Array.isArray(objectOrClipArray)) {\n var o = objectOrClipArray;\n clipArray = o.geometry && o.geometry.animations || o.animations;\n }\n for (var i = 0; i < clipArray.length; i++) {\n if (clipArray[i].name === name) {\n return clipArray[i];\n }\n }\n return null;\n }\n }, {\n key: \"CreateClipsFromMorphTargetSequences\",\n value: function CreateClipsFromMorphTargetSequences(morphTargets, fps, noLoop) {\n var animationToMorphTargets = {};\n\n // tested with https://regex101.com/ on trick sequences\n // such flamingo_flyA_003, flamingo_run1_003, crdeath0059\n var pattern = /^([\\w-]*?)([\\d]+)$/;\n\n // sort morph target names into animation groups based\n // patterns like Walk_001, Walk_002, Run_001, Run_002\n for (var i = 0, il = morphTargets.length; i < il; i++) {\n var morphTarget = morphTargets[i];\n var parts = morphTarget.name.match(pattern);\n if (parts && parts.length > 1) {\n var name = parts[1];\n var animationMorphTargets = animationToMorphTargets[name];\n if (!animationMorphTargets) {\n animationToMorphTargets[name] = animationMorphTargets = [];\n }\n animationMorphTargets.push(morphTarget);\n }\n }\n var clips = [];\n for (var _name4 in animationToMorphTargets) {\n clips.push(this.CreateFromMorphTargetSequence(_name4, animationToMorphTargets[_name4], fps, noLoop));\n }\n return clips;\n }\n\n // parse the animation.hierarchy format\n }, {\n key: \"parseAnimation\",\n value: function parseAnimation(animation, bones) {\n if (!animation) {\n console.error('THREE.AnimationClip: No animation in JSONLoader data.');\n return null;\n }\n var addNonemptyTrack = function addNonemptyTrack(trackType, trackName, animationKeys, propertyName, destTracks) {\n // only return track if there are actually keys.\n if (animationKeys.length !== 0) {\n var times = [];\n var values = [];\n flattenJSON(animationKeys, times, values, propertyName);\n\n // empty keys are filtered out, so check again\n if (times.length !== 0) {\n destTracks.push(new trackType(trackName, times, values));\n }\n }\n };\n var tracks = [];\n var clipName = animation.name || 'default';\n var fps = animation.fps || 30;\n var blendMode = animation.blendMode;\n\n // automatic length determination in AnimationClip.\n var duration = animation.length || -1;\n var hierarchyTracks = animation.hierarchy || [];\n for (var h = 0; h < hierarchyTracks.length; h++) {\n var animationKeys = hierarchyTracks[h].keys;\n\n // skip empty tracks\n if (!animationKeys || animationKeys.length === 0) continue;\n\n // process morph targets\n if (animationKeys[0].morphTargets) {\n // figure out all morph targets used in this track\n var morphTargetNames = {};\n var k = void 0;\n for (k = 0; k < animationKeys.length; k++) {\n if (animationKeys[k].morphTargets) {\n for (var m = 0; m < animationKeys[k].morphTargets.length; m++) {\n morphTargetNames[animationKeys[k].morphTargets[m]] = -1;\n }\n }\n }\n\n // create a track for each morph target with all zero\n // morphTargetInfluences except for the keys in which\n // the morphTarget is named.\n for (var morphTargetName in morphTargetNames) {\n var times = [];\n var values = [];\n for (var _m = 0; _m !== animationKeys[k].morphTargets.length; ++_m) {\n var animationKey = animationKeys[k];\n times.push(animationKey.time);\n values.push(animationKey.morphTarget === morphTargetName ? 1 : 0);\n }\n tracks.push(new NumberKeyframeTrack('.morphTargetInfluence[' + morphTargetName + ']', times, values));\n }\n duration = morphTargetNames.length * fps;\n } else {\n // ...assume skeletal animation\n\n var boneName = '.bones[' + bones[h].name + ']';\n addNonemptyTrack(VectorKeyframeTrack, boneName + '.position', animationKeys, 'pos', tracks);\n addNonemptyTrack(QuaternionKeyframeTrack, boneName + '.quaternion', animationKeys, 'rot', tracks);\n addNonemptyTrack(VectorKeyframeTrack, boneName + '.scale', animationKeys, 'scl', tracks);\n }\n }\n if (tracks.length === 0) {\n return null;\n }\n var clip = new this(clipName, duration, tracks, blendMode);\n return clip;\n }\n }]);\n return AnimationClip;\n}();\nfunction getTrackTypeForValueTypeName(typeName) {\n switch (typeName.toLowerCase()) {\n case 'scalar':\n case 'double':\n case 'float':\n case 'number':\n case 'integer':\n return NumberKeyframeTrack;\n case 'vector':\n case 'vector2':\n case 'vector3':\n case 'vector4':\n return VectorKeyframeTrack;\n case 'color':\n return ColorKeyframeTrack;\n case 'quaternion':\n return QuaternionKeyframeTrack;\n case 'bool':\n case 'boolean':\n return BooleanKeyframeTrack;\n case 'string':\n return StringKeyframeTrack;\n }\n throw new Error('THREE.KeyframeTrack: Unsupported typeName: ' + typeName);\n}\nfunction parseKeyframeTrack(json) {\n if (json.type === undefined) {\n throw new Error('THREE.KeyframeTrack: track type undefined, can not parse');\n }\n var trackType = getTrackTypeForValueTypeName(json.type);\n if (json.times === undefined) {\n var times = [],\n values = [];\n flattenJSON(json.keys, times, values, 'value');\n json.times = times;\n json.values = values;\n }\n\n // derived classes can define a static parse method\n if (trackType.parse !== undefined) {\n return trackType.parse(json);\n } else {\n // by default, we assume a constructor compatible with the base\n return new trackType(json.name, json.times, json.values, json.interpolation);\n }\n}\nvar Cache = {\n enabled: false,\n files: {},\n add: function add(key, file) {\n if (this.enabled === false) return;\n\n // console.log( 'THREE.Cache', 'Adding key:', key );\n\n this.files[key] = file;\n },\n get: function get(key) {\n if (this.enabled === false) return;\n\n // console.log( 'THREE.Cache', 'Checking key:', key );\n\n return this.files[key];\n },\n remove: function remove(key) {\n delete this.files[key];\n },\n clear: function clear() {\n this.files = {};\n }\n};\nvar LoadingManager = /*#__PURE__*/_createClass(function LoadingManager(onLoad, onProgress, onError) {\n _classCallCheck(this, LoadingManager);\n var scope = this;\n var isLoading = false;\n var itemsLoaded = 0;\n var itemsTotal = 0;\n var urlModifier = undefined;\n var handlers = [];\n\n // Refer to #5689 for the reason why we don't set .onStart\n // in the constructor\n\n this.onStart = undefined;\n this.onLoad = onLoad;\n this.onProgress = onProgress;\n this.onError = onError;\n this.itemStart = function (url) {\n itemsTotal++;\n if (isLoading === false) {\n if (scope.onStart !== undefined) {\n scope.onStart(url, itemsLoaded, itemsTotal);\n }\n }\n isLoading = true;\n };\n this.itemEnd = function (url) {\n itemsLoaded++;\n if (scope.onProgress !== undefined) {\n scope.onProgress(url, itemsLoaded, itemsTotal);\n }\n if (itemsLoaded === itemsTotal) {\n isLoading = false;\n if (scope.onLoad !== undefined) {\n scope.onLoad();\n }\n }\n };\n this.itemError = function (url) {\n if (scope.onError !== undefined) {\n scope.onError(url);\n }\n };\n this.resolveURL = function (url) {\n if (urlModifier) {\n return urlModifier(url);\n }\n return url;\n };\n this.setURLModifier = function (transform) {\n urlModifier = transform;\n return this;\n };\n this.addHandler = function (regex, loader) {\n handlers.push(regex, loader);\n return this;\n };\n this.removeHandler = function (regex) {\n var index = handlers.indexOf(regex);\n if (index !== -1) {\n handlers.splice(index, 2);\n }\n return this;\n };\n this.getHandler = function (file) {\n for (var i = 0, l = handlers.length; i < l; i += 2) {\n var regex = handlers[i];\n var loader = handlers[i + 1];\n if (regex.global) regex.lastIndex = 0; // see #17920\n\n if (regex.test(file)) {\n return loader;\n }\n }\n return null;\n };\n});\nvar DefaultLoadingManager = /*@__PURE__*/new LoadingManager();\nvar Loader = /*#__PURE__*/function () {\n function Loader(manager) {\n _classCallCheck(this, Loader);\n this.manager = manager !== undefined ? manager : DefaultLoadingManager;\n this.crossOrigin = 'anonymous';\n this.withCredentials = false;\n this.path = '';\n this.resourcePath = '';\n this.requestHeader = {};\n }\n _createClass(Loader, [{\n key: \"load\",\n value: function load( /* url, onLoad, onProgress, onError */) {}\n }, {\n key: \"loadAsync\",\n value: function loadAsync(url, onProgress) {\n var scope = this;\n return new Promise(function (resolve, reject) {\n scope.load(url, resolve, onProgress, reject);\n });\n }\n }, {\n key: \"parse\",\n value: function parse( /* data */) {}\n }, {\n key: \"setCrossOrigin\",\n value: function setCrossOrigin(crossOrigin) {\n this.crossOrigin = crossOrigin;\n return this;\n }\n }, {\n key: \"setWithCredentials\",\n value: function setWithCredentials(value) {\n this.withCredentials = value;\n return this;\n }\n }, {\n key: \"setPath\",\n value: function setPath(path) {\n this.path = path;\n return this;\n }\n }, {\n key: \"setResourcePath\",\n value: function setResourcePath(resourcePath) {\n this.resourcePath = resourcePath;\n return this;\n }\n }, {\n key: \"setRequestHeader\",\n value: function setRequestHeader(requestHeader) {\n this.requestHeader = requestHeader;\n return this;\n }\n }]);\n return Loader;\n}();\nvar loading = {};\nvar HttpError = /*#__PURE__*/function (_Error) {\n _inherits(HttpError, _Error);\n var _super111 = _createSuper(HttpError);\n function HttpError(message, response) {\n var _this93;\n _classCallCheck(this, HttpError);\n _this93 = _super111.call(this, message);\n _this93.response = response;\n return _this93;\n }\n return _createClass(HttpError);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\nvar FileLoader = /*#__PURE__*/function (_Loader) {\n _inherits(FileLoader, _Loader);\n var _super112 = _createSuper(FileLoader);\n function FileLoader(manager) {\n _classCallCheck(this, FileLoader);\n return _super112.call(this, manager);\n }\n _createClass(FileLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n var _this94 = this;\n if (url === undefined) url = '';\n if (this.path !== undefined) url = this.path + url;\n url = this.manager.resolveURL(url);\n var cached = Cache.get(url);\n if (cached !== undefined) {\n this.manager.itemStart(url);\n setTimeout(function () {\n if (onLoad) onLoad(cached);\n _this94.manager.itemEnd(url);\n }, 0);\n return cached;\n }\n\n // Check if request is duplicate\n\n if (loading[url] !== undefined) {\n loading[url].push({\n onLoad: onLoad,\n onProgress: onProgress,\n onError: onError\n });\n return;\n }\n\n // Initialise array for duplicate requests\n loading[url] = [];\n loading[url].push({\n onLoad: onLoad,\n onProgress: onProgress,\n onError: onError\n });\n\n // create request\n var req = new Request(url, {\n headers: new Headers(this.requestHeader),\n credentials: this.withCredentials ? 'include' : 'same-origin'\n // An abort controller could be added within a future PR\n });\n\n // record states ( avoid data race )\n var mimeType = this.mimeType;\n var responseType = this.responseType;\n\n // start the fetch\n fetch(req).then(function (response) {\n if (response.status === 200 || response.status === 0) {\n // Some browsers return HTTP Status 0 when using non-http protocol\n // e.g. 'file://' or 'data://'. Handle as success.\n\n if (response.status === 0) {\n console.warn('THREE.FileLoader: HTTP Status 0 received.');\n }\n\n // Workaround: Checking if response.body === undefined for Alipay browser #23548\n\n if (typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined) {\n return response;\n }\n var callbacks = loading[url];\n var reader = response.body.getReader();\n\n // Nginx needs X-File-Size check\n // https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content\n var contentLength = response.headers.get('Content-Length') || response.headers.get('X-File-Size');\n var total = contentLength ? parseInt(contentLength) : 0;\n var lengthComputable = total !== 0;\n var loaded = 0;\n\n // periodically read data into the new stream tracking while download progress\n var stream = new ReadableStream({\n start: function start(controller) {\n readData();\n function readData() {\n reader.read().then(function (_ref2) {\n var done = _ref2.done,\n value = _ref2.value;\n if (done) {\n controller.close();\n } else {\n loaded += value.byteLength;\n var event = new ProgressEvent('progress', {\n lengthComputable: lengthComputable,\n loaded: loaded,\n total: total\n });\n for (var i = 0, il = callbacks.length; i < il; i++) {\n var callback = callbacks[i];\n if (callback.onProgress) callback.onProgress(event);\n }\n controller.enqueue(value);\n readData();\n }\n });\n }\n }\n });\n return new Response(stream);\n } else {\n throw new HttpError(\"fetch for \\\"\".concat(response.url, \"\\\" responded with \").concat(response.status, \": \").concat(response.statusText), response);\n }\n }).then(function (response) {\n switch (responseType) {\n case 'arraybuffer':\n return response.arrayBuffer();\n case 'blob':\n return response.blob();\n case 'document':\n return response.text().then(function (text) {\n var parser = new DOMParser();\n return parser.parseFromString(text, mimeType);\n });\n case 'json':\n return response.json();\n default:\n if (mimeType === undefined) {\n return response.text();\n } else {\n // sniff encoding\n var re = /charset=\"?([^;\"\\s]*)\"?/i;\n var exec = re.exec(mimeType);\n var label = exec && exec[1] ? exec[1].toLowerCase() : undefined;\n var decoder = new TextDecoder(label);\n return response.arrayBuffer().then(function (ab) {\n return decoder.decode(ab);\n });\n }\n }\n }).then(function (data) {\n // Add to cache only on HTTP success, so that we do not cache\n // error response bodies as proper responses to requests.\n Cache.add(url, data);\n var callbacks = loading[url];\n delete loading[url];\n for (var i = 0, il = callbacks.length; i < il; i++) {\n var callback = callbacks[i];\n if (callback.onLoad) callback.onLoad(data);\n }\n })[\"catch\"](function (err) {\n // Abort errors and other errors are handled the same\n\n var callbacks = loading[url];\n if (callbacks === undefined) {\n // When onLoad was called and url was deleted in `loading`\n _this94.manager.itemError(url);\n throw err;\n }\n delete loading[url];\n for (var i = 0, il = callbacks.length; i < il; i++) {\n var callback = callbacks[i];\n if (callback.onError) callback.onError(err);\n }\n _this94.manager.itemError(url);\n })[\"finally\"](function () {\n _this94.manager.itemEnd(url);\n });\n this.manager.itemStart(url);\n }\n }, {\n key: \"setResponseType\",\n value: function setResponseType(value) {\n this.responseType = value;\n return this;\n }\n }, {\n key: \"setMimeType\",\n value: function setMimeType(value) {\n this.mimeType = value;\n return this;\n }\n }]);\n return FileLoader;\n}(Loader);\nvar AnimationLoader = /*#__PURE__*/function (_Loader2) {\n _inherits(AnimationLoader, _Loader2);\n var _super113 = _createSuper(AnimationLoader);\n function AnimationLoader(manager) {\n _classCallCheck(this, AnimationLoader);\n return _super113.call(this, manager);\n }\n _createClass(AnimationLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n var scope = this;\n var loader = new FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function (text) {\n try {\n onLoad(scope.parse(JSON.parse(text)));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n }, onProgress, onError);\n }\n }, {\n key: \"parse\",\n value: function parse(json) {\n var animations = [];\n for (var i = 0; i < json.length; i++) {\n var clip = AnimationClip.parse(json[i]);\n animations.push(clip);\n }\n return animations;\n }\n }]);\n return AnimationLoader;\n}(Loader);\n/**\n * Abstract Base class to block based textures loader (dds, pvr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\nvar CompressedTextureLoader = /*#__PURE__*/function (_Loader3) {\n _inherits(CompressedTextureLoader, _Loader3);\n var _super114 = _createSuper(CompressedTextureLoader);\n function CompressedTextureLoader(manager) {\n _classCallCheck(this, CompressedTextureLoader);\n return _super114.call(this, manager);\n }\n _createClass(CompressedTextureLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n var scope = this;\n var images = [];\n var texture = new CompressedTexture();\n var loader = new FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setResponseType('arraybuffer');\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n var loaded = 0;\n function loadTexture(i) {\n loader.load(url[i], function (buffer) {\n var texDatas = scope.parse(buffer, true);\n images[i] = {\n width: texDatas.width,\n height: texDatas.height,\n format: texDatas.format,\n mipmaps: texDatas.mipmaps\n };\n loaded += 1;\n if (loaded === 6) {\n if (texDatas.mipmapCount === 1) texture.minFilter = LinearFilter;\n texture.image = images;\n texture.format = texDatas.format;\n texture.needsUpdate = true;\n if (onLoad) onLoad(texture);\n }\n }, onProgress, onError);\n }\n if (Array.isArray(url)) {\n for (var i = 0, il = url.length; i < il; ++i) {\n loadTexture(i);\n }\n } else {\n // compressed cubemap texture stored in a single DDS file\n\n loader.load(url, function (buffer) {\n var texDatas = scope.parse(buffer, true);\n if (texDatas.isCubemap) {\n var faces = texDatas.mipmaps.length / texDatas.mipmapCount;\n for (var f = 0; f < faces; f++) {\n images[f] = {\n mipmaps: []\n };\n for (var _i91 = 0; _i91 < texDatas.mipmapCount; _i91++) {\n images[f].mipmaps.push(texDatas.mipmaps[f * texDatas.mipmapCount + _i91]);\n images[f].format = texDatas.format;\n images[f].width = texDatas.width;\n images[f].height = texDatas.height;\n }\n }\n texture.image = images;\n } else {\n texture.image.width = texDatas.width;\n texture.image.height = texDatas.height;\n texture.mipmaps = texDatas.mipmaps;\n }\n if (texDatas.mipmapCount === 1) {\n texture.minFilter = LinearFilter;\n }\n texture.format = texDatas.format;\n texture.needsUpdate = true;\n if (onLoad) onLoad(texture);\n }, onProgress, onError);\n }\n return texture;\n }\n }]);\n return CompressedTextureLoader;\n}(Loader);\nvar ImageLoader = /*#__PURE__*/function (_Loader4) {\n _inherits(ImageLoader, _Loader4);\n var _super115 = _createSuper(ImageLoader);\n function ImageLoader(manager) {\n _classCallCheck(this, ImageLoader);\n return _super115.call(this, manager);\n }\n _createClass(ImageLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n if (this.path !== undefined) url = this.path + url;\n url = this.manager.resolveURL(url);\n var scope = this;\n var cached = Cache.get(url);\n if (cached !== undefined) {\n scope.manager.itemStart(url);\n setTimeout(function () {\n if (onLoad) onLoad(cached);\n scope.manager.itemEnd(url);\n }, 0);\n return cached;\n }\n var image = createElementNS('img');\n function onImageLoad() {\n removeEventListeners();\n Cache.add(url, this);\n if (onLoad) onLoad(this);\n scope.manager.itemEnd(url);\n }\n function onImageError(event) {\n removeEventListeners();\n if (onError) onError(event);\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n }\n function removeEventListeners() {\n image.removeEventListener('load', onImageLoad, false);\n image.removeEventListener('error', onImageError, false);\n }\n image.addEventListener('load', onImageLoad, false);\n image.addEventListener('error', onImageError, false);\n if (url.slice(0, 5) !== 'data:') {\n if (this.crossOrigin !== undefined) image.crossOrigin = this.crossOrigin;\n }\n scope.manager.itemStart(url);\n image.src = url;\n return image;\n }\n }]);\n return ImageLoader;\n}(Loader);\nvar CubeTextureLoader = /*#__PURE__*/function (_Loader5) {\n _inherits(CubeTextureLoader, _Loader5);\n var _super116 = _createSuper(CubeTextureLoader);\n function CubeTextureLoader(manager) {\n _classCallCheck(this, CubeTextureLoader);\n return _super116.call(this, manager);\n }\n _createClass(CubeTextureLoader, [{\n key: \"load\",\n value: function load(urls, onLoad, onProgress, onError) {\n var texture = new CubeTexture();\n var loader = new ImageLoader(this.manager);\n loader.setCrossOrigin(this.crossOrigin);\n loader.setPath(this.path);\n var loaded = 0;\n function loadTexture(i) {\n loader.load(urls[i], function (image) {\n texture.images[i] = image;\n loaded++;\n if (loaded === 6) {\n texture.needsUpdate = true;\n if (onLoad) onLoad(texture);\n }\n }, undefined, onError);\n }\n for (var i = 0; i < urls.length; ++i) {\n loadTexture(i);\n }\n return texture;\n }\n }]);\n return CubeTextureLoader;\n}(Loader);\n/**\n * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)\n *\n * Sub classes have to implement the parse() method which will be used in load().\n */\nvar DataTextureLoader = /*#__PURE__*/function (_Loader6) {\n _inherits(DataTextureLoader, _Loader6);\n var _super117 = _createSuper(DataTextureLoader);\n function DataTextureLoader(manager) {\n _classCallCheck(this, DataTextureLoader);\n return _super117.call(this, manager);\n }\n _createClass(DataTextureLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n var scope = this;\n var texture = new DataTexture();\n var loader = new FileLoader(this.manager);\n loader.setResponseType('arraybuffer');\n loader.setRequestHeader(this.requestHeader);\n loader.setPath(this.path);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(url, function (buffer) {\n var texData = scope.parse(buffer);\n if (!texData) return;\n if (texData.image !== undefined) {\n texture.image = texData.image;\n } else if (texData.data !== undefined) {\n texture.image.width = texData.width;\n texture.image.height = texData.height;\n texture.image.data = texData.data;\n }\n texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;\n texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;\n texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;\n texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;\n texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;\n if (texData.encoding !== undefined) {\n texture.encoding = texData.encoding;\n }\n if (texData.flipY !== undefined) {\n texture.flipY = texData.flipY;\n }\n if (texData.format !== undefined) {\n texture.format = texData.format;\n }\n if (texData.type !== undefined) {\n texture.type = texData.type;\n }\n if (texData.mipmaps !== undefined) {\n texture.mipmaps = texData.mipmaps;\n texture.minFilter = LinearMipmapLinearFilter; // presumably...\n }\n\n if (texData.mipmapCount === 1) {\n texture.minFilter = LinearFilter;\n }\n if (texData.generateMipmaps !== undefined) {\n texture.generateMipmaps = texData.generateMipmaps;\n }\n texture.needsUpdate = true;\n if (onLoad) onLoad(texture, texData);\n }, onProgress, onError);\n return texture;\n }\n }]);\n return DataTextureLoader;\n}(Loader);\nvar TextureLoader = /*#__PURE__*/function (_Loader7) {\n _inherits(TextureLoader, _Loader7);\n var _super118 = _createSuper(TextureLoader);\n function TextureLoader(manager) {\n _classCallCheck(this, TextureLoader);\n return _super118.call(this, manager);\n }\n _createClass(TextureLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n var texture = new Texture();\n var loader = new ImageLoader(this.manager);\n loader.setCrossOrigin(this.crossOrigin);\n loader.setPath(this.path);\n loader.load(url, function (image) {\n texture.image = image;\n texture.needsUpdate = true;\n if (onLoad !== undefined) {\n onLoad(texture);\n }\n }, onProgress, onError);\n return texture;\n }\n }]);\n return TextureLoader;\n}(Loader);\nvar Light = /*#__PURE__*/function (_Object3D11) {\n _inherits(Light, _Object3D11);\n var _super119 = _createSuper(Light);\n function Light(color) {\n var _this95;\n var intensity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n _classCallCheck(this, Light);\n _this95 = _super119.call(this);\n _this95.isLight = true;\n _this95.type = 'Light';\n _this95.color = new Color(color);\n _this95.intensity = intensity;\n return _this95;\n }\n _createClass(Light, [{\n key: \"dispose\",\n value: function dispose() {\n\n // Empty here in base class; some subclasses override.\n }\n }, {\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(Light.prototype), \"copy\", this).call(this, source, recursive);\n this.color.copy(source.color);\n this.intensity = source.intensity;\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(meta) {\n var data = _get(_getPrototypeOf(Light.prototype), \"toJSON\", this).call(this, meta);\n data.object.color = this.color.getHex();\n data.object.intensity = this.intensity;\n if (this.groundColor !== undefined) data.object.groundColor = this.groundColor.getHex();\n if (this.distance !== undefined) data.object.distance = this.distance;\n if (this.angle !== undefined) data.object.angle = this.angle;\n if (this.decay !== undefined) data.object.decay = this.decay;\n if (this.penumbra !== undefined) data.object.penumbra = this.penumbra;\n if (this.shadow !== undefined) data.object.shadow = this.shadow.toJSON();\n return data;\n }\n }]);\n return Light;\n}(Object3D);\nvar HemisphereLight = /*#__PURE__*/function (_Light) {\n _inherits(HemisphereLight, _Light);\n var _super120 = _createSuper(HemisphereLight);\n function HemisphereLight(skyColor, groundColor, intensity) {\n var _this96;\n _classCallCheck(this, HemisphereLight);\n _this96 = _super120.call(this, skyColor, intensity);\n _this96.isHemisphereLight = true;\n _this96.type = 'HemisphereLight';\n _this96.position.copy(Object3D.DEFAULT_UP);\n _this96.updateMatrix();\n _this96.groundColor = new Color(groundColor);\n return _this96;\n }\n _createClass(HemisphereLight, [{\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(HemisphereLight.prototype), \"copy\", this).call(this, source, recursive);\n this.groundColor.copy(source.groundColor);\n return this;\n }\n }]);\n return HemisphereLight;\n}(Light);\nvar _projScreenMatrix$1 = /*@__PURE__*/new Matrix4();\nvar _lightPositionWorld$1 = /*@__PURE__*/new Vector3();\nvar _lookTarget$1 = /*@__PURE__*/new Vector3();\nvar LightShadow = /*#__PURE__*/function () {\n function LightShadow(camera) {\n _classCallCheck(this, LightShadow);\n this.camera = camera;\n this.bias = 0;\n this.normalBias = 0;\n this.radius = 1;\n this.blurSamples = 8;\n this.mapSize = new Vector2(512, 512);\n this.map = null;\n this.mapPass = null;\n this.matrix = new Matrix4();\n this.autoUpdate = true;\n this.needsUpdate = false;\n this._frustum = new Frustum();\n this._frameExtents = new Vector2(1, 1);\n this._viewportCount = 1;\n this._viewports = [new Vector4(0, 0, 1, 1)];\n }\n _createClass(LightShadow, [{\n key: \"getViewportCount\",\n value: function getViewportCount() {\n return this._viewportCount;\n }\n }, {\n key: \"getFrustum\",\n value: function getFrustum() {\n return this._frustum;\n }\n }, {\n key: \"updateMatrices\",\n value: function updateMatrices(light) {\n var shadowCamera = this.camera;\n var shadowMatrix = this.matrix;\n _lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld);\n shadowCamera.position.copy(_lightPositionWorld$1);\n _lookTarget$1.setFromMatrixPosition(light.target.matrixWorld);\n shadowCamera.lookAt(_lookTarget$1);\n shadowCamera.updateMatrixWorld();\n _projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse);\n this._frustum.setFromProjectionMatrix(_projScreenMatrix$1);\n shadowMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);\n shadowMatrix.multiply(_projScreenMatrix$1);\n }\n }, {\n key: \"getViewport\",\n value: function getViewport(viewportIndex) {\n return this._viewports[viewportIndex];\n }\n }, {\n key: \"getFrameExtents\",\n value: function getFrameExtents() {\n return this._frameExtents;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n if (this.map) {\n this.map.dispose();\n }\n if (this.mapPass) {\n this.mapPass.dispose();\n }\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n this.camera = source.camera.clone();\n this.bias = source.bias;\n this.radius = source.radius;\n this.mapSize.copy(source.mapSize);\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var object = {};\n if (this.bias !== 0) object.bias = this.bias;\n if (this.normalBias !== 0) object.normalBias = this.normalBias;\n if (this.radius !== 1) object.radius = this.radius;\n if (this.mapSize.x !== 512 || this.mapSize.y !== 512) object.mapSize = this.mapSize.toArray();\n object.camera = this.camera.toJSON(false).object;\n delete object.camera.matrix;\n return object;\n }\n }]);\n return LightShadow;\n}();\nvar SpotLightShadow = /*#__PURE__*/function (_LightShadow) {\n _inherits(SpotLightShadow, _LightShadow);\n var _super121 = _createSuper(SpotLightShadow);\n function SpotLightShadow() {\n var _this97;\n _classCallCheck(this, SpotLightShadow);\n _this97 = _super121.call(this, new PerspectiveCamera(50, 1, 0.5, 500));\n _this97.isSpotLightShadow = true;\n _this97.focus = 1;\n return _this97;\n }\n _createClass(SpotLightShadow, [{\n key: \"updateMatrices\",\n value: function updateMatrices(light) {\n var camera = this.camera;\n var fov = RAD2DEG * 2 * light.angle * this.focus;\n var aspect = this.mapSize.width / this.mapSize.height;\n var far = light.distance || camera.far;\n if (fov !== camera.fov || aspect !== camera.aspect || far !== camera.far) {\n camera.fov = fov;\n camera.aspect = aspect;\n camera.far = far;\n camera.updateProjectionMatrix();\n }\n _get(_getPrototypeOf(SpotLightShadow.prototype), \"updateMatrices\", this).call(this, light);\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(SpotLightShadow.prototype), \"copy\", this).call(this, source);\n this.focus = source.focus;\n return this;\n }\n }]);\n return SpotLightShadow;\n}(LightShadow);\nvar SpotLight = /*#__PURE__*/function (_Light2) {\n _inherits(SpotLight, _Light2);\n var _super122 = _createSuper(SpotLight);\n function SpotLight(color, intensity) {\n var _this98;\n var distance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var angle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Math.PI / 3;\n var penumbra = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n var decay = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 2;\n _classCallCheck(this, SpotLight);\n _this98 = _super122.call(this, color, intensity);\n _this98.isSpotLight = true;\n _this98.type = 'SpotLight';\n _this98.position.copy(Object3D.DEFAULT_UP);\n _this98.updateMatrix();\n _this98.target = new Object3D();\n _this98.distance = distance;\n _this98.angle = angle;\n _this98.penumbra = penumbra;\n _this98.decay = decay;\n _this98.map = null;\n _this98.shadow = new SpotLightShadow();\n return _this98;\n }\n _createClass(SpotLight, [{\n key: \"power\",\n get: function get() {\n // compute the light's luminous power (in lumens) from its intensity (in candela)\n // by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)\n return this.intensity * Math.PI;\n },\n set: function set(power) {\n // set the light's intensity (in candela) from the desired luminous power (in lumens)\n this.intensity = power / Math.PI;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.shadow.dispose();\n }\n }, {\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(SpotLight.prototype), \"copy\", this).call(this, source, recursive);\n this.distance = source.distance;\n this.angle = source.angle;\n this.penumbra = source.penumbra;\n this.decay = source.decay;\n this.target = source.target.clone();\n this.shadow = source.shadow.clone();\n return this;\n }\n }]);\n return SpotLight;\n}(Light);\nvar _projScreenMatrix = /*@__PURE__*/new Matrix4();\nvar _lightPositionWorld = /*@__PURE__*/new Vector3();\nvar _lookTarget = /*@__PURE__*/new Vector3();\nvar PointLightShadow = /*#__PURE__*/function (_LightShadow2) {\n _inherits(PointLightShadow, _LightShadow2);\n var _super123 = _createSuper(PointLightShadow);\n function PointLightShadow() {\n var _this99;\n _classCallCheck(this, PointLightShadow);\n _this99 = _super123.call(this, new PerspectiveCamera(90, 1, 0.5, 500));\n _this99.isPointLightShadow = true;\n _this99._frameExtents = new Vector2(4, 2);\n _this99._viewportCount = 6;\n _this99._viewports = [\n // These viewports map a cube-map onto a 2D texture with the\n // following orientation:\n //\n // xzXZ\n // y Y\n //\n // X - Positive x direction\n // x - Negative x direction\n // Y - Positive y direction\n // y - Negative y direction\n // Z - Positive z direction\n // z - Negative z direction\n\n // positive X\n new Vector4(2, 1, 1, 1),\n // negative X\n new Vector4(0, 1, 1, 1),\n // positive Z\n new Vector4(3, 1, 1, 1),\n // negative Z\n new Vector4(1, 1, 1, 1),\n // positive Y\n new Vector4(3, 0, 1, 1),\n // negative Y\n new Vector4(1, 0, 1, 1)];\n _this99._cubeDirections = [new Vector3(1, 0, 0), new Vector3(-1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1), new Vector3(0, 1, 0), new Vector3(0, -1, 0)];\n _this99._cubeUps = [new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1)];\n return _this99;\n }\n _createClass(PointLightShadow, [{\n key: \"updateMatrices\",\n value: function updateMatrices(light) {\n var viewportIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var camera = this.camera;\n var shadowMatrix = this.matrix;\n var far = light.distance || camera.far;\n if (far !== camera.far) {\n camera.far = far;\n camera.updateProjectionMatrix();\n }\n _lightPositionWorld.setFromMatrixPosition(light.matrixWorld);\n camera.position.copy(_lightPositionWorld);\n _lookTarget.copy(camera.position);\n _lookTarget.add(this._cubeDirections[viewportIndex]);\n camera.up.copy(this._cubeUps[viewportIndex]);\n camera.lookAt(_lookTarget);\n camera.updateMatrixWorld();\n shadowMatrix.makeTranslation(-_lightPositionWorld.x, -_lightPositionWorld.y, -_lightPositionWorld.z);\n _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n this._frustum.setFromProjectionMatrix(_projScreenMatrix);\n }\n }]);\n return PointLightShadow;\n}(LightShadow);\nvar PointLight = /*#__PURE__*/function (_Light3) {\n _inherits(PointLight, _Light3);\n var _super124 = _createSuper(PointLight);\n function PointLight(color, intensity) {\n var _this100;\n var distance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var decay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 2;\n _classCallCheck(this, PointLight);\n _this100 = _super124.call(this, color, intensity);\n _this100.isPointLight = true;\n _this100.type = 'PointLight';\n _this100.distance = distance;\n _this100.decay = decay;\n _this100.shadow = new PointLightShadow();\n return _this100;\n }\n _createClass(PointLight, [{\n key: \"power\",\n get: function get() {\n // compute the light's luminous power (in lumens) from its intensity (in candela)\n // for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd)\n return this.intensity * 4 * Math.PI;\n },\n set: function set(power) {\n // set the light's intensity (in candela) from the desired luminous power (in lumens)\n this.intensity = power / (4 * Math.PI);\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.shadow.dispose();\n }\n }, {\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(PointLight.prototype), \"copy\", this).call(this, source, recursive);\n this.distance = source.distance;\n this.decay = source.decay;\n this.shadow = source.shadow.clone();\n return this;\n }\n }]);\n return PointLight;\n}(Light);\nvar DirectionalLightShadow = /*#__PURE__*/function (_LightShadow3) {\n _inherits(DirectionalLightShadow, _LightShadow3);\n var _super125 = _createSuper(DirectionalLightShadow);\n function DirectionalLightShadow() {\n var _this101;\n _classCallCheck(this, DirectionalLightShadow);\n _this101 = _super125.call(this, new OrthographicCamera(-5, 5, 5, -5, 0.5, 500));\n _this101.isDirectionalLightShadow = true;\n return _this101;\n }\n return _createClass(DirectionalLightShadow);\n}(LightShadow);\nvar DirectionalLight = /*#__PURE__*/function (_Light4) {\n _inherits(DirectionalLight, _Light4);\n var _super126 = _createSuper(DirectionalLight);\n function DirectionalLight(color, intensity) {\n var _this102;\n _classCallCheck(this, DirectionalLight);\n _this102 = _super126.call(this, color, intensity);\n _this102.isDirectionalLight = true;\n _this102.type = 'DirectionalLight';\n _this102.position.copy(Object3D.DEFAULT_UP);\n _this102.updateMatrix();\n _this102.target = new Object3D();\n _this102.shadow = new DirectionalLightShadow();\n return _this102;\n }\n _createClass(DirectionalLight, [{\n key: \"dispose\",\n value: function dispose() {\n this.shadow.dispose();\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(DirectionalLight.prototype), \"copy\", this).call(this, source);\n this.target = source.target.clone();\n this.shadow = source.shadow.clone();\n return this;\n }\n }]);\n return DirectionalLight;\n}(Light);\nvar AmbientLight = /*#__PURE__*/function (_Light5) {\n _inherits(AmbientLight, _Light5);\n var _super127 = _createSuper(AmbientLight);\n function AmbientLight(color, intensity) {\n var _this103;\n _classCallCheck(this, AmbientLight);\n _this103 = _super127.call(this, color, intensity);\n _this103.isAmbientLight = true;\n _this103.type = 'AmbientLight';\n return _this103;\n }\n return _createClass(AmbientLight);\n}(Light);\nvar RectAreaLight = /*#__PURE__*/function (_Light6) {\n _inherits(RectAreaLight, _Light6);\n var _super128 = _createSuper(RectAreaLight);\n function RectAreaLight(color, intensity) {\n var _this104;\n var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;\n var height = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;\n _classCallCheck(this, RectAreaLight);\n _this104 = _super128.call(this, color, intensity);\n _this104.isRectAreaLight = true;\n _this104.type = 'RectAreaLight';\n _this104.width = width;\n _this104.height = height;\n return _this104;\n }\n _createClass(RectAreaLight, [{\n key: \"power\",\n get: function get() {\n // compute the light's luminous power (in lumens) from its intensity (in nits)\n return this.intensity * this.width * this.height * Math.PI;\n },\n set: function set(power) {\n // set the light's intensity (in nits) from the desired luminous power (in lumens)\n this.intensity = power / (this.width * this.height * Math.PI);\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(RectAreaLight.prototype), \"copy\", this).call(this, source);\n this.width = source.width;\n this.height = source.height;\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(meta) {\n var data = _get(_getPrototypeOf(RectAreaLight.prototype), \"toJSON\", this).call(this, meta);\n data.object.width = this.width;\n data.object.height = this.height;\n return data;\n }\n }]);\n return RectAreaLight;\n}(Light);\n/**\n * Primary reference:\n * https://graphics.stanford.edu/papers/envmap/envmap.pdf\n *\n * Secondary reference:\n * https://www.ppsloan.org/publications/StupidSH36.pdf\n */\n// 3-band SH defined by 9 coefficients\nvar SphericalHarmonics3 = /*#__PURE__*/function () {\n function SphericalHarmonics3() {\n _classCallCheck(this, SphericalHarmonics3);\n this.isSphericalHarmonics3 = true;\n this.coefficients = [];\n for (var i = 0; i < 9; i++) {\n this.coefficients.push(new Vector3());\n }\n }\n _createClass(SphericalHarmonics3, [{\n key: \"set\",\n value: function set(coefficients) {\n for (var i = 0; i < 9; i++) {\n this.coefficients[i].copy(coefficients[i]);\n }\n return this;\n }\n }, {\n key: \"zero\",\n value: function zero() {\n for (var i = 0; i < 9; i++) {\n this.coefficients[i].set(0, 0, 0);\n }\n return this;\n }\n\n // get the radiance in the direction of the normal\n // target is a Vector3\n }, {\n key: \"getAt\",\n value: function getAt(normal, target) {\n // normal is assumed to be unit length\n\n var x = normal.x,\n y = normal.y,\n z = normal.z;\n var coeff = this.coefficients;\n\n // band 0\n target.copy(coeff[0]).multiplyScalar(0.282095);\n\n // band 1\n target.addScaledVector(coeff[1], 0.488603 * y);\n target.addScaledVector(coeff[2], 0.488603 * z);\n target.addScaledVector(coeff[3], 0.488603 * x);\n\n // band 2\n target.addScaledVector(coeff[4], 1.092548 * (x * y));\n target.addScaledVector(coeff[5], 1.092548 * (y * z));\n target.addScaledVector(coeff[6], 0.315392 * (3.0 * z * z - 1.0));\n target.addScaledVector(coeff[7], 1.092548 * (x * z));\n target.addScaledVector(coeff[8], 0.546274 * (x * x - y * y));\n return target;\n }\n\n // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal\n // target is a Vector3\n // https://graphics.stanford.edu/papers/envmap/envmap.pdf\n }, {\n key: \"getIrradianceAt\",\n value: function getIrradianceAt(normal, target) {\n // normal is assumed to be unit length\n\n var x = normal.x,\n y = normal.y,\n z = normal.z;\n var coeff = this.coefficients;\n\n // band 0\n target.copy(coeff[0]).multiplyScalar(0.886227); // π * 0.282095\n\n // band 1\n target.addScaledVector(coeff[1], 2.0 * 0.511664 * y); // ( 2 * π / 3 ) * 0.488603\n target.addScaledVector(coeff[2], 2.0 * 0.511664 * z);\n target.addScaledVector(coeff[3], 2.0 * 0.511664 * x);\n\n // band 2\n target.addScaledVector(coeff[4], 2.0 * 0.429043 * x * y); // ( π / 4 ) * 1.092548\n target.addScaledVector(coeff[5], 2.0 * 0.429043 * y * z);\n target.addScaledVector(coeff[6], 0.743125 * z * z - 0.247708); // ( π / 4 ) * 0.315392 * 3\n target.addScaledVector(coeff[7], 2.0 * 0.429043 * x * z);\n target.addScaledVector(coeff[8], 0.429043 * (x * x - y * y)); // ( π / 4 ) * 0.546274\n\n return target;\n }\n }, {\n key: \"add\",\n value: function add(sh) {\n for (var i = 0; i < 9; i++) {\n this.coefficients[i].add(sh.coefficients[i]);\n }\n return this;\n }\n }, {\n key: \"addScaledSH\",\n value: function addScaledSH(sh, s) {\n for (var i = 0; i < 9; i++) {\n this.coefficients[i].addScaledVector(sh.coefficients[i], s);\n }\n return this;\n }\n }, {\n key: \"scale\",\n value: function scale(s) {\n for (var i = 0; i < 9; i++) {\n this.coefficients[i].multiplyScalar(s);\n }\n return this;\n }\n }, {\n key: \"lerp\",\n value: function lerp(sh, alpha) {\n for (var i = 0; i < 9; i++) {\n this.coefficients[i].lerp(sh.coefficients[i], alpha);\n }\n return this;\n }\n }, {\n key: \"equals\",\n value: function equals(sh) {\n for (var i = 0; i < 9; i++) {\n if (!this.coefficients[i].equals(sh.coefficients[i])) {\n return false;\n }\n }\n return true;\n }\n }, {\n key: \"copy\",\n value: function copy(sh) {\n return this.set(sh.coefficients);\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }, {\n key: \"fromArray\",\n value: function fromArray(array) {\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var coefficients = this.coefficients;\n for (var i = 0; i < 9; i++) {\n coefficients[i].fromArray(array, offset + i * 3);\n }\n return this;\n }\n }, {\n key: \"toArray\",\n value: function toArray() {\n var array = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var coefficients = this.coefficients;\n for (var i = 0; i < 9; i++) {\n coefficients[i].toArray(array, offset + i * 3);\n }\n return array;\n }\n\n // evaluate the basis functions\n // shBasis is an Array[ 9 ]\n }], [{\n key: \"getBasisAt\",\n value: function getBasisAt(normal, shBasis) {\n // normal is assumed to be unit length\n\n var x = normal.x,\n y = normal.y,\n z = normal.z;\n\n // band 0\n shBasis[0] = 0.282095;\n\n // band 1\n shBasis[1] = 0.488603 * y;\n shBasis[2] = 0.488603 * z;\n shBasis[3] = 0.488603 * x;\n\n // band 2\n shBasis[4] = 1.092548 * x * y;\n shBasis[5] = 1.092548 * y * z;\n shBasis[6] = 0.315392 * (3 * z * z - 1);\n shBasis[7] = 1.092548 * x * z;\n shBasis[8] = 0.546274 * (x * x - y * y);\n }\n }]);\n return SphericalHarmonics3;\n}();\nvar LightProbe = /*#__PURE__*/function (_Light7) {\n _inherits(LightProbe, _Light7);\n var _super129 = _createSuper(LightProbe);\n function LightProbe() {\n var _this105;\n var sh = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new SphericalHarmonics3();\n var intensity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n _classCallCheck(this, LightProbe);\n _this105 = _super129.call(this, undefined, intensity);\n _this105.isLightProbe = true;\n _this105.sh = sh;\n return _this105;\n }\n _createClass(LightProbe, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(LightProbe.prototype), \"copy\", this).call(this, source);\n this.sh.copy(source.sh);\n return this;\n }\n }, {\n key: \"fromJSON\",\n value: function fromJSON(json) {\n this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON();\n this.sh.fromArray(json.sh);\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(meta) {\n var data = _get(_getPrototypeOf(LightProbe.prototype), \"toJSON\", this).call(this, meta);\n data.object.sh = this.sh.toArray();\n return data;\n }\n }]);\n return LightProbe;\n}(Light);\nvar MaterialLoader = /*#__PURE__*/function (_Loader8) {\n _inherits(MaterialLoader, _Loader8);\n var _super130 = _createSuper(MaterialLoader);\n function MaterialLoader(manager) {\n var _this106;\n _classCallCheck(this, MaterialLoader);\n _this106 = _super130.call(this, manager);\n _this106.textures = {};\n return _this106;\n }\n _createClass(MaterialLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n var scope = this;\n var loader = new FileLoader(scope.manager);\n loader.setPath(scope.path);\n loader.setRequestHeader(scope.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(url, function (text) {\n try {\n onLoad(scope.parse(JSON.parse(text)));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n }, onProgress, onError);\n }\n }, {\n key: \"parse\",\n value: function parse(json) {\n var textures = this.textures;\n function getTexture(name) {\n if (textures[name] === undefined) {\n console.warn('THREE.MaterialLoader: Undefined texture', name);\n }\n return textures[name];\n }\n var material = MaterialLoader.createMaterialFromType(json.type);\n if (json.uuid !== undefined) material.uuid = json.uuid;\n if (json.name !== undefined) material.name = json.name;\n if (json.color !== undefined && material.color !== undefined) material.color.setHex(json.color);\n if (json.roughness !== undefined) material.roughness = json.roughness;\n if (json.metalness !== undefined) material.metalness = json.metalness;\n if (json.sheen !== undefined) material.sheen = json.sheen;\n if (json.sheenColor !== undefined) material.sheenColor = new Color().setHex(json.sheenColor);\n if (json.sheenRoughness !== undefined) material.sheenRoughness = json.sheenRoughness;\n if (json.emissive !== undefined && material.emissive !== undefined) material.emissive.setHex(json.emissive);\n if (json.specular !== undefined && material.specular !== undefined) material.specular.setHex(json.specular);\n if (json.specularIntensity !== undefined) material.specularIntensity = json.specularIntensity;\n if (json.specularColor !== undefined && material.specularColor !== undefined) material.specularColor.setHex(json.specularColor);\n if (json.shininess !== undefined) material.shininess = json.shininess;\n if (json.clearcoat !== undefined) material.clearcoat = json.clearcoat;\n if (json.clearcoatRoughness !== undefined) material.clearcoatRoughness = json.clearcoatRoughness;\n if (json.iridescence !== undefined) material.iridescence = json.iridescence;\n if (json.iridescenceIOR !== undefined) material.iridescenceIOR = json.iridescenceIOR;\n if (json.iridescenceThicknessRange !== undefined) material.iridescenceThicknessRange = json.iridescenceThicknessRange;\n if (json.transmission !== undefined) material.transmission = json.transmission;\n if (json.thickness !== undefined) material.thickness = json.thickness;\n if (json.attenuationDistance !== undefined) material.attenuationDistance = json.attenuationDistance;\n if (json.attenuationColor !== undefined && material.attenuationColor !== undefined) material.attenuationColor.setHex(json.attenuationColor);\n if (json.fog !== undefined) material.fog = json.fog;\n if (json.flatShading !== undefined) material.flatShading = json.flatShading;\n if (json.blending !== undefined) material.blending = json.blending;\n if (json.combine !== undefined) material.combine = json.combine;\n if (json.side !== undefined) material.side = json.side;\n if (json.shadowSide !== undefined) material.shadowSide = json.shadowSide;\n if (json.opacity !== undefined) material.opacity = json.opacity;\n if (json.transparent !== undefined) material.transparent = json.transparent;\n if (json.alphaTest !== undefined) material.alphaTest = json.alphaTest;\n if (json.depthTest !== undefined) material.depthTest = json.depthTest;\n if (json.depthWrite !== undefined) material.depthWrite = json.depthWrite;\n if (json.colorWrite !== undefined) material.colorWrite = json.colorWrite;\n if (json.stencilWrite !== undefined) material.stencilWrite = json.stencilWrite;\n if (json.stencilWriteMask !== undefined) material.stencilWriteMask = json.stencilWriteMask;\n if (json.stencilFunc !== undefined) material.stencilFunc = json.stencilFunc;\n if (json.stencilRef !== undefined) material.stencilRef = json.stencilRef;\n if (json.stencilFuncMask !== undefined) material.stencilFuncMask = json.stencilFuncMask;\n if (json.stencilFail !== undefined) material.stencilFail = json.stencilFail;\n if (json.stencilZFail !== undefined) material.stencilZFail = json.stencilZFail;\n if (json.stencilZPass !== undefined) material.stencilZPass = json.stencilZPass;\n if (json.wireframe !== undefined) material.wireframe = json.wireframe;\n if (json.wireframeLinewidth !== undefined) material.wireframeLinewidth = json.wireframeLinewidth;\n if (json.wireframeLinecap !== undefined) material.wireframeLinecap = json.wireframeLinecap;\n if (json.wireframeLinejoin !== undefined) material.wireframeLinejoin = json.wireframeLinejoin;\n if (json.rotation !== undefined) material.rotation = json.rotation;\n if (json.linewidth !== 1) material.linewidth = json.linewidth;\n if (json.dashSize !== undefined) material.dashSize = json.dashSize;\n if (json.gapSize !== undefined) material.gapSize = json.gapSize;\n if (json.scale !== undefined) material.scale = json.scale;\n if (json.polygonOffset !== undefined) material.polygonOffset = json.polygonOffset;\n if (json.polygonOffsetFactor !== undefined) material.polygonOffsetFactor = json.polygonOffsetFactor;\n if (json.polygonOffsetUnits !== undefined) material.polygonOffsetUnits = json.polygonOffsetUnits;\n if (json.dithering !== undefined) material.dithering = json.dithering;\n if (json.alphaToCoverage !== undefined) material.alphaToCoverage = json.alphaToCoverage;\n if (json.premultipliedAlpha !== undefined) material.premultipliedAlpha = json.premultipliedAlpha;\n if (json.forceSinglePass !== undefined) material.forceSinglePass = json.forceSinglePass;\n if (json.visible !== undefined) material.visible = json.visible;\n if (json.toneMapped !== undefined) material.toneMapped = json.toneMapped;\n if (json.userData !== undefined) material.userData = json.userData;\n if (json.vertexColors !== undefined) {\n if (typeof json.vertexColors === 'number') {\n material.vertexColors = json.vertexColors > 0 ? true : false;\n } else {\n material.vertexColors = json.vertexColors;\n }\n }\n\n // Shader Material\n\n if (json.uniforms !== undefined) {\n for (var name in json.uniforms) {\n var uniform = json.uniforms[name];\n material.uniforms[name] = {};\n switch (uniform.type) {\n case 't':\n material.uniforms[name].value = getTexture(uniform.value);\n break;\n case 'c':\n material.uniforms[name].value = new Color().setHex(uniform.value);\n break;\n case 'v2':\n material.uniforms[name].value = new Vector2().fromArray(uniform.value);\n break;\n case 'v3':\n material.uniforms[name].value = new Vector3().fromArray(uniform.value);\n break;\n case 'v4':\n material.uniforms[name].value = new Vector4().fromArray(uniform.value);\n break;\n case 'm3':\n material.uniforms[name].value = new Matrix3().fromArray(uniform.value);\n break;\n case 'm4':\n material.uniforms[name].value = new Matrix4().fromArray(uniform.value);\n break;\n default:\n material.uniforms[name].value = uniform.value;\n }\n }\n }\n if (json.defines !== undefined) material.defines = json.defines;\n if (json.vertexShader !== undefined) material.vertexShader = json.vertexShader;\n if (json.fragmentShader !== undefined) material.fragmentShader = json.fragmentShader;\n if (json.glslVersion !== undefined) material.glslVersion = json.glslVersion;\n if (json.extensions !== undefined) {\n for (var key in json.extensions) {\n material.extensions[key] = json.extensions[key];\n }\n }\n\n // for PointsMaterial\n\n if (json.size !== undefined) material.size = json.size;\n if (json.sizeAttenuation !== undefined) material.sizeAttenuation = json.sizeAttenuation;\n\n // maps\n\n if (json.map !== undefined) material.map = getTexture(json.map);\n if (json.matcap !== undefined) material.matcap = getTexture(json.matcap);\n if (json.alphaMap !== undefined) material.alphaMap = getTexture(json.alphaMap);\n if (json.bumpMap !== undefined) material.bumpMap = getTexture(json.bumpMap);\n if (json.bumpScale !== undefined) material.bumpScale = json.bumpScale;\n if (json.normalMap !== undefined) material.normalMap = getTexture(json.normalMap);\n if (json.normalMapType !== undefined) material.normalMapType = json.normalMapType;\n if (json.normalScale !== undefined) {\n var normalScale = json.normalScale;\n if (Array.isArray(normalScale) === false) {\n // Blender exporter used to export a scalar. See #7459\n\n normalScale = [normalScale, normalScale];\n }\n material.normalScale = new Vector2().fromArray(normalScale);\n }\n if (json.displacementMap !== undefined) material.displacementMap = getTexture(json.displacementMap);\n if (json.displacementScale !== undefined) material.displacementScale = json.displacementScale;\n if (json.displacementBias !== undefined) material.displacementBias = json.displacementBias;\n if (json.roughnessMap !== undefined) material.roughnessMap = getTexture(json.roughnessMap);\n if (json.metalnessMap !== undefined) material.metalnessMap = getTexture(json.metalnessMap);\n if (json.emissiveMap !== undefined) material.emissiveMap = getTexture(json.emissiveMap);\n if (json.emissiveIntensity !== undefined) material.emissiveIntensity = json.emissiveIntensity;\n if (json.specularMap !== undefined) material.specularMap = getTexture(json.specularMap);\n if (json.specularIntensityMap !== undefined) material.specularIntensityMap = getTexture(json.specularIntensityMap);\n if (json.specularColorMap !== undefined) material.specularColorMap = getTexture(json.specularColorMap);\n if (json.envMap !== undefined) material.envMap = getTexture(json.envMap);\n if (json.envMapIntensity !== undefined) material.envMapIntensity = json.envMapIntensity;\n if (json.reflectivity !== undefined) material.reflectivity = json.reflectivity;\n if (json.refractionRatio !== undefined) material.refractionRatio = json.refractionRatio;\n if (json.lightMap !== undefined) material.lightMap = getTexture(json.lightMap);\n if (json.lightMapIntensity !== undefined) material.lightMapIntensity = json.lightMapIntensity;\n if (json.aoMap !== undefined) material.aoMap = getTexture(json.aoMap);\n if (json.aoMapIntensity !== undefined) material.aoMapIntensity = json.aoMapIntensity;\n if (json.gradientMap !== undefined) material.gradientMap = getTexture(json.gradientMap);\n if (json.clearcoatMap !== undefined) material.clearcoatMap = getTexture(json.clearcoatMap);\n if (json.clearcoatRoughnessMap !== undefined) material.clearcoatRoughnessMap = getTexture(json.clearcoatRoughnessMap);\n if (json.clearcoatNormalMap !== undefined) material.clearcoatNormalMap = getTexture(json.clearcoatNormalMap);\n if (json.clearcoatNormalScale !== undefined) material.clearcoatNormalScale = new Vector2().fromArray(json.clearcoatNormalScale);\n if (json.iridescenceMap !== undefined) material.iridescenceMap = getTexture(json.iridescenceMap);\n if (json.iridescenceThicknessMap !== undefined) material.iridescenceThicknessMap = getTexture(json.iridescenceThicknessMap);\n if (json.transmissionMap !== undefined) material.transmissionMap = getTexture(json.transmissionMap);\n if (json.thicknessMap !== undefined) material.thicknessMap = getTexture(json.thicknessMap);\n if (json.sheenColorMap !== undefined) material.sheenColorMap = getTexture(json.sheenColorMap);\n if (json.sheenRoughnessMap !== undefined) material.sheenRoughnessMap = getTexture(json.sheenRoughnessMap);\n return material;\n }\n }, {\n key: \"setTextures\",\n value: function setTextures(value) {\n this.textures = value;\n return this;\n }\n }], [{\n key: \"createMaterialFromType\",\n value: function createMaterialFromType(type) {\n var materialLib = {\n ShadowMaterial: ShadowMaterial,\n SpriteMaterial: SpriteMaterial,\n RawShaderMaterial: RawShaderMaterial,\n ShaderMaterial: ShaderMaterial,\n PointsMaterial: PointsMaterial,\n MeshPhysicalMaterial: MeshPhysicalMaterial,\n MeshStandardMaterial: MeshStandardMaterial,\n MeshPhongMaterial: MeshPhongMaterial,\n MeshToonMaterial: MeshToonMaterial,\n MeshNormalMaterial: MeshNormalMaterial,\n MeshLambertMaterial: MeshLambertMaterial,\n MeshDepthMaterial: MeshDepthMaterial,\n MeshDistanceMaterial: MeshDistanceMaterial,\n MeshBasicMaterial: MeshBasicMaterial,\n MeshMatcapMaterial: MeshMatcapMaterial,\n LineDashedMaterial: LineDashedMaterial,\n LineBasicMaterial: LineBasicMaterial,\n Material: Material\n };\n return new materialLib[type]();\n }\n }]);\n return MaterialLoader;\n}(Loader);\nvar LoaderUtils = /*#__PURE__*/function () {\n function LoaderUtils() {\n _classCallCheck(this, LoaderUtils);\n }\n _createClass(LoaderUtils, null, [{\n key: \"decodeText\",\n value: function decodeText(array) {\n if (typeof TextDecoder !== 'undefined') {\n return new TextDecoder().decode(array);\n }\n\n // Avoid the String.fromCharCode.apply(null, array) shortcut, which\n // throws a \"maximum call stack size exceeded\" error for large arrays.\n\n var s = '';\n for (var i = 0, il = array.length; i < il; i++) {\n // Implicitly assumes little-endian.\n s += String.fromCharCode(array[i]);\n }\n try {\n // merges multi-byte utf-8 characters.\n\n return decodeURIComponent(escape(s));\n } catch (e) {\n // see #16358\n\n return s;\n }\n }\n }, {\n key: \"extractUrlBase\",\n value: function extractUrlBase(url) {\n var index = url.lastIndexOf('/');\n if (index === -1) return './';\n return url.slice(0, index + 1);\n }\n }, {\n key: \"resolveURL\",\n value: function resolveURL(url, path) {\n // Invalid URL\n if (typeof url !== 'string' || url === '') return '';\n\n // Host Relative URL\n if (/^https?:\\/\\//i.test(path) && /^\\//.test(url)) {\n path = path.replace(/(^https?:\\/\\/[^\\/]+).*/i, '$1');\n }\n\n // Absolute URL http://,https://,//\n if (/^(https?:)?\\/\\//i.test(url)) return url;\n\n // Data URI\n if (/^data:.*,.*$/i.test(url)) return url;\n\n // Blob URL\n if (/^blob:.*$/i.test(url)) return url;\n\n // Relative URL\n return path + url;\n }\n }]);\n return LoaderUtils;\n}();\nvar InstancedBufferGeometry = /*#__PURE__*/function (_BufferGeometry16) {\n _inherits(InstancedBufferGeometry, _BufferGeometry16);\n var _super131 = _createSuper(InstancedBufferGeometry);\n function InstancedBufferGeometry() {\n var _this107;\n _classCallCheck(this, InstancedBufferGeometry);\n _this107 = _super131.call(this);\n _this107.isInstancedBufferGeometry = true;\n _this107.type = 'InstancedBufferGeometry';\n _this107.instanceCount = Infinity;\n return _this107;\n }\n _createClass(InstancedBufferGeometry, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(InstancedBufferGeometry.prototype), \"copy\", this).call(this, source);\n this.instanceCount = source.instanceCount;\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var data = _get(_getPrototypeOf(InstancedBufferGeometry.prototype), \"toJSON\", this).call(this);\n data.instanceCount = this.instanceCount;\n data.isInstancedBufferGeometry = true;\n return data;\n }\n }]);\n return InstancedBufferGeometry;\n}(BufferGeometry);\nvar BufferGeometryLoader = /*#__PURE__*/function (_Loader9) {\n _inherits(BufferGeometryLoader, _Loader9);\n var _super132 = _createSuper(BufferGeometryLoader);\n function BufferGeometryLoader(manager) {\n _classCallCheck(this, BufferGeometryLoader);\n return _super132.call(this, manager);\n }\n _createClass(BufferGeometryLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n var scope = this;\n var loader = new FileLoader(scope.manager);\n loader.setPath(scope.path);\n loader.setRequestHeader(scope.requestHeader);\n loader.setWithCredentials(scope.withCredentials);\n loader.load(url, function (text) {\n try {\n onLoad(scope.parse(JSON.parse(text)));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n }, onProgress, onError);\n }\n }, {\n key: \"parse\",\n value: function parse(json) {\n var interleavedBufferMap = {};\n var arrayBufferMap = {};\n function getInterleavedBuffer(json, uuid) {\n if (interleavedBufferMap[uuid] !== undefined) return interleavedBufferMap[uuid];\n var interleavedBuffers = json.interleavedBuffers;\n var interleavedBuffer = interleavedBuffers[uuid];\n var buffer = getArrayBuffer(json, interleavedBuffer.buffer);\n var array = getTypedArray(interleavedBuffer.type, buffer);\n var ib = new InterleavedBuffer(array, interleavedBuffer.stride);\n ib.uuid = interleavedBuffer.uuid;\n interleavedBufferMap[uuid] = ib;\n return ib;\n }\n function getArrayBuffer(json, uuid) {\n if (arrayBufferMap[uuid] !== undefined) return arrayBufferMap[uuid];\n var arrayBuffers = json.arrayBuffers;\n var arrayBuffer = arrayBuffers[uuid];\n var ab = new Uint32Array(arrayBuffer).buffer;\n arrayBufferMap[uuid] = ab;\n return ab;\n }\n var geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry();\n var index = json.data.index;\n if (index !== undefined) {\n var typedArray = getTypedArray(index.type, index.array);\n geometry.setIndex(new BufferAttribute(typedArray, 1));\n }\n var attributes = json.data.attributes;\n for (var key in attributes) {\n var attribute = attributes[key];\n var bufferAttribute = void 0;\n if (attribute.isInterleavedBufferAttribute) {\n var interleavedBuffer = getInterleavedBuffer(json.data, attribute.data);\n bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized);\n } else {\n var _typedArray = getTypedArray(attribute.type, attribute.array);\n var bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;\n bufferAttribute = new bufferAttributeConstr(_typedArray, attribute.itemSize, attribute.normalized);\n }\n if (attribute.name !== undefined) bufferAttribute.name = attribute.name;\n if (attribute.usage !== undefined) bufferAttribute.setUsage(attribute.usage);\n if (attribute.updateRange !== undefined) {\n bufferAttribute.updateRange.offset = attribute.updateRange.offset;\n bufferAttribute.updateRange.count = attribute.updateRange.count;\n }\n geometry.setAttribute(key, bufferAttribute);\n }\n var morphAttributes = json.data.morphAttributes;\n if (morphAttributes) {\n for (var _key3 in morphAttributes) {\n var attributeArray = morphAttributes[_key3];\n var array = [];\n for (var i = 0, il = attributeArray.length; i < il; i++) {\n var _attribute3 = attributeArray[i];\n var _bufferAttribute = void 0;\n if (_attribute3.isInterleavedBufferAttribute) {\n var _interleavedBuffer = getInterleavedBuffer(json.data, _attribute3.data);\n _bufferAttribute = new InterleavedBufferAttribute(_interleavedBuffer, _attribute3.itemSize, _attribute3.offset, _attribute3.normalized);\n } else {\n var _typedArray2 = getTypedArray(_attribute3.type, _attribute3.array);\n _bufferAttribute = new BufferAttribute(_typedArray2, _attribute3.itemSize, _attribute3.normalized);\n }\n if (_attribute3.name !== undefined) _bufferAttribute.name = _attribute3.name;\n array.push(_bufferAttribute);\n }\n geometry.morphAttributes[_key3] = array;\n }\n }\n var morphTargetsRelative = json.data.morphTargetsRelative;\n if (morphTargetsRelative) {\n geometry.morphTargetsRelative = true;\n }\n var groups = json.data.groups || json.data.drawcalls || json.data.offsets;\n if (groups !== undefined) {\n for (var _i92 = 0, n = groups.length; _i92 !== n; ++_i92) {\n var group = groups[_i92];\n geometry.addGroup(group.start, group.count, group.materialIndex);\n }\n }\n var boundingSphere = json.data.boundingSphere;\n if (boundingSphere !== undefined) {\n var center = new Vector3();\n if (boundingSphere.center !== undefined) {\n center.fromArray(boundingSphere.center);\n }\n geometry.boundingSphere = new Sphere(center, boundingSphere.radius);\n }\n if (json.name) geometry.name = json.name;\n if (json.userData) geometry.userData = json.userData;\n return geometry;\n }\n }]);\n return BufferGeometryLoader;\n}(Loader);\nvar ObjectLoader = /*#__PURE__*/function (_Loader10) {\n _inherits(ObjectLoader, _Loader10);\n var _super133 = _createSuper(ObjectLoader);\n function ObjectLoader(manager) {\n _classCallCheck(this, ObjectLoader);\n return _super133.call(this, manager);\n }\n _createClass(ObjectLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n var scope = this;\n var path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path;\n this.resourcePath = this.resourcePath || path;\n var loader = new FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function (text) {\n var json = null;\n try {\n json = JSON.parse(text);\n } catch (error) {\n if (onError !== undefined) onError(error);\n console.error('THREE:ObjectLoader: Can\\'t parse ' + url + '.', error.message);\n return;\n }\n var metadata = json.metadata;\n if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') {\n if (onError !== undefined) onError(new Error('THREE.ObjectLoader: Can\\'t load ' + url));\n console.error('THREE.ObjectLoader: Can\\'t load ' + url);\n return;\n }\n scope.parse(json, onLoad);\n }, onProgress, onError);\n }\n }, {\n key: \"loadAsync\",\n value: function () {\n var _loadAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url, onProgress) {\n var scope, path, loader, text, json, metadata;\n return _regeneratorRuntime().wrap(function _callee2$(_context10) {\n while (1) switch (_context10.prev = _context10.next) {\n case 0:\n scope = this;\n path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path;\n this.resourcePath = this.resourcePath || path;\n loader = new FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n _context10.next = 9;\n return loader.loadAsync(url, onProgress);\n case 9:\n text = _context10.sent;\n json = JSON.parse(text);\n metadata = json.metadata;\n if (!(metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry')) {\n _context10.next = 14;\n break;\n }\n throw new Error('THREE.ObjectLoader: Can\\'t load ' + url);\n case 14:\n _context10.next = 16;\n return scope.parseAsync(json);\n case 16:\n return _context10.abrupt(\"return\", _context10.sent);\n case 17:\n case \"end\":\n return _context10.stop();\n }\n }, _callee2, this);\n }));\n function loadAsync(_x7, _x8) {\n return _loadAsync.apply(this, arguments);\n }\n return loadAsync;\n }()\n }, {\n key: \"parse\",\n value: function parse(json, onLoad) {\n var animations = this.parseAnimations(json.animations);\n var shapes = this.parseShapes(json.shapes);\n var geometries = this.parseGeometries(json.geometries, shapes);\n var images = this.parseImages(json.images, function () {\n if (onLoad !== undefined) onLoad(object);\n });\n var textures = this.parseTextures(json.textures, images);\n var materials = this.parseMaterials(json.materials, textures);\n var object = this.parseObject(json.object, geometries, materials, textures, animations);\n var skeletons = this.parseSkeletons(json.skeletons, object);\n this.bindSkeletons(object, skeletons);\n\n //\n\n if (onLoad !== undefined) {\n var hasImages = false;\n for (var uuid in images) {\n if (images[uuid].data instanceof HTMLImageElement) {\n hasImages = true;\n break;\n }\n }\n if (hasImages === false) onLoad(object);\n }\n return object;\n }\n }, {\n key: \"parseAsync\",\n value: function () {\n var _parseAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(json) {\n var animations, shapes, geometries, images, textures, materials, object, skeletons;\n return _regeneratorRuntime().wrap(function _callee3$(_context11) {\n while (1) switch (_context11.prev = _context11.next) {\n case 0:\n animations = this.parseAnimations(json.animations);\n shapes = this.parseShapes(json.shapes);\n geometries = this.parseGeometries(json.geometries, shapes);\n _context11.next = 5;\n return this.parseImagesAsync(json.images);\n case 5:\n images = _context11.sent;\n textures = this.parseTextures(json.textures, images);\n materials = this.parseMaterials(json.materials, textures);\n object = this.parseObject(json.object, geometries, materials, textures, animations);\n skeletons = this.parseSkeletons(json.skeletons, object);\n this.bindSkeletons(object, skeletons);\n return _context11.abrupt(\"return\", object);\n case 12:\n case \"end\":\n return _context11.stop();\n }\n }, _callee3, this);\n }));\n function parseAsync(_x9) {\n return _parseAsync.apply(this, arguments);\n }\n return parseAsync;\n }()\n }, {\n key: \"parseShapes\",\n value: function parseShapes(json) {\n var shapes = {};\n if (json !== undefined) {\n for (var i = 0, l = json.length; i < l; i++) {\n var shape = new Shape().fromJSON(json[i]);\n shapes[shape.uuid] = shape;\n }\n }\n return shapes;\n }\n }, {\n key: \"parseSkeletons\",\n value: function parseSkeletons(json, object) {\n var skeletons = {};\n var bones = {};\n\n // generate bone lookup table\n\n object.traverse(function (child) {\n if (child.isBone) bones[child.uuid] = child;\n });\n\n // create skeletons\n\n if (json !== undefined) {\n for (var i = 0, l = json.length; i < l; i++) {\n var skeleton = new Skeleton().fromJSON(json[i], bones);\n skeletons[skeleton.uuid] = skeleton;\n }\n }\n return skeletons;\n }\n }, {\n key: \"parseGeometries\",\n value: function parseGeometries(json, shapes) {\n var geometries = {};\n if (json !== undefined) {\n var bufferGeometryLoader = new BufferGeometryLoader();\n for (var i = 0, l = json.length; i < l; i++) {\n var geometry = void 0;\n var data = json[i];\n switch (data.type) {\n case 'BufferGeometry':\n case 'InstancedBufferGeometry':\n geometry = bufferGeometryLoader.parse(data);\n break;\n default:\n if (data.type in Geometries) {\n geometry = Geometries[data.type].fromJSON(data, shapes);\n } else {\n console.warn(\"THREE.ObjectLoader: Unsupported geometry type \\\"\".concat(data.type, \"\\\"\"));\n }\n }\n geometry.uuid = data.uuid;\n if (data.name !== undefined) geometry.name = data.name;\n if (data.userData !== undefined) geometry.userData = data.userData;\n geometries[data.uuid] = geometry;\n }\n }\n return geometries;\n }\n }, {\n key: \"parseMaterials\",\n value: function parseMaterials(json, textures) {\n var cache = {}; // MultiMaterial\n var materials = {};\n if (json !== undefined) {\n var loader = new MaterialLoader();\n loader.setTextures(textures);\n for (var i = 0, l = json.length; i < l; i++) {\n var data = json[i];\n if (cache[data.uuid] === undefined) {\n cache[data.uuid] = loader.parse(data);\n }\n materials[data.uuid] = cache[data.uuid];\n }\n }\n return materials;\n }\n }, {\n key: \"parseAnimations\",\n value: function parseAnimations(json) {\n var animations = {};\n if (json !== undefined) {\n for (var i = 0; i < json.length; i++) {\n var data = json[i];\n var clip = AnimationClip.parse(data);\n animations[clip.uuid] = clip;\n }\n }\n return animations;\n }\n }, {\n key: \"parseImages\",\n value: function parseImages(json, onLoad) {\n var scope = this;\n var images = {};\n var loader;\n function loadImage(url) {\n scope.manager.itemStart(url);\n return loader.load(url, function () {\n scope.manager.itemEnd(url);\n }, undefined, function () {\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n });\n }\n function deserializeImage(image) {\n if (typeof image === 'string') {\n var url = image;\n var path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(url) ? url : scope.resourcePath + url;\n return loadImage(path);\n } else {\n if (image.data) {\n return {\n data: getTypedArray(image.type, image.data),\n width: image.width,\n height: image.height\n };\n } else {\n return null;\n }\n }\n }\n if (json !== undefined && json.length > 0) {\n var manager = new LoadingManager(onLoad);\n loader = new ImageLoader(manager);\n loader.setCrossOrigin(this.crossOrigin);\n for (var i = 0, il = json.length; i < il; i++) {\n var image = json[i];\n var url = image.url;\n if (Array.isArray(url)) {\n // load array of images e.g CubeTexture\n\n var imageArray = [];\n for (var j = 0, jl = url.length; j < jl; j++) {\n var currentUrl = url[j];\n var deserializedImage = deserializeImage(currentUrl);\n if (deserializedImage !== null) {\n if (deserializedImage instanceof HTMLImageElement) {\n imageArray.push(deserializedImage);\n } else {\n // special case: handle array of data textures for cube textures\n\n imageArray.push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height));\n }\n }\n }\n images[image.uuid] = new Source(imageArray);\n } else {\n // load single image\n\n var _deserializedImage = deserializeImage(image.url);\n images[image.uuid] = new Source(_deserializedImage);\n }\n }\n }\n return images;\n }\n }, {\n key: \"parseImagesAsync\",\n value: function () {\n var _parseImagesAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(json) {\n var scope, images, loader, deserializeImage, _deserializeImage, i, il, image, url, imageArray, j, jl, currentUrl, deserializedImage, _deserializedImage2;\n return _regeneratorRuntime().wrap(function _callee5$(_context13) {\n while (1) switch (_context13.prev = _context13.next) {\n case 0:\n _deserializeImage = function _deserializeImage3() {\n _deserializeImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(image) {\n var _url, path;\n return _regeneratorRuntime().wrap(function _callee4$(_context12) {\n while (1) switch (_context12.prev = _context12.next) {\n case 0:\n if (!(typeof image === 'string')) {\n _context12.next = 8;\n break;\n }\n _url = image;\n path = /^(\\/\\/)|([a-z]+:(\\/\\/)?)/i.test(_url) ? _url : scope.resourcePath + _url;\n _context12.next = 5;\n return loader.loadAsync(path);\n case 5:\n return _context12.abrupt(\"return\", _context12.sent);\n case 8:\n if (!image.data) {\n _context12.next = 12;\n break;\n }\n return _context12.abrupt(\"return\", {\n data: getTypedArray(image.type, image.data),\n width: image.width,\n height: image.height\n });\n case 12:\n return _context12.abrupt(\"return\", null);\n case 13:\n case \"end\":\n return _context12.stop();\n }\n }, _callee4);\n }));\n return _deserializeImage.apply(this, arguments);\n };\n deserializeImage = function _deserializeImage2(_x11) {\n return _deserializeImage.apply(this, arguments);\n };\n scope = this;\n images = {};\n if (!(json !== undefined && json.length > 0)) {\n _context13.next = 33;\n break;\n }\n loader = new ImageLoader(this.manager);\n loader.setCrossOrigin(this.crossOrigin);\n i = 0, il = json.length;\n case 8:\n if (!(i < il)) {\n _context13.next = 33;\n break;\n }\n image = json[i];\n url = image.url;\n if (!Array.isArray(url)) {\n _context13.next = 26;\n break;\n }\n // load array of images e.g CubeTexture\n imageArray = [];\n j = 0, jl = url.length;\n case 14:\n if (!(j < jl)) {\n _context13.next = 23;\n break;\n }\n currentUrl = url[j];\n _context13.next = 18;\n return deserializeImage(currentUrl);\n case 18:\n deserializedImage = _context13.sent;\n if (deserializedImage !== null) {\n if (deserializedImage instanceof HTMLImageElement) {\n imageArray.push(deserializedImage);\n } else {\n // special case: handle array of data textures for cube textures\n\n imageArray.push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height));\n }\n }\n case 20:\n j++;\n _context13.next = 14;\n break;\n case 23:\n images[image.uuid] = new Source(imageArray);\n _context13.next = 30;\n break;\n case 26:\n _context13.next = 28;\n return deserializeImage(image.url);\n case 28:\n _deserializedImage2 = _context13.sent;\n images[image.uuid] = new Source(_deserializedImage2);\n case 30:\n i++;\n _context13.next = 8;\n break;\n case 33:\n return _context13.abrupt(\"return\", images);\n case 34:\n case \"end\":\n return _context13.stop();\n }\n }, _callee5, this);\n }));\n function parseImagesAsync(_x10) {\n return _parseImagesAsync.apply(this, arguments);\n }\n return parseImagesAsync;\n }()\n }, {\n key: \"parseTextures\",\n value: function parseTextures(json, images) {\n function parseConstant(value, type) {\n if (typeof value === 'number') return value;\n console.warn('THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value);\n return type[value];\n }\n var textures = {};\n if (json !== undefined) {\n for (var i = 0, l = json.length; i < l; i++) {\n var data = json[i];\n if (data.image === undefined) {\n console.warn('THREE.ObjectLoader: No \"image\" specified for', data.uuid);\n }\n if (images[data.image] === undefined) {\n console.warn('THREE.ObjectLoader: Undefined image', data.image);\n }\n var source = images[data.image];\n var image = source.data;\n var texture = void 0;\n if (Array.isArray(image)) {\n texture = new CubeTexture();\n if (image.length === 6) texture.needsUpdate = true;\n } else {\n if (image && image.data) {\n texture = new DataTexture();\n } else {\n texture = new Texture();\n }\n if (image) texture.needsUpdate = true; // textures can have undefined image data\n }\n\n texture.source = source;\n texture.uuid = data.uuid;\n if (data.name !== undefined) texture.name = data.name;\n if (data.mapping !== undefined) texture.mapping = parseConstant(data.mapping, TEXTURE_MAPPING);\n if (data.channel !== undefined) texture.channel = data.channel;\n if (data.offset !== undefined) texture.offset.fromArray(data.offset);\n if (data.repeat !== undefined) texture.repeat.fromArray(data.repeat);\n if (data.center !== undefined) texture.center.fromArray(data.center);\n if (data.rotation !== undefined) texture.rotation = data.rotation;\n if (data.wrap !== undefined) {\n texture.wrapS = parseConstant(data.wrap[0], TEXTURE_WRAPPING);\n texture.wrapT = parseConstant(data.wrap[1], TEXTURE_WRAPPING);\n }\n if (data.format !== undefined) texture.format = data.format;\n if (data.internalFormat !== undefined) texture.internalFormat = data.internalFormat;\n if (data.type !== undefined) texture.type = data.type;\n if (data.encoding !== undefined) texture.encoding = data.encoding;\n if (data.minFilter !== undefined) texture.minFilter = parseConstant(data.minFilter, TEXTURE_FILTER);\n if (data.magFilter !== undefined) texture.magFilter = parseConstant(data.magFilter, TEXTURE_FILTER);\n if (data.anisotropy !== undefined) texture.anisotropy = data.anisotropy;\n if (data.flipY !== undefined) texture.flipY = data.flipY;\n if (data.generateMipmaps !== undefined) texture.generateMipmaps = data.generateMipmaps;\n if (data.premultiplyAlpha !== undefined) texture.premultiplyAlpha = data.premultiplyAlpha;\n if (data.unpackAlignment !== undefined) texture.unpackAlignment = data.unpackAlignment;\n if (data.userData !== undefined) texture.userData = data.userData;\n textures[data.uuid] = texture;\n }\n }\n return textures;\n }\n }, {\n key: \"parseObject\",\n value: function parseObject(data, geometries, materials, textures, animations) {\n var object;\n function getGeometry(name) {\n if (geometries[name] === undefined) {\n console.warn('THREE.ObjectLoader: Undefined geometry', name);\n }\n return geometries[name];\n }\n function getMaterial(name) {\n if (name === undefined) return undefined;\n if (Array.isArray(name)) {\n var array = [];\n for (var i = 0, l = name.length; i < l; i++) {\n var uuid = name[i];\n if (materials[uuid] === undefined) {\n console.warn('THREE.ObjectLoader: Undefined material', uuid);\n }\n array.push(materials[uuid]);\n }\n return array;\n }\n if (materials[name] === undefined) {\n console.warn('THREE.ObjectLoader: Undefined material', name);\n }\n return materials[name];\n }\n function getTexture(uuid) {\n if (textures[uuid] === undefined) {\n console.warn('THREE.ObjectLoader: Undefined texture', uuid);\n }\n return textures[uuid];\n }\n var geometry, material;\n switch (data.type) {\n case 'Scene':\n object = new Scene();\n if (data.background !== undefined) {\n if (Number.isInteger(data.background)) {\n object.background = new Color(data.background);\n } else {\n object.background = getTexture(data.background);\n }\n }\n if (data.environment !== undefined) {\n object.environment = getTexture(data.environment);\n }\n if (data.fog !== undefined) {\n if (data.fog.type === 'Fog') {\n object.fog = new Fog(data.fog.color, data.fog.near, data.fog.far);\n } else if (data.fog.type === 'FogExp2') {\n object.fog = new FogExp2(data.fog.color, data.fog.density);\n }\n }\n if (data.backgroundBlurriness !== undefined) object.backgroundBlurriness = data.backgroundBlurriness;\n if (data.backgroundIntensity !== undefined) object.backgroundIntensity = data.backgroundIntensity;\n break;\n case 'PerspectiveCamera':\n object = new PerspectiveCamera(data.fov, data.aspect, data.near, data.far);\n if (data.focus !== undefined) object.focus = data.focus;\n if (data.zoom !== undefined) object.zoom = data.zoom;\n if (data.filmGauge !== undefined) object.filmGauge = data.filmGauge;\n if (data.filmOffset !== undefined) object.filmOffset = data.filmOffset;\n if (data.view !== undefined) object.view = Object.assign({}, data.view);\n break;\n case 'OrthographicCamera':\n object = new OrthographicCamera(data.left, data.right, data.top, data.bottom, data.near, data.far);\n if (data.zoom !== undefined) object.zoom = data.zoom;\n if (data.view !== undefined) object.view = Object.assign({}, data.view);\n break;\n case 'AmbientLight':\n object = new AmbientLight(data.color, data.intensity);\n break;\n case 'DirectionalLight':\n object = new DirectionalLight(data.color, data.intensity);\n break;\n case 'PointLight':\n object = new PointLight(data.color, data.intensity, data.distance, data.decay);\n break;\n case 'RectAreaLight':\n object = new RectAreaLight(data.color, data.intensity, data.width, data.height);\n break;\n case 'SpotLight':\n object = new SpotLight(data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay);\n break;\n case 'HemisphereLight':\n object = new HemisphereLight(data.color, data.groundColor, data.intensity);\n break;\n case 'LightProbe':\n object = new LightProbe().fromJSON(data);\n break;\n case 'SkinnedMesh':\n geometry = getGeometry(data.geometry);\n material = getMaterial(data.material);\n object = new SkinnedMesh(geometry, material);\n if (data.bindMode !== undefined) object.bindMode = data.bindMode;\n if (data.bindMatrix !== undefined) object.bindMatrix.fromArray(data.bindMatrix);\n if (data.skeleton !== undefined) object.skeleton = data.skeleton;\n break;\n case 'Mesh':\n geometry = getGeometry(data.geometry);\n material = getMaterial(data.material);\n object = new Mesh(geometry, material);\n break;\n case 'InstancedMesh':\n geometry = getGeometry(data.geometry);\n material = getMaterial(data.material);\n var count = data.count;\n var instanceMatrix = data.instanceMatrix;\n var instanceColor = data.instanceColor;\n object = new InstancedMesh(geometry, material, count);\n object.instanceMatrix = new InstancedBufferAttribute(new Float32Array(instanceMatrix.array), 16);\n if (instanceColor !== undefined) object.instanceColor = new InstancedBufferAttribute(new Float32Array(instanceColor.array), instanceColor.itemSize);\n break;\n case 'LOD':\n object = new LOD();\n break;\n case 'Line':\n object = new Line(getGeometry(data.geometry), getMaterial(data.material));\n break;\n case 'LineLoop':\n object = new LineLoop(getGeometry(data.geometry), getMaterial(data.material));\n break;\n case 'LineSegments':\n object = new LineSegments(getGeometry(data.geometry), getMaterial(data.material));\n break;\n case 'PointCloud':\n case 'Points':\n object = new Points(getGeometry(data.geometry), getMaterial(data.material));\n break;\n case 'Sprite':\n object = new Sprite(getMaterial(data.material));\n break;\n case 'Group':\n object = new Group();\n break;\n case 'Bone':\n object = new Bone();\n break;\n default:\n object = new Object3D();\n }\n object.uuid = data.uuid;\n if (data.name !== undefined) object.name = data.name;\n if (data.matrix !== undefined) {\n object.matrix.fromArray(data.matrix);\n if (data.matrixAutoUpdate !== undefined) object.matrixAutoUpdate = data.matrixAutoUpdate;\n if (object.matrixAutoUpdate) object.matrix.decompose(object.position, object.quaternion, object.scale);\n } else {\n if (data.position !== undefined) object.position.fromArray(data.position);\n if (data.rotation !== undefined) object.rotation.fromArray(data.rotation);\n if (data.quaternion !== undefined) object.quaternion.fromArray(data.quaternion);\n if (data.scale !== undefined) object.scale.fromArray(data.scale);\n }\n if (data.up !== undefined) object.up.fromArray(data.up);\n if (data.castShadow !== undefined) object.castShadow = data.castShadow;\n if (data.receiveShadow !== undefined) object.receiveShadow = data.receiveShadow;\n if (data.shadow) {\n if (data.shadow.bias !== undefined) object.shadow.bias = data.shadow.bias;\n if (data.shadow.normalBias !== undefined) object.shadow.normalBias = data.shadow.normalBias;\n if (data.shadow.radius !== undefined) object.shadow.radius = data.shadow.radius;\n if (data.shadow.mapSize !== undefined) object.shadow.mapSize.fromArray(data.shadow.mapSize);\n if (data.shadow.camera !== undefined) object.shadow.camera = this.parseObject(data.shadow.camera);\n }\n if (data.visible !== undefined) object.visible = data.visible;\n if (data.frustumCulled !== undefined) object.frustumCulled = data.frustumCulled;\n if (data.renderOrder !== undefined) object.renderOrder = data.renderOrder;\n if (data.userData !== undefined) object.userData = data.userData;\n if (data.layers !== undefined) object.layers.mask = data.layers;\n if (data.children !== undefined) {\n var children = data.children;\n for (var i = 0; i < children.length; i++) {\n object.add(this.parseObject(children[i], geometries, materials, textures, animations));\n }\n }\n if (data.animations !== undefined) {\n var objectAnimations = data.animations;\n for (var _i93 = 0; _i93 < objectAnimations.length; _i93++) {\n var uuid = objectAnimations[_i93];\n object.animations.push(animations[uuid]);\n }\n }\n if (data.type === 'LOD') {\n if (data.autoUpdate !== undefined) object.autoUpdate = data.autoUpdate;\n var levels = data.levels;\n for (var l = 0; l < levels.length; l++) {\n var level = levels[l];\n var child = object.getObjectByProperty('uuid', level.object);\n if (child !== undefined) {\n object.addLevel(child, level.distance, level.hysteresis);\n }\n }\n }\n return object;\n }\n }, {\n key: \"bindSkeletons\",\n value: function bindSkeletons(object, skeletons) {\n if (Object.keys(skeletons).length === 0) return;\n object.traverse(function (child) {\n if (child.isSkinnedMesh === true && child.skeleton !== undefined) {\n var skeleton = skeletons[child.skeleton];\n if (skeleton === undefined) {\n console.warn('THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton);\n } else {\n child.bind(skeleton, child.bindMatrix);\n }\n }\n });\n }\n }]);\n return ObjectLoader;\n}(Loader);\nvar TEXTURE_MAPPING = {\n UVMapping: UVMapping,\n CubeReflectionMapping: CubeReflectionMapping,\n CubeRefractionMapping: CubeRefractionMapping,\n EquirectangularReflectionMapping: EquirectangularReflectionMapping,\n EquirectangularRefractionMapping: EquirectangularRefractionMapping,\n CubeUVReflectionMapping: CubeUVReflectionMapping\n};\nvar TEXTURE_WRAPPING = {\n RepeatWrapping: RepeatWrapping,\n ClampToEdgeWrapping: ClampToEdgeWrapping,\n MirroredRepeatWrapping: MirroredRepeatWrapping\n};\nvar TEXTURE_FILTER = {\n NearestFilter: NearestFilter,\n NearestMipmapNearestFilter: NearestMipmapNearestFilter,\n NearestMipmapLinearFilter: NearestMipmapLinearFilter,\n LinearFilter: LinearFilter,\n LinearMipmapNearestFilter: LinearMipmapNearestFilter,\n LinearMipmapLinearFilter: LinearMipmapLinearFilter\n};\nvar ImageBitmapLoader = /*#__PURE__*/function (_Loader11) {\n _inherits(ImageBitmapLoader, _Loader11);\n var _super134 = _createSuper(ImageBitmapLoader);\n function ImageBitmapLoader(manager) {\n var _this108;\n _classCallCheck(this, ImageBitmapLoader);\n _this108 = _super134.call(this, manager);\n _this108.isImageBitmapLoader = true;\n if (typeof createImageBitmap === 'undefined') {\n console.warn('THREE.ImageBitmapLoader: createImageBitmap() not supported.');\n }\n if (typeof fetch === 'undefined') {\n console.warn('THREE.ImageBitmapLoader: fetch() not supported.');\n }\n _this108.options = {\n premultiplyAlpha: 'none'\n };\n return _this108;\n }\n _createClass(ImageBitmapLoader, [{\n key: \"setOptions\",\n value: function setOptions(options) {\n this.options = options;\n return this;\n }\n }, {\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n if (url === undefined) url = '';\n if (this.path !== undefined) url = this.path + url;\n url = this.manager.resolveURL(url);\n var scope = this;\n var cached = Cache.get(url);\n if (cached !== undefined) {\n scope.manager.itemStart(url);\n setTimeout(function () {\n if (onLoad) onLoad(cached);\n scope.manager.itemEnd(url);\n }, 0);\n return cached;\n }\n var fetchOptions = {};\n fetchOptions.credentials = this.crossOrigin === 'anonymous' ? 'same-origin' : 'include';\n fetchOptions.headers = this.requestHeader;\n fetch(url, fetchOptions).then(function (res) {\n return res.blob();\n }).then(function (blob) {\n return createImageBitmap(blob, Object.assign(scope.options, {\n colorSpaceConversion: 'none'\n }));\n }).then(function (imageBitmap) {\n Cache.add(url, imageBitmap);\n if (onLoad) onLoad(imageBitmap);\n scope.manager.itemEnd(url);\n })[\"catch\"](function (e) {\n if (onError) onError(e);\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n });\n scope.manager.itemStart(url);\n }\n }]);\n return ImageBitmapLoader;\n}(Loader);\nvar _context;\nvar AudioContext = /*#__PURE__*/function () {\n function AudioContext() {\n _classCallCheck(this, AudioContext);\n }\n _createClass(AudioContext, null, [{\n key: \"getContext\",\n value: function getContext() {\n if (_context === undefined) {\n _context = new (window.AudioContext || window.webkitAudioContext)();\n }\n return _context;\n }\n }, {\n key: \"setContext\",\n value: function setContext(value) {\n _context = value;\n }\n }]);\n return AudioContext;\n}();\nvar AudioLoader = /*#__PURE__*/function (_Loader12) {\n _inherits(AudioLoader, _Loader12);\n var _super135 = _createSuper(AudioLoader);\n function AudioLoader(manager) {\n _classCallCheck(this, AudioLoader);\n return _super135.call(this, manager);\n }\n _createClass(AudioLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n var scope = this;\n var loader = new FileLoader(this.manager);\n loader.setResponseType('arraybuffer');\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function (buffer) {\n try {\n // Create a copy of the buffer. The `decodeAudioData` method\n // detaches the buffer when complete, preventing reuse.\n var bufferCopy = buffer.slice(0);\n var context = AudioContext.getContext();\n context.decodeAudioData(bufferCopy, function (audioBuffer) {\n onLoad(audioBuffer);\n });\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n }, onProgress, onError);\n }\n }]);\n return AudioLoader;\n}(Loader);\nvar HemisphereLightProbe = /*#__PURE__*/function (_LightProbe) {\n _inherits(HemisphereLightProbe, _LightProbe);\n var _super136 = _createSuper(HemisphereLightProbe);\n function HemisphereLightProbe(skyColor, groundColor) {\n var _this109;\n var intensity = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n _classCallCheck(this, HemisphereLightProbe);\n _this109 = _super136.call(this, undefined, intensity);\n _this109.isHemisphereLightProbe = true;\n var color1 = new Color().set(skyColor);\n var color2 = new Color().set(groundColor);\n var sky = new Vector3(color1.r, color1.g, color1.b);\n var ground = new Vector3(color2.r, color2.g, color2.b);\n\n // without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI );\n var c0 = Math.sqrt(Math.PI);\n var c1 = c0 * Math.sqrt(0.75);\n _this109.sh.coefficients[0].copy(sky).add(ground).multiplyScalar(c0);\n _this109.sh.coefficients[1].copy(sky).sub(ground).multiplyScalar(c1);\n return _this109;\n }\n return _createClass(HemisphereLightProbe);\n}(LightProbe);\nvar AmbientLightProbe = /*#__PURE__*/function (_LightProbe2) {\n _inherits(AmbientLightProbe, _LightProbe2);\n var _super137 = _createSuper(AmbientLightProbe);\n function AmbientLightProbe(color) {\n var _this110;\n var intensity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n _classCallCheck(this, AmbientLightProbe);\n _this110 = _super137.call(this, undefined, intensity);\n _this110.isAmbientLightProbe = true;\n var color1 = new Color().set(color);\n\n // without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI );\n _this110.sh.coefficients[0].set(color1.r, color1.g, color1.b).multiplyScalar(2 * Math.sqrt(Math.PI));\n return _this110;\n }\n return _createClass(AmbientLightProbe);\n}(LightProbe);\nvar _eyeRight = /*@__PURE__*/new Matrix4();\nvar _eyeLeft = /*@__PURE__*/new Matrix4();\nvar _projectionMatrix = /*@__PURE__*/new Matrix4();\nvar StereoCamera = /*#__PURE__*/function () {\n function StereoCamera() {\n _classCallCheck(this, StereoCamera);\n this.type = 'StereoCamera';\n this.aspect = 1;\n this.eyeSep = 0.064;\n this.cameraL = new PerspectiveCamera();\n this.cameraL.layers.enable(1);\n this.cameraL.matrixAutoUpdate = false;\n this.cameraR = new PerspectiveCamera();\n this.cameraR.layers.enable(2);\n this.cameraR.matrixAutoUpdate = false;\n this._cache = {\n focus: null,\n fov: null,\n aspect: null,\n near: null,\n far: null,\n zoom: null,\n eyeSep: null\n };\n }\n _createClass(StereoCamera, [{\n key: \"update\",\n value: function update(camera) {\n var cache = this._cache;\n var needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov || cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near || cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep;\n if (needsUpdate) {\n cache.focus = camera.focus;\n cache.fov = camera.fov;\n cache.aspect = camera.aspect * this.aspect;\n cache.near = camera.near;\n cache.far = camera.far;\n cache.zoom = camera.zoom;\n cache.eyeSep = this.eyeSep;\n\n // Off-axis stereoscopic effect based on\n // http://paulbourke.net/stereographics/stereorender/\n\n _projectionMatrix.copy(camera.projectionMatrix);\n var eyeSepHalf = cache.eyeSep / 2;\n var eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;\n var ymax = cache.near * Math.tan(DEG2RAD * cache.fov * 0.5) / cache.zoom;\n var xmin, xmax;\n\n // translate xOffset\n\n _eyeLeft.elements[12] = -eyeSepHalf;\n _eyeRight.elements[12] = eyeSepHalf;\n\n // for left eye\n\n xmin = -ymax * cache.aspect + eyeSepOnProjection;\n xmax = ymax * cache.aspect + eyeSepOnProjection;\n _projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin);\n _projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin);\n this.cameraL.projectionMatrix.copy(_projectionMatrix);\n\n // for right eye\n\n xmin = -ymax * cache.aspect - eyeSepOnProjection;\n xmax = ymax * cache.aspect - eyeSepOnProjection;\n _projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin);\n _projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin);\n this.cameraR.projectionMatrix.copy(_projectionMatrix);\n }\n this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply(_eyeLeft);\n this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply(_eyeRight);\n }\n }]);\n return StereoCamera;\n}();\nvar Clock = /*#__PURE__*/function () {\n function Clock() {\n var autoStart = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n _classCallCheck(this, Clock);\n this.autoStart = autoStart;\n this.startTime = 0;\n this.oldTime = 0;\n this.elapsedTime = 0;\n this.running = false;\n }\n _createClass(Clock, [{\n key: \"start\",\n value: function start() {\n this.startTime = now();\n this.oldTime = this.startTime;\n this.elapsedTime = 0;\n this.running = true;\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this.getElapsedTime();\n this.running = false;\n this.autoStart = false;\n }\n }, {\n key: \"getElapsedTime\",\n value: function getElapsedTime() {\n this.getDelta();\n return this.elapsedTime;\n }\n }, {\n key: \"getDelta\",\n value: function getDelta() {\n var diff = 0;\n if (this.autoStart && !this.running) {\n this.start();\n return 0;\n }\n if (this.running) {\n var newTime = now();\n diff = (newTime - this.oldTime) / 1000;\n this.oldTime = newTime;\n this.elapsedTime += diff;\n }\n return diff;\n }\n }]);\n return Clock;\n}();\nfunction now() {\n return (typeof performance === 'undefined' ? Date : performance).now(); // see #10732\n}\n\nvar _position$1 = /*@__PURE__*/new Vector3();\nvar _quaternion$1 = /*@__PURE__*/new Quaternion();\nvar _scale$1 = /*@__PURE__*/new Vector3();\nvar _orientation$1 = /*@__PURE__*/new Vector3();\nvar AudioListener = /*#__PURE__*/function (_Object3D12) {\n _inherits(AudioListener, _Object3D12);\n var _super138 = _createSuper(AudioListener);\n function AudioListener() {\n var _this111;\n _classCallCheck(this, AudioListener);\n _this111 = _super138.call(this);\n _this111.type = 'AudioListener';\n _this111.context = AudioContext.getContext();\n _this111.gain = _this111.context.createGain();\n _this111.gain.connect(_this111.context.destination);\n _this111.filter = null;\n _this111.timeDelta = 0;\n\n // private\n\n _this111._clock = new Clock();\n return _this111;\n }\n _createClass(AudioListener, [{\n key: \"getInput\",\n value: function getInput() {\n return this.gain;\n }\n }, {\n key: \"removeFilter\",\n value: function removeFilter() {\n if (this.filter !== null) {\n this.gain.disconnect(this.filter);\n this.filter.disconnect(this.context.destination);\n this.gain.connect(this.context.destination);\n this.filter = null;\n }\n return this;\n }\n }, {\n key: \"getFilter\",\n value: function getFilter() {\n return this.filter;\n }\n }, {\n key: \"setFilter\",\n value: function setFilter(value) {\n if (this.filter !== null) {\n this.gain.disconnect(this.filter);\n this.filter.disconnect(this.context.destination);\n } else {\n this.gain.disconnect(this.context.destination);\n }\n this.filter = value;\n this.gain.connect(this.filter);\n this.filter.connect(this.context.destination);\n return this;\n }\n }, {\n key: \"getMasterVolume\",\n value: function getMasterVolume() {\n return this.gain.gain.value;\n }\n }, {\n key: \"setMasterVolume\",\n value: function setMasterVolume(value) {\n this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01);\n return this;\n }\n }, {\n key: \"updateMatrixWorld\",\n value: function updateMatrixWorld(force) {\n _get(_getPrototypeOf(AudioListener.prototype), \"updateMatrixWorld\", this).call(this, force);\n var listener = this.context.listener;\n var up = this.up;\n this.timeDelta = this._clock.getDelta();\n this.matrixWorld.decompose(_position$1, _quaternion$1, _scale$1);\n _orientation$1.set(0, 0, -1).applyQuaternion(_quaternion$1);\n if (listener.positionX) {\n // code path for Chrome (see #14393)\n\n var endTime = this.context.currentTime + this.timeDelta;\n listener.positionX.linearRampToValueAtTime(_position$1.x, endTime);\n listener.positionY.linearRampToValueAtTime(_position$1.y, endTime);\n listener.positionZ.linearRampToValueAtTime(_position$1.z, endTime);\n listener.forwardX.linearRampToValueAtTime(_orientation$1.x, endTime);\n listener.forwardY.linearRampToValueAtTime(_orientation$1.y, endTime);\n listener.forwardZ.linearRampToValueAtTime(_orientation$1.z, endTime);\n listener.upX.linearRampToValueAtTime(up.x, endTime);\n listener.upY.linearRampToValueAtTime(up.y, endTime);\n listener.upZ.linearRampToValueAtTime(up.z, endTime);\n } else {\n listener.setPosition(_position$1.x, _position$1.y, _position$1.z);\n listener.setOrientation(_orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z);\n }\n }\n }]);\n return AudioListener;\n}(Object3D);\nvar Audio = /*#__PURE__*/function (_Object3D13) {\n _inherits(Audio, _Object3D13);\n var _super139 = _createSuper(Audio);\n function Audio(listener) {\n var _this112;\n _classCallCheck(this, Audio);\n _this112 = _super139.call(this);\n _this112.type = 'Audio';\n _this112.listener = listener;\n _this112.context = listener.context;\n _this112.gain = _this112.context.createGain();\n _this112.gain.connect(listener.getInput());\n _this112.autoplay = false;\n _this112.buffer = null;\n _this112.detune = 0;\n _this112.loop = false;\n _this112.loopStart = 0;\n _this112.loopEnd = 0;\n _this112.offset = 0;\n _this112.duration = undefined;\n _this112.playbackRate = 1;\n _this112.isPlaying = false;\n _this112.hasPlaybackControl = true;\n _this112.source = null;\n _this112.sourceType = 'empty';\n _this112._startedAt = 0;\n _this112._progress = 0;\n _this112._connected = false;\n _this112.filters = [];\n return _this112;\n }\n _createClass(Audio, [{\n key: \"getOutput\",\n value: function getOutput() {\n return this.gain;\n }\n }, {\n key: \"setNodeSource\",\n value: function setNodeSource(audioNode) {\n this.hasPlaybackControl = false;\n this.sourceType = 'audioNode';\n this.source = audioNode;\n this.connect();\n return this;\n }\n }, {\n key: \"setMediaElementSource\",\n value: function setMediaElementSource(mediaElement) {\n this.hasPlaybackControl = false;\n this.sourceType = 'mediaNode';\n this.source = this.context.createMediaElementSource(mediaElement);\n this.connect();\n return this;\n }\n }, {\n key: \"setMediaStreamSource\",\n value: function setMediaStreamSource(mediaStream) {\n this.hasPlaybackControl = false;\n this.sourceType = 'mediaStreamNode';\n this.source = this.context.createMediaStreamSource(mediaStream);\n this.connect();\n return this;\n }\n }, {\n key: \"setBuffer\",\n value: function setBuffer(audioBuffer) {\n this.buffer = audioBuffer;\n this.sourceType = 'buffer';\n if (this.autoplay) this.play();\n return this;\n }\n }, {\n key: \"play\",\n value: function play() {\n var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n if (this.isPlaying === true) {\n console.warn('THREE.Audio: Audio is already playing.');\n return;\n }\n if (this.hasPlaybackControl === false) {\n console.warn('THREE.Audio: this Audio has no playback control.');\n return;\n }\n this._startedAt = this.context.currentTime + delay;\n var source = this.context.createBufferSource();\n source.buffer = this.buffer;\n source.loop = this.loop;\n source.loopStart = this.loopStart;\n source.loopEnd = this.loopEnd;\n source.onended = this.onEnded.bind(this);\n source.start(this._startedAt, this._progress + this.offset, this.duration);\n this.isPlaying = true;\n this.source = source;\n this.setDetune(this.detune);\n this.setPlaybackRate(this.playbackRate);\n return this.connect();\n }\n }, {\n key: \"pause\",\n value: function pause() {\n if (this.hasPlaybackControl === false) {\n console.warn('THREE.Audio: this Audio has no playback control.');\n return;\n }\n if (this.isPlaying === true) {\n // update current progress\n\n this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate;\n if (this.loop === true) {\n // ensure _progress does not exceed duration with looped audios\n\n this._progress = this._progress % (this.duration || this.buffer.duration);\n }\n this.source.stop();\n this.source.onended = null;\n this.isPlaying = false;\n }\n return this;\n }\n }, {\n key: \"stop\",\n value: function stop() {\n if (this.hasPlaybackControl === false) {\n console.warn('THREE.Audio: this Audio has no playback control.');\n return;\n }\n this._progress = 0;\n if (this.source !== null) {\n this.source.stop();\n this.source.onended = null;\n }\n this.isPlaying = false;\n return this;\n }\n }, {\n key: \"connect\",\n value: function connect() {\n if (this.filters.length > 0) {\n this.source.connect(this.filters[0]);\n for (var i = 1, l = this.filters.length; i < l; i++) {\n this.filters[i - 1].connect(this.filters[i]);\n }\n this.filters[this.filters.length - 1].connect(this.getOutput());\n } else {\n this.source.connect(this.getOutput());\n }\n this._connected = true;\n return this;\n }\n }, {\n key: \"disconnect\",\n value: function disconnect() {\n if (this.filters.length > 0) {\n this.source.disconnect(this.filters[0]);\n for (var i = 1, l = this.filters.length; i < l; i++) {\n this.filters[i - 1].disconnect(this.filters[i]);\n }\n this.filters[this.filters.length - 1].disconnect(this.getOutput());\n } else {\n this.source.disconnect(this.getOutput());\n }\n this._connected = false;\n return this;\n }\n }, {\n key: \"getFilters\",\n value: function getFilters() {\n return this.filters;\n }\n }, {\n key: \"setFilters\",\n value: function setFilters(value) {\n if (!value) value = [];\n if (this._connected === true) {\n this.disconnect();\n this.filters = value.slice();\n this.connect();\n } else {\n this.filters = value.slice();\n }\n return this;\n }\n }, {\n key: \"setDetune\",\n value: function setDetune(value) {\n this.detune = value;\n if (this.source.detune === undefined) return; // only set detune when available\n\n if (this.isPlaying === true) {\n this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, 0.01);\n }\n return this;\n }\n }, {\n key: \"getDetune\",\n value: function getDetune() {\n return this.detune;\n }\n }, {\n key: \"getFilter\",\n value: function getFilter() {\n return this.getFilters()[0];\n }\n }, {\n key: \"setFilter\",\n value: function setFilter(filter) {\n return this.setFilters(filter ? [filter] : []);\n }\n }, {\n key: \"setPlaybackRate\",\n value: function setPlaybackRate(value) {\n if (this.hasPlaybackControl === false) {\n console.warn('THREE.Audio: this Audio has no playback control.');\n return;\n }\n this.playbackRate = value;\n if (this.isPlaying === true) {\n this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01);\n }\n return this;\n }\n }, {\n key: \"getPlaybackRate\",\n value: function getPlaybackRate() {\n return this.playbackRate;\n }\n }, {\n key: \"onEnded\",\n value: function onEnded() {\n this.isPlaying = false;\n }\n }, {\n key: \"getLoop\",\n value: function getLoop() {\n if (this.hasPlaybackControl === false) {\n console.warn('THREE.Audio: this Audio has no playback control.');\n return false;\n }\n return this.loop;\n }\n }, {\n key: \"setLoop\",\n value: function setLoop(value) {\n if (this.hasPlaybackControl === false) {\n console.warn('THREE.Audio: this Audio has no playback control.');\n return;\n }\n this.loop = value;\n if (this.isPlaying === true) {\n this.source.loop = this.loop;\n }\n return this;\n }\n }, {\n key: \"setLoopStart\",\n value: function setLoopStart(value) {\n this.loopStart = value;\n return this;\n }\n }, {\n key: \"setLoopEnd\",\n value: function setLoopEnd(value) {\n this.loopEnd = value;\n return this;\n }\n }, {\n key: \"getVolume\",\n value: function getVolume() {\n return this.gain.gain.value;\n }\n }, {\n key: \"setVolume\",\n value: function setVolume(value) {\n this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01);\n return this;\n }\n }]);\n return Audio;\n}(Object3D);\nvar _position = /*@__PURE__*/new Vector3();\nvar _quaternion = /*@__PURE__*/new Quaternion();\nvar _scale = /*@__PURE__*/new Vector3();\nvar _orientation = /*@__PURE__*/new Vector3();\nvar PositionalAudio = /*#__PURE__*/function (_Audio) {\n _inherits(PositionalAudio, _Audio);\n var _super140 = _createSuper(PositionalAudio);\n function PositionalAudio(listener) {\n var _this113;\n _classCallCheck(this, PositionalAudio);\n _this113 = _super140.call(this, listener);\n _this113.panner = _this113.context.createPanner();\n _this113.panner.panningModel = 'HRTF';\n _this113.panner.connect(_this113.gain);\n return _this113;\n }\n _createClass(PositionalAudio, [{\n key: \"disconnect\",\n value: function disconnect() {\n _get(_getPrototypeOf(PositionalAudio.prototype), \"disconnect\", this).call(this);\n this.panner.disconnect(this.gain);\n }\n }, {\n key: \"getOutput\",\n value: function getOutput() {\n return this.panner;\n }\n }, {\n key: \"getRefDistance\",\n value: function getRefDistance() {\n return this.panner.refDistance;\n }\n }, {\n key: \"setRefDistance\",\n value: function setRefDistance(value) {\n this.panner.refDistance = value;\n return this;\n }\n }, {\n key: \"getRolloffFactor\",\n value: function getRolloffFactor() {\n return this.panner.rolloffFactor;\n }\n }, {\n key: \"setRolloffFactor\",\n value: function setRolloffFactor(value) {\n this.panner.rolloffFactor = value;\n return this;\n }\n }, {\n key: \"getDistanceModel\",\n value: function getDistanceModel() {\n return this.panner.distanceModel;\n }\n }, {\n key: \"setDistanceModel\",\n value: function setDistanceModel(value) {\n this.panner.distanceModel = value;\n return this;\n }\n }, {\n key: \"getMaxDistance\",\n value: function getMaxDistance() {\n return this.panner.maxDistance;\n }\n }, {\n key: \"setMaxDistance\",\n value: function setMaxDistance(value) {\n this.panner.maxDistance = value;\n return this;\n }\n }, {\n key: \"setDirectionalCone\",\n value: function setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) {\n this.panner.coneInnerAngle = coneInnerAngle;\n this.panner.coneOuterAngle = coneOuterAngle;\n this.panner.coneOuterGain = coneOuterGain;\n return this;\n }\n }, {\n key: \"updateMatrixWorld\",\n value: function updateMatrixWorld(force) {\n _get(_getPrototypeOf(PositionalAudio.prototype), \"updateMatrixWorld\", this).call(this, force);\n if (this.hasPlaybackControl === true && this.isPlaying === false) return;\n this.matrixWorld.decompose(_position, _quaternion, _scale);\n _orientation.set(0, 0, 1).applyQuaternion(_quaternion);\n var panner = this.panner;\n if (panner.positionX) {\n // code path for Chrome and Firefox (see #14393)\n\n var endTime = this.context.currentTime + this.listener.timeDelta;\n panner.positionX.linearRampToValueAtTime(_position.x, endTime);\n panner.positionY.linearRampToValueAtTime(_position.y, endTime);\n panner.positionZ.linearRampToValueAtTime(_position.z, endTime);\n panner.orientationX.linearRampToValueAtTime(_orientation.x, endTime);\n panner.orientationY.linearRampToValueAtTime(_orientation.y, endTime);\n panner.orientationZ.linearRampToValueAtTime(_orientation.z, endTime);\n } else {\n panner.setPosition(_position.x, _position.y, _position.z);\n panner.setOrientation(_orientation.x, _orientation.y, _orientation.z);\n }\n }\n }]);\n return PositionalAudio;\n}(Audio);\nvar AudioAnalyser = /*#__PURE__*/function () {\n function AudioAnalyser(audio) {\n var fftSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2048;\n _classCallCheck(this, AudioAnalyser);\n this.analyser = audio.context.createAnalyser();\n this.analyser.fftSize = fftSize;\n this.data = new Uint8Array(this.analyser.frequencyBinCount);\n audio.getOutput().connect(this.analyser);\n }\n _createClass(AudioAnalyser, [{\n key: \"getFrequencyData\",\n value: function getFrequencyData() {\n this.analyser.getByteFrequencyData(this.data);\n return this.data;\n }\n }, {\n key: \"getAverageFrequency\",\n value: function getAverageFrequency() {\n var value = 0;\n var data = this.getFrequencyData();\n for (var i = 0; i < data.length; i++) {\n value += data[i];\n }\n return value / data.length;\n }\n }]);\n return AudioAnalyser;\n}();\nvar PropertyMixer = /*#__PURE__*/function () {\n function PropertyMixer(binding, typeName, valueSize) {\n _classCallCheck(this, PropertyMixer);\n this.binding = binding;\n this.valueSize = valueSize;\n var mixFunction, mixFunctionAdditive, setIdentity;\n\n // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ]\n //\n // interpolators can use .buffer as their .result\n // the data then goes to 'incoming'\n //\n // 'accu0' and 'accu1' are used frame-interleaved for\n // the cumulative result and are compared to detect\n // changes\n //\n // 'orig' stores the original state of the property\n //\n // 'add' is used for additive cumulative results\n //\n // 'work' is optional and is only present for quaternion types. It is used\n // to store intermediate quaternion multiplication results\n\n switch (typeName) {\n case 'quaternion':\n mixFunction = this._slerp;\n mixFunctionAdditive = this._slerpAdditive;\n setIdentity = this._setAdditiveIdentityQuaternion;\n this.buffer = new Float64Array(valueSize * 6);\n this._workIndex = 5;\n break;\n case 'string':\n case 'bool':\n mixFunction = this._select;\n\n // Use the regular mix function and for additive on these types,\n // additive is not relevant for non-numeric types\n mixFunctionAdditive = this._select;\n setIdentity = this._setAdditiveIdentityOther;\n this.buffer = new Array(valueSize * 5);\n break;\n default:\n mixFunction = this._lerp;\n mixFunctionAdditive = this._lerpAdditive;\n setIdentity = this._setAdditiveIdentityNumeric;\n this.buffer = new Float64Array(valueSize * 5);\n }\n this._mixBufferRegion = mixFunction;\n this._mixBufferRegionAdditive = mixFunctionAdditive;\n this._setIdentity = setIdentity;\n this._origIndex = 3;\n this._addIndex = 4;\n this.cumulativeWeight = 0;\n this.cumulativeWeightAdditive = 0;\n this.useCount = 0;\n this.referenceCount = 0;\n }\n\n // accumulate data in the 'incoming' region into 'accu'\n _createClass(PropertyMixer, [{\n key: \"accumulate\",\n value: function accumulate(accuIndex, weight) {\n // note: happily accumulating nothing when weight = 0, the caller knows\n // the weight and shouldn't have made the call in the first place\n\n var buffer = this.buffer,\n stride = this.valueSize,\n offset = accuIndex * stride + stride;\n var currentWeight = this.cumulativeWeight;\n if (currentWeight === 0) {\n // accuN := incoming * weight\n\n for (var i = 0; i !== stride; ++i) {\n buffer[offset + i] = buffer[i];\n }\n currentWeight = weight;\n } else {\n // accuN := accuN + incoming * weight\n\n currentWeight += weight;\n var mix = weight / currentWeight;\n this._mixBufferRegion(buffer, offset, 0, mix, stride);\n }\n this.cumulativeWeight = currentWeight;\n }\n\n // accumulate data in the 'incoming' region into 'add'\n }, {\n key: \"accumulateAdditive\",\n value: function accumulateAdditive(weight) {\n var buffer = this.buffer,\n stride = this.valueSize,\n offset = stride * this._addIndex;\n if (this.cumulativeWeightAdditive === 0) {\n // add = identity\n\n this._setIdentity();\n }\n\n // add := add + incoming * weight\n\n this._mixBufferRegionAdditive(buffer, offset, 0, weight, stride);\n this.cumulativeWeightAdditive += weight;\n }\n\n // apply the state of 'accu' to the binding when accus differ\n }, {\n key: \"apply\",\n value: function apply(accuIndex) {\n var stride = this.valueSize,\n buffer = this.buffer,\n offset = accuIndex * stride + stride,\n weight = this.cumulativeWeight,\n weightAdditive = this.cumulativeWeightAdditive,\n binding = this.binding;\n this.cumulativeWeight = 0;\n this.cumulativeWeightAdditive = 0;\n if (weight < 1) {\n // accuN := accuN + original * ( 1 - cumulativeWeight )\n\n var originalValueOffset = stride * this._origIndex;\n this._mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride);\n }\n if (weightAdditive > 0) {\n // accuN := accuN + additive accuN\n\n this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride);\n }\n for (var i = stride, e = stride + stride; i !== e; ++i) {\n if (buffer[i] !== buffer[i + stride]) {\n // value has changed -> update scene graph\n\n binding.setValue(buffer, offset);\n break;\n }\n }\n }\n\n // remember the state of the bound property and copy it to both accus\n }, {\n key: \"saveOriginalState\",\n value: function saveOriginalState() {\n var binding = this.binding;\n var buffer = this.buffer,\n stride = this.valueSize,\n originalValueOffset = stride * this._origIndex;\n binding.getValue(buffer, originalValueOffset);\n\n // accu[0..1] := orig -- initially detect changes against the original\n for (var i = stride, e = originalValueOffset; i !== e; ++i) {\n buffer[i] = buffer[originalValueOffset + i % stride];\n }\n\n // Add to identity for additive\n this._setIdentity();\n this.cumulativeWeight = 0;\n this.cumulativeWeightAdditive = 0;\n }\n\n // apply the state previously taken via 'saveOriginalState' to the binding\n }, {\n key: \"restoreOriginalState\",\n value: function restoreOriginalState() {\n var originalValueOffset = this.valueSize * 3;\n this.binding.setValue(this.buffer, originalValueOffset);\n }\n }, {\n key: \"_setAdditiveIdentityNumeric\",\n value: function _setAdditiveIdentityNumeric() {\n var startIndex = this._addIndex * this.valueSize;\n var endIndex = startIndex + this.valueSize;\n for (var i = startIndex; i < endIndex; i++) {\n this.buffer[i] = 0;\n }\n }\n }, {\n key: \"_setAdditiveIdentityQuaternion\",\n value: function _setAdditiveIdentityQuaternion() {\n this._setAdditiveIdentityNumeric();\n this.buffer[this._addIndex * this.valueSize + 3] = 1;\n }\n }, {\n key: \"_setAdditiveIdentityOther\",\n value: function _setAdditiveIdentityOther() {\n var startIndex = this._origIndex * this.valueSize;\n var targetIndex = this._addIndex * this.valueSize;\n for (var i = 0; i < this.valueSize; i++) {\n this.buffer[targetIndex + i] = this.buffer[startIndex + i];\n }\n }\n\n // mix functions\n }, {\n key: \"_select\",\n value: function _select(buffer, dstOffset, srcOffset, t, stride) {\n if (t >= 0.5) {\n for (var i = 0; i !== stride; ++i) {\n buffer[dstOffset + i] = buffer[srcOffset + i];\n }\n }\n }\n }, {\n key: \"_slerp\",\n value: function _slerp(buffer, dstOffset, srcOffset, t) {\n Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t);\n }\n }, {\n key: \"_slerpAdditive\",\n value: function _slerpAdditive(buffer, dstOffset, srcOffset, t, stride) {\n var workOffset = this._workIndex * stride;\n\n // Store result in intermediate buffer offset\n Quaternion.multiplyQuaternionsFlat(buffer, workOffset, buffer, dstOffset, buffer, srcOffset);\n\n // Slerp to the intermediate result\n Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t);\n }\n }, {\n key: \"_lerp\",\n value: function _lerp(buffer, dstOffset, srcOffset, t, stride) {\n var s = 1 - t;\n for (var i = 0; i !== stride; ++i) {\n var j = dstOffset + i;\n buffer[j] = buffer[j] * s + buffer[srcOffset + i] * t;\n }\n }\n }, {\n key: \"_lerpAdditive\",\n value: function _lerpAdditive(buffer, dstOffset, srcOffset, t, stride) {\n for (var i = 0; i !== stride; ++i) {\n var j = dstOffset + i;\n buffer[j] = buffer[j] + buffer[srcOffset + i] * t;\n }\n }\n }]);\n return PropertyMixer;\n}(); // Characters [].:/ are reserved for track binding syntax.\nvar _RESERVED_CHARS_RE = '\\\\[\\\\]\\\\.:\\\\/';\nvar _reservedRe = new RegExp('[' + _RESERVED_CHARS_RE + ']', 'g');\n\n// Attempts to allow node names from any language. ES5's `\\w` regexp matches\n// only latin characters, and the unicode \\p{L} is not yet supported. So\n// instead, we exclude reserved characters and match everything else.\nvar _wordChar = '[^' + _RESERVED_CHARS_RE + ']';\nvar _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\\\.', '') + ']';\n\n// Parent directories, delimited by '/' or ':'. Currently unused, but must\n// be matched to parse the rest of the track name.\nvar _directoryRe = /*@__PURE__*/ /((?:WC+[\\/:])*)/.source.replace('WC', _wordChar);\n\n// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.\nvar _nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot);\n\n// Object on target node, and accessor. May not contain reserved\n// characters. Accessor may contain any character except closing bracket.\nvar _objectRe = /*@__PURE__*/ /(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace('WC', _wordChar);\n\n// Property and accessor. May not contain reserved characters. Accessor may\n// contain any non-bracket characters.\nvar _propertyRe = /*@__PURE__*/ /\\.(WC+)(?:\\[(.+)\\])?/.source.replace('WC', _wordChar);\nvar _trackRe = new RegExp('' + '^' + _directoryRe + _nodeRe + _objectRe + _propertyRe + '$');\nvar _supportedObjectNames = ['material', 'materials', 'bones', 'map'];\nvar Composite = /*#__PURE__*/function () {\n function Composite(targetGroup, path, optionalParsedPath) {\n _classCallCheck(this, Composite);\n var parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path);\n this._targetGroup = targetGroup;\n this._bindings = targetGroup.subscribe_(path, parsedPath);\n }\n _createClass(Composite, [{\n key: \"getValue\",\n value: function getValue(array, offset) {\n this.bind(); // bind all binding\n\n var firstValidIndex = this._targetGroup.nCachedObjects_,\n binding = this._bindings[firstValidIndex];\n\n // and only call .getValue on the first\n if (binding !== undefined) binding.getValue(array, offset);\n }\n }, {\n key: \"setValue\",\n value: function setValue(array, offset) {\n var bindings = this._bindings;\n for (var i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) {\n bindings[i].setValue(array, offset);\n }\n }\n }, {\n key: \"bind\",\n value: function bind() {\n var bindings = this._bindings;\n for (var i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) {\n bindings[i].bind();\n }\n }\n }, {\n key: \"unbind\",\n value: function unbind() {\n var bindings = this._bindings;\n for (var i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) {\n bindings[i].unbind();\n }\n }\n }]);\n return Composite;\n}(); // Note: This class uses a State pattern on a per-method basis:\n// 'bind' sets 'this.getValue' / 'setValue' and shadows the\n// prototype version of these methods with one that represents\n// the bound state. When the property is not found, the methods\n// become no-ops.\nvar PropertyBinding = /*#__PURE__*/function () {\n function PropertyBinding(rootNode, path, parsedPath) {\n _classCallCheck(this, PropertyBinding);\n this.path = path;\n this.parsedPath = parsedPath || PropertyBinding.parseTrackName(path);\n this.node = PropertyBinding.findNode(rootNode, this.parsedPath.nodeName);\n this.rootNode = rootNode;\n\n // initial state of these methods that calls 'bind'\n this.getValue = this._getValue_unbound;\n this.setValue = this._setValue_unbound;\n }\n _createClass(PropertyBinding, [{\n key: \"_getValue_unavailable\",\n value:\n // these are used to \"bind\" a nonexistent property\n function _getValue_unavailable() {}\n }, {\n key: \"_setValue_unavailable\",\n value: function _setValue_unavailable() {}\n\n // Getters\n }, {\n key: \"_getValue_direct\",\n value: function _getValue_direct(buffer, offset) {\n buffer[offset] = this.targetObject[this.propertyName];\n }\n }, {\n key: \"_getValue_array\",\n value: function _getValue_array(buffer, offset) {\n var source = this.resolvedProperty;\n for (var i = 0, n = source.length; i !== n; ++i) {\n buffer[offset++] = source[i];\n }\n }\n }, {\n key: \"_getValue_arrayElement\",\n value: function _getValue_arrayElement(buffer, offset) {\n buffer[offset] = this.resolvedProperty[this.propertyIndex];\n }\n }, {\n key: \"_getValue_toArray\",\n value: function _getValue_toArray(buffer, offset) {\n this.resolvedProperty.toArray(buffer, offset);\n }\n\n // Direct\n }, {\n key: \"_setValue_direct\",\n value: function _setValue_direct(buffer, offset) {\n this.targetObject[this.propertyName] = buffer[offset];\n }\n }, {\n key: \"_setValue_direct_setNeedsUpdate\",\n value: function _setValue_direct_setNeedsUpdate(buffer, offset) {\n this.targetObject[this.propertyName] = buffer[offset];\n this.targetObject.needsUpdate = true;\n }\n }, {\n key: \"_setValue_direct_setMatrixWorldNeedsUpdate\",\n value: function _setValue_direct_setMatrixWorldNeedsUpdate(buffer, offset) {\n this.targetObject[this.propertyName] = buffer[offset];\n this.targetObject.matrixWorldNeedsUpdate = true;\n }\n\n // EntireArray\n }, {\n key: \"_setValue_array\",\n value: function _setValue_array(buffer, offset) {\n var dest = this.resolvedProperty;\n for (var i = 0, n = dest.length; i !== n; ++i) {\n dest[i] = buffer[offset++];\n }\n }\n }, {\n key: \"_setValue_array_setNeedsUpdate\",\n value: function _setValue_array_setNeedsUpdate(buffer, offset) {\n var dest = this.resolvedProperty;\n for (var i = 0, n = dest.length; i !== n; ++i) {\n dest[i] = buffer[offset++];\n }\n this.targetObject.needsUpdate = true;\n }\n }, {\n key: \"_setValue_array_setMatrixWorldNeedsUpdate\",\n value: function _setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) {\n var dest = this.resolvedProperty;\n for (var i = 0, n = dest.length; i !== n; ++i) {\n dest[i] = buffer[offset++];\n }\n this.targetObject.matrixWorldNeedsUpdate = true;\n }\n\n // ArrayElement\n }, {\n key: \"_setValue_arrayElement\",\n value: function _setValue_arrayElement(buffer, offset) {\n this.resolvedProperty[this.propertyIndex] = buffer[offset];\n }\n }, {\n key: \"_setValue_arrayElement_setNeedsUpdate\",\n value: function _setValue_arrayElement_setNeedsUpdate(buffer, offset) {\n this.resolvedProperty[this.propertyIndex] = buffer[offset];\n this.targetObject.needsUpdate = true;\n }\n }, {\n key: \"_setValue_arrayElement_setMatrixWorldNeedsUpdate\",\n value: function _setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer, offset) {\n this.resolvedProperty[this.propertyIndex] = buffer[offset];\n this.targetObject.matrixWorldNeedsUpdate = true;\n }\n\n // HasToFromArray\n }, {\n key: \"_setValue_fromArray\",\n value: function _setValue_fromArray(buffer, offset) {\n this.resolvedProperty.fromArray(buffer, offset);\n }\n }, {\n key: \"_setValue_fromArray_setNeedsUpdate\",\n value: function _setValue_fromArray_setNeedsUpdate(buffer, offset) {\n this.resolvedProperty.fromArray(buffer, offset);\n this.targetObject.needsUpdate = true;\n }\n }, {\n key: \"_setValue_fromArray_setMatrixWorldNeedsUpdate\",\n value: function _setValue_fromArray_setMatrixWorldNeedsUpdate(buffer, offset) {\n this.resolvedProperty.fromArray(buffer, offset);\n this.targetObject.matrixWorldNeedsUpdate = true;\n }\n }, {\n key: \"_getValue_unbound\",\n value: function _getValue_unbound(targetArray, offset) {\n this.bind();\n this.getValue(targetArray, offset);\n }\n }, {\n key: \"_setValue_unbound\",\n value: function _setValue_unbound(sourceArray, offset) {\n this.bind();\n this.setValue(sourceArray, offset);\n }\n\n // create getter / setter pair for a property in the scene graph\n }, {\n key: \"bind\",\n value: function bind() {\n var targetObject = this.node;\n var parsedPath = this.parsedPath;\n var objectName = parsedPath.objectName;\n var propertyName = parsedPath.propertyName;\n var propertyIndex = parsedPath.propertyIndex;\n if (!targetObject) {\n targetObject = PropertyBinding.findNode(this.rootNode, parsedPath.nodeName);\n this.node = targetObject;\n }\n\n // set fail state so we can just 'return' on error\n this.getValue = this._getValue_unavailable;\n this.setValue = this._setValue_unavailable;\n\n // ensure there is a value node\n if (!targetObject) {\n console.error('THREE.PropertyBinding: Trying to update node for track: ' + this.path + ' but it wasn\\'t found.');\n return;\n }\n if (objectName) {\n var objectIndex = parsedPath.objectIndex;\n\n // special cases were we need to reach deeper into the hierarchy to get the face materials....\n switch (objectName) {\n case 'materials':\n if (!targetObject.material) {\n console.error('THREE.PropertyBinding: Can not bind to material as node does not have a material.', this);\n return;\n }\n if (!targetObject.material.materials) {\n console.error('THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this);\n return;\n }\n targetObject = targetObject.material.materials;\n break;\n case 'bones':\n if (!targetObject.skeleton) {\n console.error('THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this);\n return;\n }\n\n // potential future optimization: skip this if propertyIndex is already an integer\n // and convert the integer string to a true integer.\n\n targetObject = targetObject.skeleton.bones;\n\n // support resolving morphTarget names into indices.\n for (var i = 0; i < targetObject.length; i++) {\n if (targetObject[i].name === objectIndex) {\n objectIndex = i;\n break;\n }\n }\n break;\n case 'map':\n if ('map' in targetObject) {\n targetObject = targetObject.map;\n break;\n }\n if (!targetObject.material) {\n console.error('THREE.PropertyBinding: Can not bind to material as node does not have a material.', this);\n return;\n }\n if (!targetObject.material.map) {\n console.error('THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.', this);\n return;\n }\n targetObject = targetObject.material.map;\n break;\n default:\n if (targetObject[objectName] === undefined) {\n console.error('THREE.PropertyBinding: Can not bind to objectName of node undefined.', this);\n return;\n }\n targetObject = targetObject[objectName];\n }\n if (objectIndex !== undefined) {\n if (targetObject[objectIndex] === undefined) {\n console.error('THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject);\n return;\n }\n targetObject = targetObject[objectIndex];\n }\n }\n\n // resolve property\n var nodeProperty = targetObject[propertyName];\n if (nodeProperty === undefined) {\n var nodeName = parsedPath.nodeName;\n console.error('THREE.PropertyBinding: Trying to update property for track: ' + nodeName + '.' + propertyName + ' but it wasn\\'t found.', targetObject);\n return;\n }\n\n // determine versioning scheme\n var versioning = this.Versioning.None;\n this.targetObject = targetObject;\n if (targetObject.needsUpdate !== undefined) {\n // material\n\n versioning = this.Versioning.NeedsUpdate;\n } else if (targetObject.matrixWorldNeedsUpdate !== undefined) {\n // node transform\n\n versioning = this.Versioning.MatrixWorldNeedsUpdate;\n }\n\n // determine how the property gets bound\n var bindingType = this.BindingType.Direct;\n if (propertyIndex !== undefined) {\n // access a sub element of the property array (only primitives are supported right now)\n\n if (propertyName === 'morphTargetInfluences') {\n // potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.\n\n // support resolving morphTarget names into indices.\n if (!targetObject.geometry) {\n console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this);\n return;\n }\n if (!targetObject.geometry.morphAttributes) {\n console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this);\n return;\n }\n if (targetObject.morphTargetDictionary[propertyIndex] !== undefined) {\n propertyIndex = targetObject.morphTargetDictionary[propertyIndex];\n }\n }\n bindingType = this.BindingType.ArrayElement;\n this.resolvedProperty = nodeProperty;\n this.propertyIndex = propertyIndex;\n } else if (nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined) {\n // must use copy for Object3D.Euler/Quaternion\n\n bindingType = this.BindingType.HasFromToArray;\n this.resolvedProperty = nodeProperty;\n } else if (Array.isArray(nodeProperty)) {\n bindingType = this.BindingType.EntireArray;\n this.resolvedProperty = nodeProperty;\n } else {\n this.propertyName = propertyName;\n }\n\n // select getter / setter\n this.getValue = this.GetterByBindingType[bindingType];\n this.setValue = this.SetterByBindingTypeAndVersioning[bindingType][versioning];\n }\n }, {\n key: \"unbind\",\n value: function unbind() {\n this.node = null;\n\n // back to the prototype version of getValue / setValue\n // note: avoiding to mutate the shape of 'this' via 'delete'\n this.getValue = this._getValue_unbound;\n this.setValue = this._setValue_unbound;\n }\n }], [{\n key: \"create\",\n value: function create(root, path, parsedPath) {\n if (!(root && root.isAnimationObjectGroup)) {\n return new PropertyBinding(root, path, parsedPath);\n } else {\n return new PropertyBinding.Composite(root, path, parsedPath);\n }\n }\n\n /**\n * Replaces spaces with underscores and removes unsupported characters from\n * node names, to ensure compatibility with parseTrackName().\n *\n * @param {string} name Node name to be sanitized.\n * @return {string}\n */\n }, {\n key: \"sanitizeNodeName\",\n value: function sanitizeNodeName(name) {\n return name.replace(/\\s/g, '_').replace(_reservedRe, '');\n }\n }, {\n key: \"parseTrackName\",\n value: function parseTrackName(trackName) {\n var matches = _trackRe.exec(trackName);\n if (matches === null) {\n throw new Error('PropertyBinding: Cannot parse trackName: ' + trackName);\n }\n var results = {\n // directoryName: matches[ 1 ], // (tschw) currently unused\n nodeName: matches[2],\n objectName: matches[3],\n objectIndex: matches[4],\n propertyName: matches[5],\n // required\n propertyIndex: matches[6]\n };\n var lastDot = results.nodeName && results.nodeName.lastIndexOf('.');\n if (lastDot !== undefined && lastDot !== -1) {\n var objectName = results.nodeName.substring(lastDot + 1);\n\n // Object names must be checked against an allowlist. Otherwise, there\n // is no way to parse 'foo.bar.baz': 'baz' must be a property, but\n // 'bar' could be the objectName, or part of a nodeName (which can\n // include '.' characters).\n if (_supportedObjectNames.indexOf(objectName) !== -1) {\n results.nodeName = results.nodeName.substring(0, lastDot);\n results.objectName = objectName;\n }\n }\n if (results.propertyName === null || results.propertyName.length === 0) {\n throw new Error('PropertyBinding: can not parse propertyName from trackName: ' + trackName);\n }\n return results;\n }\n }, {\n key: \"findNode\",\n value: function findNode(root, nodeName) {\n if (nodeName === undefined || nodeName === '' || nodeName === '.' || nodeName === -1 || nodeName === root.name || nodeName === root.uuid) {\n return root;\n }\n\n // search into skeleton bones.\n if (root.skeleton) {\n var bone = root.skeleton.getBoneByName(nodeName);\n if (bone !== undefined) {\n return bone;\n }\n }\n\n // search into node subtree.\n if (root.children) {\n var searchNodeSubtree = function searchNodeSubtree(children) {\n for (var i = 0; i < children.length; i++) {\n var childNode = children[i];\n if (childNode.name === nodeName || childNode.uuid === nodeName) {\n return childNode;\n }\n var result = searchNodeSubtree(childNode.children);\n if (result) return result;\n }\n return null;\n };\n var subTreeNode = searchNodeSubtree(root.children);\n if (subTreeNode) {\n return subTreeNode;\n }\n }\n return null;\n }\n }]);\n return PropertyBinding;\n}();\nPropertyBinding.Composite = Composite;\nPropertyBinding.prototype.BindingType = {\n Direct: 0,\n EntireArray: 1,\n ArrayElement: 2,\n HasFromToArray: 3\n};\nPropertyBinding.prototype.Versioning = {\n None: 0,\n NeedsUpdate: 1,\n MatrixWorldNeedsUpdate: 2\n};\nPropertyBinding.prototype.GetterByBindingType = [PropertyBinding.prototype._getValue_direct, PropertyBinding.prototype._getValue_array, PropertyBinding.prototype._getValue_arrayElement, PropertyBinding.prototype._getValue_toArray];\nPropertyBinding.prototype.SetterByBindingTypeAndVersioning = [[\n// Direct\nPropertyBinding.prototype._setValue_direct, PropertyBinding.prototype._setValue_direct_setNeedsUpdate, PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate], [\n// EntireArray\n\nPropertyBinding.prototype._setValue_array, PropertyBinding.prototype._setValue_array_setNeedsUpdate, PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate], [\n// ArrayElement\nPropertyBinding.prototype._setValue_arrayElement, PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate, PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate], [\n// HasToFromArray\nPropertyBinding.prototype._setValue_fromArray, PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate, PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];\n\n/**\n *\n * A group of objects that receives a shared animation state.\n *\n * Usage:\n *\n * - Add objects you would otherwise pass as 'root' to the\n * constructor or the .clipAction method of AnimationMixer.\n *\n * - Instead pass this object as 'root'.\n *\n * - You can also add and remove objects later when the mixer\n * is running.\n *\n * Note:\n *\n * Objects of this class appear as one object to the mixer,\n * so cache control of the individual objects must be done\n * on the group.\n *\n * Limitation:\n *\n * - The animated properties must be compatible among the\n * all objects in the group.\n *\n * - A single property can either be controlled through a\n * target group or directly, but not both.\n */\nvar AnimationObjectGroup = /*#__PURE__*/function () {\n function AnimationObjectGroup() {\n _classCallCheck(this, AnimationObjectGroup);\n this.isAnimationObjectGroup = true;\n this.uuid = generateUUID();\n\n // cached objects followed by the active ones\n this._objects = Array.prototype.slice.call(arguments);\n this.nCachedObjects_ = 0; // threshold\n // note: read by PropertyBinding.Composite\n\n var indices = {};\n this._indicesByUUID = indices; // for bookkeeping\n\n for (var i = 0, n = arguments.length; i !== n; ++i) {\n indices[arguments[i].uuid] = i;\n }\n this._paths = []; // inside: string\n this._parsedPaths = []; // inside: { we don't care, here }\n this._bindings = []; // inside: Array< PropertyBinding >\n this._bindingsIndicesByPath = {}; // inside: indices in these arrays\n\n var scope = this;\n this.stats = {\n objects: {\n get total() {\n return scope._objects.length;\n },\n get inUse() {\n return this.total - scope.nCachedObjects_;\n }\n },\n get bindingsPerObject() {\n return scope._bindings.length;\n }\n };\n }\n _createClass(AnimationObjectGroup, [{\n key: \"add\",\n value: function add() {\n var objects = this._objects,\n indicesByUUID = this._indicesByUUID,\n paths = this._paths,\n parsedPaths = this._parsedPaths,\n bindings = this._bindings,\n nBindings = bindings.length;\n var knownObject = undefined,\n nObjects = objects.length,\n nCachedObjects = this.nCachedObjects_;\n for (var i = 0, n = arguments.length; i !== n; ++i) {\n var object = arguments[i],\n uuid = object.uuid;\n var index = indicesByUUID[uuid];\n if (index === undefined) {\n // unknown object -> add it to the ACTIVE region\n\n index = nObjects++;\n indicesByUUID[uuid] = index;\n objects.push(object);\n\n // accounting is done, now do the same for all bindings\n\n for (var j = 0, m = nBindings; j !== m; ++j) {\n bindings[j].push(new PropertyBinding(object, paths[j], parsedPaths[j]));\n }\n } else if (index < nCachedObjects) {\n knownObject = objects[index];\n\n // move existing object to the ACTIVE region\n\n var firstActiveIndex = --nCachedObjects,\n lastCachedObject = objects[firstActiveIndex];\n indicesByUUID[lastCachedObject.uuid] = index;\n objects[index] = lastCachedObject;\n indicesByUUID[uuid] = firstActiveIndex;\n objects[firstActiveIndex] = object;\n\n // accounting is done, now do the same for all bindings\n\n for (var _j16 = 0, _m2 = nBindings; _j16 !== _m2; ++_j16) {\n var bindingsForPath = bindings[_j16],\n lastCached = bindingsForPath[firstActiveIndex];\n var binding = bindingsForPath[index];\n bindingsForPath[index] = lastCached;\n if (binding === undefined) {\n // since we do not bother to create new bindings\n // for objects that are cached, the binding may\n // or may not exist\n\n binding = new PropertyBinding(object, paths[_j16], parsedPaths[_j16]);\n }\n bindingsForPath[firstActiveIndex] = binding;\n }\n } else if (objects[index] !== knownObject) {\n console.error('THREE.AnimationObjectGroup: Different objects with the same UUID ' + 'detected. Clean the caches or recreate your infrastructure when reloading scenes.');\n } // else the object is already where we want it to be\n } // for arguments\n\n this.nCachedObjects_ = nCachedObjects;\n }\n }, {\n key: \"remove\",\n value: function remove() {\n var objects = this._objects,\n indicesByUUID = this._indicesByUUID,\n bindings = this._bindings,\n nBindings = bindings.length;\n var nCachedObjects = this.nCachedObjects_;\n for (var i = 0, n = arguments.length; i !== n; ++i) {\n var object = arguments[i],\n uuid = object.uuid,\n index = indicesByUUID[uuid];\n if (index !== undefined && index >= nCachedObjects) {\n // move existing object into the CACHED region\n\n var lastCachedIndex = nCachedObjects++,\n firstActiveObject = objects[lastCachedIndex];\n indicesByUUID[firstActiveObject.uuid] = index;\n objects[index] = firstActiveObject;\n indicesByUUID[uuid] = lastCachedIndex;\n objects[lastCachedIndex] = object;\n\n // accounting is done, now do the same for all bindings\n\n for (var j = 0, m = nBindings; j !== m; ++j) {\n var bindingsForPath = bindings[j],\n firstActive = bindingsForPath[lastCachedIndex],\n binding = bindingsForPath[index];\n bindingsForPath[index] = firstActive;\n bindingsForPath[lastCachedIndex] = binding;\n }\n }\n } // for arguments\n\n this.nCachedObjects_ = nCachedObjects;\n }\n\n // remove & forget\n }, {\n key: \"uncache\",\n value: function uncache() {\n var objects = this._objects,\n indicesByUUID = this._indicesByUUID,\n bindings = this._bindings,\n nBindings = bindings.length;\n var nCachedObjects = this.nCachedObjects_,\n nObjects = objects.length;\n for (var i = 0, n = arguments.length; i !== n; ++i) {\n var object = arguments[i],\n uuid = object.uuid,\n index = indicesByUUID[uuid];\n if (index !== undefined) {\n delete indicesByUUID[uuid];\n if (index < nCachedObjects) {\n // object is cached, shrink the CACHED region\n\n var firstActiveIndex = --nCachedObjects,\n lastCachedObject = objects[firstActiveIndex],\n lastIndex = --nObjects,\n lastObject = objects[lastIndex];\n\n // last cached object takes this object's place\n indicesByUUID[lastCachedObject.uuid] = index;\n objects[index] = lastCachedObject;\n\n // last object goes to the activated slot and pop\n indicesByUUID[lastObject.uuid] = firstActiveIndex;\n objects[firstActiveIndex] = lastObject;\n objects.pop();\n\n // accounting is done, now do the same for all bindings\n\n for (var j = 0, m = nBindings; j !== m; ++j) {\n var bindingsForPath = bindings[j],\n lastCached = bindingsForPath[firstActiveIndex],\n last = bindingsForPath[lastIndex];\n bindingsForPath[index] = lastCached;\n bindingsForPath[firstActiveIndex] = last;\n bindingsForPath.pop();\n }\n } else {\n // object is active, just swap with the last and pop\n\n var _lastIndex = --nObjects,\n _lastObject = objects[_lastIndex];\n if (_lastIndex > 0) {\n indicesByUUID[_lastObject.uuid] = index;\n }\n objects[index] = _lastObject;\n objects.pop();\n\n // accounting is done, now do the same for all bindings\n\n for (var _j17 = 0, _m4 = nBindings; _j17 !== _m4; ++_j17) {\n var _bindingsForPath = bindings[_j17];\n _bindingsForPath[index] = _bindingsForPath[_lastIndex];\n _bindingsForPath.pop();\n }\n } // cached or active\n } // if object is known\n } // for arguments\n\n this.nCachedObjects_ = nCachedObjects;\n }\n\n // Internal interface used by befriended PropertyBinding.Composite:\n }, {\n key: \"subscribe_\",\n value: function subscribe_(path, parsedPath) {\n // returns an array of bindings for the given path that is changed\n // according to the contained objects in the group\n\n var indicesByPath = this._bindingsIndicesByPath;\n var index = indicesByPath[path];\n var bindings = this._bindings;\n if (index !== undefined) return bindings[index];\n var paths = this._paths,\n parsedPaths = this._parsedPaths,\n objects = this._objects,\n nObjects = objects.length,\n nCachedObjects = this.nCachedObjects_,\n bindingsForPath = new Array(nObjects);\n index = bindings.length;\n indicesByPath[path] = index;\n paths.push(path);\n parsedPaths.push(parsedPath);\n bindings.push(bindingsForPath);\n for (var i = nCachedObjects, n = objects.length; i !== n; ++i) {\n var object = objects[i];\n bindingsForPath[i] = new PropertyBinding(object, path, parsedPath);\n }\n return bindingsForPath;\n }\n }, {\n key: \"unsubscribe_\",\n value: function unsubscribe_(path) {\n // tells the group to forget about a property path and no longer\n // update the array previously obtained with 'subscribe_'\n\n var indicesByPath = this._bindingsIndicesByPath,\n index = indicesByPath[path];\n if (index !== undefined) {\n var paths = this._paths,\n parsedPaths = this._parsedPaths,\n bindings = this._bindings,\n lastBindingsIndex = bindings.length - 1,\n lastBindings = bindings[lastBindingsIndex],\n lastBindingsPath = path[lastBindingsIndex];\n indicesByPath[lastBindingsPath] = index;\n bindings[index] = lastBindings;\n bindings.pop();\n parsedPaths[index] = parsedPaths[lastBindingsIndex];\n parsedPaths.pop();\n paths[index] = paths[lastBindingsIndex];\n paths.pop();\n }\n }\n }]);\n return AnimationObjectGroup;\n}();\nvar AnimationAction = /*#__PURE__*/function () {\n function AnimationAction(mixer, clip) {\n var localRoot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n var blendMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : clip.blendMode;\n _classCallCheck(this, AnimationAction);\n this._mixer = mixer;\n this._clip = clip;\n this._localRoot = localRoot;\n this.blendMode = blendMode;\n var tracks = clip.tracks,\n nTracks = tracks.length,\n interpolants = new Array(nTracks);\n var interpolantSettings = {\n endingStart: ZeroCurvatureEnding,\n endingEnd: ZeroCurvatureEnding\n };\n for (var i = 0; i !== nTracks; ++i) {\n var interpolant = tracks[i].createInterpolant(null);\n interpolants[i] = interpolant;\n interpolant.settings = interpolantSettings;\n }\n this._interpolantSettings = interpolantSettings;\n this._interpolants = interpolants; // bound by the mixer\n\n // inside: PropertyMixer (managed by the mixer)\n this._propertyBindings = new Array(nTracks);\n this._cacheIndex = null; // for the memory manager\n this._byClipCacheIndex = null; // for the memory manager\n\n this._timeScaleInterpolant = null;\n this._weightInterpolant = null;\n this.loop = LoopRepeat;\n this._loopCount = -1;\n\n // global mixer time when the action is to be started\n // it's set back to 'null' upon start of the action\n this._startTime = null;\n\n // scaled local time of the action\n // gets clamped or wrapped to 0..clip.duration according to loop\n this.time = 0;\n this.timeScale = 1;\n this._effectiveTimeScale = 1;\n this.weight = 1;\n this._effectiveWeight = 1;\n this.repetitions = Infinity; // no. of repetitions when looping\n\n this.paused = false; // true -> zero effective time scale\n this.enabled = true; // false -> zero effective weight\n\n this.clampWhenFinished = false; // keep feeding the last frame?\n\n this.zeroSlopeAtStart = true; // for smooth interpolation w/o separate\n this.zeroSlopeAtEnd = true; // clips for start, loop and end\n }\n\n // State & Scheduling\n _createClass(AnimationAction, [{\n key: \"play\",\n value: function play() {\n this._mixer._activateAction(this);\n return this;\n }\n }, {\n key: \"stop\",\n value: function stop() {\n this._mixer._deactivateAction(this);\n return this.reset();\n }\n }, {\n key: \"reset\",\n value: function reset() {\n this.paused = false;\n this.enabled = true;\n this.time = 0; // restart clip\n this._loopCount = -1; // forget previous loops\n this._startTime = null; // forget scheduling\n\n return this.stopFading().stopWarping();\n }\n }, {\n key: \"isRunning\",\n value: function isRunning() {\n return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this);\n }\n\n // return true when play has been called\n }, {\n key: \"isScheduled\",\n value: function isScheduled() {\n return this._mixer._isActiveAction(this);\n }\n }, {\n key: \"startAt\",\n value: function startAt(time) {\n this._startTime = time;\n return this;\n }\n }, {\n key: \"setLoop\",\n value: function setLoop(mode, repetitions) {\n this.loop = mode;\n this.repetitions = repetitions;\n return this;\n }\n\n // Weight\n\n // set the weight stopping any scheduled fading\n // although .enabled = false yields an effective weight of zero, this\n // method does *not* change .enabled, because it would be confusing\n }, {\n key: \"setEffectiveWeight\",\n value: function setEffectiveWeight(weight) {\n this.weight = weight;\n\n // note: same logic as when updated at runtime\n this._effectiveWeight = this.enabled ? weight : 0;\n return this.stopFading();\n }\n\n // return the weight considering fading and .enabled\n }, {\n key: \"getEffectiveWeight\",\n value: function getEffectiveWeight() {\n return this._effectiveWeight;\n }\n }, {\n key: \"fadeIn\",\n value: function fadeIn(duration) {\n return this._scheduleFading(duration, 0, 1);\n }\n }, {\n key: \"fadeOut\",\n value: function fadeOut(duration) {\n return this._scheduleFading(duration, 1, 0);\n }\n }, {\n key: \"crossFadeFrom\",\n value: function crossFadeFrom(fadeOutAction, duration, warp) {\n fadeOutAction.fadeOut(duration);\n this.fadeIn(duration);\n if (warp) {\n var fadeInDuration = this._clip.duration,\n fadeOutDuration = fadeOutAction._clip.duration,\n startEndRatio = fadeOutDuration / fadeInDuration,\n endStartRatio = fadeInDuration / fadeOutDuration;\n fadeOutAction.warp(1.0, startEndRatio, duration);\n this.warp(endStartRatio, 1.0, duration);\n }\n return this;\n }\n }, {\n key: \"crossFadeTo\",\n value: function crossFadeTo(fadeInAction, duration, warp) {\n return fadeInAction.crossFadeFrom(this, duration, warp);\n }\n }, {\n key: \"stopFading\",\n value: function stopFading() {\n var weightInterpolant = this._weightInterpolant;\n if (weightInterpolant !== null) {\n this._weightInterpolant = null;\n this._mixer._takeBackControlInterpolant(weightInterpolant);\n }\n return this;\n }\n\n // Time Scale Control\n\n // set the time scale stopping any scheduled warping\n // although .paused = true yields an effective time scale of zero, this\n // method does *not* change .paused, because it would be confusing\n }, {\n key: \"setEffectiveTimeScale\",\n value: function setEffectiveTimeScale(timeScale) {\n this.timeScale = timeScale;\n this._effectiveTimeScale = this.paused ? 0 : timeScale;\n return this.stopWarping();\n }\n\n // return the time scale considering warping and .paused\n }, {\n key: \"getEffectiveTimeScale\",\n value: function getEffectiveTimeScale() {\n return this._effectiveTimeScale;\n }\n }, {\n key: \"setDuration\",\n value: function setDuration(duration) {\n this.timeScale = this._clip.duration / duration;\n return this.stopWarping();\n }\n }, {\n key: \"syncWith\",\n value: function syncWith(action) {\n this.time = action.time;\n this.timeScale = action.timeScale;\n return this.stopWarping();\n }\n }, {\n key: \"halt\",\n value: function halt(duration) {\n return this.warp(this._effectiveTimeScale, 0, duration);\n }\n }, {\n key: \"warp\",\n value: function warp(startTimeScale, endTimeScale, duration) {\n var mixer = this._mixer,\n now = mixer.time,\n timeScale = this.timeScale;\n var interpolant = this._timeScaleInterpolant;\n if (interpolant === null) {\n interpolant = mixer._lendControlInterpolant();\n this._timeScaleInterpolant = interpolant;\n }\n var times = interpolant.parameterPositions,\n values = interpolant.sampleValues;\n times[0] = now;\n times[1] = now + duration;\n values[0] = startTimeScale / timeScale;\n values[1] = endTimeScale / timeScale;\n return this;\n }\n }, {\n key: \"stopWarping\",\n value: function stopWarping() {\n var timeScaleInterpolant = this._timeScaleInterpolant;\n if (timeScaleInterpolant !== null) {\n this._timeScaleInterpolant = null;\n this._mixer._takeBackControlInterpolant(timeScaleInterpolant);\n }\n return this;\n }\n\n // Object Accessors\n }, {\n key: \"getMixer\",\n value: function getMixer() {\n return this._mixer;\n }\n }, {\n key: \"getClip\",\n value: function getClip() {\n return this._clip;\n }\n }, {\n key: \"getRoot\",\n value: function getRoot() {\n return this._localRoot || this._mixer._root;\n }\n\n // Interna\n }, {\n key: \"_update\",\n value: function _update(time, deltaTime, timeDirection, accuIndex) {\n // called by the mixer\n\n if (!this.enabled) {\n // call ._updateWeight() to update ._effectiveWeight\n\n this._updateWeight(time);\n return;\n }\n var startTime = this._startTime;\n if (startTime !== null) {\n // check for scheduled start of action\n\n var timeRunning = (time - startTime) * timeDirection;\n if (timeRunning < 0 || timeDirection === 0) {\n deltaTime = 0;\n } else {\n this._startTime = null; // unschedule\n deltaTime = timeDirection * timeRunning;\n }\n }\n\n // apply time scale and advance time\n\n deltaTime *= this._updateTimeScale(time);\n var clipTime = this._updateTime(deltaTime);\n\n // note: _updateTime may disable the action resulting in\n // an effective weight of 0\n\n var weight = this._updateWeight(time);\n if (weight > 0) {\n var interpolants = this._interpolants;\n var propertyMixers = this._propertyBindings;\n switch (this.blendMode) {\n case AdditiveAnimationBlendMode:\n for (var j = 0, m = interpolants.length; j !== m; ++j) {\n interpolants[j].evaluate(clipTime);\n propertyMixers[j].accumulateAdditive(weight);\n }\n break;\n case NormalAnimationBlendMode:\n default:\n for (var _j18 = 0, _m5 = interpolants.length; _j18 !== _m5; ++_j18) {\n interpolants[_j18].evaluate(clipTime);\n propertyMixers[_j18].accumulate(accuIndex, weight);\n }\n }\n }\n }\n }, {\n key: \"_updateWeight\",\n value: function _updateWeight(time) {\n var weight = 0;\n if (this.enabled) {\n weight = this.weight;\n var interpolant = this._weightInterpolant;\n if (interpolant !== null) {\n var interpolantValue = interpolant.evaluate(time)[0];\n weight *= interpolantValue;\n if (time > interpolant.parameterPositions[1]) {\n this.stopFading();\n if (interpolantValue === 0) {\n // faded out, disable\n this.enabled = false;\n }\n }\n }\n }\n this._effectiveWeight = weight;\n return weight;\n }\n }, {\n key: \"_updateTimeScale\",\n value: function _updateTimeScale(time) {\n var timeScale = 0;\n if (!this.paused) {\n timeScale = this.timeScale;\n var interpolant = this._timeScaleInterpolant;\n if (interpolant !== null) {\n var interpolantValue = interpolant.evaluate(time)[0];\n timeScale *= interpolantValue;\n if (time > interpolant.parameterPositions[1]) {\n this.stopWarping();\n if (timeScale === 0) {\n // motion has halted, pause\n this.paused = true;\n } else {\n // warp done - apply final time scale\n this.timeScale = timeScale;\n }\n }\n }\n }\n this._effectiveTimeScale = timeScale;\n return timeScale;\n }\n }, {\n key: \"_updateTime\",\n value: function _updateTime(deltaTime) {\n var duration = this._clip.duration;\n var loop = this.loop;\n var time = this.time + deltaTime;\n var loopCount = this._loopCount;\n var pingPong = loop === LoopPingPong;\n if (deltaTime === 0) {\n if (loopCount === -1) return time;\n return pingPong && (loopCount & 1) === 1 ? duration - time : time;\n }\n if (loop === LoopOnce) {\n if (loopCount === -1) {\n // just started\n\n this._loopCount = 0;\n this._setEndings(true, true, false);\n }\n handle_stop: {\n if (time >= duration) {\n time = duration;\n } else if (time < 0) {\n time = 0;\n } else {\n this.time = time;\n break handle_stop;\n }\n if (this.clampWhenFinished) this.paused = true;else this.enabled = false;\n this.time = time;\n this._mixer.dispatchEvent({\n type: 'finished',\n action: this,\n direction: deltaTime < 0 ? -1 : 1\n });\n }\n } else {\n // repetitive Repeat or PingPong\n\n if (loopCount === -1) {\n // just started\n\n if (deltaTime >= 0) {\n loopCount = 0;\n this._setEndings(true, this.repetitions === 0, pingPong);\n } else {\n // when looping in reverse direction, the initial\n // transition through zero counts as a repetition,\n // so leave loopCount at -1\n\n this._setEndings(this.repetitions === 0, true, pingPong);\n }\n }\n if (time >= duration || time < 0) {\n // wrap around\n\n var loopDelta = Math.floor(time / duration); // signed\n time -= duration * loopDelta;\n loopCount += Math.abs(loopDelta);\n var pending = this.repetitions - loopCount;\n if (pending <= 0) {\n // have to stop (switch state, clamp time, fire event)\n\n if (this.clampWhenFinished) this.paused = true;else this.enabled = false;\n time = deltaTime > 0 ? duration : 0;\n this.time = time;\n this._mixer.dispatchEvent({\n type: 'finished',\n action: this,\n direction: deltaTime > 0 ? 1 : -1\n });\n } else {\n // keep running\n\n if (pending === 1) {\n // entering the last round\n\n var atStart = deltaTime < 0;\n this._setEndings(atStart, !atStart, pingPong);\n } else {\n this._setEndings(false, false, pingPong);\n }\n this._loopCount = loopCount;\n this.time = time;\n this._mixer.dispatchEvent({\n type: 'loop',\n action: this,\n loopDelta: loopDelta\n });\n }\n } else {\n this.time = time;\n }\n if (pingPong && (loopCount & 1) === 1) {\n // invert time for the \"pong round\"\n\n return duration - time;\n }\n }\n return time;\n }\n }, {\n key: \"_setEndings\",\n value: function _setEndings(atStart, atEnd, pingPong) {\n var settings = this._interpolantSettings;\n if (pingPong) {\n settings.endingStart = ZeroSlopeEnding;\n settings.endingEnd = ZeroSlopeEnding;\n } else {\n // assuming for LoopOnce atStart == atEnd == true\n\n if (atStart) {\n settings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding;\n } else {\n settings.endingStart = WrapAroundEnding;\n }\n if (atEnd) {\n settings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding;\n } else {\n settings.endingEnd = WrapAroundEnding;\n }\n }\n }\n }, {\n key: \"_scheduleFading\",\n value: function _scheduleFading(duration, weightNow, weightThen) {\n var mixer = this._mixer,\n now = mixer.time;\n var interpolant = this._weightInterpolant;\n if (interpolant === null) {\n interpolant = mixer._lendControlInterpolant();\n this._weightInterpolant = interpolant;\n }\n var times = interpolant.parameterPositions,\n values = interpolant.sampleValues;\n times[0] = now;\n values[0] = weightNow;\n times[1] = now + duration;\n values[1] = weightThen;\n return this;\n }\n }]);\n return AnimationAction;\n}();\nvar _controlInterpolantsResultBuffer = new Float32Array(1);\nvar AnimationMixer = /*#__PURE__*/function (_EventDispatcher7) {\n _inherits(AnimationMixer, _EventDispatcher7);\n var _super141 = _createSuper(AnimationMixer);\n function AnimationMixer(root) {\n var _this114;\n _classCallCheck(this, AnimationMixer);\n _this114 = _super141.call(this);\n _this114._root = root;\n _this114._initMemoryManager();\n _this114._accuIndex = 0;\n _this114.time = 0;\n _this114.timeScale = 1.0;\n return _this114;\n }\n _createClass(AnimationMixer, [{\n key: \"_bindAction\",\n value: function _bindAction(action, prototypeAction) {\n var root = action._localRoot || this._root,\n tracks = action._clip.tracks,\n nTracks = tracks.length,\n bindings = action._propertyBindings,\n interpolants = action._interpolants,\n rootUuid = root.uuid,\n bindingsByRoot = this._bindingsByRootAndName;\n var bindingsByName = bindingsByRoot[rootUuid];\n if (bindingsByName === undefined) {\n bindingsByName = {};\n bindingsByRoot[rootUuid] = bindingsByName;\n }\n for (var i = 0; i !== nTracks; ++i) {\n var track = tracks[i],\n trackName = track.name;\n var binding = bindingsByName[trackName];\n if (binding !== undefined) {\n ++binding.referenceCount;\n bindings[i] = binding;\n } else {\n binding = bindings[i];\n if (binding !== undefined) {\n // existing binding, make sure the cache knows\n\n if (binding._cacheIndex === null) {\n ++binding.referenceCount;\n this._addInactiveBinding(binding, rootUuid, trackName);\n }\n continue;\n }\n var path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath;\n binding = new PropertyMixer(PropertyBinding.create(root, trackName, path), track.ValueTypeName, track.getValueSize());\n ++binding.referenceCount;\n this._addInactiveBinding(binding, rootUuid, trackName);\n bindings[i] = binding;\n }\n interpolants[i].resultBuffer = binding.buffer;\n }\n }\n }, {\n key: \"_activateAction\",\n value: function _activateAction(action) {\n if (!this._isActiveAction(action)) {\n if (action._cacheIndex === null) {\n // this action has been forgotten by the cache, but the user\n // appears to be still using it -> rebind\n\n var rootUuid = (action._localRoot || this._root).uuid,\n clipUuid = action._clip.uuid,\n actionsForClip = this._actionsByClip[clipUuid];\n this._bindAction(action, actionsForClip && actionsForClip.knownActions[0]);\n this._addInactiveAction(action, clipUuid, rootUuid);\n }\n var bindings = action._propertyBindings;\n\n // increment reference counts / sort out state\n for (var i = 0, n = bindings.length; i !== n; ++i) {\n var binding = bindings[i];\n if (binding.useCount++ === 0) {\n this._lendBinding(binding);\n binding.saveOriginalState();\n }\n }\n this._lendAction(action);\n }\n }\n }, {\n key: \"_deactivateAction\",\n value: function _deactivateAction(action) {\n if (this._isActiveAction(action)) {\n var bindings = action._propertyBindings;\n\n // decrement reference counts / sort out state\n for (var i = 0, n = bindings.length; i !== n; ++i) {\n var binding = bindings[i];\n if (--binding.useCount === 0) {\n binding.restoreOriginalState();\n this._takeBackBinding(binding);\n }\n }\n this._takeBackAction(action);\n }\n }\n\n // Memory manager\n }, {\n key: \"_initMemoryManager\",\n value: function _initMemoryManager() {\n this._actions = []; // 'nActiveActions' followed by inactive ones\n this._nActiveActions = 0;\n this._actionsByClip = {};\n // inside:\n // {\n // \tknownActions: Array< AnimationAction > - used as prototypes\n // \tactionByRoot: AnimationAction - lookup\n // }\n\n this._bindings = []; // 'nActiveBindings' followed by inactive ones\n this._nActiveBindings = 0;\n this._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer >\n\n this._controlInterpolants = []; // same game as above\n this._nActiveControlInterpolants = 0;\n var scope = this;\n this.stats = {\n actions: {\n get total() {\n return scope._actions.length;\n },\n get inUse() {\n return scope._nActiveActions;\n }\n },\n bindings: {\n get total() {\n return scope._bindings.length;\n },\n get inUse() {\n return scope._nActiveBindings;\n }\n },\n controlInterpolants: {\n get total() {\n return scope._controlInterpolants.length;\n },\n get inUse() {\n return scope._nActiveControlInterpolants;\n }\n }\n };\n }\n\n // Memory management for AnimationAction objects\n }, {\n key: \"_isActiveAction\",\n value: function _isActiveAction(action) {\n var index = action._cacheIndex;\n return index !== null && index < this._nActiveActions;\n }\n }, {\n key: \"_addInactiveAction\",\n value: function _addInactiveAction(action, clipUuid, rootUuid) {\n var actions = this._actions,\n actionsByClip = this._actionsByClip;\n var actionsForClip = actionsByClip[clipUuid];\n if (actionsForClip === undefined) {\n actionsForClip = {\n knownActions: [action],\n actionByRoot: {}\n };\n action._byClipCacheIndex = 0;\n actionsByClip[clipUuid] = actionsForClip;\n } else {\n var knownActions = actionsForClip.knownActions;\n action._byClipCacheIndex = knownActions.length;\n knownActions.push(action);\n }\n action._cacheIndex = actions.length;\n actions.push(action);\n actionsForClip.actionByRoot[rootUuid] = action;\n }\n }, {\n key: \"_removeInactiveAction\",\n value: function _removeInactiveAction(action) {\n var actions = this._actions,\n lastInactiveAction = actions[actions.length - 1],\n cacheIndex = action._cacheIndex;\n lastInactiveAction._cacheIndex = cacheIndex;\n actions[cacheIndex] = lastInactiveAction;\n actions.pop();\n action._cacheIndex = null;\n var clipUuid = action._clip.uuid,\n actionsByClip = this._actionsByClip,\n actionsForClip = actionsByClip[clipUuid],\n knownActionsForClip = actionsForClip.knownActions,\n lastKnownAction = knownActionsForClip[knownActionsForClip.length - 1],\n byClipCacheIndex = action._byClipCacheIndex;\n lastKnownAction._byClipCacheIndex = byClipCacheIndex;\n knownActionsForClip[byClipCacheIndex] = lastKnownAction;\n knownActionsForClip.pop();\n action._byClipCacheIndex = null;\n var actionByRoot = actionsForClip.actionByRoot,\n rootUuid = (action._localRoot || this._root).uuid;\n delete actionByRoot[rootUuid];\n if (knownActionsForClip.length === 0) {\n delete actionsByClip[clipUuid];\n }\n this._removeInactiveBindingsForAction(action);\n }\n }, {\n key: \"_removeInactiveBindingsForAction\",\n value: function _removeInactiveBindingsForAction(action) {\n var bindings = action._propertyBindings;\n for (var i = 0, n = bindings.length; i !== n; ++i) {\n var binding = bindings[i];\n if (--binding.referenceCount === 0) {\n this._removeInactiveBinding(binding);\n }\n }\n }\n }, {\n key: \"_lendAction\",\n value: function _lendAction(action) {\n // [ active actions | inactive actions ]\n // [ active actions >| inactive actions ]\n // s a\n // <-swap->\n // a s\n\n var actions = this._actions,\n prevIndex = action._cacheIndex,\n lastActiveIndex = this._nActiveActions++,\n firstInactiveAction = actions[lastActiveIndex];\n action._cacheIndex = lastActiveIndex;\n actions[lastActiveIndex] = action;\n firstInactiveAction._cacheIndex = prevIndex;\n actions[prevIndex] = firstInactiveAction;\n }\n }, {\n key: \"_takeBackAction\",\n value: function _takeBackAction(action) {\n // [ active actions | inactive actions ]\n // [ active actions |< inactive actions ]\n // a s\n // <-swap->\n // s a\n\n var actions = this._actions,\n prevIndex = action._cacheIndex,\n firstInactiveIndex = --this._nActiveActions,\n lastActiveAction = actions[firstInactiveIndex];\n action._cacheIndex = firstInactiveIndex;\n actions[firstInactiveIndex] = action;\n lastActiveAction._cacheIndex = prevIndex;\n actions[prevIndex] = lastActiveAction;\n }\n\n // Memory management for PropertyMixer objects\n }, {\n key: \"_addInactiveBinding\",\n value: function _addInactiveBinding(binding, rootUuid, trackName) {\n var bindingsByRoot = this._bindingsByRootAndName,\n bindings = this._bindings;\n var bindingByName = bindingsByRoot[rootUuid];\n if (bindingByName === undefined) {\n bindingByName = {};\n bindingsByRoot[rootUuid] = bindingByName;\n }\n bindingByName[trackName] = binding;\n binding._cacheIndex = bindings.length;\n bindings.push(binding);\n }\n }, {\n key: \"_removeInactiveBinding\",\n value: function _removeInactiveBinding(binding) {\n var bindings = this._bindings,\n propBinding = binding.binding,\n rootUuid = propBinding.rootNode.uuid,\n trackName = propBinding.path,\n bindingsByRoot = this._bindingsByRootAndName,\n bindingByName = bindingsByRoot[rootUuid],\n lastInactiveBinding = bindings[bindings.length - 1],\n cacheIndex = binding._cacheIndex;\n lastInactiveBinding._cacheIndex = cacheIndex;\n bindings[cacheIndex] = lastInactiveBinding;\n bindings.pop();\n delete bindingByName[trackName];\n if (Object.keys(bindingByName).length === 0) {\n delete bindingsByRoot[rootUuid];\n }\n }\n }, {\n key: \"_lendBinding\",\n value: function _lendBinding(binding) {\n var bindings = this._bindings,\n prevIndex = binding._cacheIndex,\n lastActiveIndex = this._nActiveBindings++,\n firstInactiveBinding = bindings[lastActiveIndex];\n binding._cacheIndex = lastActiveIndex;\n bindings[lastActiveIndex] = binding;\n firstInactiveBinding._cacheIndex = prevIndex;\n bindings[prevIndex] = firstInactiveBinding;\n }\n }, {\n key: \"_takeBackBinding\",\n value: function _takeBackBinding(binding) {\n var bindings = this._bindings,\n prevIndex = binding._cacheIndex,\n firstInactiveIndex = --this._nActiveBindings,\n lastActiveBinding = bindings[firstInactiveIndex];\n binding._cacheIndex = firstInactiveIndex;\n bindings[firstInactiveIndex] = binding;\n lastActiveBinding._cacheIndex = prevIndex;\n bindings[prevIndex] = lastActiveBinding;\n }\n\n // Memory management of Interpolants for weight and time scale\n }, {\n key: \"_lendControlInterpolant\",\n value: function _lendControlInterpolant() {\n var interpolants = this._controlInterpolants,\n lastActiveIndex = this._nActiveControlInterpolants++;\n var interpolant = interpolants[lastActiveIndex];\n if (interpolant === undefined) {\n interpolant = new LinearInterpolant(new Float32Array(2), new Float32Array(2), 1, _controlInterpolantsResultBuffer);\n interpolant.__cacheIndex = lastActiveIndex;\n interpolants[lastActiveIndex] = interpolant;\n }\n return interpolant;\n }\n }, {\n key: \"_takeBackControlInterpolant\",\n value: function _takeBackControlInterpolant(interpolant) {\n var interpolants = this._controlInterpolants,\n prevIndex = interpolant.__cacheIndex,\n firstInactiveIndex = --this._nActiveControlInterpolants,\n lastActiveInterpolant = interpolants[firstInactiveIndex];\n interpolant.__cacheIndex = firstInactiveIndex;\n interpolants[firstInactiveIndex] = interpolant;\n lastActiveInterpolant.__cacheIndex = prevIndex;\n interpolants[prevIndex] = lastActiveInterpolant;\n }\n\n // return an action for a clip optionally using a custom root target\n // object (this method allocates a lot of dynamic memory in case a\n // previously unknown clip/root combination is specified)\n }, {\n key: \"clipAction\",\n value: function clipAction(clip, optionalRoot, blendMode) {\n var root = optionalRoot || this._root,\n rootUuid = root.uuid;\n var clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip;\n var clipUuid = clipObject !== null ? clipObject.uuid : clip;\n var actionsForClip = this._actionsByClip[clipUuid];\n var prototypeAction = null;\n if (blendMode === undefined) {\n if (clipObject !== null) {\n blendMode = clipObject.blendMode;\n } else {\n blendMode = NormalAnimationBlendMode;\n }\n }\n if (actionsForClip !== undefined) {\n var existingAction = actionsForClip.actionByRoot[rootUuid];\n if (existingAction !== undefined && existingAction.blendMode === blendMode) {\n return existingAction;\n }\n\n // we know the clip, so we don't have to parse all\n // the bindings again but can just copy\n prototypeAction = actionsForClip.knownActions[0];\n\n // also, take the clip from the prototype action\n if (clipObject === null) clipObject = prototypeAction._clip;\n }\n\n // clip must be known when specified via string\n if (clipObject === null) return null;\n\n // allocate all resources required to run it\n var newAction = new AnimationAction(this, clipObject, optionalRoot, blendMode);\n this._bindAction(newAction, prototypeAction);\n\n // and make the action known to the memory manager\n this._addInactiveAction(newAction, clipUuid, rootUuid);\n return newAction;\n }\n\n // get an existing action\n }, {\n key: \"existingAction\",\n value: function existingAction(clip, optionalRoot) {\n var root = optionalRoot || this._root,\n rootUuid = root.uuid,\n clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip,\n clipUuid = clipObject ? clipObject.uuid : clip,\n actionsForClip = this._actionsByClip[clipUuid];\n if (actionsForClip !== undefined) {\n return actionsForClip.actionByRoot[rootUuid] || null;\n }\n return null;\n }\n\n // deactivates all previously scheduled actions\n }, {\n key: \"stopAllAction\",\n value: function stopAllAction() {\n var actions = this._actions,\n nActions = this._nActiveActions;\n for (var i = nActions - 1; i >= 0; --i) {\n actions[i].stop();\n }\n return this;\n }\n\n // advance the time and update apply the animation\n }, {\n key: \"update\",\n value: function update(deltaTime) {\n deltaTime *= this.timeScale;\n var actions = this._actions,\n nActions = this._nActiveActions,\n time = this.time += deltaTime,\n timeDirection = Math.sign(deltaTime),\n accuIndex = this._accuIndex ^= 1;\n\n // run active actions\n\n for (var i = 0; i !== nActions; ++i) {\n var action = actions[i];\n action._update(time, deltaTime, timeDirection, accuIndex);\n }\n\n // update scene graph\n\n var bindings = this._bindings,\n nBindings = this._nActiveBindings;\n for (var _i94 = 0; _i94 !== nBindings; ++_i94) {\n bindings[_i94].apply(accuIndex);\n }\n return this;\n }\n\n // Allows you to seek to a specific time in an animation.\n }, {\n key: \"setTime\",\n value: function setTime(timeInSeconds) {\n this.time = 0; // Zero out time attribute for AnimationMixer object;\n for (var i = 0; i < this._actions.length; i++) {\n this._actions[i].time = 0; // Zero out time attribute for all associated AnimationAction objects.\n }\n\n return this.update(timeInSeconds); // Update used to set exact time. Returns \"this\" AnimationMixer object.\n }\n\n // return this mixer's root target object\n }, {\n key: \"getRoot\",\n value: function getRoot() {\n return this._root;\n }\n\n // free all resources specific to a particular clip\n }, {\n key: \"uncacheClip\",\n value: function uncacheClip(clip) {\n var actions = this._actions,\n clipUuid = clip.uuid,\n actionsByClip = this._actionsByClip,\n actionsForClip = actionsByClip[clipUuid];\n if (actionsForClip !== undefined) {\n // note: just calling _removeInactiveAction would mess up the\n // iteration state and also require updating the state we can\n // just throw away\n\n var actionsToRemove = actionsForClip.knownActions;\n for (var i = 0, n = actionsToRemove.length; i !== n; ++i) {\n var action = actionsToRemove[i];\n this._deactivateAction(action);\n var cacheIndex = action._cacheIndex,\n lastInactiveAction = actions[actions.length - 1];\n action._cacheIndex = null;\n action._byClipCacheIndex = null;\n lastInactiveAction._cacheIndex = cacheIndex;\n actions[cacheIndex] = lastInactiveAction;\n actions.pop();\n this._removeInactiveBindingsForAction(action);\n }\n delete actionsByClip[clipUuid];\n }\n }\n\n // free all resources specific to a particular root target object\n }, {\n key: \"uncacheRoot\",\n value: function uncacheRoot(root) {\n var rootUuid = root.uuid,\n actionsByClip = this._actionsByClip;\n for (var clipUuid in actionsByClip) {\n var actionByRoot = actionsByClip[clipUuid].actionByRoot,\n action = actionByRoot[rootUuid];\n if (action !== undefined) {\n this._deactivateAction(action);\n this._removeInactiveAction(action);\n }\n }\n var bindingsByRoot = this._bindingsByRootAndName,\n bindingByName = bindingsByRoot[rootUuid];\n if (bindingByName !== undefined) {\n for (var trackName in bindingByName) {\n var binding = bindingByName[trackName];\n binding.restoreOriginalState();\n this._removeInactiveBinding(binding);\n }\n }\n }\n\n // remove a targeted clip from the cache\n }, {\n key: \"uncacheAction\",\n value: function uncacheAction(clip, optionalRoot) {\n var action = this.existingAction(clip, optionalRoot);\n if (action !== null) {\n this._deactivateAction(action);\n this._removeInactiveAction(action);\n }\n }\n }]);\n return AnimationMixer;\n}(EventDispatcher);\nvar Uniform = /*#__PURE__*/function () {\n function Uniform(value) {\n _classCallCheck(this, Uniform);\n this.value = value;\n }\n _createClass(Uniform, [{\n key: \"clone\",\n value: function clone() {\n return new Uniform(this.value.clone === undefined ? this.value : this.value.clone());\n }\n }]);\n return Uniform;\n}();\nvar id = 0;\nvar UniformsGroup = /*#__PURE__*/function (_EventDispatcher8) {\n _inherits(UniformsGroup, _EventDispatcher8);\n var _super142 = _createSuper(UniformsGroup);\n function UniformsGroup() {\n var _this115;\n _classCallCheck(this, UniformsGroup);\n _this115 = _super142.call(this);\n _this115.isUniformsGroup = true;\n Object.defineProperty(_assertThisInitialized(_this115), 'id', {\n value: id++\n });\n _this115.name = '';\n _this115.usage = StaticDrawUsage;\n _this115.uniforms = [];\n return _this115;\n }\n _createClass(UniformsGroup, [{\n key: \"add\",\n value: function add(uniform) {\n this.uniforms.push(uniform);\n return this;\n }\n }, {\n key: \"remove\",\n value: function remove(uniform) {\n var index = this.uniforms.indexOf(uniform);\n if (index !== -1) this.uniforms.splice(index, 1);\n return this;\n }\n }, {\n key: \"setName\",\n value: function setName(name) {\n this.name = name;\n return this;\n }\n }, {\n key: \"setUsage\",\n value: function setUsage(value) {\n this.usage = value;\n return this;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.dispatchEvent({\n type: 'dispose'\n });\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n this.name = source.name;\n this.usage = source.usage;\n var uniformsSource = source.uniforms;\n this.uniforms.length = 0;\n for (var i = 0, l = uniformsSource.length; i < l; i++) {\n this.uniforms.push(uniformsSource[i].clone());\n }\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }]);\n return UniformsGroup;\n}(EventDispatcher);\nvar InstancedInterleavedBuffer = /*#__PURE__*/function (_InterleavedBuffer) {\n _inherits(InstancedInterleavedBuffer, _InterleavedBuffer);\n var _super143 = _createSuper(InstancedInterleavedBuffer);\n function InstancedInterleavedBuffer(array, stride) {\n var _this116;\n var meshPerAttribute = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n _classCallCheck(this, InstancedInterleavedBuffer);\n _this116 = _super143.call(this, array, stride);\n _this116.isInstancedInterleavedBuffer = true;\n _this116.meshPerAttribute = meshPerAttribute;\n return _this116;\n }\n _createClass(InstancedInterleavedBuffer, [{\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(InstancedInterleavedBuffer.prototype), \"copy\", this).call(this, source);\n this.meshPerAttribute = source.meshPerAttribute;\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone(data) {\n var ib = _get(_getPrototypeOf(InstancedInterleavedBuffer.prototype), \"clone\", this).call(this, data);\n ib.meshPerAttribute = this.meshPerAttribute;\n return ib;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON(data) {\n var json = _get(_getPrototypeOf(InstancedInterleavedBuffer.prototype), \"toJSON\", this).call(this, data);\n json.isInstancedInterleavedBuffer = true;\n json.meshPerAttribute = this.meshPerAttribute;\n return json;\n }\n }]);\n return InstancedInterleavedBuffer;\n}(InterleavedBuffer);\nvar GLBufferAttribute = /*#__PURE__*/function () {\n function GLBufferAttribute(buffer, type, itemSize, elementSize, count) {\n _classCallCheck(this, GLBufferAttribute);\n this.isGLBufferAttribute = true;\n this.name = '';\n this.buffer = buffer;\n this.type = type;\n this.itemSize = itemSize;\n this.elementSize = elementSize;\n this.count = count;\n this.version = 0;\n }\n _createClass(GLBufferAttribute, [{\n key: \"needsUpdate\",\n set: function set(value) {\n if (value === true) this.version++;\n }\n }, {\n key: \"setBuffer\",\n value: function setBuffer(buffer) {\n this.buffer = buffer;\n return this;\n }\n }, {\n key: \"setType\",\n value: function setType(type, elementSize) {\n this.type = type;\n this.elementSize = elementSize;\n return this;\n }\n }, {\n key: \"setItemSize\",\n value: function setItemSize(itemSize) {\n this.itemSize = itemSize;\n return this;\n }\n }, {\n key: \"setCount\",\n value: function setCount(count) {\n this.count = count;\n return this;\n }\n }]);\n return GLBufferAttribute;\n}();\nvar Raycaster = /*#__PURE__*/function () {\n function Raycaster(origin, direction) {\n var near = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var far = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Infinity;\n _classCallCheck(this, Raycaster);\n this.ray = new Ray(origin, direction);\n // direction is assumed to be normalized (for accurate distance calculations)\n\n this.near = near;\n this.far = far;\n this.camera = null;\n this.layers = new Layers();\n this.params = {\n Mesh: {},\n Line: {\n threshold: 1\n },\n LOD: {},\n Points: {\n threshold: 1\n },\n Sprite: {}\n };\n }\n _createClass(Raycaster, [{\n key: \"set\",\n value: function set(origin, direction) {\n // direction is assumed to be normalized (for accurate distance calculations)\n\n this.ray.set(origin, direction);\n }\n }, {\n key: \"setFromCamera\",\n value: function setFromCamera(coords, camera) {\n if (camera.isPerspectiveCamera) {\n this.ray.origin.setFromMatrixPosition(camera.matrixWorld);\n this.ray.direction.set(coords.x, coords.y, 0.5).unproject(camera).sub(this.ray.origin).normalize();\n this.camera = camera;\n } else if (camera.isOrthographicCamera) {\n this.ray.origin.set(coords.x, coords.y, (camera.near + camera.far) / (camera.near - camera.far)).unproject(camera); // set origin in plane of camera\n this.ray.direction.set(0, 0, -1).transformDirection(camera.matrixWorld);\n this.camera = camera;\n } else {\n console.error('THREE.Raycaster: Unsupported camera type: ' + camera.type);\n }\n }\n }, {\n key: \"intersectObject\",\n value: function intersectObject(object) {\n var recursive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var intersects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n _intersectObject(object, this, intersects, recursive);\n intersects.sort(ascSort);\n return intersects;\n }\n }, {\n key: \"intersectObjects\",\n value: function intersectObjects(objects) {\n var recursive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var intersects = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n for (var i = 0, l = objects.length; i < l; i++) {\n _intersectObject(objects[i], this, intersects, recursive);\n }\n intersects.sort(ascSort);\n return intersects;\n }\n }]);\n return Raycaster;\n}();\nfunction ascSort(a, b) {\n return a.distance - b.distance;\n}\nfunction _intersectObject(object, raycaster, intersects, recursive) {\n if (object.layers.test(raycaster.layers)) {\n object.raycast(raycaster, intersects);\n }\n if (recursive === true) {\n var children = object.children;\n for (var i = 0, l = children.length; i < l; i++) {\n _intersectObject(children[i], raycaster, intersects, true);\n }\n }\n}\n\n/**\n * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system\n *\n * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.\n * The azimuthal angle (theta) is measured from the positive z-axis.\n */\nvar Spherical = /*#__PURE__*/function () {\n function Spherical() {\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var phi = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var theta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n _classCallCheck(this, Spherical);\n this.radius = radius;\n this.phi = phi; // polar angle\n this.theta = theta; // azimuthal angle\n\n return this;\n }\n _createClass(Spherical, [{\n key: \"set\",\n value: function set(radius, phi, theta) {\n this.radius = radius;\n this.phi = phi;\n this.theta = theta;\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(other) {\n this.radius = other.radius;\n this.phi = other.phi;\n this.theta = other.theta;\n return this;\n }\n\n // restrict phi to be between EPS and PI-EPS\n }, {\n key: \"makeSafe\",\n value: function makeSafe() {\n var EPS = 0.000001;\n this.phi = Math.max(EPS, Math.min(Math.PI - EPS, this.phi));\n return this;\n }\n }, {\n key: \"setFromVector3\",\n value: function setFromVector3(v) {\n return this.setFromCartesianCoords(v.x, v.y, v.z);\n }\n }, {\n key: \"setFromCartesianCoords\",\n value: function setFromCartesianCoords(x, y, z) {\n this.radius = Math.sqrt(x * x + y * y + z * z);\n if (this.radius === 0) {\n this.theta = 0;\n this.phi = 0;\n } else {\n this.theta = Math.atan2(x, z);\n this.phi = Math.acos(clamp(y / this.radius, -1, 1));\n }\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }]);\n return Spherical;\n}();\n/**\n * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system\n */\nvar Cylindrical = /*#__PURE__*/function () {\n function Cylindrical() {\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n var theta = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n _classCallCheck(this, Cylindrical);\n this.radius = radius; // distance from the origin to a point in the x-z plane\n this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis\n this.y = y; // height above the x-z plane\n\n return this;\n }\n _createClass(Cylindrical, [{\n key: \"set\",\n value: function set(radius, theta, y) {\n this.radius = radius;\n this.theta = theta;\n this.y = y;\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(other) {\n this.radius = other.radius;\n this.theta = other.theta;\n this.y = other.y;\n return this;\n }\n }, {\n key: \"setFromVector3\",\n value: function setFromVector3(v) {\n return this.setFromCartesianCoords(v.x, v.y, v.z);\n }\n }, {\n key: \"setFromCartesianCoords\",\n value: function setFromCartesianCoords(x, y, z) {\n this.radius = Math.sqrt(x * x + z * z);\n this.theta = Math.atan2(x, z);\n this.y = y;\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }]);\n return Cylindrical;\n}();\nvar _vector$4 = /*@__PURE__*/new Vector2();\nvar Box2 = /*#__PURE__*/function () {\n function Box2() {\n var min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector2(+Infinity, +Infinity);\n var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector2(-Infinity, -Infinity);\n _classCallCheck(this, Box2);\n this.isBox2 = true;\n this.min = min;\n this.max = max;\n }\n _createClass(Box2, [{\n key: \"set\",\n value: function set(min, max) {\n this.min.copy(min);\n this.max.copy(max);\n return this;\n }\n }, {\n key: \"setFromPoints\",\n value: function setFromPoints(points) {\n this.makeEmpty();\n for (var i = 0, il = points.length; i < il; i++) {\n this.expandByPoint(points[i]);\n }\n return this;\n }\n }, {\n key: \"setFromCenterAndSize\",\n value: function setFromCenterAndSize(center, size) {\n var halfSize = _vector$4.copy(size).multiplyScalar(0.5);\n this.min.copy(center).sub(halfSize);\n this.max.copy(center).add(halfSize);\n return this;\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }, {\n key: \"copy\",\n value: function copy(box) {\n this.min.copy(box.min);\n this.max.copy(box.max);\n return this;\n }\n }, {\n key: \"makeEmpty\",\n value: function makeEmpty() {\n this.min.x = this.min.y = +Infinity;\n this.max.x = this.max.y = -Infinity;\n return this;\n }\n }, {\n key: \"isEmpty\",\n value: function isEmpty() {\n // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes\n\n return this.max.x < this.min.x || this.max.y < this.min.y;\n }\n }, {\n key: \"getCenter\",\n value: function getCenter(target) {\n return this.isEmpty() ? target.set(0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5);\n }\n }, {\n key: \"getSize\",\n value: function getSize(target) {\n return this.isEmpty() ? target.set(0, 0) : target.subVectors(this.max, this.min);\n }\n }, {\n key: \"expandByPoint\",\n value: function expandByPoint(point) {\n this.min.min(point);\n this.max.max(point);\n return this;\n }\n }, {\n key: \"expandByVector\",\n value: function expandByVector(vector) {\n this.min.sub(vector);\n this.max.add(vector);\n return this;\n }\n }, {\n key: \"expandByScalar\",\n value: function expandByScalar(scalar) {\n this.min.addScalar(-scalar);\n this.max.addScalar(scalar);\n return this;\n }\n }, {\n key: \"containsPoint\",\n value: function containsPoint(point) {\n return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y ? false : true;\n }\n }, {\n key: \"containsBox\",\n value: function containsBox(box) {\n return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y;\n }\n }, {\n key: \"getParameter\",\n value: function getParameter(point, target) {\n // This can potentially have a divide by zero if the box\n // has a size dimension of 0.\n\n return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y));\n }\n }, {\n key: \"intersectsBox\",\n value: function intersectsBox(box) {\n // using 4 splitting planes to rule out intersections\n\n return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y ? false : true;\n }\n }, {\n key: \"clampPoint\",\n value: function clampPoint(point, target) {\n return target.copy(point).clamp(this.min, this.max);\n }\n }, {\n key: \"distanceToPoint\",\n value: function distanceToPoint(point) {\n return this.clampPoint(point, _vector$4).distanceTo(point);\n }\n }, {\n key: \"intersect\",\n value: function intersect(box) {\n this.min.max(box.min);\n this.max.min(box.max);\n if (this.isEmpty()) this.makeEmpty();\n return this;\n }\n }, {\n key: \"union\",\n value: function union(box) {\n this.min.min(box.min);\n this.max.max(box.max);\n return this;\n }\n }, {\n key: \"translate\",\n value: function translate(offset) {\n this.min.add(offset);\n this.max.add(offset);\n return this;\n }\n }, {\n key: \"equals\",\n value: function equals(box) {\n return box.min.equals(this.min) && box.max.equals(this.max);\n }\n }]);\n return Box2;\n}();\nvar _startP = /*@__PURE__*/new Vector3();\nvar _startEnd = /*@__PURE__*/new Vector3();\nvar Line3 = /*#__PURE__*/function () {\n function Line3() {\n var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector3();\n var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3();\n _classCallCheck(this, Line3);\n this.start = start;\n this.end = end;\n }\n _createClass(Line3, [{\n key: \"set\",\n value: function set(start, end) {\n this.start.copy(start);\n this.end.copy(end);\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(line) {\n this.start.copy(line.start);\n this.end.copy(line.end);\n return this;\n }\n }, {\n key: \"getCenter\",\n value: function getCenter(target) {\n return target.addVectors(this.start, this.end).multiplyScalar(0.5);\n }\n }, {\n key: \"delta\",\n value: function delta(target) {\n return target.subVectors(this.end, this.start);\n }\n }, {\n key: \"distanceSq\",\n value: function distanceSq() {\n return this.start.distanceToSquared(this.end);\n }\n }, {\n key: \"distance\",\n value: function distance() {\n return this.start.distanceTo(this.end);\n }\n }, {\n key: \"at\",\n value: function at(t, target) {\n return this.delta(target).multiplyScalar(t).add(this.start);\n }\n }, {\n key: \"closestPointToPointParameter\",\n value: function closestPointToPointParameter(point, clampToLine) {\n _startP.subVectors(point, this.start);\n _startEnd.subVectors(this.end, this.start);\n var startEnd2 = _startEnd.dot(_startEnd);\n var startEnd_startP = _startEnd.dot(_startP);\n var t = startEnd_startP / startEnd2;\n if (clampToLine) {\n t = clamp(t, 0, 1);\n }\n return t;\n }\n }, {\n key: \"closestPointToPoint\",\n value: function closestPointToPoint(point, clampToLine, target) {\n var t = this.closestPointToPointParameter(point, clampToLine);\n return this.delta(target).multiplyScalar(t).add(this.start);\n }\n }, {\n key: \"applyMatrix4\",\n value: function applyMatrix4(matrix) {\n this.start.applyMatrix4(matrix);\n this.end.applyMatrix4(matrix);\n return this;\n }\n }, {\n key: \"equals\",\n value: function equals(line) {\n return line.start.equals(this.start) && line.end.equals(this.end);\n }\n }, {\n key: \"clone\",\n value: function clone() {\n return new this.constructor().copy(this);\n }\n }]);\n return Line3;\n}();\nvar _vector$3 = /*@__PURE__*/new Vector3();\nvar SpotLightHelper = /*#__PURE__*/function (_Object3D14) {\n _inherits(SpotLightHelper, _Object3D14);\n var _super144 = _createSuper(SpotLightHelper);\n function SpotLightHelper(light, color) {\n var _this117;\n _classCallCheck(this, SpotLightHelper);\n _this117 = _super144.call(this);\n _this117.light = light;\n _this117.matrix = light.matrixWorld;\n _this117.matrixAutoUpdate = false;\n _this117.color = color;\n _this117.type = 'SpotLightHelper';\n var geometry = new BufferGeometry();\n var positions = [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, 1];\n for (var i = 0, j = 1, l = 32; i < l; i++, j++) {\n var p1 = i / l * Math.PI * 2;\n var p2 = j / l * Math.PI * 2;\n positions.push(Math.cos(p1), Math.sin(p1), 1, Math.cos(p2), Math.sin(p2), 1);\n }\n geometry.setAttribute('position', new Float32BufferAttribute(positions, 3));\n var material = new LineBasicMaterial({\n fog: false,\n toneMapped: false\n });\n _this117.cone = new LineSegments(geometry, material);\n _this117.add(_this117.cone);\n _this117.update();\n return _this117;\n }\n _createClass(SpotLightHelper, [{\n key: \"dispose\",\n value: function dispose() {\n this.cone.geometry.dispose();\n this.cone.material.dispose();\n }\n }, {\n key: \"update\",\n value: function update() {\n this.light.updateWorldMatrix(true, false);\n this.light.target.updateWorldMatrix(true, false);\n var coneLength = this.light.distance ? this.light.distance : 1000;\n var coneWidth = coneLength * Math.tan(this.light.angle);\n this.cone.scale.set(coneWidth, coneWidth, coneLength);\n _vector$3.setFromMatrixPosition(this.light.target.matrixWorld);\n this.cone.lookAt(_vector$3);\n if (this.color !== undefined) {\n this.cone.material.color.set(this.color);\n } else {\n this.cone.material.color.copy(this.light.color);\n }\n }\n }]);\n return SpotLightHelper;\n}(Object3D);\nvar _vector$2 = /*@__PURE__*/new Vector3();\nvar _boneMatrix = /*@__PURE__*/new Matrix4();\nvar _matrixWorldInv = /*@__PURE__*/new Matrix4();\nvar SkeletonHelper = /*#__PURE__*/function (_LineSegments) {\n _inherits(SkeletonHelper, _LineSegments);\n var _super145 = _createSuper(SkeletonHelper);\n function SkeletonHelper(object) {\n var _this118;\n _classCallCheck(this, SkeletonHelper);\n var bones = getBoneList(object);\n var geometry = new BufferGeometry();\n var vertices = [];\n var colors = [];\n var color1 = new Color(0, 0, 1);\n var color2 = new Color(0, 1, 0);\n for (var i = 0; i < bones.length; i++) {\n var bone = bones[i];\n if (bone.parent && bone.parent.isBone) {\n vertices.push(0, 0, 0);\n vertices.push(0, 0, 0);\n colors.push(color1.r, color1.g, color1.b);\n colors.push(color2.r, color2.g, color2.b);\n }\n }\n geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));\n var material = new LineBasicMaterial({\n vertexColors: true,\n depthTest: false,\n depthWrite: false,\n toneMapped: false,\n transparent: true\n });\n _this118 = _super145.call(this, geometry, material);\n _this118.isSkeletonHelper = true;\n _this118.type = 'SkeletonHelper';\n _this118.root = object;\n _this118.bones = bones;\n _this118.matrix = object.matrixWorld;\n _this118.matrixAutoUpdate = false;\n return _this118;\n }\n _createClass(SkeletonHelper, [{\n key: \"updateMatrixWorld\",\n value: function updateMatrixWorld(force) {\n var bones = this.bones;\n var geometry = this.geometry;\n var position = geometry.getAttribute('position');\n _matrixWorldInv.copy(this.root.matrixWorld).invert();\n for (var i = 0, j = 0; i < bones.length; i++) {\n var bone = bones[i];\n if (bone.parent && bone.parent.isBone) {\n _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.matrixWorld);\n _vector$2.setFromMatrixPosition(_boneMatrix);\n position.setXYZ(j, _vector$2.x, _vector$2.y, _vector$2.z);\n _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.parent.matrixWorld);\n _vector$2.setFromMatrixPosition(_boneMatrix);\n position.setXYZ(j + 1, _vector$2.x, _vector$2.y, _vector$2.z);\n j += 2;\n }\n }\n geometry.getAttribute('position').needsUpdate = true;\n _get(_getPrototypeOf(SkeletonHelper.prototype), \"updateMatrixWorld\", this).call(this, force);\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n }]);\n return SkeletonHelper;\n}(LineSegments);\nfunction getBoneList(object) {\n var boneList = [];\n if (object.isBone === true) {\n boneList.push(object);\n }\n for (var i = 0; i < object.children.length; i++) {\n boneList.push.apply(boneList, getBoneList(object.children[i]));\n }\n return boneList;\n}\nvar PointLightHelper = /*#__PURE__*/function (_Mesh3) {\n _inherits(PointLightHelper, _Mesh3);\n var _super146 = _createSuper(PointLightHelper);\n function PointLightHelper(light, sphereSize, color) {\n var _this119;\n _classCallCheck(this, PointLightHelper);\n var geometry = new SphereGeometry(sphereSize, 4, 2);\n var material = new MeshBasicMaterial({\n wireframe: true,\n fog: false,\n toneMapped: false\n });\n _this119 = _super146.call(this, geometry, material);\n _this119.light = light;\n _this119.color = color;\n _this119.type = 'PointLightHelper';\n _this119.matrix = _this119.light.matrixWorld;\n _this119.matrixAutoUpdate = false;\n _this119.update();\n\n /*\n // TODO: delete this comment?\n const distanceGeometry = new THREE.IcosahedronGeometry( 1, 2 );\n const distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } );\n this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial );\n this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial );\n const d = light.distance;\n if ( d === 0.0 ) {\n \tthis.lightDistance.visible = false;\n } else {\n \tthis.lightDistance.scale.set( d, d, d );\n }\n this.add( this.lightDistance );\n */\n return _this119;\n }\n _createClass(PointLightHelper, [{\n key: \"dispose\",\n value: function dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n }, {\n key: \"update\",\n value: function update() {\n this.light.updateWorldMatrix(true, false);\n if (this.color !== undefined) {\n this.material.color.set(this.color);\n } else {\n this.material.color.copy(this.light.color);\n }\n\n /*\n const d = this.light.distance;\n \tif ( d === 0.0 ) {\n \t\tthis.lightDistance.visible = false;\n \t} else {\n \t\tthis.lightDistance.visible = true;\n \tthis.lightDistance.scale.set( d, d, d );\n \t}\n */\n }\n }]);\n return PointLightHelper;\n}(Mesh);\nvar _vector$1 = /*@__PURE__*/new Vector3();\nvar _color1 = /*@__PURE__*/new Color();\nvar _color2 = /*@__PURE__*/new Color();\nvar HemisphereLightHelper = /*#__PURE__*/function (_Object3D15) {\n _inherits(HemisphereLightHelper, _Object3D15);\n var _super147 = _createSuper(HemisphereLightHelper);\n function HemisphereLightHelper(light, size, color) {\n var _this120;\n _classCallCheck(this, HemisphereLightHelper);\n _this120 = _super147.call(this);\n _this120.light = light;\n _this120.matrix = light.matrixWorld;\n _this120.matrixAutoUpdate = false;\n _this120.color = color;\n _this120.type = 'HemisphereLightHelper';\n var geometry = new OctahedronGeometry(size);\n geometry.rotateY(Math.PI * 0.5);\n _this120.material = new MeshBasicMaterial({\n wireframe: true,\n fog: false,\n toneMapped: false\n });\n if (_this120.color === undefined) _this120.material.vertexColors = true;\n var position = geometry.getAttribute('position');\n var colors = new Float32Array(position.count * 3);\n geometry.setAttribute('color', new BufferAttribute(colors, 3));\n _this120.add(new Mesh(geometry, _this120.material));\n _this120.update();\n return _this120;\n }\n _createClass(HemisphereLightHelper, [{\n key: \"dispose\",\n value: function dispose() {\n this.children[0].geometry.dispose();\n this.children[0].material.dispose();\n }\n }, {\n key: \"update\",\n value: function update() {\n var mesh = this.children[0];\n if (this.color !== undefined) {\n this.material.color.set(this.color);\n } else {\n var colors = mesh.geometry.getAttribute('color');\n _color1.copy(this.light.color);\n _color2.copy(this.light.groundColor);\n for (var i = 0, l = colors.count; i < l; i++) {\n var color = i < l / 2 ? _color1 : _color2;\n colors.setXYZ(i, color.r, color.g, color.b);\n }\n colors.needsUpdate = true;\n }\n this.light.updateWorldMatrix(true, false);\n mesh.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate());\n }\n }]);\n return HemisphereLightHelper;\n}(Object3D);\nvar GridHelper = /*#__PURE__*/function (_LineSegments2) {\n _inherits(GridHelper, _LineSegments2);\n var _super148 = _createSuper(GridHelper);\n function GridHelper() {\n var _this121;\n var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;\n var divisions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;\n var color1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0x444444;\n var color2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0x888888;\n _classCallCheck(this, GridHelper);\n color1 = new Color(color1);\n color2 = new Color(color2);\n var center = divisions / 2;\n var step = size / divisions;\n var halfSize = size / 2;\n var vertices = [],\n colors = [];\n for (var i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step) {\n vertices.push(-halfSize, 0, k, halfSize, 0, k);\n vertices.push(k, 0, -halfSize, k, 0, halfSize);\n var color = i === center ? color1 : color2;\n color.toArray(colors, j);\n j += 3;\n color.toArray(colors, j);\n j += 3;\n color.toArray(colors, j);\n j += 3;\n color.toArray(colors, j);\n j += 3;\n }\n var geometry = new BufferGeometry();\n geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));\n var material = new LineBasicMaterial({\n vertexColors: true,\n toneMapped: false\n });\n _this121 = _super148.call(this, geometry, material);\n _this121.type = 'GridHelper';\n return _this121;\n }\n _createClass(GridHelper, [{\n key: \"dispose\",\n value: function dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n }]);\n return GridHelper;\n}(LineSegments);\nvar PolarGridHelper = /*#__PURE__*/function (_LineSegments3) {\n _inherits(PolarGridHelper, _LineSegments3);\n var _super149 = _createSuper(PolarGridHelper);\n function PolarGridHelper() {\n var _this122;\n var radius = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;\n var sectors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 16;\n var rings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 8;\n var divisions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 64;\n var color1 = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0x444444;\n var color2 = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0x888888;\n _classCallCheck(this, PolarGridHelper);\n color1 = new Color(color1);\n color2 = new Color(color2);\n var vertices = [];\n var colors = [];\n\n // create the sectors\n\n if (sectors > 1) {\n for (var i = 0; i < sectors; i++) {\n var v = i / sectors * (Math.PI * 2);\n var x = Math.sin(v) * radius;\n var z = Math.cos(v) * radius;\n vertices.push(0, 0, 0);\n vertices.push(x, 0, z);\n var color = i & 1 ? color1 : color2;\n colors.push(color.r, color.g, color.b);\n colors.push(color.r, color.g, color.b);\n }\n }\n\n // create the rings\n\n for (var _i95 = 0; _i95 < rings; _i95++) {\n var _color3 = _i95 & 1 ? color1 : color2;\n var r = radius - radius / rings * _i95;\n for (var j = 0; j < divisions; j++) {\n // first vertex\n\n var _v = j / divisions * (Math.PI * 2);\n var _x12 = Math.sin(_v) * r;\n var _z3 = Math.cos(_v) * r;\n vertices.push(_x12, 0, _z3);\n colors.push(_color3.r, _color3.g, _color3.b);\n\n // second vertex\n\n _v = (j + 1) / divisions * (Math.PI * 2);\n _x12 = Math.sin(_v) * r;\n _z3 = Math.cos(_v) * r;\n vertices.push(_x12, 0, _z3);\n colors.push(_color3.r, _color3.g, _color3.b);\n }\n }\n var geometry = new BufferGeometry();\n geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));\n var material = new LineBasicMaterial({\n vertexColors: true,\n toneMapped: false\n });\n _this122 = _super149.call(this, geometry, material);\n _this122.type = 'PolarGridHelper';\n return _this122;\n }\n _createClass(PolarGridHelper, [{\n key: \"dispose\",\n value: function dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n }]);\n return PolarGridHelper;\n}(LineSegments);\nvar _v1 = /*@__PURE__*/new Vector3();\nvar _v2 = /*@__PURE__*/new Vector3();\nvar _v3 = /*@__PURE__*/new Vector3();\nvar DirectionalLightHelper = /*#__PURE__*/function (_Object3D16) {\n _inherits(DirectionalLightHelper, _Object3D16);\n var _super150 = _createSuper(DirectionalLightHelper);\n function DirectionalLightHelper(light, size, color) {\n var _this123;\n _classCallCheck(this, DirectionalLightHelper);\n _this123 = _super150.call(this);\n _this123.light = light;\n _this123.matrix = light.matrixWorld;\n _this123.matrixAutoUpdate = false;\n _this123.color = color;\n _this123.type = 'DirectionalLightHelper';\n if (size === undefined) size = 1;\n var geometry = new BufferGeometry();\n geometry.setAttribute('position', new Float32BufferAttribute([-size, size, 0, size, size, 0, size, -size, 0, -size, -size, 0, -size, size, 0], 3));\n var material = new LineBasicMaterial({\n fog: false,\n toneMapped: false\n });\n _this123.lightPlane = new Line(geometry, material);\n _this123.add(_this123.lightPlane);\n geometry = new BufferGeometry();\n geometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 0, 0, 1], 3));\n _this123.targetLine = new Line(geometry, material);\n _this123.add(_this123.targetLine);\n _this123.update();\n return _this123;\n }\n _createClass(DirectionalLightHelper, [{\n key: \"dispose\",\n value: function dispose() {\n this.lightPlane.geometry.dispose();\n this.lightPlane.material.dispose();\n this.targetLine.geometry.dispose();\n this.targetLine.material.dispose();\n }\n }, {\n key: \"update\",\n value: function update() {\n this.light.updateWorldMatrix(true, false);\n this.light.target.updateWorldMatrix(true, false);\n _v1.setFromMatrixPosition(this.light.matrixWorld);\n _v2.setFromMatrixPosition(this.light.target.matrixWorld);\n _v3.subVectors(_v2, _v1);\n this.lightPlane.lookAt(_v2);\n if (this.color !== undefined) {\n this.lightPlane.material.color.set(this.color);\n this.targetLine.material.color.set(this.color);\n } else {\n this.lightPlane.material.color.copy(this.light.color);\n this.targetLine.material.color.copy(this.light.color);\n }\n this.targetLine.lookAt(_v2);\n this.targetLine.scale.z = _v3.length();\n }\n }]);\n return DirectionalLightHelper;\n}(Object3D);\nvar _vector = /*@__PURE__*/new Vector3();\nvar _camera = /*@__PURE__*/new Camera();\n\n/**\n *\t- shows frustum, line of sight and up of the camera\n *\t- suitable for fast updates\n * \t- based on frustum visualization in lightgl.js shadowmap example\n *\t\thttps://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html\n */\nvar CameraHelper = /*#__PURE__*/function (_LineSegments4) {\n _inherits(CameraHelper, _LineSegments4);\n var _super151 = _createSuper(CameraHelper);\n function CameraHelper(camera) {\n var _this124;\n _classCallCheck(this, CameraHelper);\n var geometry = new BufferGeometry();\n var material = new LineBasicMaterial({\n color: 0xffffff,\n vertexColors: true,\n toneMapped: false\n });\n var vertices = [];\n var colors = [];\n var pointMap = {};\n\n // near\n\n addLine('n1', 'n2');\n addLine('n2', 'n4');\n addLine('n4', 'n3');\n addLine('n3', 'n1');\n\n // far\n\n addLine('f1', 'f2');\n addLine('f2', 'f4');\n addLine('f4', 'f3');\n addLine('f3', 'f1');\n\n // sides\n\n addLine('n1', 'f1');\n addLine('n2', 'f2');\n addLine('n3', 'f3');\n addLine('n4', 'f4');\n\n // cone\n\n addLine('p', 'n1');\n addLine('p', 'n2');\n addLine('p', 'n3');\n addLine('p', 'n4');\n\n // up\n\n addLine('u1', 'u2');\n addLine('u2', 'u3');\n addLine('u3', 'u1');\n\n // target\n\n addLine('c', 't');\n addLine('p', 'c');\n\n // cross\n\n addLine('cn1', 'cn2');\n addLine('cn3', 'cn4');\n addLine('cf1', 'cf2');\n addLine('cf3', 'cf4');\n function addLine(a, b) {\n addPoint(a);\n addPoint(b);\n }\n function addPoint(id) {\n vertices.push(0, 0, 0);\n colors.push(0, 0, 0);\n if (pointMap[id] === undefined) {\n pointMap[id] = [];\n }\n pointMap[id].push(vertices.length / 3 - 1);\n }\n geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));\n _this124 = _super151.call(this, geometry, material);\n _this124.type = 'CameraHelper';\n _this124.camera = camera;\n if (_this124.camera.updateProjectionMatrix) _this124.camera.updateProjectionMatrix();\n _this124.matrix = camera.matrixWorld;\n _this124.matrixAutoUpdate = false;\n _this124.pointMap = pointMap;\n _this124.update();\n\n // colors\n\n var colorFrustum = new Color(0xffaa00);\n var colorCone = new Color(0xff0000);\n var colorUp = new Color(0x00aaff);\n var colorTarget = new Color(0xffffff);\n var colorCross = new Color(0x333333);\n _this124.setColors(colorFrustum, colorCone, colorUp, colorTarget, colorCross);\n return _this124;\n }\n _createClass(CameraHelper, [{\n key: \"setColors\",\n value: function setColors(frustum, cone, up, target, cross) {\n var geometry = this.geometry;\n var colorAttribute = geometry.getAttribute('color');\n\n // near\n\n colorAttribute.setXYZ(0, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(1, frustum.r, frustum.g, frustum.b); // n1, n2\n colorAttribute.setXYZ(2, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(3, frustum.r, frustum.g, frustum.b); // n2, n4\n colorAttribute.setXYZ(4, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(5, frustum.r, frustum.g, frustum.b); // n4, n3\n colorAttribute.setXYZ(6, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(7, frustum.r, frustum.g, frustum.b); // n3, n1\n\n // far\n\n colorAttribute.setXYZ(8, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(9, frustum.r, frustum.g, frustum.b); // f1, f2\n colorAttribute.setXYZ(10, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(11, frustum.r, frustum.g, frustum.b); // f2, f4\n colorAttribute.setXYZ(12, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(13, frustum.r, frustum.g, frustum.b); // f4, f3\n colorAttribute.setXYZ(14, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(15, frustum.r, frustum.g, frustum.b); // f3, f1\n\n // sides\n\n colorAttribute.setXYZ(16, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(17, frustum.r, frustum.g, frustum.b); // n1, f1\n colorAttribute.setXYZ(18, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(19, frustum.r, frustum.g, frustum.b); // n2, f2\n colorAttribute.setXYZ(20, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(21, frustum.r, frustum.g, frustum.b); // n3, f3\n colorAttribute.setXYZ(22, frustum.r, frustum.g, frustum.b);\n colorAttribute.setXYZ(23, frustum.r, frustum.g, frustum.b); // n4, f4\n\n // cone\n\n colorAttribute.setXYZ(24, cone.r, cone.g, cone.b);\n colorAttribute.setXYZ(25, cone.r, cone.g, cone.b); // p, n1\n colorAttribute.setXYZ(26, cone.r, cone.g, cone.b);\n colorAttribute.setXYZ(27, cone.r, cone.g, cone.b); // p, n2\n colorAttribute.setXYZ(28, cone.r, cone.g, cone.b);\n colorAttribute.setXYZ(29, cone.r, cone.g, cone.b); // p, n3\n colorAttribute.setXYZ(30, cone.r, cone.g, cone.b);\n colorAttribute.setXYZ(31, cone.r, cone.g, cone.b); // p, n4\n\n // up\n\n colorAttribute.setXYZ(32, up.r, up.g, up.b);\n colorAttribute.setXYZ(33, up.r, up.g, up.b); // u1, u2\n colorAttribute.setXYZ(34, up.r, up.g, up.b);\n colorAttribute.setXYZ(35, up.r, up.g, up.b); // u2, u3\n colorAttribute.setXYZ(36, up.r, up.g, up.b);\n colorAttribute.setXYZ(37, up.r, up.g, up.b); // u3, u1\n\n // target\n\n colorAttribute.setXYZ(38, target.r, target.g, target.b);\n colorAttribute.setXYZ(39, target.r, target.g, target.b); // c, t\n colorAttribute.setXYZ(40, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(41, cross.r, cross.g, cross.b); // p, c\n\n // cross\n\n colorAttribute.setXYZ(42, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(43, cross.r, cross.g, cross.b); // cn1, cn2\n colorAttribute.setXYZ(44, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(45, cross.r, cross.g, cross.b); // cn3, cn4\n\n colorAttribute.setXYZ(46, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(47, cross.r, cross.g, cross.b); // cf1, cf2\n colorAttribute.setXYZ(48, cross.r, cross.g, cross.b);\n colorAttribute.setXYZ(49, cross.r, cross.g, cross.b); // cf3, cf4\n\n colorAttribute.needsUpdate = true;\n }\n }, {\n key: \"update\",\n value: function update() {\n var geometry = this.geometry;\n var pointMap = this.pointMap;\n var w = 1,\n h = 1;\n\n // we need just camera projection matrix inverse\n // world matrix must be identity\n\n _camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);\n\n // center / target\n\n setPoint('c', pointMap, geometry, _camera, 0, 0, -1);\n setPoint('t', pointMap, geometry, _camera, 0, 0, 1);\n\n // near\n\n setPoint('n1', pointMap, geometry, _camera, -w, -h, -1);\n setPoint('n2', pointMap, geometry, _camera, w, -h, -1);\n setPoint('n3', pointMap, geometry, _camera, -w, h, -1);\n setPoint('n4', pointMap, geometry, _camera, w, h, -1);\n\n // far\n\n setPoint('f1', pointMap, geometry, _camera, -w, -h, 1);\n setPoint('f2', pointMap, geometry, _camera, w, -h, 1);\n setPoint('f3', pointMap, geometry, _camera, -w, h, 1);\n setPoint('f4', pointMap, geometry, _camera, w, h, 1);\n\n // up\n\n setPoint('u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, -1);\n setPoint('u2', pointMap, geometry, _camera, -w * 0.7, h * 1.1, -1);\n setPoint('u3', pointMap, geometry, _camera, 0, h * 2, -1);\n\n // cross\n\n setPoint('cf1', pointMap, geometry, _camera, -w, 0, 1);\n setPoint('cf2', pointMap, geometry, _camera, w, 0, 1);\n setPoint('cf3', pointMap, geometry, _camera, 0, -h, 1);\n setPoint('cf4', pointMap, geometry, _camera, 0, h, 1);\n setPoint('cn1', pointMap, geometry, _camera, -w, 0, -1);\n setPoint('cn2', pointMap, geometry, _camera, w, 0, -1);\n setPoint('cn3', pointMap, geometry, _camera, 0, -h, -1);\n setPoint('cn4', pointMap, geometry, _camera, 0, h, -1);\n geometry.getAttribute('position').needsUpdate = true;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n }]);\n return CameraHelper;\n}(LineSegments);\nfunction setPoint(point, pointMap, geometry, camera, x, y, z) {\n _vector.set(x, y, z).unproject(camera);\n var points = pointMap[point];\n if (points !== undefined) {\n var position = geometry.getAttribute('position');\n for (var i = 0, l = points.length; i < l; i++) {\n position.setXYZ(points[i], _vector.x, _vector.y, _vector.z);\n }\n }\n}\nvar _box = /*@__PURE__*/new Box3();\nvar BoxHelper = /*#__PURE__*/function (_LineSegments5) {\n _inherits(BoxHelper, _LineSegments5);\n var _super152 = _createSuper(BoxHelper);\n function BoxHelper(object) {\n var _this125;\n var color = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0xffff00;\n _classCallCheck(this, BoxHelper);\n var indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]);\n var positions = new Float32Array(8 * 3);\n var geometry = new BufferGeometry();\n geometry.setIndex(new BufferAttribute(indices, 1));\n geometry.setAttribute('position', new BufferAttribute(positions, 3));\n _this125 = _super152.call(this, geometry, new LineBasicMaterial({\n color: color,\n toneMapped: false\n }));\n _this125.object = object;\n _this125.type = 'BoxHelper';\n _this125.matrixAutoUpdate = false;\n _this125.update();\n return _this125;\n }\n _createClass(BoxHelper, [{\n key: \"update\",\n value: function update(object) {\n if (object !== undefined) {\n console.warn('THREE.BoxHelper: .update() has no longer arguments.');\n }\n if (this.object !== undefined) {\n _box.setFromObject(this.object);\n }\n if (_box.isEmpty()) return;\n var min = _box.min;\n var max = _box.max;\n\n /*\n \t5____4\n 1/___0/|\n | 6__|_7\n 2/___3/\n \t0: max.x, max.y, max.z\n 1: min.x, max.y, max.z\n 2: min.x, min.y, max.z\n 3: max.x, min.y, max.z\n 4: max.x, max.y, min.z\n 5: min.x, max.y, min.z\n 6: min.x, min.y, min.z\n 7: max.x, min.y, min.z\n */\n\n var position = this.geometry.attributes.position;\n var array = position.array;\n array[0] = max.x;\n array[1] = max.y;\n array[2] = max.z;\n array[3] = min.x;\n array[4] = max.y;\n array[5] = max.z;\n array[6] = min.x;\n array[7] = min.y;\n array[8] = max.z;\n array[9] = max.x;\n array[10] = min.y;\n array[11] = max.z;\n array[12] = max.x;\n array[13] = max.y;\n array[14] = min.z;\n array[15] = min.x;\n array[16] = max.y;\n array[17] = min.z;\n array[18] = min.x;\n array[19] = min.y;\n array[20] = min.z;\n array[21] = max.x;\n array[22] = min.y;\n array[23] = min.z;\n position.needsUpdate = true;\n this.geometry.computeBoundingSphere();\n }\n }, {\n key: \"setFromObject\",\n value: function setFromObject(object) {\n this.object = object;\n this.update();\n return this;\n }\n }, {\n key: \"copy\",\n value: function copy(source, recursive) {\n _get(_getPrototypeOf(BoxHelper.prototype), \"copy\", this).call(this, source, recursive);\n this.object = source.object;\n return this;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n }]);\n return BoxHelper;\n}(LineSegments);\nvar Box3Helper = /*#__PURE__*/function (_LineSegments6) {\n _inherits(Box3Helper, _LineSegments6);\n var _super153 = _createSuper(Box3Helper);\n function Box3Helper(box) {\n var _this126;\n var color = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0xffff00;\n _classCallCheck(this, Box3Helper);\n var indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]);\n var positions = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1];\n var geometry = new BufferGeometry();\n geometry.setIndex(new BufferAttribute(indices, 1));\n geometry.setAttribute('position', new Float32BufferAttribute(positions, 3));\n _this126 = _super153.call(this, geometry, new LineBasicMaterial({\n color: color,\n toneMapped: false\n }));\n _this126.box = box;\n _this126.type = 'Box3Helper';\n _this126.geometry.computeBoundingSphere();\n return _this126;\n }\n _createClass(Box3Helper, [{\n key: \"updateMatrixWorld\",\n value: function updateMatrixWorld(force) {\n var box = this.box;\n if (box.isEmpty()) return;\n box.getCenter(this.position);\n box.getSize(this.scale);\n this.scale.multiplyScalar(0.5);\n _get(_getPrototypeOf(Box3Helper.prototype), \"updateMatrixWorld\", this).call(this, force);\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n }]);\n return Box3Helper;\n}(LineSegments);\nvar PlaneHelper = /*#__PURE__*/function (_Line3) {\n _inherits(PlaneHelper, _Line3);\n var _super154 = _createSuper(PlaneHelper);\n function PlaneHelper(plane) {\n var _this127;\n var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var hex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0xffff00;\n _classCallCheck(this, PlaneHelper);\n var color = hex;\n var positions = [1, -1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0];\n var geometry = new BufferGeometry();\n geometry.setAttribute('position', new Float32BufferAttribute(positions, 3));\n geometry.computeBoundingSphere();\n _this127 = _super154.call(this, geometry, new LineBasicMaterial({\n color: color,\n toneMapped: false\n }));\n _this127.type = 'PlaneHelper';\n _this127.plane = plane;\n _this127.size = size;\n var positions2 = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0];\n var geometry2 = new BufferGeometry();\n geometry2.setAttribute('position', new Float32BufferAttribute(positions2, 3));\n geometry2.computeBoundingSphere();\n _this127.add(new Mesh(geometry2, new MeshBasicMaterial({\n color: color,\n opacity: 0.2,\n transparent: true,\n depthWrite: false,\n toneMapped: false\n })));\n return _this127;\n }\n _createClass(PlaneHelper, [{\n key: \"updateMatrixWorld\",\n value: function updateMatrixWorld(force) {\n this.position.set(0, 0, 0);\n this.scale.set(0.5 * this.size, 0.5 * this.size, 1);\n this.lookAt(this.plane.normal);\n this.translateZ(-this.plane.constant);\n _get(_getPrototypeOf(PlaneHelper.prototype), \"updateMatrixWorld\", this).call(this, force);\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.geometry.dispose();\n this.material.dispose();\n this.children[0].geometry.dispose();\n this.children[0].material.dispose();\n }\n }]);\n return PlaneHelper;\n}(Line);\nvar _axis = /*@__PURE__*/new Vector3();\nvar _lineGeometry, _coneGeometry;\nvar ArrowHelper = /*#__PURE__*/function (_Object3D17) {\n _inherits(ArrowHelper, _Object3D17);\n var _super155 = _createSuper(ArrowHelper);\n // dir is assumed to be normalized\n\n function ArrowHelper() {\n var _this128;\n var dir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Vector3(0, 0, 1);\n var origin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector3(0, 0, 0);\n var length = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var color = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0xffff00;\n var headLength = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : length * 0.2;\n var headWidth = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : headLength * 0.2;\n _classCallCheck(this, ArrowHelper);\n _this128 = _super155.call(this);\n _this128.type = 'ArrowHelper';\n if (_lineGeometry === undefined) {\n _lineGeometry = new BufferGeometry();\n _lineGeometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 0, 1, 0], 3));\n _coneGeometry = new CylinderGeometry(0, 0.5, 1, 5, 1);\n _coneGeometry.translate(0, -0.5, 0);\n }\n _this128.position.copy(origin);\n _this128.line = new Line(_lineGeometry, new LineBasicMaterial({\n color: color,\n toneMapped: false\n }));\n _this128.line.matrixAutoUpdate = false;\n _this128.add(_this128.line);\n _this128.cone = new Mesh(_coneGeometry, new MeshBasicMaterial({\n color: color,\n toneMapped: false\n }));\n _this128.cone.matrixAutoUpdate = false;\n _this128.add(_this128.cone);\n _this128.setDirection(dir);\n _this128.setLength(length, headLength, headWidth);\n return _this128;\n }\n _createClass(ArrowHelper, [{\n key: \"setDirection\",\n value: function setDirection(dir) {\n // dir is assumed to be normalized\n\n if (dir.y > 0.99999) {\n this.quaternion.set(0, 0, 0, 1);\n } else if (dir.y < -0.99999) {\n this.quaternion.set(1, 0, 0, 0);\n } else {\n _axis.set(dir.z, 0, -dir.x).normalize();\n var radians = Math.acos(dir.y);\n this.quaternion.setFromAxisAngle(_axis, radians);\n }\n }\n }, {\n key: \"setLength\",\n value: function setLength(length) {\n var headLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : length * 0.2;\n var headWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : headLength * 0.2;\n this.line.scale.set(1, Math.max(0.0001, length - headLength), 1); // see #17458\n this.line.updateMatrix();\n this.cone.scale.set(headWidth, headLength, headWidth);\n this.cone.position.y = length;\n this.cone.updateMatrix();\n }\n }, {\n key: \"setColor\",\n value: function setColor(color) {\n this.line.material.color.set(color);\n this.cone.material.color.set(color);\n }\n }, {\n key: \"copy\",\n value: function copy(source) {\n _get(_getPrototypeOf(ArrowHelper.prototype), \"copy\", this).call(this, source, false);\n this.line.copy(source.line);\n this.cone.copy(source.cone);\n return this;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.line.geometry.dispose();\n this.line.material.dispose();\n this.cone.geometry.dispose();\n this.cone.material.dispose();\n }\n }]);\n return ArrowHelper;\n}(Object3D);\nvar AxesHelper = /*#__PURE__*/function (_LineSegments7) {\n _inherits(AxesHelper, _LineSegments7);\n var _super156 = _createSuper(AxesHelper);\n function AxesHelper() {\n var _this129;\n var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n _classCallCheck(this, AxesHelper);\n var vertices = [0, 0, 0, size, 0, 0, 0, 0, 0, 0, size, 0, 0, 0, 0, 0, 0, size];\n var colors = [1, 0, 0, 1, 0.6, 0, 0, 1, 0, 0.6, 1, 0, 0, 0, 1, 0, 0.6, 1];\n var geometry = new BufferGeometry();\n geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3));\n geometry.setAttribute('color', new Float32BufferAttribute(colors, 3));\n var material = new LineBasicMaterial({\n vertexColors: true,\n toneMapped: false\n });\n _this129 = _super156.call(this, geometry, material);\n _this129.type = 'AxesHelper';\n return _this129;\n }\n _createClass(AxesHelper, [{\n key: \"setColors\",\n value: function setColors(xAxisColor, yAxisColor, zAxisColor) {\n var color = new Color();\n var array = this.geometry.attributes.color.array;\n color.set(xAxisColor);\n color.toArray(array, 0);\n color.toArray(array, 3);\n color.set(yAxisColor);\n color.toArray(array, 6);\n color.toArray(array, 9);\n color.set(zAxisColor);\n color.toArray(array, 12);\n color.toArray(array, 15);\n this.geometry.attributes.color.needsUpdate = true;\n return this;\n }\n }, {\n key: \"dispose\",\n value: function dispose() {\n this.geometry.dispose();\n this.material.dispose();\n }\n }]);\n return AxesHelper;\n}(LineSegments);\nvar ShapePath = /*#__PURE__*/function () {\n function ShapePath() {\n _classCallCheck(this, ShapePath);\n this.type = 'ShapePath';\n this.color = new Color();\n this.subPaths = [];\n this.currentPath = null;\n }\n _createClass(ShapePath, [{\n key: \"moveTo\",\n value: function moveTo(x, y) {\n this.currentPath = new Path();\n this.subPaths.push(this.currentPath);\n this.currentPath.moveTo(x, y);\n return this;\n }\n }, {\n key: \"lineTo\",\n value: function lineTo(x, y) {\n this.currentPath.lineTo(x, y);\n return this;\n }\n }, {\n key: \"quadraticCurveTo\",\n value: function quadraticCurveTo(aCPx, aCPy, aX, aY) {\n this.currentPath.quadraticCurveTo(aCPx, aCPy, aX, aY);\n return this;\n }\n }, {\n key: \"bezierCurveTo\",\n value: function bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) {\n this.currentPath.bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY);\n return this;\n }\n }, {\n key: \"splineThru\",\n value: function splineThru(pts) {\n this.currentPath.splineThru(pts);\n return this;\n }\n }, {\n key: \"toShapes\",\n value: function toShapes(isCCW) {\n function toShapesNoHoles(inSubpaths) {\n var shapes = [];\n for (var i = 0, l = inSubpaths.length; i < l; i++) {\n var _tmpPath = inSubpaths[i];\n var _tmpShape = new Shape();\n _tmpShape.curves = _tmpPath.curves;\n shapes.push(_tmpShape);\n }\n return shapes;\n }\n function isPointInsidePolygon(inPt, inPolygon) {\n var polyLen = inPolygon.length;\n\n // inPt on polygon contour => immediate success or\n // toggling of inside/outside at every single! intersection point of an edge\n // with the horizontal line through inPt, left of inPt\n // not counting lowerY endpoints of edges and whole edges on that line\n var inside = false;\n for (var p = polyLen - 1, q = 0; q < polyLen; p = q++) {\n var edgeLowPt = inPolygon[p];\n var edgeHighPt = inPolygon[q];\n var edgeDx = edgeHighPt.x - edgeLowPt.x;\n var edgeDy = edgeHighPt.y - edgeLowPt.y;\n if (Math.abs(edgeDy) > Number.EPSILON) {\n // not parallel\n if (edgeDy < 0) {\n edgeLowPt = inPolygon[q];\n edgeDx = -edgeDx;\n edgeHighPt = inPolygon[p];\n edgeDy = -edgeDy;\n }\n if (inPt.y < edgeLowPt.y || inPt.y > edgeHighPt.y) continue;\n if (inPt.y === edgeLowPt.y) {\n if (inPt.x === edgeLowPt.x) return true; // inPt is on contour ?\n // continue;\t\t\t\t// no intersection or edgeLowPt => doesn't count !!!\n } else {\n var perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y);\n if (perpEdge === 0) return true; // inPt is on contour ?\n if (perpEdge < 0) continue;\n inside = !inside; // true intersection left of inPt\n }\n } else {\n // parallel or collinear\n if (inPt.y !== edgeLowPt.y) continue; // parallel\n // edge lies on the same horizontal line as inPt\n if (edgeHighPt.x <= inPt.x && inPt.x <= edgeLowPt.x || edgeLowPt.x <= inPt.x && inPt.x <= edgeHighPt.x) return true; // inPt: Point on contour !\n // continue;\n }\n }\n\n return inside;\n }\n var isClockWise = ShapeUtils.isClockWise;\n var subPaths = this.subPaths;\n if (subPaths.length === 0) return [];\n var solid, tmpPath, tmpShape;\n var shapes = [];\n if (subPaths.length === 1) {\n tmpPath = subPaths[0];\n tmpShape = new Shape();\n tmpShape.curves = tmpPath.curves;\n shapes.push(tmpShape);\n return shapes;\n }\n var holesFirst = !isClockWise(subPaths[0].getPoints());\n holesFirst = isCCW ? !holesFirst : holesFirst;\n\n // console.log(\"Holes first\", holesFirst);\n\n var betterShapeHoles = [];\n var newShapes = [];\n var newShapeHoles = [];\n var mainIdx = 0;\n var tmpPoints;\n newShapes[mainIdx] = undefined;\n newShapeHoles[mainIdx] = [];\n for (var i = 0, l = subPaths.length; i < l; i++) {\n tmpPath = subPaths[i];\n tmpPoints = tmpPath.getPoints();\n solid = isClockWise(tmpPoints);\n solid = isCCW ? !solid : solid;\n if (solid) {\n if (!holesFirst && newShapes[mainIdx]) mainIdx++;\n newShapes[mainIdx] = {\n s: new Shape(),\n p: tmpPoints\n };\n newShapes[mainIdx].s.curves = tmpPath.curves;\n if (holesFirst) mainIdx++;\n newShapeHoles[mainIdx] = [];\n\n //console.log('cw', i);\n } else {\n newShapeHoles[mainIdx].push({\n h: tmpPath,\n p: tmpPoints[0]\n });\n\n //console.log('ccw', i);\n }\n }\n\n // only Holes? -> probably all Shapes with wrong orientation\n if (!newShapes[0]) return toShapesNoHoles(subPaths);\n if (newShapes.length > 1) {\n var ambiguous = false;\n var toChange = 0;\n for (var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) {\n betterShapeHoles[sIdx] = [];\n }\n for (var _sIdx = 0, _sLen = newShapes.length; _sIdx < _sLen; _sIdx++) {\n var sho = newShapeHoles[_sIdx];\n for (var hIdx = 0; hIdx < sho.length; hIdx++) {\n var ho = sho[hIdx];\n var hole_unassigned = true;\n for (var s2Idx = 0; s2Idx < newShapes.length; s2Idx++) {\n if (isPointInsidePolygon(ho.p, newShapes[s2Idx].p)) {\n if (_sIdx !== s2Idx) toChange++;\n if (hole_unassigned) {\n hole_unassigned = false;\n betterShapeHoles[s2Idx].push(ho);\n } else {\n ambiguous = true;\n }\n }\n }\n if (hole_unassigned) {\n betterShapeHoles[_sIdx].push(ho);\n }\n }\n }\n if (toChange > 0 && ambiguous === false) {\n newShapeHoles = betterShapeHoles;\n }\n }\n var tmpHoles;\n for (var _i96 = 0, il = newShapes.length; _i96 < il; _i96++) {\n tmpShape = newShapes[_i96].s;\n shapes.push(tmpShape);\n tmpHoles = newShapeHoles[_i96];\n for (var j = 0, jl = tmpHoles.length; j < jl; j++) {\n tmpShape.holes.push(tmpHoles[j].h);\n }\n }\n\n //console.log(\"shape\", shapes);\n\n return shapes;\n }\n }]);\n return ShapePath;\n}();\nvar BoxBufferGeometry = /*#__PURE__*/function (_BoxGeometry) {\n _inherits(BoxBufferGeometry, _BoxGeometry);\n var _super157 = _createSuper(BoxBufferGeometry);\n // @deprecated, r144\n\n function BoxBufferGeometry(width, height, depth, widthSegments, heightSegments, depthSegments) {\n _classCallCheck(this, BoxBufferGeometry);\n console.warn('THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry.');\n return _super157.call(this, width, height, depth, widthSegments, heightSegments, depthSegments);\n }\n return _createClass(BoxBufferGeometry);\n}(BoxGeometry);\nvar CapsuleBufferGeometry = /*#__PURE__*/function (_CapsuleGeometry) {\n _inherits(CapsuleBufferGeometry, _CapsuleGeometry);\n var _super158 = _createSuper(CapsuleBufferGeometry);\n // @deprecated, r144\n\n function CapsuleBufferGeometry(radius, length, capSegments, radialSegments) {\n _classCallCheck(this, CapsuleBufferGeometry);\n console.warn('THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry.');\n return _super158.call(this, radius, length, capSegments, radialSegments);\n }\n return _createClass(CapsuleBufferGeometry);\n}(CapsuleGeometry);\nvar CircleBufferGeometry = /*#__PURE__*/function (_CircleGeometry) {\n _inherits(CircleBufferGeometry, _CircleGeometry);\n var _super159 = _createSuper(CircleBufferGeometry);\n // @deprecated, r144\n\n function CircleBufferGeometry(radius, segments, thetaStart, thetaLength) {\n _classCallCheck(this, CircleBufferGeometry);\n console.warn('THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry.');\n return _super159.call(this, radius, segments, thetaStart, thetaLength);\n }\n return _createClass(CircleBufferGeometry);\n}(CircleGeometry);\nvar ConeBufferGeometry = /*#__PURE__*/function (_ConeGeometry) {\n _inherits(ConeBufferGeometry, _ConeGeometry);\n var _super160 = _createSuper(ConeBufferGeometry);\n // @deprecated, r144\n\n function ConeBufferGeometry(radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength) {\n _classCallCheck(this, ConeBufferGeometry);\n console.warn('THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry.');\n return _super160.call(this, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);\n }\n return _createClass(ConeBufferGeometry);\n}(ConeGeometry);\nvar CylinderBufferGeometry = /*#__PURE__*/function (_CylinderGeometry2) {\n _inherits(CylinderBufferGeometry, _CylinderGeometry2);\n var _super161 = _createSuper(CylinderBufferGeometry);\n // @deprecated, r144\n\n function CylinderBufferGeometry(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength) {\n _classCallCheck(this, CylinderBufferGeometry);\n console.warn('THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry.');\n return _super161.call(this, radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);\n }\n return _createClass(CylinderBufferGeometry);\n}(CylinderGeometry);\nvar DodecahedronBufferGeometry = /*#__PURE__*/function (_DodecahedronGeometry) {\n _inherits(DodecahedronBufferGeometry, _DodecahedronGeometry);\n var _super162 = _createSuper(DodecahedronBufferGeometry);\n // @deprecated, r144\n\n function DodecahedronBufferGeometry(radius, detail) {\n _classCallCheck(this, DodecahedronBufferGeometry);\n console.warn('THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry.');\n return _super162.call(this, radius, detail);\n }\n return _createClass(DodecahedronBufferGeometry);\n}(DodecahedronGeometry);\nvar ExtrudeBufferGeometry = /*#__PURE__*/function (_ExtrudeGeometry) {\n _inherits(ExtrudeBufferGeometry, _ExtrudeGeometry);\n var _super163 = _createSuper(ExtrudeBufferGeometry);\n // @deprecated, r144\n\n function ExtrudeBufferGeometry(shapes, options) {\n _classCallCheck(this, ExtrudeBufferGeometry);\n console.warn('THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry.');\n return _super163.call(this, shapes, options);\n }\n return _createClass(ExtrudeBufferGeometry);\n}(ExtrudeGeometry);\nvar IcosahedronBufferGeometry = /*#__PURE__*/function (_IcosahedronGeometry) {\n _inherits(IcosahedronBufferGeometry, _IcosahedronGeometry);\n var _super164 = _createSuper(IcosahedronBufferGeometry);\n // @deprecated, r144\n\n function IcosahedronBufferGeometry(radius, detail) {\n _classCallCheck(this, IcosahedronBufferGeometry);\n console.warn('THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry.');\n return _super164.call(this, radius, detail);\n }\n return _createClass(IcosahedronBufferGeometry);\n}(IcosahedronGeometry);\nvar LatheBufferGeometry = /*#__PURE__*/function (_LatheGeometry2) {\n _inherits(LatheBufferGeometry, _LatheGeometry2);\n var _super165 = _createSuper(LatheBufferGeometry);\n // @deprecated, r144\n\n function LatheBufferGeometry(points, segments, phiStart, phiLength) {\n _classCallCheck(this, LatheBufferGeometry);\n console.warn('THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry.');\n return _super165.call(this, points, segments, phiStart, phiLength);\n }\n return _createClass(LatheBufferGeometry);\n}(LatheGeometry);\nvar OctahedronBufferGeometry = /*#__PURE__*/function (_OctahedronGeometry) {\n _inherits(OctahedronBufferGeometry, _OctahedronGeometry);\n var _super166 = _createSuper(OctahedronBufferGeometry);\n // @deprecated, r144\n\n function OctahedronBufferGeometry(radius, detail) {\n _classCallCheck(this, OctahedronBufferGeometry);\n console.warn('THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry.');\n return _super166.call(this, radius, detail);\n }\n return _createClass(OctahedronBufferGeometry);\n}(OctahedronGeometry);\nvar PlaneBufferGeometry = /*#__PURE__*/function (_PlaneGeometry) {\n _inherits(PlaneBufferGeometry, _PlaneGeometry);\n var _super167 = _createSuper(PlaneBufferGeometry);\n // @deprecated, r144\n\n function PlaneBufferGeometry(width, height, widthSegments, heightSegments) {\n _classCallCheck(this, PlaneBufferGeometry);\n console.warn('THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry.');\n return _super167.call(this, width, height, widthSegments, heightSegments);\n }\n return _createClass(PlaneBufferGeometry);\n}(PlaneGeometry);\nvar PolyhedronBufferGeometry = /*#__PURE__*/function (_PolyhedronGeometry5) {\n _inherits(PolyhedronBufferGeometry, _PolyhedronGeometry5);\n var _super168 = _createSuper(PolyhedronBufferGeometry);\n // @deprecated, r144\n\n function PolyhedronBufferGeometry(vertices, indices, radius, detail) {\n _classCallCheck(this, PolyhedronBufferGeometry);\n console.warn('THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry.');\n return _super168.call(this, vertices, indices, radius, detail);\n }\n return _createClass(PolyhedronBufferGeometry);\n}(PolyhedronGeometry);\nvar RingBufferGeometry = /*#__PURE__*/function (_RingGeometry) {\n _inherits(RingBufferGeometry, _RingGeometry);\n var _super169 = _createSuper(RingBufferGeometry);\n // @deprecated, r144\n\n function RingBufferGeometry(innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength) {\n _classCallCheck(this, RingBufferGeometry);\n console.warn('THREE.RingBufferGeometry has been renamed to THREE.RingGeometry.');\n return _super169.call(this, innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength);\n }\n return _createClass(RingBufferGeometry);\n}(RingGeometry);\nvar ShapeBufferGeometry = /*#__PURE__*/function (_ShapeGeometry) {\n _inherits(ShapeBufferGeometry, _ShapeGeometry);\n var _super170 = _createSuper(ShapeBufferGeometry);\n // @deprecated, r144\n\n function ShapeBufferGeometry(shapes, curveSegments) {\n _classCallCheck(this, ShapeBufferGeometry);\n console.warn('THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry.');\n return _super170.call(this, shapes, curveSegments);\n }\n return _createClass(ShapeBufferGeometry);\n}(ShapeGeometry);\nvar SphereBufferGeometry = /*#__PURE__*/function (_SphereGeometry) {\n _inherits(SphereBufferGeometry, _SphereGeometry);\n var _super171 = _createSuper(SphereBufferGeometry);\n // @deprecated, r144\n\n function SphereBufferGeometry(radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength) {\n _classCallCheck(this, SphereBufferGeometry);\n console.warn('THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry.');\n return _super171.call(this, radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength);\n }\n return _createClass(SphereBufferGeometry);\n}(SphereGeometry);\nvar TetrahedronBufferGeometry = /*#__PURE__*/function (_TetrahedronGeometry) {\n _inherits(TetrahedronBufferGeometry, _TetrahedronGeometry);\n var _super172 = _createSuper(TetrahedronBufferGeometry);\n // @deprecated, r144\n\n function TetrahedronBufferGeometry(radius, detail) {\n _classCallCheck(this, TetrahedronBufferGeometry);\n console.warn('THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry.');\n return _super172.call(this, radius, detail);\n }\n return _createClass(TetrahedronBufferGeometry);\n}(TetrahedronGeometry);\nvar TorusBufferGeometry = /*#__PURE__*/function (_TorusGeometry) {\n _inherits(TorusBufferGeometry, _TorusGeometry);\n var _super173 = _createSuper(TorusBufferGeometry);\n // @deprecated, r144\n\n function TorusBufferGeometry(radius, tube, radialSegments, tubularSegments, arc) {\n _classCallCheck(this, TorusBufferGeometry);\n console.warn('THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry.');\n return _super173.call(this, radius, tube, radialSegments, tubularSegments, arc);\n }\n return _createClass(TorusBufferGeometry);\n}(TorusGeometry);\nvar TorusKnotBufferGeometry = /*#__PURE__*/function (_TorusKnotGeometry) {\n _inherits(TorusKnotBufferGeometry, _TorusKnotGeometry);\n var _super174 = _createSuper(TorusKnotBufferGeometry);\n // @deprecated, r144\n\n function TorusKnotBufferGeometry(radius, tube, tubularSegments, radialSegments, p, q) {\n _classCallCheck(this, TorusKnotBufferGeometry);\n console.warn('THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry.');\n return _super174.call(this, radius, tube, tubularSegments, radialSegments, p, q);\n }\n return _createClass(TorusKnotBufferGeometry);\n}(TorusKnotGeometry);\nvar TubeBufferGeometry = /*#__PURE__*/function (_TubeGeometry) {\n _inherits(TubeBufferGeometry, _TubeGeometry);\n var _super175 = _createSuper(TubeBufferGeometry);\n // @deprecated, r144\n\n function TubeBufferGeometry(path, tubularSegments, radius, radialSegments, closed) {\n _classCallCheck(this, TubeBufferGeometry);\n console.warn('THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry.');\n return _super175.call(this, path, tubularSegments, radius, radialSegments, closed);\n }\n return _createClass(TubeBufferGeometry);\n}(TubeGeometry);\nif (typeof __THREE_DEVTOOLS__ !== 'undefined') {\n __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('register', {\n detail: {\n revision: REVISION\n }\n }));\n}\nif (typeof window !== 'undefined') {\n if (window.__THREE__) {\n console.warn('WARNING: Multiple instances of Three.js being imported.');\n } else {\n window.__THREE__ = REVISION;\n }\n}\n\n\n//# sourceURL=webpack://dgi_3d_viewer/../../../libraries/three/build/three.module.js?"); /***/ }), +/***/ "../../../libraries/three/examples/jsm/controls/OrbitControls.js": +/*!***********************************************************************!*\ + !*** ../../../libraries/three/examples/jsm/controls/OrbitControls.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"OrbitControls\": () => (/* binding */ OrbitControls)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"../../../libraries/three/build/three.module.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n// OrbitControls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - left mouse / touch: one-finger move\n// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish\n// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move\n\nvar _changeEvent = {\n type: 'change'\n};\nvar _startEvent = {\n type: 'start'\n};\nvar _endEvent = {\n type: 'end'\n};\nvar OrbitControls = /*#__PURE__*/function (_EventDispatcher) {\n _inherits(OrbitControls, _EventDispatcher);\n var _super = _createSuper(OrbitControls);\n function OrbitControls(object, domElement) {\n var _this;\n _classCallCheck(this, OrbitControls);\n _this = _super.call(this);\n _this.object = object;\n _this.domElement = domElement;\n _this.domElement.style.touchAction = 'none'; // disable touch scroll\n\n // Set to false to disable this control\n _this.enabled = true;\n\n // \"target\" sets the location of focus, where the object orbits around\n _this.target = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n // How far you can dolly in and out ( PerspectiveCamera only )\n _this.minDistance = 0;\n _this.maxDistance = Infinity;\n\n // How far you can zoom in and out ( OrthographicCamera only )\n _this.minZoom = 0;\n _this.maxZoom = Infinity;\n\n // How far you can orbit vertically, upper and lower limits.\n // Range is 0 to Math.PI radians.\n _this.minPolarAngle = 0; // radians\n _this.maxPolarAngle = Math.PI; // radians\n\n // How far you can orbit horizontally, upper and lower limits.\n // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )\n _this.minAzimuthAngle = -Infinity; // radians\n _this.maxAzimuthAngle = Infinity; // radians\n\n // Set to true to enable damping (inertia)\n // If damping is enabled, you must call controls.update() in your animation loop\n _this.enableDamping = false;\n _this.dampingFactor = 0.05;\n\n // This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n // Set to false to disable zooming\n _this.enableZoom = true;\n _this.zoomSpeed = 1.0;\n\n // Set to false to disable rotating\n _this.enableRotate = true;\n _this.rotateSpeed = 1.0;\n\n // Set to false to disable panning\n _this.enablePan = true;\n _this.panSpeed = 1.0;\n _this.screenSpacePanning = true; // if false, pan orthogonal to world-space direction camera.up\n _this.keyPanSpeed = 7.0; // pixels moved per arrow key push\n\n // Set to true to automatically rotate around the target\n // If auto-rotate is enabled, you must call controls.update() in your animation loop\n _this.autoRotate = false;\n _this.autoRotateSpeed = 2.0; // 30 seconds per orbit when fps is 60\n\n // The four arrow keys\n _this.keys = {\n LEFT: 'ArrowLeft',\n UP: 'ArrowUp',\n RIGHT: 'ArrowRight',\n BOTTOM: 'ArrowDown'\n };\n\n // Mouse buttons\n _this.mouseButtons = {\n LEFT: three__WEBPACK_IMPORTED_MODULE_0__.MOUSE.ROTATE,\n MIDDLE: three__WEBPACK_IMPORTED_MODULE_0__.MOUSE.DOLLY,\n RIGHT: three__WEBPACK_IMPORTED_MODULE_0__.MOUSE.PAN\n };\n\n // Touch fingers\n _this.touches = {\n ONE: three__WEBPACK_IMPORTED_MODULE_0__.TOUCH.ROTATE,\n TWO: three__WEBPACK_IMPORTED_MODULE_0__.TOUCH.DOLLY_PAN\n };\n\n // for reset\n _this.target0 = _this.target.clone();\n _this.position0 = _this.object.position.clone();\n _this.zoom0 = _this.object.zoom;\n\n // the target DOM element for key events\n _this._domElementKeyEvents = null;\n\n //\n // public methods\n //\n\n _this.getPolarAngle = function () {\n return spherical.phi;\n };\n _this.getAzimuthalAngle = function () {\n return spherical.theta;\n };\n _this.getDistance = function () {\n return this.object.position.distanceTo(this.target);\n };\n _this.listenToKeyEvents = function (domElement) {\n domElement.addEventListener('keydown', onKeyDown);\n this._domElementKeyEvents = domElement;\n };\n _this.stopListenToKeyEvents = function () {\n this._domElementKeyEvents.removeEventListener('keydown', onKeyDown);\n this._domElementKeyEvents = null;\n };\n _this.saveState = function () {\n scope.target0.copy(scope.target);\n scope.position0.copy(scope.object.position);\n scope.zoom0 = scope.object.zoom;\n };\n _this.reset = function () {\n scope.target.copy(scope.target0);\n scope.object.position.copy(scope.position0);\n scope.object.zoom = scope.zoom0;\n scope.object.updateProjectionMatrix();\n scope.dispatchEvent(_changeEvent);\n scope.update();\n state = STATE.NONE;\n };\n\n // this method is exposed, but perhaps it would be better if we can make it private...\n _this.update = function () {\n var offset = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n // so camera.up is the orbit axis\n var quat = new three__WEBPACK_IMPORTED_MODULE_0__.Quaternion().setFromUnitVectors(object.up, new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, 1, 0));\n var quatInverse = quat.clone().invert();\n var lastPosition = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var lastQuaternion = new three__WEBPACK_IMPORTED_MODULE_0__.Quaternion();\n var twoPI = 2 * Math.PI;\n return function update() {\n var position = scope.object.position;\n offset.copy(position).sub(scope.target);\n\n // rotate offset to \"y-axis-is-up\" space\n offset.applyQuaternion(quat);\n\n // angle from z-axis around y-axis\n spherical.setFromVector3(offset);\n if (scope.autoRotate && state === STATE.NONE) {\n rotateLeft(getAutoRotationAngle());\n }\n if (scope.enableDamping) {\n spherical.theta += sphericalDelta.theta * scope.dampingFactor;\n spherical.phi += sphericalDelta.phi * scope.dampingFactor;\n } else {\n spherical.theta += sphericalDelta.theta;\n spherical.phi += sphericalDelta.phi;\n }\n\n // restrict theta to be between desired limits\n\n var min = scope.minAzimuthAngle;\n var max = scope.maxAzimuthAngle;\n if (isFinite(min) && isFinite(max)) {\n if (min < -Math.PI) min += twoPI;else if (min > Math.PI) min -= twoPI;\n if (max < -Math.PI) max += twoPI;else if (max > Math.PI) max -= twoPI;\n if (min <= max) {\n spherical.theta = Math.max(min, Math.min(max, spherical.theta));\n } else {\n spherical.theta = spherical.theta > (min + max) / 2 ? Math.max(min, spherical.theta) : Math.min(max, spherical.theta);\n }\n }\n\n // restrict phi to be between desired limits\n spherical.phi = Math.max(scope.minPolarAngle, Math.min(scope.maxPolarAngle, spherical.phi));\n spherical.makeSafe();\n spherical.radius *= scale;\n\n // restrict radius to be between desired limits\n spherical.radius = Math.max(scope.minDistance, Math.min(scope.maxDistance, spherical.radius));\n\n // move target to panned location\n\n if (scope.enableDamping === true) {\n scope.target.addScaledVector(panOffset, scope.dampingFactor);\n } else {\n scope.target.add(panOffset);\n }\n offset.setFromSpherical(spherical);\n\n // rotate offset back to \"camera-up-vector-is-up\" space\n offset.applyQuaternion(quatInverse);\n position.copy(scope.target).add(offset);\n scope.object.lookAt(scope.target);\n if (scope.enableDamping === true) {\n sphericalDelta.theta *= 1 - scope.dampingFactor;\n sphericalDelta.phi *= 1 - scope.dampingFactor;\n panOffset.multiplyScalar(1 - scope.dampingFactor);\n } else {\n sphericalDelta.set(0, 0, 0);\n panOffset.set(0, 0, 0);\n }\n scale = 1;\n\n // update condition is:\n // min(camera displacement, camera rotation in radians)^2 > EPS\n // using small-angle approximation cos(x/2) = 1 - x^2 / 8\n\n if (zoomChanged || lastPosition.distanceToSquared(scope.object.position) > EPS || 8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS) {\n scope.dispatchEvent(_changeEvent);\n lastPosition.copy(scope.object.position);\n lastQuaternion.copy(scope.object.quaternion);\n zoomChanged = false;\n return true;\n }\n return false;\n };\n }();\n _this.dispose = function () {\n scope.domElement.removeEventListener('contextmenu', onContextMenu);\n scope.domElement.removeEventListener('pointerdown', onPointerDown);\n scope.domElement.removeEventListener('pointercancel', onPointerUp);\n scope.domElement.removeEventListener('wheel', onMouseWheel);\n scope.domElement.removeEventListener('pointermove', onPointerMove);\n scope.domElement.removeEventListener('pointerup', onPointerUp);\n if (scope._domElementKeyEvents !== null) {\n scope._domElementKeyEvents.removeEventListener('keydown', onKeyDown);\n scope._domElementKeyEvents = null;\n }\n\n //scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?\n };\n\n //\n // internals\n //\n\n var scope = _assertThisInitialized(_this);\n var STATE = {\n NONE: -1,\n ROTATE: 0,\n DOLLY: 1,\n PAN: 2,\n TOUCH_ROTATE: 3,\n TOUCH_PAN: 4,\n TOUCH_DOLLY_PAN: 5,\n TOUCH_DOLLY_ROTATE: 6\n };\n var state = STATE.NONE;\n var EPS = 0.000001;\n\n // current position in spherical coordinates\n var spherical = new three__WEBPACK_IMPORTED_MODULE_0__.Spherical();\n var sphericalDelta = new three__WEBPACK_IMPORTED_MODULE_0__.Spherical();\n var scale = 1;\n var panOffset = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var zoomChanged = false;\n var rotateStart = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n var rotateEnd = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n var rotateDelta = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n var panStart = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n var panEnd = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n var panDelta = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n var dollyStart = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n var dollyEnd = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n var dollyDelta = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n var pointers = [];\n var pointerPositions = {};\n function getAutoRotationAngle() {\n return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;\n }\n function getZoomScale() {\n return Math.pow(0.95, scope.zoomSpeed);\n }\n function rotateLeft(angle) {\n sphericalDelta.theta -= angle;\n }\n function rotateUp(angle) {\n sphericalDelta.phi -= angle;\n }\n var panLeft = function () {\n var v = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n return function panLeft(distance, objectMatrix) {\n v.setFromMatrixColumn(objectMatrix, 0); // get X column of objectMatrix\n v.multiplyScalar(-distance);\n panOffset.add(v);\n };\n }();\n var panUp = function () {\n var v = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n return function panUp(distance, objectMatrix) {\n if (scope.screenSpacePanning === true) {\n v.setFromMatrixColumn(objectMatrix, 1);\n } else {\n v.setFromMatrixColumn(objectMatrix, 0);\n v.crossVectors(scope.object.up, v);\n }\n v.multiplyScalar(distance);\n panOffset.add(v);\n };\n }();\n\n // deltaX and deltaY are in pixels; right and down are positive\n var pan = function () {\n var offset = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n return function pan(deltaX, deltaY) {\n var element = scope.domElement;\n if (scope.object.isPerspectiveCamera) {\n // perspective\n var position = scope.object.position;\n offset.copy(position).sub(scope.target);\n var targetDistance = offset.length();\n\n // half of the fov is center to top of screen\n targetDistance *= Math.tan(scope.object.fov / 2 * Math.PI / 180.0);\n\n // we use only clientHeight here so aspect ratio does not distort speed\n panLeft(2 * deltaX * targetDistance / element.clientHeight, scope.object.matrix);\n panUp(2 * deltaY * targetDistance / element.clientHeight, scope.object.matrix);\n } else if (scope.object.isOrthographicCamera) {\n // orthographic\n panLeft(deltaX * (scope.object.right - scope.object.left) / scope.object.zoom / element.clientWidth, scope.object.matrix);\n panUp(deltaY * (scope.object.top - scope.object.bottom) / scope.object.zoom / element.clientHeight, scope.object.matrix);\n } else {\n // camera neither orthographic nor perspective\n console.warn('WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.');\n scope.enablePan = false;\n }\n };\n }();\n function dollyOut(dollyScale) {\n if (scope.object.isPerspectiveCamera) {\n scale /= dollyScale;\n } else if (scope.object.isOrthographicCamera) {\n scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom * dollyScale));\n scope.object.updateProjectionMatrix();\n zoomChanged = true;\n } else {\n console.warn('WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.');\n scope.enableZoom = false;\n }\n }\n function dollyIn(dollyScale) {\n if (scope.object.isPerspectiveCamera) {\n scale *= dollyScale;\n } else if (scope.object.isOrthographicCamera) {\n scope.object.zoom = Math.max(scope.minZoom, Math.min(scope.maxZoom, scope.object.zoom / dollyScale));\n scope.object.updateProjectionMatrix();\n zoomChanged = true;\n } else {\n console.warn('WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.');\n scope.enableZoom = false;\n }\n }\n\n //\n // event callbacks - update the object state\n //\n\n function handleMouseDownRotate(event) {\n rotateStart.set(event.clientX, event.clientY);\n }\n function handleMouseDownDolly(event) {\n dollyStart.set(event.clientX, event.clientY);\n }\n function handleMouseDownPan(event) {\n panStart.set(event.clientX, event.clientY);\n }\n function handleMouseMoveRotate(event) {\n rotateEnd.set(event.clientX, event.clientY);\n rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed);\n var element = scope.domElement;\n rotateLeft(2 * Math.PI * rotateDelta.x / element.clientHeight); // yes, height\n\n rotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight);\n rotateStart.copy(rotateEnd);\n scope.update();\n }\n function handleMouseMoveDolly(event) {\n dollyEnd.set(event.clientX, event.clientY);\n dollyDelta.subVectors(dollyEnd, dollyStart);\n if (dollyDelta.y > 0) {\n dollyOut(getZoomScale());\n } else if (dollyDelta.y < 0) {\n dollyIn(getZoomScale());\n }\n dollyStart.copy(dollyEnd);\n scope.update();\n }\n function handleMouseMovePan(event) {\n panEnd.set(event.clientX, event.clientY);\n panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed);\n pan(panDelta.x, panDelta.y);\n panStart.copy(panEnd);\n scope.update();\n }\n function handleMouseWheel(event) {\n if (event.deltaY < 0) {\n dollyIn(getZoomScale());\n } else if (event.deltaY > 0) {\n dollyOut(getZoomScale());\n }\n scope.update();\n }\n function handleKeyDown(event) {\n var needsUpdate = false;\n switch (event.code) {\n case scope.keys.UP:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n rotateUp(2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight);\n } else {\n pan(0, scope.keyPanSpeed);\n }\n needsUpdate = true;\n break;\n case scope.keys.BOTTOM:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n rotateUp(-2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight);\n } else {\n pan(0, -scope.keyPanSpeed);\n }\n needsUpdate = true;\n break;\n case scope.keys.LEFT:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n rotateLeft(2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight);\n } else {\n pan(scope.keyPanSpeed, 0);\n }\n needsUpdate = true;\n break;\n case scope.keys.RIGHT:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n rotateLeft(-2 * Math.PI * scope.rotateSpeed / scope.domElement.clientHeight);\n } else {\n pan(-scope.keyPanSpeed, 0);\n }\n needsUpdate = true;\n break;\n }\n if (needsUpdate) {\n // prevent the browser from scrolling on cursor keys\n event.preventDefault();\n scope.update();\n }\n }\n function handleTouchStartRotate() {\n if (pointers.length === 1) {\n rotateStart.set(pointers[0].pageX, pointers[0].pageY);\n } else {\n var x = 0.5 * (pointers[0].pageX + pointers[1].pageX);\n var y = 0.5 * (pointers[0].pageY + pointers[1].pageY);\n rotateStart.set(x, y);\n }\n }\n function handleTouchStartPan() {\n if (pointers.length === 1) {\n panStart.set(pointers[0].pageX, pointers[0].pageY);\n } else {\n var x = 0.5 * (pointers[0].pageX + pointers[1].pageX);\n var y = 0.5 * (pointers[0].pageY + pointers[1].pageY);\n panStart.set(x, y);\n }\n }\n function handleTouchStartDolly() {\n var dx = pointers[0].pageX - pointers[1].pageX;\n var dy = pointers[0].pageY - pointers[1].pageY;\n var distance = Math.sqrt(dx * dx + dy * dy);\n dollyStart.set(0, distance);\n }\n function handleTouchStartDollyPan() {\n if (scope.enableZoom) handleTouchStartDolly();\n if (scope.enablePan) handleTouchStartPan();\n }\n function handleTouchStartDollyRotate() {\n if (scope.enableZoom) handleTouchStartDolly();\n if (scope.enableRotate) handleTouchStartRotate();\n }\n function handleTouchMoveRotate(event) {\n if (pointers.length == 1) {\n rotateEnd.set(event.pageX, event.pageY);\n } else {\n var position = getSecondPointerPosition(event);\n var x = 0.5 * (event.pageX + position.x);\n var y = 0.5 * (event.pageY + position.y);\n rotateEnd.set(x, y);\n }\n rotateDelta.subVectors(rotateEnd, rotateStart).multiplyScalar(scope.rotateSpeed);\n var element = scope.domElement;\n rotateLeft(2 * Math.PI * rotateDelta.x / element.clientHeight); // yes, height\n\n rotateUp(2 * Math.PI * rotateDelta.y / element.clientHeight);\n rotateStart.copy(rotateEnd);\n }\n function handleTouchMovePan(event) {\n if (pointers.length === 1) {\n panEnd.set(event.pageX, event.pageY);\n } else {\n var position = getSecondPointerPosition(event);\n var x = 0.5 * (event.pageX + position.x);\n var y = 0.5 * (event.pageY + position.y);\n panEnd.set(x, y);\n }\n panDelta.subVectors(panEnd, panStart).multiplyScalar(scope.panSpeed);\n pan(panDelta.x, panDelta.y);\n panStart.copy(panEnd);\n }\n function handleTouchMoveDolly(event) {\n var position = getSecondPointerPosition(event);\n var dx = event.pageX - position.x;\n var dy = event.pageY - position.y;\n var distance = Math.sqrt(dx * dx + dy * dy);\n dollyEnd.set(0, distance);\n dollyDelta.set(0, Math.pow(dollyEnd.y / dollyStart.y, scope.zoomSpeed));\n dollyOut(dollyDelta.y);\n dollyStart.copy(dollyEnd);\n }\n function handleTouchMoveDollyPan(event) {\n if (scope.enableZoom) handleTouchMoveDolly(event);\n if (scope.enablePan) handleTouchMovePan(event);\n }\n function handleTouchMoveDollyRotate(event) {\n if (scope.enableZoom) handleTouchMoveDolly(event);\n if (scope.enableRotate) handleTouchMoveRotate(event);\n }\n\n //\n // event handlers - FSM: listen for events and reset state\n //\n\n function onPointerDown(event) {\n if (scope.enabled === false) return;\n if (pointers.length === 0) {\n scope.domElement.setPointerCapture(event.pointerId);\n scope.domElement.addEventListener('pointermove', onPointerMove);\n scope.domElement.addEventListener('pointerup', onPointerUp);\n }\n\n //\n\n addPointer(event);\n if (event.pointerType === 'touch') {\n onTouchStart(event);\n } else {\n onMouseDown(event);\n }\n }\n function onPointerMove(event) {\n if (scope.enabled === false) return;\n if (event.pointerType === 'touch') {\n onTouchMove(event);\n } else {\n onMouseMove(event);\n }\n }\n function onPointerUp(event) {\n removePointer(event);\n if (pointers.length === 0) {\n scope.domElement.releasePointerCapture(event.pointerId);\n scope.domElement.removeEventListener('pointermove', onPointerMove);\n scope.domElement.removeEventListener('pointerup', onPointerUp);\n }\n scope.dispatchEvent(_endEvent);\n state = STATE.NONE;\n }\n function onMouseDown(event) {\n var mouseAction;\n switch (event.button) {\n case 0:\n mouseAction = scope.mouseButtons.LEFT;\n break;\n case 1:\n mouseAction = scope.mouseButtons.MIDDLE;\n break;\n case 2:\n mouseAction = scope.mouseButtons.RIGHT;\n break;\n default:\n mouseAction = -1;\n }\n switch (mouseAction) {\n case three__WEBPACK_IMPORTED_MODULE_0__.MOUSE.DOLLY:\n if (scope.enableZoom === false) return;\n handleMouseDownDolly(event);\n state = STATE.DOLLY;\n break;\n case three__WEBPACK_IMPORTED_MODULE_0__.MOUSE.ROTATE:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n if (scope.enablePan === false) return;\n handleMouseDownPan(event);\n state = STATE.PAN;\n } else {\n if (scope.enableRotate === false) return;\n handleMouseDownRotate(event);\n state = STATE.ROTATE;\n }\n break;\n case three__WEBPACK_IMPORTED_MODULE_0__.MOUSE.PAN:\n if (event.ctrlKey || event.metaKey || event.shiftKey) {\n if (scope.enableRotate === false) return;\n handleMouseDownRotate(event);\n state = STATE.ROTATE;\n } else {\n if (scope.enablePan === false) return;\n handleMouseDownPan(event);\n state = STATE.PAN;\n }\n break;\n default:\n state = STATE.NONE;\n }\n if (state !== STATE.NONE) {\n scope.dispatchEvent(_startEvent);\n }\n }\n function onMouseMove(event) {\n switch (state) {\n case STATE.ROTATE:\n if (scope.enableRotate === false) return;\n handleMouseMoveRotate(event);\n break;\n case STATE.DOLLY:\n if (scope.enableZoom === false) return;\n handleMouseMoveDolly(event);\n break;\n case STATE.PAN:\n if (scope.enablePan === false) return;\n handleMouseMovePan(event);\n break;\n }\n }\n function onMouseWheel(event) {\n if (scope.enabled === false || scope.enableZoom === false || state !== STATE.NONE) return;\n event.preventDefault();\n scope.dispatchEvent(_startEvent);\n handleMouseWheel(event);\n scope.dispatchEvent(_endEvent);\n }\n function onKeyDown(event) {\n if (scope.enabled === false || scope.enablePan === false) return;\n handleKeyDown(event);\n }\n function onTouchStart(event) {\n trackPointer(event);\n switch (pointers.length) {\n case 1:\n switch (scope.touches.ONE) {\n case three__WEBPACK_IMPORTED_MODULE_0__.TOUCH.ROTATE:\n if (scope.enableRotate === false) return;\n handleTouchStartRotate();\n state = STATE.TOUCH_ROTATE;\n break;\n case three__WEBPACK_IMPORTED_MODULE_0__.TOUCH.PAN:\n if (scope.enablePan === false) return;\n handleTouchStartPan();\n state = STATE.TOUCH_PAN;\n break;\n default:\n state = STATE.NONE;\n }\n break;\n case 2:\n switch (scope.touches.TWO) {\n case three__WEBPACK_IMPORTED_MODULE_0__.TOUCH.DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false) return;\n handleTouchStartDollyPan();\n state = STATE.TOUCH_DOLLY_PAN;\n break;\n case three__WEBPACK_IMPORTED_MODULE_0__.TOUCH.DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false) return;\n handleTouchStartDollyRotate();\n state = STATE.TOUCH_DOLLY_ROTATE;\n break;\n default:\n state = STATE.NONE;\n }\n break;\n default:\n state = STATE.NONE;\n }\n if (state !== STATE.NONE) {\n scope.dispatchEvent(_startEvent);\n }\n }\n function onTouchMove(event) {\n trackPointer(event);\n switch (state) {\n case STATE.TOUCH_ROTATE:\n if (scope.enableRotate === false) return;\n handleTouchMoveRotate(event);\n scope.update();\n break;\n case STATE.TOUCH_PAN:\n if (scope.enablePan === false) return;\n handleTouchMovePan(event);\n scope.update();\n break;\n case STATE.TOUCH_DOLLY_PAN:\n if (scope.enableZoom === false && scope.enablePan === false) return;\n handleTouchMoveDollyPan(event);\n scope.update();\n break;\n case STATE.TOUCH_DOLLY_ROTATE:\n if (scope.enableZoom === false && scope.enableRotate === false) return;\n handleTouchMoveDollyRotate(event);\n scope.update();\n break;\n default:\n state = STATE.NONE;\n }\n }\n function onContextMenu(event) {\n if (scope.enabled === false) return;\n event.preventDefault();\n }\n function addPointer(event) {\n pointers.push(event);\n }\n function removePointer(event) {\n delete pointerPositions[event.pointerId];\n for (var i = 0; i < pointers.length; i++) {\n if (pointers[i].pointerId == event.pointerId) {\n pointers.splice(i, 1);\n return;\n }\n }\n }\n function trackPointer(event) {\n var position = pointerPositions[event.pointerId];\n if (position === undefined) {\n position = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2();\n pointerPositions[event.pointerId] = position;\n }\n position.set(event.pageX, event.pageY);\n }\n function getSecondPointerPosition(event) {\n var pointer = event.pointerId === pointers[0].pointerId ? pointers[1] : pointers[0];\n return pointerPositions[pointer.pointerId];\n }\n\n //\n\n scope.domElement.addEventListener('contextmenu', onContextMenu);\n scope.domElement.addEventListener('pointerdown', onPointerDown);\n scope.domElement.addEventListener('pointercancel', onPointerUp);\n scope.domElement.addEventListener('wheel', onMouseWheel, {\n passive: false\n });\n\n // force an update at start\n\n _this.update();\n return _this;\n }\n return _createClass(OrbitControls);\n}(three__WEBPACK_IMPORTED_MODULE_0__.EventDispatcher);\n\n\n//# sourceURL=webpack://dgi_3d_viewer/../../../libraries/three/examples/jsm/controls/OrbitControls.js?"); + +/***/ }), + /***/ "../../../libraries/three/examples/jsm/loaders/GLTFLoader.js": /*!*******************************************************************!*\ !*** ../../../libraries/three/examples/jsm/loaders/GLTFLoader.js ***! \*******************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { +"use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"GLTFLoader\": () => (/* binding */ GLTFLoader)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"../../../libraries/three/build/three.module.js\");\n/* harmony import */ var _utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/BufferGeometryUtils.js */ \"../../../libraries/three/examples/jsm/utils/BufferGeometryUtils.js\");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i[\"return\"] && (_r = _i[\"return\"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\nvar GLTFLoader = /*#__PURE__*/function (_Loader) {\n _inherits(GLTFLoader, _Loader);\n var _super = _createSuper(GLTFLoader);\n function GLTFLoader(manager) {\n var _this;\n _classCallCheck(this, GLTFLoader);\n _this = _super.call(this, manager);\n _this.dracoLoader = null;\n _this.ktx2Loader = null;\n _this.meshoptDecoder = null;\n _this.pluginCallbacks = [];\n _this.register(function (parser) {\n return new GLTFMaterialsClearcoatExtension(parser);\n });\n _this.register(function (parser) {\n return new GLTFTextureBasisUExtension(parser);\n });\n _this.register(function (parser) {\n return new GLTFTextureWebPExtension(parser);\n });\n _this.register(function (parser) {\n return new GLTFTextureAVIFExtension(parser);\n });\n _this.register(function (parser) {\n return new GLTFMaterialsSheenExtension(parser);\n });\n _this.register(function (parser) {\n return new GLTFMaterialsTransmissionExtension(parser);\n });\n _this.register(function (parser) {\n return new GLTFMaterialsVolumeExtension(parser);\n });\n _this.register(function (parser) {\n return new GLTFMaterialsIorExtension(parser);\n });\n _this.register(function (parser) {\n return new GLTFMaterialsEmissiveStrengthExtension(parser);\n });\n _this.register(function (parser) {\n return new GLTFMaterialsSpecularExtension(parser);\n });\n _this.register(function (parser) {\n return new GLTFMaterialsIridescenceExtension(parser);\n });\n _this.register(function (parser) {\n return new GLTFLightsExtension(parser);\n });\n _this.register(function (parser) {\n return new GLTFMeshoptCompression(parser);\n });\n _this.register(function (parser) {\n return new GLTFMeshGpuInstancing(parser);\n });\n return _this;\n }\n _createClass(GLTFLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n var scope = this;\n var resourcePath;\n if (this.resourcePath !== '') {\n resourcePath = this.resourcePath;\n } else if (this.path !== '') {\n resourcePath = this.path;\n } else {\n resourcePath = three__WEBPACK_IMPORTED_MODULE_0__.LoaderUtils.extractUrlBase(url);\n }\n\n // Tells the LoadingManager to track an extra item, which resolves after\n // the model is fully loaded. This means the count of items loaded will\n // be incorrect, but ensures manager.onLoad() does not fire early.\n this.manager.itemStart(url);\n var _onError = function _onError(e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n scope.manager.itemEnd(url);\n };\n var loader = new three__WEBPACK_IMPORTED_MODULE_0__.FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setResponseType('arraybuffer');\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function (data) {\n try {\n scope.parse(data, resourcePath, function (gltf) {\n onLoad(gltf);\n scope.manager.itemEnd(url);\n }, _onError);\n } catch (e) {\n _onError(e);\n }\n }, onProgress, _onError);\n }\n }, {\n key: \"setDRACOLoader\",\n value: function setDRACOLoader(dracoLoader) {\n this.dracoLoader = dracoLoader;\n return this;\n }\n }, {\n key: \"setDDSLoader\",\n value: function setDDSLoader() {\n throw new Error('THREE.GLTFLoader: \"MSFT_texture_dds\" no longer supported. Please update to \"KHR_texture_basisu\".');\n }\n }, {\n key: \"setKTX2Loader\",\n value: function setKTX2Loader(ktx2Loader) {\n this.ktx2Loader = ktx2Loader;\n return this;\n }\n }, {\n key: \"setMeshoptDecoder\",\n value: function setMeshoptDecoder(meshoptDecoder) {\n this.meshoptDecoder = meshoptDecoder;\n return this;\n }\n }, {\n key: \"register\",\n value: function register(callback) {\n if (this.pluginCallbacks.indexOf(callback) === -1) {\n this.pluginCallbacks.push(callback);\n }\n return this;\n }\n }, {\n key: \"unregister\",\n value: function unregister(callback) {\n if (this.pluginCallbacks.indexOf(callback) !== -1) {\n this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1);\n }\n return this;\n }\n }, {\n key: \"parse\",\n value: function parse(data, path, onLoad, onError) {\n var json;\n var extensions = {};\n var plugins = {};\n var textDecoder = new TextDecoder();\n if (typeof data === 'string') {\n json = JSON.parse(data);\n } else if (data instanceof ArrayBuffer) {\n var magic = textDecoder.decode(new Uint8Array(data, 0, 4));\n if (magic === BINARY_EXTENSION_HEADER_MAGIC) {\n try {\n extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data);\n } catch (error) {\n if (onError) onError(error);\n return;\n }\n json = JSON.parse(extensions[EXTENSIONS.KHR_BINARY_GLTF].content);\n } else {\n json = JSON.parse(textDecoder.decode(data));\n }\n } else {\n json = data;\n }\n if (json.asset === undefined || json.asset.version[0] < 2) {\n if (onError) onError(new Error('THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.'));\n return;\n }\n var parser = new GLTFParser(json, {\n path: path || this.resourcePath || '',\n crossOrigin: this.crossOrigin,\n requestHeader: this.requestHeader,\n manager: this.manager,\n ktx2Loader: this.ktx2Loader,\n meshoptDecoder: this.meshoptDecoder\n });\n parser.fileLoader.setRequestHeader(this.requestHeader);\n for (var i = 0; i < this.pluginCallbacks.length; i++) {\n var plugin = this.pluginCallbacks[i](parser);\n plugins[plugin.name] = plugin;\n\n // Workaround to avoid determining as unknown extension\n // in addUnknownExtensionsToUserData().\n // Remove this workaround if we move all the existing\n // extension handlers to plugin system\n extensions[plugin.name] = true;\n }\n if (json.extensionsUsed) {\n for (var _i = 0; _i < json.extensionsUsed.length; ++_i) {\n var extensionName = json.extensionsUsed[_i];\n var extensionsRequired = json.extensionsRequired || [];\n switch (extensionName) {\n case EXTENSIONS.KHR_MATERIALS_UNLIT:\n extensions[extensionName] = new GLTFMaterialsUnlitExtension();\n break;\n case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:\n extensions[extensionName] = new GLTFDracoMeshCompressionExtension(json, this.dracoLoader);\n break;\n case EXTENSIONS.KHR_TEXTURE_TRANSFORM:\n extensions[extensionName] = new GLTFTextureTransformExtension();\n break;\n case EXTENSIONS.KHR_MESH_QUANTIZATION:\n extensions[extensionName] = new GLTFMeshQuantizationExtension();\n break;\n default:\n if (extensionsRequired.indexOf(extensionName) >= 0 && plugins[extensionName] === undefined) {\n console.warn('THREE.GLTFLoader: Unknown extension \"' + extensionName + '\".');\n }\n }\n }\n }\n parser.setExtensions(extensions);\n parser.setPlugins(plugins);\n parser.parse(onLoad, onError);\n }\n }, {\n key: \"parseAsync\",\n value: function parseAsync(data, path) {\n var scope = this;\n return new Promise(function (resolve, reject) {\n scope.parse(data, path, resolve, reject);\n });\n }\n }]);\n return GLTFLoader;\n}(three__WEBPACK_IMPORTED_MODULE_0__.Loader);\n/* GLTFREGISTRY */\nfunction GLTFRegistry() {\n var objects = {};\n return {\n get: function get(key) {\n return objects[key];\n },\n add: function add(key, object) {\n objects[key] = object;\n },\n remove: function remove(key) {\n delete objects[key];\n },\n removeAll: function removeAll() {\n objects = {};\n }\n };\n}\n\n/*********************************/\n/********** EXTENSIONS ***********/\n/*********************************/\n\nvar EXTENSIONS = {\n KHR_BINARY_GLTF: 'KHR_binary_glTF',\n KHR_DRACO_MESH_COMPRESSION: 'KHR_draco_mesh_compression',\n KHR_LIGHTS_PUNCTUAL: 'KHR_lights_punctual',\n KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',\n KHR_MATERIALS_IOR: 'KHR_materials_ior',\n KHR_MATERIALS_SHEEN: 'KHR_materials_sheen',\n KHR_MATERIALS_SPECULAR: 'KHR_materials_specular',\n KHR_MATERIALS_TRANSMISSION: 'KHR_materials_transmission',\n KHR_MATERIALS_IRIDESCENCE: 'KHR_materials_iridescence',\n KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',\n KHR_MATERIALS_VOLUME: 'KHR_materials_volume',\n KHR_TEXTURE_BASISU: 'KHR_texture_basisu',\n KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',\n KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',\n KHR_MATERIALS_EMISSIVE_STRENGTH: 'KHR_materials_emissive_strength',\n EXT_TEXTURE_WEBP: 'EXT_texture_webp',\n EXT_TEXTURE_AVIF: 'EXT_texture_avif',\n EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression',\n EXT_MESH_GPU_INSTANCING: 'EXT_mesh_gpu_instancing'\n};\n\n/**\n * Punctual Lights Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual\n */\nvar GLTFLightsExtension = /*#__PURE__*/function () {\n function GLTFLightsExtension(parser) {\n _classCallCheck(this, GLTFLightsExtension);\n this.parser = parser;\n this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL;\n\n // Object3D instance caches\n this.cache = {\n refs: {},\n uses: {}\n };\n }\n _createClass(GLTFLightsExtension, [{\n key: \"_markDefs\",\n value: function _markDefs() {\n var parser = this.parser;\n var nodeDefs = this.parser.json.nodes || [];\n for (var nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {\n var nodeDef = nodeDefs[nodeIndex];\n if (nodeDef.extensions && nodeDef.extensions[this.name] && nodeDef.extensions[this.name].light !== undefined) {\n parser._addNodeRef(this.cache, nodeDef.extensions[this.name].light);\n }\n }\n }\n }, {\n key: \"_loadLight\",\n value: function _loadLight(lightIndex) {\n var parser = this.parser;\n var cacheKey = 'light:' + lightIndex;\n var dependency = parser.cache.get(cacheKey);\n if (dependency) return dependency;\n var json = parser.json;\n var extensions = json.extensions && json.extensions[this.name] || {};\n var lightDefs = extensions.lights || [];\n var lightDef = lightDefs[lightIndex];\n var lightNode;\n var color = new three__WEBPACK_IMPORTED_MODULE_0__.Color(0xffffff);\n if (lightDef.color !== undefined) color.fromArray(lightDef.color);\n var range = lightDef.range !== undefined ? lightDef.range : 0;\n switch (lightDef.type) {\n case 'directional':\n lightNode = new three__WEBPACK_IMPORTED_MODULE_0__.DirectionalLight(color);\n lightNode.target.position.set(0, 0, -1);\n lightNode.add(lightNode.target);\n break;\n case 'point':\n lightNode = new three__WEBPACK_IMPORTED_MODULE_0__.PointLight(color);\n lightNode.distance = range;\n break;\n case 'spot':\n lightNode = new three__WEBPACK_IMPORTED_MODULE_0__.SpotLight(color);\n lightNode.distance = range;\n // Handle spotlight properties.\n lightDef.spot = lightDef.spot || {};\n lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle : 0;\n lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;\n lightNode.angle = lightDef.spot.outerConeAngle;\n lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;\n lightNode.target.position.set(0, 0, -1);\n lightNode.add(lightNode.target);\n break;\n default:\n throw new Error('THREE.GLTFLoader: Unexpected light type: ' + lightDef.type);\n }\n\n // Some lights (e.g. spot) default to a position other than the origin. Reset the position\n // here, because node-level parsing will only override position if explicitly specified.\n lightNode.position.set(0, 0, 0);\n lightNode.decay = 2;\n assignExtrasToUserData(lightNode, lightDef);\n if (lightDef.intensity !== undefined) lightNode.intensity = lightDef.intensity;\n lightNode.name = parser.createUniqueName(lightDef.name || 'light_' + lightIndex);\n dependency = Promise.resolve(lightNode);\n parser.cache.add(cacheKey, dependency);\n return dependency;\n }\n }, {\n key: \"getDependency\",\n value: function getDependency(type, index) {\n if (type !== 'light') return;\n return this._loadLight(index);\n }\n }, {\n key: \"createNodeAttachment\",\n value: function createNodeAttachment(nodeIndex) {\n var self = this;\n var parser = this.parser;\n var json = parser.json;\n var nodeDef = json.nodes[nodeIndex];\n var lightDef = nodeDef.extensions && nodeDef.extensions[this.name] || {};\n var lightIndex = lightDef.light;\n if (lightIndex === undefined) return null;\n return this._loadLight(lightIndex).then(function (light) {\n return parser._getNodeRef(self.cache, lightIndex, light);\n });\n }\n }]);\n return GLTFLightsExtension;\n}();\n/**\n * Unlit Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit\n */\nvar GLTFMaterialsUnlitExtension = /*#__PURE__*/function () {\n function GLTFMaterialsUnlitExtension() {\n _classCallCheck(this, GLTFMaterialsUnlitExtension);\n this.name = EXTENSIONS.KHR_MATERIALS_UNLIT;\n }\n _createClass(GLTFMaterialsUnlitExtension, [{\n key: \"getMaterialType\",\n value: function getMaterialType() {\n return three__WEBPACK_IMPORTED_MODULE_0__.MeshBasicMaterial;\n }\n }, {\n key: \"extendParams\",\n value: function extendParams(materialParams, materialDef, parser) {\n var pending = [];\n materialParams.color = new three__WEBPACK_IMPORTED_MODULE_0__.Color(1.0, 1.0, 1.0);\n materialParams.opacity = 1.0;\n var metallicRoughness = materialDef.pbrMetallicRoughness;\n if (metallicRoughness) {\n if (Array.isArray(metallicRoughness.baseColorFactor)) {\n var array = metallicRoughness.baseColorFactor;\n materialParams.color.fromArray(array);\n materialParams.opacity = array[3];\n }\n if (metallicRoughness.baseColorTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture, three__WEBPACK_IMPORTED_MODULE_0__.sRGBEncoding));\n }\n }\n return Promise.all(pending);\n }\n }]);\n return GLTFMaterialsUnlitExtension;\n}();\n/**\n * Materials Emissive Strength Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/blob/5768b3ce0ef32bc39cdf1bef10b948586635ead3/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md\n */\nvar GLTFMaterialsEmissiveStrengthExtension = /*#__PURE__*/function () {\n function GLTFMaterialsEmissiveStrengthExtension(parser) {\n _classCallCheck(this, GLTFMaterialsEmissiveStrengthExtension);\n this.parser = parser;\n this.name = EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH;\n }\n _createClass(GLTFMaterialsEmissiveStrengthExtension, [{\n key: \"extendMaterialParams\",\n value: function extendMaterialParams(materialIndex, materialParams) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n var emissiveStrength = materialDef.extensions[this.name].emissiveStrength;\n if (emissiveStrength !== undefined) {\n materialParams.emissiveIntensity = emissiveStrength;\n }\n return Promise.resolve();\n }\n }]);\n return GLTFMaterialsEmissiveStrengthExtension;\n}();\n/**\n * Clearcoat Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat\n */\nvar GLTFMaterialsClearcoatExtension = /*#__PURE__*/function () {\n function GLTFMaterialsClearcoatExtension(parser) {\n _classCallCheck(this, GLTFMaterialsClearcoatExtension);\n this.parser = parser;\n this.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT;\n }\n _createClass(GLTFMaterialsClearcoatExtension, [{\n key: \"getMaterialType\",\n value: function getMaterialType(materialIndex) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return three__WEBPACK_IMPORTED_MODULE_0__.MeshPhysicalMaterial;\n }\n }, {\n key: \"extendMaterialParams\",\n value: function extendMaterialParams(materialIndex, materialParams) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n var pending = [];\n var extension = materialDef.extensions[this.name];\n if (extension.clearcoatFactor !== undefined) {\n materialParams.clearcoat = extension.clearcoatFactor;\n }\n if (extension.clearcoatTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'clearcoatMap', extension.clearcoatTexture));\n }\n if (extension.clearcoatRoughnessFactor !== undefined) {\n materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor;\n }\n if (extension.clearcoatRoughnessTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'clearcoatRoughnessMap', extension.clearcoatRoughnessTexture));\n }\n if (extension.clearcoatNormalTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'clearcoatNormalMap', extension.clearcoatNormalTexture));\n if (extension.clearcoatNormalTexture.scale !== undefined) {\n var scale = extension.clearcoatNormalTexture.scale;\n materialParams.clearcoatNormalScale = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(scale, scale);\n }\n }\n return Promise.all(pending);\n }\n }]);\n return GLTFMaterialsClearcoatExtension;\n}();\n/**\n * Iridescence Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_iridescence\n */\nvar GLTFMaterialsIridescenceExtension = /*#__PURE__*/function () {\n function GLTFMaterialsIridescenceExtension(parser) {\n _classCallCheck(this, GLTFMaterialsIridescenceExtension);\n this.parser = parser;\n this.name = EXTENSIONS.KHR_MATERIALS_IRIDESCENCE;\n }\n _createClass(GLTFMaterialsIridescenceExtension, [{\n key: \"getMaterialType\",\n value: function getMaterialType(materialIndex) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return three__WEBPACK_IMPORTED_MODULE_0__.MeshPhysicalMaterial;\n }\n }, {\n key: \"extendMaterialParams\",\n value: function extendMaterialParams(materialIndex, materialParams) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n var pending = [];\n var extension = materialDef.extensions[this.name];\n if (extension.iridescenceFactor !== undefined) {\n materialParams.iridescence = extension.iridescenceFactor;\n }\n if (extension.iridescenceTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'iridescenceMap', extension.iridescenceTexture));\n }\n if (extension.iridescenceIor !== undefined) {\n materialParams.iridescenceIOR = extension.iridescenceIor;\n }\n if (materialParams.iridescenceThicknessRange === undefined) {\n materialParams.iridescenceThicknessRange = [100, 400];\n }\n if (extension.iridescenceThicknessMinimum !== undefined) {\n materialParams.iridescenceThicknessRange[0] = extension.iridescenceThicknessMinimum;\n }\n if (extension.iridescenceThicknessMaximum !== undefined) {\n materialParams.iridescenceThicknessRange[1] = extension.iridescenceThicknessMaximum;\n }\n if (extension.iridescenceThicknessTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'iridescenceThicknessMap', extension.iridescenceThicknessTexture));\n }\n return Promise.all(pending);\n }\n }]);\n return GLTFMaterialsIridescenceExtension;\n}();\n/**\n * Sheen Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen\n */\nvar GLTFMaterialsSheenExtension = /*#__PURE__*/function () {\n function GLTFMaterialsSheenExtension(parser) {\n _classCallCheck(this, GLTFMaterialsSheenExtension);\n this.parser = parser;\n this.name = EXTENSIONS.KHR_MATERIALS_SHEEN;\n }\n _createClass(GLTFMaterialsSheenExtension, [{\n key: \"getMaterialType\",\n value: function getMaterialType(materialIndex) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return three__WEBPACK_IMPORTED_MODULE_0__.MeshPhysicalMaterial;\n }\n }, {\n key: \"extendMaterialParams\",\n value: function extendMaterialParams(materialIndex, materialParams) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n var pending = [];\n materialParams.sheenColor = new three__WEBPACK_IMPORTED_MODULE_0__.Color(0, 0, 0);\n materialParams.sheenRoughness = 0;\n materialParams.sheen = 1;\n var extension = materialDef.extensions[this.name];\n if (extension.sheenColorFactor !== undefined) {\n materialParams.sheenColor.fromArray(extension.sheenColorFactor);\n }\n if (extension.sheenRoughnessFactor !== undefined) {\n materialParams.sheenRoughness = extension.sheenRoughnessFactor;\n }\n if (extension.sheenColorTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'sheenColorMap', extension.sheenColorTexture, three__WEBPACK_IMPORTED_MODULE_0__.sRGBEncoding));\n }\n if (extension.sheenRoughnessTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'sheenRoughnessMap', extension.sheenRoughnessTexture));\n }\n return Promise.all(pending);\n }\n }]);\n return GLTFMaterialsSheenExtension;\n}();\n/**\n * Transmission Materials Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission\n * Draft: https://github.com/KhronosGroup/glTF/pull/1698\n */\nvar GLTFMaterialsTransmissionExtension = /*#__PURE__*/function () {\n function GLTFMaterialsTransmissionExtension(parser) {\n _classCallCheck(this, GLTFMaterialsTransmissionExtension);\n this.parser = parser;\n this.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION;\n }\n _createClass(GLTFMaterialsTransmissionExtension, [{\n key: \"getMaterialType\",\n value: function getMaterialType(materialIndex) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return three__WEBPACK_IMPORTED_MODULE_0__.MeshPhysicalMaterial;\n }\n }, {\n key: \"extendMaterialParams\",\n value: function extendMaterialParams(materialIndex, materialParams) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n var pending = [];\n var extension = materialDef.extensions[this.name];\n if (extension.transmissionFactor !== undefined) {\n materialParams.transmission = extension.transmissionFactor;\n }\n if (extension.transmissionTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'transmissionMap', extension.transmissionTexture));\n }\n return Promise.all(pending);\n }\n }]);\n return GLTFMaterialsTransmissionExtension;\n}();\n/**\n * Materials Volume Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_volume\n */\nvar GLTFMaterialsVolumeExtension = /*#__PURE__*/function () {\n function GLTFMaterialsVolumeExtension(parser) {\n _classCallCheck(this, GLTFMaterialsVolumeExtension);\n this.parser = parser;\n this.name = EXTENSIONS.KHR_MATERIALS_VOLUME;\n }\n _createClass(GLTFMaterialsVolumeExtension, [{\n key: \"getMaterialType\",\n value: function getMaterialType(materialIndex) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return three__WEBPACK_IMPORTED_MODULE_0__.MeshPhysicalMaterial;\n }\n }, {\n key: \"extendMaterialParams\",\n value: function extendMaterialParams(materialIndex, materialParams) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n var pending = [];\n var extension = materialDef.extensions[this.name];\n materialParams.thickness = extension.thicknessFactor !== undefined ? extension.thicknessFactor : 0;\n if (extension.thicknessTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'thicknessMap', extension.thicknessTexture));\n }\n materialParams.attenuationDistance = extension.attenuationDistance || Infinity;\n var colorArray = extension.attenuationColor || [1, 1, 1];\n materialParams.attenuationColor = new three__WEBPACK_IMPORTED_MODULE_0__.Color(colorArray[0], colorArray[1], colorArray[2]);\n return Promise.all(pending);\n }\n }]);\n return GLTFMaterialsVolumeExtension;\n}();\n/**\n * Materials ior Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior\n */\nvar GLTFMaterialsIorExtension = /*#__PURE__*/function () {\n function GLTFMaterialsIorExtension(parser) {\n _classCallCheck(this, GLTFMaterialsIorExtension);\n this.parser = parser;\n this.name = EXTENSIONS.KHR_MATERIALS_IOR;\n }\n _createClass(GLTFMaterialsIorExtension, [{\n key: \"getMaterialType\",\n value: function getMaterialType(materialIndex) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return three__WEBPACK_IMPORTED_MODULE_0__.MeshPhysicalMaterial;\n }\n }, {\n key: \"extendMaterialParams\",\n value: function extendMaterialParams(materialIndex, materialParams) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n var extension = materialDef.extensions[this.name];\n materialParams.ior = extension.ior !== undefined ? extension.ior : 1.5;\n return Promise.resolve();\n }\n }]);\n return GLTFMaterialsIorExtension;\n}();\n/**\n * Materials specular Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular\n */\nvar GLTFMaterialsSpecularExtension = /*#__PURE__*/function () {\n function GLTFMaterialsSpecularExtension(parser) {\n _classCallCheck(this, GLTFMaterialsSpecularExtension);\n this.parser = parser;\n this.name = EXTENSIONS.KHR_MATERIALS_SPECULAR;\n }\n _createClass(GLTFMaterialsSpecularExtension, [{\n key: \"getMaterialType\",\n value: function getMaterialType(materialIndex) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;\n return three__WEBPACK_IMPORTED_MODULE_0__.MeshPhysicalMaterial;\n }\n }, {\n key: \"extendMaterialParams\",\n value: function extendMaterialParams(materialIndex, materialParams) {\n var parser = this.parser;\n var materialDef = parser.json.materials[materialIndex];\n if (!materialDef.extensions || !materialDef.extensions[this.name]) {\n return Promise.resolve();\n }\n var pending = [];\n var extension = materialDef.extensions[this.name];\n materialParams.specularIntensity = extension.specularFactor !== undefined ? extension.specularFactor : 1.0;\n if (extension.specularTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'specularIntensityMap', extension.specularTexture));\n }\n var colorArray = extension.specularColorFactor || [1, 1, 1];\n materialParams.specularColor = new three__WEBPACK_IMPORTED_MODULE_0__.Color(colorArray[0], colorArray[1], colorArray[2]);\n if (extension.specularColorTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'specularColorMap', extension.specularColorTexture, three__WEBPACK_IMPORTED_MODULE_0__.sRGBEncoding));\n }\n return Promise.all(pending);\n }\n }]);\n return GLTFMaterialsSpecularExtension;\n}();\n/**\n * BasisU Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu\n */\nvar GLTFTextureBasisUExtension = /*#__PURE__*/function () {\n function GLTFTextureBasisUExtension(parser) {\n _classCallCheck(this, GLTFTextureBasisUExtension);\n this.parser = parser;\n this.name = EXTENSIONS.KHR_TEXTURE_BASISU;\n }\n _createClass(GLTFTextureBasisUExtension, [{\n key: \"loadTexture\",\n value: function loadTexture(textureIndex) {\n var parser = this.parser;\n var json = parser.json;\n var textureDef = json.textures[textureIndex];\n if (!textureDef.extensions || !textureDef.extensions[this.name]) {\n return null;\n }\n var extension = textureDef.extensions[this.name];\n var loader = parser.options.ktx2Loader;\n if (!loader) {\n if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {\n throw new Error('THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures');\n } else {\n // Assumes that the extension is optional and that a fallback texture is present\n return null;\n }\n }\n return parser.loadTextureImage(textureIndex, extension.source, loader);\n }\n }]);\n return GLTFTextureBasisUExtension;\n}();\n/**\n * WebP Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_webp\n */\nvar GLTFTextureWebPExtension = /*#__PURE__*/function () {\n function GLTFTextureWebPExtension(parser) {\n _classCallCheck(this, GLTFTextureWebPExtension);\n this.parser = parser;\n this.name = EXTENSIONS.EXT_TEXTURE_WEBP;\n this.isSupported = null;\n }\n _createClass(GLTFTextureWebPExtension, [{\n key: \"loadTexture\",\n value: function loadTexture(textureIndex) {\n var name = this.name;\n var parser = this.parser;\n var json = parser.json;\n var textureDef = json.textures[textureIndex];\n if (!textureDef.extensions || !textureDef.extensions[name]) {\n return null;\n }\n var extension = textureDef.extensions[name];\n var source = json.images[extension.source];\n var loader = parser.textureLoader;\n if (source.uri) {\n var handler = parser.options.manager.getHandler(source.uri);\n if (handler !== null) loader = handler;\n }\n return this.detectSupport().then(function (isSupported) {\n if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader);\n if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {\n throw new Error('THREE.GLTFLoader: WebP required by asset but unsupported.');\n }\n\n // Fall back to PNG or JPEG.\n return parser.loadTexture(textureIndex);\n });\n }\n }, {\n key: \"detectSupport\",\n value: function detectSupport() {\n if (!this.isSupported) {\n this.isSupported = new Promise(function (resolve) {\n var image = new Image();\n\n // Lossy test image. Support for lossy images doesn't guarantee support for all\n // WebP images, unfortunately.\n image.src = 'data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';\n image.onload = image.onerror = function () {\n resolve(image.height === 1);\n };\n });\n }\n return this.isSupported;\n }\n }]);\n return GLTFTextureWebPExtension;\n}();\n/**\n * AVIF Texture Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_avif\n */\nvar GLTFTextureAVIFExtension = /*#__PURE__*/function () {\n function GLTFTextureAVIFExtension(parser) {\n _classCallCheck(this, GLTFTextureAVIFExtension);\n this.parser = parser;\n this.name = EXTENSIONS.EXT_TEXTURE_AVIF;\n this.isSupported = null;\n }\n _createClass(GLTFTextureAVIFExtension, [{\n key: \"loadTexture\",\n value: function loadTexture(textureIndex) {\n var name = this.name;\n var parser = this.parser;\n var json = parser.json;\n var textureDef = json.textures[textureIndex];\n if (!textureDef.extensions || !textureDef.extensions[name]) {\n return null;\n }\n var extension = textureDef.extensions[name];\n var source = json.images[extension.source];\n var loader = parser.textureLoader;\n if (source.uri) {\n var handler = parser.options.manager.getHandler(source.uri);\n if (handler !== null) loader = handler;\n }\n return this.detectSupport().then(function (isSupported) {\n if (isSupported) return parser.loadTextureImage(textureIndex, extension.source, loader);\n if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {\n throw new Error('THREE.GLTFLoader: AVIF required by asset but unsupported.');\n }\n\n // Fall back to PNG or JPEG.\n return parser.loadTexture(textureIndex);\n });\n }\n }, {\n key: \"detectSupport\",\n value: function detectSupport() {\n if (!this.isSupported) {\n this.isSupported = new Promise(function (resolve) {\n var image = new Image();\n\n // Lossy test image.\n image.src = 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=';\n image.onload = image.onerror = function () {\n resolve(image.height === 1);\n };\n });\n }\n return this.isSupported;\n }\n }]);\n return GLTFTextureAVIFExtension;\n}();\n/**\n * meshopt BufferView Compression Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression\n */\nvar GLTFMeshoptCompression = /*#__PURE__*/function () {\n function GLTFMeshoptCompression(parser) {\n _classCallCheck(this, GLTFMeshoptCompression);\n this.name = EXTENSIONS.EXT_MESHOPT_COMPRESSION;\n this.parser = parser;\n }\n _createClass(GLTFMeshoptCompression, [{\n key: \"loadBufferView\",\n value: function loadBufferView(index) {\n var json = this.parser.json;\n var bufferView = json.bufferViews[index];\n if (bufferView.extensions && bufferView.extensions[this.name]) {\n var extensionDef = bufferView.extensions[this.name];\n var buffer = this.parser.getDependency('buffer', extensionDef.buffer);\n var decoder = this.parser.options.meshoptDecoder;\n if (!decoder || !decoder.supported) {\n if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {\n throw new Error('THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files');\n } else {\n // Assumes that the extension is optional and that fallback buffer data is present\n return null;\n }\n }\n return buffer.then(function (res) {\n var byteOffset = extensionDef.byteOffset || 0;\n var byteLength = extensionDef.byteLength || 0;\n var count = extensionDef.count;\n var stride = extensionDef.byteStride;\n var source = new Uint8Array(res, byteOffset, byteLength);\n if (decoder.decodeGltfBufferAsync) {\n return decoder.decodeGltfBufferAsync(count, stride, source, extensionDef.mode, extensionDef.filter).then(function (res) {\n return res.buffer;\n });\n } else {\n // Support for MeshoptDecoder 0.18 or earlier, without decodeGltfBufferAsync\n return decoder.ready.then(function () {\n var result = new ArrayBuffer(count * stride);\n decoder.decodeGltfBuffer(new Uint8Array(result), count, stride, source, extensionDef.mode, extensionDef.filter);\n return result;\n });\n }\n });\n } else {\n return null;\n }\n }\n }]);\n return GLTFMeshoptCompression;\n}();\n/**\n * GPU Instancing Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_mesh_gpu_instancing\n *\n */\nvar GLTFMeshGpuInstancing = /*#__PURE__*/function () {\n function GLTFMeshGpuInstancing(parser) {\n _classCallCheck(this, GLTFMeshGpuInstancing);\n this.name = EXTENSIONS.EXT_MESH_GPU_INSTANCING;\n this.parser = parser;\n }\n _createClass(GLTFMeshGpuInstancing, [{\n key: \"createNodeMesh\",\n value: function createNodeMesh(nodeIndex) {\n var _this2 = this;\n var json = this.parser.json;\n var nodeDef = json.nodes[nodeIndex];\n if (!nodeDef.extensions || !nodeDef.extensions[this.name] || nodeDef.mesh === undefined) {\n return null;\n }\n var meshDef = json.meshes[nodeDef.mesh];\n\n // No Points or Lines + Instancing support yet\n var _iterator = _createForOfIteratorHelper(meshDef.primitives),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var primitive = _step.value;\n if (primitive.mode !== WEBGL_CONSTANTS.TRIANGLES && primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_STRIP && primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_FAN && primitive.mode !== undefined) {\n return null;\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n var extensionDef = nodeDef.extensions[this.name];\n var attributesDef = extensionDef.attributes;\n\n // @TODO: Can we support InstancedMesh + SkinnedMesh?\n\n var pending = [];\n var attributes = {};\n var _loop = function _loop(key) {\n pending.push(_this2.parser.getDependency('accessor', attributesDef[key]).then(function (accessor) {\n attributes[key] = accessor;\n return attributes[key];\n }));\n };\n for (var key in attributesDef) {\n _loop(key);\n }\n if (pending.length < 1) {\n return null;\n }\n pending.push(this.parser.createNodeMesh(nodeIndex));\n return Promise.all(pending).then(function (results) {\n var nodeObject = results.pop();\n var meshes = nodeObject.isGroup ? nodeObject.children : [nodeObject];\n var count = results[0].count; // All attribute counts should be same\n var instancedMeshes = [];\n var _iterator2 = _createForOfIteratorHelper(meshes),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var mesh = _step2.value;\n // Temporal variables\n var m = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4();\n var p = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var q = new three__WEBPACK_IMPORTED_MODULE_0__.Quaternion();\n var s = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(1, 1, 1);\n var instancedMesh = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedMesh(mesh.geometry, mesh.material, count);\n for (var i = 0; i < count; i++) {\n if (attributes.TRANSLATION) {\n p.fromBufferAttribute(attributes.TRANSLATION, i);\n }\n if (attributes.ROTATION) {\n q.fromBufferAttribute(attributes.ROTATION, i);\n }\n if (attributes.SCALE) {\n s.fromBufferAttribute(attributes.SCALE, i);\n }\n instancedMesh.setMatrixAt(i, m.compose(p, q, s));\n }\n\n // Add instance attributes to the geometry, excluding TRS.\n for (var attributeName in attributes) {\n if (attributeName !== 'TRANSLATION' && attributeName !== 'ROTATION' && attributeName !== 'SCALE') {\n mesh.geometry.setAttribute(attributeName, attributes[attributeName]);\n }\n }\n\n // Just in case\n three__WEBPACK_IMPORTED_MODULE_0__.Object3D.prototype.copy.call(instancedMesh, mesh);\n _this2.parser.assignFinalMaterial(instancedMesh);\n instancedMeshes.push(instancedMesh);\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n if (nodeObject.isGroup) {\n nodeObject.clear();\n nodeObject.add.apply(nodeObject, instancedMeshes);\n return nodeObject;\n }\n return instancedMeshes[0];\n });\n }\n }]);\n return GLTFMeshGpuInstancing;\n}();\n/* BINARY EXTENSION */\nvar BINARY_EXTENSION_HEADER_MAGIC = 'glTF';\nvar BINARY_EXTENSION_HEADER_LENGTH = 12;\nvar BINARY_EXTENSION_CHUNK_TYPES = {\n JSON: 0x4E4F534A,\n BIN: 0x004E4942\n};\nvar GLTFBinaryExtension = /*#__PURE__*/_createClass(function GLTFBinaryExtension(data) {\n _classCallCheck(this, GLTFBinaryExtension);\n this.name = EXTENSIONS.KHR_BINARY_GLTF;\n this.content = null;\n this.body = null;\n var headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH);\n var textDecoder = new TextDecoder();\n this.header = {\n magic: textDecoder.decode(new Uint8Array(data.slice(0, 4))),\n version: headerView.getUint32(4, true),\n length: headerView.getUint32(8, true)\n };\n if (this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC) {\n throw new Error('THREE.GLTFLoader: Unsupported glTF-Binary header.');\n } else if (this.header.version < 2.0) {\n throw new Error('THREE.GLTFLoader: Legacy binary file detected.');\n }\n var chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH;\n var chunkView = new DataView(data, BINARY_EXTENSION_HEADER_LENGTH);\n var chunkIndex = 0;\n while (chunkIndex < chunkContentsLength) {\n var chunkLength = chunkView.getUint32(chunkIndex, true);\n chunkIndex += 4;\n var chunkType = chunkView.getUint32(chunkIndex, true);\n chunkIndex += 4;\n if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) {\n var contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength);\n this.content = textDecoder.decode(contentArray);\n } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) {\n var byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;\n this.body = data.slice(byteOffset, byteOffset + chunkLength);\n }\n\n // Clients must ignore chunks with unknown types.\n\n chunkIndex += chunkLength;\n }\n if (this.content === null) {\n throw new Error('THREE.GLTFLoader: JSON content not found.');\n }\n});\n/**\n * DRACO Mesh Compression Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression\n */\nvar GLTFDracoMeshCompressionExtension = /*#__PURE__*/function () {\n function GLTFDracoMeshCompressionExtension(json, dracoLoader) {\n _classCallCheck(this, GLTFDracoMeshCompressionExtension);\n if (!dracoLoader) {\n throw new Error('THREE.GLTFLoader: No DRACOLoader instance provided.');\n }\n this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;\n this.json = json;\n this.dracoLoader = dracoLoader;\n this.dracoLoader.preload();\n }\n _createClass(GLTFDracoMeshCompressionExtension, [{\n key: \"decodePrimitive\",\n value: function decodePrimitive(primitive, parser) {\n var json = this.json;\n var dracoLoader = this.dracoLoader;\n var bufferViewIndex = primitive.extensions[this.name].bufferView;\n var gltfAttributeMap = primitive.extensions[this.name].attributes;\n var threeAttributeMap = {};\n var attributeNormalizedMap = {};\n var attributeTypeMap = {};\n for (var attributeName in gltfAttributeMap) {\n var threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase();\n threeAttributeMap[threeAttributeName] = gltfAttributeMap[attributeName];\n }\n for (var _attributeName in primitive.attributes) {\n var _threeAttributeName = ATTRIBUTES[_attributeName] || _attributeName.toLowerCase();\n if (gltfAttributeMap[_attributeName] !== undefined) {\n var accessorDef = json.accessors[primitive.attributes[_attributeName]];\n var componentType = WEBGL_COMPONENT_TYPES[accessorDef.componentType];\n attributeTypeMap[_threeAttributeName] = componentType.name;\n attributeNormalizedMap[_threeAttributeName] = accessorDef.normalized === true;\n }\n }\n return parser.getDependency('bufferView', bufferViewIndex).then(function (bufferView) {\n return new Promise(function (resolve) {\n dracoLoader.decodeDracoFile(bufferView, function (geometry) {\n for (var _attributeName2 in geometry.attributes) {\n var attribute = geometry.attributes[_attributeName2];\n var normalized = attributeNormalizedMap[_attributeName2];\n if (normalized !== undefined) attribute.normalized = normalized;\n }\n resolve(geometry);\n }, threeAttributeMap, attributeTypeMap);\n });\n });\n }\n }]);\n return GLTFDracoMeshCompressionExtension;\n}();\n/**\n * Texture Transform Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform\n */\nvar GLTFTextureTransformExtension = /*#__PURE__*/function () {\n function GLTFTextureTransformExtension() {\n _classCallCheck(this, GLTFTextureTransformExtension);\n this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM;\n }\n _createClass(GLTFTextureTransformExtension, [{\n key: \"extendTexture\",\n value: function extendTexture(texture, transform) {\n if ((transform.texCoord === undefined || transform.texCoord === texture.channel) && transform.offset === undefined && transform.rotation === undefined && transform.scale === undefined) {\n // See https://github.com/mrdoob/three.js/issues/21819.\n return texture;\n }\n texture = texture.clone();\n if (transform.texCoord !== undefined) {\n texture.channel = transform.texCoord;\n }\n if (transform.offset !== undefined) {\n texture.offset.fromArray(transform.offset);\n }\n if (transform.rotation !== undefined) {\n texture.rotation = transform.rotation;\n }\n if (transform.scale !== undefined) {\n texture.repeat.fromArray(transform.scale);\n }\n texture.needsUpdate = true;\n return texture;\n }\n }]);\n return GLTFTextureTransformExtension;\n}();\n/**\n * Mesh Quantization Extension\n *\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization\n */\nvar GLTFMeshQuantizationExtension = /*#__PURE__*/_createClass(function GLTFMeshQuantizationExtension() {\n _classCallCheck(this, GLTFMeshQuantizationExtension);\n this.name = EXTENSIONS.KHR_MESH_QUANTIZATION;\n});\n/*********************************/\n/********** INTERPOLATION ********/\n/*********************************/\n// Spline Interpolation\n// Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#appendix-c-spline-interpolation\nvar GLTFCubicSplineInterpolant = /*#__PURE__*/function (_Interpolant) {\n _inherits(GLTFCubicSplineInterpolant, _Interpolant);\n var _super2 = _createSuper(GLTFCubicSplineInterpolant);\n function GLTFCubicSplineInterpolant(parameterPositions, sampleValues, sampleSize, resultBuffer) {\n _classCallCheck(this, GLTFCubicSplineInterpolant);\n return _super2.call(this, parameterPositions, sampleValues, sampleSize, resultBuffer);\n }\n _createClass(GLTFCubicSplineInterpolant, [{\n key: \"copySampleValue_\",\n value: function copySampleValue_(index) {\n // Copies a sample value to the result buffer. See description of glTF\n // CUBICSPLINE values layout in interpolate_() function below.\n\n var result = this.resultBuffer,\n values = this.sampleValues,\n valueSize = this.valueSize,\n offset = index * valueSize * 3 + valueSize;\n for (var i = 0; i !== valueSize; i++) {\n result[i] = values[offset + i];\n }\n return result;\n }\n }, {\n key: \"interpolate_\",\n value: function interpolate_(i1, t0, t, t1) {\n var result = this.resultBuffer;\n var values = this.sampleValues;\n var stride = this.valueSize;\n var stride2 = stride * 2;\n var stride3 = stride * 3;\n var td = t1 - t0;\n var p = (t - t0) / td;\n var pp = p * p;\n var ppp = pp * p;\n var offset1 = i1 * stride3;\n var offset0 = offset1 - stride3;\n var s2 = -2 * ppp + 3 * pp;\n var s3 = ppp - pp;\n var s0 = 1 - s2;\n var s1 = s3 - pp + p;\n\n // Layout of keyframe output values for CUBICSPLINE animations:\n // [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]\n for (var i = 0; i !== stride; i++) {\n var p0 = values[offset0 + i + stride]; // splineVertex_k\n var m0 = values[offset0 + i + stride2] * td; // outTangent_k * (t_k+1 - t_k)\n var p1 = values[offset1 + i + stride]; // splineVertex_k+1\n var m1 = values[offset1 + i] * td; // inTangent_k+1 * (t_k+1 - t_k)\n\n result[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;\n }\n return result;\n }\n }]);\n return GLTFCubicSplineInterpolant;\n}(three__WEBPACK_IMPORTED_MODULE_0__.Interpolant);\nvar _q = new three__WEBPACK_IMPORTED_MODULE_0__.Quaternion();\nvar GLTFCubicSplineQuaternionInterpolant = /*#__PURE__*/function (_GLTFCubicSplineInter) {\n _inherits(GLTFCubicSplineQuaternionInterpolant, _GLTFCubicSplineInter);\n var _super3 = _createSuper(GLTFCubicSplineQuaternionInterpolant);\n function GLTFCubicSplineQuaternionInterpolant() {\n _classCallCheck(this, GLTFCubicSplineQuaternionInterpolant);\n return _super3.apply(this, arguments);\n }\n _createClass(GLTFCubicSplineQuaternionInterpolant, [{\n key: \"interpolate_\",\n value: function interpolate_(i1, t0, t, t1) {\n var result = _get(_getPrototypeOf(GLTFCubicSplineQuaternionInterpolant.prototype), \"interpolate_\", this).call(this, i1, t0, t, t1);\n _q.fromArray(result).normalize().toArray(result);\n return result;\n }\n }]);\n return GLTFCubicSplineQuaternionInterpolant;\n}(GLTFCubicSplineInterpolant);\n/*********************************/\n/********** INTERNALS ************/\n/*********************************/\n/* CONSTANTS */\nvar WEBGL_CONSTANTS = {\n FLOAT: 5126,\n //FLOAT_MAT2: 35674,\n FLOAT_MAT3: 35675,\n FLOAT_MAT4: 35676,\n FLOAT_VEC2: 35664,\n FLOAT_VEC3: 35665,\n FLOAT_VEC4: 35666,\n LINEAR: 9729,\n REPEAT: 10497,\n SAMPLER_2D: 35678,\n POINTS: 0,\n LINES: 1,\n LINE_LOOP: 2,\n LINE_STRIP: 3,\n TRIANGLES: 4,\n TRIANGLE_STRIP: 5,\n TRIANGLE_FAN: 6,\n UNSIGNED_BYTE: 5121,\n UNSIGNED_SHORT: 5123\n};\nvar WEBGL_COMPONENT_TYPES = {\n 5120: Int8Array,\n 5121: Uint8Array,\n 5122: Int16Array,\n 5123: Uint16Array,\n 5125: Uint32Array,\n 5126: Float32Array\n};\nvar WEBGL_FILTERS = {\n 9728: three__WEBPACK_IMPORTED_MODULE_0__.NearestFilter,\n 9729: three__WEBPACK_IMPORTED_MODULE_0__.LinearFilter,\n 9984: three__WEBPACK_IMPORTED_MODULE_0__.NearestMipmapNearestFilter,\n 9985: three__WEBPACK_IMPORTED_MODULE_0__.LinearMipmapNearestFilter,\n 9986: three__WEBPACK_IMPORTED_MODULE_0__.NearestMipmapLinearFilter,\n 9987: three__WEBPACK_IMPORTED_MODULE_0__.LinearMipmapLinearFilter\n};\nvar WEBGL_WRAPPINGS = {\n 33071: three__WEBPACK_IMPORTED_MODULE_0__.ClampToEdgeWrapping,\n 33648: three__WEBPACK_IMPORTED_MODULE_0__.MirroredRepeatWrapping,\n 10497: three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping\n};\nvar WEBGL_TYPE_SIZES = {\n 'SCALAR': 1,\n 'VEC2': 2,\n 'VEC3': 3,\n 'VEC4': 4,\n 'MAT2': 4,\n 'MAT3': 9,\n 'MAT4': 16\n};\nvar ATTRIBUTES = {\n POSITION: 'position',\n NORMAL: 'normal',\n TANGENT: 'tangent',\n TEXCOORD_0: 'uv',\n TEXCOORD_1: 'uv2',\n COLOR_0: 'color',\n WEIGHTS_0: 'skinWeight',\n JOINTS_0: 'skinIndex'\n};\nvar PATH_PROPERTIES = {\n scale: 'scale',\n translation: 'position',\n rotation: 'quaternion',\n weights: 'morphTargetInfluences'\n};\nvar INTERPOLATION = {\n CUBICSPLINE: undefined,\n // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each\n // keyframe track will be initialized with a default interpolation type, then modified.\n LINEAR: three__WEBPACK_IMPORTED_MODULE_0__.InterpolateLinear,\n STEP: three__WEBPACK_IMPORTED_MODULE_0__.InterpolateDiscrete\n};\nvar ALPHA_MODES = {\n OPAQUE: 'OPAQUE',\n MASK: 'MASK',\n BLEND: 'BLEND'\n};\n\n/**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material\n */\nfunction createDefaultMaterial(cache) {\n if (cache['DefaultMaterial'] === undefined) {\n cache['DefaultMaterial'] = new three__WEBPACK_IMPORTED_MODULE_0__.MeshStandardMaterial({\n color: 0xFFFFFF,\n emissive: 0x000000,\n metalness: 1,\n roughness: 1,\n transparent: false,\n depthTest: true,\n side: three__WEBPACK_IMPORTED_MODULE_0__.FrontSide\n });\n }\n return cache['DefaultMaterial'];\n}\nfunction addUnknownExtensionsToUserData(knownExtensions, object, objectDef) {\n // Add unknown glTF extensions to an object's userData.\n\n for (var name in objectDef.extensions) {\n if (knownExtensions[name] === undefined) {\n object.userData.gltfExtensions = object.userData.gltfExtensions || {};\n object.userData.gltfExtensions[name] = objectDef.extensions[name];\n }\n }\n}\n\n/**\n * @param {Object3D|Material|BufferGeometry} object\n * @param {GLTF.definition} gltfDef\n */\nfunction assignExtrasToUserData(object, gltfDef) {\n if (gltfDef.extras !== undefined) {\n if (_typeof(gltfDef.extras) === 'object') {\n Object.assign(object.userData, gltfDef.extras);\n } else {\n console.warn('THREE.GLTFLoader: Ignoring primitive type .extras, ' + gltfDef.extras);\n }\n }\n}\n\n/**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets\n *\n * @param {BufferGeometry} geometry\n * @param {Array} targets\n * @param {GLTFParser} parser\n * @return {Promise}\n */\nfunction addMorphTargets(geometry, targets, parser) {\n var hasMorphPosition = false;\n var hasMorphNormal = false;\n var hasMorphColor = false;\n for (var i = 0, il = targets.length; i < il; i++) {\n var target = targets[i];\n if (target.POSITION !== undefined) hasMorphPosition = true;\n if (target.NORMAL !== undefined) hasMorphNormal = true;\n if (target.COLOR_0 !== undefined) hasMorphColor = true;\n if (hasMorphPosition && hasMorphNormal && hasMorphColor) break;\n }\n if (!hasMorphPosition && !hasMorphNormal && !hasMorphColor) return Promise.resolve(geometry);\n var pendingPositionAccessors = [];\n var pendingNormalAccessors = [];\n var pendingColorAccessors = [];\n for (var _i2 = 0, _il = targets.length; _i2 < _il; _i2++) {\n var _target = targets[_i2];\n if (hasMorphPosition) {\n var pendingAccessor = _target.POSITION !== undefined ? parser.getDependency('accessor', _target.POSITION) : geometry.attributes.position;\n pendingPositionAccessors.push(pendingAccessor);\n }\n if (hasMorphNormal) {\n var _pendingAccessor = _target.NORMAL !== undefined ? parser.getDependency('accessor', _target.NORMAL) : geometry.attributes.normal;\n pendingNormalAccessors.push(_pendingAccessor);\n }\n if (hasMorphColor) {\n var _pendingAccessor2 = _target.COLOR_0 !== undefined ? parser.getDependency('accessor', _target.COLOR_0) : geometry.attributes.color;\n pendingColorAccessors.push(_pendingAccessor2);\n }\n }\n return Promise.all([Promise.all(pendingPositionAccessors), Promise.all(pendingNormalAccessors), Promise.all(pendingColorAccessors)]).then(function (accessors) {\n var morphPositions = accessors[0];\n var morphNormals = accessors[1];\n var morphColors = accessors[2];\n if (hasMorphPosition) geometry.morphAttributes.position = morphPositions;\n if (hasMorphNormal) geometry.morphAttributes.normal = morphNormals;\n if (hasMorphColor) geometry.morphAttributes.color = morphColors;\n geometry.morphTargetsRelative = true;\n return geometry;\n });\n}\n\n/**\n * @param {Mesh} mesh\n * @param {GLTF.Mesh} meshDef\n */\nfunction updateMorphTargets(mesh, meshDef) {\n mesh.updateMorphTargets();\n if (meshDef.weights !== undefined) {\n for (var i = 0, il = meshDef.weights.length; i < il; i++) {\n mesh.morphTargetInfluences[i] = meshDef.weights[i];\n }\n }\n\n // .extras has user-defined data, so check that .extras.targetNames is an array.\n if (meshDef.extras && Array.isArray(meshDef.extras.targetNames)) {\n var targetNames = meshDef.extras.targetNames;\n if (mesh.morphTargetInfluences.length === targetNames.length) {\n mesh.morphTargetDictionary = {};\n for (var _i3 = 0, _il2 = targetNames.length; _i3 < _il2; _i3++) {\n mesh.morphTargetDictionary[targetNames[_i3]] = _i3;\n }\n } else {\n console.warn('THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.');\n }\n }\n}\nfunction createPrimitiveKey(primitiveDef) {\n var dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION];\n var geometryKey;\n if (dracoExtension) {\n geometryKey = 'draco:' + dracoExtension.bufferView + ':' + dracoExtension.indices + ':' + createAttributesKey(dracoExtension.attributes);\n } else {\n geometryKey = primitiveDef.indices + ':' + createAttributesKey(primitiveDef.attributes) + ':' + primitiveDef.mode;\n }\n return geometryKey;\n}\nfunction createAttributesKey(attributes) {\n var attributesKey = '';\n var keys = Object.keys(attributes).sort();\n for (var i = 0, il = keys.length; i < il; i++) {\n attributesKey += keys[i] + ':' + attributes[keys[i]] + ';';\n }\n return attributesKey;\n}\nfunction getNormalizedComponentScale(constructor) {\n // Reference:\n // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization#encoding-quantized-data\n\n switch (constructor) {\n case Int8Array:\n return 1 / 127;\n case Uint8Array:\n return 1 / 255;\n case Int16Array:\n return 1 / 32767;\n case Uint16Array:\n return 1 / 65535;\n default:\n throw new Error('THREE.GLTFLoader: Unsupported normalized accessor component type.');\n }\n}\nfunction getImageURIMimeType(uri) {\n if (uri.search(/\\.jpe?g($|\\?)/i) > 0 || uri.search(/^data\\:image\\/jpeg/) === 0) return 'image/jpeg';\n if (uri.search(/\\.webp($|\\?)/i) > 0 || uri.search(/^data\\:image\\/webp/) === 0) return 'image/webp';\n return 'image/png';\n}\nvar _identityMatrix = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4();\n\n/* GLTF PARSER */\nvar GLTFParser = /*#__PURE__*/function () {\n function GLTFParser() {\n var json = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, GLTFParser);\n this.json = json;\n this.extensions = {};\n this.plugins = {};\n this.options = options;\n\n // loader object cache\n this.cache = new GLTFRegistry();\n\n // associations between Three.js objects and glTF elements\n this.associations = new Map();\n\n // BufferGeometry caching\n this.primitiveCache = {};\n\n // Node cache\n this.nodeCache = {};\n\n // Object3D instance caches\n this.meshCache = {\n refs: {},\n uses: {}\n };\n this.cameraCache = {\n refs: {},\n uses: {}\n };\n this.lightCache = {\n refs: {},\n uses: {}\n };\n this.sourceCache = {};\n this.textureCache = {};\n\n // Track node names, to ensure no duplicates\n this.nodeNamesUsed = {};\n\n // Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the\n // expensive work of uploading a texture to the GPU off the main thread.\n\n var isSafari = false;\n var isFirefox = false;\n var firefoxVersion = -1;\n if (typeof navigator !== 'undefined') {\n isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === true;\n isFirefox = navigator.userAgent.indexOf('Firefox') > -1;\n firefoxVersion = isFirefox ? navigator.userAgent.match(/Firefox\\/([0-9]+)\\./)[1] : -1;\n }\n if (typeof createImageBitmap === 'undefined' || isSafari || isFirefox && firefoxVersion < 98) {\n this.textureLoader = new three__WEBPACK_IMPORTED_MODULE_0__.TextureLoader(this.options.manager);\n } else {\n this.textureLoader = new three__WEBPACK_IMPORTED_MODULE_0__.ImageBitmapLoader(this.options.manager);\n }\n this.textureLoader.setCrossOrigin(this.options.crossOrigin);\n this.textureLoader.setRequestHeader(this.options.requestHeader);\n this.fileLoader = new three__WEBPACK_IMPORTED_MODULE_0__.FileLoader(this.options.manager);\n this.fileLoader.setResponseType('arraybuffer');\n if (this.options.crossOrigin === 'use-credentials') {\n this.fileLoader.setWithCredentials(true);\n }\n }\n _createClass(GLTFParser, [{\n key: \"setExtensions\",\n value: function setExtensions(extensions) {\n this.extensions = extensions;\n }\n }, {\n key: \"setPlugins\",\n value: function setPlugins(plugins) {\n this.plugins = plugins;\n }\n }, {\n key: \"parse\",\n value: function parse(onLoad, onError) {\n var parser = this;\n var json = this.json;\n var extensions = this.extensions;\n\n // Clear the loader cache\n this.cache.removeAll();\n this.nodeCache = {};\n\n // Mark the special nodes/meshes in json for efficient parse\n this._invokeAll(function (ext) {\n return ext._markDefs && ext._markDefs();\n });\n Promise.all(this._invokeAll(function (ext) {\n return ext.beforeRoot && ext.beforeRoot();\n })).then(function () {\n return Promise.all([parser.getDependencies('scene'), parser.getDependencies('animation'), parser.getDependencies('camera')]);\n }).then(function (dependencies) {\n var result = {\n scene: dependencies[0][json.scene || 0],\n scenes: dependencies[0],\n animations: dependencies[1],\n cameras: dependencies[2],\n asset: json.asset,\n parser: parser,\n userData: {}\n };\n addUnknownExtensionsToUserData(extensions, result, json);\n assignExtrasToUserData(result, json);\n Promise.all(parser._invokeAll(function (ext) {\n return ext.afterRoot && ext.afterRoot(result);\n })).then(function () {\n onLoad(result);\n });\n })[\"catch\"](onError);\n }\n\n /**\n * Marks the special nodes/meshes in json for efficient parse.\n */\n }, {\n key: \"_markDefs\",\n value: function _markDefs() {\n var nodeDefs = this.json.nodes || [];\n var skinDefs = this.json.skins || [];\n var meshDefs = this.json.meshes || [];\n\n // Nothing in the node definition indicates whether it is a Bone or an\n // Object3D. Use the skins' joint references to mark bones.\n for (var skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex++) {\n var joints = skinDefs[skinIndex].joints;\n for (var i = 0, il = joints.length; i < il; i++) {\n nodeDefs[joints[i]].isBone = true;\n }\n }\n\n // Iterate over all nodes, marking references to shared resources,\n // as well as skeleton joints.\n for (var nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {\n var nodeDef = nodeDefs[nodeIndex];\n if (nodeDef.mesh !== undefined) {\n this._addNodeRef(this.meshCache, nodeDef.mesh);\n\n // Nothing in the mesh definition indicates whether it is\n // a SkinnedMesh or Mesh. Use the node's mesh reference\n // to mark SkinnedMesh if node has skin.\n if (nodeDef.skin !== undefined) {\n meshDefs[nodeDef.mesh].isSkinnedMesh = true;\n }\n }\n if (nodeDef.camera !== undefined) {\n this._addNodeRef(this.cameraCache, nodeDef.camera);\n }\n }\n }\n\n /**\n * Counts references to shared node / Object3D resources. These resources\n * can be reused, or \"instantiated\", at multiple nodes in the scene\n * hierarchy. Mesh, Camera, and Light instances are instantiated and must\n * be marked. Non-scenegraph resources (like Materials, Geometries, and\n * Textures) can be reused directly and are not marked here.\n *\n * Example: CesiumMilkTruck sample model reuses \"Wheel\" meshes.\n */\n }, {\n key: \"_addNodeRef\",\n value: function _addNodeRef(cache, index) {\n if (index === undefined) return;\n if (cache.refs[index] === undefined) {\n cache.refs[index] = cache.uses[index] = 0;\n }\n cache.refs[index]++;\n }\n\n /** Returns a reference to a shared resource, cloning it if necessary. */\n }, {\n key: \"_getNodeRef\",\n value: function _getNodeRef(cache, index, object) {\n var _this3 = this;\n if (cache.refs[index] <= 1) return object;\n var ref = object.clone();\n\n // Propagates mappings to the cloned object, prevents mappings on the\n // original object from being lost.\n var updateMappings = function updateMappings(original, clone) {\n var mappings = _this3.associations.get(original);\n if (mappings != null) {\n _this3.associations.set(clone, mappings);\n }\n var _iterator3 = _createForOfIteratorHelper(original.children.entries()),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var _step3$value = _slicedToArray(_step3.value, 2),\n i = _step3$value[0],\n child = _step3$value[1];\n updateMappings(child, clone.children[i]);\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n };\n updateMappings(object, ref);\n ref.name += '_instance_' + cache.uses[index]++;\n return ref;\n }\n }, {\n key: \"_invokeOne\",\n value: function _invokeOne(func) {\n var extensions = Object.values(this.plugins);\n extensions.push(this);\n for (var i = 0; i < extensions.length; i++) {\n var result = func(extensions[i]);\n if (result) return result;\n }\n return null;\n }\n }, {\n key: \"_invokeAll\",\n value: function _invokeAll(func) {\n var extensions = Object.values(this.plugins);\n extensions.unshift(this);\n var pending = [];\n for (var i = 0; i < extensions.length; i++) {\n var result = func(extensions[i]);\n if (result) pending.push(result);\n }\n return pending;\n }\n\n /**\n * Requests the specified dependency asynchronously, with caching.\n * @param {string} type\n * @param {number} index\n * @return {Promise}\n */\n }, {\n key: \"getDependency\",\n value: function getDependency(type, index) {\n var cacheKey = type + ':' + index;\n var dependency = this.cache.get(cacheKey);\n if (!dependency) {\n switch (type) {\n case 'scene':\n dependency = this.loadScene(index);\n break;\n case 'node':\n dependency = this._invokeOne(function (ext) {\n return ext.loadNode && ext.loadNode(index);\n });\n break;\n case 'mesh':\n dependency = this._invokeOne(function (ext) {\n return ext.loadMesh && ext.loadMesh(index);\n });\n break;\n case 'accessor':\n dependency = this.loadAccessor(index);\n break;\n case 'bufferView':\n dependency = this._invokeOne(function (ext) {\n return ext.loadBufferView && ext.loadBufferView(index);\n });\n break;\n case 'buffer':\n dependency = this.loadBuffer(index);\n break;\n case 'material':\n dependency = this._invokeOne(function (ext) {\n return ext.loadMaterial && ext.loadMaterial(index);\n });\n break;\n case 'texture':\n dependency = this._invokeOne(function (ext) {\n return ext.loadTexture && ext.loadTexture(index);\n });\n break;\n case 'skin':\n dependency = this.loadSkin(index);\n break;\n case 'animation':\n dependency = this._invokeOne(function (ext) {\n return ext.loadAnimation && ext.loadAnimation(index);\n });\n break;\n case 'camera':\n dependency = this.loadCamera(index);\n break;\n default:\n dependency = this._invokeOne(function (ext) {\n return ext != this && ext.getDependency && ext.getDependency(type, index);\n });\n if (!dependency) {\n throw new Error('Unknown type: ' + type);\n }\n break;\n }\n this.cache.add(cacheKey, dependency);\n }\n return dependency;\n }\n\n /**\n * Requests all dependencies of the specified type asynchronously, with caching.\n * @param {string} type\n * @return {Promise>}\n */\n }, {\n key: \"getDependencies\",\n value: function getDependencies(type) {\n var dependencies = this.cache.get(type);\n if (!dependencies) {\n var parser = this;\n var defs = this.json[type + (type === 'mesh' ? 'es' : 's')] || [];\n dependencies = Promise.all(defs.map(function (def, index) {\n return parser.getDependency(type, index);\n }));\n this.cache.add(type, dependencies);\n }\n return dependencies;\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n * @param {number} bufferIndex\n * @return {Promise}\n */\n }, {\n key: \"loadBuffer\",\n value: function loadBuffer(bufferIndex) {\n var bufferDef = this.json.buffers[bufferIndex];\n var loader = this.fileLoader;\n if (bufferDef.type && bufferDef.type !== 'arraybuffer') {\n throw new Error('THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.');\n }\n\n // If present, GLB container is required to be the first buffer.\n if (bufferDef.uri === undefined && bufferIndex === 0) {\n return Promise.resolve(this.extensions[EXTENSIONS.KHR_BINARY_GLTF].body);\n }\n var options = this.options;\n return new Promise(function (resolve, reject) {\n loader.load(three__WEBPACK_IMPORTED_MODULE_0__.LoaderUtils.resolveURL(bufferDef.uri, options.path), resolve, undefined, function () {\n reject(new Error('THREE.GLTFLoader: Failed to load buffer \"' + bufferDef.uri + '\".'));\n });\n });\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views\n * @param {number} bufferViewIndex\n * @return {Promise}\n */\n }, {\n key: \"loadBufferView\",\n value: function loadBufferView(bufferViewIndex) {\n var bufferViewDef = this.json.bufferViews[bufferViewIndex];\n return this.getDependency('buffer', bufferViewDef.buffer).then(function (buffer) {\n var byteLength = bufferViewDef.byteLength || 0;\n var byteOffset = bufferViewDef.byteOffset || 0;\n return buffer.slice(byteOffset, byteOffset + byteLength);\n });\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors\n * @param {number} accessorIndex\n * @return {Promise}\n */\n }, {\n key: \"loadAccessor\",\n value: function loadAccessor(accessorIndex) {\n var parser = this;\n var json = this.json;\n var accessorDef = this.json.accessors[accessorIndex];\n if (accessorDef.bufferView === undefined && accessorDef.sparse === undefined) {\n var itemSize = WEBGL_TYPE_SIZES[accessorDef.type];\n var TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType];\n var normalized = accessorDef.normalized === true;\n var array = new TypedArray(accessorDef.count * itemSize);\n return Promise.resolve(new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(array, itemSize, normalized));\n }\n var pendingBufferViews = [];\n if (accessorDef.bufferView !== undefined) {\n pendingBufferViews.push(this.getDependency('bufferView', accessorDef.bufferView));\n } else {\n pendingBufferViews.push(null);\n }\n if (accessorDef.sparse !== undefined) {\n pendingBufferViews.push(this.getDependency('bufferView', accessorDef.sparse.indices.bufferView));\n pendingBufferViews.push(this.getDependency('bufferView', accessorDef.sparse.values.bufferView));\n }\n return Promise.all(pendingBufferViews).then(function (bufferViews) {\n var bufferView = bufferViews[0];\n var itemSize = WEBGL_TYPE_SIZES[accessorDef.type];\n var TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType];\n\n // For VEC3: itemSize is 3, elementBytes is 4, itemBytes is 12.\n var elementBytes = TypedArray.BYTES_PER_ELEMENT;\n var itemBytes = elementBytes * itemSize;\n var byteOffset = accessorDef.byteOffset || 0;\n var byteStride = accessorDef.bufferView !== undefined ? json.bufferViews[accessorDef.bufferView].byteStride : undefined;\n var normalized = accessorDef.normalized === true;\n var array, bufferAttribute;\n\n // The buffer is not interleaved if the stride is the item size in bytes.\n if (byteStride && byteStride !== itemBytes) {\n // Each \"slice\" of the buffer, as defined by 'count' elements of 'byteStride' bytes, gets its own InterleavedBuffer\n // This makes sure that IBA.count reflects accessor.count properly\n var ibSlice = Math.floor(byteOffset / byteStride);\n var ibCacheKey = 'InterleavedBuffer:' + accessorDef.bufferView + ':' + accessorDef.componentType + ':' + ibSlice + ':' + accessorDef.count;\n var ib = parser.cache.get(ibCacheKey);\n if (!ib) {\n array = new TypedArray(bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes);\n\n // Integer parameters to IB/IBA are in array elements, not bytes.\n ib = new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBuffer(array, byteStride / elementBytes);\n parser.cache.add(ibCacheKey, ib);\n }\n bufferAttribute = new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute(ib, itemSize, byteOffset % byteStride / elementBytes, normalized);\n } else {\n if (bufferView === null) {\n array = new TypedArray(accessorDef.count * itemSize);\n } else {\n array = new TypedArray(bufferView, byteOffset, accessorDef.count * itemSize);\n }\n bufferAttribute = new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(array, itemSize, normalized);\n }\n\n // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#sparse-accessors\n if (accessorDef.sparse !== undefined) {\n var itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR;\n var TypedArrayIndices = WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType];\n var byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0;\n var byteOffsetValues = accessorDef.sparse.values.byteOffset || 0;\n var sparseIndices = new TypedArrayIndices(bufferViews[1], byteOffsetIndices, accessorDef.sparse.count * itemSizeIndices);\n var sparseValues = new TypedArray(bufferViews[2], byteOffsetValues, accessorDef.sparse.count * itemSize);\n if (bufferView !== null) {\n // Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes.\n bufferAttribute = new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(bufferAttribute.array.slice(), bufferAttribute.itemSize, bufferAttribute.normalized);\n }\n for (var i = 0, il = sparseIndices.length; i < il; i++) {\n var index = sparseIndices[i];\n bufferAttribute.setX(index, sparseValues[i * itemSize]);\n if (itemSize >= 2) bufferAttribute.setY(index, sparseValues[i * itemSize + 1]);\n if (itemSize >= 3) bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]);\n if (itemSize >= 4) bufferAttribute.setW(index, sparseValues[i * itemSize + 3]);\n if (itemSize >= 5) throw new Error('THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.');\n }\n }\n return bufferAttribute;\n });\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures\n * @param {number} textureIndex\n * @return {Promise}\n */\n }, {\n key: \"loadTexture\",\n value: function loadTexture(textureIndex) {\n var json = this.json;\n var options = this.options;\n var textureDef = json.textures[textureIndex];\n var sourceIndex = textureDef.source;\n var sourceDef = json.images[sourceIndex];\n var loader = this.textureLoader;\n if (sourceDef.uri) {\n var handler = options.manager.getHandler(sourceDef.uri);\n if (handler !== null) loader = handler;\n }\n return this.loadTextureImage(textureIndex, sourceIndex, loader);\n }\n }, {\n key: \"loadTextureImage\",\n value: function loadTextureImage(textureIndex, sourceIndex, loader) {\n var parser = this;\n var json = this.json;\n var textureDef = json.textures[textureIndex];\n var sourceDef = json.images[sourceIndex];\n var cacheKey = (sourceDef.uri || sourceDef.bufferView) + ':' + textureDef.sampler;\n if (this.textureCache[cacheKey]) {\n // See https://github.com/mrdoob/three.js/issues/21559.\n return this.textureCache[cacheKey];\n }\n var promise = this.loadImageSource(sourceIndex, loader).then(function (texture) {\n texture.flipY = false;\n texture.name = textureDef.name || sourceDef.name || '';\n if (texture.name === '' && typeof sourceDef.uri === 'string' && sourceDef.uri.startsWith('data:image/') === false) {\n texture.name = sourceDef.uri;\n }\n var samplers = json.samplers || {};\n var sampler = samplers[textureDef.sampler] || {};\n texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || three__WEBPACK_IMPORTED_MODULE_0__.LinearFilter;\n texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || three__WEBPACK_IMPORTED_MODULE_0__.LinearMipmapLinearFilter;\n texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping;\n texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping;\n parser.associations.set(texture, {\n textures: textureIndex\n });\n return texture;\n })[\"catch\"](function () {\n return null;\n });\n this.textureCache[cacheKey] = promise;\n return promise;\n }\n }, {\n key: \"loadImageSource\",\n value: function loadImageSource(sourceIndex, loader) {\n var parser = this;\n var json = this.json;\n var options = this.options;\n if (this.sourceCache[sourceIndex] !== undefined) {\n return this.sourceCache[sourceIndex].then(function (texture) {\n return texture.clone();\n });\n }\n var sourceDef = json.images[sourceIndex];\n var URL = self.URL || self.webkitURL;\n var sourceURI = sourceDef.uri || '';\n var isObjectURL = false;\n if (sourceDef.bufferView !== undefined) {\n // Load binary image data from bufferView, if provided.\n\n sourceURI = parser.getDependency('bufferView', sourceDef.bufferView).then(function (bufferView) {\n isObjectURL = true;\n var blob = new Blob([bufferView], {\n type: sourceDef.mimeType\n });\n sourceURI = URL.createObjectURL(blob);\n return sourceURI;\n });\n } else if (sourceDef.uri === undefined) {\n throw new Error('THREE.GLTFLoader: Image ' + sourceIndex + ' is missing URI and bufferView');\n }\n var promise = Promise.resolve(sourceURI).then(function (sourceURI) {\n return new Promise(function (resolve, reject) {\n var onLoad = resolve;\n if (loader.isImageBitmapLoader === true) {\n onLoad = function onLoad(imageBitmap) {\n var texture = new three__WEBPACK_IMPORTED_MODULE_0__.Texture(imageBitmap);\n texture.needsUpdate = true;\n resolve(texture);\n };\n }\n loader.load(three__WEBPACK_IMPORTED_MODULE_0__.LoaderUtils.resolveURL(sourceURI, options.path), onLoad, undefined, reject);\n });\n }).then(function (texture) {\n // Clean up resources and configure Texture.\n\n if (isObjectURL === true) {\n URL.revokeObjectURL(sourceURI);\n }\n texture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType(sourceDef.uri);\n return texture;\n })[\"catch\"](function (error) {\n console.error('THREE.GLTFLoader: Couldn\\'t load texture', sourceURI);\n throw error;\n });\n this.sourceCache[sourceIndex] = promise;\n return promise;\n }\n\n /**\n * Asynchronously assigns a texture to the given material parameters.\n * @param {Object} materialParams\n * @param {string} mapName\n * @param {Object} mapDef\n * @return {Promise}\n */\n }, {\n key: \"assignTexture\",\n value: function assignTexture(materialParams, mapName, mapDef, encoding) {\n var parser = this;\n return this.getDependency('texture', mapDef.index).then(function (texture) {\n if (!texture) return null;\n if (mapDef.texCoord !== undefined && mapDef.texCoord > 0) {\n texture = texture.clone();\n texture.channel = mapDef.texCoord;\n }\n if (parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]) {\n var transform = mapDef.extensions !== undefined ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] : undefined;\n if (transform) {\n var gltfReference = parser.associations.get(texture);\n texture = parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(texture, transform);\n parser.associations.set(texture, gltfReference);\n }\n }\n if (encoding !== undefined) {\n texture.encoding = encoding;\n }\n materialParams[mapName] = texture;\n return texture;\n });\n }\n\n /**\n * Assigns final material to a Mesh, Line, or Points instance. The instance\n * already has a material (generated from the glTF material options alone)\n * but reuse of the same glTF material may require multiple threejs materials\n * to accommodate different primitive types, defines, etc. New materials will\n * be created if necessary, and reused from a cache.\n * @param {Object3D} mesh Mesh, Line, or Points instance.\n */\n }, {\n key: \"assignFinalMaterial\",\n value: function assignFinalMaterial(mesh) {\n var geometry = mesh.geometry;\n var material = mesh.material;\n var useDerivativeTangents = geometry.attributes.tangent === undefined;\n var useVertexColors = geometry.attributes.color !== undefined;\n var useFlatShading = geometry.attributes.normal === undefined;\n if (mesh.isPoints) {\n var cacheKey = 'PointsMaterial:' + material.uuid;\n var pointsMaterial = this.cache.get(cacheKey);\n if (!pointsMaterial) {\n pointsMaterial = new three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial();\n three__WEBPACK_IMPORTED_MODULE_0__.Material.prototype.copy.call(pointsMaterial, material);\n pointsMaterial.color.copy(material.color);\n pointsMaterial.map = material.map;\n pointsMaterial.sizeAttenuation = false; // glTF spec says points should be 1px\n\n this.cache.add(cacheKey, pointsMaterial);\n }\n material = pointsMaterial;\n } else if (mesh.isLine) {\n var _cacheKey = 'LineBasicMaterial:' + material.uuid;\n var lineMaterial = this.cache.get(_cacheKey);\n if (!lineMaterial) {\n lineMaterial = new three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial();\n three__WEBPACK_IMPORTED_MODULE_0__.Material.prototype.copy.call(lineMaterial, material);\n lineMaterial.color.copy(material.color);\n lineMaterial.map = material.map;\n this.cache.add(_cacheKey, lineMaterial);\n }\n material = lineMaterial;\n }\n\n // Clone the material if it will be modified\n if (useDerivativeTangents || useVertexColors || useFlatShading) {\n var _cacheKey2 = 'ClonedMaterial:' + material.uuid + ':';\n if (useDerivativeTangents) _cacheKey2 += 'derivative-tangents:';\n if (useVertexColors) _cacheKey2 += 'vertex-colors:';\n if (useFlatShading) _cacheKey2 += 'flat-shading:';\n var cachedMaterial = this.cache.get(_cacheKey2);\n if (!cachedMaterial) {\n cachedMaterial = material.clone();\n if (useVertexColors) cachedMaterial.vertexColors = true;\n if (useFlatShading) cachedMaterial.flatShading = true;\n if (useDerivativeTangents) {\n // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995\n if (cachedMaterial.normalScale) cachedMaterial.normalScale.y *= -1;\n if (cachedMaterial.clearcoatNormalScale) cachedMaterial.clearcoatNormalScale.y *= -1;\n }\n this.cache.add(_cacheKey2, cachedMaterial);\n this.associations.set(cachedMaterial, this.associations.get(material));\n }\n material = cachedMaterial;\n }\n mesh.material = material;\n }\n }, {\n key: \"getMaterialType\",\n value: function getMaterialType( /* materialIndex */\n ) {\n return three__WEBPACK_IMPORTED_MODULE_0__.MeshStandardMaterial;\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials\n * @param {number} materialIndex\n * @return {Promise}\n */\n }, {\n key: \"loadMaterial\",\n value: function loadMaterial(materialIndex) {\n var parser = this;\n var json = this.json;\n var extensions = this.extensions;\n var materialDef = json.materials[materialIndex];\n var materialType;\n var materialParams = {};\n var materialExtensions = materialDef.extensions || {};\n var pending = [];\n if (materialExtensions[EXTENSIONS.KHR_MATERIALS_UNLIT]) {\n var kmuExtension = extensions[EXTENSIONS.KHR_MATERIALS_UNLIT];\n materialType = kmuExtension.getMaterialType();\n pending.push(kmuExtension.extendParams(materialParams, materialDef, parser));\n } else {\n // Specification:\n // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#metallic-roughness-material\n\n var metallicRoughness = materialDef.pbrMetallicRoughness || {};\n materialParams.color = new three__WEBPACK_IMPORTED_MODULE_0__.Color(1.0, 1.0, 1.0);\n materialParams.opacity = 1.0;\n if (Array.isArray(metallicRoughness.baseColorFactor)) {\n var array = metallicRoughness.baseColorFactor;\n materialParams.color.fromArray(array);\n materialParams.opacity = array[3];\n }\n if (metallicRoughness.baseColorTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture, three__WEBPACK_IMPORTED_MODULE_0__.sRGBEncoding));\n }\n materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0;\n materialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0;\n if (metallicRoughness.metallicRoughnessTexture !== undefined) {\n pending.push(parser.assignTexture(materialParams, 'metalnessMap', metallicRoughness.metallicRoughnessTexture));\n pending.push(parser.assignTexture(materialParams, 'roughnessMap', metallicRoughness.metallicRoughnessTexture));\n }\n materialType = this._invokeOne(function (ext) {\n return ext.getMaterialType && ext.getMaterialType(materialIndex);\n });\n pending.push(Promise.all(this._invokeAll(function (ext) {\n return ext.extendMaterialParams && ext.extendMaterialParams(materialIndex, materialParams);\n })));\n }\n if (materialDef.doubleSided === true) {\n materialParams.side = three__WEBPACK_IMPORTED_MODULE_0__.DoubleSide;\n }\n var alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;\n if (alphaMode === ALPHA_MODES.BLEND) {\n materialParams.transparent = true;\n\n // See: https://github.com/mrdoob/three.js/issues/17706\n materialParams.depthWrite = false;\n } else {\n materialParams.transparent = false;\n if (alphaMode === ALPHA_MODES.MASK) {\n materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;\n }\n }\n if (materialDef.normalTexture !== undefined && materialType !== three__WEBPACK_IMPORTED_MODULE_0__.MeshBasicMaterial) {\n pending.push(parser.assignTexture(materialParams, 'normalMap', materialDef.normalTexture));\n materialParams.normalScale = new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(1, 1);\n if (materialDef.normalTexture.scale !== undefined) {\n var scale = materialDef.normalTexture.scale;\n materialParams.normalScale.set(scale, scale);\n }\n }\n if (materialDef.occlusionTexture !== undefined && materialType !== three__WEBPACK_IMPORTED_MODULE_0__.MeshBasicMaterial) {\n pending.push(parser.assignTexture(materialParams, 'aoMap', materialDef.occlusionTexture));\n if (materialDef.occlusionTexture.strength !== undefined) {\n materialParams.aoMapIntensity = materialDef.occlusionTexture.strength;\n }\n }\n if (materialDef.emissiveFactor !== undefined && materialType !== three__WEBPACK_IMPORTED_MODULE_0__.MeshBasicMaterial) {\n materialParams.emissive = new three__WEBPACK_IMPORTED_MODULE_0__.Color().fromArray(materialDef.emissiveFactor);\n }\n if (materialDef.emissiveTexture !== undefined && materialType !== three__WEBPACK_IMPORTED_MODULE_0__.MeshBasicMaterial) {\n pending.push(parser.assignTexture(materialParams, 'emissiveMap', materialDef.emissiveTexture, three__WEBPACK_IMPORTED_MODULE_0__.sRGBEncoding));\n }\n return Promise.all(pending).then(function () {\n var material = new materialType(materialParams);\n if (materialDef.name) material.name = materialDef.name;\n assignExtrasToUserData(material, materialDef);\n parser.associations.set(material, {\n materials: materialIndex\n });\n if (materialDef.extensions) addUnknownExtensionsToUserData(extensions, material, materialDef);\n return material;\n });\n }\n\n /** When Object3D instances are targeted by animation, they need unique names. */\n }, {\n key: \"createUniqueName\",\n value: function createUniqueName(originalName) {\n var sanitizedName = three__WEBPACK_IMPORTED_MODULE_0__.PropertyBinding.sanitizeNodeName(originalName || '');\n var name = sanitizedName;\n for (var i = 1; this.nodeNamesUsed[name]; ++i) {\n name = sanitizedName + '_' + i;\n }\n this.nodeNamesUsed[name] = true;\n return name;\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry\n *\n * Creates BufferGeometries from primitives.\n *\n * @param {Array} primitives\n * @return {Promise>}\n */\n }, {\n key: \"loadGeometries\",\n value: function loadGeometries(primitives) {\n var parser = this;\n var extensions = this.extensions;\n var cache = this.primitiveCache;\n function createDracoPrimitive(primitive) {\n return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(primitive, parser).then(function (geometry) {\n return addPrimitiveAttributes(geometry, primitive, parser);\n });\n }\n var pending = [];\n for (var i = 0, il = primitives.length; i < il; i++) {\n var primitive = primitives[i];\n var cacheKey = createPrimitiveKey(primitive);\n\n // See if we've already created this geometry\n var cached = cache[cacheKey];\n if (cached) {\n // Use the cached geometry if it exists\n pending.push(cached.promise);\n } else {\n var geometryPromise = void 0;\n if (primitive.extensions && primitive.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]) {\n // Use DRACO geometry if available\n geometryPromise = createDracoPrimitive(primitive);\n } else {\n // Otherwise create a new geometry\n geometryPromise = addPrimitiveAttributes(new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry(), primitive, parser);\n }\n\n // Cache this geometry\n cache[cacheKey] = {\n primitive: primitive,\n promise: geometryPromise\n };\n pending.push(geometryPromise);\n }\n }\n return Promise.all(pending);\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes\n * @param {number} meshIndex\n * @return {Promise}\n */\n }, {\n key: \"loadMesh\",\n value: function loadMesh(meshIndex) {\n var parser = this;\n var json = this.json;\n var extensions = this.extensions;\n var meshDef = json.meshes[meshIndex];\n var primitives = meshDef.primitives;\n var pending = [];\n for (var i = 0, il = primitives.length; i < il; i++) {\n var material = primitives[i].material === undefined ? createDefaultMaterial(this.cache) : this.getDependency('material', primitives[i].material);\n pending.push(material);\n }\n pending.push(parser.loadGeometries(primitives));\n return Promise.all(pending).then(function (results) {\n var materials = results.slice(0, results.length - 1);\n var geometries = results[results.length - 1];\n var meshes = [];\n for (var _i4 = 0, _il3 = geometries.length; _i4 < _il3; _i4++) {\n var geometry = geometries[_i4];\n var primitive = primitives[_i4];\n\n // 1. create Mesh\n\n var mesh = void 0;\n var _material = materials[_i4];\n if (primitive.mode === WEBGL_CONSTANTS.TRIANGLES || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN || primitive.mode === undefined) {\n // .isSkinnedMesh isn't in glTF spec. See ._markDefs()\n mesh = meshDef.isSkinnedMesh === true ? new three__WEBPACK_IMPORTED_MODULE_0__.SkinnedMesh(geometry, _material) : new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(geometry, _material);\n if (mesh.isSkinnedMesh === true) {\n // normalize skin weights to fix malformed assets (see #15319)\n mesh.normalizeSkinWeights();\n }\n if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP) {\n mesh.geometry = (0,_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_1__.toTrianglesDrawMode)(mesh.geometry, three__WEBPACK_IMPORTED_MODULE_0__.TriangleStripDrawMode);\n } else if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN) {\n mesh.geometry = (0,_utils_BufferGeometryUtils_js__WEBPACK_IMPORTED_MODULE_1__.toTrianglesDrawMode)(mesh.geometry, three__WEBPACK_IMPORTED_MODULE_0__.TriangleFanDrawMode);\n }\n } else if (primitive.mode === WEBGL_CONSTANTS.LINES) {\n mesh = new three__WEBPACK_IMPORTED_MODULE_0__.LineSegments(geometry, _material);\n } else if (primitive.mode === WEBGL_CONSTANTS.LINE_STRIP) {\n mesh = new three__WEBPACK_IMPORTED_MODULE_0__.Line(geometry, _material);\n } else if (primitive.mode === WEBGL_CONSTANTS.LINE_LOOP) {\n mesh = new three__WEBPACK_IMPORTED_MODULE_0__.LineLoop(geometry, _material);\n } else if (primitive.mode === WEBGL_CONSTANTS.POINTS) {\n mesh = new three__WEBPACK_IMPORTED_MODULE_0__.Points(geometry, _material);\n } else {\n throw new Error('THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode);\n }\n if (Object.keys(mesh.geometry.morphAttributes).length > 0) {\n updateMorphTargets(mesh, meshDef);\n }\n mesh.name = parser.createUniqueName(meshDef.name || 'mesh_' + meshIndex);\n assignExtrasToUserData(mesh, meshDef);\n if (primitive.extensions) addUnknownExtensionsToUserData(extensions, mesh, primitive);\n parser.assignFinalMaterial(mesh);\n meshes.push(mesh);\n }\n for (var _i5 = 0, _il4 = meshes.length; _i5 < _il4; _i5++) {\n parser.associations.set(meshes[_i5], {\n meshes: meshIndex,\n primitives: _i5\n });\n }\n if (meshes.length === 1) {\n return meshes[0];\n }\n var group = new three__WEBPACK_IMPORTED_MODULE_0__.Group();\n parser.associations.set(group, {\n meshes: meshIndex\n });\n for (var _i6 = 0, _il5 = meshes.length; _i6 < _il5; _i6++) {\n group.add(meshes[_i6]);\n }\n return group;\n });\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras\n * @param {number} cameraIndex\n * @return {Promise}\n */\n }, {\n key: \"loadCamera\",\n value: function loadCamera(cameraIndex) {\n var camera;\n var cameraDef = this.json.cameras[cameraIndex];\n var params = cameraDef[cameraDef.type];\n if (!params) {\n console.warn('THREE.GLTFLoader: Missing camera parameters.');\n return;\n }\n if (cameraDef.type === 'perspective') {\n camera = new three__WEBPACK_IMPORTED_MODULE_0__.PerspectiveCamera(three__WEBPACK_IMPORTED_MODULE_0__.MathUtils.radToDeg(params.yfov), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6);\n } else if (cameraDef.type === 'orthographic') {\n camera = new three__WEBPACK_IMPORTED_MODULE_0__.OrthographicCamera(-params.xmag, params.xmag, params.ymag, -params.ymag, params.znear, params.zfar);\n }\n if (cameraDef.name) camera.name = this.createUniqueName(cameraDef.name);\n assignExtrasToUserData(camera, cameraDef);\n return Promise.resolve(camera);\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins\n * @param {number} skinIndex\n * @return {Promise}\n */\n }, {\n key: \"loadSkin\",\n value: function loadSkin(skinIndex) {\n var skinDef = this.json.skins[skinIndex];\n var pending = [];\n for (var i = 0, il = skinDef.joints.length; i < il; i++) {\n pending.push(this._loadNodeShallow(skinDef.joints[i]));\n }\n if (skinDef.inverseBindMatrices !== undefined) {\n pending.push(this.getDependency('accessor', skinDef.inverseBindMatrices));\n } else {\n pending.push(null);\n }\n return Promise.all(pending).then(function (results) {\n var inverseBindMatrices = results.pop();\n var jointNodes = results;\n\n // Note that bones (joint nodes) may or may not be in the\n // scene graph at this time.\n\n var bones = [];\n var boneInverses = [];\n for (var _i7 = 0, _il6 = jointNodes.length; _i7 < _il6; _i7++) {\n var jointNode = jointNodes[_i7];\n if (jointNode) {\n bones.push(jointNode);\n var mat = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4();\n if (inverseBindMatrices !== null) {\n mat.fromArray(inverseBindMatrices.array, _i7 * 16);\n }\n boneInverses.push(mat);\n } else {\n console.warn('THREE.GLTFLoader: Joint \"%s\" could not be found.', skinDef.joints[_i7]);\n }\n }\n return new three__WEBPACK_IMPORTED_MODULE_0__.Skeleton(bones, boneInverses);\n });\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations\n * @param {number} animationIndex\n * @return {Promise}\n */\n }, {\n key: \"loadAnimation\",\n value: function loadAnimation(animationIndex) {\n var json = this.json;\n var animationDef = json.animations[animationIndex];\n var animationName = animationDef.name ? animationDef.name : 'animation_' + animationIndex;\n var pendingNodes = [];\n var pendingInputAccessors = [];\n var pendingOutputAccessors = [];\n var pendingSamplers = [];\n var pendingTargets = [];\n for (var i = 0, il = animationDef.channels.length; i < il; i++) {\n var channel = animationDef.channels[i];\n var sampler = animationDef.samplers[channel.sampler];\n var target = channel.target;\n var name = target.node;\n var input = animationDef.parameters !== undefined ? animationDef.parameters[sampler.input] : sampler.input;\n var output = animationDef.parameters !== undefined ? animationDef.parameters[sampler.output] : sampler.output;\n if (target.node === undefined) continue;\n pendingNodes.push(this.getDependency('node', name));\n pendingInputAccessors.push(this.getDependency('accessor', input));\n pendingOutputAccessors.push(this.getDependency('accessor', output));\n pendingSamplers.push(sampler);\n pendingTargets.push(target);\n }\n return Promise.all([Promise.all(pendingNodes), Promise.all(pendingInputAccessors), Promise.all(pendingOutputAccessors), Promise.all(pendingSamplers), Promise.all(pendingTargets)]).then(function (dependencies) {\n var nodes = dependencies[0];\n var inputAccessors = dependencies[1];\n var outputAccessors = dependencies[2];\n var samplers = dependencies[3];\n var targets = dependencies[4];\n var tracks = [];\n var _loop2 = function _loop2() {\n var node = nodes[_i8];\n var inputAccessor = inputAccessors[_i8];\n var outputAccessor = outputAccessors[_i8];\n var sampler = samplers[_i8];\n var target = targets[_i8];\n if (node === undefined) return \"continue\";\n node.updateMatrix();\n var TypedKeyframeTrack;\n switch (PATH_PROPERTIES[target.path]) {\n case PATH_PROPERTIES.weights:\n TypedKeyframeTrack = three__WEBPACK_IMPORTED_MODULE_0__.NumberKeyframeTrack;\n break;\n case PATH_PROPERTIES.rotation:\n TypedKeyframeTrack = three__WEBPACK_IMPORTED_MODULE_0__.QuaternionKeyframeTrack;\n break;\n case PATH_PROPERTIES.position:\n case PATH_PROPERTIES.scale:\n default:\n TypedKeyframeTrack = three__WEBPACK_IMPORTED_MODULE_0__.VectorKeyframeTrack;\n break;\n }\n var targetName = node.name ? node.name : node.uuid;\n var interpolation = sampler.interpolation !== undefined ? INTERPOLATION[sampler.interpolation] : three__WEBPACK_IMPORTED_MODULE_0__.InterpolateLinear;\n var targetNames = [];\n if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) {\n node.traverse(function (object) {\n if (object.morphTargetInfluences) {\n targetNames.push(object.name ? object.name : object.uuid);\n }\n });\n } else {\n targetNames.push(targetName);\n }\n var outputArray = outputAccessor.array;\n if (outputAccessor.normalized) {\n var scale = getNormalizedComponentScale(outputArray.constructor);\n var scaled = new Float32Array(outputArray.length);\n for (var j = 0, jl = outputArray.length; j < jl; j++) {\n scaled[j] = outputArray[j] * scale;\n }\n outputArray = scaled;\n }\n for (var _j = 0, _jl = targetNames.length; _j < _jl; _j++) {\n var track = new TypedKeyframeTrack(targetNames[_j] + '.' + PATH_PROPERTIES[target.path], inputAccessor.array, outputArray, interpolation);\n\n // Override interpolation with custom factory method.\n if (sampler.interpolation === 'CUBICSPLINE') {\n track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline(result) {\n // A CUBICSPLINE keyframe in glTF has three output values for each input value,\n // representing inTangent, splineVertex, and outTangent. As a result, track.getValueSize()\n // must be divided by three to get the interpolant's sampleSize argument.\n\n var interpolantType = this instanceof three__WEBPACK_IMPORTED_MODULE_0__.QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;\n return new interpolantType(this.times, this.values, this.getValueSize() / 3, result);\n };\n\n // Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.\n track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;\n }\n tracks.push(track);\n }\n };\n for (var _i8 = 0, _il7 = nodes.length; _i8 < _il7; _i8++) {\n var _ret = _loop2();\n if (_ret === \"continue\") continue;\n }\n return new three__WEBPACK_IMPORTED_MODULE_0__.AnimationClip(animationName, undefined, tracks);\n });\n }\n }, {\n key: \"createNodeMesh\",\n value: function createNodeMesh(nodeIndex) {\n var json = this.json;\n var parser = this;\n var nodeDef = json.nodes[nodeIndex];\n if (nodeDef.mesh === undefined) return null;\n return parser.getDependency('mesh', nodeDef.mesh).then(function (mesh) {\n var node = parser._getNodeRef(parser.meshCache, nodeDef.mesh, mesh);\n\n // if weights are provided on the node, override weights on the mesh.\n if (nodeDef.weights !== undefined) {\n node.traverse(function (o) {\n if (!o.isMesh) return;\n for (var i = 0, il = nodeDef.weights.length; i < il; i++) {\n o.morphTargetInfluences[i] = nodeDef.weights[i];\n }\n });\n }\n return node;\n });\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy\n * @param {number} nodeIndex\n * @return {Promise}\n */\n }, {\n key: \"loadNode\",\n value: function loadNode(nodeIndex) {\n var json = this.json;\n var parser = this;\n var nodeDef = json.nodes[nodeIndex];\n var nodePending = parser._loadNodeShallow(nodeIndex);\n var childPending = [];\n var childrenDef = nodeDef.children || [];\n for (var i = 0, il = childrenDef.length; i < il; i++) {\n childPending.push(parser.getDependency('node', childrenDef[i]));\n }\n var skeletonPending = nodeDef.skin === undefined ? Promise.resolve(null) : parser.getDependency('skin', nodeDef.skin);\n return Promise.all([nodePending, Promise.all(childPending), skeletonPending]).then(function (results) {\n var node = results[0];\n var children = results[1];\n var skeleton = results[2];\n if (skeleton !== null) {\n // This full traverse should be fine because\n // child glTF nodes have not been added to this node yet.\n node.traverse(function (mesh) {\n if (!mesh.isSkinnedMesh) return;\n mesh.bind(skeleton, _identityMatrix);\n });\n }\n for (var _i9 = 0, _il8 = children.length; _i9 < _il8; _i9++) {\n node.add(children[_i9]);\n }\n return node;\n });\n }\n\n // ._loadNodeShallow() parses a single node.\n // skin and child nodes are created and added in .loadNode() (no '_' prefix).\n }, {\n key: \"_loadNodeShallow\",\n value: function _loadNodeShallow(nodeIndex) {\n var json = this.json;\n var extensions = this.extensions;\n var parser = this;\n\n // This method is called from .loadNode() and .loadSkin().\n // Cache a node to avoid duplication.\n\n if (this.nodeCache[nodeIndex] !== undefined) {\n return this.nodeCache[nodeIndex];\n }\n var nodeDef = json.nodes[nodeIndex];\n\n // reserve node's name before its dependencies, so the root has the intended name.\n var nodeName = nodeDef.name ? parser.createUniqueName(nodeDef.name) : '';\n var pending = [];\n var meshPromise = parser._invokeOne(function (ext) {\n return ext.createNodeMesh && ext.createNodeMesh(nodeIndex);\n });\n if (meshPromise) {\n pending.push(meshPromise);\n }\n if (nodeDef.camera !== undefined) {\n pending.push(parser.getDependency('camera', nodeDef.camera).then(function (camera) {\n return parser._getNodeRef(parser.cameraCache, nodeDef.camera, camera);\n }));\n }\n parser._invokeAll(function (ext) {\n return ext.createNodeAttachment && ext.createNodeAttachment(nodeIndex);\n }).forEach(function (promise) {\n pending.push(promise);\n });\n this.nodeCache[nodeIndex] = Promise.all(pending).then(function (objects) {\n var node;\n\n // .isBone isn't in glTF spec. See ._markDefs\n if (nodeDef.isBone === true) {\n node = new three__WEBPACK_IMPORTED_MODULE_0__.Bone();\n } else if (objects.length > 1) {\n node = new three__WEBPACK_IMPORTED_MODULE_0__.Group();\n } else if (objects.length === 1) {\n node = objects[0];\n } else {\n node = new three__WEBPACK_IMPORTED_MODULE_0__.Object3D();\n }\n if (node !== objects[0]) {\n for (var i = 0, il = objects.length; i < il; i++) {\n node.add(objects[i]);\n }\n }\n if (nodeDef.name) {\n node.userData.name = nodeDef.name;\n node.name = nodeName;\n }\n assignExtrasToUserData(node, nodeDef);\n if (nodeDef.extensions) addUnknownExtensionsToUserData(extensions, node, nodeDef);\n if (nodeDef.matrix !== undefined) {\n var matrix = new three__WEBPACK_IMPORTED_MODULE_0__.Matrix4();\n matrix.fromArray(nodeDef.matrix);\n node.applyMatrix4(matrix);\n } else {\n if (nodeDef.translation !== undefined) {\n node.position.fromArray(nodeDef.translation);\n }\n if (nodeDef.rotation !== undefined) {\n node.quaternion.fromArray(nodeDef.rotation);\n }\n if (nodeDef.scale !== undefined) {\n node.scale.fromArray(nodeDef.scale);\n }\n }\n if (!parser.associations.has(node)) {\n parser.associations.set(node, {});\n }\n parser.associations.get(node).nodes = nodeIndex;\n return node;\n });\n return this.nodeCache[nodeIndex];\n }\n\n /**\n * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes\n * @param {number} sceneIndex\n * @return {Promise}\n */\n }, {\n key: \"loadScene\",\n value: function loadScene(sceneIndex) {\n var extensions = this.extensions;\n var sceneDef = this.json.scenes[sceneIndex];\n var parser = this;\n\n // Loader returns Group, not Scene.\n // See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172\n var scene = new three__WEBPACK_IMPORTED_MODULE_0__.Group();\n if (sceneDef.name) scene.name = parser.createUniqueName(sceneDef.name);\n assignExtrasToUserData(scene, sceneDef);\n if (sceneDef.extensions) addUnknownExtensionsToUserData(extensions, scene, sceneDef);\n var nodeIds = sceneDef.nodes || [];\n var pending = [];\n for (var i = 0, il = nodeIds.length; i < il; i++) {\n pending.push(parser.getDependency('node', nodeIds[i]));\n }\n return Promise.all(pending).then(function (nodes) {\n for (var _i10 = 0, _il9 = nodes.length; _i10 < _il9; _i10++) {\n scene.add(nodes[_i10]);\n }\n\n // Removes dangling associations, associations that reference a node that\n // didn't make it into the scene.\n var reduceAssociations = function reduceAssociations(node) {\n var reducedAssociations = new Map();\n var _iterator4 = _createForOfIteratorHelper(parser.associations),\n _step4;\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var _step4$value = _slicedToArray(_step4.value, 2),\n key = _step4$value[0],\n value = _step4$value[1];\n if (key instanceof three__WEBPACK_IMPORTED_MODULE_0__.Material || key instanceof three__WEBPACK_IMPORTED_MODULE_0__.Texture) {\n reducedAssociations.set(key, value);\n }\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n node.traverse(function (node) {\n var mappings = parser.associations.get(node);\n if (mappings != null) {\n reducedAssociations.set(node, mappings);\n }\n });\n return reducedAssociations;\n };\n parser.associations = reduceAssociations(scene);\n return scene;\n });\n }\n }]);\n return GLTFParser;\n}();\n/**\n * @param {BufferGeometry} geometry\n * @param {GLTF.Primitive} primitiveDef\n * @param {GLTFParser} parser\n */\nfunction computeBounds(geometry, primitiveDef, parser) {\n var attributes = primitiveDef.attributes;\n var box = new three__WEBPACK_IMPORTED_MODULE_0__.Box3();\n if (attributes.POSITION !== undefined) {\n var accessor = parser.json.accessors[attributes.POSITION];\n var min = accessor.min;\n var max = accessor.max;\n\n // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n\n if (min !== undefined && max !== undefined) {\n box.set(new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(min[0], min[1], min[2]), new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(max[0], max[1], max[2]));\n if (accessor.normalized) {\n var boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]);\n box.min.multiplyScalar(boxScale);\n box.max.multiplyScalar(boxScale);\n }\n } else {\n console.warn('THREE.GLTFLoader: Missing min/max properties for accessor POSITION.');\n return;\n }\n } else {\n return;\n }\n var targets = primitiveDef.targets;\n if (targets !== undefined) {\n var maxDisplacement = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var vector = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n for (var i = 0, il = targets.length; i < il; i++) {\n var target = targets[i];\n if (target.POSITION !== undefined) {\n var _accessor = parser.json.accessors[target.POSITION];\n var _min = _accessor.min;\n var _max = _accessor.max;\n\n // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.\n\n if (_min !== undefined && _max !== undefined) {\n // we need to get max of absolute components because target weight is [-1,1]\n vector.setX(Math.max(Math.abs(_min[0]), Math.abs(_max[0])));\n vector.setY(Math.max(Math.abs(_min[1]), Math.abs(_max[1])));\n vector.setZ(Math.max(Math.abs(_min[2]), Math.abs(_max[2])));\n if (_accessor.normalized) {\n var _boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[_accessor.componentType]);\n vector.multiplyScalar(_boxScale);\n }\n\n // Note: this assumes that the sum of all weights is at most 1. This isn't quite correct - it's more conservative\n // to assume that each target can have a max weight of 1. However, for some use cases - notably, when morph targets\n // are used to implement key-frame animations and as such only two are active at a time - this results in very large\n // boxes. So for now we make a box that's sometimes a touch too small but is hopefully mostly of reasonable size.\n maxDisplacement.max(vector);\n } else {\n console.warn('THREE.GLTFLoader: Missing min/max properties for accessor POSITION.');\n }\n }\n }\n\n // As per comment above this box isn't conservative, but has a reasonable size for a very large number of morph targets.\n box.expandByVector(maxDisplacement);\n }\n geometry.boundingBox = box;\n var sphere = new three__WEBPACK_IMPORTED_MODULE_0__.Sphere();\n box.getCenter(sphere.center);\n sphere.radius = box.min.distanceTo(box.max) / 2;\n geometry.boundingSphere = sphere;\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {GLTF.Primitive} primitiveDef\n * @param {GLTFParser} parser\n * @return {Promise}\n */\nfunction addPrimitiveAttributes(geometry, primitiveDef, parser) {\n var attributes = primitiveDef.attributes;\n var pending = [];\n function assignAttributeAccessor(accessorIndex, attributeName) {\n return parser.getDependency('accessor', accessorIndex).then(function (accessor) {\n geometry.setAttribute(attributeName, accessor);\n });\n }\n for (var gltfAttributeName in attributes) {\n var threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase();\n\n // Skip attributes already provided by e.g. Draco extension.\n if (threeAttributeName in geometry.attributes) continue;\n pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName));\n }\n if (primitiveDef.indices !== undefined && !geometry.index) {\n var accessor = parser.getDependency('accessor', primitiveDef.indices).then(function (accessor) {\n geometry.setIndex(accessor);\n });\n pending.push(accessor);\n }\n assignExtrasToUserData(geometry, primitiveDef);\n computeBounds(geometry, primitiveDef, parser);\n return Promise.all(pending).then(function () {\n return primitiveDef.targets !== undefined ? addMorphTargets(geometry, primitiveDef.targets, parser) : geometry;\n });\n}\n\n\n//# sourceURL=webpack://dgi_3d_viewer/../../../libraries/three/examples/jsm/loaders/GLTFLoader.js?"); /***/ }), +/***/ "../../../libraries/three/examples/jsm/loaders/MTLLoader.js": +/*!******************************************************************!*\ + !*** ../../../libraries/three/examples/jsm/loaders/MTLLoader.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"MTLLoader\": () => (/* binding */ MTLLoader)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"../../../libraries/three/build/three.module.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n/**\n * Loads a Wavefront .mtl file specifying materials\n */\nvar MTLLoader = /*#__PURE__*/function (_Loader) {\n _inherits(MTLLoader, _Loader);\n var _super = _createSuper(MTLLoader);\n function MTLLoader(manager) {\n _classCallCheck(this, MTLLoader);\n return _super.call(this, manager);\n }\n\n /**\n * Loads and parses a MTL asset from a URL.\n *\n * @param {String} url - URL to the MTL file.\n * @param {Function} [onLoad] - Callback invoked with the loaded object.\n * @param {Function} [onProgress] - Callback for download progress.\n * @param {Function} [onError] - Callback for download errors.\n *\n * @see setPath setResourcePath\n *\n * @note In order for relative texture references to resolve correctly\n * you must call setResourcePath() explicitly prior to load.\n */\n _createClass(MTLLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n var scope = this;\n var path = this.path === '' ? three__WEBPACK_IMPORTED_MODULE_0__.LoaderUtils.extractUrlBase(url) : this.path;\n var loader = new three__WEBPACK_IMPORTED_MODULE_0__.FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function (text) {\n try {\n onLoad(scope.parse(text, path));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n }, onProgress, onError);\n }\n }, {\n key: \"setMaterialOptions\",\n value: function setMaterialOptions(value) {\n this.materialOptions = value;\n return this;\n }\n\n /**\n * Parses a MTL file.\n *\n * @param {String} text - Content of MTL file\n * @return {MaterialCreator}\n *\n * @see setPath setResourcePath\n *\n * @note In order for relative texture references to resolve correctly\n * you must call setResourcePath() explicitly prior to parse.\n */\n }, {\n key: \"parse\",\n value: function parse(text, path) {\n var lines = text.split('\\n');\n var info = {};\n var delimiter_pattern = /\\s+/;\n var materialsInfo = {};\n for (var i = 0; i < lines.length; i++) {\n var line = lines[i];\n line = line.trim();\n if (line.length === 0 || line.charAt(0) === '#') {\n // Blank line or comment ignore\n continue;\n }\n var pos = line.indexOf(' ');\n var key = pos >= 0 ? line.substring(0, pos) : line;\n key = key.toLowerCase();\n var value = pos >= 0 ? line.substring(pos + 1) : '';\n value = value.trim();\n if (key === 'newmtl') {\n // New material\n\n info = {\n name: value\n };\n materialsInfo[value] = info;\n } else {\n if (key === 'ka' || key === 'kd' || key === 'ks' || key === 'ke') {\n var ss = value.split(delimiter_pattern, 3);\n info[key] = [parseFloat(ss[0]), parseFloat(ss[1]), parseFloat(ss[2])];\n } else {\n info[key] = value;\n }\n }\n }\n var materialCreator = new MaterialCreator(this.resourcePath || path, this.materialOptions);\n materialCreator.setCrossOrigin(this.crossOrigin);\n materialCreator.setManager(this.manager);\n materialCreator.setMaterials(materialsInfo);\n return materialCreator;\n }\n }]);\n return MTLLoader;\n}(three__WEBPACK_IMPORTED_MODULE_0__.Loader);\n/**\n * Create a new MTLLoader.MaterialCreator\n * @param baseUrl - Url relative to which textures are loaded\n * @param options - Set of options on how to construct the materials\n * side: Which side to apply the material\n * FrontSide (default), THREE.BackSide, THREE.DoubleSide\n * wrap: What type of wrapping to apply for textures\n * RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping\n * normalizeRGB: RGBs need to be normalized to 0-1 from 0-255\n * Default: false, assumed to be already normalized\n * ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's\n * Default: false\n * @constructor\n */\nvar MaterialCreator = /*#__PURE__*/function () {\n function MaterialCreator() {\n var baseUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, MaterialCreator);\n this.baseUrl = baseUrl;\n this.options = options;\n this.materialsInfo = {};\n this.materials = {};\n this.materialsArray = [];\n this.nameLookup = {};\n this.crossOrigin = 'anonymous';\n this.side = this.options.side !== undefined ? this.options.side : three__WEBPACK_IMPORTED_MODULE_0__.FrontSide;\n this.wrap = this.options.wrap !== undefined ? this.options.wrap : three__WEBPACK_IMPORTED_MODULE_0__.RepeatWrapping;\n }\n _createClass(MaterialCreator, [{\n key: \"setCrossOrigin\",\n value: function setCrossOrigin(value) {\n this.crossOrigin = value;\n return this;\n }\n }, {\n key: \"setManager\",\n value: function setManager(value) {\n this.manager = value;\n }\n }, {\n key: \"setMaterials\",\n value: function setMaterials(materialsInfo) {\n this.materialsInfo = this.convert(materialsInfo);\n this.materials = {};\n this.materialsArray = [];\n this.nameLookup = {};\n }\n }, {\n key: \"convert\",\n value: function convert(materialsInfo) {\n if (!this.options) return materialsInfo;\n var converted = {};\n for (var mn in materialsInfo) {\n // Convert materials info into normalized form based on options\n\n var mat = materialsInfo[mn];\n var covmat = {};\n converted[mn] = covmat;\n for (var prop in mat) {\n var save = true;\n var value = mat[prop];\n var lprop = prop.toLowerCase();\n switch (lprop) {\n case 'kd':\n case 'ka':\n case 'ks':\n // Diffuse color (color under white light) using RGB values\n\n if (this.options && this.options.normalizeRGB) {\n value = [value[0] / 255, value[1] / 255, value[2] / 255];\n }\n if (this.options && this.options.ignoreZeroRGBs) {\n if (value[0] === 0 && value[1] === 0 && value[2] === 0) {\n // ignore\n\n save = false;\n }\n }\n break;\n default:\n break;\n }\n if (save) {\n covmat[lprop] = value;\n }\n }\n }\n return converted;\n }\n }, {\n key: \"preload\",\n value: function preload() {\n for (var mn in this.materialsInfo) {\n this.create(mn);\n }\n }\n }, {\n key: \"getIndex\",\n value: function getIndex(materialName) {\n return this.nameLookup[materialName];\n }\n }, {\n key: \"getAsArray\",\n value: function getAsArray() {\n var index = 0;\n for (var mn in this.materialsInfo) {\n this.materialsArray[index] = this.create(mn);\n this.nameLookup[mn] = index;\n index++;\n }\n return this.materialsArray;\n }\n }, {\n key: \"create\",\n value: function create(materialName) {\n if (this.materials[materialName] === undefined) {\n this.createMaterial_(materialName);\n }\n return this.materials[materialName];\n }\n }, {\n key: \"createMaterial_\",\n value: function createMaterial_(materialName) {\n // Create material\n\n var scope = this;\n var mat = this.materialsInfo[materialName];\n var params = {\n name: materialName,\n side: this.side\n };\n function resolveURL(baseUrl, url) {\n if (typeof url !== 'string' || url === '') return '';\n\n // Absolute URL\n if (/^https?:\\/\\//i.test(url)) return url;\n return baseUrl + url;\n }\n function setMapForType(mapType, value) {\n if (params[mapType]) return; // Keep the first encountered texture\n\n var texParams = scope.getTextureParams(value, params);\n var map = scope.loadTexture(resolveURL(scope.baseUrl, texParams.url));\n map.repeat.copy(texParams.scale);\n map.offset.copy(texParams.offset);\n map.wrapS = scope.wrap;\n map.wrapT = scope.wrap;\n if (mapType === 'map' || mapType === 'emissiveMap') {\n map.encoding = three__WEBPACK_IMPORTED_MODULE_0__.sRGBEncoding;\n }\n params[mapType] = map;\n }\n for (var prop in mat) {\n var value = mat[prop];\n var n = void 0;\n if (value === '') continue;\n switch (prop.toLowerCase()) {\n // Ns is material specular exponent\n\n case 'kd':\n // Diffuse color (color under white light) using RGB values\n\n params.color = new three__WEBPACK_IMPORTED_MODULE_0__.Color().fromArray(value).convertSRGBToLinear();\n break;\n case 'ks':\n // Specular color (color when light is reflected from shiny surface) using RGB values\n params.specular = new three__WEBPACK_IMPORTED_MODULE_0__.Color().fromArray(value).convertSRGBToLinear();\n break;\n case 'ke':\n // Emissive using RGB values\n params.emissive = new three__WEBPACK_IMPORTED_MODULE_0__.Color().fromArray(value).convertSRGBToLinear();\n break;\n case 'map_kd':\n // Diffuse texture map\n\n setMapForType('map', value);\n break;\n case 'map_ks':\n // Specular map\n\n setMapForType('specularMap', value);\n break;\n case 'map_ke':\n // Emissive map\n\n setMapForType('emissiveMap', value);\n break;\n case 'norm':\n setMapForType('normalMap', value);\n break;\n case 'map_bump':\n case 'bump':\n // Bump texture map\n\n setMapForType('bumpMap', value);\n break;\n case 'map_d':\n // Alpha map\n\n setMapForType('alphaMap', value);\n params.transparent = true;\n break;\n case 'ns':\n // The specular exponent (defines the focus of the specular highlight)\n // A high exponent results in a tight, concentrated highlight. Ns values normally range from 0 to 1000.\n\n params.shininess = parseFloat(value);\n break;\n case 'd':\n n = parseFloat(value);\n if (n < 1) {\n params.opacity = n;\n params.transparent = true;\n }\n break;\n case 'tr':\n n = parseFloat(value);\n if (this.options && this.options.invertTrProperty) n = 1 - n;\n if (n > 0) {\n params.opacity = 1 - n;\n params.transparent = true;\n }\n break;\n default:\n break;\n }\n }\n this.materials[materialName] = new three__WEBPACK_IMPORTED_MODULE_0__.MeshPhongMaterial(params);\n return this.materials[materialName];\n }\n }, {\n key: \"getTextureParams\",\n value: function getTextureParams(value, matParams) {\n var texParams = {\n scale: new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(1, 1),\n offset: new three__WEBPACK_IMPORTED_MODULE_0__.Vector2(0, 0)\n };\n var items = value.split(/\\s+/);\n var pos;\n pos = items.indexOf('-bm');\n if (pos >= 0) {\n matParams.bumpScale = parseFloat(items[pos + 1]);\n items.splice(pos, 2);\n }\n pos = items.indexOf('-s');\n if (pos >= 0) {\n texParams.scale.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2]));\n items.splice(pos, 4); // we expect 3 parameters here!\n }\n\n pos = items.indexOf('-o');\n if (pos >= 0) {\n texParams.offset.set(parseFloat(items[pos + 1]), parseFloat(items[pos + 2]));\n items.splice(pos, 4); // we expect 3 parameters here!\n }\n\n texParams.url = items.join(' ').trim();\n return texParams;\n }\n }, {\n key: \"loadTexture\",\n value: function loadTexture(url, mapping, onLoad, onProgress, onError) {\n var manager = this.manager !== undefined ? this.manager : three__WEBPACK_IMPORTED_MODULE_0__.DefaultLoadingManager;\n var loader = manager.getHandler(url);\n if (loader === null) {\n loader = new three__WEBPACK_IMPORTED_MODULE_0__.TextureLoader(manager);\n }\n if (loader.setCrossOrigin) loader.setCrossOrigin(this.crossOrigin);\n var texture = loader.load(url, onLoad, onProgress, onError);\n if (mapping !== undefined) texture.mapping = mapping;\n return texture;\n }\n }]);\n return MaterialCreator;\n}();\n\n\n//# sourceURL=webpack://dgi_3d_viewer/../../../libraries/three/examples/jsm/loaders/MTLLoader.js?"); + +/***/ }), + +/***/ "../../../libraries/three/examples/jsm/loaders/OBJLoader.js": +/*!******************************************************************!*\ + !*** ../../../libraries/three/examples/jsm/loaders/OBJLoader.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"OBJLoader\": () => (/* binding */ OBJLoader)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"../../../libraries/three/build/three.module.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n// o object_name | g group_name\nvar _object_pattern = /^[og]\\s*(.+)?/;\n// mtllib file_reference\nvar _material_library_pattern = /^mtllib /;\n// usemtl material_name\nvar _material_use_pattern = /^usemtl /;\n// usemap map_name\nvar _map_use_pattern = /^usemap /;\nvar _face_vertex_data_separator_pattern = /\\s+/;\nvar _vA = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nvar _vB = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nvar _vC = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nvar _ab = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nvar _cb = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\nvar _color = new three__WEBPACK_IMPORTED_MODULE_0__.Color();\nfunction ParserState() {\n var state = {\n objects: [],\n object: {},\n vertices: [],\n normals: [],\n colors: [],\n uvs: [],\n materials: {},\n materialLibraries: [],\n startObject: function startObject(name, fromDeclaration) {\n // If the current object (initial from reset) is not from a g/o declaration in the parsed\n // file. We need to use it for the first parsed g/o to keep things in sync.\n if (this.object && this.object.fromDeclaration === false) {\n this.object.name = name;\n this.object.fromDeclaration = fromDeclaration !== false;\n return;\n }\n var previousMaterial = this.object && typeof this.object.currentMaterial === 'function' ? this.object.currentMaterial() : undefined;\n if (this.object && typeof this.object._finalize === 'function') {\n this.object._finalize(true);\n }\n this.object = {\n name: name || '',\n fromDeclaration: fromDeclaration !== false,\n geometry: {\n vertices: [],\n normals: [],\n colors: [],\n uvs: [],\n hasUVIndices: false\n },\n materials: [],\n smooth: true,\n startMaterial: function startMaterial(name, libraries) {\n var previous = this._finalize(false);\n\n // New usemtl declaration overwrites an inherited material, except if faces were declared\n // after the material, then it must be preserved for proper MultiMaterial continuation.\n if (previous && (previous.inherited || previous.groupCount <= 0)) {\n this.materials.splice(previous.index, 1);\n }\n var material = {\n index: this.materials.length,\n name: name || '',\n mtllib: Array.isArray(libraries) && libraries.length > 0 ? libraries[libraries.length - 1] : '',\n smooth: previous !== undefined ? previous.smooth : this.smooth,\n groupStart: previous !== undefined ? previous.groupEnd : 0,\n groupEnd: -1,\n groupCount: -1,\n inherited: false,\n clone: function clone(index) {\n var cloned = {\n index: typeof index === 'number' ? index : this.index,\n name: this.name,\n mtllib: this.mtllib,\n smooth: this.smooth,\n groupStart: 0,\n groupEnd: -1,\n groupCount: -1,\n inherited: false\n };\n cloned.clone = this.clone.bind(cloned);\n return cloned;\n }\n };\n this.materials.push(material);\n return material;\n },\n currentMaterial: function currentMaterial() {\n if (this.materials.length > 0) {\n return this.materials[this.materials.length - 1];\n }\n return undefined;\n },\n _finalize: function _finalize(end) {\n var lastMultiMaterial = this.currentMaterial();\n if (lastMultiMaterial && lastMultiMaterial.groupEnd === -1) {\n lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3;\n lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart;\n lastMultiMaterial.inherited = false;\n }\n\n // Ignore objects tail materials if no face declarations followed them before a new o/g started.\n if (end && this.materials.length > 1) {\n for (var mi = this.materials.length - 1; mi >= 0; mi--) {\n if (this.materials[mi].groupCount <= 0) {\n this.materials.splice(mi, 1);\n }\n }\n }\n\n // Guarantee at least one empty material, this makes the creation later more straight forward.\n if (end && this.materials.length === 0) {\n this.materials.push({\n name: '',\n smooth: this.smooth\n });\n }\n return lastMultiMaterial;\n }\n };\n\n // Inherit previous objects material.\n // Spec tells us that a declared material must be set to all objects until a new material is declared.\n // If a usemtl declaration is encountered while this new object is being parsed, it will\n // overwrite the inherited material. Exception being that there was already face declarations\n // to the inherited material, then it will be preserved for proper MultiMaterial continuation.\n\n if (previousMaterial && previousMaterial.name && typeof previousMaterial.clone === 'function') {\n var declared = previousMaterial.clone(0);\n declared.inherited = true;\n this.object.materials.push(declared);\n }\n this.objects.push(this.object);\n },\n finalize: function finalize() {\n if (this.object && typeof this.object._finalize === 'function') {\n this.object._finalize(true);\n }\n },\n parseVertexIndex: function parseVertexIndex(value, len) {\n var index = parseInt(value, 10);\n return (index >= 0 ? index - 1 : index + len / 3) * 3;\n },\n parseNormalIndex: function parseNormalIndex(value, len) {\n var index = parseInt(value, 10);\n return (index >= 0 ? index - 1 : index + len / 3) * 3;\n },\n parseUVIndex: function parseUVIndex(value, len) {\n var index = parseInt(value, 10);\n return (index >= 0 ? index - 1 : index + len / 2) * 2;\n },\n addVertex: function addVertex(a, b, c) {\n var src = this.vertices;\n var dst = this.object.geometry.vertices;\n dst.push(src[a + 0], src[a + 1], src[a + 2]);\n dst.push(src[b + 0], src[b + 1], src[b + 2]);\n dst.push(src[c + 0], src[c + 1], src[c + 2]);\n },\n addVertexPoint: function addVertexPoint(a) {\n var src = this.vertices;\n var dst = this.object.geometry.vertices;\n dst.push(src[a + 0], src[a + 1], src[a + 2]);\n },\n addVertexLine: function addVertexLine(a) {\n var src = this.vertices;\n var dst = this.object.geometry.vertices;\n dst.push(src[a + 0], src[a + 1], src[a + 2]);\n },\n addNormal: function addNormal(a, b, c) {\n var src = this.normals;\n var dst = this.object.geometry.normals;\n dst.push(src[a + 0], src[a + 1], src[a + 2]);\n dst.push(src[b + 0], src[b + 1], src[b + 2]);\n dst.push(src[c + 0], src[c + 1], src[c + 2]);\n },\n addFaceNormal: function addFaceNormal(a, b, c) {\n var src = this.vertices;\n var dst = this.object.geometry.normals;\n _vA.fromArray(src, a);\n _vB.fromArray(src, b);\n _vC.fromArray(src, c);\n _cb.subVectors(_vC, _vB);\n _ab.subVectors(_vA, _vB);\n _cb.cross(_ab);\n _cb.normalize();\n dst.push(_cb.x, _cb.y, _cb.z);\n dst.push(_cb.x, _cb.y, _cb.z);\n dst.push(_cb.x, _cb.y, _cb.z);\n },\n addColor: function addColor(a, b, c) {\n var src = this.colors;\n var dst = this.object.geometry.colors;\n if (src[a] !== undefined) dst.push(src[a + 0], src[a + 1], src[a + 2]);\n if (src[b] !== undefined) dst.push(src[b + 0], src[b + 1], src[b + 2]);\n if (src[c] !== undefined) dst.push(src[c + 0], src[c + 1], src[c + 2]);\n },\n addUV: function addUV(a, b, c) {\n var src = this.uvs;\n var dst = this.object.geometry.uvs;\n dst.push(src[a + 0], src[a + 1]);\n dst.push(src[b + 0], src[b + 1]);\n dst.push(src[c + 0], src[c + 1]);\n },\n addDefaultUV: function addDefaultUV() {\n var dst = this.object.geometry.uvs;\n dst.push(0, 0);\n dst.push(0, 0);\n dst.push(0, 0);\n },\n addUVLine: function addUVLine(a) {\n var src = this.uvs;\n var dst = this.object.geometry.uvs;\n dst.push(src[a + 0], src[a + 1]);\n },\n addFace: function addFace(a, b, c, ua, ub, uc, na, nb, nc) {\n var vLen = this.vertices.length;\n var ia = this.parseVertexIndex(a, vLen);\n var ib = this.parseVertexIndex(b, vLen);\n var ic = this.parseVertexIndex(c, vLen);\n this.addVertex(ia, ib, ic);\n this.addColor(ia, ib, ic);\n\n // normals\n\n if (na !== undefined && na !== '') {\n var nLen = this.normals.length;\n ia = this.parseNormalIndex(na, nLen);\n ib = this.parseNormalIndex(nb, nLen);\n ic = this.parseNormalIndex(nc, nLen);\n this.addNormal(ia, ib, ic);\n } else {\n this.addFaceNormal(ia, ib, ic);\n }\n\n // uvs\n\n if (ua !== undefined && ua !== '') {\n var uvLen = this.uvs.length;\n ia = this.parseUVIndex(ua, uvLen);\n ib = this.parseUVIndex(ub, uvLen);\n ic = this.parseUVIndex(uc, uvLen);\n this.addUV(ia, ib, ic);\n this.object.geometry.hasUVIndices = true;\n } else {\n // add placeholder values (for inconsistent face definitions)\n\n this.addDefaultUV();\n }\n },\n addPointGeometry: function addPointGeometry(vertices) {\n this.object.geometry.type = 'Points';\n var vLen = this.vertices.length;\n for (var vi = 0, l = vertices.length; vi < l; vi++) {\n var index = this.parseVertexIndex(vertices[vi], vLen);\n this.addVertexPoint(index);\n this.addColor(index);\n }\n },\n addLineGeometry: function addLineGeometry(vertices, uvs) {\n this.object.geometry.type = 'Line';\n var vLen = this.vertices.length;\n var uvLen = this.uvs.length;\n for (var vi = 0, l = vertices.length; vi < l; vi++) {\n this.addVertexLine(this.parseVertexIndex(vertices[vi], vLen));\n }\n for (var uvi = 0, _l = uvs.length; uvi < _l; uvi++) {\n this.addUVLine(this.parseUVIndex(uvs[uvi], uvLen));\n }\n }\n };\n state.startObject('', false);\n return state;\n}\n\n//\nvar OBJLoader = /*#__PURE__*/function (_Loader) {\n _inherits(OBJLoader, _Loader);\n var _super = _createSuper(OBJLoader);\n function OBJLoader(manager) {\n var _this;\n _classCallCheck(this, OBJLoader);\n _this = _super.call(this, manager);\n _this.materials = null;\n return _this;\n }\n _createClass(OBJLoader, [{\n key: \"load\",\n value: function load(url, onLoad, onProgress, onError) {\n var scope = this;\n var loader = new three__WEBPACK_IMPORTED_MODULE_0__.FileLoader(this.manager);\n loader.setPath(this.path);\n loader.setRequestHeader(this.requestHeader);\n loader.setWithCredentials(this.withCredentials);\n loader.load(url, function (text) {\n try {\n onLoad(scope.parse(text));\n } catch (e) {\n if (onError) {\n onError(e);\n } else {\n console.error(e);\n }\n scope.manager.itemError(url);\n }\n }, onProgress, onError);\n }\n }, {\n key: \"setMaterials\",\n value: function setMaterials(materials) {\n this.materials = materials;\n return this;\n }\n }, {\n key: \"parse\",\n value: function parse(text) {\n var state = new ParserState();\n if (text.indexOf('\\r\\n') !== -1) {\n // This is faster than String.split with regex that splits on both\n text = text.replace(/\\r\\n/g, '\\n');\n }\n if (text.indexOf('\\\\\\n') !== -1) {\n // join lines separated by a line continuation character (\\)\n text = text.replace(/\\\\\\n/g, '');\n }\n var lines = text.split('\\n');\n var result = [];\n for (var i = 0, l = lines.length; i < l; i++) {\n var line = lines[i].trimStart();\n if (line.length === 0) continue;\n var lineFirstChar = line.charAt(0);\n\n // @todo invoke passed in handler if any\n if (lineFirstChar === '#') continue;\n if (lineFirstChar === 'v') {\n var data = line.split(_face_vertex_data_separator_pattern);\n switch (data[0]) {\n case 'v':\n state.vertices.push(parseFloat(data[1]), parseFloat(data[2]), parseFloat(data[3]));\n if (data.length >= 7) {\n _color.setRGB(parseFloat(data[4]), parseFloat(data[5]), parseFloat(data[6])).convertSRGBToLinear();\n state.colors.push(_color.r, _color.g, _color.b);\n } else {\n // if no colors are defined, add placeholders so color and vertex indices match\n\n state.colors.push(undefined, undefined, undefined);\n }\n break;\n case 'vn':\n state.normals.push(parseFloat(data[1]), parseFloat(data[2]), parseFloat(data[3]));\n break;\n case 'vt':\n state.uvs.push(parseFloat(data[1]), parseFloat(data[2]));\n break;\n }\n } else if (lineFirstChar === 'f') {\n var lineData = line.slice(1).trim();\n var vertexData = lineData.split(_face_vertex_data_separator_pattern);\n var faceVertices = [];\n\n // Parse the face vertex data into an easy to work with format\n\n for (var j = 0, jl = vertexData.length; j < jl; j++) {\n var vertex = vertexData[j];\n if (vertex.length > 0) {\n var vertexParts = vertex.split('/');\n faceVertices.push(vertexParts);\n }\n }\n\n // Draw an edge between the first vertex and all subsequent vertices to form an n-gon\n\n var v1 = faceVertices[0];\n for (var _j = 1, _jl = faceVertices.length - 1; _j < _jl; _j++) {\n var v2 = faceVertices[_j];\n var v3 = faceVertices[_j + 1];\n state.addFace(v1[0], v2[0], v3[0], v1[1], v2[1], v3[1], v1[2], v2[2], v3[2]);\n }\n } else if (lineFirstChar === 'l') {\n var lineParts = line.substring(1).trim().split(' ');\n var lineVertices = [];\n var lineUVs = [];\n if (line.indexOf('/') === -1) {\n lineVertices = lineParts;\n } else {\n for (var li = 0, llen = lineParts.length; li < llen; li++) {\n var parts = lineParts[li].split('/');\n if (parts[0] !== '') lineVertices.push(parts[0]);\n if (parts[1] !== '') lineUVs.push(parts[1]);\n }\n }\n state.addLineGeometry(lineVertices, lineUVs);\n } else if (lineFirstChar === 'p') {\n var _lineData = line.slice(1).trim();\n var pointData = _lineData.split(' ');\n state.addPointGeometry(pointData);\n } else if ((result = _object_pattern.exec(line)) !== null) {\n // o object_name\n // or\n // g group_name\n\n // WORKAROUND: https://bugs.chromium.org/p/v8/issues/detail?id=2869\n // let name = result[ 0 ].slice( 1 ).trim();\n var name = (' ' + result[0].slice(1).trim()).slice(1);\n state.startObject(name);\n } else if (_material_use_pattern.test(line)) {\n // material\n\n state.object.startMaterial(line.substring(7).trim(), state.materialLibraries);\n } else if (_material_library_pattern.test(line)) {\n // mtl file\n\n state.materialLibraries.push(line.substring(7).trim());\n } else if (_map_use_pattern.test(line)) {\n // the line is parsed but ignored since the loader assumes textures are defined MTL files\n // (according to https://www.okino.com/conv/imp_wave.htm, 'usemap' is the old-style Wavefront texture reference method)\n\n console.warn('THREE.OBJLoader: Rendering identifier \"usemap\" not supported. Textures must be defined in MTL files.');\n } else if (lineFirstChar === 's') {\n result = line.split(' ');\n\n // smooth shading\n\n // @todo Handle files that have varying smooth values for a set of faces inside one geometry,\n // but does not define a usemtl for each face set.\n // This should be detected and a dummy material created (later MultiMaterial and geometry groups).\n // This requires some care to not create extra material on each smooth value for \"normal\" obj files.\n // where explicit usemtl defines geometry groups.\n // Example asset: examples/models/obj/cerberus/Cerberus.obj\n\n /*\n \t * http://paulbourke.net/dataformats/obj/\n \t *\n \t * From chapter \"Grouping\" Syntax explanation \"s group_number\":\n \t * \"group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.\n \t * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form\n \t * surfaces, smoothing groups are either turned on or off; there is no difference between values greater\n \t * than 0.\"\n \t */\n if (result.length > 1) {\n var value = result[1].trim().toLowerCase();\n state.object.smooth = value !== '0' && value !== 'off';\n } else {\n // ZBrush can produce \"s\" lines #11707\n state.object.smooth = true;\n }\n var material = state.object.currentMaterial();\n if (material) material.smooth = state.object.smooth;\n } else {\n // Handle null terminated files without exception\n if (line === '\\0') continue;\n console.warn('THREE.OBJLoader: Unexpected line: \"' + line + '\"');\n }\n }\n state.finalize();\n var container = new three__WEBPACK_IMPORTED_MODULE_0__.Group();\n container.materialLibraries = [].concat(state.materialLibraries);\n var hasPrimitives = !(state.objects.length === 1 && state.objects[0].geometry.vertices.length === 0);\n if (hasPrimitives === true) {\n for (var _i = 0, _l2 = state.objects.length; _i < _l2; _i++) {\n var object = state.objects[_i];\n var geometry = object.geometry;\n var materials = object.materials;\n var isLine = geometry.type === 'Line';\n var isPoints = geometry.type === 'Points';\n var hasVertexColors = false;\n\n // Skip o/g line declarations that did not follow with any faces\n if (geometry.vertices.length === 0) continue;\n var buffergeometry = new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry();\n buffergeometry.setAttribute('position', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(geometry.vertices, 3));\n if (geometry.normals.length > 0) {\n buffergeometry.setAttribute('normal', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(geometry.normals, 3));\n }\n if (geometry.colors.length > 0) {\n hasVertexColors = true;\n buffergeometry.setAttribute('color', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(geometry.colors, 3));\n }\n if (geometry.hasUVIndices === true) {\n buffergeometry.setAttribute('uv', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(geometry.uvs, 2));\n }\n\n // Create materials\n\n var createdMaterials = [];\n for (var mi = 0, miLen = materials.length; mi < miLen; mi++) {\n var sourceMaterial = materials[mi];\n var materialHash = sourceMaterial.name + '_' + sourceMaterial.smooth + '_' + hasVertexColors;\n var _material = state.materials[materialHash];\n if (this.materials !== null) {\n _material = this.materials.create(sourceMaterial.name);\n\n // mtl etc. loaders probably can't create line materials correctly, copy properties to a line material.\n if (isLine && _material && !(_material instanceof three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial)) {\n var materialLine = new three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial();\n three__WEBPACK_IMPORTED_MODULE_0__.Material.prototype.copy.call(materialLine, _material);\n materialLine.color.copy(_material.color);\n _material = materialLine;\n } else if (isPoints && _material && !(_material instanceof three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial)) {\n var materialPoints = new three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial({\n size: 10,\n sizeAttenuation: false\n });\n three__WEBPACK_IMPORTED_MODULE_0__.Material.prototype.copy.call(materialPoints, _material);\n materialPoints.color.copy(_material.color);\n materialPoints.map = _material.map;\n _material = materialPoints;\n }\n }\n if (_material === undefined) {\n if (isLine) {\n _material = new three__WEBPACK_IMPORTED_MODULE_0__.LineBasicMaterial();\n } else if (isPoints) {\n _material = new three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial({\n size: 1,\n sizeAttenuation: false\n });\n } else {\n _material = new three__WEBPACK_IMPORTED_MODULE_0__.MeshPhongMaterial();\n }\n _material.name = sourceMaterial.name;\n _material.flatShading = sourceMaterial.smooth ? false : true;\n _material.vertexColors = hasVertexColors;\n state.materials[materialHash] = _material;\n }\n createdMaterials.push(_material);\n }\n\n // Create mesh\n\n var mesh = void 0;\n if (createdMaterials.length > 1) {\n for (var _mi = 0, _miLen = materials.length; _mi < _miLen; _mi++) {\n var _sourceMaterial = materials[_mi];\n buffergeometry.addGroup(_sourceMaterial.groupStart, _sourceMaterial.groupCount, _mi);\n }\n if (isLine) {\n mesh = new three__WEBPACK_IMPORTED_MODULE_0__.LineSegments(buffergeometry, createdMaterials);\n } else if (isPoints) {\n mesh = new three__WEBPACK_IMPORTED_MODULE_0__.Points(buffergeometry, createdMaterials);\n } else {\n mesh = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(buffergeometry, createdMaterials);\n }\n } else {\n if (isLine) {\n mesh = new three__WEBPACK_IMPORTED_MODULE_0__.LineSegments(buffergeometry, createdMaterials[0]);\n } else if (isPoints) {\n mesh = new three__WEBPACK_IMPORTED_MODULE_0__.Points(buffergeometry, createdMaterials[0]);\n } else {\n mesh = new three__WEBPACK_IMPORTED_MODULE_0__.Mesh(buffergeometry, createdMaterials[0]);\n }\n }\n mesh.name = object.name;\n container.add(mesh);\n }\n } else {\n // if there is only the default parser state object with no geometry data, interpret data as point cloud\n\n if (state.vertices.length > 0) {\n var _material2 = new three__WEBPACK_IMPORTED_MODULE_0__.PointsMaterial({\n size: 1,\n sizeAttenuation: false\n });\n var _buffergeometry = new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry();\n _buffergeometry.setAttribute('position', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(state.vertices, 3));\n if (state.colors.length > 0 && state.colors[0] !== undefined) {\n _buffergeometry.setAttribute('color', new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(state.colors, 3));\n _material2.vertexColors = true;\n }\n var points = new three__WEBPACK_IMPORTED_MODULE_0__.Points(_buffergeometry, _material2);\n container.add(points);\n }\n }\n return container;\n }\n }]);\n return OBJLoader;\n}(three__WEBPACK_IMPORTED_MODULE_0__.Loader);\n\n\n//# sourceURL=webpack://dgi_3d_viewer/../../../libraries/three/examples/jsm/loaders/OBJLoader.js?"); + +/***/ }), + /***/ "../../../libraries/three/examples/jsm/utils/BufferGeometryUtils.js": /*!**************************************************************************!*\ !*** ../../../libraries/three/examples/jsm/utils/BufferGeometryUtils.js ***! \**************************************************************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { +"use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"computeMikkTSpaceTangents\": () => (/* binding */ computeMikkTSpaceTangents),\n/* harmony export */ \"computeMorphedAttributes\": () => (/* binding */ computeMorphedAttributes),\n/* harmony export */ \"deepCloneAttribute\": () => (/* binding */ deepCloneAttribute),\n/* harmony export */ \"deinterleaveAttribute\": () => (/* binding */ deinterleaveAttribute),\n/* harmony export */ \"deinterleaveGeometry\": () => (/* binding */ deinterleaveGeometry),\n/* harmony export */ \"estimateBytesUsed\": () => (/* binding */ estimateBytesUsed),\n/* harmony export */ \"interleaveAttributes\": () => (/* binding */ interleaveAttributes),\n/* harmony export */ \"mergeAttributes\": () => (/* binding */ mergeAttributes),\n/* harmony export */ \"mergeBufferAttributes\": () => (/* binding */ mergeBufferAttributes),\n/* harmony export */ \"mergeBufferGeometries\": () => (/* binding */ mergeBufferGeometries),\n/* harmony export */ \"mergeGeometries\": () => (/* binding */ mergeGeometries),\n/* harmony export */ \"mergeGroups\": () => (/* binding */ mergeGroups),\n/* harmony export */ \"mergeVertices\": () => (/* binding */ mergeVertices),\n/* harmony export */ \"toCreasedNormals\": () => (/* binding */ toCreasedNormals),\n/* harmony export */ \"toTrianglesDrawMode\": () => (/* binding */ toTrianglesDrawMode)\n/* harmony export */ });\n/* harmony import */ var three__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! three */ \"../../../libraries/three/build/three.module.js\");\n\nfunction computeMikkTSpaceTangents(geometry, MikkTSpace) {\n var negateSign = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n if (!MikkTSpace || !MikkTSpace.isReady) {\n throw new Error('BufferGeometryUtils: Initialized MikkTSpace library required.');\n }\n if (!geometry.hasAttribute('position') || !geometry.hasAttribute('normal') || !geometry.hasAttribute('uv')) {\n throw new Error('BufferGeometryUtils: Tangents require \"position\", \"normal\", and \"uv\" attributes.');\n }\n function getAttributeArray(attribute) {\n if (attribute.normalized || attribute.isInterleavedBufferAttribute) {\n var dstArray = new Float32Array(attribute.getCount() * attribute.itemSize);\n for (var i = 0, j = 0; i < attribute.getCount(); i++) {\n dstArray[j++] = attribute.getX(i);\n dstArray[j++] = attribute.getY(i);\n if (attribute.itemSize > 2) {\n dstArray[j++] = attribute.getZ(i);\n }\n }\n return dstArray;\n }\n if (attribute.array instanceof Float32Array) {\n return attribute.array;\n }\n return new Float32Array(attribute.array);\n }\n\n // MikkTSpace algorithm requires non-indexed input.\n\n var _geometry = geometry.index ? geometry.toNonIndexed() : geometry;\n\n // Compute vertex tangents.\n\n var tangents = MikkTSpace.generateTangents(getAttributeArray(_geometry.attributes.position), getAttributeArray(_geometry.attributes.normal), getAttributeArray(_geometry.attributes.uv));\n\n // Texture coordinate convention of glTF differs from the apparent\n // default of the MikkTSpace library; .w component must be flipped.\n\n if (negateSign) {\n for (var i = 3; i < tangents.length; i += 4) {\n tangents[i] *= -1;\n }\n }\n\n //\n\n _geometry.setAttribute('tangent', new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(tangents, 4));\n if (geometry !== _geometry) {\n geometry.copy(_geometry);\n }\n return geometry;\n}\n\n/**\n * @param {Array} geometries\n * @param {Boolean} useGroups\n * @return {BufferGeometry}\n */\nfunction mergeGeometries(geometries) {\n var useGroups = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var isIndexed = geometries[0].index !== null;\n var attributesUsed = new Set(Object.keys(geometries[0].attributes));\n var morphAttributesUsed = new Set(Object.keys(geometries[0].morphAttributes));\n var attributes = {};\n var morphAttributes = {};\n var morphTargetsRelative = geometries[0].morphTargetsRelative;\n var mergedGeometry = new three__WEBPACK_IMPORTED_MODULE_0__.BufferGeometry();\n var offset = 0;\n for (var i = 0; i < geometries.length; ++i) {\n var geometry = geometries[i];\n var attributesCount = 0;\n\n // ensure that all geometries are indexed, or none\n\n if (isIndexed !== (geometry.index !== null)) {\n console.error('THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.');\n return null;\n }\n\n // gather attributes, exit early if they're different\n\n for (var name in geometry.attributes) {\n if (!attributesUsed.has(name)) {\n console.error('THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. All geometries must have compatible attributes; make sure \"' + name + '\" attribute exists among all geometries, or in none of them.');\n return null;\n }\n if (attributes[name] === undefined) attributes[name] = [];\n attributes[name].push(geometry.attributes[name]);\n attributesCount++;\n }\n\n // ensure geometries have the same number of attributes\n\n if (attributesCount !== attributesUsed.size) {\n console.error('THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. Make sure all geometries have the same number of attributes.');\n return null;\n }\n\n // gather morph attributes, exit early if they're different\n\n if (morphTargetsRelative !== geometry.morphTargetsRelative) {\n console.error('THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. .morphTargetsRelative must be consistent throughout all geometries.');\n return null;\n }\n for (var _name in geometry.morphAttributes) {\n if (!morphAttributesUsed.has(_name)) {\n console.error('THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. .morphAttributes must be consistent throughout all geometries.');\n return null;\n }\n if (morphAttributes[_name] === undefined) morphAttributes[_name] = [];\n morphAttributes[_name].push(geometry.morphAttributes[_name]);\n }\n if (useGroups) {\n var count = void 0;\n if (isIndexed) {\n count = geometry.index.count;\n } else if (geometry.attributes.position !== undefined) {\n count = geometry.attributes.position.count;\n } else {\n console.error('THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index ' + i + '. The geometry must have either an index or a position attribute');\n return null;\n }\n mergedGeometry.addGroup(offset, count, i);\n offset += count;\n }\n }\n\n // merge indices\n\n if (isIndexed) {\n var indexOffset = 0;\n var mergedIndex = [];\n for (var _i = 0; _i < geometries.length; ++_i) {\n var index = geometries[_i].index;\n for (var j = 0; j < index.count; ++j) {\n mergedIndex.push(index.getX(j) + indexOffset);\n }\n indexOffset += geometries[_i].attributes.position.count;\n }\n mergedGeometry.setIndex(mergedIndex);\n }\n\n // merge attributes\n\n for (var _name2 in attributes) {\n var mergedAttribute = mergeAttributes(attributes[_name2]);\n if (!mergedAttribute) {\n console.error('THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the ' + _name2 + ' attribute.');\n return null;\n }\n mergedGeometry.setAttribute(_name2, mergedAttribute);\n }\n\n // merge morph attributes\n\n for (var _name3 in morphAttributes) {\n var numMorphTargets = morphAttributes[_name3][0].length;\n if (numMorphTargets === 0) break;\n mergedGeometry.morphAttributes = mergedGeometry.morphAttributes || {};\n mergedGeometry.morphAttributes[_name3] = [];\n for (var _i2 = 0; _i2 < numMorphTargets; ++_i2) {\n var morphAttributesToMerge = [];\n for (var _j = 0; _j < morphAttributes[_name3].length; ++_j) {\n morphAttributesToMerge.push(morphAttributes[_name3][_j][_i2]);\n }\n var mergedMorphAttribute = mergeAttributes(morphAttributesToMerge);\n if (!mergedMorphAttribute) {\n console.error('THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the ' + _name3 + ' morphAttribute.');\n return null;\n }\n mergedGeometry.morphAttributes[_name3].push(mergedMorphAttribute);\n }\n }\n return mergedGeometry;\n}\n\n/**\n * @param {Array} attributes\n * @return {BufferAttribute}\n */\nfunction mergeAttributes(attributes) {\n var TypedArray;\n var itemSize;\n var normalized;\n var arrayLength = 0;\n for (var i = 0; i < attributes.length; ++i) {\n var attribute = attributes[i];\n if (attribute.isInterleavedBufferAttribute) {\n console.error('THREE.BufferGeometryUtils: .mergeAttributes() failed. InterleavedBufferAttributes are not supported.');\n return null;\n }\n if (TypedArray === undefined) TypedArray = attribute.array.constructor;\n if (TypedArray !== attribute.array.constructor) {\n console.error('THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.');\n return null;\n }\n if (itemSize === undefined) itemSize = attribute.itemSize;\n if (itemSize !== attribute.itemSize) {\n console.error('THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes.');\n return null;\n }\n if (normalized === undefined) normalized = attribute.normalized;\n if (normalized !== attribute.normalized) {\n console.error('THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes.');\n return null;\n }\n arrayLength += attribute.array.length;\n }\n var array = new TypedArray(arrayLength);\n var offset = 0;\n for (var _i3 = 0; _i3 < attributes.length; ++_i3) {\n array.set(attributes[_i3].array, offset);\n offset += attributes[_i3].array.length;\n }\n return new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(array, itemSize, normalized);\n}\n\n/**\n * @param {BufferAttribute}\n * @return {BufferAttribute}\n */\nfunction deepCloneAttribute(attribute) {\n if (attribute.isInstancedInterleavedBufferAttribute || attribute.isInterleavedBufferAttribute) {\n return deinterleaveAttribute(attribute);\n }\n if (attribute.isInstancedBufferAttribute) {\n return new three__WEBPACK_IMPORTED_MODULE_0__.InstancedBufferAttribute().copy(attribute);\n }\n return new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute().copy(attribute);\n}\n\n/**\n * @param {Array} attributes\n * @return {Array}\n */\nfunction interleaveAttributes(attributes) {\n // Interleaves the provided attributes into an InterleavedBuffer and returns\n // a set of InterleavedBufferAttributes for each attribute\n var TypedArray;\n var arrayLength = 0;\n var stride = 0;\n\n // calculate the length and type of the interleavedBuffer\n for (var i = 0, l = attributes.length; i < l; ++i) {\n var attribute = attributes[i];\n if (TypedArray === undefined) TypedArray = attribute.array.constructor;\n if (TypedArray !== attribute.array.constructor) {\n console.error('AttributeBuffers of different types cannot be interleaved');\n return null;\n }\n arrayLength += attribute.array.length;\n stride += attribute.itemSize;\n }\n\n // Create the set of buffer attributes\n var interleavedBuffer = new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBuffer(new TypedArray(arrayLength), stride);\n var offset = 0;\n var res = [];\n var getters = ['getX', 'getY', 'getZ', 'getW'];\n var setters = ['setX', 'setY', 'setZ', 'setW'];\n for (var j = 0, _l = attributes.length; j < _l; j++) {\n var _attribute = attributes[j];\n var itemSize = _attribute.itemSize;\n var count = _attribute.count;\n var iba = new three__WEBPACK_IMPORTED_MODULE_0__.InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, _attribute.normalized);\n res.push(iba);\n offset += itemSize;\n\n // Move the data for each attribute into the new interleavedBuffer\n // at the appropriate offset\n for (var c = 0; c < count; c++) {\n for (var k = 0; k < itemSize; k++) {\n iba[setters[k]](c, _attribute[getters[k]](c));\n }\n }\n }\n return res;\n}\n\n// returns a new, non-interleaved version of the provided attribute\nfunction deinterleaveAttribute(attribute) {\n var cons = attribute.data.array.constructor;\n var count = attribute.count;\n var itemSize = attribute.itemSize;\n var normalized = attribute.normalized;\n var array = new cons(count * itemSize);\n var newAttribute;\n if (attribute.isInstancedInterleavedBufferAttribute) {\n newAttribute = new three__WEBPACK_IMPORTED_MODULE_0__.InstancedBufferAttribute(array, itemSize, normalized, attribute.meshPerAttribute);\n } else {\n newAttribute = new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(array, itemSize, normalized);\n }\n for (var i = 0; i < count; i++) {\n newAttribute.setX(i, attribute.getX(i));\n if (itemSize >= 2) {\n newAttribute.setY(i, attribute.getY(i));\n }\n if (itemSize >= 3) {\n newAttribute.setZ(i, attribute.getZ(i));\n }\n if (itemSize >= 4) {\n newAttribute.setW(i, attribute.getW(i));\n }\n }\n return newAttribute;\n}\n\n// deinterleaves all attributes on the geometry\nfunction deinterleaveGeometry(geometry) {\n var attributes = geometry.attributes;\n var morphTargets = geometry.morphTargets;\n var attrMap = new Map();\n for (var key in attributes) {\n var attr = attributes[key];\n if (attr.isInterleavedBufferAttribute) {\n if (!attrMap.has(attr)) {\n attrMap.set(attr, deinterleaveAttribute(attr));\n }\n attributes[key] = attrMap.get(attr);\n }\n }\n for (var _key in morphTargets) {\n var _attr = morphTargets[_key];\n if (_attr.isInterleavedBufferAttribute) {\n if (!attrMap.has(_attr)) {\n attrMap.set(_attr, deinterleaveAttribute(_attr));\n }\n morphTargets[_key] = attrMap.get(_attr);\n }\n }\n}\n\n/**\n * @param {Array} geometry\n * @return {number}\n */\nfunction estimateBytesUsed(geometry) {\n // Return the estimated memory used by this geometry in bytes\n // Calculate using itemSize, count, and BYTES_PER_ELEMENT to account\n // for InterleavedBufferAttributes.\n var mem = 0;\n for (var name in geometry.attributes) {\n var attr = geometry.getAttribute(name);\n mem += attr.count * attr.itemSize * attr.array.BYTES_PER_ELEMENT;\n }\n var indices = geometry.getIndex();\n mem += indices ? indices.count * indices.itemSize * indices.array.BYTES_PER_ELEMENT : 0;\n return mem;\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {number} tolerance\n * @return {BufferGeometry}\n */\nfunction mergeVertices(geometry) {\n var tolerance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1e-4;\n tolerance = Math.max(tolerance, Number.EPSILON);\n\n // Generate an index buffer if the geometry doesn't have one, or optimize it\n // if it's already available.\n var hashToIndex = {};\n var indices = geometry.getIndex();\n var positions = geometry.getAttribute('position');\n var vertexCount = indices ? indices.count : positions.count;\n\n // next value for triangle indices\n var nextIndex = 0;\n\n // attributes and new attribute arrays\n var attributeNames = Object.keys(geometry.attributes);\n var tmpAttributes = {};\n var tmpMorphAttributes = {};\n var newIndices = [];\n var getters = ['getX', 'getY', 'getZ', 'getW'];\n var setters = ['setX', 'setY', 'setZ', 'setW'];\n\n // Initialize the arrays, allocating space conservatively. Extra\n // space will be trimmed in the last step.\n for (var i = 0, l = attributeNames.length; i < l; i++) {\n var name = attributeNames[i];\n var attr = geometry.attributes[name];\n tmpAttributes[name] = new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(new attr.array.constructor(attr.count * attr.itemSize), attr.itemSize, attr.normalized);\n var morphAttr = geometry.morphAttributes[name];\n if (morphAttr) {\n tmpMorphAttributes[name] = new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(new morphAttr.array.constructor(morphAttr.count * morphAttr.itemSize), morphAttr.itemSize, morphAttr.normalized);\n }\n }\n\n // convert the error tolerance to an amount of decimal places to truncate to\n var decimalShift = Math.log10(1 / tolerance);\n var shiftMultiplier = Math.pow(10, decimalShift);\n for (var _i4 = 0; _i4 < vertexCount; _i4++) {\n var index = indices ? indices.getX(_i4) : _i4;\n\n // Generate a hash for the vertex attributes at the current index 'i'\n var hash = '';\n for (var j = 0, _l2 = attributeNames.length; j < _l2; j++) {\n var _name4 = attributeNames[j];\n var attribute = geometry.getAttribute(_name4);\n var itemSize = attribute.itemSize;\n for (var k = 0; k < itemSize; k++) {\n // double tilde truncates the decimal value\n hash += \"\".concat(~~(attribute[getters[k]](index) * shiftMultiplier), \",\");\n }\n }\n\n // Add another reference to the vertex if it's already\n // used by another index\n if (hash in hashToIndex) {\n newIndices.push(hashToIndex[hash]);\n } else {\n // copy data to the new index in the temporary attributes\n for (var _j2 = 0, _l3 = attributeNames.length; _j2 < _l3; _j2++) {\n var _name5 = attributeNames[_j2];\n var _attribute2 = geometry.getAttribute(_name5);\n var _morphAttr = geometry.morphAttributes[_name5];\n var _itemSize = _attribute2.itemSize;\n var newarray = tmpAttributes[_name5];\n var newMorphArrays = tmpMorphAttributes[_name5];\n for (var _k = 0; _k < _itemSize; _k++) {\n var getterFunc = getters[_k];\n var setterFunc = setters[_k];\n newarray[setterFunc](nextIndex, _attribute2[getterFunc](index));\n if (_morphAttr) {\n for (var m = 0, ml = _morphAttr.length; m < ml; m++) {\n newMorphArrays[m][setterFunc](nextIndex, _morphAttr[m][getterFunc](index));\n }\n }\n }\n }\n hashToIndex[hash] = nextIndex;\n newIndices.push(nextIndex);\n nextIndex++;\n }\n }\n\n // generate result BufferGeometry\n var result = geometry.clone();\n for (var _name6 in geometry.attributes) {\n var tmpAttribute = tmpAttributes[_name6];\n result.setAttribute(_name6, new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(tmpAttribute.array.slice(0, nextIndex * tmpAttribute.itemSize), tmpAttribute.itemSize, tmpAttribute.normalized));\n if (!(_name6 in tmpMorphAttributes)) continue;\n for (var _j3 = 0; _j3 < tmpMorphAttributes[_name6].length; _j3++) {\n var tmpMorphAttribute = tmpMorphAttributes[_name6][_j3];\n result.morphAttributes[_name6][_j3] = new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(tmpMorphAttribute.array.slice(0, nextIndex * tmpMorphAttribute.itemSize), tmpMorphAttribute.itemSize, tmpMorphAttribute.normalized);\n }\n }\n\n // indices\n\n result.setIndex(newIndices);\n return result;\n}\n\n/**\n * @param {BufferGeometry} geometry\n * @param {number} drawMode\n * @return {BufferGeometry}\n */\nfunction toTrianglesDrawMode(geometry, drawMode) {\n if (drawMode === three__WEBPACK_IMPORTED_MODULE_0__.TrianglesDrawMode) {\n console.warn('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.');\n return geometry;\n }\n if (drawMode === three__WEBPACK_IMPORTED_MODULE_0__.TriangleFanDrawMode || drawMode === three__WEBPACK_IMPORTED_MODULE_0__.TriangleStripDrawMode) {\n var index = geometry.getIndex();\n\n // generate index if not present\n\n if (index === null) {\n var indices = [];\n var position = geometry.getAttribute('position');\n if (position !== undefined) {\n for (var i = 0; i < position.count; i++) {\n indices.push(i);\n }\n geometry.setIndex(indices);\n index = geometry.getIndex();\n } else {\n console.error('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.');\n return geometry;\n }\n }\n\n //\n\n var numberOfTriangles = index.count - 2;\n var newIndices = [];\n if (drawMode === three__WEBPACK_IMPORTED_MODULE_0__.TriangleFanDrawMode) {\n // gl.TRIANGLE_FAN\n\n for (var _i5 = 1; _i5 <= numberOfTriangles; _i5++) {\n newIndices.push(index.getX(0));\n newIndices.push(index.getX(_i5));\n newIndices.push(index.getX(_i5 + 1));\n }\n } else {\n // gl.TRIANGLE_STRIP\n\n for (var _i6 = 0; _i6 < numberOfTriangles; _i6++) {\n if (_i6 % 2 === 0) {\n newIndices.push(index.getX(_i6));\n newIndices.push(index.getX(_i6 + 1));\n newIndices.push(index.getX(_i6 + 2));\n } else {\n newIndices.push(index.getX(_i6 + 2));\n newIndices.push(index.getX(_i6 + 1));\n newIndices.push(index.getX(_i6));\n }\n }\n }\n if (newIndices.length / 3 !== numberOfTriangles) {\n console.error('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.');\n }\n\n // build final geometry\n\n var newGeometry = geometry.clone();\n newGeometry.setIndex(newIndices);\n newGeometry.clearGroups();\n return newGeometry;\n } else {\n console.error('THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode);\n return geometry;\n }\n}\n\n/**\n * Calculates the morphed attributes of a morphed/skinned BufferGeometry.\n * Helpful for Raytracing or Decals.\n * @param {Mesh | Line | Points} object An instance of Mesh, Line or Points.\n * @return {Object} An Object with original position/normal attributes and morphed ones.\n */\nfunction computeMorphedAttributes(object) {\n var _vA = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var _vB = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var _vC = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var _tempA = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var _tempB = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var _tempC = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var _morphA = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var _morphB = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var _morphC = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n function _calculateMorphedAttributeData(object, attribute, morphAttribute, morphTargetsRelative, a, b, c, modifiedAttributeArray) {\n _vA.fromBufferAttribute(attribute, a);\n _vB.fromBufferAttribute(attribute, b);\n _vC.fromBufferAttribute(attribute, c);\n var morphInfluences = object.morphTargetInfluences;\n if (morphAttribute && morphInfluences) {\n _morphA.set(0, 0, 0);\n _morphB.set(0, 0, 0);\n _morphC.set(0, 0, 0);\n for (var _i7 = 0, _il = morphAttribute.length; _i7 < _il; _i7++) {\n var influence = morphInfluences[_i7];\n var morph = morphAttribute[_i7];\n if (influence === 0) continue;\n _tempA.fromBufferAttribute(morph, a);\n _tempB.fromBufferAttribute(morph, b);\n _tempC.fromBufferAttribute(morph, c);\n if (morphTargetsRelative) {\n _morphA.addScaledVector(_tempA, influence);\n _morphB.addScaledVector(_tempB, influence);\n _morphC.addScaledVector(_tempC, influence);\n } else {\n _morphA.addScaledVector(_tempA.sub(_vA), influence);\n _morphB.addScaledVector(_tempB.sub(_vB), influence);\n _morphC.addScaledVector(_tempC.sub(_vC), influence);\n }\n }\n _vA.add(_morphA);\n _vB.add(_morphB);\n _vC.add(_morphC);\n }\n if (object.isSkinnedMesh) {\n object.applyBoneTransform(a, _vA);\n object.applyBoneTransform(b, _vB);\n object.applyBoneTransform(c, _vC);\n }\n modifiedAttributeArray[a * 3 + 0] = _vA.x;\n modifiedAttributeArray[a * 3 + 1] = _vA.y;\n modifiedAttributeArray[a * 3 + 2] = _vA.z;\n modifiedAttributeArray[b * 3 + 0] = _vB.x;\n modifiedAttributeArray[b * 3 + 1] = _vB.y;\n modifiedAttributeArray[b * 3 + 2] = _vB.z;\n modifiedAttributeArray[c * 3 + 0] = _vC.x;\n modifiedAttributeArray[c * 3 + 1] = _vC.y;\n modifiedAttributeArray[c * 3 + 2] = _vC.z;\n }\n var geometry = object.geometry;\n var material = object.material;\n var a, b, c;\n var index = geometry.index;\n var positionAttribute = geometry.attributes.position;\n var morphPosition = geometry.morphAttributes.position;\n var morphTargetsRelative = geometry.morphTargetsRelative;\n var normalAttribute = geometry.attributes.normal;\n var morphNormal = geometry.morphAttributes.position;\n var groups = geometry.groups;\n var drawRange = geometry.drawRange;\n var i, j, il, jl;\n var group;\n var start, end;\n var modifiedPosition = new Float32Array(positionAttribute.count * positionAttribute.itemSize);\n var modifiedNormal = new Float32Array(normalAttribute.count * normalAttribute.itemSize);\n if (index !== null) {\n // indexed buffer geometry\n\n if (Array.isArray(material)) {\n for (i = 0, il = groups.length; i < il; i++) {\n group = groups[i];\n start = Math.max(group.start, drawRange.start);\n end = Math.min(group.start + group.count, drawRange.start + drawRange.count);\n for (j = start, jl = end; j < jl; j += 3) {\n a = index.getX(j);\n b = index.getX(j + 1);\n c = index.getX(j + 2);\n _calculateMorphedAttributeData(object, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition);\n _calculateMorphedAttributeData(object, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal);\n }\n }\n } else {\n start = Math.max(0, drawRange.start);\n end = Math.min(index.count, drawRange.start + drawRange.count);\n for (i = start, il = end; i < il; i += 3) {\n a = index.getX(i);\n b = index.getX(i + 1);\n c = index.getX(i + 2);\n _calculateMorphedAttributeData(object, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition);\n _calculateMorphedAttributeData(object, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal);\n }\n }\n } else {\n // non-indexed buffer geometry\n\n if (Array.isArray(material)) {\n for (i = 0, il = groups.length; i < il; i++) {\n group = groups[i];\n start = Math.max(group.start, drawRange.start);\n end = Math.min(group.start + group.count, drawRange.start + drawRange.count);\n for (j = start, jl = end; j < jl; j += 3) {\n a = j;\n b = j + 1;\n c = j + 2;\n _calculateMorphedAttributeData(object, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition);\n _calculateMorphedAttributeData(object, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal);\n }\n }\n } else {\n start = Math.max(0, drawRange.start);\n end = Math.min(positionAttribute.count, drawRange.start + drawRange.count);\n for (i = start, il = end; i < il; i += 3) {\n a = i;\n b = i + 1;\n c = i + 2;\n _calculateMorphedAttributeData(object, positionAttribute, morphPosition, morphTargetsRelative, a, b, c, modifiedPosition);\n _calculateMorphedAttributeData(object, normalAttribute, morphNormal, morphTargetsRelative, a, b, c, modifiedNormal);\n }\n }\n }\n var morphedPositionAttribute = new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(modifiedPosition, 3);\n var morphedNormalAttribute = new three__WEBPACK_IMPORTED_MODULE_0__.Float32BufferAttribute(modifiedNormal, 3);\n return {\n positionAttribute: positionAttribute,\n normalAttribute: normalAttribute,\n morphedPositionAttribute: morphedPositionAttribute,\n morphedNormalAttribute: morphedNormalAttribute\n };\n}\nfunction mergeGroups(geometry) {\n if (geometry.groups.length === 0) {\n console.warn('THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge.');\n return geometry;\n }\n var groups = geometry.groups;\n\n // sort groups by material index\n\n groups = groups.sort(function (a, b) {\n if (a.materialIndex !== b.materialIndex) return a.materialIndex - b.materialIndex;\n return a.start - b.start;\n });\n\n // create index for non-indexed geometries\n\n if (geometry.getIndex() === null) {\n var positionAttribute = geometry.getAttribute('position');\n var indices = [];\n for (var i = 0; i < positionAttribute.count; i += 3) {\n indices.push(i, i + 1, i + 2);\n }\n geometry.setIndex(indices);\n }\n\n // sort index\n\n var index = geometry.getIndex();\n var newIndices = [];\n for (var _i8 = 0; _i8 < groups.length; _i8++) {\n var group = groups[_i8];\n var groupStart = group.start;\n var groupLength = groupStart + group.count;\n for (var j = groupStart; j < groupLength; j++) {\n newIndices.push(index.getX(j));\n }\n }\n geometry.dispose(); // Required to force buffer recreation\n geometry.setIndex(newIndices);\n\n // update groups indices\n\n var start = 0;\n for (var _i9 = 0; _i9 < groups.length; _i9++) {\n var _group = groups[_i9];\n _group.start = start;\n start += _group.count;\n }\n\n // merge groups\n\n var currentGroup = groups[0];\n geometry.groups = [currentGroup];\n for (var _i10 = 1; _i10 < groups.length; _i10++) {\n var _group2 = groups[_i10];\n if (currentGroup.materialIndex === _group2.materialIndex) {\n currentGroup.count += _group2.count;\n } else {\n currentGroup = _group2;\n geometry.groups.push(currentGroup);\n }\n }\n return geometry;\n}\n\n// Creates a new, non-indexed geometry with smooth normals everywhere except faces that meet at\n// an angle greater than the crease angle.\nfunction toCreasedNormals(geometry) {\n var creaseAngle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Math.PI / 3;\n var creaseDot = Math.cos(creaseAngle);\n var hashMultiplier = (1 + 1e-10) * 1e2;\n\n // reusable vertors\n var verts = [new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(), new three__WEBPACK_IMPORTED_MODULE_0__.Vector3(), new three__WEBPACK_IMPORTED_MODULE_0__.Vector3()];\n var tempVec1 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var tempVec2 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var tempNorm = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n var tempNorm2 = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3();\n\n // hashes a vector\n function hashVertex(v) {\n var x = ~~(v.x * hashMultiplier);\n var y = ~~(v.y * hashMultiplier);\n var z = ~~(v.z * hashMultiplier);\n return \"\".concat(x, \",\").concat(y, \",\").concat(z);\n }\n var resultGeometry = geometry.toNonIndexed();\n var posAttr = resultGeometry.attributes.position;\n var vertexMap = {};\n\n // find all the normals shared by commonly located vertices\n for (var i = 0, l = posAttr.count / 3; i < l; i++) {\n var i3 = 3 * i;\n var a = verts[0].fromBufferAttribute(posAttr, i3 + 0);\n var b = verts[1].fromBufferAttribute(posAttr, i3 + 1);\n var c = verts[2].fromBufferAttribute(posAttr, i3 + 2);\n tempVec1.subVectors(c, b);\n tempVec2.subVectors(a, b);\n\n // add the normal to the map for all vertices\n var normal = new three__WEBPACK_IMPORTED_MODULE_0__.Vector3().crossVectors(tempVec1, tempVec2).normalize();\n for (var n = 0; n < 3; n++) {\n var vert = verts[n];\n var hash = hashVertex(vert);\n if (!(hash in vertexMap)) {\n vertexMap[hash] = [];\n }\n vertexMap[hash].push(normal);\n }\n }\n\n // average normals from all vertices that share a common location if they are within the\n // provided crease threshold\n var normalArray = new Float32Array(posAttr.count * 3);\n var normAttr = new three__WEBPACK_IMPORTED_MODULE_0__.BufferAttribute(normalArray, 3, false);\n for (var _i11 = 0, _l4 = posAttr.count / 3; _i11 < _l4; _i11++) {\n // get the face normal for this vertex\n var _i12 = 3 * _i11;\n var _a = verts[0].fromBufferAttribute(posAttr, _i12 + 0);\n var _b = verts[1].fromBufferAttribute(posAttr, _i12 + 1);\n var _c = verts[2].fromBufferAttribute(posAttr, _i12 + 2);\n tempVec1.subVectors(_c, _b);\n tempVec2.subVectors(_a, _b);\n tempNorm.crossVectors(tempVec1, tempVec2).normalize();\n\n // average all normals that meet the threshold and set the normal value\n for (var _n = 0; _n < 3; _n++) {\n var _vert = verts[_n];\n var _hash = hashVertex(_vert);\n var otherNormals = vertexMap[_hash];\n tempNorm2.set(0, 0, 0);\n for (var k = 0, lk = otherNormals.length; k < lk; k++) {\n var otherNorm = otherNormals[k];\n if (tempNorm.dot(otherNorm) > creaseDot) {\n tempNorm2.add(otherNorm);\n }\n }\n tempNorm2.normalize();\n normAttr.setXYZ(_i12 + _n, tempNorm2.x, tempNorm2.y, tempNorm2.z);\n }\n }\n resultGeometry.setAttribute('normal', normAttr);\n return resultGeometry;\n}\nfunction mergeBufferGeometries(geometries) {\n var useGroups = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n console.warn('THREE.BufferGeometryUtils: mergeBufferGeometries() has been renamed to mergeGeometries().'); // @deprecated, r151\n return mergeGeometries(geometries, useGroups);\n}\nfunction mergeBufferAttributes(attributes) {\n console.warn('THREE.BufferGeometryUtils: mergeBufferAttributes() has been renamed to mergeAttributes().'); // @deprecated, r151\n return mergeAttributes(attributes);\n}\n\n\n//# sourceURL=webpack://dgi_3d_viewer/../../../libraries/three/examples/jsm/utils/BufferGeometryUtils.js?"); /***/ }) @@ -77,6 +145,18 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /******/ } /******/ /************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports @@ -89,6 +169,18 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /******/ }; /******/ })(); /******/ +/******/ /* webpack/runtime/global */ +/******/ (() => { +/******/ __webpack_require__.g = (function() { +/******/ if (typeof globalThis === 'object') return globalThis; +/******/ try { +/******/ return this || new Function('return this')(); +/******/ } catch (e) { +/******/ if (typeof window === 'object') return window; +/******/ } +/******/ })(); +/******/ })(); +/******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) diff --git a/js/test_threejs.js b/js/dist/test_threejs.js similarity index 100% rename from js/test_threejs.js rename to js/dist/test_threejs.js diff --git a/package-lock.json b/package-lock.json index 52da579..6d733ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,10 @@ "name": "dgi_3d_viewer", "version": "1.0.0", "license": "GPL-3.0", + "dependencies": { + "jszip": "^3.10.1", + "jszip-utils": "^0.1.0" + }, "devDependencies": { "@babel/cli": "^7.21.0", "@babel/core": "^7.21.4", @@ -16,7 +20,8 @@ "core-js": "^3.30.1", "regenerator-runtime": "^0.13.11", "webpack": "^5.81.0", - "webpack-cli": "^5.0.2" + "webpack-cli": "^5.0.2", + "webpack-dev-server": "^4.15.0" }, "engines": { "node": ">= 16.0" @@ -1767,6 +1772,12 @@ "@jridgewell/sourcemap-codec": "1.4.14" } }, + "node_modules/@leichtgewicht/ip-codec": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz", + "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==", + "dev": true + }, "node_modules/@nicolo-ribaudo/chokidar-2": { "version": "2.1.8-no-fsevents.3", "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz", @@ -1774,6 +1785,44 @@ "dev": true, "optional": true }, + "node_modules/@types/body-parser": { + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", + "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==", + "dev": true, + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/bonjour": { + "version": "3.5.10", + "resolved": "https://registry.npmjs.org/@types/bonjour/-/bonjour-3.5.10.tgz", + "integrity": "sha512-p7ienRMiS41Nu2/igbJxxLDWrSZ0WxM8UQgCeO9KhoVF7cOVFkrKsiDr1EsJIla8vV3oEEjGcz11jc5yimhzZw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.35", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz", + "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/connect-history-api-fallback": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.0.tgz", + "integrity": "sha512-4x5FkPpLipqwthjPsF7ZRbOv3uoLUFkTA9G9v583qi4pACvq0uTELrB8OLUzPWUI4IJIyvM85vzkV1nyiI2Lig==", + "dev": true, + "dependencies": { + "@types/express-serve-static-core": "*", + "@types/node": "*" + } + }, "node_modules/@types/eslint": { "version": "8.37.0", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.37.0.tgz", @@ -1800,18 +1849,122 @@ "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==", "dev": true }, + "node_modules/@types/express": { + "version": "4.17.17", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz", + "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==", + "dev": true, + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.17.35", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.35.tgz", + "integrity": "sha512-wALWQwrgiB2AWTT91CB62b6Yt0sNHpznUXeZEcnPU3DRdlDIz74x8Qg1UUYKSVFi+va5vKOLYRBI1bRKiLLKIg==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "node_modules/@types/http-proxy": { + "version": "1.17.11", + "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.11.tgz", + "integrity": "sha512-HC8G7c1WmaF2ekqpnFq626xd3Zz0uvaqFmBJNRZCGEZCXkvSdJoNFn/8Ygbd9fKNQj8UzLdCETaI0UWPAjK7IA==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, + "node_modules/@types/mime": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", + "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw==", + "dev": true + }, "node_modules/@types/node": { "version": "18.16.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.3.tgz", "integrity": "sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==", "dev": true }, + "node_modules/@types/qs": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz", + "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==", + "dev": true + }, + "node_modules/@types/range-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz", + "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", + "dev": true + }, + "node_modules/@types/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==", + "dev": true + }, + "node_modules/@types/send": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.1.tgz", + "integrity": "sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==", + "dev": true, + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-index": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@types/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha512-d/Hs3nWDxNL2xAczmOVZNj92YZCS6RGxfBPjKzuu/XirCgXdpKEb88dYNbrYGint6IVWLNP+yonwVAuRC0T2Dg==", + "dev": true, + "dependencies": { + "@types/express": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.1.tgz", + "integrity": "sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==", + "dev": true, + "dependencies": { + "@types/mime": "*", + "@types/node": "*" + } + }, + "node_modules/@types/sockjs": { + "version": "0.3.33", + "resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.33.tgz", + "integrity": "sha512-f0KEEe05NvUnat+boPTZ0dgaLZ4SfSouXUgv5noUiefG2ajgKjmETo9ZJyuqsl7dfl2aHlLJUiki6B4ZYldiiw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/ws": { + "version": "8.5.4", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.4.tgz", + "integrity": "sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.5", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.5.tgz", @@ -2014,6 +2167,19 @@ "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", "dev": true }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/acorn": { "version": "8.8.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", @@ -2080,6 +2246,18 @@ "ajv": "^8.8.2" } }, + "node_modules/ansi-html-community": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz", + "integrity": "sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw==", + "dev": true, + "engines": [ + "node >= 0.8.0" + ], + "bin": { + "ansi-html": "bin/ansi-html" + } + }, "node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -2097,7 +2275,6 @@ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, - "optional": true, "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -2106,6 +2283,12 @@ "node": ">= 8" } }, + "node_modules/array-flatten": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz", + "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==", + "dev": true + }, "node_modules/babel-loader": { "version": "9.1.2", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.2.tgz", @@ -2177,16 +2360,81 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/batch": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", + "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", + "dev": true + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true, - "optional": true, "engines": { "node": ">=8" } }, + "node_modules/body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "dev": true, + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/body-parser/node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/body-parser/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/body-parser/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/bonjour-service": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.1.1.tgz", + "integrity": "sha512-Z/5lQRMOG9k7W+FkeGTNjh7htqn/2LMnfOvBZ8pynNZCM9MwkQkI3zeI4oz09uWdcgmgHugVvBqxGg4VQJ5PCg==", + "dev": true, + "dependencies": { + "array-flatten": "^2.1.2", + "dns-equal": "^1.0.0", + "fast-deep-equal": "^3.1.3", + "multicast-dns": "^7.2.5" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2202,7 +2450,6 @@ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, - "optional": true, "dependencies": { "fill-range": "^7.0.1" }, @@ -2244,6 +2491,28 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, + "node_modules/bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001481", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001481.tgz", @@ -2289,7 +2558,6 @@ "url": "https://paulmillr.com/funding/" } ], - "optional": true, "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", @@ -2365,18 +2633,114 @@ "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", "dev": true }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "dev": true, + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/compression": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", + "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", + "dev": true, + "dependencies": { + "accepts": "~1.3.5", + "bytes": "3.0.0", + "compressible": "~2.0.16", + "debug": "2.6.9", + "on-headers": "~1.0.2", + "safe-buffer": "5.1.2", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/compression/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/compression/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/compression/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/connect-history-api-fallback": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz", + "integrity": "sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "dev": true, + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", "dev": true }, + "node_modules/cookie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "dev": true + }, "node_modules/core-js": { "version": "3.30.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.30.1.tgz", @@ -2401,6 +2765,11 @@ "url": "https://opencollective.com/core-js" } }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -2432,12 +2801,91 @@ } } }, + "node_modules/default-gateway": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-6.0.3.tgz", + "integrity": "sha512-fwSOJsbbNzZ/CUFpqFBqYfYNLj1NbMPm8MMCIzHjC83iSJRBEGmDUxU+WP661BaBQImeC2yHwXtz+P/O9o+XEg==", + "dev": true, + "dependencies": { + "execa": "^5.0.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/define-lazy-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "dev": true, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", + "dev": true + }, + "node_modules/dns-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", + "integrity": "sha512-z+paD6YUQsk+AbGCEM4PrOXSss5gd66QfcVBFTKR/HpFL9jCqikS94HYwKww6fQyO7IxrIIyUu+g0Ka9tUS2Cg==", + "dev": true + }, + "node_modules/dns-packet": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.0.tgz", + "integrity": "sha512-rza3UH1LwdHh9qyPXp8lkwpjSNk/AMD3dPytUoRoqnypDUhY0xvbdmVhWOfxO68frEfV9BU8V12Ez7ZsHGZpCQ==", + "dev": true, + "dependencies": { + "@leichtgewicht/ip-codec": "^2.0.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "dev": true + }, "node_modules/electron-to-chromium": { "version": "1.4.378", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.378.tgz", "integrity": "sha512-RfCD26kGStl6+XalfX3DGgt3z2DNwJS5DKRHCpkPq5T/PqpZMPB1moSRXuK9xhkt/sF57LlpzJgNoYl7mO7Z6w==", "dev": true }, + "node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/enhanced-resolve": { "version": "5.13.0", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.13.0.tgz", @@ -2478,6 +2926,12 @@ "node": ">=6" } }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "dev": true + }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -2539,6 +2993,21 @@ "node": ">=0.10.0" } }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "dev": true + }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -2548,6 +3017,92 @@ "node": ">=0.8.x" } }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/express": { + "version": "4.18.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", + "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "dev": true, + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.11.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/express/node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "dev": true + }, + "node_modules/express/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/express/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2569,12 +3124,23 @@ "node": ">= 4.9.1" } }, + "node_modules/faye-websocket": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz", + "integrity": "sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==", + "dev": true, + "dependencies": { + "websocket-driver": ">=0.5.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, - "optional": true, "dependencies": { "to-regex-range": "^5.0.1" }, @@ -2582,8 +3148,41 @@ "node": ">=8" } }, - "node_modules/find-cache-dir": { - "version": "3.3.2", + "node_modules/finalhandler": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "dev": true, + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/finalhandler/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/find-cache-dir": { + "version": "3.3.2", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", "dev": true, @@ -2636,6 +3235,50 @@ "node": ">=8" } }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fs-monkey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/fs-monkey/-/fs-monkey-1.0.3.tgz", + "integrity": "sha512-cybjIfiiE+pTWicSCLFHSrXZ6EilF30oh91FDP9S2B051prEa7QWfrVTQm10/dDpswBDXZugPa1Ogu8Yh+HV0Q==", + "dev": true + }, "node_modules/fs-readdir-recursive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", @@ -2677,6 +3320,33 @@ "node": ">=6.9.0" } }, + "node_modules/get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -2702,7 +3372,6 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, - "optional": true, "dependencies": { "is-glob": "^4.0.1" }, @@ -2731,6 +3400,12 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "node_modules/handle-thing": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", + "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", + "dev": true + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -2752,6 +3427,170 @@ "node": ">=4" } }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hpack.js": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", + "integrity": "sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ==", + "dev": true, + "dependencies": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + } + }, + "node_modules/hpack.js/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/hpack.js/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/hpack.js/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/html-entities": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz", + "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==", + "dev": true + }, + "node_modules/http-deceiver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==", + "dev": true + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dev": true, + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-parser-js": { + "version": "0.5.8", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz", + "integrity": "sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==", + "dev": true + }, + "node_modules/http-proxy": { + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "dev": true, + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/http-proxy-middleware": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", + "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==", + "dev": true, + "dependencies": { + "@types/http-proxy": "^1.17.8", + "http-proxy": "^1.18.1", + "is-glob": "^4.0.1", + "is-plain-obj": "^3.0.0", + "micromatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "@types/express": "^4.17.13" + }, + "peerDependenciesMeta": { + "@types/express": { + "optional": true + } + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==" + }, "node_modules/import-local": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", @@ -2784,8 +3623,7 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/interpret": { "version": "3.1.1", @@ -2796,12 +3634,20 @@ "node": ">=10.13.0" } }, + "node_modules/ipaddr.js": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.0.1.tgz", + "integrity": "sha512-1qTgH9NG+IIJ4yfKs2e6Pp1bZg8wbDbKHT21HrLIeYBTRLgMYKnMTPAuI3Lcs61nfx5h1xlXnbJtH1kX5/d/ng==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, - "optional": true, "dependencies": { "binary-extensions": "^2.0.0" }, @@ -2821,12 +3667,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, - "optional": true, "engines": { "node": ">=0.10.0" } @@ -2836,7 +3696,6 @@ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, - "optional": true, "dependencies": { "is-extglob": "^2.1.1" }, @@ -2849,11 +3708,22 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, - "optional": true, "engines": { "node": ">=0.12.0" } }, + "node_modules/is-plain-obj": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", + "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -2866,6 +3736,35 @@ "node": ">=0.10.0" } }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -2961,6 +3860,49 @@ "node": ">=6" } }, + "node_modules/jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "node_modules/jszip-utils": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/jszip-utils/-/jszip-utils-0.1.0.tgz", + "integrity": "sha512-tBNe0o3HAf8vo0BrOYnLPnXNo5A3KsRMnkBFYjh20Y3GPYGfgyoclEMgvVchx0nnL+mherPi74yLPIusHUQpZg==" + }, + "node_modules/jszip/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/jszip/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/jszip/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -2970,6 +3912,24 @@ "node": ">=0.10.0" } }, + "node_modules/launch-editor": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.6.0.tgz", + "integrity": "sha512-JpDCcQnyAAzZZaZ7vEiSqL690w7dAEyLao+KC96zBplnYbJS7TYNjvM3M7y3dGz+v7aIsJk3hllWuc0kWAjyRQ==", + "dev": true, + "dependencies": { + "picocolors": "^1.0.0", + "shell-quote": "^1.7.3" + } + }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dependencies": { + "immediate": "~3.0.5" + } + }, "node_modules/loader-runner": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", @@ -3019,12 +3979,73 @@ "node": ">=6" } }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/memfs": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.5.1.tgz", + "integrity": "sha512-UWbFJKvj5k+nETdteFndTpYxdeTMox/ULeqX5k/dpaQJCCFmj5EeKv3dBcyO2xmkRAx2vppRu5dVG7SOtsGOzA==", + "dev": true, + "dependencies": { + "fs-monkey": "^1.0.3" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", + "dev": true + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -3046,6 +4067,21 @@ "node": ">= 0.6" } }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -3064,12 +4100,43 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/multicast-dns": { + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz", + "integrity": "sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==", + "dev": true, + "dependencies": { + "dns-packet": "^5.2.2", + "thunky": "^1.0.2" + }, + "bin": { + "multicast-dns": "cli.js" + } + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, + "node_modules/node-forge": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "dev": true, + "engines": { + "node": ">= 6.13.0" + } + }, "node_modules/node-releases": { "version": "2.0.10", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz", @@ -3081,11 +4148,58 @@ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, - "optional": true, "engines": { "node": ">=0.10.0" } }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dev": true, + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -3095,6 +4209,38 @@ "wrappy": "1" } }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/open": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz", + "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==", + "dev": true, + "dependencies": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -3122,6 +4268,19 @@ "node": ">=8" } }, + "node_modules/p-retry": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-4.6.2.tgz", + "integrity": "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==", + "dev": true, + "dependencies": { + "@types/retry": "0.12.0", + "retry": "^0.13.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -3131,6 +4290,20 @@ "node": ">=6" } }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -3164,6 +4337,12 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==", + "dev": true + }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -3175,7 +4354,6 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, - "optional": true, "engines": { "node": ">=8.6" }, @@ -3201,25 +4379,114 @@ "find-up": "^4.0.0" }, "engines": { - "node": ">=8" + "node": ">=8" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dev": true, + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-addr/node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dev": true, + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "dev": true, + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" } }, - "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "node_modules/raw-body/node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", "dev": true, "engines": { - "node": ">=6" + "node": ">= 0.8" } }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dev": true, "dependencies": { - "safe-buffer": "^5.1.0" + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" } }, "node_modules/readdirp": { @@ -3227,7 +4494,6 @@ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, - "optional": true, "dependencies": { "picomatch": "^2.2.1" }, @@ -3327,6 +4593,12 @@ "node": ">=0.10.0" } }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, "node_modules/resolve": { "version": "1.22.2", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", @@ -3365,6 +4637,30 @@ "node": ">=8" } }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -3385,6 +4681,12 @@ } ] }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "node_modules/schema-utils": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.1.tgz", @@ -3404,6 +4706,24 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/select-hose": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", + "integrity": "sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==", + "dev": true + }, + "node_modules/selfsigned": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.1.1.tgz", + "integrity": "sha512-GSL3aowiF7wa/WtSFwnUrludWFoNhftq8bUkH9pkzjpN2XSPOAYEgg6e0sS9s0rZwgJzJiQRPU18A6clnoW5wQ==", + "dev": true, + "dependencies": { + "node-forge": "^1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", @@ -3413,6 +4733,51 @@ "semver": "bin/semver" } }, + "node_modules/send": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "dev": true, + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, "node_modules/serialize-javascript": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", @@ -3422,6 +4787,110 @@ "randombytes": "^2.1.0" } }, + "node_modules/serve-index": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", + "integrity": "sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==", + "dev": true, + "dependencies": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/serve-index/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/serve-index/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-index/node_modules/http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==", + "dev": true, + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-index/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==", + "dev": true + }, + "node_modules/serve-index/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/serve-index/node_modules/setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", + "dev": true + }, + "node_modules/serve-index/node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-static": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "dev": true, + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "dev": true + }, "node_modules/shallow-clone": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", @@ -3455,6 +4924,35 @@ "node": ">=8" } }, + "node_modules/shell-quote": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", + "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, "node_modules/slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", @@ -3464,6 +4962,17 @@ "node": ">=6" } }, + "node_modules/sockjs": { + "version": "0.3.24", + "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz", + "integrity": "sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==", + "dev": true, + "dependencies": { + "faye-websocket": "^0.11.3", + "uuid": "^8.3.2", + "websocket-driver": "^0.7.4" + } + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -3483,6 +4992,63 @@ "source-map": "^0.6.0" } }, + "node_modules/spdy": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", + "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", + "dev": true, + "dependencies": { + "debug": "^4.1.0", + "handle-thing": "^2.0.0", + "http-deceiver": "^1.2.7", + "select-hose": "^2.0.0", + "spdy-transport": "^3.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/spdy-transport": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", + "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", + "dev": true, + "dependencies": { + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "hpack.js": "^2.1.6", + "obuf": "^1.1.2", + "readable-stream": "^3.0.6", + "wbuf": "^1.7.3" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -3623,6 +5189,12 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, + "node_modules/thunky": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", + "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", + "dev": true + }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -3637,7 +5209,6 @@ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, - "optional": true, "dependencies": { "is-number": "^7.0.0" }, @@ -3645,6 +5216,28 @@ "node": ">=8.0" } }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "dev": true, + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", @@ -3685,6 +5278,15 @@ "node": ">=4" } }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/update-browserslist-db": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", @@ -3724,6 +5326,38 @@ "punycode": "^2.1.0" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "dev": true, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/watchpack": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", @@ -3737,6 +5371,15 @@ "node": ">=10.13.0" } }, + "node_modules/wbuf": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", + "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "dev": true, + "dependencies": { + "minimalistic-assert": "^1.0.0" + } + }, "node_modules/webpack": { "version": "5.81.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.81.0.tgz", @@ -3838,6 +5481,88 @@ "node": ">=14" } }, + "node_modules/webpack-dev-middleware": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-5.3.3.tgz", + "integrity": "sha512-hj5CYrY0bZLB+eTO+x/j67Pkrquiy7kWepMHmUMoPsmcUaeEnQJqFzHJOyxgWlq746/wUuA64p9ta34Kyb01pA==", + "dev": true, + "dependencies": { + "colorette": "^2.0.10", + "memfs": "^3.4.3", + "mime-types": "^2.1.31", + "range-parser": "^1.2.1", + "schema-utils": "^4.0.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, + "node_modules/webpack-dev-server": { + "version": "4.15.0", + "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-4.15.0.tgz", + "integrity": "sha512-HmNB5QeSl1KpulTBQ8UT4FPrByYyaLxpJoQ0+s7EvUrMc16m0ZS1sgb1XGqzmgCPk0c9y+aaXxn11tbLzuM7NQ==", + "dev": true, + "dependencies": { + "@types/bonjour": "^3.5.9", + "@types/connect-history-api-fallback": "^1.3.5", + "@types/express": "^4.17.13", + "@types/serve-index": "^1.9.1", + "@types/serve-static": "^1.13.10", + "@types/sockjs": "^0.3.33", + "@types/ws": "^8.5.1", + "ansi-html-community": "^0.0.8", + "bonjour-service": "^1.0.11", + "chokidar": "^3.5.3", + "colorette": "^2.0.10", + "compression": "^1.7.4", + "connect-history-api-fallback": "^2.0.0", + "default-gateway": "^6.0.3", + "express": "^4.17.3", + "graceful-fs": "^4.2.6", + "html-entities": "^2.3.2", + "http-proxy-middleware": "^2.0.3", + "ipaddr.js": "^2.0.1", + "launch-editor": "^2.6.0", + "open": "^8.0.9", + "p-retry": "^4.5.0", + "rimraf": "^3.0.2", + "schema-utils": "^4.0.0", + "selfsigned": "^2.1.1", + "serve-index": "^1.9.1", + "sockjs": "^0.3.24", + "spdy": "^4.0.2", + "webpack-dev-middleware": "^5.3.1", + "ws": "^8.13.0" + }, + "bin": { + "webpack-dev-server": "bin/webpack-dev-server.js" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.37.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "webpack": { + "optional": true + }, + "webpack-cli": { + "optional": true + } + } + }, "node_modules/webpack-merge": { "version": "5.8.0", "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", @@ -3909,6 +5634,29 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/websocket-driver": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", + "integrity": "sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==", + "dev": true, + "dependencies": { + "http-parser-js": ">=0.5.1", + "safe-buffer": ">=5.1.0", + "websocket-extensions": ">=0.1.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/websocket-extensions": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz", + "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -3936,6 +5684,27 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, + "node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", diff --git a/package.json b/package.json index 2a0ef5e..52df11b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "scripts": { "build-test": "webpack --config webpack_test_threejs.config.js", "build-dev": "webpack --mode=development --config=webpack.config.js", - "build-prod": "webpack --mode=production --config=webpack.config.js" + "build-prod": "webpack --mode=production --config=webpack.config.js", + "serve": "webpack serve --mode development --config webpack.config.js" }, "license": "GPL-3.0", "devDependencies": { @@ -20,6 +21,11 @@ "core-js": "^3.30.1", "regenerator-runtime": "^0.13.11", "webpack": "^5.81.0", - "webpack-cli": "^5.0.2" + "webpack-cli": "^5.0.2", + "webpack-dev-server": "^4.15.0" + }, + "dependencies": { + "jszip": "^3.10.1", + "jszip-utils": "^0.1.0" } } diff --git a/src/Plugin/Field/FieldFormatter/DgiThreejsFileFormatter.php b/src/Plugin/Field/FieldFormatter/DgiThreejsFileFormatter.php index 2ac7a46..beaa89d 100644 --- a/src/Plugin/Field/FieldFormatter/DgiThreejsFileFormatter.php +++ b/src/Plugin/Field/FieldFormatter/DgiThreejsFileFormatter.php @@ -5,7 +5,6 @@ use Drupal\Core\Field\FieldItemListInterface; use Drupal\file\Plugin\Field\FieldFormatter\FileFormatterBase; use Drupal\file\FileInterface; -use Drupal\Core\Field\EntityReferenceFieldItemListInterface; /** * Plugin implementation of the 'dgi_threejs_file_formatter' formatter. @@ -18,96 +17,95 @@ * } * ) */ -class DgiThreejsFileFormatter extends FileFormatterBase -{ +class DgiThreejsFileFormatter extends FileFormatterBase { + + /** + * @inheritDoc + */ + public static function defaultSettings(): array { + $viewer_settings = [ + 'width' => '100%', + 'height' => '400px', + 'file_url' => '', + 'container_classes' => ['dgi-3d-viewer-canvas'], + 'progress_element_classes' => ['dgi-3d-viewer-progress'], + ]; + return [ + 'viewer_settings' => $viewer_settings, + ] + parent::defaultSettings(); + } + + /** + * @inheritDoc + */ + public function viewElements(FieldItemListInterface $items, $langcode): array { /** - * @inheritDoc + * Upstream class extensions and inheritance is a bit of a mess: + * + * This extends FileFormatterBase, + * which extends EntityReferenceFormatterBase, + * which extends FormatterBase, + * which implements FormatterInterface. + * + * EntityReferenceFormatterBase has a getEntitiesToView() method, + * which expects an EntityReferenceFieldItemListInterface, but + * it doesn't override viewElements(), and neither does + * FileFormatterBase. Type difference aren't affecting functionality. + * It's just getting caught by static analysis, so casting the + * $items argument to EntityReferenceFieldItemListInterface for now. + * @see https://www.drupal.org/project/drupal/issues/3138528 + * + * @var \Drupal\Core\Field\EntityReferenceFieldItemListInterface $items */ - public static function defaultSettings(): array - { - $viewer_settings = [ - 'width' => '100%', - 'height' => '400px', - 'file_url' => '', - 'container_classes' => ['dgi-3d-viewer-canvas'], - 'progress_element_classes' => ['dgi-3d-viewer-progress'], - 'perspective_camera_settings' => [ // https://threejs.org/docs/#api/en/cameras/PerspectiveCamera - 'fov' => 50, - 'near' => 0.1, - 'far' => 2000, - 'position' => [ - 'x' => 0, // left / right - 'y' => 0, // up / down - 'z' => 25, // forward / backward, 0 is center, which is likely inside the model. - ], - 'rotation' => [ - 'x' => 0, - 'y' => 0, - 'z' => 0, - ], - ], - ]; - return [ - 'viewer_settings' => $viewer_settings - ] + parent::defaultSettings(); + $entities = parent::getEntitiesToView($items, $langcode); + // If no entities load, or the first is not a FileInterface object, + // return empty. + if (empty($entities) || !($entities[0] instanceof FileInterface)) { + return []; } - /** - * @inheritDoc - */ - public function viewElements(FieldItemListInterface $items, $langcode): array - { - /** - * Upstream class extensions and inheritance is a bit of a mess: - * - * This extends FileFormatterBase, - * which extends EntityReferenceFormatterBase, - * which extends FormatterBase, - * which implements FormatterInterface. - * - * EntityReferenceFormatterBase has a getEntitiesToView() method, - * which expects an EntityReferenceFieldItemListInterface, but - * it doesn't override viewElements(), and neither does - * FileFormatterBase. Type difference aren't affecting functionality. - * It's just getting caught by static analysis, so casting the - * $items argument to EntityReferenceFieldItemListInterface for now. - * @see https://www.drupal.org/project/drupal/issues/3138528 - * - * @var EntityReferenceFieldItemListInterface $items - */ - $entities = parent::getEntitiesToView($items, $langcode); - // If no entities load, or the first is not a FileInterface object, - // return empty. - if (empty($entities) || !($entities[0] instanceof FileInterface)) { - return []; - } + $parent = $items->getParent()->getValue(); - // Get the file URL. - $file_url = $entities[0]->createFileUrl(); - if ($file_url) { - $viewer_settings = $this->getSetting('viewer_settings'); - $viewer_settings['file_url'] = $file_url; - $this->setSetting('viewer_settings', $viewer_settings); - $render_array = [ - '#type' => 'container', - '#attributes' => [ - 'class' => $viewer_settings['container_classes'], - ], - '#children' => [ - 'progress' => [ - '#type' => 'html_tag', - '#tag' => 'span', - '#value' => t('Rendering...'), - '#attributes' => [ - 'class' => $viewer_settings['progress_element_classes'], - ], - ], - ], - ]; - $render_array['#attached']['drupalSettings']['dgi3DViewer'] = $viewer_settings; - $render_array['#attached']['library'][] = 'dgi_3d_viewer/dgi_3d_viewer'; - return $render_array; - } - return []; + // Get the file URL. + $file_url = $entities[0]->createFileUrl(); + if ($file_url) { + $viewer_settings = $this->getSetting('viewer_settings'); + $viewer_settings['file_url'] = $file_url; + $viewer_settings['model_ext'] = pathinfo($file_url, PATHINFO_EXTENSION); + if ($customCamera = $parent->field_customcamera->value) { + $viewer_settings['camera_settings'] = unserialize($customCamera, ['allowed_classes' => FALSE]); + } + + if ($light = $parent->field_light->value) { + $viewer_settings['light'] = $light; + } + + if ($objArchive = $parent->field_materials_zip && $objArchive->entity) { + $viewer_settings['compressed_resources_url'] = $objArchive->entity->createFileUrl(); + } + + $this->setSetting('viewer_settings', $viewer_settings); + $render_array = [ + '#type' => 'container', + '#attributes' => [ + 'class' => $viewer_settings['container_classes'], + ], + '#children' => [ + 'progress' => [ + '#type' => 'html_tag', + '#tag' => 'span', + '#value' => $this->t('Rendering...'), + '#attributes' => [ + 'class' => $viewer_settings['progress_element_classes'], + ], + ], + ], + ]; + $render_array['#attached']['drupalSettings']['dgi3DViewer'] = $viewer_settings; + $render_array['#attached']['library'][] = 'dgi_3d_viewer/dgi_3d_viewer'; + return $render_array; } -} \ No newline at end of file + return []; + } + +} diff --git a/src/Plugin/Field/FieldWidget/DgiThreejsFileWidget.php b/src/Plugin/Field/FieldWidget/DgiThreejsFileWidget.php index 7b55f58..66a944f 100644 --- a/src/Plugin/Field/FieldWidget/DgiThreejsFileWidget.php +++ b/src/Plugin/Field/FieldWidget/DgiThreejsFileWidget.php @@ -16,83 +16,114 @@ * } * ) */ -class DgiThreejsFileWidget extends FileWidget -{ - /** - * @inheritDoc - */ - public static function defaultSettings(): array - { - // TODO: Change how the preview settings are defined. - // Some settings will be exposed to the user in the widget settings - // form when the configurable camera work is done, and some will be - // defined as default settings. The defaults should be defined in a way - // that allows them to be retrieved by the formatter as well. - $preview_settings = [ - 'width' => '100%', - 'height' => '400px', - 'file_url' => '', - 'container_classes' => ['dgi-3d-viewer-canvas'], - 'progress_element_classes' => ['dgi-3d-viewer-progress'], - 'perspective_camera_settings' => [ // https://threejs.org/docs/#api/en/cameras/PerspectiveCamera - 'fov' => 50, - 'near' => 0.1, - 'far' => 2000, - 'position' => [ - 'x' => 0, // left / right - 'y' => 0, // up / down - 'z' => 25, // forward / backward, 0 is center, which is likely inside the model. - ], - 'rotation' => [ - 'x' => 0, - 'y' => 0, - 'z' => 0, - ], - ], +class DgiThreejsFileWidget extends FileWidget { + + /** + * @inheritDoc + */ + public static function defaultSettings(): array { + $preview_settings = [ + 'width' => '100%', + 'height' => '400px', + 'file_url' => '', + 'container_classes' => ['dgi-3d-viewer-canvas'], + 'progress_element_classes' => ['dgi-3d-viewer-progress'], + // https://threejs.org/docs/#api/en/cameras/PerspectiveCamera + 'perspective_camera_settings' => [ + 'fov' => 50, + 'near' => 0.1, + 'far' => 2000, + 'position' => [ + 'x' => 0, + 'y' => 0, + 'z' => 25, + ], + 'rotation' => [ + 'x' => 0, + 'y' => 0, + 'z' => 0, + ], + ], + ]; + return [ + 'preview_settings' => $preview_settings, + ] + parent::defaultSettings(); + } + + /** + * @inheritDoc + */ + public static function process($element, FormStateInterface $form_state, $form) { + $preview_settings = static::defaultSettings()['preview_settings']; + // If file is uploaded, check if it is a supported format. + if (!empty($element['#files'])) { + $file = reset($element['#files']); + $supported_formats = ['gltf', 'glb', 'obj']; + $file_ext = pathinfo($file->getFileUri(), PATHINFO_EXTENSION); + if (!in_array($file_ext, $supported_formats)) { + return parent::process($element, $form_state, $form); + } + else { + $preview_settings['model_ext'] = $file_ext; + // The file exists and is a supported format, so we can add the viewer. + $preview_settings['file_url'] = $file->createFileUrl(); + // Define the preview container. + $element['preview'] = [ + '#theme' => 'container', + '#attributes' => [ + 'class' => $preview_settings['container_classes'], + 'style' => 'width: ' . $preview_settings['width'] . '; height: ' . $preview_settings['height'] . ';', + ], + ]; + $element['preview']['#children']['progress'] = [ + '#type' => 'html_tag', + '#tag' => 'span', + '#value' => t('Rendering...'), + '#attributes' => [ + 'class' => $preview_settings['progress_element_classes'], + ], ]; - return [ - 'preview_settings' => $preview_settings - ] + parent::defaultSettings(); + } } - /** - * @inheritDoc - */ - public static function process($element, FormStateInterface $form_state, $form) - { - $preview_settings = static::defaultSettings()['preview_settings']; - // If file is uploaded, check if it is a supported format. - if (!empty($element['#files'])) { - $file = reset($element['#files']); - $supported_formats = ['gltf', 'glb']; - $file_ext = pathinfo($file->getFileUri(), PATHINFO_EXTENSION); - if (!in_array($file_ext, $supported_formats)) { - return parent::process($element, $form_state, $form); - } - else { - // The file exists and is a supported format, so we can add the viewer. - $preview_settings['file_url'] = $file->createFileUrl(); - // Define the preview container. - $element['preview'] = [ - '#theme' => 'container', - '#attributes' => [ - 'class' => $preview_settings['container_classes'], - 'style' => 'width: ' . $preview_settings['width'] . '; height: ' . $preview_settings['height'] . ';', - ], - ]; - $element['preview']['#children']['progress'] = [ - '#type' => 'html_tag', - '#tag' => 'span', - '#value' => t('Rendering...'), - '#attributes' => [ - 'class' => $preview_settings['progress_element_classes'], - ], - ]; - } - } - // Add the library and settings to the element. - $element['#attached']['drupalSettings']['dgi3DViewer'] = $preview_settings; - $element['#attached']['library'][] = 'dgi_3d_viewer/dgi_3d_viewer'; - return parent::process($element, $form_state, $form); + // Add the library and settings to the element. + $element['#attached']['drupalSettings']['dgi3DViewer'] = $preview_settings; + $element['#attached']['library'][] = 'dgi_3d_viewer/dgi_3d_viewer'; + return parent::process($element, $form_state, $form); + } + + /** + * Convert camera array to threejs settings. + */ + private static function cameraArrayToThreejsSettings(array $camera): array { + $camera_settings = []; + + if (array_key_exists('field_aspect', $camera)) { + $camera_settings['type'] = 'PerspectiveCamera'; + } + else { + $camera_settings['type'] = 'OrthographicCamera'; } + + foreach ($camera as $fieldName => $property) { + // Create field name array. + // For ex: field_aspect will become $array = ['field', 'aspect']. + $field_name_array = explode('_', $fieldName); + + // Remove the first element which is 'field'. + array_shift($field_name_array); + + // Position and Rotation require sub-arrays. + if (isset($field_name_array[1])) { + $camera_settings['settings'][$field_name_array[0]][$field_name_array[1]] = $property[0]['value']; + } + else { + $camera_settings['settings'][$field_name_array[0]] = $property[0]['value']; + } + + } + + return $camera_settings; + } + } diff --git a/webpack.config.js b/webpack.config.js index a4b3185..7faa0ad 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,7 +4,7 @@ module.exports = { entry: './js/dgi_3d_viewer.es6.js', output: { filename: 'dgi_3d_viewer.js', - path: path.resolve(__dirname, 'js'), + path: path.resolve(__dirname, 'js/dist'), }, resolve: { alias: { @@ -12,6 +12,10 @@ module.exports = { addons: path.resolve(__dirname, '/opt/www/drupal/libraries/three/examples/jsm/') } }, + devServer: { + compress: true, + port: 9000, + }, module: { rules: [ {