mirror of https://github.com/OCA/web.git
1093 lines
1.4 MiB
1093 lines
1.4 MiB
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
"undefined"!=typeof window&&null!=window.customElements&&window.customElements.polyfillWrapFlushCallback,String(Math.random()).slice(2)
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/;
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
(()=>{try{const e={get capture(){return!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})(),
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.2.1")
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/,void 0===window.ShadyCSS||void 0===window.ShadyCSS.prepareTemplateDom&&console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1.")
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/,window.JSCompiler_renameProperty=(e,t)=>e;const e={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},t=(e,t)=>t!==e&&(t==t||e==e),n={attribute:!0,type:String,converter:e,reflect:!1,hasChanged:t};class i extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,n)=>{const i=this._attributeNameForProperty(n,t);void 0!==i&&(this._attributeToPropertyMap.set(i,n),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=n){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const i="symbol"==typeof e?Symbol():"__"+e,r=this.getPropertyDescriptor(e,i,t);void 0!==r&&Object.defineProperty(this.prototype,e,r)}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(n){const i=this[e];this[t]=n,this._requestUpdate(e,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||n}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty("finalized")||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const n of t)this.createProperty(n,e[n])}}static _attributeNameForProperty(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,n,i=t){return i(e,n)}static _propertyValueFromAttribute(t,n){const i=n.type,r=n.converter||e,a="function"==typeof r?r:r.fromAttribute;return a?a(t,i):t}static _propertyValueToAttribute(t,n){if(void 0===n.reflect)return;const i=n.type,r=n.converter;return(r&&r.toAttribute||e.toAttribute)(t,i)}initialize(){this._saveInstanceProperties(),this._requestUpdate()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this._attributeToProperty(e,n)}_propertyToAttribute(e,t,i=n){const r=this.constructor,a=r._attributeNameForProperty(e,i);if(void 0!==a){const e=r._propertyValueToAttribute(t,i);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(a):this.setAttribute(a,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const n=this.constructor,i=n._attributeToPropertyMap.get(e);if(void 0!==i){const e=n.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=n._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}_requestUpdate(e,t){let n=!0;if(void 0!==e){const i=this.constructor,r=i.getPropertyOptions(e);i._valueHasChanged(this[e],t,r.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==r.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,r))):n=!1}!this._hasRequestedUpdate&&n&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this._requestUpdate(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}i.finalized=!0;
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/
|
|
const r=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Object.assign(Object.assign({},t),{finisher(n){n.createProperty(t.key,e)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(n){n.createProperty(t.key,e)}};function a(e){return(t,n)=>void 0!==n?((e,t,n)=>{t.constructor.createProperty(n,e)})(e,t,n):r(e,t)}
|
|
/**
|
|
@license
|
|
Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
|
|
This code may only be used under the BSD style license found at
|
|
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
|
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
|
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
part of the polymer project is also subject to an additional IP rights grant
|
|
found at http://polymer.github.io/PATENTS.txt
|
|
*/"adoptedStyleSheets"in Document.prototype&&CSSStyleSheet.prototype;
|
|
/**
|
|
* @license
|
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
* This code may only be used under the BSD style license found at
|
|
* http://polymer.github.io/LICENSE.txt
|
|
* The complete set of authors may be found at
|
|
* http://polymer.github.io/AUTHORS.txt
|
|
* The complete set of contributors may be found at
|
|
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
* Code distributed by Google as part of the polymer project is also
|
|
* subject to an additional IP rights grant found at
|
|
* http://polymer.github.io/PATENTS.txt
|
|
*/(window.litElementVersions||(window.litElementVersions=[])).push("2.3.1");
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const o=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,s=o&&self.XRSession.prototype.requestHitTestSource,l=null!=self.ResizeObserver,c=null!=self.IntersectionObserver,h=s,u=((()=>{const e=navigator.userAgent||navigator.vendor||self.opera;let t=!1;(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0)})(),/\bCrOS\b/.test(navigator.userAgent),/android/i.test(navigator.userAgent)),p=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,d=(()=>{const e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))})(),f=/Safari\//.test(navigator.userAgent),m=p&&/CriOS\//.test(navigator.userAgent),g=p&&f;!window.ActiveXObject&&window;
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const v=document.createElement("template");v.innerHTML='\n<style>\n:host {\n display: block;\n position: relative;\n contain: strict;\n width: 150px;\n height: 100px;\n}\n\n/* NOTE: This ruleset is our integration surface area with the\n * :focus-visible polyfill.\n *\n * @see https://github.com/WICG/focus-visible/pull/196 */\n:host([data-js-focus-visible]:focus:not(.focus-visible)),\n:host([data-js-focus-visible]) :focus:not(.focus-visible) {\n outline: none;\n}\n\n.container {\n position: relative;\n}\n\n.annotation-container {\n position: absolute;\n pointer-events: none;\n top: 0;\n}\n\n.userInput {\n width: 100%;\n height: 100%;\n display: block;\n overflow: hidden;\n}\n\ncanvas {\n position: absolute;\n display: none;\n pointer-events: none;\n /* NOTE(cdata): Chrome 76 and below apparently have a bug\n * that causes our canvas not to display pixels unless it is\n * on its own render layer\n * @see https://github.com/GoogleWebComponents/model-viewer/pull/755#issuecomment-536597893\n */\n transform: translateZ(0);\n}\n\ncanvas.show {\n display: block;\n}\n\n/* Adapted from HTML5 Boilerplate\n *\n * @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */\n.screen-reader-only {\n border: 0;\n clip: rect(0, 0, 0, 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n}\n\n.slot {\n position: absolute;\n pointer-events: none;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.slot > * {\n pointer-events: initial;\n}\n\n.annotation-wrapper ::slotted(*) {\n opacity: var(--max-hotspot-opacity, 1);\n transition: opacity 0.3s;\n}\n\n.pointer-tumbling .annotation-wrapper ::slotted(*) {\n pointer-events: none;\n}\n\n.annotation-wrapper ::slotted(*) {\n pointer-events: initial;\n}\n\n.annotation-wrapper.hide ::slotted(*) {\n opacity: var(--min-hotspot-opacity, 0.25);\n}\n\n.slot.poster {\n opacity: 0;\n transition: opacity 0.3s 0.3s;\n background-color: inherit;\n}\n\n.slot.poster.show {\n opacity: 1;\n transition: none;\n}\n\n.slot.poster > * {\n pointer-events: initial;\n}\n\n.slot.poster:not(.show) > * {\n pointer-events: none;\n}\n\n#default-poster {\n width: 100%;\n height: 100%;\n /* The default poster is a <button> so we need to set display\n * to prevent it from being affected by text-align: */\n display: block;\n position: absolute;\n border: none;\n padding: 0;\n background-size: contain;\n background-repeat: no-repeat;\n background-position: center;\n background-color: var(--poster-color, #fff);\n background-image: var(--poster-image, none);\n}\n\n#default-progress-bar {\n display: block;\n position: relative;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n}\n\n#default-progress-bar > .mask {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: var(--progress-mask, #fff);\n transition: opacity 0.3s;\n opacity: 0.2;\n}\n\n#default-progress-bar > .bar {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: var(--progress-bar-height, 5px);\n transition: transform 0.09s;\n transform-origin: top left;\n transform: scaleX(0);\n overflow: hidden;\n}\n\n#default-progress-bar > .bar:before {\n content: \'\';\n display: block;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n\n background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4));\n\n transition: none;\n transform-origin: top left;\n transform: translateY(0);\n}\n\n#default-progress-bar > .bar.hide:before {\n transition: transform 0.3s 1s;\n transform: translateY(-100%);\n}\n\n.slot.interaction-prompt {\n display: var(--interaction-prompt-display, flex);\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n align-items: center;\n justify-content: center;\n\n opacity: 0;\n will-change: opacity;\n overflow: hidden;\n transition: opacity 0.3s;\n}\n\n.slot.interaction-prompt.visible {\n opacity: 1;\n}\n\n.slot.interaction-prompt > .animated-container {\n will-change: transform, opacity;\n}\n\n.slot.interaction-prompt > * {\n pointer-events: none;\n}\n\n.slot.ar-button {\n -moz-user-select: none;\n -webkit-tap-highlight-color: transparent;\n user-select: none;\n\n display: var(--ar-button-display, block);\n}\n\n.slot.ar-button:not(.enabled) {\n display: none;\n}\n\n.fab {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 40px;\n height: 40px;\n cursor: pointer;\n background-color: #fff;\n box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15);\n border-radius: 100px;\n}\n\n.fab > * {\n opacity: 0.87;\n}\n\n#default-ar-button {\n position: absolute;\n bottom: 16px;\n right: 16px;\n transform: scale(var(--ar-button-scale, 1));\n transform-origin: bottom right;\n}\n\n.slot.default {\n pointer-events: none;\n}\n\n.slot.progress-bar {\n pointer-events: none;\n}\n\n.slot.exit-webxr-ar-button {\n pointer-events: none;\n}\n\n.slot.exit-webxr-ar-button:not(.enabled) {\n display: none;\n}\n\n#default-exit-webxr-ar-button {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n top: 16px;\n left: 16px;\n width: 40px;\n height: 40px;\n box-sizing: border-box;\n}\n\n#default-exit-webxr-ar-button > svg {\n fill: #fff;\n}\n</style>\n<div class="container">\n <div class="userInput" tabindex="0" role="img"\n aria-label="A depiction of a 3D model"\n aria-live="polite">\n <canvas></canvas>\n </div>\n\n \x3c!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM\n will have their <slot> elements removed by ShadyCSS --\x3e\n <div class="slot poster">\n <slot name="poster">\n <button type="button" id="default-poster" aria-hidden="true" aria-label="Activate to view in 3D!"></button>\n </slot>\n </div>\n\n <div class="slot ar-button">\n <slot name="ar-button">\n <a id="default-ar-button" class="fab"\n tabindex="2"\n aria-label="View this 3D model up close">\n \n<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"\n\t xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"\n\t viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">\n<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>\n<g id="Art_layer">\n\t<path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>\n\t<path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>\n\t<path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>\n\t<path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>\n\t<g>\n\t\t<path d="M18.25,7.6l-5.5-3.18c-0.46-0.27-1.04-0.27-1.5,0L5.75,7.6C5.29,7.87,5,8.36,5,8.9v6.35c0,0.54,0.29,1.03,0.75,1.3\n\t\t\tl5.5,3.18c0.46,0.27,1.04,0.27,1.5,0l5.5-3.18c0.46-0.27,0.75-0.76,0.75-1.3V8.9C19,8.36,18.71,7.87,18.25,7.6z M7,14.96v-4.62\n\t\t\tl4,2.32v4.61L7,14.96z M12,10.93L8,8.61l4-2.31l4,2.31L12,10.93z M13,17.27v-4.61l4-2.32v4.62L13,17.27z"/>\n\t</g>\n</g>\n</svg>\n </a>\n </slot>\n </div>\n\n <div class="slot interaction-prompt">\n <div class="animated-container" part="interaction-prompt">\n <slot name="interaction-prompt" aria-hidden="true">\n \n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">\n <defs>\n <path id="A" d="M.001.232h24.997V36H.001z" />\n </defs>\n <g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">\n <path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />\n <g transform="translate(11 3)">\n <path d="M8.733 11.165c.04-1.108.766-2.027 1.743-2.307a2.54 2.54 0 0 1 .628-.089c.16 0 .314.017.463.044 1.088.2 1.9 1.092 1.9 2.16v8.88h1.26c2.943-1.39 5-4.45 5-8.025a9.01 9.01 0 0 0-1.9-5.56l-.43-.5c-.765-.838-1.683-1.522-2.712-2-1.057-.49-2.226-.77-3.46-.77s-2.4.278-3.46.77c-1.03.478-1.947 1.162-2.71 2l-.43.5a9.01 9.01 0 0 0-1.9 5.56 9.04 9.04 0 0 0 .094 1.305c.03.21.088.41.13.617l.136.624c.083.286.196.56.305.832l.124.333a8.78 8.78 0 0 0 .509.953l.065.122a8.69 8.69 0 0 0 3.521 3.191l1.11.537v-9.178z" fill-opacity=".5" fill="#e4e4e4" />\n <path d="M22.94 26.218l-2.76 7.74c-.172.485-.676.8-1.253.8H12.24c-1.606 0-3.092-.68-3.98-1.82-1.592-2.048-3.647-3.822-6.11-5.27-.095-.055-.15-.137-.152-.23-.004-.1.046-.196.193-.297.56-.393 1.234-.6 1.926-.6a3.43 3.43 0 0 1 .691.069l4.922.994V10.972c0-.663.615-1.203 1.37-1.203s1.373.54 1.373 1.203v9.882h2.953c.273 0 .533.073.757.21l6.257 3.874c.027.017.045.042.07.06.41.296.586.77.426 1.22M4.1 16.614c-.024-.04-.042-.083-.065-.122a8.69 8.69 0 0 1-.509-.953c-.048-.107-.08-.223-.124-.333l-.305-.832c-.058-.202-.09-.416-.136-.624l-.13-.617a9.03 9.03 0 0 1-.094-1.305c0-2.107.714-4.04 1.9-5.56l.43-.5c.764-.84 1.682-1.523 2.71-2 1.058-.49 2.226-.77 3.46-.77s2.402.28 3.46.77c1.03.477 1.947 1.16 2.712 2l.428.5a9 9 0 0 1 1.901 5.559c0 3.577-2.056 6.636-5 8.026h-1.26v-8.882c0-1.067-.822-1.96-1.9-2.16-.15-.028-.304-.044-.463-.044-.22 0-.427.037-.628.09-.977.28-1.703 1.198-1.743 2.306v9.178l-1.11-.537C6.18 19.098 4.96 18 4.1 16.614M22.97 24.09l-6.256-3.874c-.102-.063-.218-.098-.33-.144 2.683-1.8 4.354-4.855 4.354-8.243 0-.486-.037-.964-.104-1.43a9.97 9.97 0 0 0-1.57-4.128l-.295-.408-.066-.092a10.05 10.05 0 0 0-.949-1.078c-.342-.334-.708-.643-1.094-.922-1.155-.834-2.492-1.412-3.94-1.65l-.732-.088-.748-.03a9.29 9.29 0 0 0-1.482.119c-1.447.238-2.786.816-3.94 1.65a9.33 9.33 0 0 0-.813.686 9.59 9.59 0 0 0-.845.877l-.385.437-.36.5-.288.468-.418.778-.04.09c-.593 1.28-.93 2.71-.93 4.222 0 3.832 2.182 7.342 5.56 8.938l1.437.68v4.946L5 25.64a4.44 4.44 0 0 0-.888-.086c-.017 0-.034.003-.05.003-.252.004-.503.033-.75.08a5.08 5.08 0 0 0-.237.056c-.193.046-.382.107-.568.18-.075.03-.15.057-.225.1-.25.114-.494.244-.723.405a1.31 1.31 0 0 0-.566 1.122 1.28 1.28 0 0 0 .645 1.051C4 29.925 5.96 31.614 7.473 33.563a5.06 5.06 0 0 0 .434.491c1.086 1.082 2.656 1.713 4.326 1.715h6.697c.748-.001 1.43-.333 1.858-.872.142-.18.256-.38.336-.602l2.757-7.74c.094-.26.13-.53.112-.794s-.088-.52-.203-.76a2.19 2.19 0 0 0-.821-.91" fill-opacity=".6" fill="#000" />\n <path d="M22.444 24.94l-6.257-3.874a1.45 1.45 0 0 0-.757-.211h-2.953v-9.88c0-.663-.616-1.203-1.373-1.203s-1.37.54-1.37 1.203v16.643l-4.922-.994a3.44 3.44 0 0 0-.692-.069 3.35 3.35 0 0 0-1.925.598c-.147.102-.198.198-.194.298.004.094.058.176.153.23 2.462 1.448 4.517 3.22 6.11 5.27.887 1.14 2.373 1.82 3.98 1.82h6.686c.577 0 1.08-.326 1.253-.8l2.76-7.74c.16-.448-.017-.923-.426-1.22-.025-.02-.043-.043-.07-.06z" fill="#fff" />\n <g transform="translate(0 .769)">\n <mask id="B" fill="#fff">\n <use xlink:href="#A" />\n </mask>\n <path d="M23.993 24.992a1.96 1.96 0 0 1-.111.794l-2.758 7.74c-.08.22-.194.423-.336.602-.427.54-1.11.87-1.857.872h-6.698c-1.67-.002-3.24-.633-4.326-1.715-.154-.154-.3-.318-.434-.49C5.96 30.846 4 29.157 1.646 27.773c-.385-.225-.626-.618-.645-1.05a1.31 1.31 0 0 1 .566-1.122 4.56 4.56 0 0 1 .723-.405l.225-.1a4.3 4.3 0 0 1 .568-.18l.237-.056c.248-.046.5-.075.75-.08.018 0 .034-.003.05-.003.303-.001.597.027.89.086l3.722.752V20.68l-1.436-.68c-3.377-1.596-5.56-5.106-5.56-8.938 0-1.51.336-2.94.93-4.222.015-.03.025-.06.04-.09.127-.267.268-.525.418-.778.093-.16.186-.316.288-.468.063-.095.133-.186.2-.277L3.773 5c.118-.155.26-.29.385-.437.266-.3.544-.604.845-.877a9.33 9.33 0 0 1 .813-.686C6.97 2.167 8.31 1.59 9.757 1.35a9.27 9.27 0 0 1 1.481-.119 8.82 8.82 0 0 1 .748.031c.247.02.49.05.733.088 1.448.238 2.786.816 3.94 1.65.387.28.752.588 1.094.922a9.94 9.94 0 0 1 .949 1.078l.066.092c.102.133.203.268.295.408a9.97 9.97 0 0 1 1.571 4.128c.066.467.103.945.103 1.43 0 3.388-1.67 6.453-4.353 8.243.11.046.227.08.33.144l6.256 3.874c.37.23.645.55.82.9.115.24.185.498.203.76m.697-1.195c-.265-.55-.677-1.007-1.194-1.326l-5.323-3.297c2.255-2.037 3.564-4.97 3.564-8.114 0-2.19-.637-4.304-1.84-6.114-.126-.188-.26-.37-.4-.552-.645-.848-1.402-1.6-2.252-2.204C15.472.91 13.393.232 11.238.232A10.21 10.21 0 0 0 5.23 2.19c-.848.614-1.606 1.356-2.253 2.205-.136.18-.272.363-.398.55C1.374 6.756.737 8.87.737 11.06c0 4.218 2.407 8.08 6.133 9.842l.863.41v3.092l-2.525-.51c-.356-.07-.717-.106-1.076-.106a5.45 5.45 0 0 0-3.14.996c-.653.46-1.022 1.202-.99 1.983a2.28 2.28 0 0 0 1.138 1.872c2.24 1.318 4.106 2.923 5.543 4.772 1.26 1.62 3.333 2.59 5.55 2.592h6.698c1.42-.001 2.68-.86 3.134-2.138l2.76-7.74c.272-.757.224-1.584-.134-2.325" fill-opacity=".05" fill="#000" mask="url(#B)" />\n </g>\n </g>\n </g>\n</svg>\n </slot>\n </div>\n </div>\n\n <div class="slot default">\n <slot></slot>\n\n <div class="slot progress-bar">\n <slot name="progress-bar">\n <div id="default-progress-bar" aria-hidden="true">\n <div class="mask"></div>\n <div class="bar"></div>\n </div>\n </slot>\n </div>\n \n <div class="slot exit-webxr-ar-button">\n <slot name="exit-webxr-ar-button">\n <a id="default-exit-webxr-ar-button"\n tabindex="3"\n aria-label="Exit AR"\n aria-hidden="true">\n \n<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">\n \x3c!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement\n support for dynamic re-coloring of UI components --\x3e\n <defs>\n <filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">\n <feGaussianBlur in="SourceAlpha" stdDeviation="1"/>\n <feOffset dx="0" dy="0" result="offsetblur"/>\n <feFlood flood-color="#000000"/>\n <feComposite in2="offsetblur" operator="in"/>\n <feMerge>\n <feMergeNode/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>\n </defs>\n <path filter="url(#drop-shadow)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>\n <path d="M0 0h24v24H0z" fill="none"/>\n</svg>\n </a>\n </slot>\n </div>\n </div>\n</div>';void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const t=Object(e);for(let e=1;e<arguments.length;e++){const n=arguments[e];if(null!=n)for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t});function y(){}Object.assign(y.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var i=n.indexOf(t);-1!==i&&n.splice(i,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),i=0,r=n.length;i<r;i++)n[i].call(this,e)}}}});for(var x=[],b=0;b<256;b++)x[b]=(b<16?"0":"")+b.toString(16);var w,_={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(x[255&e]+x[e>>8&255]+x[e>>16&255]+x[e>>24&255]+"-"+x[255&t]+x[t>>8&255]+"-"+x[t>>16&15|64]+x[t>>24&255]+"-"+x[63&n|128]+x[n>>8&255]+"-"+x[n>>16&255]+x[n>>24&255]+x[255&i]+x[i>>8&255]+x[i>>16&255]+x[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*_.DEG2RAD},radToDeg:function(e){return e*_.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),c=a((t+i)/2),h=o((t+i)/2),u=a((t-i)/2),p=o((t-i)/2),d=a((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(s*h,l*u,l*p,s*c);break;case"YZY":e.set(l*p,s*h,l*u,s*c);break;case"ZXZ":e.set(l*u,l*p,s*h,s*c);break;case"XZX":e.set(s*h,l*f,l*d,s*c);break;case"YXY":e.set(l*d,s*h,l*f,s*c);break;case"ZYZ":e.set(l*f,l*d,s*h,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};function M(e,t){this.x=e||0,this.y=t||0}function S(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperties(M.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(M.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),Object.assign(S.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,a,o,s,l){var c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],c=n[4],h=n[7],u=n[2],p=n[5],d=n[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],x=i[7],b=i[2],w=i[5],_=i[8];return r[0]=a*f+o*v+s*b,r[3]=a*m+o*y+s*w,r[6]=a*g+o*x+s*_,r[1]=l*f+c*v+h*b,r[4]=l*m+c*y+h*w,r[7]=l*g+c*x+h*_,r[2]=u*f+p*v+d*b,r[5]=u*m+p*y+d*w,r[8]=u*g+p*x+d*_,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8];return t*a*c-t*o*l-n*r*c+n*o*s+i*r*l-i*a*s},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var n=e.elements,i=this.elements,r=n[0],a=n[1],o=n[2],s=n[3],l=n[4],c=n[5],h=n[6],u=n[7],p=n[8],d=p*l-c*u,f=c*h-p*s,m=u*s-l*h,g=r*d+a*f+o*m;if(0===g)return this.set(0,0,0,0,0,0,0,0,0);var v=1/g;return i[0]=d*v,i[1]=(o*u-p*a)*v,i[2]=(c*a-o*l)*v,i[3]=f*v,i[4]=(p*r-o*h)*v,i[5]=(o*s-c*r)*v,i[6]=m*v,i[7]=(a*h-u*r)*v,i[8]=(l*r-a*s)*v,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,i,r,a,o){var s=Math.cos(r),l=Math.sin(r);this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-i*l,i*s,-i*(-l*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],a=i[3],o=i[6],s=i[1],l=i[4],c=i[7];return i[0]=t*r+n*s,i[3]=t*a+n*l,i[6]=t*o+n*c,i[1]=-n*r+t*s,i[4]=-n*a+t*l,i[7]=-n*o+t*c,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}});var T={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===w&&(w=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),w.width=e.width,w.height=e.height;var n=w.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=w}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},E=0;function A(e,t,n,i,r,a,o,s,l,c){Object.defineProperty(this,"id",{value:E++}),this.uuid=_.generateUUID(),this.name="",this.image=void 0!==e?e:A.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:A.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:1001,this.wrapT=void 0!==i?i:1001,this.magFilter=void 0!==r?r:1006,this.minFilter=void 0!==a?a:1008,this.anisotropy=void 0!==l?l:1,this.format=void 0!==o?o:1023,this.internalFormat=null,this.type=void 0!==s?s:1009,this.offset=new M(0,0),this.repeat=new M(1,1),this.center=new M(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new S,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==c?c:3e3,this.version=0,this.onUpdate=null}function L(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function R(e,t,n){this.width=e,this.height=t,this.scissor=new L(0,0,e,t),this.scissorTest=!1,this.viewport=new L(0,0,e,t),n=n||{},this.texture=new A(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:1006,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function P(e,t,n){R.call(this,e,t,n),this.samples=4}function C(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}A.DEFAULT_IMAGE=void 0,A.DEFAULT_MAPPING=300,A.prototype=Object.assign(Object.create(y.prototype),{constructor:A,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var i=this.image;if(void 0===i.uuid&&(i.uuid=_.generateUUID()),!t&&void 0===e.images[i.uuid]){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a<o;a++)r.push(T.getDataURL(i[a]))}else r=T.getDataURL(i);e.images[i.uuid]={uuid:i.uuid,url:r}}n.image=i.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(A.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(L.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(L.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,a=e.elements,o=a[0],s=a[4],l=a[8],c=a[1],h=a[5],u=a[9],p=a[2],d=a[6],f=a[10];if(Math.abs(s-c)<.01&&Math.abs(l-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(s+c)<.1&&Math.abs(l+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+h+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,g=(h+1)/2,v=(f+1)/2,y=(s+c)/4,x=(l+p)/4,b=(u+d)/4;return m>g&&m>v?m<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(m)),r=x/n):g>v?g<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(g)),r=b/i):v<.01?(n=.707106781,i=.707106781,r=0):(n=x/(r=Math.sqrt(v)),i=b/r),this.set(n,i,r,t),this}var w=Math.sqrt((d-u)*(d-u)+(l-p)*(l-p)+(c-s)*(c-s));return Math.abs(w)<.001&&(w=1),this.x=(d-u)/w,this.y=(l-p)/w,this.z=(c-s)/w,this.w=Math.acos((o+h+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}),R.prototype=Object.assign(Object.create(y.prototype),{constructor:R,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),P.prototype=Object.assign(Object.create(R.prototype),{constructor:P,isWebGLMultisampleRenderTarget:!0,copy:function(e){return R.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(C,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,a,o){var s=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3],u=r[a+0],p=r[a+1],d=r[a+2],f=r[a+3];if(h!==f||s!==u||l!==p||c!==d){var m=1-o,g=s*u+l*p+c*d+h*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var w=o*v;if(s=s*m+u*w,l=l*m+p*w,c=c*m+d*w,h=h*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+l*l+c*c+h*h);s*=_,l*=_,c*=_,h*=_}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=h},multiplyQuaternionsFlat:function(e,t,n,i,r,a){var o=n[i],s=n[i+1],l=n[i+2],c=n[i+3],h=r[a],u=r[a+1],p=r[a+2],d=r[a+3];return e[t]=o*d+c*h+s*p-l*u,e[t+1]=s*d+c*u+l*h-o*p,e[t+2]=l*d+c*p+o*u-s*h,e[t+3]=c*d-o*h-s*u-l*p,e}}),Object.defineProperties(C.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(C.prototype,{isQuaternion:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,i=e._y,r=e._z,a=e.order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),u=s(n/2),p=s(i/2),d=s(r/2);switch(a){case"XYZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"YXZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"ZXY":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"ZYX":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"YZX":this._x=u*c*h+l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h-u*p*d;break;case"XZY":this._x=u*c*h-l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],a=n[8],o=n[1],s=n[5],l=n[9],c=n[2],h=n[6],u=n[10],p=i+s+u;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(h-l)*t,this._y=(a-c)*t,this._z=(o-r)*t):i>s&&i>u?(t=2*Math.sqrt(1+i-s-u),this._w=(h-l)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(a+c)/t):s>u?(t=2*Math.sqrt(1+s-i-u),this._w=(a-c)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(l+h)/t):(t=2*Math.sqrt(1+u-i-s),this._w=(o-r)/t,this._x=(a+c)/t,this._y=(l+h)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(_.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+i*l-r*s,this._y=i*c+a*s+r*o-n*l,this._z=r*c+a*l+n*s-i*o,this._w=a*c-n*o-i*s-r*l,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*i+t*this._y,this._z=l*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var c=Math.sqrt(s),h=Math.atan2(c,o),u=Math.sin((1-t)*h)/c,p=Math.sin(t*h)/c;return this._w=a*u+this._w*p,this._x=n*u+this._x*p,this._y=i*u+this._y*p,this._z=r*u+this._z*p,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var O=new D,I=new C;function D(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}Object.assign(D.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(I.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(I.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*i-o*n,c=s*n+o*t-r*i,h=s*i+r*n-a*t,u=-r*t-a*n-o*i;return this.x=l*s+u*-r+c*-o-h*-a,this.y=c*s+u*-a+h*-r-l*-o,this.z=h*s+u*-o+l*-a-c*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},projectOnVector:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return O.copy(this).projectOnVector(e),this.sub(O)},reflect:function(e){return this.sub(O.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(_.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}});var N=new D,z=new k,U=new D(0,0,0),F=new D(1,1,1),B=new D,H=new D,G=new D;function k(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.assign(k.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,a,o,s,l,c,h,u,p,d,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new k).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,i=1/N.setFromMatrixColumn(e,0).length(),r=1/N.setFromMatrixColumn(e,1).length(),a=1/N.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){var u=a*c,p=a*h,d=o*c,f=o*h;t[0]=s*c,t[4]=-s*h,t[8]=l,t[1]=p+d*l,t[5]=u-f*l,t[9]=-o*s,t[2]=f-u*l,t[6]=d+p*l,t[10]=a*s}else if("YXZ"===e.order){var m=s*c,g=s*h,v=l*c,y=l*h;t[0]=m+y*o,t[4]=v*o-g,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-o,t[2]=g*o-v,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*c,g=s*h,v=l*c,y=l*h;t[0]=m-y*o,t[4]=-a*h,t[8]=v+g*o,t[1]=g+v*o,t[5]=a*c,t[9]=y-m*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){u=a*c,p=a*h,d=o*c,f=o*h;t[0]=s*c,t[4]=d*l-p,t[8]=u*l+f,t[1]=s*h,t[5]=f*l+u,t[9]=p*l-d,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,b=a*l,w=o*s,_=o*l;t[0]=s*c,t[4]=_-x*h,t[8]=w*h+b,t[1]=h,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=b*h+w,t[10]=x-_*h}else if("XZY"===e.order){x=a*s,b=a*l,w=o*s,_=o*l;t[0]=s*c,t[4]=-h,t[8]=l*c,t[1]=x*h+_,t[5]=a*c,t[9]=b*h-w,t[2]=w*h-b,t[6]=o*c,t[10]=_*h+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(U,e,F)},lookAt:function(e,t,n){var i=this.elements;return G.subVectors(e,t),0===G.lengthSq()&&(G.z=1),G.normalize(),B.crossVectors(n,G),0===B.lengthSq()&&(1===Math.abs(n.z)?G.x+=1e-4:G.z+=1e-4,G.normalize(),B.crossVectors(n,G)),B.normalize(),H.crossVectors(G,B),i[0]=B.x,i[4]=H.x,i[8]=G.x,i[1]=B.y,i[5]=H.y,i[9]=G.y,i[2]=B.z,i[6]=H.z,i[10]=G.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],h=n[5],u=n[9],p=n[13],d=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],w=i[0],_=i[4],M=i[8],S=i[12],T=i[1],E=i[5],A=i[9],L=i[13],R=i[2],P=i[6],C=i[10],O=i[14],I=i[3],D=i[7],N=i[11],z=i[15];return r[0]=a*w+o*T+s*R+l*I,r[4]=a*_+o*E+s*P+l*D,r[8]=a*M+o*A+s*C+l*N,r[12]=a*S+o*L+s*O+l*z,r[1]=c*w+h*T+u*R+p*I,r[5]=c*_+h*E+u*P+p*D,r[9]=c*M+h*A+u*C+p*N,r[13]=c*S+h*L+u*O+p*z,r[2]=d*w+f*T+m*R+g*I,r[6]=d*_+f*E+m*P+g*D,r[10]=d*M+f*A+m*C+g*N,r[14]=d*S+f*L+m*O+g*z,r[3]=v*w+y*T+x*R+b*I,r[7]=v*_+y*E+x*P+b*D,r[11]=v*M+y*A+x*C+b*N,r[15]=v*S+y*L+x*O+b*z,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],l=e[13],c=e[2],h=e[6],u=e[10],p=e[14];return e[3]*(+r*s*h-i*l*h-r*o*u+n*l*u+i*o*p-n*s*p)+e[7]*(+t*s*p-t*l*u+r*a*u-i*a*p+i*l*c-r*s*c)+e[11]*(+t*l*h-t*o*p-r*a*h+n*a*p+r*o*c-n*l*c)+e[15]*(-i*o*c-t*s*h+t*o*u+i*a*h-n*a*u+n*s*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e,t,n){var i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var n=this.elements,i=e.elements,r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],c=i[5],h=i[6],u=i[7],p=i[8],d=i[9],f=i[10],m=i[11],g=i[12],v=i[13],y=i[14],x=i[15],b=d*y*u-v*f*u+v*h*m-c*y*m-d*h*x+c*f*x,w=g*f*u-p*y*u-g*h*m+l*y*m+p*h*x-l*f*x,_=p*v*u-g*d*u+g*c*m-l*v*m-p*c*x+l*d*x,M=g*d*h-p*v*h-g*c*f+l*v*f+p*c*y-l*d*y,S=r*b+a*w+o*_+s*M;if(0===S)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var T=1/S;return n[0]=b*T,n[1]=(v*f*s-d*y*s-v*o*m+a*y*m+d*o*x-a*f*x)*T,n[2]=(c*y*s-v*h*s+v*o*u-a*y*u-c*o*x+a*h*x)*T,n[3]=(d*h*s-c*f*s-d*o*u+a*f*u+c*o*m-a*h*m)*T,n[4]=w*T,n[5]=(p*y*s-g*f*s+g*o*m-r*y*m-p*o*x+r*f*x)*T,n[6]=(g*h*s-l*y*s-g*o*u+r*y*u+l*o*x-r*h*x)*T,n[7]=(l*f*s-p*h*s+p*o*u-r*f*u-l*o*m+r*h*m)*T,n[8]=_*T,n[9]=(g*d*s-p*v*s-g*a*m+r*v*m+p*a*x-r*d*x)*T,n[10]=(l*v*s-g*c*s+g*a*u-r*v*u-l*a*x+r*c*x)*T,n[11]=(p*c*s-l*d*s-p*a*u+r*d*u+l*a*m-r*c*m)*T,n[12]=M*T,n[13]=(p*v*o-g*d*o+g*a*f-r*v*f-p*a*y+r*d*y)*T,n[14]=(g*c*o-l*v*o-g*a*h+r*v*h+l*a*y-r*c*y)*T,n[15]=(l*d*o-p*c*o+p*a*h-r*d*h-l*a*f+r*c*f)*T,this},scale:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,l=r*a,c=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,c*o+n,c*s-i*a,0,l*s-i*o,c*s+i*a,r*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,l=r+r,c=a+a,h=o+o,u=r*l,p=r*c,d=r*h,f=a*c,m=a*h,g=o*h,v=s*l,y=s*c,x=s*h,b=n.x,w=n.y,_=n.z;return i[0]=(1-(f+g))*b,i[1]=(p+x)*b,i[2]=(d-y)*b,i[3]=0,i[4]=(p-x)*w,i[5]=(1-(u+g))*w,i[6]=(m+v)*w,i[7]=0,i[8]=(d+y)*_,i[9]=(m-v)*_,i[10]=(1-(u+f))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},decompose:function(e,t,n){var i=this.elements,r=N.set(i[0],i[1],i[2]).length(),a=N.set(i[4],i[5],i[6]).length(),o=N.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],z.copy(this);var s=1/r,l=1/a,c=1/o;return z.elements[0]*=s,z.elements[1]*=s,z.elements[2]*=s,z.elements[4]*=l,z.elements[5]*=l,z.elements[6]*=l,z.elements[8]*=c,z.elements[9]*=c,z.elements[10]*=c,t.setFromRotationMatrix(z),n.x=r,n.y=a,n.z=o,this},makePerspective:function(e,t,n,i,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(t-e),l=2*r/(n-i),c=(t+e)/(t-e),h=(n+i)/(n-i),u=-(a+r)/(a-r),p=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,i,r,a){var o=this.elements,s=1/(t-e),l=1/(n-i),c=1/(a-r),h=(t+e)*s,u=(n+i)*l,p=(a+r)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}});var V=new k,j=new C;function W(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._order=i||W.DefaultOrder}function q(){this.mask=1}W.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],W.DefaultOrder="XYZ",Object.defineProperties(W.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(W.prototype,{isEuler:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var i=_.clamp,r=e.elements,a=r[0],o=r[4],s=r[8],l=r[1],c=r[5],h=r[9],u=r[2],p=r[6],d=r[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,a),this._z=0);break;case"ZXY":this._x=Math.asin(i(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!1!==n&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return V.makeRotationFromQuaternion(e),this.setFromRotationMatrix(V,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return j.setFromEuler(this),this.setFromQuaternion(j,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new D(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(q.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return 0!=(this.mask&e.mask)}});let X=0;const Y=new D,J=new C,Z=new k,K=new D,Q=new D,$=new D,ee=new C,te=new D(1,0,0),ne=new D(0,1,0),ie=new D(0,0,1),re={type:"added"},ae={type:"removed"};function oe(){Object.defineProperty(this,"id",{value:X++}),this.uuid=_.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=oe.DefaultUp.clone();var e=new D,t=new W,n=new C,i=new D(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new k},normalMatrix:{value:new S}}),this.matrix=new k,this.matrixWorld=new k,this.matrixAutoUpdate=oe.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new q,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function se(){oe.call(this),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}oe.DefaultUp=new D(0,1,0),oe.DefaultMatrixAutoUpdate=!0,oe.prototype=Object.assign(Object.create(y.prototype),{constructor:oe,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return J.setFromAxisAngle(e,t),this.quaternion.multiply(J),this},rotateOnWorldAxis:function(e,t){return J.setFromAxisAngle(e,t),this.quaternion.premultiply(J),this},rotateX:function(e){return this.rotateOnAxis(te,e)},rotateY:function(e){return this.rotateOnAxis(ne,e)},rotateZ:function(e){return this.rotateOnAxis(ie,e)},translateOnAxis:function(e,t){return Y.copy(e).applyQuaternion(this.quaternion),this.position.add(Y.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(te,e)},translateY:function(e){return this.translateOnAxis(ne,e)},translateZ:function(e){return this.translateOnAxis(ie,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(Z.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?K.copy(e):K.set(e,t,n);var i=this.parent;this.updateWorldMatrix(!0,!1),Q.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Z.lookAt(Q,K,this.up):Z.lookAt(K,Q,this.up),this.quaternion.setFromRotationMatrix(Z),i&&(Z.extractRotation(i.matrixWorld),J.setFromRotationMatrix(Z),this.quaternion.premultiply(J.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(re)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(ae)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),Z.getInverse(this.matrixWorld),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Z.multiply(e.parent.matrixWorld)),e.applyMatrix4(Z),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new D),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new C),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Q,e,$),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new D),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Q,ee,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new D),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var i=this.children,r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var c=o[s];r(e.shapes,c)}else r(e.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var h=[];for(s=0,l=this.material.length;s<l;s++)h.push(r(e.materials,this.material[s]));i.material=h}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(s=0;s<this.children.length;s++)i.children.push(this.children[s].toJSON(e).object)}if(t){var u=m(e.geometries),p=m(e.materials),d=m(e.textures),f=m(e.images);o=m(e.shapes);u.length>0&&(n.geometries=u),p.length>0&&(n.materials=p),d.length>0&&(n.textures=d),f.length>0&&(n.images=f),o.length>0&&(n.shapes=o)}return n.object=i,n;function m(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var i=e.children[n];this.add(i.clone())}return this}}),se.prototype=Object.assign(Object.create(oe.prototype),{constructor:se,isScene:!0,copy:function(e,t){return oe.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=oe.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}});var le=[new D,new D,new D,new D,new D,new D,new D,new D],ce=new D,he=new we,ue=new D,pe=new D,de=new D,fe=new D,me=new D,ge=new D,ve=new D,ye=new D,xe=new D,be=new D;function we(e,t){this.min=void 0!==e?e:new D(1/0,1/0,1/0),this.max=void 0!==t?t:new D(-1/0,-1/0,-1/0)}function _e(e,t,n,i,r){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){be.fromArray(e,a);var s=r.x*Math.abs(be.x)+r.y*Math.abs(be.y)+r.z*Math.abs(be.z),l=t.dot(be),c=n.dot(be),h=i.dot(be);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>s)return!1}return!0}Object.assign(we.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;s<l;s+=3){var c=e[s],h=e[s+1],u=e[s+2];c<t&&(t=c),h<n&&(n=h),u<i&&(i=u),c>r&&(r=c),h>a&&(a=h),u>o&&(o=u)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;s<l;s++){var c=e.getX(s),h=e.getY(s),u=e.getZ(s);c<t&&(t=c),h<n&&(n=h),u<i&&(i=u),c>r&&(r=c),h>a&&(a=h),u>o&&(o=u)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=ce.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new D),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new D),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),he.copy(t.boundingBox),he.applyMatrix4(e.matrixWorld),this.union(he));for(var n=e.children,i=0,r=n.length;i<r;i++)this.expandByObject(n[i]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new D),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,ce),ce.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(ve),ye.subVectors(this.max,ve),ue.subVectors(e.a,ve),pe.subVectors(e.b,ve),de.subVectors(e.c,ve),fe.subVectors(pe,ue),me.subVectors(de,pe),ge.subVectors(ue,de);var t=[0,-fe.z,fe.y,0,-me.z,me.y,0,-ge.z,ge.y,fe.z,0,-fe.x,me.z,0,-me.x,ge.z,0,-ge.x,-fe.y,fe.x,0,-me.y,me.x,0,-ge.y,ge.x,0];return!!_e(t,ue,pe,de,ye)&&(!!_e(t=[1,0,0,0,1,0,0,0,1],ue,pe,de,ye)&&(xe.crossVectors(fe,me),_e(t=[xe.x,xe.y,xe.z],ue,pe,de,ye)))},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new D),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return ce.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(ce).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()||(le[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),le[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),le[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),le[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),le[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),le[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),le[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),le[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(le)),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Me=new we;function Se(e,t){this.center=void 0!==e?e:new D,this.radius=void 0!==t?t:-1}Object.assign(Se.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;void 0!==t?n.copy(t):Me.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new D),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new we),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var Te=new D,Ee=new D,Ae=new D,Le=new D,Re=new D,Pe=new D,Ce=new D;function Oe(e,t){this.origin=void 0!==e?e:new D,this.direction=void 0!==t?t:new D(0,0,-1)}Object.assign(Oe.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new D),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,Te)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new D),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=Te.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Te.copy(this.direction).multiplyScalar(t).add(this.origin),Te.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,i){Ee.copy(e).add(t).multiplyScalar(.5),Ae.copy(t).sub(e).normalize(),Le.copy(this.origin).sub(Ee);var r,a,o,s,l=.5*e.distanceTo(t),c=-this.direction.dot(Ae),h=Le.dot(this.direction),u=-Le.dot(Ae),p=Le.lengthSq(),d=Math.abs(1-c*c);if(d>0)if(a=c*h-u,s=l*d,(r=c*u-h)>=0)if(a>=-s)if(a<=s){var f=1/d;o=(r*=f)*(r+c*(a*=f)+2*h)+a*(c*r+a+2*u)+p}else a=l,o=-(r=Math.max(0,-(c*a+h)))*r+a*(a+2*u)+p;else a=-l,o=-(r=Math.max(0,-(c*a+h)))*r+a*(a+2*u)+p;else a<=-s?o=-(r=Math.max(0,-(-c*l+h)))*r+(a=r>0?-l:Math.min(Math.max(-l,-u),l))*(a+2*u)+p:a<=s?(r=0,o=(a=Math.min(Math.max(-l,-u),l))*(a+2*u)+p):o=-(r=Math.max(0,-(c*l+h)))*r+(a=r>0?l:Math.min(Math.max(-l,-u),l))*(a+2*u)+p;else a=c>0?-l:l,o=-(r=Math.max(0,-(c*a+h)))*r+a*(a+2*u)+p;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(Ae).multiplyScalar(a).add(Ee),o},intersectSphere:function(e,t){Te.subVectors(e.center,this.origin);var n=Te.dot(this.direction),i=Te.dot(Te)-n*n,r=e.radius*e.radius;if(i>r)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,a,o,s,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),c>=0?(r=(e.min.y-u.y)*c,a=(e.max.y-u.y)*c):(r=(e.max.y-u.y)*c,a=(e.min.y-u.y)*c),n>a||r>i?null:((r>n||n!=n)&&(n=r),(a<i||i!=i)&&(i=a),h>=0?(o=(e.min.z-u.z)*h,s=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,s=(e.min.z-u.z)*h),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,Te)},intersectTriangle:function(e,t,n,i,r){Re.subVectors(t,e),Pe.subVectors(n,e),Ce.crossVectors(Re,Pe);var a,o=this.direction.dot(Ce);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Le.subVectors(this.origin,e);var s=a*this.direction.dot(Pe.crossVectors(Le,Pe));if(s<0)return null;var l=a*this.direction.dot(Re.cross(Le));if(l<0)return null;if(s+l>o)return null;var c=-a*Le.dot(Ce);return c<0?null:this.at(c/o,r)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var Ie=new D,De=new D,Ne=new S;function ze(e,t){this.normal=void 0!==e?e:new D(1,0,0),this.constant=void 0!==t?t:0}Object.assign(ze.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var i=Ie.subVectors(n,t).cross(De.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new D),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new D);var n=e.delta(Ie),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?void 0:t.copy(n).multiplyScalar(r).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new D),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||Ne.getNormalMatrix(e),i=this.coplanarPoint(Ie).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var Ue=new D,Fe=new D,Be=new D,He=new D,Ge=new D,ke=new D,Ve=new D,je=new D,We=new D,qe=new D;function Xe(e,t,n){this.a=void 0!==e?e:new D,this.b=void 0!==t?t:new D,this.c=void 0!==n?n:new D}Object.assign(Xe,{getNormal:function(e,t,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new D),i.subVectors(n,t),Ue.subVectors(e,t),i.cross(Ue);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)},getBarycoord:function(e,t,n,i,r){Ue.subVectors(i,t),Fe.subVectors(n,t),Be.subVectors(e,t);var a=Ue.dot(Ue),o=Ue.dot(Fe),s=Ue.dot(Be),l=Fe.dot(Fe),c=Fe.dot(Be),h=a*l-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new D),0===h)return r.set(-2,-1,-1);var u=1/h,p=(l*s-o*c)*u,d=(a*c-o*s)*u;return r.set(1-p-d,d,p)},containsPoint:function(e,t,n,i){return Xe.getBarycoord(e,t,n,i,He),He.x>=0&&He.y>=0&&He.x+He.y<=1},getUV:function(e,t,n,i,r,a,o,s){return this.getBarycoord(e,t,n,i,He),s.set(0,0),s.addScaledVector(r,He.x),s.addScaledVector(a,He.y),s.addScaledVector(o,He.z),s},isFrontFacing:function(e,t,n,i){return Ue.subVectors(n,t),Fe.subVectors(e,t),Ue.cross(Fe).dot(i)<0}}),Object.assign(Xe.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return Ue.subVectors(this.c,this.b),Fe.subVectors(this.a,this.b),.5*Ue.cross(Fe).length()},getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new D),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return Xe.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new ze),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return Xe.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,i,r){return Xe.getUV(e,this.a,this.b,this.c,t,n,i,r)},containsPoint:function(e){return Xe.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return Xe.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new D);var n,i,r=this.a,a=this.b,o=this.c;Ge.subVectors(a,r),ke.subVectors(o,r),je.subVectors(e,r);var s=Ge.dot(je),l=ke.dot(je);if(s<=0&&l<=0)return t.copy(r);We.subVectors(e,a);var c=Ge.dot(We),h=ke.dot(We);if(c>=0&&h<=c)return t.copy(a);var u=s*h-c*l;if(u<=0&&s>=0&&c<=0)return n=s/(s-c),t.copy(r).addScaledVector(Ge,n);qe.subVectors(e,o);var p=Ge.dot(qe),d=ke.dot(qe);if(d>=0&&p<=d)return t.copy(o);var f=p*l-s*d;if(f<=0&&l>=0&&d<=0)return i=l/(l-d),t.copy(r).addScaledVector(ke,i);var m=c*d-p*h;if(m<=0&&h-c>=0&&p-d>=0)return Ve.subVectors(o,a),i=(h-c)/(h-c+(p-d)),t.copy(a).addScaledVector(Ve,i);var g=1/(m+f+u);return n=f*g,i=u*g,t.copy(r).addScaledVector(Ge,n).addScaledVector(ke,i)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var Ye={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Je={h:0,s:0,l:0},Ze={h:0,s:0,l:0};function Ke(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function Qe(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function $e(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function et(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function tt(e,t,n,i,r,a){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new D,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new Ke,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}Object.assign(Ke.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=_.euclideanModulo(e,1),t=_.clamp(t,0,1),n=_.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Qe(r,i,e+1/3),this.g=Qe(r,i,e),this.b=Qe(r,i,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],a=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(o,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var c=n[1],h=c.length;if(3===h)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=Ye[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=$e(e.r),this.g=$e(e.g),this.b=$e(e.b),this},copyLinearToSRGB:function(e){return this.r=et(e.r),this.g=et(e.g),this.b=et(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,i=this.r,r=this.g,a=this.b,o=Math.max(i,r,a),s=Math.min(i,r,a),l=(s+o)/2;if(s===o)t=0,n=0;else{var c=o-s;switch(n=l<=.5?c/(o+s):c/(2-o-s),o){case i:t=(r-a)/c+(r<a?6:0);break;case r:t=(a-i)/c+2;break;case a:t=(i-r)/c+4}t/=6}return e.h=t,e.s=n,e.l=l,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,n){return this.getHSL(Je),Je.h+=e,Je.s+=t,Je.l+=n,this.setHSL(Je.h,Je.s,Je.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL(Je),e.getHSL(Ze);var n=_.lerp(Je.h,Ze.h,t),i=_.lerp(Je.s,Ze.s,t),r=_.lerp(Je.l,Ze.l,t);return this.setHSL(n,i,r),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),Ke.NAMES=Ye,Object.assign(tt.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var nt=0;function it(){Object.defineProperty(this,"id",{value:nt++}),this.uuid=_.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function rt(e){it.call(this),this.type="MeshBasicMaterial",this.color=new Ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(e)}it.prototype=Object.assign(Object.create(y.prototype),{constructor:it,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(it.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),rt.prototype=Object.create(it.prototype),rt.prototype.constructor=rt,rt.prototype.isMeshBasicMaterial=!0,rt.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var at=new D;function ot(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function st(e,t,n){ot.call(this,new Int8Array(e),t,n)}function lt(e,t,n){ot.call(this,new Uint8Array(e),t,n)}function ct(e,t,n){ot.call(this,new Uint8ClampedArray(e),t,n)}function ht(e,t,n){ot.call(this,new Int16Array(e),t,n)}function ut(e,t,n){ot.call(this,new Uint16Array(e),t,n)}function pt(e,t,n){ot.call(this,new Int32Array(e),t,n)}function dt(e,t,n){ot.call(this,new Uint32Array(e),t,n)}function ft(e,t,n){ot.call(this,new Float32Array(e),t,n)}function mt(e,t,n){ot.call(this,new Float64Array(e),t,n)}function gt(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function vt(e){if(0===e.length)return-1/0;let t=e[0];for(let n=1,i=e.length;n<i;++n)e[n]>t&&(t=e[n]);return t}Object.defineProperty(ot.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(ot.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new Ke),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new M),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new D),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new L),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)at.x=this.getX(t),at.y=this.getY(t),at.z=this.getZ(t),at.applyMatrix3(e),this.setXYZ(t,at.x,at.y,at.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)at.x=this.getX(t),at.y=this.getY(t),at.z=this.getZ(t),at.applyMatrix4(e),this.setXYZ(t,at.x,at.y,at.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)at.x=this.getX(t),at.y=this.getY(t),at.z=this.getZ(t),at.applyNormalMatrix(e),this.setXYZ(t,at.x,at.y,at.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)at.x=this.getX(t),at.y=this.getY(t),at.z=this.getZ(t),at.transformDirection(e),this.setXYZ(t,at.x,at.y,at.z);return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),st.prototype=Object.create(ot.prototype),st.prototype.constructor=st,lt.prototype=Object.create(ot.prototype),lt.prototype.constructor=lt,ct.prototype=Object.create(ot.prototype),ct.prototype.constructor=ct,ht.prototype=Object.create(ot.prototype),ht.prototype.constructor=ht,ut.prototype=Object.create(ot.prototype),ut.prototype.constructor=ut,pt.prototype=Object.create(ot.prototype),pt.prototype.constructor=pt,dt.prototype=Object.create(ot.prototype),dt.prototype.constructor=dt,ft.prototype=Object.create(ot.prototype),ft.prototype.constructor=ft,mt.prototype=Object.create(ot.prototype),mt.prototype.constructor=mt,Object.assign(gt.prototype,{computeGroups:function(e){for(var t,n=[],i=void 0,r=e.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==i&&(i=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,n.push(t)),t={start:3*a,materialIndex:i})}void 0!==t&&(t.count=3*a-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,i=e.vertices,r=e.faceVertexUvs,a=r[0]&&r[0].length>0,o=r[1]&&r[1].length>0,s=e.morphTargets,l=s.length;if(l>0){t=[];for(var c=0;c<l;c++)t[c]={name:s[c].name,data:[]};this.morphTargets.position=t}var h,u=e.morphNormals,p=u.length;if(p>0){h=[];for(c=0;c<p;c++)h[c]={name:u[c].name,data:[]};this.morphTargets.normal=h}var d=e.skinIndices,f=e.skinWeights,m=d.length===i.length,g=f.length===i.length;i.length>0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(c=0;c<n.length;c++){var v=n[c];this.vertices.push(i[v.a],i[v.b],i[v.c]);var y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=v.normal;this.normals.push(x,x,x)}var b,w=v.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var _=v.color;this.colors.push(_,_,_)}if(!0===a)void 0!==(b=r[0][c])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",c),this.uvs.push(new M,new M,new M));if(!0===o)void 0!==(b=r[1][c])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",c),this.uvs2.push(new M,new M,new M));for(var S=0;S<l;S++){var T=s[S].vertices;t[S].data.push(T[v.a],T[v.b],T[v.c])}for(S=0;S<p;S++){var E=u[S].vertexNormals[c];h[S].data.push(E.a,E.b,E.c)}m&&this.skinIndices.push(d[v.a],d[v.b],d[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}});var yt=1,xt=new k,bt=new oe,wt=new D,_t=new we,Mt=new we,St=new D;function Tt(){Object.defineProperty(this,"id",{value:yt+=2}),this.uuid=_.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}Tt.prototype=Object.assign(Object.create(y.prototype),{constructor:Tt,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(vt(e)>65535?dt:ut)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new S).getNormalMatrix(e);n.applyNormalMatrix(i),n.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return xt.makeRotationX(e),this.applyMatrix4(xt),this},rotateY:function(e){return xt.makeRotationY(e),this.applyMatrix4(xt),this},rotateZ:function(e){return xt.makeRotationZ(e),this.applyMatrix4(xt),this},translate:function(e,t,n){return xt.makeTranslation(e,t,n),this.applyMatrix4(xt),this},scale:function(e,t,n){return xt.makeScale(e,t,n),this.applyMatrix4(xt),this},lookAt:function(e){return bt.lookAt(e),bt.updateMatrix(),this.applyMatrix4(bt.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(wt).negate(),this.translate(wt.x,wt.y,wt.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new ft(3*t.vertices.length,3),i=new ft(3*t.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new ft(t.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new ft(t,3)),this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var i=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(i=void 0,n.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(n);i.verticesNeedUpdate=n.verticesNeedUpdate,i.normalsNeedUpdate=n.normalsNeedUpdate,i.colorsNeedUpdate=n.colorsNeedUpdate,i.uvsNeedUpdate=n.uvsNeedUpdate,i.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=i}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new gt).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.setAttribute("position",new ot(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.setAttribute("normal",new ot(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.setAttribute("color",new ot(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new ot(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new ot(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],l=e.morphTargets[o],c=0,h=l.length;c<h;c++){var u=l[c],p=new ft(3*u.data.length,3);p.name=u.name,s.push(p.copyVector3sArray(u.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var d=new ft(4*e.skinIndices.length,4);this.setAttribute("skinIndex",d.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new ft(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new we);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n<i;n++){var r=t[n];_t.setFromBufferAttribute(r),this.morphTargetsRelative?(St.addVectors(this.boundingBox.min,_t.min),this.boundingBox.expandByPoint(St),St.addVectors(this.boundingBox.max,_t.max),this.boundingBox.expandByPoint(St)):(this.boundingBox.expandByPoint(_t.min),this.boundingBox.expandByPoint(_t.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Se);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(_t.setFromBufferAttribute(e),t)for(var i=0,r=t.length;i<r;i++){var a=t[i];Mt.setFromBufferAttribute(a),this.morphTargetsRelative?(St.addVectors(_t.min,Mt.min),_t.expandByPoint(St),St.addVectors(_t.max,Mt.max),_t.expandByPoint(St)):(_t.expandByPoint(Mt.min),_t.expandByPoint(Mt.max))}_t.getCenter(n);var o=0;for(i=0,r=e.count;i<r;i++)St.fromBufferAttribute(e,i),o=Math.max(o,n.distanceToSquared(St));if(t)for(i=0,r=t.length;i<r;i++){a=t[i];for(var s=this.morphTargetsRelative,l=0,c=a.count;l<c;l++)St.fromBufferAttribute(a,l),s&&(wt.fromBufferAttribute(e,l),St.add(wt)),o=Math.max(o,n.distanceToSquared(St))}this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(void 0===t.normal)this.setAttribute("normal",new ot(new Float32Array(n.length),3));else for(var i=t.normal.array,r=0,a=i.length;r<a;r++)i[r]=0;var o,s,l,c=t.normal.array,h=new D,u=new D,p=new D,d=new D,f=new D;if(e){var m=e.array;for(r=0,a=e.count;r<a;r+=3)o=3*m[r+0],s=3*m[r+1],l=3*m[r+2],h.fromArray(n,o),u.fromArray(n,s),p.fromArray(n,l),d.subVectors(p,u),f.subVectors(h,u),d.cross(f),c[o]+=d.x,c[o+1]+=d.y,c[o+2]+=d.z,c[s]+=d.x,c[s+1]+=d.y,c[s+2]+=d.z,c[l]+=d.x,c[l+1]+=d.y,c[l+2]+=d.z}else for(r=0,a=n.length;r<a;r+=9)h.fromArray(n,r),u.fromArray(n,r+3),p.fromArray(n,r+6),d.subVectors(p,u),f.subVectors(h,u),d.cross(f),c[r]=d.x,c[r+1]=d.y,c[r+2]=d.z,c[r+3]=d.x,c[r+4]=d.y,c[r+5]=d.z,c[r+6]=d.x,c[r+7]=d.y,c[r+8]=d.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var i in n)if(void 0!==e.attributes[i])for(var r=n[i].array,a=e.attributes[i],o=a.array,s=a.itemSize*t,l=Math.min(o.length,r.length-s),c=0,h=s;c<l;c++,h++)r[h]=o[c];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)St.x=e.getX(t),St.y=e.getY(t),St.z=e.getZ(t),St.normalize(),e.setXYZ(t,St.x,St.y,St.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i),o=0,s=0,l=0,c=t.length;l<c;l++){o=t[l]*i;for(var h=0;h<i;h++)a[s++]=n[o++]}return new ot(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Tt,n=this.index.array,i=this.attributes;for(var r in i){var a=e(i[r],n);t.setAttribute(r,a)}var o=this.morphAttributes;for(r in o){for(var s=[],l=o[r],c=0,h=l.length;c<h;c++){a=e(l[c],n);s.push(a)}t.morphAttributes[r]=s}t.morphTargetsRelative=this.morphTargetsRelative;for(var u=this.groups,p=(c=0,u.length);c<p;c++){var d=u[c];t.addGroup(d.start,d.count,d.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var n in r){var a=(p=r[n]).toJSON();""!==p.name&&(a.name=p.name),e.data.attributes[n]=a}var o={},s=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],c=[],h=0,u=l.length;h<u;h++){var p;a=(p=l[h]).toJSON();""!==p.name&&(a.name=p.name),c.push(a)}c.length>0&&(o[n]=c,s=!0)}s&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);var d=this.groups;d.length>0&&(e.data.groups=JSON.parse(JSON.stringify(d)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new Tt).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var l=[],c=s[t];for(n=0,i=c.length;n<i;n++)l.push(c[n].clone());this.morphAttributes[t]=l}this.morphTargetsRelative=e.morphTargetsRelative;var h=e.groups;for(n=0,i=h.length;n<i;n++){var u=h[n];this.addGroup(u.start,u.count,u.materialIndex)}var p=e.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=e.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Et=new k,At=new Oe,Lt=new Se,Rt=new D,Pt=new D,Ct=new D,Ot=new D,It=new D,Dt=new D,Nt=new D,zt=new D,Ut=new D,Ft=new M,Bt=new M,Ht=new M,Gt=new D,kt=new D;function Vt(e,t){oe.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Tt,this.material=void 0!==t?t:new rt,this.updateMorphTargets()}function jt(e,t,n,i,r,a,o,s){if(null===(1===t.side?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,2!==t.side,s)))return null;kt.copy(s),kt.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(kt);return l<n.near||l>n.far?null:{distance:l,point:kt.clone(),object:e}}function Wt(e,t,n,i,r,a,o,s,l,c,h,u){Rt.fromBufferAttribute(r,c),Pt.fromBufferAttribute(r,h),Ct.fromBufferAttribute(r,u);var p=e.morphTargetInfluences;if(t.morphTargets&&a&&p){Nt.set(0,0,0),zt.set(0,0,0),Ut.set(0,0,0);for(var d=0,f=a.length;d<f;d++){var m=p[d],g=a[d];0!==m&&(Ot.fromBufferAttribute(g,c),It.fromBufferAttribute(g,h),Dt.fromBufferAttribute(g,u),o?(Nt.addScaledVector(Ot,m),zt.addScaledVector(It,m),Ut.addScaledVector(Dt,m)):(Nt.addScaledVector(Ot.sub(Rt),m),zt.addScaledVector(It.sub(Pt),m),Ut.addScaledVector(Dt.sub(Ct),m)))}Rt.add(Nt),Pt.add(zt),Ct.add(Ut)}e.isSkinnedMesh&&(e.boneTransform(c,Rt),e.boneTransform(h,Pt),e.boneTransform(u,Ct));var v=jt(e,t,n,i,Rt,Pt,Ct,Gt);if(v){s&&(Ft.fromBufferAttribute(s,c),Bt.fromBufferAttribute(s,h),Ht.fromBufferAttribute(s,u),v.uv=Xe.getUV(Gt,Rt,Pt,Ct,Ft,Bt,Ht,new M)),l&&(Ft.fromBufferAttribute(l,c),Bt.fromBufferAttribute(l,h),Ht.fromBufferAttribute(l,u),v.uv2=Xe.getUV(Gt,Rt,Pt,Ct,Ft,Bt,Ht,new M));var y=new tt(c,h,u);Xe.getNormal(Rt,Pt,Ct,y.normal),v.face=y}return v}Vt.prototype=Object.assign(Object.create(oe.prototype),{constructor:Vt,isMesh:!0,copy:function(e){return oe.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var n,i=this.geometry,r=this.material,a=this.matrixWorld;if(void 0!==r&&(null===i.boundingSphere&&i.computeBoundingSphere(),Lt.copy(i.boundingSphere),Lt.applyMatrix4(a),!1!==e.ray.intersectsSphere(Lt)&&(Et.getInverse(a),At.copy(e.ray).applyMatrix4(Et),null===i.boundingBox||!1!==At.intersectsBox(i.boundingBox))))if(i.isBufferGeometry){var o,s,l,c,h,u,p,d,f,m=i.index,g=i.attributes.position,v=i.morphAttributes.position,y=i.morphTargetsRelative,x=i.attributes.uv,b=i.attributes.uv2,w=i.groups,_=i.drawRange;if(null!==m)if(Array.isArray(r))for(c=0,u=w.length;c<u;c++)for(f=r[(d=w[c]).materialIndex],h=Math.max(d.start,_.start),p=Math.min(d.start+d.count,_.start+_.count);h<p;h+=3)o=m.getX(h),s=m.getX(h+1),l=m.getX(h+2),(n=Wt(this,f,e,At,g,v,y,x,b,o,s,l))&&(n.faceIndex=Math.floor(h/3),n.face.materialIndex=d.materialIndex,t.push(n));else for(c=Math.max(0,_.start),u=Math.min(m.count,_.start+_.count);c<u;c+=3)o=m.getX(c),s=m.getX(c+1),l=m.getX(c+2),(n=Wt(this,r,e,At,g,v,y,x,b,o,s,l))&&(n.faceIndex=Math.floor(c/3),t.push(n));else if(void 0!==g)if(Array.isArray(r))for(c=0,u=w.length;c<u;c++)for(f=r[(d=w[c]).materialIndex],h=Math.max(d.start,_.start),p=Math.min(d.start+d.count,_.start+_.count);h<p;h+=3)(n=Wt(this,f,e,At,g,v,y,x,b,o=h,s=h+1,l=h+2))&&(n.faceIndex=Math.floor(h/3),n.face.materialIndex=d.materialIndex,t.push(n));else for(c=Math.max(0,_.start),u=Math.min(g.count,_.start+_.count);c<u;c+=3)(n=Wt(this,r,e,At,g,v,y,x,b,o=c,s=c+1,l=c+2))&&(n.faceIndex=Math.floor(c/3),t.push(n))}else if(i.isGeometry){var S,T,E,A,L=Array.isArray(r),R=i.vertices,P=i.faces,C=i.faceVertexUvs[0];C.length>0&&(A=C);for(var O=0,I=P.length;O<I;O++){var D=P[O],N=L?r[D.materialIndex]:r;if(void 0!==N&&(S=R[D.a],T=R[D.b],E=R[D.c],n=jt(this,N,e,At,S,T,E,Gt))){if(A&&A[O]){var z=A[O];Ft.copy(z[0]),Bt.copy(z[1]),Ht.copy(z[2]),n.uv=Xe.getUV(Gt,S,T,E,Ft,Bt,Ht,new M)}n.face=D,n.faceIndex=O,t.push(n)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var qt=0,Xt=new k,Yt=new oe,Jt=new D;function Zt(){Object.defineProperty(this,"id",{value:qt+=2}),this.uuid=_.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}Zt.prototype=Object.assign(Object.create(y.prototype),{constructor:Zt,isGeometry:!0,applyMatrix4:function(e){for(var t=(new S).getNormalMatrix(e),n=0,i=this.vertices.length;n<i;n++){this.vertices[n].applyMatrix4(e)}for(n=0,i=this.faces.length;n<i;n++){var r=this.faces[n];r.normal.applyMatrix3(t).normalize();for(var a=0,o=r.vertexNormals.length;a<o;a++)r.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return Xt.makeRotationX(e),this.applyMatrix4(Xt),this},rotateY:function(e){return Xt.makeRotationY(e),this.applyMatrix4(Xt),this},rotateZ:function(e){return Xt.makeRotationZ(e),this.applyMatrix4(Xt),this},translate:function(e,t,n){return Xt.makeTranslation(e,t,n),this.applyMatrix4(Xt),this},scale:function(e,t,n){return Xt.makeScale(e,t,n),this.applyMatrix4(Xt),this},lookAt:function(e){return Yt.lookAt(e),Yt.updateMatrix(),this.applyMatrix4(Yt.matrix),this},fromBufferGeometry:function(e){var t=this,n=null!==e.index?e.index.array:void 0,i=e.attributes;if(void 0===i.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var r=i.position.array,a=void 0!==i.normal?i.normal.array:void 0,o=void 0!==i.color?i.color.array:void 0,s=void 0!==i.uv?i.uv.array:void 0,l=void 0!==i.uv2?i.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var c=0;c<r.length;c+=3)t.vertices.push((new D).fromArray(r,c)),void 0!==o&&t.colors.push((new Ke).fromArray(o,c));function h(e,n,i,r){var c=void 0===o?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[i].clone()],h=new tt(e,n,i,void 0===a?[]:[(new D).fromArray(a,3*e),(new D).fromArray(a,3*n),(new D).fromArray(a,3*i)],c,r);t.faces.push(h),void 0!==s&&t.faceVertexUvs[0].push([(new M).fromArray(s,2*e),(new M).fromArray(s,2*n),(new M).fromArray(s,2*i)]),void 0!==l&&t.faceVertexUvs[1].push([(new M).fromArray(l,2*e),(new M).fromArray(l,2*n),(new M).fromArray(l,2*i)])}var u=e.groups;if(u.length>0)for(c=0;c<u.length;c++)for(var p=u[c],d=p.start,f=d,m=d+p.count;f<m;f+=3)void 0!==n?h(n[f],n[f+1],n[f+2],p.materialIndex):h(f,f+1,f+2,p.materialIndex);else if(void 0!==n)for(c=0;c<n.length;c+=3)h(n[c],n[c+1],n[c+2]);else for(c=0;c<r.length/3;c+=3)h(c,c+1,c+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Jt).negate(),this.translate(Jt.x,Jt.y,Jt.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,i=new k;return i.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(i),this},computeFaceNormals:function(){for(var e=new D,t=new D,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){var t,n,i,r,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)o[t]=new D;if(e){var s,l,c,h=new D,u=new D;for(i=0,r=this.faces.length;i<r;i++)a=this.faces[i],s=this.vertices[a.a],l=this.vertices[a.b],c=this.vertices[a.c],h.subVectors(c,l),u.subVectors(s,l),h.cross(u),o[a.a].add(h),o[a.b].add(h),o[a.c].add(h)}else for(this.computeFaceNormals(),i=0,r=this.faces.length;i<r;i++)o[(a=this.faces[i]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(i=0,r=this.faces.length;i<r;i++){var p=(a=this.faces[i]).vertexNormals;3===p.length?(p[0].copy(o[a.a]),p[1].copy(o[a.b]),p[2].copy(o[a.c])):(p[0]=o[a.a].clone(),p[1]=o[a.b].clone(),p[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var i=(n=this.faces[e]).vertexNormals;3===i.length?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n<i;n++)for((r=this.faces[n]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),e=0,t=r.vertexNormals.length;e<t;e++)r.__originalVertexNormals[e]?r.__originalVertexNormals[e].copy(r.vertexNormals[e]):r.__originalVertexNormals[e]=r.vertexNormals[e].clone();var a=new Zt;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(n=0,i=this.faces.length;n<i;n++)l=new D,c={a:new D,b:new D,c:new D},o.push(l),s.push(c)}var l,c,h=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,i=this.faces.length;n<i;n++)r=this.faces[n],l=h.faceNormals[n],c=h.vertexNormals[n],l.copy(r.normal),c.a.copy(r.vertexNormals[0]),c.b.copy(r.vertexNormals[1]),c.c.copy(r.vertexNormals[2])}for(n=0,i=this.faces.length;n<i;n++)(r=this.faces[n]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new we),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Se),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var i,r=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,l=e.faces,c=this.colors,h=e.colors;void 0===n&&(n=0),void 0!==t&&(i=(new S).getNormalMatrix(t));for(var u=0,p=o.length;u<p;u++){var d=o[u].clone();void 0!==t&&d.applyMatrix4(t),a.push(d)}for(u=0,p=h.length;u<p;u++)c.push(h[u].clone());for(u=0,p=l.length;u<p;u++){var f,m,g,v=l[u],y=v.vertexNormals,x=v.vertexColors;(f=new tt(v.a+r,v.b+r,v.c+r)).normal.copy(v.normal),void 0!==i&&f.normal.applyMatrix3(i).normalize();for(var b=0,w=y.length;b<w;b++)m=y[b].clone(),void 0!==i&&m.applyMatrix3(i).normalize(),f.vertexNormals.push(m);f.color.copy(v.color);for(b=0,w=x.length;b<w;b++)g=x[b],f.vertexColors.push(g.clone());f.materialIndex=v.materialIndex+n,s.push(f)}for(u=0,p=e.faceVertexUvs.length;u<p;u++){var _=e.faceVertexUvs[u];void 0===this.faceVertexUvs[u]&&(this.faceVertexUvs[u]=[]);for(b=0,w=_.length;b<w;b++){for(var M=_[b],T=[],E=0,A=M.length;E<A;E++)T.push(M[E].clone());this.faceVertexUvs[u].push(T)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,n,i,r,a,o,s,l={},c=[],h=[],u=Math.pow(10,4);for(n=0,i=this.vertices.length;n<i;n++)e=this.vertices[n],void 0===l[t=Math.round(e.x*u)+"_"+Math.round(e.y*u)+"_"+Math.round(e.z*u)]?(l[t]=n,c.push(this.vertices[n]),h[n]=c.length-1):h[n]=h[l[t]];var p=[];for(n=0,i=this.faces.length;n<i;n++){(r=this.faces[n]).a=h[r.a],r.b=h[r.b],r.c=h[r.c],a=[r.a,r.b,r.c];for(var d=0;d<3;d++)if(a[d]===a[(d+1)%3]){p.push(n);break}}for(n=p.length-1;n>=0;n--){var f=p[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-c.length;return this.vertices=c,m},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var i=e[t];this.vertices.push(new D(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));var i,r,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(i=[]),o&&o.length===t&&(r=[]);for(n=0;n<t;n++){var s=e[n]._id;i&&i.push(a[s]),r&&r.push(o[s])}i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}for(var i=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];i.push(a.x,a.y,a.z)}var o=[],s=[],l={},c=[],h={},u=[],p={};for(r=0;r<this.faces.length;r++){var d=this.faces[r],f=void 0!==this.faceVertexUvs[0][r],m=d.normal.length()>0,g=d.vertexNormals.length>0,v=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=d.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,g),x=M(x,6,v),x=M(x,7,y),o.push(x),o.push(d.a,d.b,d.c),o.push(d.materialIndex),f){var b=this.faceVertexUvs[0][r];o.push(E(b[0]),E(b[1]),E(b[2]))}if(m&&o.push(S(d.normal)),g){var w=d.vertexNormals;o.push(S(w[0]),S(w[1]),S(w[2]))}if(v&&o.push(T(d.color)),y){var _=d.vertexColors;o.push(T(_[0]),T(_[1]),T(_[2]))}}function M(e,t,n){return n?e|1<<t:e&~(1<<t)}function S(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==l[t]||(l[t]=s.length/3,s.push(e.x,e.y,e.z)),l[t]}function T(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==h[t]||(h[t]=c.length,c.push(e.getHex())),h[t]}function E(e){var t=e.x.toString()+e.y.toString();return void 0!==p[t]||(p[t]=u.length/2,u.push(e.x,e.y)),p[t]}return e.data={},e.data.vertices=i,e.data.normals=s,c.length>0&&(e.data.colors=c),u.length>0&&(e.data.uvs=[u]),e.data.faces=o,e},clone:function(){return(new Zt).copy(this)},copy:function(e){var t,n,i,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var l=e.colors;for(t=0,n=l.length;t<n;t++)this.colors.push(l[t].clone());var c=e.faces;for(t=0,n=c.length;t<n;t++)this.faces.push(c[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var h=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),i=0,r=h.length;i<r;i++){var u=h[i],p=[];for(a=0,o=u.length;a<o;a++){var d=u[a];p.push(d.clone())}this.faceVertexUvs[t].push(p)}}var f=e.morphTargets;for(t=0,n=f.length;t<n;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],i=0,r=f[t].vertices.length;i<r;i++)m.vertices.push(f[t].vertices[i].clone());if(void 0!==f[t].normals)for(m.normals=[],i=0,r=f[t].normals.length;i<r;i++)m.normals.push(f[t].normals[i].clone());this.morphTargets.push(m)}var g=e.morphNormals;for(t=0,n=g.length;t<n;t++){var v={};if(void 0!==g[t].vertexNormals)for(v.vertexNormals=[],i=0,r=g[t].vertexNormals.length;i<r;i++){var y=g[t].vertexNormals[i],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x)}if(void 0!==g[t].faceNormals)for(v.faceNormals=[],i=0,r=g[t].faceNormals.length;i<r;i++)v.faceNormals.push(g[t].faceNormals[i].clone());this.morphNormals.push(v)}var b=e.skinWeights;for(t=0,n=b.length;t<n;t++)this.skinWeights.push(b[t].clone());var w=e.skinIndices;for(t=0,n=w.length;t<n;t++)this.skinIndices.push(w[t].clone());var _=e.lineDistances;for(t=0,n=_.length;t<n;t++)this.lineDistances.push(_[t]);var M=e.boundingBox;null!==M&&(this.boundingBox=M.clone());var S=e.boundingSphere;return null!==S&&(this.boundingSphere=S.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class Kt extends Tt{constructor(e,t,n,i,r,a){super(),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;e=e||1,t=t||1,n=n||1,i=Math.floor(i)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;const s=[],l=[],c=[],h=[];let u=0,p=0;function d(e,t,n,i,r,a,d,f,m,g,v){const y=a/m,x=d/g,b=a/2,w=d/2,_=f/2,M=m+1,S=g+1;let T=0,E=0;const A=new D;for(let a=0;a<S;a++){const o=a*x-w;for(let s=0;s<M;s++){const u=s*y-b;A[e]=u*i,A[t]=o*r,A[n]=_,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=f>0?1:-1,c.push(A.x,A.y,A.z),h.push(s/m),h.push(1-a/g),T+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){const n=u+t+M*e,i=u+t+M*(e+1),r=u+(t+1)+M*(e+1),a=u+(t+1)+M*e;s.push(n,i,a),s.push(i,r,a),E+=6}o.addGroup(p,E,v),p+=E,u+=T}d("z","y","x",-1,-1,n,t,e,a,r,0),d("z","y","x",1,-1,n,t,-e,a,r,1),d("x","z","y",1,1,e,n,t,i,a,2),d("x","z","y",1,-1,e,n,-t,i,a,3),d("x","y","z",1,-1,e,t,n,i,r,4),d("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(s),this.setAttribute("position",new ft(l,3)),this.setAttribute("normal",new ft(c,3)),this.setAttribute("uv",new ft(h,2))}}function Qt(e){var t={};for(var n in e)for(var i in t[n]={},e[n]){var r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}return t}function $t(e){for(var t={},n=0;n<e.length;n++){var i=Qt(e[n]);for(var r in i)t[r]=i[r]}return t}var en={clone:Qt,merge:$t};function tn(e){it.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function nn(){oe.call(this),this.type="Camera",this.matrixWorldInverse=new k,this.projectionMatrix=new k,this.projectionMatrixInverse=new k}function rn(e,t,n,i){nn.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}tn.prototype=Object.create(it.prototype),tn.prototype.constructor=tn,tn.prototype.isShaderMaterial=!0,tn.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Qt(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this},tn.prototype.toJSON=function(e){var t=it.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var r={};for(var a in this.extensions)!0===this.extensions[a]&&(r[a]=!0);return Object.keys(r).length>0&&(t.extensions=r),t},nn.prototype=Object.assign(Object.create(oe.prototype),{constructor:nn,isCamera:!0,copy:function(e,t){return oe.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new D),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){oe.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){oe.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),rn.prototype=Object.assign(Object.create(nn.prototype),{constructor:rn,isPerspectiveCamera:!0,copy:function(e,t){return nn.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*_.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*_.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*_.RAD2DEG*Math.atan(Math.tan(.5*_.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*_.DEG2RAD*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(r+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=oe.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});function an(e,t,n){if(oe.call(this),this.type="CubeCamera",!0===n.isWebGLCubeRenderTarget){this.renderTarget=n;var i=new rn(90,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new D(1,0,0)),this.add(i);var r=new rn(90,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new D(-1,0,0)),this.add(r);var a=new rn(90,1,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new D(0,1,0)),this.add(a);var o=new rn(90,1,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new D(0,-1,0)),this.add(o);var s=new rn(90,1,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new D(0,0,1)),this.add(s);var l=new rn(90,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new D(0,0,-1)),this.add(l),this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var c=e.xr.enabled,h=e.getRenderTarget();e.xr.enabled=!1;var u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=u,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(h),e.xr.enabled=c},this.clear=function(e,t,i,r){for(var a=e.getRenderTarget(),o=0;o<6;o++)e.setRenderTarget(n,o),e.clear(t,i,r);e.setRenderTarget(a)}}else console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")}function on(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),R.call(this,e,e,t)}function sn(e,t,n,i,r,a,o,s,l,c,h,u){A.call(this,null,a,o,s,l,c,i,r,h,u),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==l?l:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}an.prototype=Object.create(oe.prototype),an.prototype.constructor=an,on.prototype=Object.create(R.prototype),on.prototype.constructor=on,on.prototype.isWebGLCubeRenderTarget=!0,on.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new se,i={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include <begin_vertex>","\t#include <project_vertex>","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#include <common>","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV = equirectUv( direction );","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},r=new tn({type:"CubemapFromEquirect",uniforms:Qt(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;var a=new Vt(new Kt(5,5,5),r);return n.add(a),new an(1,10,this).update(e,n),a.geometry.dispose(),a.material.dispose(),this},sn.prototype=Object.create(A.prototype),sn.prototype.constructor=sn,sn.prototype.isDataTexture=!0;var ln=new Se,cn=new D;function hn(e,t,n,i,r,a){this.planes=[void 0!==e?e:new ze,void 0!==t?t:new ze,void 0!==n?n:new ze,void 0!==i?i:new ze,void 0!==r?r:new ze,void 0!==a?a:new ze]}Object.assign(hn.prototype,{set:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],h=n[7],u=n[8],p=n[9],d=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(o-i,h-s,f-u,y-m).normalize(),t[1].setComponents(o+i,h+s,f+u,y+m).normalize(),t[2].setComponents(o+r,h+l,f+p,y+g).normalize(),t[3].setComponents(o-r,h-l,f-p,y-g).normalize(),t[4].setComponents(o-a,h-c,f-d,y-v).normalize(),t[5].setComponents(o+a,h+c,f+d,y+v).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),ln.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ln)},intersectsSprite:function(e){return ln.center.set(0,0,0),ln.radius=.7071067811865476,ln.applyMatrix4(e.matrixWorld),this.intersectsSphere(ln)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(n)<i)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var i=t[n];if(cn.x=i.normal.x>0?e.max.x:e.min.x,cn.y=i.normal.y>0?e.max.y:e.min.y,cn.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(cn)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var un={common:{diffuse:{value:new Ke(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new S},uv2Transform:{value:new S},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new M(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ke(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Ke(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new S}},sprite:{diffuse:{value:new Ke(15658734)},opacity:{value:1},center:{value:new M(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new S}}};function pn(){var e=null,t=!1,n=null;function i(r,a){!1!==t&&(n(r,a),e.requestAnimationFrame(i))}return{start:function(){!0!==t&&null!==n&&(e.requestAnimationFrame(i),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function dn(e,t){var n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){t.isInterleavedBufferAttribute&&(t=t.data);var a=i.get(t);void 0===a?i.set(t,function(t,n){var i=t.array,r=t.usage,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,i,r),t.onUploadCallback();var o=5126;return i instanceof Float32Array?o=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?o=5123:i instanceof Int16Array?o=5122:i instanceof Uint32Array?o=5125:i instanceof Int32Array?o=5124:i instanceof Int8Array?o=5120:i instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(t,r)):a.version<t.version&&(!function(t,i,r){var a=i.array,o=i.updateRange;e.bindBuffer(r,t),-1===o.count?e.bufferSubData(r,0,a):(n?e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(a.buffer,t,r),a.version=t.version)}}}function fn(e,t,n,i){Zt.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new mn(e,t,n,i)),this.mergeVertices()}function mn(e,t,n,i){Tt.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};var r,a,o=(e=e||1)/2,s=(t=t||1)/2,l=Math.floor(n)||1,c=Math.floor(i)||1,h=l+1,u=c+1,p=e/l,d=t/c,f=[],m=[],g=[],v=[];for(a=0;a<u;a++){var y=a*d-s;for(r=0;r<h;r++){var x=r*p-o;m.push(x,-y,0),g.push(0,0,1),v.push(r/l),v.push(1-a/c)}}for(a=0;a<c;a++)for(r=0;r<l;r++){var b=r+h*a,w=r+h*(a+1),_=r+1+h*(a+1),M=r+1+h*a;f.push(b,w,M),f.push(w,_,M)}this.setIndex(f),this.setAttribute("position",new ft(m,3)),this.setAttribute("normal",new ft(g,3)),this.setAttribute("uv",new ft(v,2))}fn.prototype=Object.create(Zt.prototype),fn.prototype.constructor=fn,mn.prototype=Object.create(Tt.prototype),mn.prototype.constructor=mn;var gn={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\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\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",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",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#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; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\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 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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return 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}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) {\n uv = vec2(-direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) {\n uv = vec2(-direction.x, direction.y) / abs(direction.z); } else if (face == 3.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) {\n uv = vec2(-direction.x, direction.z) / abs(direction.y); } else {\n uv = vec2(direction.x, direction.y) / abs(direction.z); }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif",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",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\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}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\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#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\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",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\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",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\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",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\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",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",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",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",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 texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",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 GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\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\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\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\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\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\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",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.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_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_Diffuse_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 CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * 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}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\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\tgetPointDirectLightIrradiance( 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 *= all( bvec2( 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\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\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ 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\tgetDirectionalDirectLightIrradiance( 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 *= all( bvec2( 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 );\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 );\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",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",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",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",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",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",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",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",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}\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 linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",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;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",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",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#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#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ 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#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\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\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",shadowmap_pars_vertex:"#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#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ 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#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",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, vSpotShadowCoord[ 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}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",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",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",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\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",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"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}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\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}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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 <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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 <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\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\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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 <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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 <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#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\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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 <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#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\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#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\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#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\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\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 <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\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 <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},vn={basic:{uniforms:$t([un.common,un.specularmap,un.envmap,un.aomap,un.lightmap,un.fog]),vertexShader:gn.meshbasic_vert,fragmentShader:gn.meshbasic_frag},lambert:{uniforms:$t([un.common,un.specularmap,un.envmap,un.aomap,un.lightmap,un.emissivemap,un.fog,un.lights,{emissive:{value:new Ke(0)}}]),vertexShader:gn.meshlambert_vert,fragmentShader:gn.meshlambert_frag},phong:{uniforms:$t([un.common,un.specularmap,un.envmap,un.aomap,un.lightmap,un.emissivemap,un.bumpmap,un.normalmap,un.displacementmap,un.fog,un.lights,{emissive:{value:new Ke(0)},specular:{value:new Ke(1118481)},shininess:{value:30}}]),vertexShader:gn.meshphong_vert,fragmentShader:gn.meshphong_frag},standard:{uniforms:$t([un.common,un.envmap,un.aomap,un.lightmap,un.emissivemap,un.bumpmap,un.normalmap,un.displacementmap,un.roughnessmap,un.metalnessmap,un.fog,un.lights,{emissive:{value:new Ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:gn.meshphysical_vert,fragmentShader:gn.meshphysical_frag},toon:{uniforms:$t([un.common,un.specularmap,un.aomap,un.lightmap,un.emissivemap,un.bumpmap,un.normalmap,un.displacementmap,un.gradientmap,un.fog,un.lights,{emissive:{value:new Ke(0)},specular:{value:new Ke(1118481)},shininess:{value:30}}]),vertexShader:gn.meshtoon_vert,fragmentShader:gn.meshtoon_frag},matcap:{uniforms:$t([un.common,un.bumpmap,un.normalmap,un.displacementmap,un.fog,{matcap:{value:null}}]),vertexShader:gn.meshmatcap_vert,fragmentShader:gn.meshmatcap_frag},points:{uniforms:$t([un.points,un.fog]),vertexShader:gn.points_vert,fragmentShader:gn.points_frag},dashed:{uniforms:$t([un.common,un.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:gn.linedashed_vert,fragmentShader:gn.linedashed_frag},depth:{uniforms:$t([un.common,un.displacementmap]),vertexShader:gn.depth_vert,fragmentShader:gn.depth_frag},normal:{uniforms:$t([un.common,un.bumpmap,un.normalmap,un.displacementmap,{opacity:{value:1}}]),vertexShader:gn.normal_vert,fragmentShader:gn.normal_frag},sprite:{uniforms:$t([un.sprite,un.fog]),vertexShader:gn.sprite_vert,fragmentShader:gn.sprite_frag},background:{uniforms:{uvTransform:{value:new S},t2D:{value:null}},vertexShader:gn.background_vert,fragmentShader:gn.background_frag},cube:{uniforms:$t([un.envmap,{opacity:{value:1}}]),vertexShader:gn.cube_vert,fragmentShader:gn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:gn.equirect_vert,fragmentShader:gn.equirect_frag},distanceRGBA:{uniforms:$t([un.common,un.displacementmap,{referencePosition:{value:new D},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:gn.distanceRGBA_vert,fragmentShader:gn.distanceRGBA_frag},shadow:{uniforms:$t([un.lights,un.fog,{color:{value:new Ke(0)},opacity:{value:1}}]),vertexShader:gn.shadow_vert,fragmentShader:gn.shadow_frag}};function yn(e,t,n,i){var r,a,o=new Ke(0),s=0,l=null,c=0,h=null;function u(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,i)}return{getClearColor:function(){return o},setClearColor:function(e,t){o.set(e),u(o,s=void 0!==t?t:1)},getClearAlpha:function(){return s},setClearAlpha:function(e){u(o,s=e)},render:function(t,i,p,d){var f=i.background,m=e.xr,g=m.getSession&&m.getSession();if(g&&"additive"===g.environmentBlendMode&&(f=null),null===f?u(o,s):f&&f.isColor&&(u(f,1),d=!0),(e.autoClear||d)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||f.isWebGLCubeRenderTarget||306===f.mapping)){void 0===a&&((a=new Vt(new Kt(1,1,1),new tn({type:"BackgroundCubeMaterial",uniforms:Qt(vn.cube.uniforms),vertexShader:vn.cube.vertexShader,fragmentShader:vn.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(a));var v=f.isWebGLCubeRenderTarget?f.texture:f;a.material.uniforms.envMap.value=v,a.material.uniforms.flipEnvMap.value=v.isCubeTexture?-1:1,l===f&&c===v.version&&h===e.toneMapping||(a.material.needsUpdate=!0,l=f,c=v.version,h=e.toneMapping),t.unshift(a,a.geometry,a.material,0,0,null)}else f&&f.isTexture&&(void 0===r&&((r=new Vt(new mn(2,2),new tn({type:"BackgroundMaterial",uniforms:Qt(vn.background.uniforms),vertexShader:vn.background.vertexShader,fragmentShader:vn.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(r.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(r)),r.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),r.material.uniforms.uvTransform.value.copy(f.matrix),l===f&&c===f.version&&h===e.toneMapping||(r.material.needsUpdate=!0,l=f,c=f.version,h=e.toneMapping),t.unshift(r,r.geometry,r.material,0,0,null))}}}function xn(e,t,n,i){var r,a=i.isWebGL2;this.setMode=function(e){r=e},this.render=function(t,i){e.drawArrays(r,t,i),n.update(i,r)},this.renderInstances=function(i,o,s,l){if(0!==l){var c,h;if(a)c=e,h="drawArraysInstanced";else if(h="drawArraysInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](r,o,s,l),n.update(s,r,l)}}}function bn(e,t,n){var i;function r(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),u=e.getParameter(3379),p=e.getParameter(34076),d=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),v=h>0,y=a||!!t.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?e.getParameter(36183):0}}function wn(){var e=this,t=null,n=0,i=!1,r=!1,a=new ze,o=new S,s={value:null,needsUpdate:!1};function l(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function c(t,n,i,r){var l=null!==t?t.length:0,c=null;if(0!==l){if(c=s.value,!0!==r||null===c){var h=i+4*l,u=n.matrixWorldInverse;o.getNormalMatrix(u),(null===c||c.length<h)&&(c=new Float32Array(h));for(var p=0,d=i;p!==l;++p,d+=4)a.copy(t[p]).applyMatrix4(u,o),a.normal.toArray(c,d),c[d+3]=a.constant}s.value=c,s.needsUpdate=!0}return e.numPlanes=l,e.numIntersection=0,c}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,r,a){var o=0!==e.length||r||0!==n||i;return i=r,t=c(e,a,0),n=e.length,o},this.beginShadows=function(){r=!0,c(null)},this.endShadows=function(){r=!1,l()},this.setState=function(e,a,o,h,u,p){if(!i||null===e||0===e.length||r&&!o)r?c(null):l();else{var d=r?0:n,f=4*d,m=u.clippingState||null;s.value=m,m=c(e,h,f,p);for(var g=0;g!==f;++g)m[g]=t[g];u.clippingState=m,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=d}}}function _n(e){var t={};return{get:function(n){if(void 0!==t[n])return t[n];var i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=i,i}}}function Mn(e,t,n){var i=new WeakMap,r=new WeakMap;function a(e){var o=e.target,s=i.get(o);for(var l in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[l]);o.removeEventListener("dispose",a),i.delete(o);var c=r.get(s);c&&(t.remove(c),r.delete(s)),n.memory.geometries--}function o(e){var n=[],i=e.index,a=e.attributes.position,o=0;if(null!==i){var s=i.array;o=i.version;for(var l=0,c=s.length;l<c;l+=3){var h=s[l+0],u=s[l+1],p=s[l+2];n.push(h,u,u,p,p,h)}}else{s=a.array;o=a.version;for(l=0,c=s.length/3-1;l<c;l+=3){h=l+0,u=l+1,p=l+2;n.push(h,u,u,p,p,h)}}var d=new(vt(n)>65535?dt:ut)(n,1);d.version=o,t.update(d,34963);var f=r.get(e);f&&t.remove(f),r.set(e,d)}return{get:function(e,t){var r=i.get(t);return r||(t.addEventListener("dispose",a),t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Tt).setFromObject(e)),r=t._bufferGeometry),i.set(t,r),n.memory.geometries++,r)},update:function(e){var n=e.index,i=e.attributes;for(var r in null!==n&&t.update(n,34963),i)t.update(i[r],34962);var a=e.morphAttributes;for(var r in a)for(var o=a[r],s=0,l=o.length;s<l;s++)t.update(o[s],34962)},getWireframeAttribute:function(e){var t=r.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&o(e)}else o(e);return r.get(e)}}}function Sn(e,t,n,i){var r,a,o,s=i.isWebGL2;this.setMode=function(e){r=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,i){e.drawElements(r,i,a,t*o),n.update(i,r)},this.renderInstances=function(i,l,c,h){if(0!==h){var u,p;if(s)u=e,p="drawElementsInstanced";else if(p="drawElementsInstancedANGLE",null===(u=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[p](r,c,a,l*o,h),n.update(c,r,h)}}}function Tn(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,i){switch(i=i||1,t.calls++,n){case 4:t.triangles+=i*(e/3);break;case 1:t.lines+=i*(e/2);break;case 3:t.lines+=i*(e-1);break;case 2:t.lines+=i*e;break;case 0:t.points+=i*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function En(e,t){return Math.abs(t[1])-Math.abs(e[1])}function An(e){var t={},n=new Float32Array(8);return{update:function(i,r,a,o){var s=i.morphTargetInfluences,l=void 0===s?0:s.length,c=t[r.id];if(void 0===c){c=[];for(var h=0;h<l;h++)c[h]=[h,0];t[r.id]=c}var u=a.morphTargets&&r.morphAttributes.position,p=a.morphNormals&&r.morphAttributes.normal;for(h=0;h<l;h++){0!==(f=c[h])[1]&&(u&&r.deleteAttribute("morphTarget"+h),p&&r.deleteAttribute("morphNormal"+h))}for(h=0;h<l;h++){(f=c[h])[0]=h,f[1]=s[h]}c.sort(En);var d=0;for(h=0;h<8;h++){var f;if(f=c[h]){var m=f[0],g=f[1];if(g){u&&r.setAttribute("morphTarget"+h,u[m]),p&&r.setAttribute("morphNormal"+h,p[m]),n[h]=g,d+=g;continue}}n[h]=0}var v=r.morphTargetsRelative?1:1-d;o.getUniforms().setValue(e,"morphTargetBaseInfluence",v),o.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function Ln(e,t,n,i){var r=new WeakMap;return{update:function(e){var a=i.render.frame,o=e.geometry,s=t.get(e,o);return r.get(s)!==a&&(o.isGeometry&&s.updateFromObject(e),t.update(s),r.set(s,a)),e.isInstancedMesh&&n.update(e.instanceMatrix,34962),s},dispose:function(){r=new WeakMap}}}function Rn(e,t,n,i,r,a,o,s,l,c){e=void 0!==e?e:[],t=void 0!==t?t:301,o=void 0!==o?o:1022,A.call(this,e,t,n,i,r,a,o,s,l,c),this.flipY=!1}function Pn(e,t,n,i){A.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Cn(e,t,n,i){A.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}vn.physical={uniforms:$t([vn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new M(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Ke(0)},transparency:{value:0}}]),vertexShader:gn.meshphysical_vert,fragmentShader:gn.meshphysical_frag},Rn.prototype=Object.create(A.prototype),Rn.prototype.constructor=Rn,Rn.prototype.isCubeTexture=!0,Object.defineProperty(Rn.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),Pn.prototype=Object.create(A.prototype),Pn.prototype.constructor=Pn,Pn.prototype.isDataTexture2DArray=!0,Cn.prototype=Object.create(A.prototype),Cn.prototype.constructor=Cn,Cn.prototype.isDataTexture3D=!0;var On=new A,In=new Pn,Dn=new Cn,Nn=new Rn,zn=[],Un=[],Fn=new Float32Array(16),Bn=new Float32Array(9),Hn=new Float32Array(4);function Gn(e,t,n){var i=e[0];if(i<=0||i>0)return e;var r=t*n,a=zn[r];if(void 0===a&&(a=new Float32Array(r),zn[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function kn(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function Vn(e,t){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]}function jn(e,t){var n=Un[t];void 0===n&&(n=new Int32Array(t),Un[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function Wn(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function qn(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(kn(n,t))return;e.uniform2fv(this.addr,t),Vn(n,t)}}function Xn(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(kn(n,t))return;e.uniform3fv(this.addr,t),Vn(n,t)}}function Yn(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(kn(n,t))return;e.uniform4fv(this.addr,t),Vn(n,t)}}function Jn(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(kn(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Vn(n,t)}else{if(kn(n,i))return;Hn.set(i),e.uniformMatrix2fv(this.addr,!1,Hn),Vn(n,i)}}function Zn(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(kn(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Vn(n,t)}else{if(kn(n,i))return;Bn.set(i),e.uniformMatrix3fv(this.addr,!1,Bn),Vn(n,i)}}function Kn(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(kn(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Vn(n,t)}else{if(kn(n,i))return;Fn.set(i),e.uniformMatrix4fv(this.addr,!1,Fn),Vn(n,i)}}function Qn(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(t||On,r)}function $n(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||In,r)}function ei(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||Dn,r)}function ti(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(t||Nn,r)}function ni(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function ii(e,t){var n=this.cache;kn(n,t)||(e.uniform2iv(this.addr,t),Vn(n,t))}function ri(e,t){var n=this.cache;kn(n,t)||(e.uniform3iv(this.addr,t),Vn(n,t))}function ai(e,t){var n=this.cache;kn(n,t)||(e.uniform4iv(this.addr,t),Vn(n,t))}function oi(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function si(e,t){e.uniform1fv(this.addr,t)}function li(e,t){e.uniform1iv(this.addr,t)}function ci(e,t){e.uniform2iv(this.addr,t)}function hi(e,t){e.uniform3iv(this.addr,t)}function ui(e,t){e.uniform4iv(this.addr,t)}function pi(e,t){var n=Gn(t,this.size,2);e.uniform2fv(this.addr,n)}function di(e,t){var n=Gn(t,this.size,3);e.uniform3fv(this.addr,n)}function fi(e,t){var n=Gn(t,this.size,4);e.uniform4fv(this.addr,n)}function mi(e,t){var n=Gn(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function gi(e,t){var n=Gn(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function vi(e,t){var n=Gn(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function yi(e,t,n){var i=t.length,r=jn(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.safeSetTexture2D(t[a]||On,r[a])}function xi(e,t,n){var i=t.length,r=jn(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.safeSetTextureCube(t[a]||Nn,r[a])}function bi(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return Wn;case 35664:return qn;case 35665:return Xn;case 35666:return Yn;case 35674:return Jn;case 35675:return Zn;case 35676:return Kn;case 5124:case 35670:return ni;case 35667:case 35671:return ii;case 35668:case 35672:return ri;case 35669:case 35673:return ai;case 5125:return oi;case 35678:case 36198:case 36298:case 36306:case 35682:return Qn;case 35679:case 36299:case 36307:return ei;case 35680:case 36300:case 36308:case 36293:return ti;case 36289:case 36303:case 36311:case 36292:return $n}}(t.type)}function wi(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return si;case 35664:return pi;case 35665:return di;case 35666:return fi;case 35674:return mi;case 35675:return gi;case 35676:return vi;case 5124:case 35670:return li;case 35667:case 35671:return ci;case 35668:case 35672:return hi;case 35669:case 35673:return ui;case 35678:case 36198:case 36298:case 36306:case 35682:return yi;case 35680:case 36300:case 36308:case 36293:return xi}}(t.type)}function _i(e){this.id=e,this.seq=[],this.map={}}wi.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Vn(t,e)},_i.prototype.setValue=function(e,t,n){for(var i=this.seq,r=0,a=i.length;r!==a;++r){var o=i[r];o.setValue(e,t[o.id],n)}};var Mi=/([\w\d_]+)(\])?(\[|\.)?/g;function Si(e,t){e.seq.push(t),e.map[t.id]=t}function Ti(e,t,n){var i=e.name,r=i.length;for(Mi.lastIndex=0;;){var a=Mi.exec(i),o=Mi.lastIndex,s=a[1],l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===r){Si(n,void 0===c?new bi(s,e,t):new wi(s,e,t));break}var h=n.map[s];void 0===h&&Si(n,h=new _i(s)),n=h}}function Ei(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),i=0;i<n;++i){var r=e.getActiveUniform(t,i);Ti(r,e.getUniformLocation(t,r.name),this)}}function Ai(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}Ei.prototype.setValue=function(e,t,n,i){var r=this.map[t];void 0!==r&&r.setValue(e,n,i)},Ei.prototype.setOptional=function(e,t,n){var i=t[n];void 0!==i&&this.setValue(e,n,i)},Ei.upload=function(e,t,n,i){for(var r=0,a=t.length;r!==a;++r){var o=t[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,i)}},Ei.seqWithValue=function(e,t){for(var n=[],i=0,r=e.length;i!==r;++i){var a=e[i];a.id in t&&n.push(a)}return n};var Li=0;function Ri(e){switch(e){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:throw new Error("unsupported encoding: "+e)}}function Pi(e,t,n){var i=e.getShaderParameter(t,35713),r=e.getShaderInfoLog(t).trim();return i&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+r+function(e){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(e.getShaderSource(t))}function Ci(e,t){var n=Ri(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Oi(e,t){var n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="Uncharted2";break;case 4:n="OptimizedCineon";break;case 5:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Ii(e){return""!==e}function Di(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Ni(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var zi=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ui(e){return e.replace(zi,Fi)}function Fi(e,t){var n=gn[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Ui(n)}var Bi=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Hi=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g;function Gi(e){return e.replace(Hi,Vi).replace(Bi,ki)}function ki(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Vi(e,t,n,i)}function Vi(e,t,n,i){for(var r="",a=parseInt(t);a<parseInt(n);a++)r+=i.replace(/\[ i \]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function ji(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function Wi(e,t,n){var i,r,a,o,s,l=e.getContext(),c=n.defines,h=n.vertexShader,u=n.fragmentShader,p=function(e){var t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),d=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:case 307:t="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:t="ENVMAP_TYPE_EQUIREC";break;case 305:t="ENVMAP_TYPE_SPHERE"}return t}(n),f=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case 302:case 304:t="ENVMAP_MODE_REFRACTION"}return t}(n),m=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),g=e.gammaFactor>0?e.gammaFactor:1,v=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ii).join("\n")}(n),y=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(c),x=l.createProgram();if(n.isRawShaderMaterial?((i=[y].filter(Ii).join("\n")).length>0&&(i+="\n"),(r=[v,y].filter(Ii).join("\n")).length>0&&(r+="\n")):(i=[ji(n),"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+g,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+p:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.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"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\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(Ii).join("\n"),r=[v,ji(n),"#define SHADER_NAME "+n.shaderName,y,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",n.envMap?"#define "+m:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+p:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?gn.tonemapping_pars_fragment:"",0!==n.toneMapping?Oi("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?gn.encodings_pars_fragment:"",n.mapEncoding?Ci("mapTexelToLinear",n.mapEncoding):"",n.matcapEncoding?Ci("matcapTexelToLinear",n.matcapEncoding):"",n.envMapEncoding?Ci("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Ci("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMapEncoding?Ci("lightMapTexelToLinear",n.lightMapEncoding):"",n.outputEncoding?(a="linearToOutputTexel",o=n.outputEncoding,s=Ri(o),"vec4 "+a+"( vec4 value ) { return LinearTo"+s[0]+s[1]+"; }"):"",n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ii).join("\n")),h=Ni(h=Di(h=Ui(h),n),n),u=Ni(u=Di(u=Ui(u),n),n),h=Gi(h),u=Gi(u),n.isWebGL2&&!n.isRawShaderMaterial){var b=!1,w=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==h.match(w)&&null!==u.match(w)&&(b=!0,h=h.replace(w,""),u=u.replace(w,"")),i=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,r=["#version 300 es\n","#define varying in",b?"":"out highp vec4 pc_fragColor;",b?"":"#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"+r}var _,M,S=r+u,T=Ai(l,35633,i+h),E=Ai(l,35632,S);if(l.attachShader(x,T),l.attachShader(x,E),void 0!==n.index0AttributeName?l.bindAttribLocation(x,0,n.index0AttributeName):!0===n.morphTargets&&l.bindAttribLocation(x,0,"position"),l.linkProgram(x),e.debug.checkShaderErrors){var A=l.getProgramInfoLog(x).trim(),L=l.getShaderInfoLog(T).trim(),R=l.getShaderInfoLog(E).trim(),P=!0,C=!0;if(!1===l.getProgramParameter(x,35714)){P=!1;var O=Pi(l,T,"vertex"),I=Pi(l,E,"fragment");console.error("THREE.WebGLProgram: shader error: ",l.getError(),"35715",l.getProgramParameter(x,35715),"gl.getProgramInfoLog",A,O,I)}else""!==A?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",A):""!==L&&""!==R||(C=!1);C&&(this.diagnostics={runnable:P,programLog:A,vertexShader:{log:L,prefix:i},fragmentShader:{log:R,prefix:r}})}return l.deleteShader(T),l.deleteShader(E),this.getUniforms=function(){return void 0===_&&(_=new Ei(l,x)),_},this.getAttributes=function(){return void 0===M&&(M=function(e,t){for(var n={},i=e.getProgramParameter(t,35721),r=0;r<i;r++){var a=e.getActiveAttrib(t,r).name;n[a]=e.getAttribLocation(t,a)}return n}(l,x)),M},this.destroy=function(){l.deleteProgram(x),this.program=void 0},this.name=n.shaderName,this.id=Li++,this.cacheKey=t,this.usedTimes=1,this.program=x,this.vertexShader=T,this.fragmentShader=E,this}function qi(e,t,n){var i=[],r=n.isWebGL2,a=n.logarithmicDepthBuffer,o=n.floatVertexTextures,s=n.precision,l=n.maxVertexUniforms,c=n.vertexTextures,h={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},u=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen"];function p(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=3e3,t}this.getParameters=function(i,u,d,f,m,g,v){var y=f.fog,x=i.isMeshStandardMaterial?f.environment:null,b=i.envMap||x,w=h[i.type],_=v.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(o)return 1024;var n=l,i=Math.floor((n-20)/4),r=Math.min(i,t.length);return r<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+r+"."),0):r}(v):0;null!==i.precision&&(s=n.getMaxPrecision(i.precision))!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",s,"instead.");var M=function(e,t){var n;if(t){var i=vn[t];n={name:e.type,uniforms:en.clone(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader}}else n={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return n}(i,w);i.onBeforeCompile(M,e);var S=e.getRenderTarget();return{isWebGL2:r,shaderID:w,shaderName:M.name,uniforms:M.uniforms,vertexShader:M.vertexShader,fragmentShader:M.fragmentShader,defines:i.defines,isRawShaderMaterial:i.isRawShaderMaterial,isShaderMaterial:i.isShaderMaterial,precision:s,instancing:!0===v.isInstancedMesh,supportsVertexTextures:c,outputEncoding:null!==S?p(S.texture):e.outputEncoding,map:!!i.map,mapEncoding:p(i.map),matcap:!!i.matcap,matcapEncoding:p(i.matcap),envMap:!!b,envMapMode:b&&b.mapping,envMapEncoding:p(b),envMapCubeUV:!!b&&(306===b.mapping||307===b.mapping),lightMap:!!i.lightMap,lightMapEncoding:p(i.lightMap),aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:p(i.emissiveMap),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,objectSpaceNormalMap:1===i.normalMapType,tangentSpaceNormalMap:0===i.normalMapType,clearcoatMap:!!i.clearcoatMap,clearcoatRoughnessMap:!!i.clearcoatRoughnessMap,clearcoatNormalMap:!!i.clearcoatNormalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,gradientMap:!!i.gradientMap,sheen:!!i.sheen,combine:i.combine,vertexTangents:i.normalMap&&i.vertexTangents,vertexColors:i.vertexColors,vertexUvs:!!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatMap||i.clearcoatRoughnessMap||i.clearcoatNormalMap||i.displacementMap),uvsVertexOnly:!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatNormalMap||!i.displacementMap),fog:!!y,useFog:i.fog,fogExp2:y&&y.isFogExp2,flatShading:i.flatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:a,skinning:i.skinning&&_>0,maxBones:_,useVertexTexture:o,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:u.directional.length,numPointLights:u.point.length,numSpotLights:u.spot.length,numRectAreaLights:u.rectArea.length,numHemiLights:u.hemi.length,numDirLightShadows:u.directionalShadowMap.length,numPointLightShadows:u.pointShadowMap.length,numSpotLightShadows:u.spotShadowMap.length,numClippingPlanes:m,numClipIntersection:g,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:i.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:2===i.side,flipSided:1===i.side,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:r||null!==t.get("EXT_frag_depth"),rendererExtensionDrawBuffers:r||null!==t.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:r||null!==t.get("EXT_shader_texture_lod"),onBeforeCompile:i.onBeforeCompile}},this.getProgramCacheKey=function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);if(void 0===t.isRawShaderMaterial){for(var r=0;r<u.length;r++)n.push(t[u[r]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.onBeforeCompile.toString()),n.join()},this.acquireProgram=function(t,n){for(var r,a=0,o=i.length;a<o;a++){var s=i[a];if(s.cacheKey===n){++(r=s).usedTimes;break}}return void 0===r&&(r=new Wi(e,n,t),i.push(r)),r},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=i.indexOf(e);i[t]=i[i.length-1],i.pop(),e.destroy()}},this.programs=i}function Xi(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function Yi(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Ji(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Zi(){var e=[],t=0,n=[],i=[],r={id:-1};function a(n,i,a,o,s,l){var c=e[t];return void 0===c?(c={id:n.id,object:n,geometry:i,material:a,program:a.program||r,groupOrder:o,renderOrder:n.renderOrder,z:s,group:l},e[t]=c):(c.id=n.id,c.object=n,c.geometry=i,c.material=a,c.program=a.program||r,c.groupOrder=o,c.renderOrder=n.renderOrder,c.z=s,c.group=l),t++,c}return{opaque:n,transparent:i,init:function(){t=0,n.length=0,i.length=0},push:function(e,t,r,o,s,l){var c=a(e,t,r,o,s,l);(!0===r.transparent?i:n).push(c)},unshift:function(e,t,r,o,s,l){var c=a(e,t,r,o,s,l);(!0===r.transparent?i:n).unshift(c)},finish:function(){for(var n=t,i=e.length;n<i;n++){var r=e[n];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.program=null,r.group=null}},sort:function(e,t){n.length>1&&n.sort(e||Yi),i.length>1&&i.sort(t||Ji)}}}function Ki(){var e=new WeakMap;function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}return{get:function(n,i){var r,a=e.get(n);return void 0===a?(r=new Zi,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):void 0===(r=a.get(i))&&(r=new Zi,a.set(i,r)),r},dispose:function(){e=new WeakMap}}}function Qi(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new D,color:new Ke};break;case"SpotLight":n={position:new D,direction:new D,color:new Ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new D,color:new Ke,distance:0,decay:0};break;case"HemisphereLight":n={direction:new D,skyColor:new Ke,groundColor:new Ke};break;case"RectAreaLight":n={color:new Ke,position:new D,halfWidth:new D,halfHeight:new D}}return e[t.id]=n,n}}}var $i=0;function er(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function tr(){for(var e,t=new Qi,n=(e={},{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new M};break;case"PointLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new M,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=0;r<9;r++)i.probe.push(new D);var a=new D,o=new k,s=new k;return{setup:function(e,r,l){for(var c=0,h=0,u=0,p=0;p<9;p++)i.probe[p].set(0,0,0);var d=0,f=0,m=0,g=0,v=0,y=0,x=0,b=0,w=l.matrixWorldInverse;e.sort(er),p=0;for(var _=e.length;p<_;p++){var M=e[p],S=M.color,T=M.intensity,E=M.distance,A=M.shadow&&M.shadow.map?M.shadow.map.texture:null;if(M.isAmbientLight)c+=S.r*T,h+=S.g*T,u+=S.b*T;else if(M.isLightProbe)for(var L=0;L<9;L++)i.probe[L].addScaledVector(M.sh.coefficients[L],T);else if(M.isDirectionalLight){if((C=t.get(M)).color.copy(M.color).multiplyScalar(M.intensity),C.direction.setFromMatrixPosition(M.matrixWorld),a.setFromMatrixPosition(M.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(w),M.castShadow){var R=M.shadow;(P=n.get(M)).shadowBias=R.bias,P.shadowRadius=R.radius,P.shadowMapSize=R.mapSize,i.directionalShadow[d]=P,i.directionalShadowMap[d]=A,i.directionalShadowMatrix[d]=M.shadow.matrix,y++}i.directional[d]=C,d++}else if(M.isSpotLight){if((C=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(w),C.color.copy(S).multiplyScalar(T),C.distance=E,C.direction.setFromMatrixPosition(M.matrixWorld),a.setFromMatrixPosition(M.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(w),C.coneCos=Math.cos(M.angle),C.penumbraCos=Math.cos(M.angle*(1-M.penumbra)),C.decay=M.decay,M.castShadow){R=M.shadow;(P=n.get(M)).shadowBias=R.bias,P.shadowRadius=R.radius,P.shadowMapSize=R.mapSize,i.spotShadow[m]=P,i.spotShadowMap[m]=A,i.spotShadowMatrix[m]=M.shadow.matrix,b++}i.spot[m]=C,m++}else if(M.isRectAreaLight){(C=t.get(M)).color.copy(S).multiplyScalar(T),C.position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(w),s.identity(),o.copy(M.matrixWorld),o.premultiply(w),s.extractRotation(o),C.halfWidth.set(.5*M.width,0,0),C.halfHeight.set(0,.5*M.height,0),C.halfWidth.applyMatrix4(s),C.halfHeight.applyMatrix4(s),i.rectArea[g]=C,g++}else if(M.isPointLight){if((C=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(w),C.color.copy(M.color).multiplyScalar(M.intensity),C.distance=M.distance,C.decay=M.decay,M.castShadow){var P;R=M.shadow;(P=n.get(M)).shadowBias=R.bias,P.shadowRadius=R.radius,P.shadowMapSize=R.mapSize,P.shadowCameraNear=R.camera.near,P.shadowCameraFar=R.camera.far,i.pointShadow[f]=P,i.pointShadowMap[f]=A,i.pointShadowMatrix[f]=M.shadow.matrix,x++}i.point[f]=C,f++}else if(M.isHemisphereLight){var C;(C=t.get(M)).direction.setFromMatrixPosition(M.matrixWorld),C.direction.transformDirection(w),C.direction.normalize(),C.skyColor.copy(M.color).multiplyScalar(T),C.groundColor.copy(M.groundColor).multiplyScalar(T),i.hemi[v]=C,v++}}i.ambient[0]=c,i.ambient[1]=h,i.ambient[2]=u;var O=i.hash;O.directionalLength===d&&O.pointLength===f&&O.spotLength===m&&O.rectAreaLength===g&&O.hemiLength===v&&O.numDirectionalShadows===y&&O.numPointShadows===x&&O.numSpotShadows===b||(i.directional.length=d,i.spot.length=m,i.rectArea.length=g,i.point.length=f,i.hemi.length=v,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=x,i.pointShadowMap.length=x,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=x,i.spotShadowMatrix.length=b,O.directionalLength=d,O.pointLength=f,O.spotLength=m,O.rectAreaLength=g,O.hemiLength=v,O.numDirectionalShadows=y,O.numPointShadows=x,O.numSpotShadows=b,i.version=$i++)},state:i}}function nr(){var e=new tr,t=[],n=[];return{init:function(){t.length=0,n.length=0},state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:function(i){e.setup(t,n,i)},pushLight:function(e){t.push(e)},pushShadow:function(e){n.push(e)}}}function ir(){var e=new WeakMap;function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}return{get:function(n,i){var r;return!1===e.has(n)?(r=new nr,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):!1===e.get(n).has(i)?(r=new nr,e.get(n).set(i,r)):r=e.get(n).get(i),r},dispose:function(){e=new WeakMap}}}function rr(e){it.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function ar(e){it.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new D,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}rr.prototype=Object.create(it.prototype),rr.prototype.constructor=rr,rr.prototype.isMeshDepthMaterial=!0,rr.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},ar.prototype=Object.create(it.prototype),ar.prototype.constructor=ar,ar.prototype.isMeshDistanceMaterial=!0,ar.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};function or(e,t,n){var i=new hn,r=new M,a=new M,o=new L,s=[],l=[],c={},h={0:1,1:0,2:2},u=new tn({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new M},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=u.clone();p.defines.HORIZONAL_PASS=1;var d=new Tt;d.setAttribute("position",new ot(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var f=new Vt(d,u),m=this;function g(n,i){var r=t.update(f);u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,u,f,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,p,f,null)}function v(e,t,n){var i=e<<0|t<<1|n<<2,r=s[i];return void 0===r&&(r=new rr({depthPacking:3201,morphTargets:e,skinning:t}),s[i]=r),r}function y(e,t,n){var i=e<<0|t<<1|n<<2,r=l[i];return void 0===r&&(r=new ar({morphTargets:e,skinning:t}),l[i]=r),r}function x(t,n,i,r,a,o,s){var l=null,u=v,p=t.customDepthMaterial;if(!0===r.isPointLight&&(u=y,p=t.customDistanceMaterial),void 0===p){var d=!1;!0===i.morphTargets&&(d=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var f=!1;!0===t.isSkinnedMesh&&(!0===i.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),l=u(d,f,!0===t.isInstancedMesh)}else l=p;if(e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var m=l.uuid,g=i.uuid,x=c[m];void 0===x&&(x={},c[m]=x);var b=x[g];void 0===b&&(b=l.clone(),x[g]=b),l=b}return l.visible=i.visible,l.wireframe=i.wireframe,l.side=3===s?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:h[i.side],l.clipShadows=i.clipShadows,l.clippingPlanes=i.clippingPlanes,l.clipIntersection=i.clipIntersection,l.wireframeLinewidth=i.wireframeLinewidth,l.linewidth=i.linewidth,!0===r.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(r.matrixWorld),l.nearDistance=a,l.farDistance=o),l}function b(n,r,a,o,s){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),c=n.material;if(Array.isArray(c))for(var h=l.groups,u=0,p=h.length;u<p;u++){var d=h[u],f=c[d.materialIndex];if(f&&f.visible){var m=x(n,l,f,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,m,n,d)}}else if(c.visible){m=x(n,l,c,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,m,n,null)}}for(var g=n.children,v=0,y=g.length;v<y;v++)b(g[v],r,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,s,l){if(!1!==m.enabled&&(!1!==m.autoUpdate||!1!==m.needsUpdate)&&0!==t.length){var c=e.getRenderTarget(),h=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),p=e.state;p.setBlending(0),p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);for(var d=0,f=t.length;d<f;d++){var v=t[d],y=v.shadow;if(void 0!==y){r.copy(y.mapSize);var x=y.getFrameExtents();if(r.multiply(x),a.copy(y.mapSize),(r.x>n||r.y>n)&&(r.x>n&&(a.x=Math.floor(n/x.x),r.x=a.x*x.x,y.mapSize.x=a.x),r.y>n&&(a.y=Math.floor(n/x.y),r.y=a.y*x.y,y.mapSize.y=a.y)),null===y.map&&!y.isPointLightShadow&&3===this.type){var w={minFilter:1006,magFilter:1006,format:1023};y.map=new R(r.x,r.y,w),y.map.texture.name=v.name+".shadowMap",y.mapPass=new R(r.x,r.y,w),y.camera.updateProjectionMatrix()}if(null===y.map){w={minFilter:1003,magFilter:1003,format:1023};y.map=new R(r.x,r.y,w),y.map.texture.name=v.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var _=y.getViewportCount(),M=0;M<_;M++){var S=y.getViewport(M);o.set(a.x*S.x,a.y*S.y,a.x*S.z,a.y*S.w),p.viewport(o),y.updateMatrices(v,M),i=y.getFrustum(),b(s,l,y.camera,v,this.type)}y.isPointLightShadow||3!==this.type||g(y,l)}else console.warn("THREE.WebGLShadowMap:",v,"has no shadow.")}m.needsUpdate=!1,e.setRenderTarget(c,h,u)}}}function sr(e,t,n){var i=n.isWebGL2;var r=new function(){var t=!1,n=new L,i=null,r=new L(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},a=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(e){e?B(2929):H(2929)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},o=new function(){var t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(e){t||(e?B(2960):H(2960))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null}}},s=e.getParameter(34921),l=new Uint8Array(s),c=new Uint8Array(s),h=new Uint8Array(s),u={},p=null,d=null,f=null,m=null,g=null,v=null,y=null,x=null,b=null,w=!1,_=null,M=null,S=null,T=null,E=null,A=e.getParameter(35661),R=!1,P=0,C=e.getParameter(7938);-1!==C.indexOf("WebGL")?(P=parseFloat(/^WebGL\ ([0-9])/.exec(C)[1]),R=P>=1):-1!==C.indexOf("OpenGL ES")&&(P=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(C)[1]),R=P>=2);var O=null,I={},D=new L,N=new L;function z(t,n,i){var r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<i;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,r);return a}var U={};function F(n,r){(l[n]=1,0===c[n]&&(e.enableVertexAttribArray(n),c[n]=1),h[n]!==r)&&((i?e:t.get("ANGLE_instanced_arrays"))[i?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),h[n]=r)}function B(t){!0!==u[t]&&(e.enable(t),u[t]=!0)}function H(t){!1!==u[t]&&(e.disable(t),u[t]=!1)}U[3553]=z(3553,3553,1),U[34067]=z(34067,34069,6),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),B(2929),a.setFunc(3),W(!1),q(1),B(2884),j(0);var G={100:32774,101:32778,102:32779};if(i)G[103]=32775,G[104]=32776;else{var k=t.get("EXT_blend_minmax");null!==k&&(G[103]=k.MIN_EXT,G[104]=k.MAX_EXT)}var V={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function j(t,n,i,r,a,o,s,l){if(0!==t){if(d||(B(3042),d=!0),5===t)a=a||n,o=o||i,s=s||r,n===m&&a===y||(e.blendEquationSeparate(G[n],G[a]),m=n,y=a),i===g&&r===v&&o===x&&s===b||(e.blendFuncSeparate(V[i],V[r],V[o],V[s]),g=i,v=r,x=o,b=s),f=t,w=null;else if(t!==f||l!==w){if(100===m&&100===y||(e.blendEquation(32774),m=100,y=100),l)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,0,769,771);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFunc(0,769);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}g=null,v=null,x=null,b=null,f=t,w=l}}else d&&(H(3042),d=!1)}function W(t){_!==t&&(t?e.frontFace(2304):e.frontFace(2305),_=t)}function q(t){0!==t?(B(2884),t!==M&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):H(2884),M=t}function X(t,n,i){t?(B(32823),T===n&&E===i||(e.polygonOffset(n,i),T=n,E=i)):H(32823)}function Y(t){void 0===t&&(t=33984+A-1),O!==t&&(e.activeTexture(t),O=t)}return{buffers:{color:r,depth:a,stencil:o},initAttributes:function(){for(var e=0,t=l.length;e<t;e++)l[e]=0},enableAttribute:function(e){F(e,0)},enableAttributeAndDivisor:F,disableUnusedAttributes:function(){for(var t=0,n=c.length;t!==n;++t)c[t]!==l[t]&&(e.disableVertexAttribArray(t),c[t]=0)},vertexAttribPointer:function(t,n,r,a,o,s){!0!==i||5124!==r&&5125!==r?e.vertexAttribPointer(t,n,r,a,o,s):e.vertexAttribIPointer(t,n,r,a,o,s)},enable:B,disable:H,useProgram:function(t){return p!==t&&(e.useProgram(t),p=t,!0)},setBlending:j,setMaterial:function(e,t){2===e.side?H(2884):B(2884);var n=1===e.side;t&&(n=!n),W(n),1===e.blending&&!1===e.transparent?j(0):j(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),r.setMask(e.colorWrite);var i=e.stencilWrite;o.setTest(i),i&&(o.setMask(e.stencilWriteMask),o.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),o.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),X(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:W,setCullFace:q,setLineWidth:function(t){t!==S&&(R&&e.lineWidth(t),S=t)},setPolygonOffset:X,setScissorTest:function(e){e?B(3089):H(3089)},activeTexture:Y,bindTexture:function(t,n){null===O&&Y();var i=I[O];void 0===i&&(i={type:void 0,texture:void 0},I[O]=i),i.type===t&&i.texture===n||(e.bindTexture(t,n||U[t]),i.type=t,i.texture=n)},unbindTexture:function(){var t=I[O];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===D.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),D.copy(t))},viewport:function(t){!1===N.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),N.copy(t))},reset:function(){for(var t=0;t<c.length;t++)1===c[t]&&(e.disableVertexAttribArray(t),c[t]=0);u={},O=null,I={},p=null,f=null,_=null,M=null,r.reset(),a.reset(),o.reset()}}}function lr(e,t,n,i,r,a,o){var s,l=r.isWebGL2,c=r.maxTextures,h=r.maxCubemapSize,u=r.maxTextureSize,p=r.maxSamples,d=new WeakMap,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function m(e,t){return f?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function g(e,t,n,i){var r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?_.floorPowerOfTwo:Math.floor,o=a(r*e.width),l=a(r*e.height);void 0===s&&(s=m(o,l));var c=n?m(o,l):s;return c.width=o,c.height=l,c.getContext("2d").drawImage(e,0,0,o,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+l+")."),c}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function v(e){return _.isPowerOfTwo(e.width)&&_.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function x(t,n,r,a){e.generateMipmap(t),i.get(n).__maxMipLevel=Math.log(Math.max(r,a))*Math.LOG2E}function b(n,i,r){if(!1===l)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var a=i;return 6403===i&&(5126===r&&(a=33326),5131===r&&(a=33325),5121===r&&(a=33321)),6407===i&&(5126===r&&(a=34837),5131===r&&(a=34843),5121===r&&(a=32849)),6408===i&&(5126===r&&(a=34836),5131===r&&(a=34842),5121===r&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||t.get("EXT_color_buffer_float"),a}function w(e){return 1003===e||1004===e||1005===e?9728:9729}function M(t){var n=t.target;n.removeEventListener("dispose",M),function(t){var n=i.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),i.remove(t)}(n),n.isVideoTexture&&d.delete(n),o.memory.textures--}function S(t){var n=t.target;n.removeEventListener("dispose",S),function(t){var n=i.get(t),r=i.get(t.texture);if(!t)return;void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);i.remove(t.texture),i.remove(t)}(n),o.memory.textures--}var T=0;function E(e,t){var r=i.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;d.get(e)!==t&&(d.set(e,t),e.update())}(e),e.version>0&&r.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void I(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}function A(t,r){if(6===t.image.length){var o=i.get(t);if(t.version>0&&o.__version!==t.version){O(o,t),n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),c=t.image[0]&&t.image[0].isDataTexture,u=[],p=0;p<6;p++)u[p]=s||c?c?t.image[p].image:t.image[p]:g(t.image[p],!1,!0,h);var d,f=u[0],m=v(f)||l,w=a.convert(t.format),_=a.convert(t.type),M=b(t.internalFormat,w,_);if(C(34067,t,m),s){for(p=0;p<6;p++){d=u[p].mipmaps;for(var S=0;S<d.length;S++){var T=d[S];1023!==t.format&&1022!==t.format?null!==w?n.compressedTexImage2D(34069+p,S,M,T.width,T.height,0,T.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+p,S,M,T.width,T.height,0,w,_,T.data)}}o.__maxMipLevel=d.length-1}else{d=t.mipmaps;for(p=0;p<6;p++)if(c){n.texImage2D(34069+p,0,M,u[p].width,u[p].height,0,w,_,u[p].data);for(S=0;S<d.length;S++){var E=(T=d[S]).image[p].image;n.texImage2D(34069+p,S+1,M,E.width,E.height,0,w,_,E.data)}}else{n.texImage2D(34069+p,0,M,w,_,u[p]);for(S=0;S<d.length;S++){T=d[S];n.texImage2D(34069+p,S+1,M,w,_,T.image[p])}}o.__maxMipLevel=d.length}y(t,m)&&x(34067,t,f.width,f.height),o.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture)}}function L(e,t){n.activeTexture(33984+t),n.bindTexture(34067,i.get(e).__webglTexture)}var R={1e3:10497,1001:33071,1002:33648},P={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function C(n,a,o){o?(e.texParameteri(n,10242,R[a.wrapS]),e.texParameteri(n,10243,R[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,R[a.wrapR]),e.texParameteri(n,10240,P[a.magFilter]),e.texParameteri(n,10241,P[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),1001===a.wrapS&&1001===a.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,w(a.magFilter)),e.texParameteri(n,10241,w(a.minFilter)),1003!==a.minFilter&&1006!==a.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var s=t.get("EXT_texture_filter_anisotropic");if(s){if(1015===a.type&&null===t.get("OES_texture_float_linear"))return;if(1016===a.type&&null===(l||t.get("OES_texture_half_float_linear")))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function O(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",M),t.__webglTexture=e.createTexture(),o.memory.textures++)}function I(t,i,r){var o=3553;i.isDataTexture2DArray&&(o=35866),i.isDataTexture3D&&(o=32879),O(t,i),n.activeTexture(33984+r),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment);var s=function(e){return!l&&(1001!==e.wrapS||1001!==e.wrapT||1003!==e.minFilter&&1006!==e.minFilter)}(i)&&!1===v(i.image),c=g(i.image,s,!1,u),h=v(c)||l,p=a.convert(i.format),d=a.convert(i.type),f=b(i.internalFormat,p,d);C(o,i,h);var m,w=i.mipmaps;if(i.isDepthTexture)f=6402,l?f=1015===i.type?36012:1014===i.type?33190:1020===i.type?35056:33189:1015===i.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===i.format&&6402===f&&1012!==i.type&&1014!==i.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=1012,d=a.convert(i.type)),1027===i.format&&6402===f&&(f=34041,1020!==i.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=1020,d=a.convert(i.type))),n.texImage2D(3553,0,f,c.width,c.height,0,p,d,null);else if(i.isDataTexture)if(w.length>0&&h){for(var _=0,M=w.length;_<M;_++)m=w[_],n.texImage2D(3553,_,f,m.width,m.height,0,p,d,m.data);i.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,f,c.width,c.height,0,p,d,c.data),t.__maxMipLevel=0;else if(i.isCompressedTexture){for(_=0,M=w.length;_<M;_++)m=w[_],1023!==i.format&&1022!==i.format?null!==p?n.compressedTexImage2D(3553,_,f,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,_,f,m.width,m.height,0,p,d,m.data);t.__maxMipLevel=w.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,f,c.width,c.height,c.depth,0,p,d,c.data),t.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,f,c.width,c.height,c.depth,0,p,d,c.data),t.__maxMipLevel=0;else if(w.length>0&&h){for(_=0,M=w.length;_<M;_++)m=w[_],n.texImage2D(3553,_,f,p,d,m);i.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,f,p,d,c),t.__maxMipLevel=0;y(i,h)&&x(o,i,c.width,c.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}function D(t,r,o,s){var l=a.convert(r.texture.format),c=a.convert(r.texture.type),h=b(r.texture.internalFormat,l,c);n.texImage2D(s,0,h,r.width,r.height,0,l,c,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,i.get(r.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function N(t,n,i){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var r=33189;if(i){var o=n.depthTexture;o&&o.isDepthTexture&&(1015===o.type?r=36012:1014===o.type&&(r=33190));var s=U(n);e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(i){s=U(n);e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var l=a.convert(n.texture.format),c=a.convert(n.texture.type);r=b(n.texture.internalFormat,l,c);if(i){s=U(n);e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height)}e.bindRenderbuffer(36161,null)}function z(t){var n=i.get(t),r=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),E(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(1026===n.depthTexture.format)e.framebufferTexture2D(36160,36096,3553,r,0);else{if(1027!==n.depthTexture.format)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,r,0)}}(n.__webglFramebuffer,t)}else if(r){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),N(n.__webglDepthbuffer[a],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),N(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function U(e){return l&&e.isWebGLMultisampleRenderTarget?Math.min(p,e.samples):0}var F=!1,B=!1;this.allocateTextureUnit=function(){var e=T;return e>=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),T+=1,e},this.resetTextureUnits=function(){T=0},this.setTexture2D=E,this.setTexture2DArray=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?I(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?I(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=A,this.setTextureCubeDynamic=L,this.setupRenderTarget=function(t){var r=i.get(t),s=i.get(t.texture);t.addEventListener("dispose",S),s.__webglTexture=e.createTexture(),o.memory.textures++;var c=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultisampleRenderTarget,u=v(t)||l;if(!l||1022!==t.texture.format||1015!==t.texture.type&&1016!==t.texture.type||(t.texture.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){r.__webglFramebuffer=[];for(var p=0;p<6;p++)r.__webglFramebuffer[p]=e.createFramebuffer()}else if(r.__webglFramebuffer=e.createFramebuffer(),h)if(l){r.__webglMultisampledFramebuffer=e.createFramebuffer(),r.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,r.__webglColorRenderbuffer);var d=a.convert(t.texture.format),f=a.convert(t.texture.type),m=b(t.texture.internalFormat,d,f),g=U(t);e.renderbufferStorageMultisample(36161,g,m,t.width,t.height),e.bindFramebuffer(36160,r.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,r.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(r.__webglDepthRenderbuffer=e.createRenderbuffer(),N(r.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,s.__webglTexture),C(34067,t.texture,u);for(p=0;p<6;p++)D(r.__webglFramebuffer[p],t,36064,34069+p);y(t.texture,u)&&x(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,s.__webglTexture),C(3553,t.texture,u),D(r.__webglFramebuffer,t,36064,3553),y(t.texture,u)&&x(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&z(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(y(t,v(e)||l)){var r=e.isWebGLCubeRenderTarget?34067:3553,a=i.get(t).__webglTexture;n.bindTexture(r,a),x(r,t,e.width,e.height),n.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(l){var n=i.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var r=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,r,a,0,0,r,a,o,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),F=!0),e=e.texture),E(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),B=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?A(e,t):L(e,t)}}function cr(e,t,n){var i=n.isWebGL2;return{convert:function(e){var n;if(1009===e)return 5121;if(1017===e)return 32819;if(1018===e)return 32820;if(1019===e)return 33635;if(1010===e)return 5120;if(1011===e)return 5122;if(1012===e)return 5123;if(1013===e)return 5124;if(1014===e)return 5125;if(1015===e)return 5126;if(1016===e)return i?5131:null!==(n=t.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(1021===e)return 6406;if(1022===e)return 6407;if(1023===e)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(1026===e)return 6402;if(1027===e)return 34041;if(1028===e)return 6403;if(1029===e)return 36244;if(1030===e)return 33319;if(1031===e)return 33320;if(1032===e)return 36248;if(1033===e)return 36249;if(33776===e||33777===e||33778===e||33779===e){if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===e)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===e||35841===e||35842===e||35843===e){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===e)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===e)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===e)return null!==(n=t.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===e||37496===e)&&null!==(n=t.get("WEBGL_compressed_texture_etc"))){if(37492===e)return n.COMPRESSED_RGB8_ETC2;if(37496===e)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e||37840===e||37841===e||37842===e||37843===e||37844===e||37845===e||37846===e||37847===e||37848===e||37849===e||37850===e||37851===e||37852===e||37853===e?null!==(n=t.get("WEBGL_compressed_texture_astc"))?e:null:36492===e?null!==(n=t.get("EXT_texture_compression_bptc"))?e:null:1020===e?i?34042:null!==(n=t.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function hr(e){rn.call(this),this.cameras=e||[]}function ur(){oe.call(this),this.type="Group"}function pr(){this._targetRay=null,this._grip=null}function dr(e,t){var n=this,i=null,r=1,a=null,o="local-floor",s=null,l=[],c=new Map,h=new rn;h.layers.enable(1),h.viewport=new L;var u=new rn;u.layers.enable(2),u.viewport=new L;var p=[h,u],d=new hr;d.layers.enable(1),d.layers.enable(2);var f=null,m=null;function g(e){var t=c.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function v(){c.forEach((function(e,t){e.disconnect(t)})),c.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),S.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(e){a=e,S.setContext(i),S.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}function x(e){for(var t=i.inputSources,n=0;n<l.length;n++)c.set(t[n],l[n]);for(n=0;n<e.removed.length;n++){var r=e.removed[n];(a=c.get(r))&&(a.dispatchEvent({type:"disconnected",data:r}),c.delete(r))}for(n=0;n<e.added.length;n++){var a;r=e.added[n];(a=c.get(r))&&a.dispatchEvent({type:"connected",data:r})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=l[e];return void 0===t&&(t=new pr,l[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=l[e];return void 0===t&&(t=new pr,l[e]=t),t.getGripSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getSession=function(){return i},this.setSession=function(e){if(null!==(i=e)){i.addEventListener("select",g),i.addEventListener("selectstart",g),i.addEventListener("selectend",g),i.addEventListener("squeeze",g),i.addEventListener("squeezestart",g),i.addEventListener("squeezeend",g),i.addEventListener("end",v);var n=t.getContextAttributes();!0!==n.xrCompatible&&t.makeXRCompatible();var a={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:r},s=new XRWebGLLayer(i,t,a);i.updateRenderState({baseLayer:s}),i.requestReferenceSpace(o).then(y),i.addEventListener("inputsourceschange",x)}};var b=new D,w=new D;function _(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){d.near=u.near=h.near=e.near,d.far=u.far=h.far=e.far,f===d.near&&m===d.far||(i.updateRenderState({depthNear:d.near,depthFar:d.far}),f=d.near,m=d.far);var t=e.parent,n=d.cameras;_(d,t);for(var r=0;r<n.length;r++)_(n[r],t);e.matrixWorld.copy(d.matrixWorld);for(var a=e.children,o=(r=0,a.length);r<o;r++)a[r].updateMatrixWorld(!0);return 2===n.length?function(e,t,n){b.setFromMatrixPosition(t.matrixWorld),w.setFromMatrixPosition(n.matrixWorld);var i=b.distanceTo(w),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(a[8]+1)/a[0],p=o*h,d=o*u,f=i/(-h+u),m=f*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=o+f,v=s+f,y=p-m,x=d+(i-m),_=l*s/v*g,M=c*s/v*g;e.projectionMatrix.makePerspective(y,x,_,M,g,v)}(d,h,u):d.projectionMatrix.copy(h.projectionMatrix),d};var M=null;var S=new pn;S.setAnimationLoop((function(t,n){if(null!==(s=n.getViewerPose(a))){var r=s.views,o=i.renderState.baseLayer;e.setFramebuffer(o.framebuffer);var c=!1;r.length!==d.cameras.length&&(d.cameras.length=0,c=!0);for(var h=0;h<r.length;h++){var u=r[h],f=o.getViewport(u),m=p[h];m.matrix.fromArray(u.transform.matrix),m.projectionMatrix.fromArray(u.projectionMatrix),m.viewport.set(f.x,f.y,f.width,f.height),0===h&&d.matrix.copy(m.matrix),!0===c&&d.cameras.push(m)}}var g=i.inputSources;for(h=0;h<l.length;h++){var v=l[h],y=g[h];v.update(y,n,a)}M&&M(t,n)})),this.setAnimationLoop=function(e){M=e},this.dispose=function(){}}function fr(e){function t(t,n,i){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);var r,a,o=n.envMap||i;o&&(t.envMap.value=o,t.flipEnvMap.value=o.isCubeTexture?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio,t.maxMipLevel.value=e.get(o).__maxMipLevel),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap&&(r=n.emissiveMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix)),n.aoMap?a=n.aoMap:n.lightMap&&(a=n.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),t.uv2Transform.value.copy(a.matrix))}function n(e,t,n){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,i,r,a,o){i.isMeshBasicMaterial?t(e,i):i.isMeshLambertMaterial?(t(e,i),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,i)):i.isMeshToonMaterial?(t(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshPhongMaterial?(t(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshStandardMaterial?(t(e,i,r),i.isMeshPhysicalMaterial?function(e,t,i){n(e,t,i),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap);t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate());e.transparency.value=t.transparency}(e,i,r):n(e,i,r)):i.isMeshMatcapMaterial?(t(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDepthMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDistanceMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?(t(e,i),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var r;t.map?r=t.map:t.alphaMap&&(r=t.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i,a,o):i.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function mr(e){var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,u=null,p=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var d,f,m,g,v,y,x,b,w,S,T,E,A,R,P,C,O,I,N,z=this,U=!1,F=null,B=0,H=0,G=null,V=null,j=-1,W={geometry:null,program:null,wireframe:!1},q=null,X=null,Y=new L,J=new L,Z=null,K=t.width,Q=t.height,$=1,ee=null,te=null,ne=new L(0,0,K,Q),ie=new L(0,0,K,Q),re=!1,ae=new hn,oe=new wn,le=!1,ce=!1,he=new k,ue=new D;function pe(){return null===G?$:1}try{var de={alpha:i,depth:r,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if(t.addEventListener("webglcontextlost",ve,!1),t.addEventListener("webglcontextrestored",ye,!1),null===(d=n||t.getContext("webgl",de)||t.getContext("experimental-webgl",de)))throw null!==t.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===d.getShaderPrecisionFormat&&(d.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function fe(){f=new _n(d),!1===(m=new bn(d,f,e)).isWebGL2&&(f.get("WEBGL_depth_texture"),f.get("OES_texture_float"),f.get("OES_texture_half_float"),f.get("OES_texture_half_float_linear"),f.get("OES_standard_derivatives"),f.get("OES_element_index_uint"),f.get("ANGLE_instanced_arrays")),f.get("OES_texture_float_linear"),N=new cr(d,f,m),(g=new sr(d,f,m)).scissor(J.copy(ie).multiplyScalar($).floor()),g.viewport(Y.copy(ne).multiplyScalar($).floor()),v=new Tn(d),y=new Xi,x=new lr(d,f,g,y,m,N,v),b=new dn(d,m),w=new Mn(d,b,v),S=new Ln(d,w,b,v),C=new An(d),T=new qi(z,f,m),E=new fr(y),A=new Ki,R=new ir,P=new yn(z,g,S,s),O=new xn(d,f,v,m),I=new Sn(d,f,v,m),v.programs=T.programs,z.capabilities=m,z.extensions=f,z.properties=y,z.renderLists=A,z.state=g,z.info=v}fe();var me=new dr(z,d);this.xr=me;var ge=new or(z,S,m.maxTextureSize);function ve(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),U=!0}function ye(){console.log("THREE.WebGLRenderer: Context Restored."),U=!1,fe()}function xe(e){var t=e.target;t.removeEventListener("dispose",xe),function(e){be(e),y.remove(e)}(t)}function be(e){var t=y.get(e).program;e.program=void 0,void 0!==t&&T.releaseProgram(t)}this.shadowMap=ge,this.getContext=function(){return d},this.getContextAttributes=function(){return d.getContextAttributes()},this.forceContextLoss=function(){var e=f.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=f.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return $},this.setPixelRatio=function(e){void 0!==e&&($=e,this.setSize(K,Q,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new M),e.set(K,Q)},this.setSize=function(e,n,i){me.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(K=e,Q=n,t.width=Math.floor(e*$),t.height=Math.floor(n*$),!1!==i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new M),e.set(K*$,Q*$).floor()},this.setDrawingBufferSize=function(e,n,i){K=e,Q=n,$=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new L),e.copy(Y)},this.getViewport=function(e){return e.copy(ne)},this.setViewport=function(e,t,n,i){e.isVector4?ne.set(e.x,e.y,e.z,e.w):ne.set(e,t,n,i),g.viewport(Y.copy(ne).multiplyScalar($).floor())},this.getScissor=function(e){return e.copy(ie)},this.setScissor=function(e,t,n,i){e.isVector4?ie.set(e.x,e.y,e.z,e.w):ie.set(e,t,n,i),g.scissor(J.copy(ie).multiplyScalar($).floor())},this.getScissorTest=function(){return re},this.setScissorTest=function(e){g.setScissorTest(re=e)},this.setOpaqueSort=function(e){ee=e},this.setTransparentSort=function(e){te=e},this.getClearColor=function(){return P.getClearColor()},this.setClearColor=function(){P.setClearColor.apply(P,arguments)},this.getClearAlpha=function(){return P.getClearAlpha()},this.setClearAlpha=function(){P.setClearAlpha.apply(P,arguments)},this.clear=function(e,t,n){var i=0;(void 0===e||e)&&(i|=16384),(void 0===t||t)&&(i|=256),(void 0===n||n)&&(i|=1024),d.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ve,!1),t.removeEventListener("webglcontextrestored",ye,!1),A.dispose(),R.dispose(),y.dispose(),S.dispose(),me.dispose(),Me.stop()},this.renderBufferImmediate=function(e,t){g.initAttributes();var n=y.get(e);e.hasPositions&&!n.position&&(n.position=d.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=d.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=d.createBuffer()),e.hasColors&&!n.color&&(n.color=d.createBuffer());var i=t.getAttributes();e.hasPositions&&(d.bindBuffer(34962,n.position),d.bufferData(34962,e.positionArray,35048),g.enableAttribute(i.position),d.vertexAttribPointer(i.position,3,5126,!1,0,0)),e.hasNormals&&(d.bindBuffer(34962,n.normal),d.bufferData(34962,e.normalArray,35048),g.enableAttribute(i.normal),d.vertexAttribPointer(i.normal,3,5126,!1,0,0)),e.hasUvs&&(d.bindBuffer(34962,n.uv),d.bufferData(34962,e.uvArray,35048),g.enableAttribute(i.uv),d.vertexAttribPointer(i.uv,2,5126,!1,0,0)),e.hasColors&&(d.bindBuffer(34962,n.color),d.bufferData(34962,e.colorArray,35048),g.enableAttribute(i.color),d.vertexAttribPointer(i.color,3,5126,!1,0,0)),g.disableUnusedAttributes(),d.drawArrays(4,0,e.count),e.count=0};var we=new se;this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=we);var o=r.isMesh&&r.matrixWorld.determinant()<0,s=Le(e,t,i,r);g.setMaterial(i,o);var l=!1;W.geometry===n.id&&W.program===s.id&&W.wireframe===(!0===i.wireframe)||(W.geometry=n.id,W.program=s.id,W.wireframe=!0===i.wireframe,l=!0),(i.morphTargets||i.morphNormals)&&(C.update(r,n,i,s),l=!0),!0===r.isInstancedMesh&&(l=!0);var c=n.index,h=n.attributes.position;if(null===c){if(void 0===h||0===h.count)return}else if(0===c.count)return;var u,p=1;!0===i.wireframe&&(c=w.getWireframeAttribute(n),p=2);var v=O;null!==c&&(u=b.get(c),(v=I).setIndex(u)),l&&(!function(e,t,n,i){if(!1===m.isWebGL2&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&null===f.get("ANGLE_instanced_arrays"))return;g.initAttributes();var r=t.attributes,a=i.getAttributes(),o=n.defaultAttributeValues;for(var s in a){var l=a[s];if(l>=0){var c=r[s];if(void 0!==c){var h=c.normalized,u=c.itemSize;if(void 0===(M=b.get(c)))continue;var p=M.buffer,v=M.type,y=M.bytesPerElement;if(c.isInterleavedBufferAttribute){var x=c.data,w=x.stride,_=c.offset;x&&x.isInstancedInterleavedBuffer?(g.enableAttributeAndDivisor(l,x.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=x.meshPerAttribute*x.count)):g.enableAttribute(l),d.bindBuffer(34962,p),g.vertexAttribPointer(l,u,v,h,w*y,_*y)}else c.isInstancedBufferAttribute?(g.enableAttributeAndDivisor(l,c.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=c.meshPerAttribute*c.count)):g.enableAttribute(l),d.bindBuffer(34962,p),g.vertexAttribPointer(l,u,v,h,0,0)}else if("instanceMatrix"===s){var M;if(void 0===(M=b.get(e.instanceMatrix)))continue;p=M.buffer,v=M.type;g.enableAttributeAndDivisor(l+0,1),g.enableAttributeAndDivisor(l+1,1),g.enableAttributeAndDivisor(l+2,1),g.enableAttributeAndDivisor(l+3,1),d.bindBuffer(34962,p),d.vertexAttribPointer(l+0,4,v,!1,64,0),d.vertexAttribPointer(l+1,4,v,!1,64,16),d.vertexAttribPointer(l+2,4,v,!1,64,32),d.vertexAttribPointer(l+3,4,v,!1,64,48)}else if(void 0!==o){var S=o[s];if(void 0!==S)switch(S.length){case 2:d.vertexAttrib2fv(l,S);break;case 3:d.vertexAttrib3fv(l,S);break;case 4:d.vertexAttrib4fv(l,S);break;default:d.vertexAttrib1fv(l,S)}}}}g.disableUnusedAttributes()}(r,n,i,s),null!==c&&d.bindBuffer(34963,u.buffer));var y=null!==c?c.count:h.count,x=n.drawRange.start*p,_=n.drawRange.count*p,M=null!==a?a.start*p:0,S=null!==a?a.count*p:1/0,T=Math.max(x,M),E=Math.min(y,x+_,M+S)-1,A=Math.max(0,E-T+1);if(0!==A){if(r.isMesh)!0===i.wireframe?(g.setLineWidth(i.wireframeLinewidth*pe()),v.setMode(1)):v.setMode(4);else if(r.isLine){var L=i.linewidth;void 0===L&&(L=1),g.setLineWidth(L*pe()),r.isLineSegments?v.setMode(1):r.isLineLoop?v.setMode(2):v.setMode(3)}else r.isPoints?v.setMode(0):r.isSprite&&v.setMode(4);if(r.isInstancedMesh)v.renderInstances(n,T,A,r.count);else if(n.isInstancedBufferGeometry){var R=Math.min(n.instanceCount,n._maxInstanceCount);v.renderInstances(n,T,A,R)}else v.render(T,A)}},this.compile=function(e,t){(p=R.get(e,t)).init(),e.traverse((function(e){e.isLight&&(p.pushLight(e),e.castShadow&&p.pushShadow(e))})),p.setupLights(t);const n={};e.traverse((function(t){let i=t.material;if(i)if(Array.isArray(i))for(let r=0;r<i.length;r++){let a=i[r];a.uuid in n==!1&&(Ae(a,e,t),n[a.uuid]=!0)}else i.uuid in n==!1&&(Ae(i,e,t),n[i.uuid]=!0)}))};var _e=null;var Me=new pn;function Se(e,t,n,i){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)p.pushLight(e),e.castShadow&&p.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ae.intersectsSprite(e)){i&&ue.setFromMatrixPosition(e.matrixWorld).applyMatrix4(he);var r=S.update(e);(a=e.material).visible&&u.push(e,r,a,n,ue.z,null)}}else if(e.isImmediateRenderObject)i&&ue.setFromMatrixPosition(e.matrixWorld).applyMatrix4(he),u.push(e,null,e.material,n,ue.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==v.render.frame&&(e.skeleton.update(),e.skeleton.frame=v.render.frame),!e.frustumCulled||ae.intersectsObject(e))){i&&ue.setFromMatrixPosition(e.matrixWorld).applyMatrix4(he);r=S.update(e);var a=e.material;if(Array.isArray(a))for(var o=r.groups,s=0,l=o.length;s<l;s++){var c=o[s],h=a[c.materialIndex];h&&h.visible&&u.push(e,r,h,n,ue.z,c)}else a.visible&&u.push(e,r,a,n,ue.z,null)}var d=e.children;for(s=0,l=d.length;s<l;s++)Se(d[s],t,n,i)}}function Te(e,t,n,i){for(var r=0,a=e.length;r<a;r++){var o=e[r],s=o.object,l=o.geometry,c=void 0===i?o.material:i,h=o.group;if(n.isArrayCamera){X=n;for(var u=n.cameras,d=0,f=u.length;d<f;d++){var m=u[d];s.layers.test(m.layers)&&(g.viewport(Y.copy(m.viewport)),p.setupLights(m),Ee(s,t,m,l,c,h))}}else X=null,Ee(s,t,n,l,c,h)}}function Ee(e,t,n,i,r,a){if(e.onBeforeRender(z,t,n,i,r,a),p=R.get(t,X||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=Le(n,t,r,e);g.setMaterial(r),W.geometry=null,W.program=null,W.wireframe=!1,function(e,t){e.render((function(e){z.renderBufferImmediate(e,t)}))}(e,o)}else z.renderBufferDirect(n,t,i,r,e,a);e.onAfterRender(z,t,n,i,r,a),p=R.get(t,X||n)}function Ae(e,t,n){var i=y.get(e),r=p.state.lights,a=p.state.shadowsArray,o=r.state.version,s=T.getParameters(e,r.state,a,t,oe.numPlanes,oe.numIntersection,n),l=T.getProgramCacheKey(s),c=i.program,h=!0;if(void 0===c)e.addEventListener("dispose",xe);else if(c.cacheKey!==l)be(e);else if(i.lightsStateVersion!==o)i.lightsStateVersion=o,h=!1;else{if(void 0!==s.shaderID)return;h=!1}h&&(c=T.acquireProgram(s,l),i.program=c,i.uniforms=s.uniforms,i.outputEncoding=s.outputEncoding,e.program=c);var u=c.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var d=0;d<z.maxMorphTargets;d++)u["morphTarget"+d]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(d=0;d<z.maxMorphNormals;d++)u["morphNormal"+d]>=0&&e.numSupportedMorphNormals++}var f=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=oe.numPlanes,i.numIntersection=oe.numIntersection,f.clippingPlanes=oe.uniform),i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=o,i.needsLights&&(f.ambientLightColor.value=r.state.ambient,f.lightProbe.value=r.state.probe,f.directionalLights.value=r.state.directional,f.directionalLightShadows.value=r.state.directionalShadow,f.spotLights.value=r.state.spot,f.spotLightShadows.value=r.state.spotShadow,f.rectAreaLights.value=r.state.rectArea,f.pointLights.value=r.state.point,f.pointLightShadows.value=r.state.pointShadow,f.hemisphereLights.value=r.state.hemi,f.directionalShadowMap.value=r.state.directionalShadowMap,f.directionalShadowMatrix.value=r.state.directionalShadowMatrix,f.spotShadowMap.value=r.state.spotShadowMap,f.spotShadowMatrix.value=r.state.spotShadowMatrix,f.pointShadowMap.value=r.state.pointShadowMap,f.pointShadowMatrix.value=r.state.pointShadowMatrix);var m=i.program.getUniforms(),g=Ei.seqWithValue(m.seq,f);i.uniformsList=g}function Le(e,t,n,i){x.resetTextureUnits();var r=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=null===G?z.outputEncoding:G.texture.encoding,s=y.get(n),l=p.state.lights;if(le&&(ce||e!==q)){var c=e===q&&n.id===j;oe.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,s,c)}n.version===s.__version?void 0===s.program||n.fog&&s.fog!==r||s.environment!==a||s.needsLights&&s.lightsStateVersion!==l.state.version?Ae(n,t,i):void 0===s.numClippingPlanes||s.numClippingPlanes===oe.numPlanes&&s.numIntersection===oe.numIntersection?s.outputEncoding!==o&&Ae(n,t,i):Ae(n,t,i):(Ae(n,t,i),s.__version=n.version);var h,u,f=!1,v=!1,b=!1,w=s.program,M=w.getUniforms(),S=s.uniforms;if(g.useProgram(w.program)&&(f=!0,v=!0,b=!0),n.id!==j&&(j=n.id,v=!0),f||q!==e){if(M.setValue(d,"projectionMatrix",e.projectionMatrix),m.logarithmicDepthBuffer&&M.setValue(d,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),q!==e&&(q=e,v=!0,b=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var T=M.map.cameraPosition;void 0!==T&&T.setValue(d,ue.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&M.setValue(d,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&M.setValue(d,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){M.setOptional(d,i,"bindMatrix"),M.setOptional(d,i,"bindMatrixInverse");var A=i.skeleton;if(A){var L=A.bones;if(m.floatVertexTextures){if(void 0===A.boneTexture){var R=Math.sqrt(4*L.length);R=_.ceilPowerOfTwo(R),R=Math.max(R,4);var P=new Float32Array(R*R*4);P.set(A.boneMatrices);var C=new sn(P,R,R,1023,1015);A.boneMatrices=P,A.boneTexture=C,A.boneTextureSize=R}M.setValue(d,"boneTexture",A.boneTexture,x),M.setValue(d,"boneTextureSize",A.boneTextureSize)}else M.setOptional(d,A,"boneMatrices")}}return(v||s.receiveShadow!==i.receiveShadow)&&(s.receiveShadow=i.receiveShadow,M.setValue(d,"receiveShadow",i.receiveShadow)),v&&(M.setValue(d,"toneMappingExposure",z.toneMappingExposure),M.setValue(d,"toneMappingWhitePoint",z.toneMappingWhitePoint),s.needsLights&&(u=b,(h=S).ambientLightColor.needsUpdate=u,h.lightProbe.needsUpdate=u,h.directionalLights.needsUpdate=u,h.directionalLightShadows.needsUpdate=u,h.pointLights.needsUpdate=u,h.pointLightShadows.needsUpdate=u,h.spotLights.needsUpdate=u,h.spotLightShadows.needsUpdate=u,h.rectAreaLights.needsUpdate=u,h.hemisphereLights.needsUpdate=u),r&&n.fog&&E.refreshFogUniforms(S,r),E.refreshMaterialUniforms(S,n,a,$,Q),void 0!==S.ltc_1&&(S.ltc_1.value=un.LTC_1),void 0!==S.ltc_2&&(S.ltc_2.value=un.LTC_2),Ei.upload(d,s.uniformsList,S,x)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Ei.upload(d,s.uniformsList,S,x),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&M.setValue(d,"center",i.center),M.setValue(d,"modelViewMatrix",i.modelViewMatrix),M.setValue(d,"normalMatrix",i.normalMatrix),M.setValue(d,"modelMatrix",i.matrixWorld),w}Me.setAnimationLoop((function(e){me.isPresenting||_e&&_e(e)})),"undefined"!=typeof window&&Me.setContext(window),this.setAnimationLoop=function(e){_e=e,me.setAnimationLoop(e),Me.start()},this.render=function(e,t){var n,i;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),i=arguments[3]),t&&t.isCamera){if(!U){W.geometry=null,W.program=null,W.wireframe=!1,j=-1,q=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),me.enabled&&me.isPresenting&&(t=me.getCamera(t)),e.onBeforeRender(z,e,t,n||G),(p=R.get(e,t)).init(),he.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ae.setFromProjectionMatrix(he),ce=this.localClippingEnabled,le=oe.init(this.clippingPlanes,ce,t),(u=A.get(e,t)).init(),Se(e,t,0,z.sortObjects),u.finish(),!0===z.sortObjects&&u.sort(ee,te),le&&oe.beginShadows();var r=p.state.shadowsArray;ge.render(r,e,t),p.setupLights(t),le&&oe.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),P.render(u,e,t,i);var a=u.opaque,o=u.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&Te(a,e,t,s),o.length&&Te(o,e,t,s)}else a.length&&Te(a,e,t),o.length&&Te(o,e,t);e.onAfterRender(z,e,t),null!==G&&(x.updateRenderTargetMipmap(G),x.updateMultisampleRenderTarget(G)),g.buffers.depth.setTest(!0),g.buffers.depth.setMask(!0),g.buffers.color.setMask(!0),g.setPolygonOffset(!1),u=null,p=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(e){F!==e&&null===G&&d.bindFramebuffer(36160,e),F=e},this.getActiveCubeFace=function(){return B},this.getActiveMipmapLevel=function(){return H},this.getRenderTarget=function(){return G},this.setRenderTarget=function(e,t,n){G=e,B=t,H=n,e&&void 0===y.get(e).__webglFramebuffer&&x.setupRenderTarget(e);var i=F,r=!1;if(e){var a=y.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=a[t||0],r=!0):i=e.isWebGLMultisampleRenderTarget?y.get(e).__webglMultisampledFramebuffer:a,Y.copy(e.viewport),J.copy(e.scissor),Z=e.scissorTest}else Y.copy(ne).multiplyScalar($).floor(),J.copy(ie).multiplyScalar($).floor(),Z=re;if(V!==i&&(d.bindFramebuffer(36160,i),V=i),g.viewport(Y),g.scissor(J),g.setScissorTest(Z),r){var o=y.get(e.texture);d.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(e&&e.isWebGLRenderTarget){var s=y.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){var l=!1;s!==V&&(d.bindFramebuffer(36160,s),l=!0);try{var c=e.texture,h=c.format,u=c.type;if(1023!==h&&N.convert(h)!==d.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(1009===u||N.convert(u)===d.getParameter(35738)||1015===u&&(m.isWebGL2||f.get("OES_texture_float")||f.get("WEBGL_color_buffer_float"))||1016===u&&(m.isWebGL2?f.get("EXT_color_buffer_float"):f.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===d.checkFramebufferStatus(36160)?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&d.readPixels(t,n,i,r,N.convert(h),N.convert(u),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&d.bindFramebuffer(36160,V)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),o=N.convert(t.format);x.setTexture2D(t,0),d.copyTexImage2D(3553,n,o,e.x,e.y,r,a,0),g.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i){void 0===i&&(i=0);var r=t.image.width,a=t.image.height,o=N.convert(n.format),s=N.convert(n.type);x.setTexture2D(n,0),t.isDataTexture?d.texSubImage2D(3553,i,e.x,e.y,r,a,o,s,t.image.data):t.isCompressedTexture?d.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):d.texSubImage2D(3553,i,e.x,e.y,o,s,t.image),0===i&&n.generateMipmaps&&d.generateMipmap(3553),g.unbindTexture()},this.initTexture=function(e){x.setTexture2D(e,0),g.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function gr(e,t){this.name="",this.color=new Ke(e),this.density=void 0!==t?t:25e-5}function vr(e,t,n){this.name="",this.color=new Ke(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function yr(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}hr.prototype=Object.assign(Object.create(rn.prototype),{constructor:hr,isArrayCamera:!0}),ur.prototype=Object.assign(Object.create(oe.prototype),{constructor:ur,isGroup:!0}),Object.assign(pr.prototype,{constructor:pr,getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new ur,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new ur,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),this},update:function(e,t,n){var i=null,r=null,a=this._targetRay,o=this._grip;return e&&(null!==a&&null!==(i=t.getPose(e.targetRaySpace,n))&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)),null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale))),null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),this}}),Object.assign(dr.prototype,y.prototype),Object.assign(gr.prototype,{isFogExp2:!0,clone:function(){return new gr(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(vr.prototype,{isFog:!0,clone:function(){return new vr(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(yr.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(yr.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});var xr,br=new D;function wr(e,t,n,i){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}function _r(e){it.call(this),this.type="SpriteMaterial",this.color=new Ke(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.defineProperties(wr.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(wr.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)br.x=this.getX(t),br.y=this.getY(t),br.z=this.getZ(t),br.applyMatrix4(e),this.setXYZ(t,br.x,br.y,br.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this},clone:function(){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,i=0;i<this.itemSize;i++)e.push(this.data.array[n+i]);return new ot(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,i=0;i<this.itemSize;i++)e.push(this.data.array[n+i]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}),_r.prototype=Object.create(it.prototype),_r.prototype.constructor=_r,_r.prototype.isSpriteMaterial=!0,_r.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var Mr=new D,Sr=new D,Tr=new D,Er=new M,Ar=new M,Lr=new k,Rr=new D,Pr=new D,Cr=new D,Or=new M,Ir=new M,Dr=new M;function Nr(e){if(oe.call(this),this.type="Sprite",void 0===xr){xr=new Tt;var t=new yr(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);xr.setIndex([0,1,2,0,2,3]),xr.setAttribute("position",new wr(t,3,0,!1)),xr.setAttribute("uv",new wr(t,2,3,!1))}this.geometry=xr,this.material=void 0!==e?e:new _r,this.center=new M(.5,.5)}function zr(e,t,n,i,r,a){Er.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(Ar.x=a*Er.x-r*Er.y,Ar.y=r*Er.x+a*Er.y):Ar.copy(Er),e.copy(t),e.x+=Ar.x,e.y+=Ar.y,e.applyMatrix4(Lr)}Nr.prototype=Object.assign(Object.create(oe.prototype),{constructor:Nr,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Sr.setFromMatrixScale(this.matrixWorld),Lr.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Tr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Sr.multiplyScalar(-Tr.z);var n,i,r=this.material.rotation;0!==r&&(i=Math.cos(r),n=Math.sin(r));var a=this.center;zr(Rr.set(-.5,-.5,0),Tr,a,Sr,n,i),zr(Pr.set(.5,-.5,0),Tr,a,Sr,n,i),zr(Cr.set(.5,.5,0),Tr,a,Sr,n,i),Or.set(0,0),Ir.set(1,0),Dr.set(1,1);var o=e.ray.intersectTriangle(Rr,Pr,Cr,!1,Mr);if(null!==o||(zr(Pr.set(-.5,.5,0),Tr,a,Sr,n,i),Ir.set(0,1),null!==(o=e.ray.intersectTriangle(Rr,Cr,Pr,!1,Mr)))){var s=e.ray.origin.distanceTo(Mr);s<e.near||s>e.far||t.push({distance:s,point:Mr.clone(),uv:Xe.getUV(Mr,Rr,Pr,Cr,Or,Ir,Dr,new M),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return oe.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var Ur,Fr,Br,Hr,Gr,kr=new D,Vr=new D;function jr(){oe.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function Wr(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),Vt.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new k,this.bindMatrixInverse=new k}jr.prototype=Object.assign(Object.create(oe.prototype),{constructor:jr,isLOD:!0,copy:function(e){oe.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n<i;n++){var r=t[n];this.addLevel(r.object.clone(),r.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){kr.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(kr);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){kr.setFromMatrixPosition(e.matrixWorld),Vr.setFromMatrixPosition(this.matrixWorld);var n=kr.distanceTo(Vr)/e.zoom;t[0].object.visible=!0;for(var i=1,r=t.length;i<r&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}},toJSON:function(e){var t=oe.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,i=0,r=n.length;i<r;i++){var a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),Wr.prototype=Object.assign(Object.create(Vt.prototype),{constructor:Wr,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new L,t=this.geometry.attributes.skinWeight,n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){Vt.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:(Ur=new D,Fr=new L,Br=new L,Hr=new D,Gr=new k,function(e,t){var n=this.skeleton,i=this.geometry;Fr.fromBufferAttribute(i.attributes.skinIndex,e),Br.fromBufferAttribute(i.attributes.skinWeight,e),Ur.fromBufferAttribute(i.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var r=0;r<4;r++){var a=Br.getComponent(r);if(0!==a){var o=Fr.getComponent(r);Gr.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Hr.copy(Ur).applyMatrix4(Gr),a)}}return t.applyMatrix4(this.bindMatrixInverse)})});var qr=new k,Xr=new k;function Yr(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new k)}}function Jr(){oe.call(this),this.type="Bone"}Object.assign(Yr.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new k;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture,r=0,a=e.length;r<a;r++){var o=e[r]?e[r].matrixWorld:Xr;qr.multiplyMatrices(o,t[r]),qr.toArray(n,16*r)}void 0!==i&&(i.needsUpdate=!0)},clone:function(){return new Yr(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var i=this.bones[t];if(i.name===e)return i}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),Jr.prototype=Object.assign(Object.create(oe.prototype),{constructor:Jr,isBone:!0});var Zr=new k,Kr=new k,Qr=[],$r=new Vt;function ea(e,t,n){Vt.call(this,e,t),this.instanceMatrix=new ot(new Float32Array(16*n),16),this.count=n,this.frustumCulled=!1}function ta(e){it.call(this),this.type="LineBasicMaterial",this.color=new Ke(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}ea.prototype=Object.assign(Object.create(Vt.prototype),{constructor:ea,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){var n=this.matrixWorld,i=this.count;if($r.geometry=this.geometry,$r.material=this.material,void 0!==$r.material)for(var r=0;r<i;r++){this.getMatrixAt(r,Zr),Kr.multiplyMatrices(n,Zr),$r.matrixWorld=Kr,$r.raycast(e,Qr);for(var a=0,o=Qr.length;a<o;a++){var s=Qr[a];s.instanceId=r,s.object=this,t.push(s)}Qr.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),ta.prototype=Object.create(it.prototype),ta.prototype.constructor=ta,ta.prototype.isLineBasicMaterial=!0,ta.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this};var na=new D,ia=new D,ra=new k,aa=new Oe,oa=new Se;function sa(e,t,n){1===n&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),oe.call(this),this.type="Line",this.geometry=void 0!==e?e:new Tt,this.material=void 0!==t?t:new ta,this.updateMorphTargets()}sa.prototype=Object.assign(Object.create(oe.prototype),{constructor:sa,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],i=1,r=t.count;i<r;i++)na.fromBufferAttribute(t,i-1),ia.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=na.distanceTo(ia);e.setAttribute("lineDistance",new ft(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;(n=e.lineDistances)[0]=0;for(i=1,r=a.length;i<r;i++)n[i]=n[i-1],n[i]+=a[i-1].distanceTo(a[i])}return this},raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),oa.copy(n.boundingSphere),oa.applyMatrix4(i),oa.radius+=r,!1!==e.ray.intersectsSphere(oa)){ra.getInverse(i),aa.copy(e.ray).applyMatrix4(ra);var a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new D,l=new D,c=new D,h=new D,u=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var p=n.index,d=n.attributes.position.array;if(null!==p)for(var f=p.array,m=0,g=f.length-1;m<g;m+=u){var v=f[m],y=f[m+1];if(s.fromArray(d,3*v),l.fromArray(d,3*y),!(aa.distanceSqToSegment(s,l,h,c)>o))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,g=d.length/3-1;m<g;m+=u){if(s.fromArray(d,3*m),l.fromArray(d,3*m+3),!(aa.distanceSqToSegment(s,l,h,c)>o))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){var x=n.vertices,b=x.length;for(m=0;m<b-1;m+=u){var w;if(!(aa.distanceSqToSegment(x[m],x[m+1],h,c)>o))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var la=new D,ca=new D;function ha(e,t){sa.call(this,e,t),this.type="LineSegments"}function ua(e,t){sa.call(this,e,t),this.type="LineLoop"}function pa(e){it.call(this),this.type="PointsMaterial",this.color=new Ke(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}ha.prototype=Object.assign(Object.create(sa.prototype),{constructor:ha,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],i=0,r=t.count;i<r;i+=2)la.fromBufferAttribute(t,i),ca.fromBufferAttribute(t,i+1),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+la.distanceTo(ca);e.setAttribute("lineDistance",new ft(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for(n=e.lineDistances,i=0,r=a.length;i<r;i+=2)la.copy(a[i]),ca.copy(a[i+1]),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+la.distanceTo(ca)}return this}}),ua.prototype=Object.assign(Object.create(sa.prototype),{constructor:ua,isLineLoop:!0}),pa.prototype=Object.create(it.prototype),pa.prototype.constructor=pa,pa.prototype.isPointsMaterial=!0,pa.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};var da=new k,fa=new Oe,ma=new Se,ga=new D;function va(e,t){oe.call(this),this.type="Points",this.geometry=void 0!==e?e:new Tt,this.material=void 0!==t?t:new pa,this.updateMorphTargets()}function ya(e,t,n,i,r,a,o){var s=fa.distanceSqToPoint(e);if(s<n){var l=new D;fa.closestPointToPoint(e,l),l.applyMatrix4(i);var c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}function xa(e,t,n,i,r,a,o,s,l){A.call(this,e,t,n,i,r,a,o,s,l),this.format=void 0!==o?o:1022,this.minFilter=void 0!==a?a:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1}function ba(e,t,n,i,r,a,o,s,l,c,h,u){A.call(this,null,a,o,s,l,c,i,r,h,u),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function wa(e,t,n,i,r,a,o,s,l){A.call(this,e,t,n,i,r,a,o,s,l),this.needsUpdate=!0}function _a(e,t,n,i,r,a,o,s,l,c){if(1026!==(c=void 0!==c?c:1026)&&1027!==c)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&1026===c&&(n=1012),void 0===n&&1027===c&&(n=1020),A.call(this,null,i,r,a,o,s,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:1003,this.minFilter=void 0!==s?s:1003,this.flipY=!1,this.generateMipmaps=!1}function Ma(e){Tt.call(this),this.type="WireframeGeometry";var t,n,i,r,a,o,s,l,c,h,u=[],p=[0,0],d={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,i=m.length;t<i;t++){var g=m[t];for(n=0;n<3;n++)s=g[f[n]],l=g[f[(n+1)%3]],p[0]=Math.min(s,l),p[1]=Math.max(s,l),void 0===d[c=p[0]+","+p[1]]&&(d[c]={index1:p[0],index2:p[1]})}for(c in d)o=d[c],h=e.vertices[o.index1],u.push(h.x,h.y,h.z),h=e.vertices[o.index2],u.push(h.x,h.y,h.z)}else if(e&&e.isBufferGeometry){var v,y,x,b,w,_,M;if(h=new D,null!==e.index){for(v=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),r=0,a=x.length;r<a;++r)for(t=w=(b=x[r]).start,i=w+b.count;t<i;t+=3)for(n=0;n<3;n++)s=y.getX(t+n),l=y.getX(t+(n+1)%3),p[0]=Math.min(s,l),p[1]=Math.max(s,l),void 0===d[c=p[0]+","+p[1]]&&(d[c]={index1:p[0],index2:p[1]});for(c in d)o=d[c],h.fromBufferAttribute(v,o.index1),u.push(h.x,h.y,h.z),h.fromBufferAttribute(v,o.index2),u.push(h.x,h.y,h.z)}else for(t=0,i=(v=e.attributes.position).count/3;t<i;t++)for(n=0;n<3;n++)_=3*t+n,h.fromBufferAttribute(v,_),u.push(h.x,h.y,h.z),M=3*t+(n+1)%3,h.fromBufferAttribute(v,M),u.push(h.x,h.y,h.z)}this.setAttribute("position",new ft(u,3))}function Sa(e,t,n){Zt.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new Ta(e,t,n)),this.mergeVertices()}function Ta(e,t,n){Tt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var i,r,a=[],o=[],s=[],l=[],c=1e-5,h=new D,u=new D,p=new D,d=new D,f=new D;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var m=t+1;for(i=0;i<=n;i++){var g=i/n;for(r=0;r<=t;r++){var v=r/t;e(v,g,u),o.push(u.x,u.y,u.z),v-c>=0?(e(v-c,g,p),d.subVectors(u,p)):(e(v+c,g,p),d.subVectors(p,u)),g-c>=0?(e(v,g-c,p),f.subVectors(u,p)):(e(v,g+c,p),f.subVectors(p,u)),h.crossVectors(d,f).normalize(),s.push(h.x,h.y,h.z),l.push(v,g)}}for(i=0;i<n;i++)for(r=0;r<t;r++){var y=i*m+r,x=i*m+r+1,b=(i+1)*m+r+1,w=(i+1)*m+r;a.push(y,x,w),a.push(x,b,w)}this.setIndex(a),this.setAttribute("position",new ft(o,3)),this.setAttribute("normal",new ft(s,3)),this.setAttribute("uv",new ft(l,2))}function Ea(e,t,n,i){Zt.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},this.fromBufferGeometry(new Aa(e,t,n,i)),this.mergeVertices()}function Aa(e,t,n,i){Tt.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},n=n||1;var r=[],a=[];function o(e,t,n,i){var r,a,o=Math.pow(2,i),l=[];for(r=0;r<=o;r++){l[r]=[];var c=e.clone().lerp(n,r/o),h=t.clone().lerp(n,r/o),u=o-r;for(a=0;a<=u;a++)l[r][a]=0===a&&r===o?c:c.clone().lerp(h,a/u)}for(r=0;r<o;r++)for(a=0;a<2*(o-r)-1;a++){var p=Math.floor(a/2);a%2==0?(s(l[r][p+1]),s(l[r+1][p]),s(l[r][p])):(s(l[r][p+1]),s(l[r+1][p+1]),s(l[r+1][p]))}}function s(e){r.push(e.x,e.y,e.z)}function l(t,n){var i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function c(e,t,n,i){i<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=i/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function u(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}!function(e){for(var n=new D,i=new D,r=new D,a=0;a<t.length;a+=3)l(t[a+0],n),l(t[a+1],i),l(t[a+2],r),o(n,i,r,e)}(i=i||0),function(e){for(var t=new D,n=0;n<r.length;n+=3)t.x=r[n+0],t.y=r[n+1],t.z=r[n+2],t.normalize().multiplyScalar(e),r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z}(n),function(){for(var e=new D,t=0;t<r.length;t+=3){e.x=r[t+0],e.y=r[t+1],e.z=r[t+2];var n=h(e)/2/Math.PI+.5,i=u(e)/Math.PI+.5;a.push(n,1-i)}(function(){for(var e=new D,t=new D,n=new D,i=new D,o=new M,s=new M,l=new M,u=0,p=0;u<r.length;u+=9,p+=6){e.set(r[u+0],r[u+1],r[u+2]),t.set(r[u+3],r[u+4],r[u+5]),n.set(r[u+6],r[u+7],r[u+8]),o.set(a[p+0],a[p+1]),s.set(a[p+2],a[p+3]),l.set(a[p+4],a[p+5]),i.copy(e).add(t).add(n).divideScalar(3);var d=h(i);c(o,p+0,e,d),c(s,p+2,t,d),c(l,p+4,n,d)}})(),function(){for(var e=0;e<a.length;e+=6){var t=a[e+0],n=a[e+2],i=a[e+4],r=Math.max(t,n,i),o=Math.min(t,n,i);r>.9&&o<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new ft(r,3)),this.setAttribute("normal",new ft(r.slice(),3)),this.setAttribute("uv",new ft(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function La(e,t){Zt.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ra(e,t)),this.mergeVertices()}function Ra(e,t){Aa.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Pa(e,t){Zt.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ca(e,t)),this.mergeVertices()}function Ca(e,t){Aa.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Oa(e,t){Zt.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ia(e,t)),this.mergeVertices()}function Ia(e,t){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];Aa.call(this,i,[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],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Da(e,t){Zt.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Na(e,t)),this.mergeVertices()}function Na(e,t){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];Aa.call(this,r,[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],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function za(e,t,n,i,r,a){Zt.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new Ua(e,t,n,i,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function Ua(e,t,n,i,r){Tt.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},t=t||64,n=n||1,i=i||8,r=r||!1;var a=e.computeFrenetFrames(t,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,l=new D,c=new D,h=new M,u=new D,p=[],d=[],f=[],m=[];function g(r){u=e.getPointAt(r/t,u);var o=a.normals[r],h=a.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);c.x=g*o.x+m*h.x,c.y=g*o.y+m*h.y,c.z=g*o.z+m*h.z,c.normalize(),d.push(c.x,c.y,c.z),l.x=u.x+n*c.x,l.y=u.y+n*c.y,l.z=u.z+n*c.z,p.push(l.x,l.y,l.z)}}!function(){for(o=0;o<t;o++)g(o);g(!1===r?t:0),function(){for(o=0;o<=t;o++)for(s=0;s<=i;s++)h.x=o/t,h.y=s/i,f.push(h.x,h.y)}(),function(){for(s=1;s<=t;s++)for(o=1;o<=i;o++){var e=(i+1)*(s-1)+(o-1),n=(i+1)*s+(o-1),r=(i+1)*s+o,a=(i+1)*(s-1)+o;m.push(e,n,a),m.push(n,r,a)}}()}(),this.setIndex(m),this.setAttribute("position",new ft(p,3)),this.setAttribute("normal",new ft(d,3)),this.setAttribute("uv",new ft(f,2))}function Fa(e,t,n,i,r,a,o){Zt.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Ba(e,t,n,i,r,a)),this.mergeVertices()}function Ba(e,t,n,i,r,a){Tt.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,i=Math.floor(i)||8,r=r||2,a=a||3;var o,s,l=[],c=[],h=[],u=[],p=new D,d=new D,f=new D,m=new D,g=new D,v=new D,y=new D;for(o=0;o<=n;++o){var x=o/n*r*Math.PI*2;for(A(x,r,a,e,f),A(x+.01,r,a,e,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize(),s=0;s<=i;++s){var b=s/i*Math.PI*2,w=-t*Math.cos(b),_=t*Math.sin(b);p.x=f.x+(w*y.x+_*g.x),p.y=f.y+(w*y.y+_*g.y),p.z=f.z+(w*y.z+_*g.z),c.push(p.x,p.y,p.z),d.subVectors(p,f).normalize(),h.push(d.x,d.y,d.z),u.push(o/n),u.push(s/i)}}for(s=1;s<=n;s++)for(o=1;o<=i;o++){var M=(i+1)*(s-1)+(o-1),S=(i+1)*s+(o-1),T=(i+1)*s+o,E=(i+1)*(s-1)+o;l.push(M,S,E),l.push(S,T,E)}function A(e,t,n,i,r){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,l=Math.cos(s);r.x=i*(2+l)*.5*a,r.y=i*(2+l)*o*.5,r.z=i*Math.sin(s)*.5}this.setIndex(l),this.setAttribute("position",new ft(c,3)),this.setAttribute("normal",new ft(h,3)),this.setAttribute("uv",new ft(u,2))}function Ha(e,t,n,i,r){Zt.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new Ga(e,t,n,i,r)),this.mergeVertices()}function Ga(e,t,n,i,r){Tt.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},e=e||1,t=t||.4,n=Math.floor(n)||8,i=Math.floor(i)||6,r=r||2*Math.PI;var a,o,s=[],l=[],c=[],h=[],u=new D,p=new D,d=new D;for(a=0;a<=n;a++)for(o=0;o<=i;o++){var f=o/i*r,m=a/n*Math.PI*2;p.x=(e+t*Math.cos(m))*Math.cos(f),p.y=(e+t*Math.cos(m))*Math.sin(f),p.z=t*Math.sin(m),l.push(p.x,p.y,p.z),u.x=e*Math.cos(f),u.y=e*Math.sin(f),d.subVectors(p,u).normalize(),c.push(d.x,d.y,d.z),h.push(o/i),h.push(a/n)}for(a=1;a<=n;a++)for(o=1;o<=i;o++){var g=(i+1)*a+o-1,v=(i+1)*(a-1)+o-1,y=(i+1)*(a-1)+o,x=(i+1)*a+o;s.push(g,v,x),s.push(v,y,x)}this.setIndex(s),this.setAttribute("position",new ft(l,3)),this.setAttribute("normal",new ft(c,3)),this.setAttribute("uv",new ft(h,2))}va.prototype=Object.assign(Object.create(oe.prototype),{constructor:va,isPoints:!0,raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),ma.copy(n.boundingSphere),ma.applyMatrix4(i),ma.radius+=r,!1!==e.ray.intersectsSphere(ma)){da.getInverse(i),fa.copy(e.ray).applyMatrix4(da);var a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,l=n.attributes.position.array;if(null!==s)for(var c=s.array,h=0,u=c.length;h<u;h++){var p=c[h];ga.fromArray(l,3*p),ya(ga,p,o,i,e,t,this)}else{h=0;for(var d=l.length/3;h<d;h++)ga.fromArray(l,3*h),ya(ga,h,o,i,e,t,this)}}else{var f=n.vertices;for(h=0,d=f.length;h<d;h++)ya(f[h],h,o,i,e,t,this)}}},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),xa.prototype=Object.assign(Object.create(A.prototype),{constructor:xa,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),ba.prototype=Object.create(A.prototype),ba.prototype.constructor=ba,ba.prototype.isCompressedTexture=!0,wa.prototype=Object.create(A.prototype),wa.prototype.constructor=wa,wa.prototype.isCanvasTexture=!0,_a.prototype=Object.create(A.prototype),_a.prototype.constructor=_a,_a.prototype.isDepthTexture=!0,Ma.prototype=Object.create(Tt.prototype),Ma.prototype.constructor=Ma,Sa.prototype=Object.create(Zt.prototype),Sa.prototype.constructor=Sa,Ta.prototype=Object.create(Tt.prototype),Ta.prototype.constructor=Ta,Ea.prototype=Object.create(Zt.prototype),Ea.prototype.constructor=Ea,Aa.prototype=Object.create(Tt.prototype),Aa.prototype.constructor=Aa,La.prototype=Object.create(Zt.prototype),La.prototype.constructor=La,Ra.prototype=Object.create(Aa.prototype),Ra.prototype.constructor=Ra,Pa.prototype=Object.create(Zt.prototype),Pa.prototype.constructor=Pa,Ca.prototype=Object.create(Aa.prototype),Ca.prototype.constructor=Ca,Oa.prototype=Object.create(Zt.prototype),Oa.prototype.constructor=Oa,Ia.prototype=Object.create(Aa.prototype),Ia.prototype.constructor=Ia,Da.prototype=Object.create(Zt.prototype),Da.prototype.constructor=Da,Na.prototype=Object.create(Aa.prototype),Na.prototype.constructor=Na,za.prototype=Object.create(Zt.prototype),za.prototype.constructor=za,Ua.prototype=Object.create(Tt.prototype),Ua.prototype.constructor=Ua,Ua.prototype.toJSON=function(){var e=Tt.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},Fa.prototype=Object.create(Zt.prototype),Fa.prototype.constructor=Fa,Ba.prototype=Object.create(Tt.prototype),Ba.prototype.constructor=Ba,Ha.prototype=Object.create(Zt.prototype),Ha.prototype.constructor=Ha,Ga.prototype=Object.create(Tt.prototype),Ga.prototype.constructor=Ga;var ka=function(e,t,n){n=n||2;var i,r,a,o,s,l,c,h=t&&t.length,u=h?t[0]*n:e.length,p=Va(e,0,u,n,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=function(e,t,n,i){var r,a,o,s,l,c=[];for(r=0,a=t.length;r<a;r++)o=t[r]*i,s=r<a-1?t[r+1]*i:e.length,(l=Va(e,o,s,i,!1))===l.next&&(l.steiner=!0),c.push(eo(l));for(c.sort(Za),r=0;r<c.length;r++)Ka(c[r],n),n=ja(n,n.next);return n}(e,t,p,n)),e.length>80*n){i=a=e[0],r=o=e[1];for(var f=n;f<u;f+=n)(s=e[f])<i&&(i=s),(l=e[f+1])<r&&(r=l),s>a&&(a=s),l>o&&(o=l);c=0!==(c=Math.max(a-i,o-r))?1/c:0}return Wa(p,d,n,i,r,c),d};function Va(e,t,n,i,r){var a,o;if(r===function(e,t,n,i){for(var r=0,a=t,o=n-i;a<n;a+=i)r+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return r}(e,t,n,i)>0)for(a=t;a<n;a+=i)o=ho(a,e[a],e[a+1],o);else for(a=n-i;a>=t;a-=i)o=ho(a,e[a],e[a+1],o);return o&&ro(o,o.next)&&(uo(o),o=o.next),o}function ja(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!ro(i,i.next)&&0!==io(i.prev,i,i.next))i=i.next;else{if(uo(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function Wa(e,t,n,i,r,a,o){if(e){!o&&a&&function(e,t,n,i){var r=e;do{null===r.z&&(r.z=$a(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,a,o,s,l,c=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t<c&&(s++,i=i.nextZ);t++);for(l=c;s>0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,a);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?Xa(e,i,r,a):qa(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),uo(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?Wa(e=Ya(ja(e),t,n),t,n,i,r,a,2):2===o&&Ja(e,t,n,i,r,a):Wa(ja(e),t,n,i,r,a,1);break}}}function qa(e){var t=e.prev,n=e,i=e.next;if(io(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(to(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&io(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Xa(e,t,n,i){var r=e.prev,a=e,o=e.next;if(io(r,a,o)>=0)return!1;for(var s=r.x<a.x?r.x<o.x?r.x:o.x:a.x<o.x?a.x:o.x,l=r.y<a.y?r.y<o.y?r.y:o.y:a.y<o.y?a.y:o.y,c=r.x>a.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,h=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,u=$a(s,l,t,n,i),p=$a(c,h,t,n,i),d=e.prevZ,f=e.nextZ;d&&d.z>=u&&f&&f.z<=p;){if(d!==e.prev&&d!==e.next&&to(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&io(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==e.prev&&f!==e.next&&to(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&io(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=u;){if(d!==e.prev&&d!==e.next&&to(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&io(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=p;){if(f!==e.prev&&f!==e.next&&to(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&io(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Ya(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!ro(r,a)&&ao(r,i,i.next,a)&&lo(r,a)&&lo(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),uo(i),uo(i.next),i=e=a),i=i.next}while(i!==e);return ja(i)}function Ja(e,t,n,i,r,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&no(o,s)){var l=co(o,s);return o=ja(o,o.next),l=ja(l,l.next),Wa(o,t,n,i,r,a),void Wa(l,t,n,i,r,a)}s=s.next}o=o.next}while(o!==e)}function Za(e,t){return e.x-t.x}function Ka(e,t){if(t=function(e,t){var n,i=t,r=e.x,a=e.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>o){if(o=s,s===r){if(a===i.y)return i;if(a===i.next.y)return i.next}n=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!n)return null;if(r===o)return n;var l,c=n,h=n.x,u=n.y,p=1/0;i=n;do{r>=i.x&&i.x>=h&&r!==i.x&&to(a<u?r:o,a,h,u,a<u?o:r,a,i.x,i.y)&&(l=Math.abs(a-i.y)/(r-i.x),lo(i,e)&&(l<p||l===p&&(i.x>n.x||i.x===n.x&&Qa(n,i)))&&(n=i,p=l)),i=i.next}while(i!==c);return n}(e,t)){var n=co(t,e);ja(t,t.next),ja(n,n.next)}}function Qa(e,t){return io(e.prev,e,t.prev)<0&&io(t.next,e,e.next)<0}function $a(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function eo(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function to(e,t,n,i,r,a,o,s){return(r-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(i-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(r-o)*(i-s)>=0}function no(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&ao(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(lo(e,t)&&lo(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(io(e.prev,e,t.prev)||io(e,t.prev,t))||ro(e,t)&&io(e.prev,e,e.next)>0&&io(t.prev,t,t.next)>0)}function io(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ro(e,t){return e.x===t.x&&e.y===t.y}function ao(e,t,n,i){var r=so(io(e,t,n)),a=so(io(e,t,i)),o=so(io(n,i,e)),s=so(io(n,i,t));return r!==a&&o!==s||(!(0!==r||!oo(e,n,t))||(!(0!==a||!oo(e,i,t))||(!(0!==o||!oo(n,e,i))||!(0!==s||!oo(n,t,i)))))}function oo(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function so(e){return e>0?1:e<0?-1:0}function lo(e,t){return io(e.prev,e,e.next)<0?io(e,t,e.next)>=0&&io(e,e.prev,t)>=0:io(e,t,e.prev)<0||io(e,e.next,t)<0}function co(e,t){var n=new po(e.i,e.x,e.y),i=new po(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function ho(e,t,n,i){var r=new po(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function uo(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function po(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var fo={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n},isClockWise:function(e){return fo.area(e)<0},triangulateShape:function(e,t){var n=[],i=[],r=[];mo(e),go(n,e);var a=e.length;t.forEach(mo);for(var o=0;o<t.length;o++)i.push(a),a+=t[o].length,go(n,t[o]);var s=ka(n,i);for(o=0;o<s.length;o+=3)r.push(s.slice(o,o+3));return r}};function mo(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function go(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function vo(e,t){Zt.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new yo(e,t)),this.mergeVertices()}function yo(e,t){Tt.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,i=[],r=[],a=0,o=e.length;a<o;a++){s(e[a])}function s(e){var a=[],o=void 0!==t.curveSegments?t.curveSegments:12,s=void 0!==t.steps?t.steps:1,l=void 0!==t.depth?t.depth:100,c=void 0===t.bevelEnabled||t.bevelEnabled,h=void 0!==t.bevelThickness?t.bevelThickness:6,u=void 0!==t.bevelSize?t.bevelSize:h-2,p=void 0!==t.bevelOffset?t.bevelOffset:0,d=void 0!==t.bevelSegments?t.bevelSegments:3,f=t.extrudePath,m=void 0!==t.UVGenerator?t.UVGenerator:xo;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=t.amount);var g,v,y,x,b,w,_,S,T=!1;f&&(g=f.getSpacedPoints(s),T=!0,c=!1,v=f.computeFrenetFrames(s,!1),y=new D,x=new D,b=new D),c||(d=0,h=0,u=0,p=0);var E=e.extractPoints(o),A=E.shape,L=E.holes;if(!fo.isClockWise(A))for(A=A.reverse(),_=0,S=L.length;_<S;_++)w=L[_],fo.isClockWise(w)&&(L[_]=w.reverse());var R=fo.triangulateShape(A,L),P=A;for(_=0,S=L.length;_<S;_++)w=L[_],A=A.concat(w);function C(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var O,I,N,z,U,F,B=A.length,H=R.length;function G(e,t,n){var i,r,a,o=e.x-t.x,s=e.y-t.y,l=n.x-e.x,c=n.y-e.y,h=o*o+s*s,u=o*c-s*l;if(Math.abs(u)>Number.EPSILON){var p=Math.sqrt(h),d=Math.sqrt(l*l+c*c),f=t.x-s/p,m=t.y+o/p,g=((n.x-c/d-f)*c-(n.y+l/d-m)*l)/(o*c-s*l),v=(i=f+o*g-e.x)*i+(r=m+s*g-e.y)*r;if(v<=2)return new M(i,r);a=Math.sqrt(v/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),y?(i=-s,r=o,a=Math.sqrt(h)):(i=o,r=s,a=Math.sqrt(h/2))}return new M(i/a,r/a)}for(var k=[],V=0,j=P.length,W=j-1,q=V+1;V<j;V++,W++,q++)W===j&&(W=0),q===j&&(q=0),k[V]=G(P[V],P[W],P[q]);var X,Y,J=[],Z=k.concat();for(_=0,S=L.length;_<S;_++){for(w=L[_],X=[],V=0,W=(j=w.length)-1,q=V+1;V<j;V++,W++,q++)W===j&&(W=0),q===j&&(q=0),X[V]=G(w[V],w[W],w[q]);J.push(X),Z=Z.concat(X)}for(O=0;O<d;O++){for(N=O/d,z=h*Math.cos(N*Math.PI/2),I=u*Math.sin(N*Math.PI/2)+p,V=0,j=P.length;V<j;V++)Q((U=C(P[V],k[V],I)).x,U.y,-z);for(_=0,S=L.length;_<S;_++)for(w=L[_],X=J[_],V=0,j=w.length;V<j;V++)Q((U=C(w[V],X[V],I)).x,U.y,-z)}for(I=u+p,V=0;V<B;V++)U=c?C(A[V],Z[V],I):A[V],T?(x.copy(v.normals[0]).multiplyScalar(U.x),y.copy(v.binormals[0]).multiplyScalar(U.y),b.copy(g[0]).add(x).add(y),Q(b.x,b.y,b.z)):Q(U.x,U.y,0);for(Y=1;Y<=s;Y++)for(V=0;V<B;V++)U=c?C(A[V],Z[V],I):A[V],T?(x.copy(v.normals[Y]).multiplyScalar(U.x),y.copy(v.binormals[Y]).multiplyScalar(U.y),b.copy(g[Y]).add(x).add(y),Q(b.x,b.y,b.z)):Q(U.x,U.y,l/s*Y);for(O=d-1;O>=0;O--){for(N=O/d,z=h*Math.cos(N*Math.PI/2),I=u*Math.sin(N*Math.PI/2)+p,V=0,j=P.length;V<j;V++)Q((U=C(P[V],k[V],I)).x,U.y,l+z);for(_=0,S=L.length;_<S;_++)for(w=L[_],X=J[_],V=0,j=w.length;V<j;V++)U=C(w[V],X[V],I),T?Q(U.x,U.y+g[s-1].y,g[s-1].x+z):Q(U.x,U.y,l+z)}function K(e,t){var n,i;for(V=e.length;--V>=0;){n=V,(i=V-1)<0&&(i=e.length-1);var r=0,a=s+2*d;for(r=0;r<a;r++){var o=B*r,l=B*(r+1);ee(t+n+o,t+i+o,t+i+l,t+n+l)}}}function Q(e,t,n){a.push(e),a.push(t),a.push(n)}function $(e,t,r){te(e),te(t),te(r);var a=i.length/3,o=m.generateTopUV(n,i,a-3,a-2,a-1);ne(o[0]),ne(o[1]),ne(o[2])}function ee(e,t,r,a){te(e),te(t),te(a),te(t),te(r),te(a);var o=i.length/3,s=m.generateSideWallUV(n,i,o-6,o-3,o-2,o-1);ne(s[0]),ne(s[1]),ne(s[3]),ne(s[1]),ne(s[2]),ne(s[3])}function te(e){i.push(a[3*e+0]),i.push(a[3*e+1]),i.push(a[3*e+2])}function ne(e){r.push(e.x),r.push(e.y)}!function(){var e=i.length/3;if(c){var t=0,r=B*t;for(V=0;V<H;V++)$((F=R[V])[2]+r,F[1]+r,F[0]+r);for(r=B*(t=s+2*d),V=0;V<H;V++)$((F=R[V])[0]+r,F[1]+r,F[2]+r)}else{for(V=0;V<H;V++)$((F=R[V])[2],F[1],F[0]);for(V=0;V<H;V++)$((F=R[V])[0]+B*s,F[1]+B*s,F[2]+B*s)}n.addGroup(e,i.length/3-e,0)}(),function(){var e=i.length/3,t=0;for(K(P,t),t+=P.length,_=0,S=L.length;_<S;_++)K(w=L[_],t),t+=w.length;n.addGroup(e,i.length/3-e,1)}()}this.setAttribute("position",new ft(i,3)),this.setAttribute("uv",new ft(r,2)),this.computeVertexNormals()}vo.prototype=Object.create(Zt.prototype),vo.prototype.constructor=vo,vo.prototype.toJSON=function(){var e=Zt.prototype.toJSON.call(this);return bo(this.parameters.shapes,this.parameters.options,e)},yo.prototype=Object.create(Tt.prototype),yo.prototype.constructor=yo,yo.prototype.toJSON=function(){var e=Tt.prototype.toJSON.call(this);return bo(this.parameters.shapes,this.parameters.options,e)};var xo={generateTopUV:function(e,t,n,i,r){var a=t[3*n],o=t[3*n+1],s=t[3*i],l=t[3*i+1],c=t[3*r],h=t[3*r+1];return[new M(a,o),new M(s,l),new M(c,h)]},generateSideWallUV:function(e,t,n,i,r,a){var o=t[3*n],s=t[3*n+1],l=t[3*n+2],c=t[3*i],h=t[3*i+1],u=t[3*i+2],p=t[3*r],d=t[3*r+1],f=t[3*r+2],m=t[3*a],g=t[3*a+1],v=t[3*a+2];return Math.abs(s-h)<.01?[new M(o,1-l),new M(c,1-u),new M(p,1-f),new M(m,1-v)]:[new M(s,1-l),new M(h,1-u),new M(d,1-f),new M(g,1-v)]}};function bo(e,t,n){if(n.shapes=[],Array.isArray(e))for(var i=0,r=e.length;i<r;i++){var a=e[i];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function wo(e,t){Zt.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new _o(e,t)),this.mergeVertices()}function _o(e,t){var n=(t=t||{}).font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Zt;var i=n.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),yo.call(this,i,t),this.type="TextBufferGeometry"}function Mo(e,t,n,i,r,a,o){Zt.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new So(e,t,n,i,r,a,o)),this.mergeVertices()}function So(e,t,n,i,r,a,o){Tt.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,l,c=Math.min(a+o,Math.PI),h=0,u=[],p=new D,d=new D,f=[],m=[],g=[],v=[];for(l=0;l<=n;l++){var y=[],x=l/n,b=0;for(0==l&&0==a?b=.5/t:l==n&&c==Math.PI&&(b=-.5/t),s=0;s<=t;s++){var w=s/t;p.x=-e*Math.cos(i+w*r)*Math.sin(a+x*o),p.y=e*Math.cos(a+x*o),p.z=e*Math.sin(i+w*r)*Math.sin(a+x*o),m.push(p.x,p.y,p.z),d.copy(p).normalize(),g.push(d.x,d.y,d.z),v.push(w+b,1-x),y.push(h++)}u.push(y)}for(l=0;l<n;l++)for(s=0;s<t;s++){var _=u[l][s+1],M=u[l][s],S=u[l+1][s],T=u[l+1][s+1];(0!==l||a>0)&&f.push(_,M,T),(l!==n-1||c<Math.PI)&&f.push(M,S,T)}this.setIndex(f),this.setAttribute("position",new ft(m,3)),this.setAttribute("normal",new ft(g,3)),this.setAttribute("uv",new ft(v,2))}function To(e,t,n,i,r,a){Zt.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new Eo(e,t,n,i,r,a)),this.mergeVertices()}function Eo(e,t,n,i,r,a){Tt.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},e=e||.5,t=t||1,r=void 0!==r?r:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var o,s,l,c=[],h=[],u=[],p=[],d=e,f=(t-e)/(i=void 0!==i?Math.max(1,i):1),m=new D,g=new M;for(s=0;s<=i;s++){for(l=0;l<=n;l++)o=r+l/n*a,m.x=d*Math.cos(o),m.y=d*Math.sin(o),h.push(m.x,m.y,m.z),u.push(0,0,1),g.x=(m.x/t+1)/2,g.y=(m.y/t+1)/2,p.push(g.x,g.y);d+=f}for(s=0;s<i;s++){var v=s*(n+1);for(l=0;l<n;l++){var y=o=l+v,x=o+n+1,b=o+n+2,w=o+1;c.push(y,x,w),c.push(x,b,w)}}this.setIndex(c),this.setAttribute("position",new ft(h,3)),this.setAttribute("normal",new ft(u,3)),this.setAttribute("uv",new ft(p,2))}function Ao(e,t,n,i){Zt.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},this.fromBufferGeometry(new Lo(e,t,n,i)),this.mergeVertices()}function Lo(e,t,n,i){Tt.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t)||12,n=n||0,i=i||2*Math.PI,i=_.clamp(i,0,2*Math.PI);var r,a,o,s=[],l=[],c=[],h=1/t,u=new D,p=new M;for(a=0;a<=t;a++){var d=n+a*h*i,f=Math.sin(d),m=Math.cos(d);for(o=0;o<=e.length-1;o++)u.x=e[o].x*f,u.y=e[o].y,u.z=e[o].x*m,l.push(u.x,u.y,u.z),p.x=a/t,p.y=o/(e.length-1),c.push(p.x,p.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var g=r=o+a*e.length,v=r+e.length,y=r+e.length+1,x=r+1;s.push(g,v,x),s.push(v,y,x)}if(this.setIndex(s),this.setAttribute("position",new ft(l,3)),this.setAttribute("uv",new ft(c,2)),this.computeVertexNormals(),i===2*Math.PI){var b=this.attributes.normal.array,w=new D,S=new D,T=new D;for(r=t*e.length*3,a=0,o=0;a<e.length;a++,o+=3)w.x=b[o+0],w.y=b[o+1],w.z=b[o+2],S.x=b[r+o+0],S.y=b[r+o+1],S.z=b[r+o+2],T.addVectors(w,S).normalize(),b[o+0]=b[r+o+0]=T.x,b[o+1]=b[r+o+1]=T.y,b[o+2]=b[r+o+2]=T.z}}function Ro(e,t){Zt.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new Po(e,t)),this.mergeVertices()}function Po(e,t){Tt.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],i=[],r=[],a=[],o=0,s=0;if(!1===Array.isArray(e))c(e);else for(var l=0;l<e.length;l++)c(e[l]),this.addGroup(o,s,l),o+=s,s=0;function c(e){var o,l,c,h=i.length/3,u=e.extractPoints(t),p=u.shape,d=u.holes;for(!1===fo.isClockWise(p)&&(p=p.reverse()),o=0,l=d.length;o<l;o++)c=d[o],!0===fo.isClockWise(c)&&(d[o]=c.reverse());var f=fo.triangulateShape(p,d);for(o=0,l=d.length;o<l;o++)c=d[o],p=p.concat(c);for(o=0,l=p.length;o<l;o++){var m=p[o];i.push(m.x,m.y,0),r.push(0,0,1),a.push(m.x,m.y)}for(o=0,l=f.length;o<l;o++){var g=f[o],v=g[0]+h,y=g[1]+h,x=g[2]+h;n.push(v,y,x),s+=3}}this.setIndex(n),this.setAttribute("position",new ft(i,3)),this.setAttribute("normal",new ft(r,3)),this.setAttribute("uv",new ft(a,2))}function Co(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}function Oo(e,t){Tt.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,i,r,a,o=[],s=Math.cos(_.DEG2RAD*t),l=[0,0],c={},h=["a","b","c"];e.isBufferGeometry?(a=new Zt).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var u=a.vertices,p=a.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],g=0;g<3;g++)n=m[h[g]],i=m[h[(g+1)%3]],l[0]=Math.min(n,i),l[1]=Math.max(n,i),void 0===c[r=l[0]+","+l[1]]?c[r]={index1:l[0],index2:l[1],face1:d,face2:void 0}:c[r].face2=d;for(r in c){var v=c[r];if(void 0===v.face2||p[v.face1].normal.dot(p[v.face2].normal)<=s){var y=u[v.index1];o.push(y.x,y.y,y.z),y=u[v.index2],o.push(y.x,y.y,y.z)}}this.setAttribute("position",new ft(o,3))}function Io(e,t,n,i,r,a,o,s){Zt.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Do(e,t,n,i,r,a,o,s)),this.mergeVertices()}function Do(e,t,n,i,r,a,o,s){Tt.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s};var l=this;e=void 0!==e?e:1,t=void 0!==t?t:1,n=n||1,i=Math.floor(i)||8,r=Math.floor(r)||1,a=void 0!==a&&a,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI;var c=[],h=[],u=[],p=[],d=0,f=[],m=n/2,g=0;function v(n){var r,a,f,v=new M,y=new D,x=0,b=!0===n?e:t,w=!0===n?1:-1;for(a=d,r=1;r<=i;r++)h.push(0,m*w,0),u.push(0,w,0),p.push(.5,.5),d++;for(f=d,r=0;r<=i;r++){var _=r/i*s+o,S=Math.cos(_),T=Math.sin(_);y.x=b*T,y.y=m*w,y.z=b*S,h.push(y.x,y.y,y.z),u.push(0,w,0),v.x=.5*S+.5,v.y=.5*T*w+.5,p.push(v.x,v.y),d++}for(r=0;r<i;r++){var E=a+r,A=f+r;!0===n?c.push(A,A+1,E):c.push(A+1,A,E),x+=3}l.addGroup(g,x,!0===n?1:2),g+=x}!function(){var a,v,y=new D,x=new D,b=0,w=(t-e)/n;for(v=0;v<=r;v++){var _=[],M=v/r,S=M*(t-e)+e;for(a=0;a<=i;a++){var T=a/i,E=T*s+o,A=Math.sin(E),L=Math.cos(E);x.x=S*A,x.y=-M*n+m,x.z=S*L,h.push(x.x,x.y,x.z),y.set(A,w,L).normalize(),u.push(y.x,y.y,y.z),p.push(T,1-M),_.push(d++)}f.push(_)}for(a=0;a<i;a++)for(v=0;v<r;v++){var R=f[v][a],P=f[v+1][a],C=f[v+1][a+1],O=f[v][a+1];c.push(R,P,O),c.push(P,C,O),b+=6}l.addGroup(g,b,0),g+=b}(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new ft(h,3)),this.setAttribute("normal",new ft(u,3)),this.setAttribute("uv",new ft(p,2))}function No(e,t,n,i,r,a,o){Io.call(this,0,e,t,n,i,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function zo(e,t,n,i,r,a,o){Do.call(this,0,e,t,n,i,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function Uo(e,t,n,i){Zt.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new Fo(e,t,n,i)),this.mergeVertices()}function Fo(e,t,n,i){Tt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,a,o=[],s=[],l=[],c=[],h=new D,u=new M;for(s.push(0,0,0),l.push(0,0,1),c.push(.5,.5),a=0,r=3;a<=t;a++,r+=3){var p=n+a/t*i;h.x=e*Math.cos(p),h.y=e*Math.sin(p),s.push(h.x,h.y,h.z),l.push(0,0,1),u.x=(s[r]/e+1)/2,u.y=(s[r+1]/e+1)/2,c.push(u.x,u.y)}for(r=1;r<=t;r++)o.push(r,r+1,0);this.setIndex(o),this.setAttribute("position",new ft(s,3)),this.setAttribute("normal",new ft(l,3)),this.setAttribute("uv",new ft(c,2))}wo.prototype=Object.create(Zt.prototype),wo.prototype.constructor=wo,_o.prototype=Object.create(yo.prototype),_o.prototype.constructor=_o,Mo.prototype=Object.create(Zt.prototype),Mo.prototype.constructor=Mo,So.prototype=Object.create(Tt.prototype),So.prototype.constructor=So,To.prototype=Object.create(Zt.prototype),To.prototype.constructor=To,Eo.prototype=Object.create(Tt.prototype),Eo.prototype.constructor=Eo,Ao.prototype=Object.create(Zt.prototype),Ao.prototype.constructor=Ao,Lo.prototype=Object.create(Tt.prototype),Lo.prototype.constructor=Lo,Ro.prototype=Object.create(Zt.prototype),Ro.prototype.constructor=Ro,Ro.prototype.toJSON=function(){var e=Zt.prototype.toJSON.call(this);return Co(this.parameters.shapes,e)},Po.prototype=Object.create(Tt.prototype),Po.prototype.constructor=Po,Po.prototype.toJSON=function(){var e=Tt.prototype.toJSON.call(this);return Co(this.parameters.shapes,e)},Oo.prototype=Object.create(Tt.prototype),Oo.prototype.constructor=Oo,Io.prototype=Object.create(Zt.prototype),Io.prototype.constructor=Io,Do.prototype=Object.create(Tt.prototype),Do.prototype.constructor=Do,No.prototype=Object.create(Io.prototype),No.prototype.constructor=No,zo.prototype=Object.create(Do.prototype),zo.prototype.constructor=zo,Uo.prototype=Object.create(Zt.prototype),Uo.prototype.constructor=Uo,Fo.prototype=Object.create(Tt.prototype),Fo.prototype.constructor=Fo;var Bo=Object.freeze({__proto__:null,WireframeGeometry:Ma,ParametricGeometry:Sa,ParametricBufferGeometry:Ta,TetrahedronGeometry:La,TetrahedronBufferGeometry:Ra,OctahedronGeometry:Pa,OctahedronBufferGeometry:Ca,IcosahedronGeometry:Oa,IcosahedronBufferGeometry:Ia,DodecahedronGeometry:Da,DodecahedronBufferGeometry:Na,PolyhedronGeometry:Ea,PolyhedronBufferGeometry:Aa,TubeGeometry:za,TubeBufferGeometry:Ua,TorusKnotGeometry:Fa,TorusKnotBufferGeometry:Ba,TorusGeometry:Ha,TorusBufferGeometry:Ga,TextGeometry:wo,TextBufferGeometry:_o,SphereGeometry:Mo,SphereBufferGeometry:So,RingGeometry:To,RingBufferGeometry:Eo,PlaneGeometry:fn,PlaneBufferGeometry:mn,LatheGeometry:Ao,LatheBufferGeometry:Lo,ShapeGeometry:Ro,ShapeBufferGeometry:Po,ExtrudeGeometry:vo,ExtrudeBufferGeometry:yo,EdgesGeometry:Oo,ConeGeometry:No,ConeBufferGeometry:zo,CylinderGeometry:Io,CylinderBufferGeometry:Do,CircleGeometry:Uo,CircleBufferGeometry:Fo,BoxGeometry:class extends Zt{constructor(e,t,n,i,r,a){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new Kt(e,t,n,i,r,a)),this.mergeVertices()}},BoxBufferGeometry:Kt});function Ho(e){it.call(this),this.type="ShadowMaterial",this.color=new Ke(0),this.transparent=!0,this.setValues(e)}function Go(e){tn.call(this,e),this.type="RawShaderMaterial"}function ko(e){it.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Ke(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new M(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function Vo(e){ko.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new M(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function jo(e){it.call(this),this.type="MeshPhongMaterial",this.color=new Ke(16777215),this.specular=new Ke(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new M(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Wo(e){it.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ke(16777215),this.specular=new Ke(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new M(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function qo(e){it.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new M(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Xo(e){it.call(this),this.type="MeshLambertMaterial",this.color=new Ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Yo(e){it.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ke(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new M(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Jo(e){ta.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}Ho.prototype=Object.create(it.prototype),Ho.prototype.constructor=Ho,Ho.prototype.isShadowMaterial=!0,Ho.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.color.copy(e.color),this},Go.prototype=Object.create(tn.prototype),Go.prototype.constructor=Go,Go.prototype.isRawShaderMaterial=!0,ko.prototype=Object.create(it.prototype),ko.prototype.constructor=ko,ko.prototype.isMeshStandardMaterial=!0,ko.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},Vo.prototype=Object.create(ko.prototype),Vo.prototype.constructor=Vo,Vo.prototype.isMeshPhysicalMaterial=!0,Vo.prototype.copy=function(e){return ko.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new Ke).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},jo.prototype=Object.create(it.prototype),jo.prototype.constructor=jo,jo.prototype.isMeshPhongMaterial=!0,jo.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Wo.prototype=Object.create(it.prototype),Wo.prototype.constructor=Wo,Wo.prototype.isMeshToonMaterial=!0,Wo.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},qo.prototype=Object.create(it.prototype),qo.prototype.constructor=qo,qo.prototype.isMeshNormalMaterial=!0,qo.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Xo.prototype=Object.create(it.prototype),Xo.prototype.constructor=Xo,Xo.prototype.isMeshLambertMaterial=!0,Xo.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Yo.prototype=Object.create(it.prototype),Yo.prototype.constructor=Yo,Yo.prototype.isMeshMatcapMaterial=!0,Yo.prototype.copy=function(e){return it.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Jo.prototype=Object.create(ta.prototype),Jo.prototype.constructor=Jo,Jo.prototype.isLineDashedMaterial=!0,Jo.prototype.copy=function(e){return ta.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Zo=Object.freeze({__proto__:null,ShadowMaterial:Ho,SpriteMaterial:_r,RawShaderMaterial:Go,ShaderMaterial:tn,PointsMaterial:pa,MeshPhysicalMaterial:Vo,MeshStandardMaterial:ko,MeshPhongMaterial:jo,MeshToonMaterial:Wo,MeshNormalMaterial:qo,MeshLambertMaterial:Xo,MeshDepthMaterial:rr,MeshDistanceMaterial:ar,MeshBasicMaterial:rt,MeshMatcapMaterial:Yo,LineDashedMaterial:Jo,LineBasicMaterial:ta,Material:it}),Ko={arraySlice:function(e,t,n){return Ko.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,l=0;l!==t;++l)r[o++]=e[s+l];return r},flattenJSON:function(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}},subclip:function(e,t,n,i,r){r=r||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var l=a.tracks[s],c=l.getValueSize(),h=[],u=[],p=0;p<l.times.length;++p){var d=l.times[p]*r;if(!(d<n||d>=i)){h.push(l.times[p]);for(var f=0;f<c;++f)u.push(l.values[p*c+f])}}0!==h.length&&(l.times=Ko.convertArray(h,l.times.constructor),l.values=Ko.convertArray(u,l.values.constructor),o.push(l))}a.tracks=o;var m=1/0;for(s=0;s<a.tracks.length;++s)m>a.tracks[s].times[0]&&(m=a.tracks[s].times[0]);for(s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*m);return a.resetDuration(),a},makeClipAdditive:function(e,t,n,i){void 0===t&&(t=0),void 0===n&&(n=e),(void 0===i||i<=0)&&(i=30);for(var r=e.tracks.length,a=t/i,o=0;o<r;++o){var s=n.tracks[o],l=s.ValueTypeName;if("bool"!==l&&"string"!==l){var c=e.tracks.find((function(e){return e.name===s.name&&e.ValueTypeName===l}));if(void 0!==c){var h,u=s.getValueSize(),p=s.times.length-1;if(a<=s.times[0])h=Ko.arraySlice(s.values,0,s.valueSize);else if(a>=s.times[p]){var d=p*u;h=Ko.arraySlice(s.values,d)}else{var f=s.createInterpolant();f.evaluate(a),h=f.resultBuffer}if("quaternion"===l)new C(h[0],h[1],h[2],h[3]).normalize().conjugate().toArray(h);for(var m=c.times.length,g=0;g<m;++g){var v=g*u;if("quaternion"===l)C.multiplyQuaternionsFlat(c.values,v,h,0,c.values,v);else for(var y=0;y<u;++y)c.values[v+y]-=h[y]}}}}return e.blendMode=2501,e}};function Qo(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function $o(e,t,n,i){Qo.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function es(e,t,n,i){Qo.call(this,e,t,n,i)}function ts(e,t,n,i){Qo.call(this,e,t,n,i)}function ns(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ko.convertArray(t,this.TimeBufferType),this.values=Ko.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}function is(e,t,n){ns.call(this,e,t,n)}function rs(e,t,n,i){ns.call(this,e,t,n,i)}function as(e,t,n,i){ns.call(this,e,t,n,i)}function os(e,t,n,i){Qo.call(this,e,t,n,i)}function ss(e,t,n,i){ns.call(this,e,t,n,i)}function ls(e,t,n,i){ns.call(this,e,t,n,i)}function cs(e,t,n,i){ns.call(this,e,t,n,i)}function hs(e,t,n,i){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.blendMode=void 0!==i?i:2500,this.uuid=_.generateUUID(),this.duration<0&&this.resetDuration()}function us(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return as;case"vector":case"vector2":case"vector3":case"vector4":return cs;case"color":return rs;case"quaternion":return ss;case"bool":case"boolean":return is;case"string":return ls}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],i=[];Ko.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(Qo.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var a;n:{i:if(!(e<i)){for(var o=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,r)}if(n===o)break;if(r=i,e<(i=t[++n]))break t}a=t.length;break n}if(e>=r)break e;var s=t[1];e<s&&(n=2,r=s);for(o=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===o)break;if(i=r,e>=(r=t[--n-1]))break t}a=n,n=0}for(;n<a;){var l=n+a>>>1;e<t[l]?a=l:n=l+1}if(i=t[n],void 0===(r=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,r,e)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i,a=0;a!==i;++a)t[a]=n[r+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Qo.prototype,{beforeStart_:Qo.prototype.copySampleValue_,afterEnd_:Qo.prototype.copySampleValue_}),$o.prototype=Object.assign(Object.create(Qo.prototype),{constructor:$o,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(e,t,n){var i=this.parameterPositions,r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:o=t+i[r=i.length-2]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=e,s=2*n-t;break;case 2402:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}var l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=r*c,this._offsetNext=a*c},interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(n-t)/(i-t),f=d*d,m=f*d,g=-u*m+2*u*f-u*d,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==o;++b)r[b]=g*a[c+b]+v*a[l+b]+y*a[s+b]+x*a[h+b];return r}}),es.prototype=Object.assign(Object.create(Qo.prototype),{constructor:es,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=(n-t)/(i-t),h=1-c,u=0;u!==o;++u)r[u]=a[l+u]*h+a[s+u]*c;return r}}),ts.prototype=Object.assign(Object.create(Qo.prototype),{constructor:ts,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(ns,{toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:Ko.convertArray(e.times,Array),values:Ko.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}}),Object.assign(ns.prototype,{constructor:ns,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new ts(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new es(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new $o(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,i=n.length,r=0,a=i-1;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Ko.arraySlice(n,r,a),this.values=Ko.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&Ko.isTypedArray(i)){o=0;for(var l=i.length;o!==l;++o){var c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}}return e},optimize:function(){for(var e=Ko.arraySlice(this.times),t=Ko.arraySlice(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=1,a=e.length-1,o=1;o<a;++o){var s=!1,l=e[o];if(l!==e[o+1]&&(1!==o||l!==l[0]))if(i)s=!0;else for(var c=o*n,h=c-n,u=c+n,p=0;p!==n;++p){var d=t[c+p];if(d!==t[h+p]||d!==t[u+p]){s=!0;break}}if(s){if(o!==r){e[r]=e[o];var f=o*n,m=r*n;for(p=0;p!==n;++p)t[m+p]=t[f+p]}++r}}if(a>0){e[r]=e[a];for(f=a*n,m=r*n,p=0;p!==n;++p)t[m+p]=t[f+p];++r}return r!==e.length?(this.times=Ko.arraySlice(e,0,r),this.values=Ko.arraySlice(t,0,r*n)):(this.times=e,this.values=t),this},clone:function(){var e=Ko.arraySlice(this.times,0),t=Ko.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),is.prototype=Object.assign(Object.create(ns.prototype),{constructor:is,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),rs.prototype=Object.assign(Object.create(ns.prototype),{constructor:rs,ValueTypeName:"color"}),as.prototype=Object.assign(Object.create(ns.prototype),{constructor:as,ValueTypeName:"number"}),os.prototype=Object.assign(Object.create(Qo.prototype),{constructor:os,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=(n-t)/(i-t),c=s+o;s!==c;s+=4)C.slerpFlat(r,0,a,s-o,a,s,l);return r}}),ss.prototype=Object.assign(Object.create(ns.prototype),{constructor:ss,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new os(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),ls.prototype=Object.assign(Object.create(ns.prototype),{constructor:ls,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),cs.prototype=Object.assign(Object.create(ns.prototype),{constructor:cs,ValueTypeName:"vector"}),Object.assign(hs,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(us(n[r]).scale(i));return new hs(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},r=0,a=n.length;r!==a;++r)t.push(ns.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,a=[],o=0;o<r;o++){var s=[],l=[];s.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);var c=Ko.getKeyframeOrder(s);s=Ko.sortedArray(s,1,c),l=Ko.sortedArray(l,1,c),i||0!==s[0]||(s.push(r),l.push(l[0])),a.push(new as(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/n))}return new hs(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var i=e;n=i.geometry&&i.geometry.animations||i.animations}for(var r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],l=s.name.match(r);if(l&&l.length>1){var c=i[u=l[1]];c||(i[u]=c=[]),c.push(s)}}var h=[];for(var u in i)h.push(hs.CreateFromMorphTargetSequence(u,i[u],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];Ko.flattenJSON(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.blendMode,l=e.hierarchy||[],c=0;c<l.length;c++){var h=l[c].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var u={},p=0;p<h.length;p++)if(h[p].morphTargets)for(var d=0;d<h[p].morphTargets.length;d++)u[h[p].morphTargets[d]]=-1;for(var f in u){var m=[],g=[];for(d=0;d!==h[p].morphTargets.length;++d){var v=h[p];m.push(v.time),g.push(v.morphTarget===f?1:0)}i.push(new as(".morphTargetInfluence["+f+"]",m,g))}a=u.length*(o||1)}else{var y=".bones["+t[c].name+"]";n(cs,y+".position",h,"pos",i),n(ss,y+".quaternion",h,"rot",i),n(cs,y+".scale",h,"scl",i)}}return 0===i.length?null:new hs(r,a,i,s)}}),Object.assign(hs.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new hs(this.name,this.duration,e,this.blendMode)}});var ps={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function ds(e,t,n){var i=this,r=!1,a=0,o=0,s=void 0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===r&&void 0!==i.onStart&&i.onStart(e,a,o),r=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,o),a===o&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){var t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=l.length;t<n;t+=2){var i=l[t],r=l[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null}}var fs=new ds;function ms(e){this.manager=void 0!==e?e:fs,this.crossOrigin="anonymous",this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(ms.prototype,{load:function(){},loadAsync:function(e,t){var n=this;return new Promise((function(i,r){n.load(e,i,t,r)}))},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}});var gs={};function vs(e){ms.call(this,e)}function ys(e){ms.call(this,e)}function xs(e){ms.call(this,e)}function bs(e){ms.call(this,e)}function ws(e){ms.call(this,e)}function _s(e){ms.call(this,e)}function Ms(e){ms.call(this,e)}function Ss(){this.type="Curve",this.arcLengthDivisions=200}function Ts(e,t,n,i,r,a,o,s){Ss.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Es(e,t,n,i,r,a){Ts.call(this,e,t,n,n,i,r,a),this.type="ArcCurve"}function As(){var e=0,t=0,n=0,i=0;function r(r,a,o,s){e=r,t=o,n=-3*r+3*a-2*o-s,i=2*r-2*a+o+s}return{initCatmullRom:function(e,t,n,i,a){r(t,n,a*(n-e),a*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,a,o,s){var l=(t-e)/a-(n-e)/(a+o)+(n-t)/o,c=(n-t)/o-(i-t)/(o+s)+(i-n)/s;r(t,n,l*=o,c*=o)},calc:function(r){var a=r*r;return e+t*r+n*a+i*(a*r)}}}vs.prototype=Object.assign(Object.create(ms.prototype),{constructor:vs,load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=ps.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;if(void 0===gs[e]){var o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],l=!!o[2],c=o[3];c=decodeURIComponent(c),l&&(c=atob(c));try{var h,u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":for(var p=new Uint8Array(c.length),d=0;d<c.length;d++)p[d]=c.charCodeAt(d);h="blob"===u?new Blob([p.buffer],{type:s}):p.buffer;break;case"document":var f=new DOMParser;h=f.parseFromString(c,s);break;case"json":h=JSON.parse(c);break;default:h=c}setTimeout((function(){t&&t(h),r.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}),0)}}else{gs[e]=[],gs[e].push({onLoad:t,onProgress:n,onError:i});var m=new XMLHttpRequest;for(var g in m.open("GET",e,!0),m.addEventListener("load",(function(t){var n=this.response,i=gs[e];if(delete gs[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),ps.add(e,n);for(var a=0,o=i.length;a<o;a++){(s=i[a]).onLoad&&s.onLoad(n)}r.manager.itemEnd(e)}else{for(a=0,o=i.length;a<o;a++){var s;(s=i[a]).onError&&s.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}}),!1),m.addEventListener("progress",(function(t){for(var n=gs[e],i=0,r=n.length;i<r;i++){var a=n[i];a.onProgress&&a.onProgress(t)}}),!1),m.addEventListener("error",(function(t){var n=gs[e];delete gs[e];for(var i=0,a=n.length;i<a;i++){var o=n[i];o.onError&&o.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}),!1),m.addEventListener("abort",(function(t){var n=gs[e];delete gs[e];for(var i=0,a=n.length;i<a;i++){var o=n[i];o.onError&&o.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(g,this.requestHeader[g]);m.send(null)}return r.manager.itemStart(e),m}gs[e].push({onLoad:t,onProgress:n,onError:i})},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}}),ys.prototype=Object.assign(Object.create(ms.prototype),{constructor:ys,load:function(e,t,n,i){var r=this,a=new vs(r.manager);a.setPath(r.path),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var i=hs.parse(e[n]);t.push(i)}return t}}),xs.prototype=Object.assign(Object.create(ms.prototype),{constructor:xs,load:function(e,t,n,i){var r=this,a=[],o=new ba;o.image=a;var s=new vs(this.manager);function l(l){s.load(e[l],(function(e){var n=r.parse(e,!0);a[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(c+=1)&&(1===n.mipmapCount&&(o.minFilter=1006),o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,i)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(e))for(var c=0,h=0,u=e.length;h<u;++h)l(h);else s.load(e,(function(e){var n=r.parse(e,!0);if(n.isCubemap)for(var i=n.mipmaps.length/n.mipmapCount,s=0;s<i;s++){a[s]={mipmaps:[]};for(var l=0;l<n.mipmapCount;l++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+l]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=1006),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,i);return o}}),bs.prototype=Object.assign(Object.create(ms.prototype),{constructor:bs,load:function(e,t,n,i){var r=this,a=new sn,o=new vs(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,(function(e){var n=r.parse(e);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:1001,a.wrapT=void 0!==n.wrapT?n.wrapT:1001,a.magFilter=void 0!==n.magFilter?n.magFilter:1006,a.minFilter=void 0!==n.minFilter?n.minFilter:1006,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=1008),1===n.mipmapCount&&(a.minFilter=1006),a.needsUpdate=!0,t&&t(a,n))}),n,i),a}}),ws.prototype=Object.assign(Object.create(ms.prototype),{constructor:ws,load:function(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=ps.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),ps.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}),_s.prototype=Object.assign(Object.create(ms.prototype),{constructor:_s,load:function(e,t,n,i){var r=new Rn,a=new ws(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],(function(e){r.images[n]=e,6===++o&&(r.needsUpdate=!0,t&&t(r))}),void 0,i)}for(var l=0;l<e.length;++l)s(l);return r}}),Ms.prototype=Object.assign(Object.create(ms.prototype),{constructor:Ms,load:function(e,t,n,i){var r=new A,a=new ws(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(n){r.image=n;var i=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);r.format=i?1022:1023,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}),Object.assign(Ss.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,i=[],r=this.getPoint(0),a=0;for(i.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(r),i.push(a),r=t;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=i[r=Math.floor(s+(l-s)/2)]-n)<0)s=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(a-1);var c=i[r];return(r+(n-c)/(i[r+1]-c))/(a-1)},getTangent:function(e,t){var n=e-1e-4,i=e+1e-4;n<0&&(n=0),i>1&&(i=1);var r=this.getPoint(n),a=this.getPoint(i),o=t||(r.isVector2?new M:new D);return o.copy(a).sub(r).normalize(),o},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n,i,r,a=new D,o=[],s=[],l=[],c=new D,h=new k;for(n=0;n<=e;n++)i=n/e,o[n]=this.getTangentAt(i,new D),o[n].normalize();s[0]=new D,l[0]=new D;var u=Number.MAX_VALUE,p=Math.abs(o[0].x),d=Math.abs(o[0].y),f=Math.abs(o[0].z);for(p<=u&&(u=p,a.set(1,0,0)),d<=u&&(u=d,a.set(0,1,0)),f<=u&&a.set(0,0,1),c.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],c),l[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),c.crossVectors(o[n-1],o[n]),c.length()>Number.EPSILON&&(c.normalize(),r=Math.acos(_.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(h.makeRotationAxis(c,r))),l[n].crossVectors(o[n],s[n]);if(!0===t)for(r=Math.acos(_.clamp(s[0].dot(s[e]),-1,1)),r/=e,o[0].dot(c.crossVectors(s[0],s[e]))>0&&(r=-r),n=1;n<=e;n++)s[n].applyMatrix4(h.makeRotationAxis(o[n],r*n)),l[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:l}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),Ts.prototype=Object.create(Ss.prototype),Ts.prototype.constructor=Ts,Ts.prototype.isEllipseCurve=!0,Ts.prototype.getPoint=function(e,t){for(var n=t||new M,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=a?0:i),!0!==this.aClockwise||a||(r===i?r=-i:r-=i);var o=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var c=Math.cos(this.aRotation),h=Math.sin(this.aRotation),u=s-this.aX,p=l-this.aY;s=u*c-p*h+this.aX,l=u*h+p*c+this.aY}return n.set(s,l)},Ts.prototype.copy=function(e){return Ss.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Ts.prototype.toJSON=function(){var e=Ss.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},Ts.prototype.fromJSON=function(e){return Ss.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},Es.prototype=Object.create(Ts.prototype),Es.prototype.constructor=Es,Es.prototype.isArcCurve=!0;var Ls=new D,Rs=new As,Ps=new As,Cs=new As;function Os(e,t,n,i){Ss.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=i||.5}function Is(e,t,n,i,r){var a=.5*(i-t),o=.5*(r-n),s=e*e;return(2*n-2*i+a+o)*(e*s)+(-3*n+3*i-2*a-o)*s+a*e+n}function Ds(e,t,n,i){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function Ns(e,t,n,i,r){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}function zs(e,t,n,i){Ss.call(this),this.type="CubicBezierCurve",this.v0=e||new M,this.v1=t||new M,this.v2=n||new M,this.v3=i||new M}function Us(e,t,n,i){Ss.call(this),this.type="CubicBezierCurve3",this.v0=e||new D,this.v1=t||new D,this.v2=n||new D,this.v3=i||new D}function Fs(e,t){Ss.call(this),this.type="LineCurve",this.v1=e||new M,this.v2=t||new M}function Bs(e,t){Ss.call(this),this.type="LineCurve3",this.v1=e||new D,this.v2=t||new D}function Hs(e,t,n){Ss.call(this),this.type="QuadraticBezierCurve",this.v0=e||new M,this.v1=t||new M,this.v2=n||new M}function Gs(e,t,n){Ss.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new D,this.v1=t||new D,this.v2=n||new D}function ks(e){Ss.call(this),this.type="SplineCurve",this.points=e||[]}Os.prototype=Object.create(Ss.prototype),Os.prototype.constructor=Os,Os.prototype.isCatmullRomCurve3=!0,Os.prototype.getPoint=function(e,t){var n,i,r,a,o=t||new D,s=this.points,l=s.length,c=(l-(this.closed?0:1))*e,h=Math.floor(c),u=c-h;if(this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/l)+1)*l:0===u&&h===l-1&&(h=l-2,u=1),this.closed||h>0?n=s[(h-1)%l]:(Ls.subVectors(s[0],s[1]).add(s[0]),n=Ls),i=s[h%l],r=s[(h+1)%l],this.closed||h+2<l?a=s[(h+2)%l]:(Ls.subVectors(s[l-1],s[l-2]).add(s[l-1]),a=Ls),"centripetal"===this.curveType||"chordal"===this.curveType){var p="chordal"===this.curveType?.5:.25,d=Math.pow(n.distanceToSquared(i),p),f=Math.pow(i.distanceToSquared(r),p),m=Math.pow(r.distanceToSquared(a),p);f<1e-4&&(f=1),d<1e-4&&(d=f),m<1e-4&&(m=f),Rs.initNonuniformCatmullRom(n.x,i.x,r.x,a.x,d,f,m),Ps.initNonuniformCatmullRom(n.y,i.y,r.y,a.y,d,f,m),Cs.initNonuniformCatmullRom(n.z,i.z,r.z,a.z,d,f,m)}else"catmullrom"===this.curveType&&(Rs.initCatmullRom(n.x,i.x,r.x,a.x,this.tension),Ps.initCatmullRom(n.y,i.y,r.y,a.y,this.tension),Cs.initCatmullRom(n.z,i.z,r.z,a.z,this.tension));return o.set(Rs.calc(u),Ps.calc(u),Cs.calc(u)),o},Os.prototype.copy=function(e){Ss.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Os.prototype.toJSON=function(){var e=Ss.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Os.prototype.fromJSON=function(e){Ss.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new D).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},zs.prototype=Object.create(Ss.prototype),zs.prototype.constructor=zs,zs.prototype.isCubicBezierCurve=!0,zs.prototype.getPoint=function(e,t){var n=t||new M,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(Ns(e,i.x,r.x,a.x,o.x),Ns(e,i.y,r.y,a.y,o.y)),n},zs.prototype.copy=function(e){return Ss.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},zs.prototype.toJSON=function(){var e=Ss.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},zs.prototype.fromJSON=function(e){return Ss.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Us.prototype=Object.create(Ss.prototype),Us.prototype.constructor=Us,Us.prototype.isCubicBezierCurve3=!0,Us.prototype.getPoint=function(e,t){var n=t||new D,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(Ns(e,i.x,r.x,a.x,o.x),Ns(e,i.y,r.y,a.y,o.y),Ns(e,i.z,r.z,a.z,o.z)),n},Us.prototype.copy=function(e){return Ss.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},Us.prototype.toJSON=function(){var e=Ss.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},Us.prototype.fromJSON=function(e){return Ss.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},Fs.prototype=Object.create(Ss.prototype),Fs.prototype.constructor=Fs,Fs.prototype.isLineCurve=!0,Fs.prototype.getPoint=function(e,t){var n=t||new M;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Fs.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Fs.prototype.getTangent=function(e,t){return(t||new M).copy(this.v2).sub(this.v1).normalize()},Fs.prototype.copy=function(e){return Ss.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Fs.prototype.toJSON=function(){var e=Ss.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Fs.prototype.fromJSON=function(e){return Ss.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Bs.prototype=Object.create(Ss.prototype),Bs.prototype.constructor=Bs,Bs.prototype.isLineCurve3=!0,Bs.prototype.getPoint=function(e,t){var n=t||new D;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Bs.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Bs.prototype.copy=function(e){return Ss.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Bs.prototype.toJSON=function(){var e=Ss.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Bs.prototype.fromJSON=function(e){return Ss.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Hs.prototype=Object.create(Ss.prototype),Hs.prototype.constructor=Hs,Hs.prototype.isQuadraticBezierCurve=!0,Hs.prototype.getPoint=function(e,t){var n=t||new M,i=this.v0,r=this.v1,a=this.v2;return n.set(Ds(e,i.x,r.x,a.x),Ds(e,i.y,r.y,a.y)),n},Hs.prototype.copy=function(e){return Ss.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Hs.prototype.toJSON=function(){var e=Ss.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Hs.prototype.fromJSON=function(e){return Ss.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Gs.prototype=Object.create(Ss.prototype),Gs.prototype.constructor=Gs,Gs.prototype.isQuadraticBezierCurve3=!0,Gs.prototype.getPoint=function(e,t){var n=t||new D,i=this.v0,r=this.v1,a=this.v2;return n.set(Ds(e,i.x,r.x,a.x),Ds(e,i.y,r.y,a.y),Ds(e,i.z,r.z,a.z)),n},Gs.prototype.copy=function(e){return Ss.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Gs.prototype.toJSON=function(){var e=Ss.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Gs.prototype.fromJSON=function(e){return Ss.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ks.prototype=Object.create(Ss.prototype),ks.prototype.constructor=ks,ks.prototype.isSplineCurve=!0,ks.prototype.getPoint=function(e,t){var n=t||new M,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,s=i[0===a?a:a-1],l=i[a],c=i[a>i.length-2?i.length-1:a+1],h=i[a>i.length-3?i.length-1:a+2];return n.set(Is(o,s.x,l.x,c.x,h.x),Is(o,s.y,l.y,c.y,h.y)),n},ks.prototype.copy=function(e){Ss.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this},ks.prototype.toJSON=function(){var e=Ss.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e},ks.prototype.fromJSON=function(e){Ss.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new M).fromArray(i))}return this};var Vs=Object.freeze({__proto__:null,ArcCurve:Es,CatmullRomCurve3:Os,CubicBezierCurve:zs,CubicBezierCurve3:Us,EllipseCurve:Ts,LineCurve:Fs,LineCurve3:Bs,QuadraticBezierCurve:Hs,QuadraticBezierCurve3:Gs,SplineCurve:ks});function js(){Ss.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function Ws(e){js.call(this),this.type="Path",this.currentPoint=new M,e&&this.setFromPoints(e)}function qs(e){Ws.call(this,e),this.uuid=_.generateUUID(),this.type="Shape",this.holes=[]}function Xs(e,t){oe.call(this),this.type="Light",this.color=new Ke(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function Ys(e,t,n){Xs.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(oe.DefaultUp),this.updateMatrix(),this.groundColor=new Ke(t)}function Js(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new M(512,512),this.map=null,this.mapPass=null,this.matrix=new k,this._frustum=new hn,this._frameExtents=new M(1,1),this._viewportCount=1,this._viewports=[new L(0,0,1,1)]}function Zs(){Js.call(this,new rn(50,1,.5,500))}function Ks(e,t,n,i,r,a){Xs.call(this,e,t),this.type="SpotLight",this.position.copy(oe.DefaultUp),this.updateMatrix(),this.target=new oe,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new Zs}function Qs(){Js.call(this,new rn(90,1,.5,500)),this._frameExtents=new M(4,2),this._viewportCount=6,this._viewports=[new L(2,1,1,1),new L(0,1,1,1),new L(3,1,1,1),new L(1,1,1,1),new L(3,0,1,1),new L(1,0,1,1)],this._cubeDirections=[new D(1,0,0),new D(-1,0,0),new D(0,0,1),new D(0,0,-1),new D(0,1,0),new D(0,-1,0)],this._cubeUps=[new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,1,0),new D(0,0,1),new D(0,0,-1)]}function $s(e,t,n,i){Xs.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new Qs}function el(e,t,n,i,r,a){nn.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==n?n:1,this.bottom=void 0!==i?i:-1,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function tl(){Js.call(this,new el(-5,5,5,-5,.5,500))}function nl(e,t){Xs.call(this,e,t),this.type="DirectionalLight",this.position.copy(oe.DefaultUp),this.updateMatrix(),this.target=new oe,this.shadow=new tl}function il(e,t){Xs.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function rl(e,t,n,i){Xs.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}function al(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new D)}function ol(e,t){Xs.call(this,void 0,t),this.type="LightProbe",this.sh=void 0!==e?e:new al}function sl(e){ms.call(this,e),this.textures={}}js.prototype=Object.assign(Object.create(Ss.prototype),{constructor:js,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Fs(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),i=0;i<n.length;){if(n[i]>=t){var r=n[i]-t,a=this.curves[i],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,n=[],i=0,r=this.curves;i<r.length;i++)for(var a=r[i],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),l=0;l<s.length;l++){var c=s[l];t&&t.equals(c)||(n.push(c),t=c)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){Ss.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Ss.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e},fromJSON:function(e){Ss.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push((new Vs[i.type]).fromJSON(i))}return this}}),Ws.prototype=Object.assign(Object.create(js.prototype),{constructor:Ws,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new Fs(this.currentPoint.clone(),new M(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,i){var r=new Hs(this.currentPoint.clone(),new M(e,t),new M(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this},bezierCurveTo:function(e,t,n,i,r,a){var o=new zs(this.currentPoint.clone(),new M(e,t),new M(n,i),new M(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this},splineThru:function(e){var t=new ks([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,i,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,i,r,a),this},absarc:function(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this},ellipse:function(e,t,n,i,r,a,o,s){var l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,i,r,a,o,s),this},absellipse:function(e,t,n,i,r,a,o,s){var l=new Ts(e,t,n,i,r,a,o,s);if(this.curves.length>0){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var h=l.getPoint(1);return this.currentPoint.copy(h),this},copy:function(e){return js.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=js.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return js.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),qs.prototype=Object.assign(Object.create(Ws.prototype),{constructor:qs,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){Ws.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push(i.clone())}return this},toJSON:function(){var e=Ws.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e},fromJSON:function(e){Ws.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push((new Ws).fromJSON(i))}return this}}),Xs.prototype=Object.assign(Object.create(oe.prototype),{constructor:Xs,isLight:!0,copy:function(e){return oe.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=oe.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Ys.prototype=Object.assign(Object.create(Xs.prototype),{constructor:Ys,isHemisphereLight:!0,copy:function(e){return Xs.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Js.prototype,{_projScreenMatrix:new k,_lightPositionWorld:new D,_lookTarget:new D,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,i=this._projScreenMatrix,r=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),r.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(r),t.updateMatrixWorld(),i.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(i),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),Zs.prototype=Object.assign(Object.create(Js.prototype),{constructor:Zs,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=2*_.RAD2DEG*e.angle,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),Js.prototype.updateMatrices.call(this,e)}}),Ks.prototype=Object.assign(Object.create(Xs.prototype),{constructor:Ks,isSpotLight:!0,copy:function(e){return Xs.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Qs.prototype=Object.assign(Object.create(Js.prototype),{constructor:Qs,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var n=this.camera,i=this.matrix,r=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;r.setFromMatrixPosition(e.matrixWorld),n.position.copy(r),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),i.makeTranslation(-r.x,-r.y,-r.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),$s.prototype=Object.assign(Object.create(Xs.prototype),{constructor:$s,isPointLight:!0,copy:function(e){return Xs.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),el.prototype=Object.assign(Object.create(nn.prototype),{constructor:el,isOrthographicCamera:!0,copy:function(e,t){return nn.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(r+=l*this.view.offsetX)+l*this.view.width,s=(o-=c*this.view.offsetY)-c*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=oe.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),tl.prototype=Object.assign(Object.create(Js.prototype),{constructor:tl,isDirectionalLightShadow:!0,updateMatrices:function(e){Js.prototype.updateMatrices.call(this,e)}}),nl.prototype=Object.assign(Object.create(Xs.prototype),{constructor:nl,isDirectionalLight:!0,copy:function(e){return Xs.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),il.prototype=Object.assign(Object.create(Xs.prototype),{constructor:il,isAmbientLight:!0}),rl.prototype=Object.assign(Object.create(Xs.prototype),{constructor:rl,isRectAreaLight:!0,copy:function(e){return Xs.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=Xs.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(al.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*r),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*i*1.092548),t.addScaledVector(a[5],i*r*1.092548),t.addScaledVector(a[6],.315392*(3*r*r-1)),t.addScaledVector(a[7],n*r*1.092548),t.addScaledVector(a[8],.546274*(n*n-i*i)),t},getIrradianceAt:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*i),t.addScaledVector(a[2],1.023328*r),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*i),t.addScaledVector(a[5],.858086*i*r),t.addScaledVector(a[6],.743125*r*r-.247708),t.addScaledVector(a[7],.858086*n*r),t.addScaledVector(a[8],.429043*(n*n-i*i)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(e,t){void 0===t&&(t=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}}),Object.assign(al,{getBasisAt:function(e,t){var n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}),ol.prototype=Object.assign(Object.create(Xs.prototype),{constructor:ol,isLightProbe:!0,copy:function(e){return Xs.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=Xs.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),sl.prototype=Object.assign(Object.create(ms.prototype),{constructor:sl,load:function(e,t,n,i){var r=this,a=new vs(r.manager);a.setPath(r.path),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)},parse:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i=new Zo[e.type];if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=(new Ke).setHex(e.sheen)),void 0!==e.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&i.specular.setHex(e.specular),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),1!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(i.skinning=e.skinning),void 0!==e.morphTargets&&(i.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(i.morphNormals=e.morphNormals),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.vertexTangents&&(i.vertexTangents=e.vertexTangents),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var r in e.uniforms){var a=e.uniforms[r];switch(i.uniforms[r]={},a.type){case"t":i.uniforms[r].value=n(a.value);break;case"c":i.uniforms[r].value=(new Ke).setHex(a.value);break;case"v2":i.uniforms[r].value=(new M).fromArray(a.value);break;case"v3":i.uniforms[r].value=(new D).fromArray(a.value);break;case"v4":i.uniforms[r].value=(new L).fromArray(a.value);break;case"m3":i.uniforms[r].value=(new S).fromArray(a.value);case"m4":i.uniforms[r].value=(new k).fromArray(a.value);break;default:i.uniforms[r].value=a.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var o in e.extensions)i.extensions[o]=e.extensions[o];if(void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),i.normalScale=(new M).fromArray(s)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new M).fromArray(e.clearcoatNormalScale)),i},setTextures:function(e){return this.textures=e,this}});var ll=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}},cl=function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)};function hl(){Tt.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function ul(e,t,n,i){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),ot.call(this,e,t,n),this.meshPerAttribute=i||1}function pl(e){ms.call(this,e)}hl.prototype=Object.assign(Object.create(Tt.prototype),{constructor:hl,isInstancedBufferGeometry:!0,copy:function(e){return Tt.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=Tt.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),ul.prototype=Object.assign(Object.create(ot.prototype),{constructor:ul,isInstancedBufferAttribute:!0,copy:function(e){return ot.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=ot.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),pl.prototype=Object.assign(Object.create(ms.prototype),{constructor:pl,load:function(e,t,n,i){var r=this,a=new vs(r.manager);a.setPath(r.path),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)},parse:function(e){var t=e.isInstancedBufferGeometry?new hl:new Tt,n=e.data.index;if(void 0!==n){var i=new dl[n.type](n.array);t.setIndex(new ot(i,1))}var r=e.data.attributes;for(var a in r){var o=r[a],s=(i=new dl[o.type](o.array),new(o.isInstancedBufferAttribute?ul:ot)(i,o.itemSize,o.normalized));void 0!==o.name&&(s.name=o.name),t.setAttribute(a,s)}var l=e.data.morphAttributes;if(l)for(var a in l){for(var c=l[a],h=[],u=0,p=c.length;u<p;u++){o=c[u],s=new ot(i=new dl[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),h.push(s)}t.morphAttributes[a]=h}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var d=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==d){u=0;for(var f=d.length;u!==f;++u){var m=d[u];t.addGroup(m.start,m.count,m.materialIndex)}}var g=e.data.boundingSphere;if(void 0!==g){var v=new D;void 0!==g.center&&v.fromArray(g.center),t.boundingSphere=new Se(v,g.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var dl={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function fl(e){ms.call(this,e)}fl.prototype=Object.assign(Object.create(ms.prototype),{constructor:fl,load:function(e,t,n,i){var r=this,a=""===this.path?cl(e):this.path;this.resourcePath=this.resourcePath||a;var o=new vs(r.manager);o.setPath(this.path),o.load(e,(function(n){var a=null;try{a=JSON.parse(n)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?r.parse(a,t):console.error("THREE.ObjectLoader: Can't load "+e)}),n,i)},parse:function(e,t){var n=this.parseShape(e.shapes),i=this.parseGeometries(e.geometries,n),r=this.parseImages(e.images,(function(){void 0!==t&&t(s)})),a=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,i,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var n=0,i=e.length;n<i;n++){var r=(new qs).fromJSON(e[n]);t[r.uuid]=r}return t},parseGeometries:function(e,t){var n={};if(void 0!==e)for(var i=new pl,r=0,a=e.length;r<a;r++){var o,s=e[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Bo[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Bo[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Bo[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Bo[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Bo[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Bo[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new Bo[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Bo[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Bo[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Bo[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new Bo[s.type]((new Vs[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Bo[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new Bo[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var l=[],c=0,h=s.shapes.length;c<h;c++){var u=t[s.shapes[c]];l.push(u)}o=new Bo[s.type](l,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(l=[],c=0,h=s.shapes.length;c<h;c++){u=t[s.shapes[c]];l.push(u)}var p=s.options.extrudePath;void 0!==p&&(s.options.extrudePath=(new Vs[p.type]).fromJSON(p)),o=new Bo[s.type](l,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(s);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},i={};if(void 0!==e){var r=new sl;r.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if("MultiMaterial"===s.type){for(var l=[],c=0;c<s.materials.length;c++){var h=s.materials[c];void 0===n[h.uuid]&&(n[h.uuid]=r.parse(h)),l.push(n[h.uuid])}i[s.uuid]=l}else void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n],r=hs.parse(i);void 0!==i.uuid&&(r.uuid=i.uuid),t.push(r)}return t},parseImages:function(e,t){var n=this,i={};function r(e){return n.manager.itemStart(e),a.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}if(void 0!==e&&e.length>0){var a=new ws(new ds(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var l=e[o],c=l.url;if(Array.isArray(c)){i[l.uuid]=[];for(var h=0,u=c.length;h<u;h++){var p=c[h],d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(p)?p:n.resourcePath+p;i[l.uuid].push(r(d))}}else{d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:n.resourcePath+l.url;i[l.uuid]=r(d)}}}return i},parseTextures:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var i={};if(void 0!==e)for(var r=0,a=e.length;r<a;r++){var o,s=e[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(o=Array.isArray(t[s.image])?new Rn(t[s.image]):new A(t[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=n(s.mapping,gl)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=n(s.wrap[0],vl),o.wrapT=n(s.wrap[1],vl)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=n(s.minFilter,yl)),void 0!==s.magFilter&&(o.magFilter=n(s.magFilter,yl)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),i[s.uuid]=o}return i},parseObject:function(e,t,n){var i;function r(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function a(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],i=0,r=e.length;i<r;i++){var a=e[i];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),t.push(n[a])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}switch(e.type){case"Scene":i=new se,void 0!==e.background&&Number.isInteger(e.background)&&(i.background=new Ke(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?i.fog=new vr(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(i.fog=new gr(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":i=new rn(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(i.focus=e.focus),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.filmGauge&&(i.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(i.filmOffset=e.filmOffset),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"OrthographicCamera":i=new el(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"AmbientLight":i=new il(e.color,e.intensity);break;case"DirectionalLight":i=new nl(e.color,e.intensity);break;case"PointLight":i=new $s(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":i=new rl(e.color,e.intensity,e.width,e.height);break;case"SpotLight":i=new Ks(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":i=new Ys(e.color,e.groundColor,e.intensity);break;case"LightProbe":i=(new ol).fromJSON(e);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":i=new Vt(o=r(e.geometry),s=a(e.material));break;case"InstancedMesh":var o=r(e.geometry),s=a(e.material),l=e.count,c=e.instanceMatrix;(i=new ea(o,s,l)).instanceMatrix=new ot(new Float32Array(c.array),16);break;case"LOD":i=new jr;break;case"Line":i=new sa(r(e.geometry),a(e.material),e.mode);break;case"LineLoop":i=new ua(r(e.geometry),a(e.material));break;case"LineSegments":i=new ha(r(e.geometry),a(e.material));break;case"PointCloud":case"Points":i=new va(r(e.geometry),a(e.material));break;case"Sprite":i=new Nr(a(e.material));break;case"Group":i=new ur;break;default:i=new oe}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(i.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.frustumCulled&&(i.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(i.renderOrder=e.renderOrder),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.layers&&(i.layers.mask=e.layers),void 0!==e.children)for(var h=e.children,u=0;u<h.length;u++)i.add(this.parseObject(h[u],t,n));if("LOD"===e.type){void 0!==e.autoUpdate&&(i.autoUpdate=e.autoUpdate);for(var p=e.levels,d=0;d<p.length;d++){var f=p[d],m=i.getObjectByProperty("uuid",f.object);void 0!==m&&i.addLevel(m,f.distance)}}return i}});var ml,gl={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},vl={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},yl={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008};function xl(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),ms.call(this,e),this.options=void 0}function bl(){this.type="ShapePath",this.color=new Ke,this.subPaths=[],this.currentPath=null}function wl(e){this.type="Font",this.data=e}function _l(e,t,n,i,r){var a=r.glyphs[e]||r.glyphs["?"];if(a){var o,s,l,c,h,u,p,d,f=new bl;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),g=0,v=m.length;g<v;){switch(m[g++]){case"m":o=m[g++]*t+n,s=m[g++]*t+i,f.moveTo(o,s);break;case"l":o=m[g++]*t+n,s=m[g++]*t+i,f.lineTo(o,s);break;case"q":l=m[g++]*t+n,c=m[g++]*t+i,h=m[g++]*t+n,u=m[g++]*t+i,f.quadraticCurveTo(h,u,l,c);break;case"b":l=m[g++]*t+n,c=m[g++]*t+i,h=m[g++]*t+n,u=m[g++]*t+i,p=m[g++]*t+n,d=m[g++]*t+i,f.bezierCurveTo(h,u,p,d,l,c)}}return{offsetX:a.ha*t,path:f}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+r.familyName+".")}function Ml(e){ms.call(this,e)}xl.prototype=Object.assign(Object.create(ms.prototype),{constructor:xl,setOptions:function(e){return this.options=e,this},load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=ps.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;fetch(e).then((function(e){return e.blob()})).then((function(e){return void 0===r.options?createImageBitmap(e):createImageBitmap(e,r.options)})).then((function(n){ps.add(e,n),t&&t(n),r.manager.itemEnd(e)})).catch((function(t){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)})),r.manager.itemStart(e)}}),Object.assign(bl.prototype,{moveTo:function(e,t){return this.currentPath=new Ws,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this},bezierCurveTo:function(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n],a=new qs;a.curves=r.curves,t.push(a)}return t}function i(e,t){for(var n=t.length,i=!1,r=n-1,a=0;a<n;r=a++){var o=t[r],s=t[a],l=s.x-o.x,c=s.y-o.y;if(Math.abs(c)>Number.EPSILON){if(c<0&&(o=t[a],l=-l,s=t[r],c=-c),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var h=c*(e.x-o.x)-l*(e.y-o.y);if(0===h)return!0;if(h<0)continue;i=!i}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return i}var r=fo.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,l,c=[];if(1===a.length)return s=a[0],(l=new qs).curves=s.curves,c.push(l),c;var h=!r(a[0].getPoints());h=e?!h:h;var u,p,d=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=a.length;v<y;v++)o=r(u=(s=a[v]).getPoints()),(o=e?!o:o)?(!h&&f[g]&&g++,f[g]={s:new qs,p:u},f[g].s.curves=s.curves,h&&g++,m[g]=[]):m[g].push({h:s,p:u[0]});if(!f[0])return n(a);if(f.length>1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)d[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],S=0;S<M.length;S++){for(var T=M[S],E=!0,A=0;A<f.length;A++)i(T.p,f[A].p)&&(w!==A&&b.push({froms:w,tos:A,hole:S}),E?(E=!1,d[A].push(T)):x=!0);E&&d[w].push(T)}b.length>0&&(x||(m=d))}v=0;for(var L=f.length;v<L;v++){l=f[v].s,c.push(l);for(var R=0,P=(p=m[v]).length;R<P;R++)l.holes.push(p[R].h)}return c}}),Object.assign(wl.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var n=[],i=function(e,t,n){for(var i=Array.from?Array.from(e):String(e).split(""),r=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,o=[],s=0,l=0,c=0;c<i.length;c++){var h=i[c];if("\n"===h)s=0,l-=a;else{var u=_l(h,r,s,l,n);s+=u.offsetX,o.push(u.path)}}return o}(e,t,this.data),r=0,a=i.length;r<a;r++)Array.prototype.push.apply(n,i[r].toShapes());return n}}),Ml.prototype=Object.assign(Object.create(ms.prototype),{constructor:Ml,load:function(e,t,n,i){var r=this,a=new vs(this.manager);a.setPath(this.path),a.load(e,(function(e){var n;try{n=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(e.substring(65,e.length-2))}var i=r.parse(n);t&&t(i)}),n,i)},parse:function(e){return new wl(e)}});var Sl=function(){return void 0===ml&&(ml=new(window.AudioContext||window.webkitAudioContext)),ml};function Tl(e){ms.call(this,e)}function El(e,t,n){ol.call(this,void 0,n);var i=(new Ke).set(e),r=(new Ke).set(t),a=new D(i.r,i.g,i.b),o=new D(r.r,r.g,r.b),s=Math.sqrt(Math.PI),l=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(l)}function Al(e,t){ol.call(this,void 0,t);var n=(new Ke).set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}Tl.prototype=Object.assign(Object.create(ms.prototype),{constructor:Tl,load:function(e,t,n,i){var r=this,a=new vs(r.manager);a.setResponseType("arraybuffer"),a.setPath(r.path),a.load(e,(function(n){try{var a=n.slice(0);Sl().decodeAudioData(a,(function(e){t(e)}))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}}),El.prototype=Object.assign(Object.create(ol.prototype),{constructor:El,isHemisphereLightProbe:!0,copy:function(e){return ol.prototype.copy.call(this,e),this},toJSON:function(e){return ol.prototype.toJSON.call(this,e)}}),Al.prototype=Object.assign(Object.create(ol.prototype),{constructor:Al,isAmbientLightProbe:!0,copy:function(e){return ol.prototype.copy.call(this,e),this},toJSON:function(e){return ol.prototype.toJSON.call(this,e)}});var Ll=new k,Rl=new k;function Pl(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(function(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new rn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new rn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var n,i,r=e.projectionMatrix.clone(),a=t.eyeSep/2,o=a*t.near/t.focus,s=t.near*Math.tan(_.DEG2RAD*t.fov*.5)/t.zoom;Rl.elements[12]=-a,Ll.elements[12]=a,n=-s*t.aspect+o,i=s*t.aspect+o,r.elements[0]=2*t.near/(i-n),r.elements[8]=(i+n)/(i-n),this.cameraL.projectionMatrix.copy(r),n=-s*t.aspect-o,i=s*t.aspect-o,r.elements[0]=2*t.near/(i-n),r.elements[8]=(i+n)/(i-n),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Rl),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Ll)}}),Object.assign(Pl.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});var Cl=new D,Ol=new C,Il=new D,Dl=new D;function Nl(){oe.call(this),this.type="AudioListener",this.context=Sl(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Pl}function zl(e){oe.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this._startedAt=0,this._progress=0,this.filters=[]}Nl.prototype=Object.assign(Object.create(oe.prototype),{constructor:Nl,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){oe.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Cl,Ol,Il),Dl.set(0,0,-1).applyQuaternion(Ol),t.positionX){var i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Cl.x,i),t.positionY.linearRampToValueAtTime(Cl.y,i),t.positionZ.linearRampToValueAtTime(Cl.z,i),t.forwardX.linearRampToValueAtTime(Dl.x,i),t.forwardY.linearRampToValueAtTime(Dl.y,i),t.forwardZ.linearRampToValueAtTime(Dl.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Cl.x,Cl.y,Cl.z),t.setOrientation(Dl.x,Dl.y,Dl.z,n.x,n.y,n.z)}}),zl.prototype=Object.assign(Object.create(oe.prototype),{constructor:zl,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(e){if(void 0===e&&(e=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});var Ul=new D,Fl=new C,Bl=new D,Hl=new D;function Gl(e){zl.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function kl(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function Vl(e,t,n){var i,r,a;switch(this.binding=e,this.valueSize=n,t){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}Gl.prototype=Object.assign(Object.create(zl.prototype),{constructor:Gl,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(oe.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(Ul,Fl,Bl),Hl.set(0,0,1).applyQuaternion(Fl);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Ul.x,n),t.positionY.linearRampToValueAtTime(Ul.y,n),t.positionZ.linearRampToValueAtTime(Ul.z,n),t.orientationX.linearRampToValueAtTime(Hl.x,n),t.orientationY.linearRampToValueAtTime(Hl.y,n),t.orientationZ.linearRampToValueAtTime(Hl.z,n)}else t.setPosition(Ul.x,Ul.y,Ul.z),t.setOrientation(Hl.x,Hl.y,Hl.z)}}}),Object.assign(kl.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(Vl.prototype,{accumulate:function(e,t){var n=this.buffer,i=this.valueSize,r=e*i+i,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==i;++o)n[r+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,r,0,s,i)}this.cumulativeWeight=a},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){var s=t*this._origIndex;this._mixBufferRegion(n,i,s,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(var l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){o.setValue(n,i);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(var r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[4*this._addIndex+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,i,r){if(i>=.5)for(var a=0;a!==r;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,i){C.slerpFlat(e,t,e,t,e,n,i)},_slerpAdditive:function(e,t,n,i,r){var a=this._workIndex*r;C.multiplyQuaternionsFlat(e,a,e,t,e,n),C.slerpFlat(e,t,e,t,e,a,i)},_lerp:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}},_lerpAdditive:function(e,t,n,i,r){for(var a=0;a!==r;++a){var o=t+a;e[o]=e[o]+e[n+a]*i}}});var jl=new RegExp("[\\[\\]\\.:\\/]","g"),Wl="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",ql=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Xl=/(WCOD+)?/.source.replace("WCOD",Wl),Yl=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Jl=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Zl=new RegExp("^"+ql+Xl+Yl+Jl+"$"),Kl=["material","materials","bones"];function Ql(e,t,n){var i=n||$l.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}function $l(e,t,n){this.path=t,this.parsedPath=n||$l.parseTrackName(t),this.node=$l.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function ec(e,t,n,i){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=i||t.blendMode;for(var r=t.tracks,a=r.length,o=new Array(a),s={endingStart:2400,endingEnd:2400},l=0;l!==a;++l){var c=r[l].createInterpolant(null);o[l]=c,c.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function tc(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function nc(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function ic(e,t,n){yr.call(this,e,t),this.meshPerAttribute=n||1}function rc(e,t,n,i){this.ray=new Oe(e,t),this.near=n||0,this.far=i||1/0,this.camera=null,this.layers=new q,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function ac(e,t){return e.distance-t.distance}function oc(e,t,n,i){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===i)for(var r=e.children,a=0,o=r.length;a<o;a++)oc(r[a],t,n,!0)}function sc(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this}Object.assign(Ql.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign($l,{Composite:Ql,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new $l.Composite(e,t,n):new $l(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(jl,"")},parseTrackName:function(e){var t=Zl.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var r=n.nodeName.substring(i+1);-1!==Kl.indexOf(r)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var i=function(e){for(var n=0;n<e.length;n++){var r=e[n];if(r.name===t||r.uuid===t)return r;var a=i(r.children);if(a)return a}return null},r=i(e.children);if(r)return r}return null}}),Object.assign($l.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)e[t++]=n[i]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=$l.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==a){if(void 0===e[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[i];if(void 0!==s){var l=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(c=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}else{var h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign($l.prototype,{_getValue_unbound:$l.prototype.getValue,_setValue_unbound:$l.prototype.setValue}),Object.assign(function(){this.uuid=_.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,l=void 0,c=0,h=arguments.length;c!==h;++c){var u=arguments[c],p=u.uuid,d=i[p];if(void 0===d){d=t++,i[p]=d,e.push(u);for(var f=0,m=s;f!==m;++f)o[f].push(new $l(u,r[f],a[f]))}else if(d<n){l=e[d];var g=--n,v=e[g];i[v.uuid]=d,e[d]=v,i[p]=g,e[g]=u;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[g],b=y[d];y[d]=x,void 0===b&&(b=new $l(u,r[f],a[f])),y[g]=b}}else e[d]!==l&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,r=i.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,c=n[l];if(void 0!==c&&c>=t){var h=t++,u=e[h];n[u.uuid]=c,e[c]=u,n[l]=h,e[h]=s;for(var p=0,d=r;p!==d;++p){var f=i[p],m=f[h],g=f[c];f[c]=m,f[h]=g}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],c=l.uuid,h=i[c];if(void 0!==h)if(delete i[c],h<n){var u=--n,p=e[u],d=e[y=--t];i[p.uuid]=h,e[h]=p,i[d.uuid]=u,e[u]=d,e.pop();for(var f=0,m=a;f!==m;++f){var g=(x=r[f])[u],v=x[y];x[h]=g,x[u]=v,x.pop()}}else{var y;i[(d=e[y=--t]).uuid]=h,e[h]=d,e.pop();for(f=0,m=a;f!==m;++f){var x;(x=r[f])[h]=x[y],x.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(void 0!==i)return r[i];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,a.push(e),o.push(t),r.push(h);for(var u=c,p=s.length;u!==p;++u){var d=s[u];h[u]=new $l(d,e,t)}return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}),Object.assign(ec.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var i=this._mixer,r=i.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,l=a.sampleValues;return s[0]=r,s[1]=r+n,l[0]=e/o,l[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,i){if(this.enabled){var r=this._startTime;if(null!==r){var a=(e-r)*n;if(a<0||0===n)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case 2501:for(var h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulateAdditive(s);break;case 2500:default:for(h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulate(i,s)}}}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,i=this.loop,r=this._loopCount,a=2202===i;if(0===e)return-1===r?t:a&&1==(1&r)?n-t:t;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&1==(1&r))return n-t}return t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,i.endingEnd=t?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}}),tc.prototype=Object.assign(Object.create(y.prototype),{constructor:tc,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var h=0;h!==r;++h){var u=i[h],p=u.name,d=c[p];if(void 0!==d)a[h]=d;else{if(void 0!==(d=a[h])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;++(d=new Vl($l.create(n,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),a[h]=d}o[h].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var i=this._actions,r=this._actionsByClip,a=r[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;var r=e._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,l=s[s.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_addInactiveBinding:function(e,t,n){var i=this._bindingsByRootAndName,r=i[t],a=this._bindings;void 0===r&&(r={},i[t]=r),r[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],s=t[t.length-1],l=e._cacheIndex;s._cacheIndex=l,t[l]=s,t.pop(),delete o[r],0===Object.keys(o).length&&delete a[i]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new es(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var i=t||this._root,r=i.uuid,a="string"==typeof e?hs.findByName(i,e):e,o=null!==a?a.uuid:e,s=this._actionsByClip[o],l=null;if(void 0===n&&(n=null!==a?a.blendMode:2500),void 0!==s){var c=s.actionByRoot[r];if(void 0!==c&&c.blendMode===n)return c;l=s.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;var h=new ec(this,a,t,n);return this._bindAction(h,l),this._addInactiveAction(h,o,r),h},existingAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?hs.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[i]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(i,e,r,a)}var s=this._bindings,l=this._nActiveBindings;for(o=0;o!==l;++o)s[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var c=l._cacheIndex,h=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,h._cacheIndex=c,t[c]=h,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),nc.prototype.clone=function(){return new nc(void 0===this.value.clone?this.value:this.value.clone())},ic.prototype=Object.assign(Object.create(yr.prototype),{constructor:ic,isInstancedInterleavedBuffer:!0,copy:function(e){return yr.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(rc.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var i=n||[];return oc(e,this,i,t),i.sort(ac),i},intersectObjects:function(e,t,n){var i=n||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var r=0,a=e.length;r<a;r++)oc(e[r],this,i,t);return i.sort(ac),i}}),Object.assign(sc.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(_.clamp(t/this.radius,-1,1))),this}}),Object.assign(function(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}});var lc=new M;function cc(e,t){this.min=void 0!==e?e:new M(1/0,1/0),this.max=void 0!==t?t:new M(-1/0,-1/0)}Object.assign(cc.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=lc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new M),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new M),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new M),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new M),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return lc.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var hc=new D,uc=new D;function pc(e,t){this.start=void 0!==e?e:new D,this.end=void 0!==t?t:new D}function dc(e){oe.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}Object.assign(pc.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new D),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new D),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new D),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){hc.subVectors(e,this.start),uc.subVectors(this.end,this.start);var n=uc.dot(uc),i=uc.dot(hc)/n;return t&&(i=_.clamp(i,0,1)),i},closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new D),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),dc.prototype=Object.create(oe.prototype),dc.prototype.constructor=dc,dc.prototype.isImmediateRenderObject=!0;var fc=new D;function mc(e,t){oe.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new Tt,i=[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],r=0,a=1;r<32;r++,a++){var o=r/32*Math.PI*2,s=a/32*Math.PI*2;i.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new ft(i,3));var l=new ta({fog:!1,toneMapped:!1});this.cone=new ha(n,l),this.add(this.cone),this.update()}mc.prototype=Object.create(oe.prototype),mc.prototype.constructor=mc,mc.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},mc.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),fc.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(fc),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var gc=new D,vc=new k,yc=new k;function xc(e){for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var i=0;i<t.children.length;i++)n.push.apply(n,e(t.children[i]));return n}(e),n=new Tt,i=[],r=[],a=new Ke(0,0,1),o=new Ke(0,1,0),s=0;s<t.length;s++){var l=t[s];l.parent&&l.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new ft(i,3)),n.setAttribute("color",new ft(r,3));var c=new ta({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});ha.call(this,n,c),this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function bc(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var i=new So(t,4,2),r=new rt({wireframe:!0,fog:!1,toneMapped:!1});Vt.call(this,i,r),this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}xc.prototype=Object.create(ha.prototype),xc.prototype.constructor=xc,xc.prototype.isSkeletonHelper=!0,xc.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,i=n.getAttribute("position");yc.getInverse(this.root.matrixWorld);for(var r=0,a=0;r<t.length;r++){var o=t[r];o.parent&&o.parent.isBone&&(vc.multiplyMatrices(yc,o.matrixWorld),gc.setFromMatrixPosition(vc),i.setXYZ(a,gc.x,gc.y,gc.z),vc.multiplyMatrices(yc,o.parent.matrixWorld),gc.setFromMatrixPosition(vc),i.setXYZ(a+1,gc.x,gc.y,gc.z),a+=2)}n.getAttribute("position").needsUpdate=!0,oe.prototype.updateMatrixWorld.call(this,e)},bc.prototype=Object.create(Vt.prototype),bc.prototype.constructor=bc,bc.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},bc.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var wc=new D,_c=new Ke,Mc=new Ke;function Sc(e,t,n){oe.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var i=new Ca(t);i.rotateY(.5*Math.PI),this.material=new rt({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);var r=i.getAttribute("position"),a=new Float32Array(3*r.count);i.setAttribute("color",new ot(a,3)),this.add(new Vt(i,this.material)),this.update()}function Tc(e,t,n,i){e=e||10,t=t||10,n=new Ke(void 0!==n?n:4473924),i=new Ke(void 0!==i?i:8947848);for(var r=t/2,a=e/t,o=e/2,s=[],l=[],c=0,h=0,u=-o;c<=t;c++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var p=c===r?n:i;p.toArray(l,h),h+=3,p.toArray(l,h),h+=3,p.toArray(l,h),h+=3,p.toArray(l,h),h+=3}var d=new Tt;d.setAttribute("position",new ft(s,3)),d.setAttribute("color",new ft(l,3));var f=new ta({vertexColors:!0,toneMapped:!1});ha.call(this,d,f),this.type="GridHelper"}function Ec(e,t,n,i,r,a){e=e||10,t=t||16,n=n||8,i=i||64,r=new Ke(void 0!==r?r:4473924),a=new Ke(void 0!==a?a:8947848);var o,s,l,c,h,u,p,d=[],f=[];for(c=0;c<=t;c++)l=c/t*(2*Math.PI),o=Math.sin(l)*e,s=Math.cos(l)*e,d.push(0,0,0),d.push(o,0,s),p=1&c?r:a,f.push(p.r,p.g,p.b),f.push(p.r,p.g,p.b);for(c=0;c<=n;c++)for(p=1&c?r:a,u=e-e/n*c,h=0;h<i;h++)l=h/i*(2*Math.PI),o=Math.sin(l)*u,s=Math.cos(l)*u,d.push(o,0,s),f.push(p.r,p.g,p.b),l=(h+1)/i*(2*Math.PI),o=Math.sin(l)*u,s=Math.cos(l)*u,d.push(o,0,s),f.push(p.r,p.g,p.b);var m=new Tt;m.setAttribute("position",new ft(d,3)),m.setAttribute("color",new ft(f,3));var g=new ta({vertexColors:!0,toneMapped:!1});ha.call(this,m,g),this.type="PolarGridHelper"}Sc.prototype=Object.create(oe.prototype),Sc.prototype.constructor=Sc,Sc.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Sc.prototype.update=function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");_c.copy(this.light.color),Mc.copy(this.light.groundColor);for(var n=0,i=t.count;n<i;n++){var r=n<i/2?_c:Mc;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}e.lookAt(wc.setFromMatrixPosition(this.light.matrixWorld).negate())},Tc.prototype=Object.assign(Object.create(ha.prototype),{constructor:Tc,copy:function(e){return ha.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),Ec.prototype=Object.create(ha.prototype),Ec.prototype.constructor=Ec;var Ac=new D,Lc=new D,Rc=new D;function Pc(e,t,n){oe.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);var i=new Tt;i.setAttribute("position",new ft([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var r=new ta({fog:!1,toneMapped:!1});this.lightPlane=new sa(i,r),this.add(this.lightPlane),(i=new Tt).setAttribute("position",new ft([0,0,0,0,0,1],3)),this.targetLine=new sa(i,r),this.add(this.targetLine),this.update()}Pc.prototype=Object.create(oe.prototype),Pc.prototype.constructor=Pc,Pc.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Pc.prototype.update=function(){Ac.setFromMatrixPosition(this.light.matrixWorld),Lc.setFromMatrixPosition(this.light.target.matrixWorld),Rc.subVectors(Lc,Ac),this.lightPlane.lookAt(Lc),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Lc),this.targetLine.scale.z=Rc.length()};var Cc=new D,Oc=new nn;function Ic(e){var t=new Tt,n=new ta({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],a={},o=new Ke(16755200),s=new Ke(16711680),l=new Ke(43775),c=new Ke(16777215),h=new Ke(3355443);function u(e,t,n){p(e,n),p(t,n)}function p(e,t){i.push(0,0,0),r.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(i.length/3-1)}u("n1","n2",o),u("n2","n4",o),u("n4","n3",o),u("n3","n1",o),u("f1","f2",o),u("f2","f4",o),u("f4","f3",o),u("f3","f1",o),u("n1","f1",o),u("n2","f2",o),u("n3","f3",o),u("n4","f4",o),u("p","n1",s),u("p","n2",s),u("p","n3",s),u("p","n4",s),u("u1","u2",l),u("u2","u3",l),u("u3","u1",l),u("c","t",c),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),t.setAttribute("position",new ft(i,3)),t.setAttribute("color",new ft(r,3)),ha.call(this,t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Dc(e,t,n,i,r,a,o){Cc.set(r,a,o).unproject(i);var s=t[e];if(void 0!==s)for(var l=n.getAttribute("position"),c=0,h=s.length;c<h;c++)l.setXYZ(s[c],Cc.x,Cc.y,Cc.z)}Ic.prototype=Object.create(ha.prototype),Ic.prototype.constructor=Ic,Ic.prototype.update=function(){var e=this.geometry,t=this.pointMap;Oc.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Dc("c",t,e,Oc,0,0,-1),Dc("t",t,e,Oc,0,0,1),Dc("n1",t,e,Oc,-1,-1,-1),Dc("n2",t,e,Oc,1,-1,-1),Dc("n3",t,e,Oc,-1,1,-1),Dc("n4",t,e,Oc,1,1,-1),Dc("f1",t,e,Oc,-1,-1,1),Dc("f2",t,e,Oc,1,-1,1),Dc("f3",t,e,Oc,-1,1,1),Dc("f4",t,e,Oc,1,1,1),Dc("u1",t,e,Oc,.7,1.1,-1),Dc("u2",t,e,Oc,-.7,1.1,-1),Dc("u3",t,e,Oc,0,2,-1),Dc("cf1",t,e,Oc,-1,0,1),Dc("cf2",t,e,Oc,1,0,1),Dc("cf3",t,e,Oc,0,-1,1),Dc("cf4",t,e,Oc,0,1,1),Dc("cn1",t,e,Oc,-1,0,-1),Dc("cn2",t,e,Oc,1,0,-1),Dc("cn3",t,e,Oc,0,-1,-1),Dc("cn4",t,e,Oc,0,1,-1),e.getAttribute("position").needsUpdate=!0};var Nc=new we;function zc(e,t){this.object=e,void 0===t&&(t=16776960);var n=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]),i=new Float32Array(24),r=new Tt;r.setIndex(new ot(n,1)),r.setAttribute("position",new ot(i,3)),ha.call(this,r,new ta({color:t,toneMapped:!1})),this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}function Uc(e,t){this.type="Box3Helper",this.box=e,t=t||16776960;var n=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]),i=new Tt;i.setIndex(new ot(n,1)),i.setAttribute("position",new ft([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),ha.call(this,i,new ta({color:t,toneMapped:!1})),this.type="Box3Helper",this.geometry.computeBoundingSphere()}function Fc(e,t,n){this.plane=e,this.size=void 0===t?1:t;var i=void 0!==n?n:16776960,r=new Tt;r.setAttribute("position",new ft([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),r.computeBoundingSphere(),sa.call(this,r,new ta({color:i,toneMapped:!1})),this.type="PlaneHelper";var a=new Tt;a.setAttribute("position",new ft([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new Vt(a,new rt({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}zc.prototype=Object.create(ha.prototype),zc.prototype.constructor=zc,zc.prototype.update=function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Nc.setFromObject(this.object),!Nc.isEmpty()){var t=Nc.min,n=Nc.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}},zc.prototype.setFromObject=function(e){return this.object=e,this.update(),this},zc.prototype.copy=function(e){return ha.prototype.copy.call(this,e),this.object=e.object,this},zc.prototype.clone=function(){return(new this.constructor).copy(this)},Uc.prototype=Object.create(ha.prototype),Uc.prototype.constructor=Uc,Uc.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),oe.prototype.updateMatrixWorld.call(this,e))},Fc.prototype=Object.create(sa.prototype),Fc.prototype.constructor=Fc,Fc.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?1:0,this.lookAt(this.plane.normal),oe.prototype.updateMatrixWorld.call(this,e)};var Bc,Hc,Gc=new D;function kc(e,t,n,i,r,a){oe.call(this),this.type="ArrowHelper",void 0===e&&(e=new D(0,0,1)),void 0===t&&(t=new D(0,0,0)),void 0===n&&(n=1),void 0===i&&(i=16776960),void 0===r&&(r=.2*n),void 0===a&&(a=.2*r),void 0===Bc&&((Bc=new Tt).setAttribute("position",new ft([0,0,0,0,1,0],3)),(Hc=new Do(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new sa(Bc,new ta({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Vt(Hc,new rt({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,a)}function Vc(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new Tt;n.setAttribute("position",new ft(t,3)),n.setAttribute("color",new ft([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var i=new ta({vertexColors:!0,toneMapped:!1});ha.call(this,n,i),this.type="AxesHelper"}kc.prototype=Object.create(oe.prototype),kc.prototype.constructor=kc,kc.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Gc.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Gc,t)}},kc.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},kc.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},kc.prototype.copy=function(e){return oe.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},kc.prototype.clone=function(){return(new this.constructor).copy(this)},Vc.prototype=Object.create(ha.prototype),Vc.prototype.constructor=Vc;var jc=Math.pow(2,8),Wc=[.125,.215,.35,.446,.526,.582],qc=5+Wc.length,Xc={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},Yc=new el,{_lodPlanes:Jc,_sizeLods:Zc,_sigmas:Kc}=function(){for(var e=[],t=[],n=[],i=8,r=0;r<qc;r++){var a=Math.pow(2,i);t.push(a);var o=1/a;r>4?o=Wc[r-8+4-1]:0==r&&(o=0),n.push(o);for(var s=1/(a-1),l=-s/2,c=1+s/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=new Float32Array(108),p=new Float32Array(72),d=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,g=f>2?0:-1,v=[m,g,0,m+2/3,g,0,m+2/3,g+1,0,m,g,0,m+2/3,g+1,0,m,g+1,0];u.set(v,18*f),p.set(h,12*f);var y=[f,f,f,f,f,f];d.set(y,6*f)}var x=new Tt;x.setAttribute("position",new ot(u,3)),x.setAttribute("uv",new ot(p,2)),x.setAttribute("faceIndex",new ot(d,1)),e.push(x),i>4&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}(),Qc=null,$c=(1+Math.sqrt(5))/2,eh=1/$c,th=[new D(1,1,1),new D(-1,1,1),new D(1,1,-1),new D(-1,1,-1),new D(0,$c,eh),new D(0,$c,-eh),new D(eh,0,$c),new D(-eh,0,$c),new D($c,eh,0),new D(-$c,eh,0)];function nh(e){var t,n,i,r;this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=(t=20,n=new Float32Array(t),i=new D(0,1,0),(r=new Go({defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i},inputEncoding:{value:Xc[3e3]},outputEncoding:{value:Xc[3e3]}},vertexShader:lh(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n${ch()}\n\n#define ENVMAP_TYPE_CUBE_UV\n#include <cube_uv_reflection_fragment>\n\nvec3 getSample(float theta, vec3 axis) {\n\tfloat cosTheta = cos(theta);\n\t// Rodrigues' axis-angle rotation\n\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\treturn bilinearCubeUV(envMap, sampleDirection, mipInt);\n}\n\nvoid main() {\n\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\tif (all(equal(axis, vec3(0.0))))\n\t\taxis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);\n\taxis = normalize(axis);\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb += weights[0] * getSample(0.0, axis);\n\tfor (int i = 1; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfloat theta = dTheta * float(i);\n\t\tgl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);\n\t\tgl_FragColor.rgb += weights[i] * getSample(theta, axis);\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})).type="SphericalGaussianBlur",r),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}function ih(e){return void 0!==e&&1009===e.type&&(3e3===e.encoding||3001===e.encoding||3007===e.encoding)}function rh(e){var t=new R(3*jc,3*jc,e);return t.texture.mapping=306,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function ah(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function oh(){var e=new Go({uniforms:{envMap:{value:null},texelSize:{value:new M(1,1)},inputEncoding:{value:Xc[3e3]},outputEncoding:{value:Xc[3e3]}},vertexShader:lh(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n${ch()}\n\n#include <common>\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv = equirectUv( outputDirection );\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1});return e.type="EquirectangularToCubeUV",e}function sh(){var e=new Go({uniforms:{envMap:{value:null},inputEncoding:{value:Xc[3e3]},outputEncoding:{value:Xc[3e3]}},vertexShader:lh(),fragmentShader:`\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n${ch()}\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1});return e.type="CubemapToCubeUV",e}function lh(){return"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\n\n// RH coordinate system; PMREM face-indexing convention\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\t} else if (face == 2.0) {\n\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\t} else if (face == 5.0) {\n\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\t}\n\treturn direction;\n}\n\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t"}function ch(){return"\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t"}function hh(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Os.call(this,e),this.type="catmullrom"}nh.prototype={constructor:nh,fromScene:function(e,t=0,n=.1,i=100){Qc=this._renderer.getRenderTarget();var r=this._allocateTargets();return this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r},fromEquirectangular:function(e){return e.magFilter=1003,e.minFilter=1003,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){Qc=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t},compileCubemapShader:function(){null===this._cubemapShader&&(this._cubemapShader=sh(),this._compileMaterial(this._cubemapShader))},compileEquirectangularShader:function(){null===this._equirectShader&&(this._equirectShader=oh(),this._compileMaterial(this._equirectShader))},dispose:function(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(var e=0;e<Jc.length;e++)Jc[e].dispose()},_cleanup:function(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Qc),e.scissorTest=!1,e.setSize(e.width,e.height)},_allocateTargets:function(e){var t={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:1009,format:1023,encoding:ih(e)?e.encoding:3002,depthBuffer:!1,stencilBuffer:!1},n=rh(t);return n.depthBuffer=!e,this._pingPongRenderTarget=rh(t),n},_compileMaterial:function(e){var t=new Vt(Jc[0],e);this._renderer.compile(t,Yc)},_sceneToCubeUV:function(e,t,n,i){var r=new rn(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.outputEncoding,c=s.toneMapping,h=s.toneMappingExposure,u=s.getClearColor(),p=s.getClearAlpha();s.toneMapping=1,s.toneMappingExposure=1,s.outputEncoding=3e3;var d=e.background;if(d&&d.isColor){d.convertSRGBToLinear();var f=Math.max(d.r,d.g,d.b),m=Math.min(Math.max(Math.ceil(Math.log2(f)),-128),127);d=d.multiplyScalar(Math.pow(2,-m));var g=(m+128)/255;s.setClearColor(d,g),e.background=null}for(var v=0;v<6;v++){var y=v%3;0==y?(r.up.set(0,a[v],0),r.lookAt(o[v],0,0)):1==y?(r.up.set(0,0,a[v]),r.lookAt(0,o[v],0)):(r.up.set(0,a[v],0),r.lookAt(0,0,o[v])),ah(i,y*jc,v>2?jc:0,jc,jc),s.setRenderTarget(i),s.render(e,r)}s.toneMapping=c,s.toneMappingExposure=h,s.outputEncoding=l,s.setClearColor(u,p)},_textureToCubeUV:function(e,t){var n=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=sh()):null==this._equirectShader&&(this._equirectShader=oh());var i=e.isCubeTexture?this._cubemapShader:this._equirectShader,r=new Vt(Jc[0],i),a=i.uniforms;a.envMap.value=e,e.isCubeTexture||a.texelSize.value.set(1/e.image.width,1/e.image.height),a.inputEncoding.value=Xc[e.encoding],a.outputEncoding.value=Xc[t.texture.encoding],ah(t,0,0,3*jc,2*jc),n.setRenderTarget(t),n.render(r,Yc)},_applyPMREM:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var i=1;i<qc;i++){var r=Math.sqrt(Kc[i]*Kc[i]-Kc[i-1]*Kc[i-1]),a=th[(i-1)%th.length];this._blur(e,i-1,i,r,a)}t.autoClear=n},_blur:function(e,t,n,i,r){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)},_halfBlur:function(e,t,n,i,r,a,o){var s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var c=new Vt(Jc[i],l),h=l.uniforms,u=Zc[n]-1,p=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,d=r/p,f=isFinite(r)?1+Math.floor(3*d):20;f>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);for(var m=[],g=0,v=0;v<20;++v){var y=v/d,x=Math.exp(-y*y/2);m.push(x),0==v?g+=x:v<f&&(g+=2*x)}for(v=0;v<m.length;v++)m[v]=m[v]/g;h.envMap.value=e.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===a,o&&(h.poleAxis.value=o),h.dTheta.value=p,h.mipInt.value=8-n,h.inputEncoding.value=Xc[e.texture.encoding],h.outputEncoding.value=Xc[e.texture.encoding];var b=Zc[i];ah(t,y=3*Math.max(0,jc-2*b),(0===i?0:2*jc)+2*b*(i>4?i-8+4:0),3*b,2*b),s.setRenderTarget(t),s.render(c,Yc)}},Ss.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Ss.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(js.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new Zt,n=0,i=e.length;n<i;n++){var r=e[n];t.vertices.push(new D(r.x,r.y,r.z||0))}return t}}),Object.assign(Ws.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),hh.prototype=Object.create(Os.prototype),Object.assign(hh.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),Tc.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},xc.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(ms.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),cl(e)}}),ms.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Object.assign(fl.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(cc.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(we.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(Se.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),hn.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},pc.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(_,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),_.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),_.ceilPowerOfTwo(e)}}),Object.assign(S.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(k.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new D).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,i,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,a)}}),ze.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},C.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(Oe.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(Xe.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(Xe,{barycoordFromPoint:function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Xe.getBarycoord(e,t,n,i,r)},normal:function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Xe.getNormal(e,t,n,i)}}),Object.assign(qs.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new vo(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Ro(this,e)}}),Object.assign(M.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(D.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(L.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Zt.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.assign(oe.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(oe.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.assign(Vt.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}),Object.defineProperties(Vt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(jr.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Yr.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Wr.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Ss.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),rn.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(Xs.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(ot.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),Object.assign(ot.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?35048:35044),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Tt.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new ot(arguments[1],arguments[2])))},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(Tt.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(hl.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}}),Object.defineProperties(rc.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(yr.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),35048===this.usage},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(yr.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?35048:35044),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(yo.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(nc.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(it.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Ke}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(jo.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(tn.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(mr.prototype,{clearTarget:function(e,t,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,i)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(mr.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?3001:3e3}}}),Object.defineProperties(or.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(R.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(zl.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new Tl).load(e,(function(e){t.setBuffer(e)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),kl.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},an.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},T.crossOrigin=void 0,T.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Ms;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},T.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new _s;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},T.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},T.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"117"}}));var uh=function(e){ms.call(this,e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}};uh.prototype=Object.assign(Object.create(ms.prototype),{constructor:uh,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(e,t,n,i){var r=new vs(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),"use-credentials"===this.crossOrigin&&r.setWithCredentials(!0),r.load(e,e=>{var n={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,n).then(t).catch(i)},n,i)},decodeDracoFile:function(e,t,n,i){var r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,r).then(t)},decodeGeometry:function(e,t){for(var n in t.attributeTypes){var i=t.attributeTypes[n];void 0!==i.BYTES_PER_ELEMENT&&(t.attributeTypes[n]=i.name)}var r,a=JSON.stringify(t);if(uh.taskCache.has(e)){var o=uh.taskCache.get(e);if(o.key===a)return o.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var s=this.workerNextTaskID++,l=e.byteLength,c=this._getWorker(s,l).then(n=>(r=n,new Promise((n,i)=>{r._callbacks[s]={resolve:n,reject:i},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return c.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),uh.taskCache.set(e,{key:a,promise:c}),c},_createGeometry:function(e){var t=new Tt;e.index&&t.setIndex(new ot(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var i=e.attributes[n],r=i.name,a=i.array,o=i.itemSize;t.setAttribute(r,new ot(a,o))}return t},_loadLibrary:function(e,t){var n=new vs(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),new Promise((t,i)=>{n.load(e,t,void 0,i)})},preload:function(){return this._initDecoder(),this},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{var n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);var i=uh.DRACOWorker.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending},_getWorker:function(e,t){return this._initDecoder().then(()=>{var n;this.workerPool.length<this.workerLimit?((n=new Worker(this.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},this.workerPool.push(n)):this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));return(n=this.workerPool[this.workerPool.length-1])._taskCosts[e]=t,n._taskLoad+=t,n})},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))},dispose:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}),uh.DRACOWorker=function(){var e,t;function n(e,t,n,i,r,a){var o,s,l=a.num_components(),c=n.num_points()*l;switch(r){case Float32Array:o=new e.DracoFloat32Array,t.GetAttributeFloatForAllPoints(n,a,o),s=new Float32Array(c);break;case Int8Array:o=new e.DracoInt8Array,t.GetAttributeInt8ForAllPoints(n,a,o),s=new Int8Array(c);break;case Int16Array:o=new e.DracoInt16Array,t.GetAttributeInt16ForAllPoints(n,a,o),s=new Int16Array(c);break;case Int32Array:o=new e.DracoInt32Array,t.GetAttributeInt32ForAllPoints(n,a,o),s=new Int32Array(c);break;case Uint8Array:o=new e.DracoUInt8Array,t.GetAttributeUInt8ForAllPoints(n,a,o),s=new Uint8Array(c);break;case Uint16Array:o=new e.DracoUInt16Array,t.GetAttributeUInt16ForAllPoints(n,a,o),s=new Uint16Array(c);break;case Uint32Array:o=new e.DracoUInt32Array,t.GetAttributeUInt32ForAllPoints(n,a,o),s=new Uint32Array(c);break;default:throw new Error("THREE.DRACOLoader: Unexpected attribute type.")}for(var h=0;h<c;h++)s[h]=o.GetValue(h);return e.destroy(o),{name:i,array:s,itemSize:l}}onmessage=function(i){var r=i.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var a=r.buffer,o=r.taskConfig;t.then(e=>{var t=e.draco,i=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(a),a.byteLength);try{var l=function(e,t,i,r){var a,o,s=r.attributeIDs,l=r.attributeTypes,c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,o=t.DecodeBufferToMesh(i,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,o=t.DecodeBufferToPointCloud(i,a)}if(!o.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+o.error_msg());var h={index:null,attributes:[]};for(var u in s){var p,d,f=self[l[u]];if(r.useUniqueIDs)d=s[u],p=t.GetAttributeByUniqueId(a,d);else{if(-1===(d=t.GetAttributeId(a,e[s[u]])))continue;p=t.GetAttribute(a,d)}h.attributes.push(n(e,t,a,u,f,p))}if(c===e.TRIANGULAR_MESH){for(var m=a.num_faces(),g=new Uint32Array(3*m),v=new e.DracoInt32Array,y=0;y<m;++y){t.GetFaceFromMesh(a,y,v);for(var x=0;x<3;++x)g[3*y+x]=v.GetValue(x)}h.index={array:g,itemSize:1},e.destroy(v)}return e.destroy(a),h}(t,i,s,o),c=l.attributes.map(e=>e.array.buffer);l.index&&c.push(l.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:l},c)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(s),t.destroy(i)}})}}},uh.taskCache=new WeakMap,uh.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},uh.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},uh.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},uh.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};var ph,dh,fh=function(){function e(e){ms.call(this,e),this.dracoLoader=null,this.ddsLoader=null}function t(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}e.prototype=Object.assign(Object.create(ms.prototype),{constructor:e,load:function(e,t,n,i){var r,a=this;r=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:cl(e),a.manager.itemStart(e);var o=function(t){i?i(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},s=new vs(a.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),"use-credentials"===a.crossOrigin&&s.setWithCredentials(!0),s.load(e,(function(n){try{a.parse(n,r,(function(n){t(n),a.manager.itemEnd(e)}),o)}catch(e){o(e)}}),n,o)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(e,t,l,c){var d,g={};if("string"==typeof e)d=e;else if(ll(new Uint8Array(e,0,4))===s){try{g[n.KHR_BINARY_GLTF]=new h(e)}catch(e){return void(c&&c(e))}d=g[n.KHR_BINARY_GLTF].content}else d=ll(new Uint8Array(e));var v=JSON.parse(d);if(void 0===v.asset||v.asset.version[0]<2)c&&c(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{if(v.extensionsUsed)for(var y=0;y<v.extensionsUsed.length;++y){var x=v.extensionsUsed[y],b=v.extensionsRequired||[];switch(x){case n.KHR_LIGHTS_PUNCTUAL:g[x]=new r(v);break;case n.KHR_MATERIALS_CLEARCOAT:g[x]=new o;break;case n.KHR_MATERIALS_UNLIT:g[x]=new a;break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:g[x]=new f;break;case n.KHR_DRACO_MESH_COMPRESSION:g[x]=new u(v,this.dracoLoader);break;case n.MSFT_TEXTURE_DDS:g[x]=new i(this.ddsLoader);break;case n.KHR_TEXTURE_TRANSFORM:g[x]=new p;break;case n.KHR_MESH_QUANTIZATION:g[x]=new m;break;default:b.indexOf(x)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+x+'".')}}var w=new W(v,g,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});w.fileLoader.setRequestHeader(this.requestHeader),w.parse(l,c)}}});var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function i(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=e}function r(e){this.name=n.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[n.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function a(){this.name=n.KHR_MATERIALS_UNLIT}function o(){this.name=n.KHR_MATERIALS_CLEARCOAT}r.prototype.loadLight=function(e){var t,n=this.lightDefs[e],i=new Ke(16777215);void 0!==n.color&&i.fromArray(n.color);var r=void 0!==n.range?n.range:0;switch(n.type){case"directional":(t=new nl(i)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new $s(i)).distance=r;break;case"spot":(t=new Ks(i)).distance=r,n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,t.angle=n.spot.outerConeAngle,t.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+n.type+'".')}return t.position.set(0,0,0),t.decay=2,void 0!==n.intensity&&(t.intensity=n.intensity),t.name=n.name||"light_"+e,Promise.resolve(t)},a.prototype.getMaterialType=function(){return rt},a.prototype.extendParams=function(e,t,n){var i=[];e.color=new Ke(1,1,1),e.opacity=1;var r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){var a=r.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture))}return Promise.all(i)},o.prototype.getMaterialType=function(){return Vo},o.prototype.extendParams=function(e,t,n){var i=[],r=t.extensions[this.name];if(void 0!==r.clearcoatFactor&&(e.clearcoat=r.clearcoatFactor),void 0!==r.clearcoatTexture&&i.push(n.assignTexture(e,"clearcoatMap",r.clearcoatTexture)),void 0!==r.clearcoatRoughnessFactor&&(e.clearcoatRoughness=r.clearcoatRoughnessFactor),void 0!==r.clearcoatRoughnessTexture&&i.push(n.assignTexture(e,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),void 0!==r.clearcoatNormalTexture&&(i.push(n.assignTexture(e,"clearcoatNormalMap",r.clearcoatNormalTexture)),void 0!==r.clearcoatNormalTexture.scale)){var a=r.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new M(a,a)}return Promise.all(i)};var s="glTF",l=1313821514,c=5130562;function h(e){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,12);if(this.header={magic:ll(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==s)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=new DataView(e,12),r=0;r<i.byteLength;){var a=i.getUint32(r,!0);r+=4;var o=i.getUint32(r,!0);if(r+=4,o===l){var h=new Uint8Array(e,12+r,a);this.content=ll(h)}else if(o===c){var u=12+r;this.body=e.slice(u,u+a)}r+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function u(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function p(){this.name=n.KHR_TEXTURE_TRANSFORM}function d(e){ko.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var t=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),i=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),r=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),a=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),o={specular:{value:(new Ke).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=o,this.onBeforeCompile=function(e){for(var s in o)e.uniforms[s]=o[s];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;"),e.fragmentShader=e.fragmentShader.replace("uniform float metalness;","uniform float glossiness;"),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_pars_fragment>",t),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_pars_fragment>",n),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>",i),e.fragmentShader=e.fragmentShader.replace("#include <metalnessmap_fragment>",r),e.fragmentShader=e.fragmentShader.replace("#include <lights_physical_fragment>",a)},Object.defineProperties(this,{specular:{get:function(){return o.specular.value},set:function(e){o.specular.value=e}},specularMap:{get:function(){return o.specularMap.value},set:function(e){o.specularMap.value=e}},glossiness:{get:function(){return o.glossiness.value},set:function(e){o.glossiness.value=e}},glossinessMap:{get:function(){return o.glossinessMap.value},set:function(e){o.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_ROUGHNESSMAP=""):(delete this.defines.USE_ROUGHNESSMAP,delete this.defines.USE_GLOSSINESSMAP)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}function f(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return d},extendParams:function(e,t,n){var i=t.extensions[this.name];e.color=new Ke(1,1,1),e.opacity=1;var r=[];if(Array.isArray(i.diffuseFactor)){var a=i.diffuseFactor;e.color.fromArray(a),e.opacity=a[3]}if(void 0!==i.diffuseTexture&&r.push(n.assignTexture(e,"map",i.diffuseTexture)),e.emissive=new Ke(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new Ke(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){var o=i.specularGlossinessTexture;r.push(n.assignTexture(e,"glossinessMap",o)),r.push(n.assignTexture(e,"specularMap",o))}return Promise.all(r)},createMaterial:function(e){var t=new d(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=0,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}}function m(){this.name=n.KHR_MESH_QUANTIZATION}function g(e,t,n,i){Qo.call(this,e,t,n,i)}u.prototype.decodePrimitive=function(e,t){var n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},l={};for(var c in a){var h=P[c]||c.toLowerCase();o[h]=a[c]}for(c in e.attributes){h=P[c]||c.toLowerCase();if(void 0!==a[c]){var u=n.accessors[e.attributes[c]],p=E[u.componentType];l[h]=p,s[h]=!0===u.normalized}}return t.getDependency("bufferView",r).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var n in e.attributes){var i=e.attributes[n],r=s[n];void 0!==r&&(i.normalized=r)}t(e)}),o,l)}))}))},p.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},d.prototype=Object.create(ko.prototype),d.prototype.constructor=d,d.prototype.copy=function(e){return ko.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},g.prototype=Object.create(Qo.prototype),g.prototype.constructor=g,g.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i,a=0;a!==i;a++)t[a]=n[r+a];return t},g.prototype.beforeStart_=g.prototype.copySampleValue_,g.prototype.afterEnd_=g.prototype.copySampleValue_,g.prototype.interpolate_=function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,c=i-t,h=(n-t)/c,u=h*h,p=u*h,d=e*l,f=d-l,m=-2*p+3*u,g=p-u,v=1-m,y=g-u+h,x=0;x!==o;x++){var b=a[f+x+o],w=a[f+x+s]*c,_=a[d+x+o],M=a[d+x]*c;r[x]=v*b+y*w+m*_+g*M}return r};var v=0,y=1,x=2,b=3,w=4,S=5,T=6,E={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},A={9728:1003,9729:1006,9984:1004,9985:1007,9986:1005,9987:1008},L={33071:1001,33648:1002,10497:1e3},R={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},P={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},C={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},O={CUBICSPLINE:void 0,LINEAR:2301,STEP:2300},I="OPAQUE",N="MASK",z="BLEND",U={"image/png":1023,"image/jpeg":1022};function F(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function B(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new ko({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function H(e,t,n){for(var i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function G(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function V(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(n=0,i=r.length;n<i;n++)e.morphTargetDictionary[r[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function j(e){for(var t="",n=Object.keys(e).sort(),i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function W(e,n,i){this.json=e||{},this.extensions=n||{},this.options=i||{},this.cache=new t,this.associations=new Map,this.primitiveCache={},this.textureLoader=new Ms(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new vs(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function q(e,t,n){var i=t.attributes,r=[];function a(t,i){return n.getDependency("accessor",t).then((function(t){e.setAttribute(i,t)}))}for(var o in i){var s=P[o]||o.toLowerCase();s in e.attributes||r.push(a(i[o],s))}if(void 0!==t.indices&&!e.index){var l=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));r.push(l)}return G(e,t),function(e,t,n){var i=t.attributes,r=new we;if(void 0!==i.POSITION){var a=(d=n.json.accessors[i.POSITION]).min,o=d.max;if(void 0!==a&&void 0!==o){r.set(new D(a[0],a[1],a[2]),new D(o[0],o[1],o[2]));var s=t.targets;if(void 0!==s){for(var l=new D,c=new D,h=0,u=s.length;h<u;h++){var p=s[h];if(void 0!==p.POSITION){var d;a=(d=n.json.accessors[p.POSITION]).min,o=d.max;void 0!==a&&void 0!==o?(c.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),c.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),c.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),l.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(l)}e.boundingBox=r;var f=new Se;r.getCenter(f.center),f.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=f}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,n),Promise.all(r).then((function(){return void 0!==t.targets?function(e,t,n){for(var i=!1,r=!1,a=0,o=t.length;a<o;a++){if(void 0!==(c=t[a]).POSITION&&(i=!0),void 0!==c.NORMAL&&(r=!0),i&&r)break}if(!i&&!r)return Promise.resolve(e);var s=[],l=[];for(a=0,o=t.length;a<o;a++){var c=t[a];if(i){var h=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):e.attributes.position;s.push(h)}if(r){h=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):e.attributes.normal;l.push(h)}}return Promise.all([Promise.all(s),Promise.all(l)]).then((function(t){var n=t[0],a=t[1];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=a),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}function X(e,t){var n=e.getIndex();if(null===n){var i=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a<r.count;a++)i.push(a);e.setIndex(i),n=e.getIndex()}var o=n.count-2,s=[];if(2===t)for(a=1;a<=o;a++)s.push(n.getX(0)),s.push(n.getX(a)),s.push(n.getX(a+1));else for(a=0;a<o;a++)a%2==0?(s.push(n.getX(a)),s.push(n.getX(a+1)),s.push(n.getX(a+2))):(s.push(n.getX(a+2)),s.push(n.getX(a+1)),s.push(n.getX(a)));s.length/3!==o&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var l=e.clone();return l.setIndex(s),l}return W.prototype.parse=function(e,t){var n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.markDefs(),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};H(r,a,i),G(a,i),e(a)})).catch(t)},W.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],i={},r={},a=0,o=t.length;a<o;a++)for(var s=t[a].joints,l=0,c=s.length;l<c;l++)e[s[l]].isBone=!0;for(var h=0,u=e.length;h<u;h++){var p=e[h];void 0!==p.mesh&&(void 0===i[p.mesh]&&(i[p.mesh]=r[p.mesh]=0),i[p.mesh]++,void 0!==p.skin&&(n[p.mesh].isSkinnedMesh=!0))}this.json.meshReferences=i,this.json.meshUses=r},W.prototype.getDependency=function(e,t){var i=e+":"+t,r=this.cache.get(i);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this.loadMesh(t);break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this.loadBufferView(t);break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this.loadMaterial(t);break;case"texture":r=this.loadTexture(t);break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;case"light":r=this.extensions[n.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(i,r)}return r},W.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var n=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map((function(t,i){return n.getDependency(e,i)}))),this.cache.add(e,t)}return t},W.prototype.loadBuffer=function(e){var t=this.json.buffers[e],i=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);var r=this.options;return new Promise((function(e,n){i.load(F(t.uri,r.path),e,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},W.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)}))},W.prototype.loadAccessor=function(e){var t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse)return Promise.resolve(null);var r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then((function(e){var r,a=e[0],o=R[i.type],s=E[i.componentType],l=s.BYTES_PER_ELEMENT,c=l*o,h=i.byteOffset||0,u=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,p=!0===i.normalized;if(u&&u!==c){var d=Math.floor(h/u),f="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+d+":"+i.count,m=t.cache.get(f);m||(m=new yr(new s(a,d*u,i.count*u/l),u/l),t.cache.add(f,m)),r=new wr(m,o,h%u/l,p)}else r=new ot(null===a?new s(i.count*o):new s(a,h,i.count*o),o,p);if(void 0!==i.sparse){var g=R.SCALAR,v=E[i.sparse.indices.componentType],y=i.sparse.indices.byteOffset||0,x=i.sparse.values.byteOffset||0,b=new v(e[1],y,i.sparse.count*g),w=new s(e[2],x,i.sparse.count*o);null!==a&&(r=new ot(r.array.slice(),r.itemSize,r.normalized));for(var _=0,M=b.length;_<M;_++){var S=b[_];if(r.setX(S,w[_*o]),o>=2&&r.setY(S,w[_*o+1]),o>=3&&r.setZ(S,w[_*o+2]),o>=4&&r.setW(S,w[_*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return r}))},W.prototype.loadTexture=function(e){var t,i=this,r=this.json,a=this.options,o=this.textureLoader,s=self.URL||self.webkitURL,l=r.textures[e],c=l.extensions||{},h=(t=c[n.MSFT_TEXTURE_DDS]?r.images[c[n.MSFT_TEXTURE_DDS].source]:r.images[l.source]).uri,u=!1;return void 0!==t.bufferView&&(h=i.getDependency("bufferView",t.bufferView).then((function(e){u=!0;var n=new Blob([e],{type:t.mimeType});return h=s.createObjectURL(n)}))),Promise.resolve(h).then((function(e){var t=a.manager.getHandler(e);return t||(t=c[n.MSFT_TEXTURE_DDS]?i.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:o),new Promise((function(n,i){t.load(F(e,a.path),n,void 0,i)}))})).then((function(n){!0===u&&s.revokeObjectURL(h),n.flipY=!1,l.name&&(n.name=l.name),t.mimeType in U&&(n.format=U[t.mimeType]);var a=(r.samplers||{})[l.sampler]||{};return n.magFilter=A[a.magFilter]||1006,n.minFilter=A[a.minFilter]||1008,n.wrapS=L[a.wrapS]||1e3,n.wrapT=L[a.wrapT]||1e3,i.associations.set(n,{type:"textures",index:e}),n}))},W.prototype.assignTexture=function(e,t,i){var r=this;return this.getDependency("texture",i.index).then((function(a){if(!a.isCompressedTexture)switch(t){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":a.format=1022}if(void 0===i.texCoord||0==i.texCoord||"aoMap"===t&&1==i.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+i.texCoord+" for texture "+t+" not yet supported."),r.extensions[n.KHR_TEXTURE_TRANSFORM]){var o=void 0!==i.extensions?i.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(o){var s=r.associations.get(a);a=r.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),r.associations.set(a,s)}}e[t]=a}))},W.prototype.assignFinalMaterial=function(e){var t=e.geometry,n=e.material,i=void 0!==t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal,o=!0===e.isSkinnedMesh,s=Object.keys(t.morphAttributes).length>0,l=s&&void 0!==t.morphAttributes.normal;if(e.isPoints){var c="PointsMaterial:"+n.uuid,h=this.cache.get(c);h||(h=new pa,it.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,h.sizeAttenuation=!1,this.cache.add(c,h)),n=h}else if(e.isLine){c="LineBasicMaterial:"+n.uuid;var u=this.cache.get(c);u||(u=new ta,it.prototype.copy.call(u,n),u.color.copy(n.color),this.cache.add(c,u)),n=u}if(i||r||a||o||s){c="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),o&&(c+="skinning:"),i&&(c+="vertex-tangents:"),r&&(c+="vertex-colors:"),a&&(c+="flat-shading:"),s&&(c+="morph-targets:"),l&&(c+="morph-normals:");var p=this.cache.get(c);p||(p=n.clone(),o&&(p.skinning=!0),i&&(p.vertexTangents=!0),r&&(p.vertexColors=!0),a&&(p.flatShading=!0),s&&(p.morphTargets=!0),l&&(p.morphNormals=!0),this.cache.add(c,p),this.associations.set(p,this.associations.get(n))),n=p}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),n.normalScale&&!i&&(n.normalScale.y=-n.normalScale.y),n.clearcoatNormalScale&&!i&&(n.clearcoatNormalScale.y=-n.clearcoatNormalScale.y),e.material=n},W.prototype.loadMaterial=function(e){var t,i=this,r=this.json,a=this.extensions,o=r.materials[e],s={},l=o.extensions||{},c=[];if(l[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var h=a[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=h.getMaterialType(),c.push(h.extendParams(s,o,i))}else if(l[n.KHR_MATERIALS_UNLIT]){var u=a[n.KHR_MATERIALS_UNLIT];t=u.getMaterialType(),c.push(u.extendParams(s,o,i))}else{t=ko;var p=o.pbrMetallicRoughness||{};if(s.color=new Ke(1,1,1),s.opacity=1,Array.isArray(p.baseColorFactor)){var f=p.baseColorFactor;s.color.fromArray(f),s.opacity=f[3]}void 0!==p.baseColorTexture&&c.push(i.assignTexture(s,"map",p.baseColorTexture)),s.metalness=void 0!==p.metallicFactor?p.metallicFactor:1,s.roughness=void 0!==p.roughnessFactor?p.roughnessFactor:1,void 0!==p.metallicRoughnessTexture&&(c.push(i.assignTexture(s,"metalnessMap",p.metallicRoughnessTexture)),c.push(i.assignTexture(s,"roughnessMap",p.metallicRoughnessTexture)))}!0===o.doubleSided&&(s.side=2);var m=o.alphaMode||I;if(m===z?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,m===N&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==rt&&(c.push(i.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new M(1,1),void 0!==o.normalTexture.scale&&s.normalScale.set(o.normalTexture.scale,o.normalTexture.scale)),void 0!==o.occlusionTexture&&t!==rt&&(c.push(i.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==rt&&(s.emissive=(new Ke).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==rt&&c.push(i.assignTexture(s,"emissiveMap",o.emissiveTexture)),l[n.KHR_MATERIALS_CLEARCOAT]){var g=a[n.KHR_MATERIALS_CLEARCOAT];t=g.getMaterialType(),c.push(g.extendParams(s,{extensions:l},i))}return Promise.all(c).then((function(){var r;return r=t===d?a[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new t(s),o.name&&(r.name=o.name),r.map&&(r.map.encoding=3001),r.emissiveMap&&(r.emissiveMap.encoding=3001),G(r,o),i.associations.set(r,{type:"materials",index:e}),o.extensions&&H(a,r,o),r}))},W.prototype.loadGeometries=function(e){var t=this,i=this.extensions,r=this.primitiveCache;function a(e){return i[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return q(n,e,t)}))}for(var o,s,l=[],c=0,h=e.length;c<h;c++){var u,p=e[c],d=(s=void 0,(s=(o=p).extensions&&o.extensions[n.KHR_DRACO_MESH_COMPRESSION])?"draco:"+s.bufferView+":"+s.indices+":"+j(s.attributes):o.indices+":"+j(o.attributes)+":"+o.mode),f=r[d];if(f)l.push(f.promise);else u=p.extensions&&p.extensions[n.KHR_DRACO_MESH_COMPRESSION]?a(p):q(new Tt,p,t),r[d]={primitive:p,promise:u},l.push(u)}return Promise.all(l)},W.prototype.loadMesh=function(e){for(var t=this,n=this.json.meshes[e],i=n.primitives,r=[],a=0,o=i.length;a<o;a++){var s=void 0===i[a].material?B(this.cache):this.getDependency("material",i[a].material);r.push(s)}return r.push(t.loadGeometries(i)),Promise.all(r).then((function(r){for(var a=r.slice(0,r.length-1),o=r[r.length-1],s=[],l=0,c=o.length;l<c;l++){var h,u=o[l],p=i[l],d=a[l];if(p.mode===w||p.mode===S||p.mode===T||void 0===p.mode)!0!==(h=!0===n.isSkinnedMesh?new Wr(u,d):new Vt(u,d)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),p.mode===S?h.geometry=X(h.geometry,1):p.mode===T&&(h.geometry=X(h.geometry,2));else if(p.mode===y)h=new ha(u,d);else if(p.mode===b)h=new sa(u,d);else if(p.mode===x)h=new ua(u,d);else{if(p.mode!==v)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);h=new va(u,d)}Object.keys(h.geometry.morphAttributes).length>0&&V(h,n),h.name=n.name||"mesh_"+e,o.length>1&&(h.name+="_"+l),G(h,n),t.assignFinalMaterial(h),s.push(h)}if(1===s.length)return s[0];var f=new ur;for(l=0,c=s.length;l<c;l++)f.add(s[l]);return f}))},W.prototype.loadCamera=function(e){var t,n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new rn(_.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new el(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=n.name),G(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},W.prototype.loadSkin=function(e){var t=this.json.skins[e],n={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(n):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return n.inverseBindMatrices=e,n}))},W.prototype.loadAnimation=function(e){for(var t=this.json.animations[e],n=[],i=[],r=[],a=[],o=[],s=0,l=t.channels.length;s<l;s++){var c=t.channels[s],h=t.samplers[c.sampler],u=c.target,p=void 0!==u.node?u.node:u.id,d=void 0!==t.parameters?t.parameters[h.input]:h.input,f=void 0!==t.parameters?t.parameters[h.output]:h.output;n.push(this.getDependency("node",p)),i.push(this.getDependency("accessor",d)),r.push(this.getDependency("accessor",f)),a.push(h),o.push(u)}return Promise.all([Promise.all(n),Promise.all(i),Promise.all(r),Promise.all(a),Promise.all(o)]).then((function(n){for(var i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=[],c=0,h=i.length;c<h;c++){var u=i[c],p=r[c],d=a[c],f=o[c],m=s[c];if(void 0!==u){var v;switch(u.updateMatrix(),u.matrixAutoUpdate=!0,C[m.path]){case C.weights:v=as;break;case C.rotation:v=ss;break;case C.position:case C.scale:default:v=cs}var y=u.name?u.name:u.uuid,x=void 0!==f.interpolation?O[f.interpolation]:2301,b=[];C[m.path]===C.weights?u.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&b.push(e.name?e.name:e.uuid)})):b.push(y);var w=d.array;if(d.normalized){var _;if(w.constructor===Int8Array)_=1/127;else if(w.constructor===Uint8Array)_=1/255;else if(w.constructor==Int16Array)_=1/32767;else{if(w.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");_=1/65535}for(var M=new Float32Array(w.length),S=0,T=w.length;S<T;S++)M[S]=w[S]*_;w=M}for(S=0,T=b.length;S<T;S++){var E=new v(b[S]+"."+C[m.path],p.array,w,x);"CUBICSPLINE"===f.interpolation&&(E.createInterpolant=function(e){return new g(this.times,this.values,this.getValueSize()/3,e)},E.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(E)}}}return new hs(t.name?t.name:"animation_"+e,void 0,l)}))},W.prototype.loadNode=function(e){var t,i=this.json,r=this.extensions,a=this,o=i.meshReferences,s=i.meshUses,l=i.nodes[e];return(t=[],void 0!==l.mesh&&t.push(a.getDependency("mesh",l.mesh).then((function(e){var t;if(o[l.mesh]>1){var n=s[l.mesh]++;(t=e.clone()).name+="_instance_"+n}else t=e;return void 0!==l.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,n=l.weights.length;t<n;t++)e.morphTargetInfluences[t]=l.weights[t]})),t}))),void 0!==l.camera&&t.push(a.getDependency("camera",l.camera)),l.extensions&&l.extensions[n.KHR_LIGHTS_PUNCTUAL]&&void 0!==l.extensions[n.KHR_LIGHTS_PUNCTUAL].light&&t.push(a.getDependency("light",l.extensions[n.KHR_LIGHTS_PUNCTUAL].light)),Promise.all(t)).then((function(t){var n;if((n=!0===l.isBone?new Jr:t.length>1?new ur:1===t.length?t[0]:new oe)!==t[0])for(var i=0,o=t.length;i<o;i++)n.add(t[i]);if(l.name&&(n.userData.name=l.name,n.name=$l.sanitizeNodeName(l.name)),G(n,l),l.extensions&&H(r,n,l),void 0!==l.matrix){var s=new k;s.fromArray(l.matrix),n.applyMatrix4(s)}else void 0!==l.translation&&n.position.fromArray(l.translation),void 0!==l.rotation&&n.quaternion.fromArray(l.rotation),void 0!==l.scale&&n.scale.fromArray(l.scale);return a.associations.set(n,{type:"nodes",index:e}),n}))},W.prototype.loadScene=function(){function e(t,n,i,r){var a=i.nodes[t];return r.getDependency("node",t).then((function(e){return void 0===a.skin?e:r.getDependency("skin",a.skin).then((function(e){for(var n=[],i=0,a=(t=e).joints.length;i<a;i++)n.push(r.getDependency("node",t.joints[i]));return Promise.all(n)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var i=[],r=[],a=0,o=n.length;a<o;a++){var s=n[a];if(s){i.push(s);var l=new k;void 0!==t.inverseBindMatrices&&l.fromArray(t.inverseBindMatrices.array,16*a),r.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}e.bind(new Yr(i,r),e.matrixWorld)}})),e}));var t})).then((function(t){n.add(t);var o=[];if(a.children)for(var s=a.children,l=0,c=s.length;l<c;l++){var h=s[l];o.push(e(h,t,i,r))}return Promise.all(o)}))}return function(t){var n=this.json,i=this.extensions,r=this.json.scenes[t],a=new ur;r.name&&(a.name=r.name),G(a,r),r.extensions&&H(i,a,r);for(var o=r.nodes||[],s=[],l=0,c=o.length;l<c;l++)s.push(e(o[l],a,n,this));return Promise.all(s).then((function(){return a}))}}(),e}();
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const mh=Symbol("retainerCount"),gh=Symbol("recentlyUsed"),vh=Symbol("evict"),yh=Symbol("evictionThreshold"),xh=Symbol("cache");class bh{constructor(e,t=5){this[ph]=new Map,this[dh]=[],this[xh]=e,this[yh]=t}set evictionThreshold(e){this[yh]=e,this[vh]()}get evictionThreshold(){return this[yh]}get cache(){return this[xh]}retainerCount(e){return this[mh].get(e)||0}reset(){this[mh].clear(),this[gh]=[]}retain(e){this[mh].has(e)||this[mh].set(e,0),this[mh].set(e,this[mh].get(e)+1);const t=this[gh].indexOf(e);-1!==t&&this[gh].splice(t,1),this[gh].unshift(e),this[vh]()}release(e){this[mh].has(e)&&this[mh].set(e,Math.max(this[mh].get(e)-1,0)),this[vh]()}[(ph=mh,dh=gh,vh)](){if(!(this[gh].length<this[yh]))for(let e=this[gh].length-1;e>=this[yh];--e){const t=this[gh][e];0===this[mh].get(t)&&(this[xh].delete(t),this[gh].splice(e,1))}}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var wh,_h;const Mh=new Map,Sh=new Map;let Th;const Eh=new uh,Ah=Symbol("loader"),Lh=Symbol("evictionPolicy"),Rh=Symbol("GLTFInstance");class Ph extends y{constructor(e){super(),this[_h]=new fh,this[Rh]=e,this[Ah].setDRACOLoader(Eh)}static setDRACODecoderLocation(e){Th=e,Eh.setDecoderPath(e)}static getDRACODecoderLocation(){return Th}static get cache(){return Mh}static clearCache(){Mh.forEach((e,t)=>{this.delete(t)}),this[Lh].reset()}static has(e){return Mh.has(e)}static async delete(e){if(!this.has(e))return;const t=Mh.get(e);Sh.delete(e),Mh.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!Sh.get(e)}get[(wh=Lh,_h=Ah,Lh)](){return this.constructor[Lh]}async preload(e,t,n=(()=>{})){if(this.dispatchEvent({type:"preload",element:t,src:e}),!Mh.has(e)){const t=((e,t,n=(()=>{}))=>{const i=e=>{n(Math.max(0,Math.min(1,e.loaded/e.total)))};return new Promise((n,r)=>{t.load(e,n,i,r)})})(e,this[Ah],e=>{n(.8*e)}),i=this[Rh],r=t.then(e=>i.prepare(e)).then(e=>(n(.9),new i(e)));Mh.set(e,r)}await Mh.get(e),Sh.set(e,!0),n&&n(1)}async load(e,t,n=(()=>{})){await this.preload(e,t,n);const i=await Mh.get(e),r=await i.clone();return this[Lh].retain(e),r.dispose=(()=>{const t=r.dispose;let n=!1;return()=>{n||(n=!0,t.apply(r),this[Lh].release(e))}})(),r}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var Ch;Ph[wh]=new bh(Ph);const Oh=Symbol("velocity");class Ih{constructor(){this[Ch]=0}update(e,t,n,i){if(null==e||0===i)return t;if(e===t&&0===this[Oh])return t;if(n<0)return e;const r=e-t,a=this[Oh]+.02*r,o=r+n*a,s=Math.exp(-.02*n),l=(a-.02*o)*s,c=-.02*(l+a*s);return Math.abs(l)<2e-4*.02*Math.abs(i)&&c*r>=0?(this[Oh]=0,t):(this[Oh]=l,t+o*s)}}Ch=Oh;var Dh=function(e){oe.call(this),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))};(Dh.prototype=Object.create(oe.prototype)).constructor=Dh;var Nh=function(){var e,t,n,i,r=this,a=new D,o=new k,s=new k,l={objects:new WeakMap},c=document.createElement("div");c.style.overflow="hidden",this.domElement=c,this.getSize=function(){return{width:e,height:t}},this.setSize=function(r,a){n=(e=r)/2,i=(t=a)/2,c.style.width=r+"px",c.style.height=a+"px"};var h,u,p=function(e,t,o){if(e instanceof Dh){e.onBeforeRender(r,t,o),a.setFromMatrixPosition(e.matrixWorld),a.applyMatrix4(s);var h=e.element,u="translate(-50%,-50%) translate("+(a.x*n+n)+"px,"+(-a.y*i+i)+"px)";h.style.WebkitTransform=u,h.style.MozTransform=u,h.style.oTransform=u,h.style.transform=u,h.style.display=e.visible&&a.z>=-1&&a.z<=1?"":"none";var f={distanceToCameraSquared:d(o,e)};l.objects.set(e,f),h.parentNode!==c&&c.appendChild(h),e.onAfterRender(r,t,o)}for(var m=0,g=e.children.length;m<g;m++)p(e.children[m],t,o)},d=(h=new D,u=new D,function(e,t){return h.setFromMatrixPosition(e.matrixWorld),u.setFromMatrixPosition(t.matrixWorld),h.distanceToSquared(u)}),f=function(e){for(var t=function(e){var t=[];return e.traverse((function(e){e instanceof Dh&&t.push(e)})),t}(e).sort((function(e,t){return l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),n=t.length,i=0,r=t.length;i<r;i++)t[i].element.style.zIndex=n-i};this.render=function(e,t){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),o.copy(t.matrixWorldInverse),s.multiplyMatrices(t.projectionMatrix,o),p(e,e,t),f(e)}};
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const zh=(e,t)=>({type:"number",number:e,unit:t}),Uh=(()=>{const e={};return t=>{const n=t;if(n in e)return e[n];const i=[];let r=0;for(;t;){if(++r>1e3){t="";break}const e=Fh(t),n=e.nodes[0];if(null==n||0===n.terms.length)break;i.push(n),t=e.remainingInput}return e[n]=i}})(),Fh=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,n=/^[\),]/;return i=>{const r=[];for(;i.length&&(i=i.trim(),!n.test(i));)if("("===i[0]){const{nodes:e,remainingInput:t}=kh(i);i=t,r.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(i)){const e=Bh(i),t=e.nodes[0];if("("===(i=e.remainingInput)[0]){const{nodes:e,remainingInput:n}=kh(i);r.push({type:"function",name:t,arguments:e}),i=n}else r.push(t)}else if(t.test(i))r.push({type:"operator",value:i[0]}),i=i.slice(1);else{const{nodes:e,remainingInput:t}="#"===i[0]?Gh(i):Hh(i);if(0===e.length)break;r.push(e[0]),i=t}return{nodes:[{type:"expression",terms:r}],remainingInput:i}}})(),Bh=(()=>{const e=/[^a-z^0-9^_^\-^\u0240-\uffff]/i;return t=>{const n=t.match(e);return{nodes:[{type:"ident",value:null==n?t:t.substr(0,n.index)}],remainingInput:null==n?"":t.substr(n.index)}}})(),Hh=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,n=/^(m|mm|cm|rad|deg|[%])$/;return i=>{const r=i.match(e),a=null==r?"0":r[0],o=(i=null==a?i:i.slice(a.length)).match(t);let s=null!=o&&""!==o[0]?o[0]:null;const l=null==o?i:i.slice(s.length);return null==s||n.test(s)||(s=null),{nodes:[{type:"number",number:parseFloat(a)||0,unit:s}],remainingInput:l}}})(),Gh=(()=>{const e=/^[a-f0-9]*/i;return t=>{const n=(t=t.slice(1).trim()).match(e);return{nodes:null==n?[]:[{type:"hex",value:n[0]}],remainingInput:null==n?t:t.slice(n[0].length)}}})(),kh=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const n=Fh(e);if(t.push(n.nodes[0]),","===(e=n.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},Vh=Symbol("visitedTypes");class jh{constructor(e){this[Vh]=e}walk(e,t){const n=e.slice();for(;n.length;){const e=n.shift();switch(this[Vh].indexOf(e.type)>-1&&t(e),e.type){case"expression":n.unshift(...e.terms);break;case"function":n.unshift(e.name,...e.arguments)}}}}const Wh=Object.freeze({type:"number",number:0,unit:null}),qh=(e,t=0)=>{let{number:n,unit:i}=e;if(isFinite(n)){if("rad"===e.unit||null==e.unit)return e}else n=t,i="rad";return{type:"number",number:("deg"===i&&null!=n?n:0)*Math.PI/180,unit:"rad"}},Xh=(e,t=0)=>{let n,{number:i,unit:r}=e;if(isFinite(i)){if("m"===e.unit)return e}else i=t,r="m";switch(r){default:n=1;break;case"cm":n=.01;break;case"mm":n=.001}return{type:"number",number:n*i,unit:"m"}},Yh=(()=>{const e=e=>e,t={rad:e,deg:qh,m:e,mm:Xh,cm:Xh};return(e,n=Wh)=>{let{number:i,unit:r}=e;if(isFinite(i)||(i=n.number,r=n.unit),null==r)return e;const a=t[r];return null==a?n:a(e)}})();
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var Jh,Zh,Kh,Qh;const $h=Symbol("slot"),eu=Symbol("pivot"),tu=Symbol("referenceCount"),nu=Symbol("updateVisibility"),iu=Symbol("visible");class ru extends Dh{constructor(e){super(document.createElement("div")),this.normal=new D(0,1,0),this[Jh]=!1,this[Zh]=1,this[Kh]=document.createElement("div"),this[Qh]=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this[$h].name=e.name,this.element.appendChild(this[eu]),this[eu].appendChild(this[$h]),this.updatePosition(e.position),this.updateNormal(e.normal)}show(){this[iu]||(this[iu]=!0,this[nu]())}hide(){this[iu]&&(this[iu]=!1,this[nu]())}increment(){this[tu]++}decrement(){return this[tu]>0&&--this[tu],0===this[tu]}updatePosition(e){if(null==e)return;const t=Uh(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,Yh(t[e]).number)}updateNormal(e){if(null==e)return;const t=Uh(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,Yh(t[e]).number)}orient(e){this[eu].style.transform=`rotate(${e}rad)`}[(Jh=iu,Zh=tu,Kh=eu,Qh=$h,nu)](){this[iu]?this.element.classList.remove("hide"):this.element.classList.add("hide"),this[$h].assignedNodes().forEach(e=>{if(e.nodeType!==Node.ELEMENT_NODE)return;const t=e,n=t.dataset.visibilityAttribute;if(null!=n){const e="data-"+n;this[iu]?t.setAttribute(e,""):t.removeAttribute(e)}t.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:this[iu]}}))})}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const au=(e,t)=>{let n=0;const i=new D;return e.traverse(e=>{let r,a;e.updateWorldMatrix(!1,!1);let o=e.geometry;if(void 0!==o)if(o.isGeometry){let s=o.vertices;for(r=0,a=s.length;r<a;r++)i.copy(s[r]),i.applyMatrix4(e.matrixWorld),n=t(n,i)}else if(o.isBufferGeometry){let s=o.attributes.position;if(void 0!==s)for(r=0,a=s.count;r<a;r++)i.fromBufferAttribute(s,r).applyMatrix4(e.matrixWorld),n=t(n,i)}}),n};
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/class ou extends nl{constructor(e,t){super(),this.shadowMaterial=new Ho,this.boundingBox=new we,this.size=new D,this.isAnimated=!1,this.needsUpdate=!1,this.intensity=0,this.castShadow=!0,this.frustumCulled=!1,this.floor=new Vt(new mn,this.shadowMaterial),this.floor.rotateX(-Math.PI/2),this.floor.receiveShadow=!0,this.floor.castShadow=!1,this.floor.frustumCulled=!1,this.add(this.floor),this.shadow.camera.up.set(0,0,1),e.add(this),this.target=e,this.setModel(e,t)}setModel(e,t){this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size);const{boundingBox:n,size:i}=this;if(this.isAnimated){const e=2*Math.max(i.x,i.y,i.z);i.y=e,n.expandByVector(i.subScalar(e).multiplyScalar(-.5)),n.max.y=n.min.y+e,i.set(e,e,e)}const r=.001*i.y;this.position.y=n.max.y+r,n.getCenter(this.floor.position),this.setSoftness(t)}setSoftness(e){const t=Math.pow(2,9-3*e);this.setMapSize(t)}setMapSize(e){const{camera:t,mapSize:n,map:i}=this.shadow,{size:r,boundingBox:a}=this;null!=i&&(i.dispose(),this.shadow.map=null),this.isAnimated&&(e*=2);const o=Math.floor(r.x>r.z?e:e*r.x/r.z),s=Math.floor(r.x>r.z?e*r.z/r.x:e);n.set(o,s);const l=2.5*r.x/o,c=2.5*r.z/s;t.left=-a.max.x-l,t.right=-a.min.x+l,t.bottom=a.min.z-c,t.top=a.max.z+c,this.setScaleAndOffset(t.zoom,0),this.shadow.updateMatrices(this),this.floor.scale.set(r.x+2*l,r.z+2*c,1),this.needsUpdate=!0}setIntensity(e){this.shadowMaterial.opacity=e,e>0?(this.visible=!0,this.floor.visible=!0):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.shadowMaterial.opacity}setRotation(e){this.shadow.camera.up.set(Math.sin(e),0,Math.cos(e)),this.shadow.updateMatrices(this)}setScaleAndOffset(e,t){const n=this.size.y,i=1/e,r=.001*n;this.floor.position.y=2*r-n+t*i;const{camera:a}=this.shadow;a.zoom=e,a.near=0,a.far=n*e-t,a.projectionMatrix.makeOrthographic(a.left*e,a.right*e,a.top*e,a.bottom*e,a.near,a.far),a.projectionMatrixInverse.getInverse(a.projectionMatrix)}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var su,lu;const cu=22.5*Math.PI/180,hu=Math.sin(cu),uu=Math.tan(cu),pu=Symbol("shadow"),du=Symbol("cancelPendingSourceChange"),fu=Symbol("currentGLTF"),mu=new D,gu=new D,vu=new D;class yu extends oe{constructor(){super(),this[su]=null,this[lu]=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.animations=[],this.modelContainer=new oe,this.animationNames=[],this.boundingBox=new we,this.size=new D,this.idealCameraDistance=0,this.fieldOfViewAspect=0,this.userData={url:null},this.url=null,this.name="Model",this.modelContainer.name="ModelContainer",this.add(this.modelContainer),this.mixer=new tc(this.modelContainer)}get currentGLTF(){return this[fu]}hasModel(){return!!this.modelContainer.children.length}setObject(e){this.clear(),this.modelContainer.add(e),this.updateFraming(),this.dispatchEvent({type:"model-load"})}async setSource(e,t,n){if(!t||t===this.url)return void(n&&n(1));let i;null!=this[du]&&(this[du](),this[du]=null),this.url=t;try{i=await new Promise(async(i,r)=>{this[du]=()=>r();try{i(await e[dm].loader.load(t,e,n))}catch(e){r(e)}})}catch(e){if(null==e)return;throw e}this.clear(),this[fu]=i,null!=i&&this.modelContainer.add(i.scene);const{animations:r}=i,a=new Map,o=[];for(const e of r)a.set(e.name,e),o.push(e.name);this.animations=r,this.animationsByName=a,this.animationNames=o,this.userData.url=t,this.updateFraming(),this.dispatchEvent({type:"model-load",url:t})}set animationTime(e){this.mixer.setTime(e)}get animationTime(){return null!=this.currentAnimationAction?this.currentAnimationAction.time:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(e=null,t=0){const{animations:n}=this;if(null==n||0===n.length)return void console.warn("Cannot play animation (model does not have any animations)");let i=null;null!=e&&(i=this.animationsByName.get(e)),null==i&&(i=n[0]);try{const{currentAnimationAction:e}=this;this.currentAnimationAction=this.mixer.clipAction(i,this).play(),this.currentAnimationAction.enabled=!0,null!=e&&this.currentAnimationAction!==e&&this.currentAnimationAction.crossFadeFrom(e,t,!1)}catch(e){console.error(e)}}stopAnimation(){null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction.reset(),this.currentAnimationAction=null),this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e)}clear(){this.url=null,this.userData={url:null};const e=this[fu];if(null!=e){for(const e of this.modelContainer.children)this.modelContainer.remove(e);e.dispose(),this[fu]=null}null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}updateFraming(e=null){this.remove(this.modelContainer),null==e&&(this.boundingBox.setFromObject(this.modelContainer),this.boundingBox.getSize(this.size),e=this.boundingBox.getCenter(new D));const t=Math.sqrt(au(this.modelContainer,(t,n)=>Math.max(t,e.distanceToSquared(n))));this.idealCameraDistance=t/hu;this.fieldOfViewAspect=au(this.modelContainer,(t,n)=>{n.sub(e);const i=Math.sqrt(n.x*n.x+n.z*n.z);return Math.max(t,i/(this.idealCameraDistance-Math.abs(n.y)))})/uu,this.add(this.modelContainer)}setShadowIntensity(e,t){let n=this[pu];null!=n?(n.setIntensity(e),n.setModel(this,t)):e>0&&(n=new ou(this,t),n.setIntensity(e),this[pu]=n)}setShadowSoftness(e){const t=this[pu];null!=t&&t.setSoftness(e)}setShadowRotation(e){const t=this[pu];null!=t&&t.setRotation(e)}updateShadow(){const e=this[pu];if(null==e)return!1;{const{needsUpdate:t}=e;return e.needsUpdate=!1,t}}setShadowScaleAndOffset(e,t){const n=this[pu];null!=n&&n.setScaleAndOffset(e,t)}addHotspot(e){this.add(e)}removeHotspot(e){this.remove(e)}forHotspots(e){const{children:t}=this;for(let n=0,i=t.length;n<i;n++){const i=t[n];i instanceof ru&&e(i)}}updateHotspots(e){this.forHotspots(t=>{mu.copy(e),gu.setFromMatrixPosition(t.matrixWorld),mu.sub(gu),vu.copy(t.normal).transformDirection(this.matrixWorld),mu.dot(vu)<0?t.hide():t.show()})}orientHotspots(e){this.forHotspots(t=>{t.orient(e)})}setHotspotsVisibility(e){this.forHotspots(t=>{t.visible=e})}}su=pu,lu=fu;
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const xu=Math.tan(22.5*Math.PI/180),bu=new rc,wu=new D;class _u extends se{constructor({canvas:e,element:t,width:n,height:i}){super(),this.aspect=1,this.shadowIntensity=0,this.shadowSoftness=1,this.width=1,this.height=1,this.isDirty=!1,this.context=null,this.exposure=1,this.canScale=!0,this.framedFieldOfView=45,this.camera=new rn(45,1,.1,100),this.goalTarget=new D,this.targetDamperX=new Ih,this.targetDamperY=new Ih,this.targetDamperZ=new Ih,this.name="ModelScene",this.element=t,this.canvas=e,this.model=new yu,this.camera=new rn(45,1,.1,100),this.camera.name="MainCamera",this.activeCamera=this.camera,this.add(this.model),this.setSize(n,i),this.model.addEventListener("model-load",e=>this.onModelLoad(e))}createContext(){this.context=this.canvas.getContext("2d")}async setModelSource(e,t){try{await this.model.setSource(this.element,e,t)}catch(t){throw new Error(`Could not set model source to '${e}': ${t.message}`)}}setSize(e,t){this.width===e&&this.height===t||(this.width=Math.max(e,1),this.height=Math.max(t,1),this.aspect=this.width/this.height,this.frameModel(),this.isDirty=!0)}frameModel(){const e=xu*Math.max(1,this.model.fieldOfViewAspect/this.aspect);this.framedFieldOfView=2*Math.atan(e)*180/Math.PI}getSize(){return{width:this.width,height:this.height}}getCamera(){return this.activeCamera}setCamera(e){this.activeCamera=e}onModelLoad(e){this.frameModel(),this.setShadowIntensity(this.shadowIntensity),this.isDirty=!0,this.dispatchEvent({type:"model-load",url:e.url})}setTarget(e,t,n){this.goalTarget.set(-e,-t,-n)}getTarget(){return wu.copy(this.goalTarget).multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){const t=this.goalTarget,n=this.model.position;if(!t.equals(n)){const i=this.model.idealCameraDistance;let{x:r,y:a,z:o}=n;r=this.targetDamperX.update(r,t.x,e,i),a=this.targetDamperY.update(a,t.y,e,i),o=this.targetDamperZ.update(o,t.z,e,i),this.model.position.set(r,a,o),this.isDirty=!0}}pointTowards(e,t){const{x:n,z:i}=this.position;this.yaw=Math.atan2(e-n,t-i)}set yaw(e){this.rotation.y=e,this.model.setShadowRotation(e),this.isDirty=!0}get yaw(){return this.rotation.y}setShadowIntensity(e){e=Math.max(e,0),this.shadowIntensity=e,this.model.hasModel()&&this.model.setShadowIntensity(e,this.shadowSoftness)}setShadowSoftness(e){this.shadowSoftness=e,this.model.setShadowSoftness(e)}positionAndNormalFromPoint(e,t=this){bu.setFromCamera(e,this.getCamera());const n=bu.intersectObject(t,!0);if(0===n.length)return null;const i=n[0];return null==i.face?null:{position:i.point,normal:i.face.normal}}}var Mu,Su=((Mu=new Go({uniforms:{roughnessMap:{value:null},normalMap:{value:null},texelSize:{value:new M(1,1)}},vertexShader:"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = vec4( position, 1.0 );\n}\n ",fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec2 vUv;\nuniform sampler2D roughnessMap;\nuniform sampler2D normalMap;\nuniform vec2 texelSize;\n\n#define ENVMAP_TYPE_CUBE_UV\nvec4 envMapTexelToLinear(vec4 a){return a;}\n#include <cube_uv_reflection_fragment>\n\nfloat roughnessToVariance(float roughness) {\nfloat variance = 0.0;\nif (roughness >= r1) {\n variance = (r0 - roughness) * (v1 - v0) / (r0 - r1) + v0;\n} else if (roughness >= r4) {\n variance = (r1 - roughness) * (v4 - v1) / (r1 - r4) + v1;\n} else if (roughness >= r5) {\n variance = (r4 - roughness) * (v5 - v4) / (r4 - r5) + v4;\n} else {\n float roughness2 = roughness * roughness;\n variance = 1.79 * roughness2 * roughness2;\n}\nreturn variance;\n}\nfloat varianceToRoughness(float variance) {\nfloat roughness = 0.0;\nif (variance >= v1) {\n roughness = (v0 - variance) * (r1 - r0) / (v0 - v1) + r0;\n} else if (variance >= v4) {\n roughness = (v1 - variance) * (r4 - r1) / (v1 - v4) + r1;\n} else if (variance >= v5) {\n roughness = (v4 - variance) * (r5 - r4) / (v4 - v5) + r4;\n} else {\n roughness = pow(0.559 * variance, 0.25);// 0.559 = 1.0 / 1.79\n}\nreturn roughness;\n}\n\nvoid main() {\n gl_FragColor = texture2D(roughnessMap, vUv, -1.0);\n if (texelSize.x == 0.0) return;\n float roughness = gl_FragColor.g;\n float variance = roughnessToVariance(roughness);\n vec3 avgNormal;\n for (float x = -1.0; x < 2.0; x += 2.0) {\n for (float y = -1.0; y < 2.0; y += 2.0) {\n vec2 uv = vUv + vec2(x, y) * 0.25 * texelSize;\n avgNormal += normalize(texture2D(normalMap, uv, -1.0).xyz - 0.5);\n }\n }\n variance += 1.0 - 0.25 * length(avgNormal);\n gl_FragColor.g = varianceToRoughness(variance);\n}\n",blending:0,depthTest:!1,depthWrite:!1})).type="RoughnessMipmapper",Mu),Tu=new Vt(new mn(2,2),Su),Eu=new el(0,1,0,1,0,1),Au=null,Lu=null;function Ru(e){(Lu=e).compile(Tu,Eu)}Ru.prototype={constructor:Ru,generateMipmaps:function(e){var{roughnessMap:t,normalMap:n}=e;if(null!=t&&null!=n&&t.generateMipmaps&&!e.userData.roughnessUpdated){e.userData.roughnessUpdated=!0;var i=Math.max(t.image.width,n.image.width),r=Math.max(t.image.height,n.image.height);if(_.isPowerOfTwo(i)&&_.isPowerOfTwo(r)){var a=Lu.getRenderTarget(),o=Lu.autoClear;if(Lu.autoClear=!1,null!=Au&&Au.width===i&&Au.height===r||(null!=Au&&Au.dispose(),(Au=new R(i,r,{depthBuffer:!1,stencilBuffer:!1})).scissorTest=!0),i!==t.image.width||r!==t.image.height){var s=new R(i,r,{minFilter:1008,depthBuffer:!1,stencilBuffer:!1});s.texture.generateMipmaps=!0,Lu.setRenderTarget(s),e.roughnessMap=s.texture,e.metalnessMap==t&&(e.metalnessMap=e.roughnessMap),e.aoMap==t&&(e.aoMap=e.roughnessMap)}Su.uniforms.roughnessMap.value=t,Su.uniforms.normalMap.value=n;for(var l=new M(0,0),c=Su.uniforms.texelSize.value,h=0;i>=1&&r>=1;++h,i/=2,r/=2)c.set(1/i,1/r),0==h&&c.set(0,0),Au.viewport.set(l.x,l.y,i,r),Au.scissor.set(l.x,l.y,i,r),Lu.setRenderTarget(Au),Lu.render(Tu,Eu),Lu.copyFramebufferToTexture(l,e.roughnessMap,h),Su.uniforms.roughnessMap.value=e.roughnessMap;t!==e.roughnessMap&&t.dispose(),Lu.setRenderTarget(a),Lu.autoClear=o}}},dispose:function(){Su.dispose(),Tu.geometry.dispose(),null!=Au&&Au.dispose()}};
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const Pu=e=>null!=e&&"null"!==e?Ou(e):null,Cu=()=>{if(h)return;const e=[];throw o||e.push("WebXR Device API"),s||e.push("WebXR Hit Test API"),new Error("The following APIs are required for AR, but are missing in this browser: "+e.join(", "))},Ou=e=>new URL(e,window.location.toString()).toString(),Iu=(e,t)=>{let n=null;return(...i)=>{null!=n&&self.clearTimeout(n),n=self.setTimeout(()=>{n=null,e(...i)},t)}},Du=(e,t,n)=>Math.max(t,Math.min(n,e)),Nu=(()=>{const e=(()=>{const e=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(const t of e)if("viewport"===t.name)return!0;return!1})();return e||console.warn('No <meta name="viewport"> detected; <model-viewer> will cap pixel density at 1.'),()=>e?window.devicePixelRatio:1})(),zu=(()=>{const e=new RegExp("[?&]model-viewer-debug-mode(&|$)");return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})(),Uu=Math.PI/24,Fu=new M,Bu=(e,t,n)=>{let i=t>0?n>0?0:-Math.PI/2:n>0?Math.PI/2:Math.PI;for(let r=0;r<=12;++r)e.push(t+.17*Math.cos(i),n+.17*Math.sin(i),0,t+.2*Math.cos(i),n+.2*Math.sin(i),0),i+=Uu};class Hu extends Vt{constructor(e){const t=new Tt,n=[],i=[],{size:r,boundingBox:a}=e,o=r.x/2,s=r.z/2;Bu(i,o,s),Bu(i,-o,s),Bu(i,-o,-s),Bu(i,o,-s);const l=i.length/3;for(let e=0;e<l-2;e+=2)n.push(e,e+1,e+3,e,e+3,e+2);const c=l-2;n.push(c,c+1,1,c,1,0),t.setAttribute("position",new ft(i,3)),t.setIndex(n),super(t);const h=this.material;h.side=2,h.transparent=!0,h.opacity=0,this.goalOpacity=0,this.opacityDamper=new Ih,this.hitPlane=new Vt(new mn(r.x+.4,r.z+.4)),this.hitPlane.visible=!1,this.add(this.hitPlane),this.rotateX(-Math.PI/2),a.getCenter(this.position),this.shadowHeight=a.min.y,this.position.y=this.shadowHeight,e.add(this)}getHit(e,t,n){Fu.set(t,-n),this.hitPlane.visible=!0;const i=e.positionAndNormalFromPoint(Fu,this.hitPlane);return this.hitPlane.visible=!1,null==i?null:i.position}set offsetHeight(e){this.position.y=this.shadowHeight+e}get offsetHeight(){return this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?.75:0}updateOpacity(e){const t=this.material;t.opacity=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1),this.visible=t.opacity>0}dispose(){const{geometry:e,material:t}=this.hitPlane;e.dispose(),t.dispose(),this.geometry.dispose(),this.material.dispose()}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const Gu=e=>{if(null==e)throw new Error("WebGL is not available!");return e},ku=e=>{const t={EXT_shader_texture_lod:"\n #extension GL_EXT_shader_texture_lod : enable\n precision mediump float;\n uniform sampler2D tex;\n void main() {\n gl_FragColor = texture2DLodEXT(tex, vec2(0.0, 0.0), 0.0);\n }"};const n=e.getExtension;e.getExtension=i=>{let r;return t[i]?(r=n.call(e,i),r&&!function(e,n){const i=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(i,t[n]),e.compileShader(i);const r=e.getShaderParameter(i,e.COMPILE_STATUS);return e.deleteShader(i),r}(e,i)&&(r=null)):r=n.call(e,i),r}};
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var Vu,ju,Wu,qu,Xu,Yu,Ju,Zu,Ku,Qu,$u,ep,tp,np,ip,rp,ap,op,sp,lp,cp,hp,up,pp,dp,fp,mp,gp,vp,yp,xp,bp,wp,_p,Mp,Sp,Tp;const Ep="not-presenting",Ap="session-started",Lp="object-placed",Rp=Symbol("presentedScene"),Pp=Symbol("placementBox"),Cp=Symbol("lastTick"),Op=Symbol("turntableRotation"),Ip=Symbol("oldShadowIntensity"),Dp=Symbol("oldBackground"),Np=Symbol("rafId"),zp=Symbol("currentSession"),Up=Symbol("tick"),Fp=Symbol("refSpace"),Bp=Symbol("viewerRefSpace"),Hp=Symbol("frame"),Gp=Symbol("initialized"),kp=Symbol("initialModelToWorld"),Vp=Symbol("placementComplete"),jp=Symbol("hitTestSource"),Wp=Symbol("transiertHitTestSource"),qp=Symbol("inputSource"),Xp=Symbol("isTranslating"),Yp=Symbol("isRotating"),Jp=Symbol("isScaling"),Zp=Symbol("lastDragPosition"),Kp=Symbol("lastScalar"),Qp=Symbol("goalPosition"),$p=Symbol("goalYaw"),ed=Symbol("goalScale"),td=Symbol("xDamper"),nd=Symbol("yDamper"),id=Symbol("zDamper"),rd=Symbol("yawDamper"),ad=Symbol("scaleDamper"),od=Symbol("damperRate"),sd=Symbol("resolveCleanup"),ld=Symbol("exitWebXRButtonContainer"),cd=Symbol("onWebXRFrame"),hd=Symbol("postSessionCleanup"),ud=Symbol("updateCamera"),pd=Symbol("placeInitially"),dd=Symbol("getHitPoint"),fd=Symbol("onSelectStart"),md=Symbol("onSelect"),gd=Symbol("onUpdateScene"),vd=Symbol("fingerSeparation"),yd=Symbol("processInput"),xd=Symbol("moveScene"),bd=Symbol("onExitWebXRButtonContainerClick"),wd=new D,_d=new k,Md=new D;class Sd extends y{constructor(e){super(),this.renderer=e,this.camera=new rn,this[Vu]=null,this[ju]=null,this[Wu]=null,this[qu]=null,this[Xu]=null,this[Yu]=null,this[Ju]=null,this[Zu]=null,this[Ku]=null,this[Qu]=null,this[$u]=null,this[ep]=null,this[tp]=null,this[np]=null,this[ip]=null,this[rp]=null,this[ap]=!1,this[op]=new k,this[sp]=!1,this[lp]=!1,this[cp]=!1,this[hp]=!1,this[up]=new D,this[pp]=0,this[dp]=new D,this[fp]=0,this[mp]=1,this[gp]=new Ih,this[vp]=new Ih,this[yp]=new Ih,this[xp]=new Ih,this[bp]=new Ih,this[wp]=1,this[_p]=()=>this.stopPresenting(),this[Mp]=()=>{null!=this[Pp]&&this.isPresenting&&(this[Pp].dispose(),this[Pp]=new Hu(this[Rp].model))},this[Sp]=e=>{const t=this[Wp];if(null==t)return;const n=this[Hp].getHitTestResultsForTransientInput(t),i=this[Rp],r=this[Pp];if(1===n.length){this[qp]=e.inputSource;const{axes:t}=this[qp].gamepad,n=r.getHit(this[Rp],t[0],t[1]);r.show=!0,null!=n?(this[Xp]=!0,this[Zp].copy(n)):(this[Yp]=!0,this[Kp]=t[0])}else 2===n.length&&i.canScale&&(r.show=!0,this[Jp]=!0,this[Kp]=this[vd](n)/i.scale.x)},this[Tp]=()=>{this[Xp]=!1,this[Yp]=!1,this[Jp]=!1,this[qp]=null,this[Qp].y+=this[Pp].offsetHeight*this[Rp].scale.x,this[Pp].show=!1},this.threeRenderer=e.threeRenderer,this.camera.matrixAutoUpdate=!1}async resolveARSession(e){Cu();const t=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay"],domOverlay:{root:e.element.shadowRoot.querySelector("div.annotation-container")}}),n=Gu(this.renderer.context3D);await n.makeXRCompatible(),t.updateRenderState({baseLayer:new XRWebGLLayer(t,n,{alpha:!0})});let i=new Promise((e,n)=>{t.requestAnimationFrame(()=>e())});await i,e.element[pm](window.screen);const{framebuffer:r,framebufferWidth:a,framebufferHeight:o}=t.renderState.baseLayer;this.threeRenderer.setFramebuffer(r),this.threeRenderer.setPixelRatio(1),this.threeRenderer.setSize(a,o,!1);const s=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");return s.classList.add("enabled"),s.addEventListener("click",this[bd]),this[ld]=s,t}get presentedScene(){return this[Rp]}async supportsPresentation(){try{return Cu(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return!1}}async present(e){this.isPresenting&&console.warn("Cannot present while a model is already presenting");let t=new Promise((e,t)=>{requestAnimationFrame(()=>e())});e.model.setHotspotsVisibility(!1),e.isDirty=!0,await t,this[Rp]=e;const n=await this.resolveARSession(e);n.addEventListener("end",()=>{this[hd]()},{once:!0}),this[Fp]=await n.requestReferenceSpace("local"),this[Bp]=await n.requestReferenceSpace("viewer"),e.setCamera(this.camera),this[Gp]=!1,this[od]=.4,this[Op]=e.yaw,e.yaw=0,this[$p]=0,this[ed]=1,this[Dp]=e.background,e.background=null,this[Ip]=e.shadowIntensity,e.setShadowIntensity(0),e.addEventListener("model-load",this[gd]);const i=20*Math.PI/180,r=new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(i),z:-Math.cos(i)});n.requestHitTestSource({space:this[Bp],offsetRay:r}).then(e=>{this[jp]=e}),this[zp]=n,this[Pp]=new Hu(e.model),this[Vp]=!1,this[Cp]=performance.now(),this[Up]()}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise(e=>{this[sd]=e});try{await this[zp].end(),await e}catch(e){console.warn("Error while trying to end AR session"),console.warn(e),this[hd]()}}[(Vu=Pp,ju=Cp,Wu=Op,qu=Ip,Xu=Dp,Yu=Np,Ju=zp,Zu=Fp,Ku=Bp,Qu=Hp,$u=jp,ep=Wp,tp=qp,np=Rp,ip=sd,rp=ld,ap=Gp,op=kp,sp=Vp,lp=Xp,cp=Yp,hp=Jp,up=Zp,pp=Kp,dp=Qp,fp=$p,mp=ed,gp=td,vp=nd,yp=id,xp=rd,bp=ad,wp=od,_p=bd,hd)](){this.threeRenderer.setFramebuffer(null);const e=this[zp];null!=e&&(e.removeEventListener("selectstart",this[fd]),e.removeEventListener("selectend",this[md]),e.cancelAnimationFrame(this[Np]),this[zp]=null);const t=this[Rp];if(null!=t){const{model:e,element:n}=t;t.setCamera(t.camera),e.remove(this[Pp]),t.position.set(0,0,0),t.scale.set(1,1,1),e.setShadowScaleAndOffset(1,0);const i=this[Op];null!=i&&(t.yaw=i);const r=this[Ip];null!=r&&t.setShadowIntensity(r);const a=this[Dp];null!=a&&(t.background=a),t.removeEventListener("model-load",this[gd]),e.orientHotspots(0),n.requestUpdate("cameraTarget"),n[pm](n.getBoundingClientRect())}this.renderer.height=0;const n=this[ld];null!=n&&(n.classList.remove("enabled"),n.removeEventListener("click",this[bd]),this[ld]=null);const i=this[Wp];null!=i&&(i.cancel(),this[Wp]=null);const r=this[jp];null!=r&&(r.cancel(),this[jp]=null),null!=this[Pp]&&(this[Pp].dispose(),this[Pp]=null),this[Cp]=null,this[Op]=null,this[Ip]=null,this[Dp]=null,this[Np]=null,this[Fp]=null,this[Rp]=null,this[Bp]=null,this[Hp]=null,this[qp]=null,null!=this[sd]&&this[sd](),this.dispatchEvent({type:"status",status:Ep})}get isPresenting(){return null!=this[Rp]}updateTarget(){const e=this[Rp];if(null!=e){const t=e.getTarget();e.setTarget(t.x,e.model.boundingBox.min.y,t.z)}}[(Mp=gd,ud)](e){const{camera:t}=this,{matrix:n}=t;if(n.fromArray(e.transform.matrix),t.updateMatrixWorld(!0),t.position.setFromMatrixPosition(n),null!=this[jp]){const{position:e,model:n}=this[Rp],i=n.idealCameraDistance;t.getWorldDirection(e),e.multiplyScalar(i),e.add(t.position)}if(!this[Gp]){t.projectionMatrix.fromArray(e.projectionMatrix),t.projectionMatrixInverse.getInverse(t.projectionMatrix);const{x:n,z:i}=t.position,r=this[Rp];r.pointTowards(n,i),r.model.updateMatrixWorld(!0),this[$p]=r.yaw,this[kp].copy(r.model.matrixWorld),r.model.setHotspotsVisibility(!0),this[Gp]=!0,this.dispatchEvent({type:"status",status:Ap})}this[Rp].model.orientHotspots(Math.atan2(n.elements[1],n.elements[5]))}[pd](e){const t=this[jp];if(null==t)return;const n=e.getHitTestResults(t);if(0==n.length)return;const i=n[0],r=this[dd](i);if(null==r)return;this.placeModel(r),t.cancel(),this[jp]=null;const{session:a}=e;a.addEventListener("selectstart",this[fd]),a.addEventListener("selectend",this[md]),a.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then(e=>{this[Wp]=e})}[dd](e){const t=e.getPose(this[Fp]);if(null==t)return null;const n=_d.fromArray(t.transform.matrix);return n.elements[5]>.75?Md.setFromMatrixPosition(n):null}placeModel(e){const t=this[Rp],{model:n}=t,{min:i,max:r}=n.boundingBox;this[Pp].show=!0;const a=this[Qp];a.copy(e);const o=e.y,s=this.camera.position.clone(),l=e.clone().sub(s).normalize();s.sub(l.multiplyScalar(n.idealCameraDistance));const c=new Oe(s,l.normalize()),h=this[kp],u=(new D).setFromMatrixPosition(h).add(e);h.setPosition(u);const p=(new k).getInverse(h);c.applyMatrix4(p),r.y+=10,c.intersectBox(n.boundingBox,u),r.y-=10,null!=u&&(u.applyMatrix4(h),a.add(e).sub(u));const d=t.getTarget();t.setTarget(d.x,i.y,d.z),a.y=o,this.dispatchEvent({type:"status",status:Lp})}[(Sp=fd,Tp=md,vd)](e){const t=e[0].inputSource.gamepad.axes,n=e[1].inputSource.gamepad.axes,i=n[0]-t[0],r=n[1]-t[1];return Math.sqrt(i*i+r*r)}[yd](e){const t=this[Wp];if(null==t)return;if(!this[Xp]&&!this[Jp]&&!this[Yp])return;const n=e.getHitTestResultsForTransientInput(t),i=this[Rp],r=i.scale.x;if(this[Jp])if(n.length<2)this[Jp]=!1;else{const e=this[vd](n)/this[Kp];this[ed]=e<1.2&&e>1/1.2?1:e}else{if(2===n.length&&i.canScale)return this[Xp]=!1,this[Yp]=!1,this[Jp]=!0,void(this[Kp]=this[vd](n)/r);if(this[Yp]){const e=this[qp].gamepad.axes[0];this[$p]+=1.5*(e-this[Kp]),this[Kp]=e}else this[Xp]&&n.forEach(e=>{if(e.inputSource!==this[qp]||e.results.length<1)return;const t=this[dd](e.results[0]);if(null==t)return;this[Qp].sub(this[Zp]);const n=t.y-this[Zp].y;if(n<0){this[Pp].offsetHeight=n/r,this[Rp].model.setShadowScaleAndOffset(r,n);const e=wd.copy(this.camera.position),i=-n/(e.y-t.y);e.multiplyScalar(i),t.multiplyScalar(1-i).add(e)}this[Qp].add(t),this[Zp].copy(t)})}}[xd](e){const t=this[Rp],{model:n,position:i,yaw:r}=t,a=n.idealCameraDistance,o=this[Qp],s=t.scale.x,l=this[Pp];if(null==this[jp]&&(!o.equals(i)||this[ed]!==s)){let{x:r,y:c,z:h}=i;e*=this[od],r=this[td].update(r,o.x,e,a),c=this[nd].update(c,o.y,e,a),h=this[id].update(h,o.z,e,a),i.set(r,c,h);const u=this[ad].update(s,this[ed],e,1);if(t.scale.set(u,u,u),!this[Xp]){const e=o.y-c;this[Vp]?(l.offsetHeight=e/u,n.setShadowScaleAndOffset(u,e)):0===e&&(this[Vp]=!0,l.show=!1,t.setShadowIntensity(.3),this[od]=1)}}l.updateOpacity(e),t.updateTarget(e),t.updateMatrixWorld(!0),t.yaw=this[rd].update(r,this[$p],e,Math.PI)}[Up](){this[Np]=this[zp].requestAnimationFrame((e,t)=>this[cd](e,t))}[cd](e,t){this[Hp]=t;const n=t.getViewerPose(this[Fp]);this[Up]();const i=this[Rp];if(null==n||null==i)return;this[ud](n.views[0]),this[pd](t),this[yd](t);const r=e-this[Cp];this[xd](r),this.renderer.preRender(i,e,r),this[Cp]=e,this.threeRenderer.render(i,this.camera)}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/class Td{constructor(e){e.threeRenderer.debug={checkShaderErrors:!0},Promise.resolve().then(()=>{self.dispatchEvent(new CustomEvent("model-viewer-renderer-debug",{detail:{renderer:e,THREE:{ShaderMaterial:tn,Texture:A,Mesh:Vt,Scene:se,PlaneBufferGeometry:mn,OrthographicCamera:el,WebGLRenderTarget:R}}}))})}addScene(e){self.dispatchEvent(new CustomEvent("model-viewer-scene-added-debug",{detail:{scene:e}}))}removeScene(e){self.dispatchEvent(new CustomEvent("model-viewer-scene-removed-debug",{detail:{scene:e}}))}}const Ed=Symbol("threeGLTF"),Ad=Symbol("gltf"),Ld=Symbol("gltfElementMap"),Rd=Symbol("threeObjectMap"),Pd=Symbol("parallelTraverseThreeScene"),Cd=Symbol("correlateOriginalThreeGLTF"),Od=Symbol("correlateCloneThreeGLTF");class Id{constructor(e,t,n,i){this[Ed]=e,this[Ad]=t,this[Ld]=i,this[Rd]=n}static from(e,t){return null!=t?this[Od](e,t):this[Cd](e)}static[Cd](e){const t=e.parser.json,{associations:n}=e.parser,i=new Map;return n.forEach((e,n)=>{if(null==e)return;const{type:r,index:a}=e,o=(t[r]||[])[a];if(null==o)return;let s=i.get(o);null==s&&(s=new Set,i.set(o,s)),s.add(n)}),new Id(e,t,n,i)}static[Od](e,t){const n=t.threeGLTF,i=t.gltf,r=JSON.parse(JSON.stringify(i)),a=new Map,o=new Map;for(let i=0;i<n.scenes.length;i++)this[Pd](n.scenes[i],e.scenes[i],(e,n)=>{const i=t.threeObjectMap.get(e);if(null!=i){const{type:e,index:t}=i,s=r[e][t];a.set(n,{type:e,index:t});const l=o.get(s)||new Set;l.add(n),o.set(s,l)}});return new Id(e,r,a,o)}static[Pd](e,t,n){const i=(e,t)=>{if(n(e,t),e.isObject3D){if(e.isMesh)if(Array.isArray(e.material))for(let n=0;n<e.material.length;++n)i(e.material[n],t.material[n]);else i(e.material,t.material);for(let n=0;n<e.children.length;++n)i(e.children[n],t.children[n])}};i(e,t)}get threeGLTF(){return this[Ed]}get gltf(){return this[Ad]}get gltfElementMap(){return this[Ld]}get threeObjectMap(){return this[Rd]}}Hd=new D,Gd=new C,kd=new D,Vd=new k,jd=new k,Wd=new k,Dd=new D,Nd=new D,zd=new D,Ud=new D,Fd=new M,Bd=new M;var Dd,Nd,zd,Ud,Fd,Bd,Hd,Gd,kd,Vd,jd,Wd,qd=function(e){var t=new Map,n=new Map,i=e.clone();return function e(t,n,i){i(t,n);for(var r=0;r<t.children.length;r++)e(t.children[r],n.children[r],i)}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/(e,i,(function(e,i){t.set(i,e),n.set(e,i)})),i.traverse((function(e){if(e.isSkinnedMesh){var i=e,r=t.get(e),a=r.skeleton.bones;i.skeleton=r.skeleton.clone(),i.bindMatrix.copy(r.bindMatrix),i.skeleton.bones=a.map((function(e){return n.get(e)})),i.bind(i.skeleton,i.bindMatrix)}})),i};const Xd=Symbol("prepared"),Yd=Symbol("prepare"),Jd=Symbol("preparedGLTF"),Zd=Symbol("clone");class Kd{constructor(e){this[Jd]=e}static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[Xd])return e;const t=this[Yd](e);return t[Xd]=!0,t}static[Yd](e){const{scene:t}=e,n=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:n})}get parser(){return this[Jd].parser}get animations(){return this[Jd].animations}get scene(){return this[Jd].scene}get scenes(){return this[Jd].scenes}get cameras(){return this[Jd].cameras}get asset(){return this[Jd].asset}get userData(){return this[Jd].userData}clone(){return new(0,this.constructor)(this[Zd]())}dispose(){this.scenes.forEach(e=>{e.traverse(e=>{if(!e.isMesh)return;const t=e;(Array.isArray(t.material)?t.material:[t.material]).forEach(e=>{e.dispose()}),t.geometry.dispose()})})}[Zd](){const e=this[Jd],t=qd(this.scene),n=[t],i=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:n,userData:i})}}
|
|
/**
|
|
* @license MIT
|
|
* @see https://github.com/mrdoob/three.js/blob/dev/LICENSE
|
|
*/const Qd="\n#ifdef ALPHATEST\n\n if ( diffuseColor.a < ALPHATEST ) discard;\n diffuseColor.a = 1.0;\n\n#endif\n",$d=Symbol("cloneAndPatchMaterial"),ef=Symbol("correlatedSceneGraph");
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/class tf extends Kd{static[Yd](e){const t=super[Yd](e);null==t[ef]&&(t[ef]=Id.from(t));const{scene:n}=t,i=[];n.traverse(e=>{if(e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid),!e.isMesh)return;e.castShadow=!0;const t=e;let n=!1;(Array.isArray(t.material)?t.material:[t.material]).forEach(e=>{e.isMeshStandardMaterial&&(e.transparent&&2===e.side&&(n=!0,e.side=0),Mf.singleton.roughnessMipmapper.generateMipmaps(e))}),n&&i.push(t)});for(const e of i){const t=(Array.isArray(e.material)?e.material:[e.material]).map(e=>{const t=e.clone();return t.side=1,t}),n=Array.isArray(e.material)?t:t[0],i=new Vt(e.geometry,n);i.renderOrder=-1,e.add(i)}return t}get correlatedSceneGraph(){return this[Jd][ef]}[Zd](){const e=super[Zd](),t=new Map;return e.scene.traverse(e=>{if(e.isMesh){const n=e;Array.isArray(n.material)?n.material=n.material.map(e=>this[$d](e,t)):null!=n.material&&(n.material=this[$d](n.material,t))}}),e[ef]=Id.from(e,this.correlatedSceneGraph),e}[$d](e,t){if(t.has(e.uuid))return t.get(e.uuid);const n=e.clone(),i=e.onBeforeCompile;return n.onBeforeCompile=e.isGLTFSpecularGlossinessMaterial?e=>{i(e,void 0),e.fragmentShader=e.fragmentShader.replace("#include <alphatest_fragment>",Qd)}:e=>{e.fragmentShader=e.fragmentShader.replace("#include <alphatest_fragment>",Qd),i(e,void 0)},n.shadowSide=0,n.transparent&&(n.depthWrite=!1),n.alphaTest||n.transparent||(n.alphaTest=-.5),t.set(e.uuid,n),n}}var nf,rf,af=function(e){bs.call(this,e),this.type=1009};af.prototype=Object.assign(Object.create(bs.prototype),{constructor:af,parse:function(e){var t=function(e,t){switch(e){case 1:console.error("RGBELoader Read Error: "+(t||""));break;case 2:console.error("RGBELoader Write Error: "+(t||""));break;case 3:console.error("RGBELoader Bad File Format: "+(t||""));break;default:case 4:console.error("RGBELoader: Error: "+(t||""))}return-1},n=function(e,t,n){t=t||1024;for(var i=e.pos,r=-1,a=0,o="",s=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));0>(r=s.indexOf("\n"))&&a<t&&i<e.byteLength;)o+=s,a+=s.length,i+=128,s+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));return-1<r&&(!1!==n&&(e.pos+=a+r+1),o+s.slice(0,r))},i=function(e,t,n,i){var r=e[t+3],a=Math.pow(2,r-128)/255;n[i+0]=e[t+0]*a,n[i+1]=e[t+1]*a,n[i+2]=e[t+2]*a},r=function(){var e=new Float32Array(1),t=new Int32Array(e.buffer);function n(n){e[0]=n;var i=t[0],r=i>>16&32768,a=i>>12&2047,o=i>>23&255;return o<103?r:o>142?(r|=31744,r|=(255==o?0:1)&&8388607&i):o<113?r|=((a|=2048)>>114-o)+(a>>113-o&1):(r|=o-112<<10|a>>1,r+=1&a)}return function(e,t,i,r){var a=e[t+3],o=Math.pow(2,a-128)/255;i[r+0]=n(e[t+0]*o),i[r+1]=n(e[t+1]*o),i[r+2]=n(e[t+2]*o)}}(),a=new Uint8Array(e);a.pos=0;var o=function(e){var i,r,a=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,l=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,c={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(i=n(e)))return t(1,"no header found");if(!(r=i.match(/^#\?(\S+)$/)))return t(3,"bad initial token");for(c.valid|=1,c.programtype=r[1],c.string+=i+"\n";!1!==(i=n(e));)if(c.string+=i+"\n","#"!==i.charAt(0)){if((r=i.match(a))&&(c.gamma=parseFloat(r[1],10)),(r=i.match(o))&&(c.exposure=parseFloat(r[1],10)),(r=i.match(s))&&(c.valid|=2,c.format=r[1]),(r=i.match(l))&&(c.valid|=4,c.height=parseInt(r[1],10),c.width=parseInt(r[2],10)),2&c.valid&&4&c.valid)break}else c.comments+=i+"\n";return 2&c.valid?4&c.valid?c:t(3,"missing image size specifier"):t(3,"missing format specifier")}(a);if(-1!==o){var s=o.width,l=o.height,c=function(e,n,i){var r,a,o,s,l,c,h,u,p,d,f,m,g,v=n,y=i;if(v<8||v>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(v!==(e[2]<<8|e[3]))return t(3,"wrong scanline width");if(!(r=new Uint8Array(4*n*i)).length)return t(4,"unable to allocate buffer space");for(a=0,o=0,u=4*v,g=new Uint8Array(4),c=new Uint8Array(u);y>0&&o<e.byteLength;){if(o+4>e.byteLength)return t(1);if(g[0]=e[o++],g[1]=e[o++],g[2]=e[o++],g[3]=e[o++],2!=g[0]||2!=g[1]||(g[2]<<8|g[3])!=v)return t(3,"bad rgbe scanline format");for(h=0;h<u&&o<e.byteLength;){if((m=(s=e[o++])>128)&&(s-=128),0===s||h+s>u)return t(3,"bad scanline data");if(m)for(l=e[o++],p=0;p<s;p++)c[h++]=l;else c.set(e.subarray(o,o+s),h),h+=s,o+=s}for(d=v,p=0;p<d;p++)f=0,r[a]=c[p+f],f+=v,r[a+1]=c[p+f],f+=v,r[a+2]=c[p+f],f+=v,r[a+3]=c[p+f],a+=4;y--}return r}(a.subarray(a.pos),s,l);if(-1!==c){switch(this.type){case 1009:var h=c,u=1023,p=1009;break;case 1015:for(var d=c.length/4*3,f=new Float32Array(d),m=0;m<d;m++)i(c,4*m,f,3*m);h=f,u=1022,p=1015;break;case 1016:d=c.length/4*3;var g=new Uint16Array(d);for(m=0;m<d;m++)r(c,4*m,g,3*m);h=g,u=1022,p=1016;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:s,height:l,data:h,header:o.string,gamma:o.gamma,exposure:o.exposure,format:u,type:p}}}return null},setDataType:function(e){return this.type=e,this},load:function(e,t,n,i){return bs.prototype.load.call(this,e,(function(e,n){switch(e.type){case 1009:e.encoding=3002,e.minFilter=1003,e.magFilter=1003,e.generateMipmaps=!1,e.flipY=!0;break;case 1015:case 1016:e.encoding=3e3,e.minFilter=1006,e.magFilter=1006,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,n)}),n,i)}});
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
class of extends se{constructor(){super(),this.position.y=-3.5;const e=new Kt;e.deleteAttribute("uv");const t=new ko({metalness:0,side:1}),n=new ko({metalness:0}),i=new $s(16777215,500,28,2);i.position.set(.418,16.199,.3),this.add(i);const r=new Vt(e,t);r.position.set(-.757,13.219,.717),r.scale.set(31.713,28.305,28.591),this.add(r);const a=new Vt(e,n);a.position.set(-10.906,2.009,1.846),a.rotation.set(0,-.195,0),a.scale.set(2.328,7.905,4.651),this.add(a);const o=new Vt(e,n);o.position.set(-5.607,-.754,-.758),o.rotation.set(0,.994,0),o.scale.set(1.97,1.534,3.955),this.add(o);const s=new Vt(e,n);s.position.set(6.167,.857,7.803),s.rotation.set(0,.561,0),s.scale.set(3.927,6.285,3.687),this.add(s);const l=new Vt(e,n);l.position.set(-2.017,.018,6.124),l.rotation.set(0,.333,0),l.scale.set(2.002,4.566,2.064),this.add(l);const c=new Vt(e,n);c.position.set(2.291,-.756,-2.621),c.rotation.set(0,-.286,0),c.scale.set(1.546,1.552,1.496),this.add(c);const h=new Vt(e,n);h.position.set(-2.193,-.369,-5.547),h.rotation.set(0,.516,0),h.scale.set(3.875,3.487,2.986),this.add(h);const u=new Vt(e,this.createAreaLightMaterial(50));u.position.set(-16.116,14.37,8.208),u.scale.set(.1,2.428,2.739),this.add(u);const p=new Vt(e,this.createAreaLightMaterial(50));p.position.set(-16.109,18.021,-8.207),p.scale.set(.1,2.425,2.751),this.add(p);const d=new Vt(e,this.createAreaLightMaterial(17));d.position.set(14.904,12.198,-1.832),d.scale.set(.15,4.265,6.331),this.add(d);const f=new Vt(e,this.createAreaLightMaterial(43));f.position.set(-.462,8.89,14.52),f.scale.set(4.38,5.441,.088),this.add(f);const m=new Vt(e,this.createAreaLightMaterial(20));m.position.set(3.235,11.486,-12.541),m.scale.set(2.5,2,.1),this.add(m);const g=new Vt(e,this.createAreaLightMaterial(100));g.position.set(0,20,0),g.scale.set(1,.1,1),this.add(g)}createAreaLightMaterial(e){const t=new rt;return t.color.setScalar(e),t}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/ps.enabled=!0;const sf=/\.hdr$/,lf=new Ms,cf=new af,hf=Symbol("environmentMapCache"),uf=Symbol("generatedEnvironmentMap"),pf=Symbol("PMREMGenerator"),df=Symbol("addMetadata"),ff=Symbol("loadEnvironmentMapFromUrl"),mf=Symbol("loadGeneratedEnvironmentMap"),gf={url:null,mapping:null};class vf extends y{constructor(e){super(),this[nf]=null,this[rf]=new Map,this[pf]=new nh(e)}get pmremGenerator(){return this[pf]}async load(e,t=(()=>{})){try{this[pf].compileEquirectangularShader();const n=sf.test(e),i=n?cf:lf,r=await new Promise((n,r)=>i.load(e,n,e=>{t(e.loaded/e.total*.9)},r));return t(1),this[df](r,e,"Equirectangular"),n?(r.encoding=3002,r.minFilter=1003,r.magFilter=1003,r.flipY=!0):r.encoding=3007,r}finally{t&&t(1)}}async loadEquirectAsCubeUV(e,t=(()=>{})){let n=null;try{n=await this.load(e,t);const i=this[pf].fromEquirectangular(n);return this[df](i.texture,e,"CubeUV"),i}finally{null!=n&&n.dispose()}}async generateEnvironmentMapAndSkybox(e=null,t=null,n={}){const{progressTracker:i}=n,r=null!=i?i.beginActivity():()=>{};try{let n,a=Promise.resolve(null);e&&(a=this[ff](e,i)),n=t?this[ff](t,i):e?a:this[mf]();let[o,s]=await Promise.all([n,a]);if(null==o)throw new Error("Failed to load environment map.");return o=o,this[df](o.texture,t,"PMREM"),null!=s&&this[df](s.texture,e,"PMREM"),{environmentMap:o,skybox:s}}finally{r(1)}}[(nf=uf,rf=hf,df)](e,t,n){null!=e&&(e.userData=Object.assign(Object.assign({},gf),{url:t,mapping:n}))}[ff](e,t){if(!this[hf].has(e)){const n=t?t.beginActivity():()=>{},i=this.loadEquirectAsCubeUV(e,n);this[hf].set(e,i)}return this[hf].get(e)}[mf](){if(null==this[uf]){const e=new of;this[uf]=this[pf].fromScene(e,.04),e.dispose()}return Promise.resolve(this[uf])}async dispose(){const e=[];this[hf].forEach(t=>{e.push(t)}),this[hf].clear();for(const t of e)try{(await t).dispose()}catch(e){}null!=this[uf]&&(this[uf].dispose(),this[uf]=null)}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var yf,xf;const bf=Symbol("onWebGLContextLost"),wf=Symbol("webGLContextLostHandler"),_f=Symbol("singleton");class Mf extends y{constructor(e){super(),this.loader=new Ph(tf),this.width=0,this.height=0,this.dpr=1,this.minScale=.5,this.debugger=null,this.scenes=new Set,this.multipleScenesVisible=!1,this.scale=1,this.avgFrameDuration=22,this[xf]=e=>this[bf](e);const t={alpha:!0,antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0};this.dpr=Nu(),this.canvasElement=document.createElement("canvas"),this.canvasElement.id="webgl-canvas",this.canvas3D=this.canvasElement,this.canvas3D.addEventListener("webglcontextlost",this[wf]);try{this.context3D=((e,t)=>Gu(e.getContext("webgl",t)||e.getContext("experimental-webgl",t)))(this.canvas3D,t),ku(this.context3D),this.threeRenderer=new mr({canvas:this.canvas3D,context:this.context3D}),this.threeRenderer.autoClear=!0,this.threeRenderer.outputEncoding=3007,this.threeRenderer.gammaFactor=2.2,this.threeRenderer.physicallyCorrectLights=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.shadowMap.enabled=!0,this.threeRenderer.shadowMap.type=2,this.threeRenderer.shadowMap.autoUpdate=!1,this.debugger=null!=e&&e.debug?new Td(this):null,this.threeRenderer.debug={checkShaderErrors:!!this.debugger},this.threeRenderer.toneMapping=5}catch(e){this.context3D=null,console.warn(e)}this.arRenderer=new Sd(this),this.textureUtils=this.canRender?new vf(this.threeRenderer):null,this.roughnessMipmapper=new Ru(this.threeRenderer),this.updateRendererSize(),this.lastTick=performance.now(),this.avgFrameDuration=0}static get singleton(){return this[_f]}static resetSingleton(){this[_f].dispose(),this[_f]=new Mf({debug:zu()})}get canRender(){return null!=this.threeRenderer&&null!=this.context3D}get scaleFactor(){return this.scale}updateRendererSize(){const e=Nu();if(e!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[Qf](t.getBoundingClientRect())}let t=0,n=0;for(const e of this.scenes)t=Math.max(t,e.width),n=Math.max(n,e.height);if(t===this.width&&n===this.height&&e===this.dpr)return;this.width=t,this.height=n,this.dpr=e,this.canRender&&this.threeRenderer.setSize(t*e,n*e,!1);const i=t/this.scale,r=n/this.scale;this.canvasElement.style.width=i+"px",this.canvasElement.style.height=r+"px";for(const a of this.scenes){const{canvas:o}=a;o.width=t*e,o.height=n*e,o.style.width=i+"px",o.style.height=r+"px",a.isDirty=!0}}updateRendererScale(){let{scale:e}=this;if(this.avgFrameDuration>26&&e>this.minScale?e*=.79:this.avgFrameDuration<18&&e<1&&(e/=.79,e=Math.min(e,1)),e=Math.max(e,this.minScale),e==this.scale)return;this.scale=e,this.avgFrameDuration=22;const t=this.width/e,n=this.height/e;this.canvasElement.style.width=t+"px",this.canvasElement.style.height=n+"px";for(const e of this.scenes){const{style:i}=e.canvas;i.width=t+"px",i.height=n+"px",e.isDirty=!0}}registerScene(e){this.scenes.add(e);const{canvas:t}=e;t.width=this.width*this.dpr,t.height=this.height*this.dpr,t.style.width=this.width/this.scale+"px",t.style.height=this.height/this.scale+"px",this.multipleScenesVisible&&t.classList.add("show"),e.isDirty=!0,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(e=>this.render(e)),null!=this.debugger&&this.debugger.addScene(e)}unregisterScene(e){this.scenes.delete(e),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null),null!=this.debugger&&this.debugger.removeScene(e)}displayCanvas(e){return this.multipleScenesVisible?e.element[sm]:this.canvasElement}selectCanvas(){let e=0,t=null;for(const n of this.scenes)n.element[ym]()&&(++e,t=n.element[om]);const n=e>1||!1,{canvasElement:i}=this;if(n!==this.multipleScenesVisible||!n&&i.parentElement!==t){this.multipleScenesVisible=n,n&&i.classList.remove("show");for(const e of this.scenes){const r=e.element[om],a=e.element[sm];n?(a.classList.add("show"),e.isDirty=!0):r===t&&(r.appendChild(i),i.classList.add("show"),a.classList.remove("show"),e.isDirty=!0)}}}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,n){const{element:i,exposure:r,model:a}=e;i[hm](t,n);const o="number"==typeof r&&!self.isNaN(r);this.threeRenderer.toneMappingExposure=o?r:1,a.updateShadow()&&(this.threeRenderer.shadowMap.needsUpdate=!0)}render(e){const t=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.avgFrameDuration+=Du(.2*(t-this.avgFrameDuration),-2,2),this.selectCanvas(),this.updateRendererSize(),this.updateRendererScale();const{dpr:n,scale:i}=this;for(const r of this.scenes){if(!r.element[ym]())continue;if(this.preRender(r,e,t),!r.isDirty)continue;r.isDirty=!1;const a=Math.ceil(r.width*i*n),o=Math.ceil(r.height*i*n);if(this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.floor(this.height*n)-o,a,o),this.threeRenderer.render(r,r.getCamera()),this.multipleScenesVisible){null==r.context&&r.createContext();{const e=r.context;e.clearRect(0,0,a,o),e.drawImage(this.canvas3D,0,0,a,o,0,0,a,o)}}}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null,this.scenes.clear(),this.canvas3D.removeEventListener("webglcontextlost",this[wf])}[(yf=_f,xf=wf,bf)](e){this.dispatchEvent({type:"contextlost",sourceEvent:e})}}Mf[yf]=new Mf({debug:zu()});
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var Sf,Tf;const Ef=Symbol("ongoingActivities"),Af=Symbol("announceTotalProgress"),Lf=Symbol("eventDelegate");class Rf{constructor(){this[Sf]=document.createDocumentFragment(),this.addEventListener=(...e)=>this[Lf].addEventListener(...e),this.removeEventListener=(...e)=>this[Lf].removeEventListener(...e),this.dispatchEvent=(...e)=>this[Lf].dispatchEvent(...e),this[Tf]=new Set}get ongoingActivityCount(){return this[Ef].size}beginActivity(){const e={progress:0};return this[Ef].add(e),1===this.ongoingActivityCount&&this[Af](),t=>{let n;return n=Math.max(Du(t,0,1),e.progress),n!==e.progress&&(e.progress=n,this[Af]()),e.progress}}[(Sf=Lf,Tf=Ef,Af)](){let e=0,t=0,n=0;for(const i of this[Ef]){const{progress:r}=i;e+=r*(.5/Math.pow(2,t++)),1===r&&n++}n===this.ongoingActivityCount&&(e=1,this[Ef].clear()),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:e}}))}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var Pf,Cf,Of,If,Df,Nf,zf,Uf,Ff,Bf,Hf=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const Gf=document.createElement("canvas");let kf=null;const Vf=Symbol("template"),jf=Symbol("fallbackResizeHandler"),Wf=Symbol("defaultAriaLabel"),qf=Symbol("resizeObserver"),Xf=Symbol("intersectionObserver"),Yf=Symbol("clearModelTimeout"),Jf=Symbol("onContextLost"),Zf=Symbol("contextLostHandler"),Kf=Symbol("loaded"),Qf=Symbol("updateSize"),$f=Symbol("isElementInViewport"),em=Symbol("announceModelVisibility"),tm=Symbol("ariaLabel"),nm=Symbol("loadedTime"),im=Symbol("updateSource"),rm=Symbol("markLoaded"),am=Symbol("container"),om=Symbol("input"),sm=Symbol("canvas"),lm=Symbol("scene"),cm=Symbol("needsRender"),hm=Symbol("tick"),um=Symbol("onModelLoad"),pm=Symbol("onResize"),dm=Symbol("renderer"),fm=Symbol("progressTracker"),mm=Symbol("getLoaded"),gm=Symbol("getModelIsVisible"),vm=Symbol("shouldAttemptPreload"),ym=Symbol("sceneIsReady"),xm=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}});class bm extends i{constructor(){super(),this.alt=null,this.src=null,this[Pf]=!1,this[Cf]=!1,this[Of]=0,this[If]=null,this[Df]=Iu(()=>{const e=this.getBoundingClientRect();this[Qf](e)},50),this[Nf]=Iu(e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))},0),this[zf]=null,this[Uf]=null,this[Ff]=new Rf,this[Bf]=e=>this[Jf](e);const e=this.constructor.template;window.ShadyCSS&&window.ShadyCSS.styleElement(this,{}),this.attachShadow({mode:"open"});const t=this.shadowRoot;let n,i;if(t.appendChild(e.content.cloneNode(!0)),this[am]=t.querySelector(".container"),this[om]=t.querySelector(".userInput"),this[sm]=t.querySelector("canvas"),this[Wf]=this[om].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();n=e.width,i=e.height}else n=300,i=150;this[lm]=new _u({canvas:this[sm],element:this,width:n,height:i}),this[lm].addEventListener("model-load",e=>{this[rm](),this[um](),this.dispatchEvent(new CustomEvent("load",{detail:{url:e.url}}))}),Promise.resolve().then(()=>{this[Qf](this.getBoundingClientRect())}),l&&(this[qf]=new ResizeObserver(e=>{if(!this[dm].isPresenting)for(let t of e)t.target===this&&this[Qf](t.contentRect)})),c?this[Xf]=new IntersectionObserver(e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[$f]=t.isIntersecting,this[em](e),this[$f]&&!this[ym]()&&this[im]()}},{root:null,rootMargin:"0px",threshold:0}):this[$f]=!0}static get is(){return"model-viewer"}static get template(){return this.hasOwnProperty(Vf)||(this[Vf]=(e=>{const t=document.createElement("template");return t.innerHTML=v.innerHTML,window.ShadyCSS&&window.ShadyCSS.prepareTemplate(t,e),t})(this.is)),this[Vf]}static set modelCacheSize(e){Ph[Lh].evictionThreshold=e}static get modelCacheSize(){return Ph[Lh].evictionThreshold}static set minimumRenderScale(e){e>1&&console.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&console.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0. This could result in single-pixel renders on some devices; consider increasing."),Mf.singleton.minScale=Math.max(0,Math.min(1,e))}static get minimumRenderScale(){return Mf.singleton.minScale}get loaded(){return this[mm]()}get[(Pf=$f,Cf=Kf,Of=nm,If=Yf,Df=jf,Nf=em,zf=qf,Uf=Xf,Ff=fm,Bf=Zf,dm)](){return Mf.singleton}get modelIsVisible(){return this[gm]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),l?this[qf].observe(this):self.addEventListener("resize",this[jf]),c&&this[Xf].observe(this);const e=this[dm];e.addEventListener("contextlost",this[Zf]),e.registerScene(this[lm]),null!=this[Yf]&&(self.clearTimeout(this[Yf]),this[Yf]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),l?this[qf].unobserve(this):self.removeEventListener("resize",this[jf]),c&&this[Xf].unobserve(this);const e=this[dm];e.removeEventListener("contextlost",this[Zf]),e.unregisterScene(this[lm]),this[Yf]=self.setTimeout(()=>{this[lm].model.clear()},1e3)}updated(e){if(super.updated(e),!e.has("src")||null!=this.src&&this.src===this[lm].model.url||(this[Kf]=!1,this[nm]=0,this[im]()),e.has("alt")){const e=null==this.alt?this[Wf]:this.alt;this[om].setAttribute("aria-label",e)}}toDataURL(e,t){return this[dm].displayCanvas(this[lm]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,n=e?e.qualityArgument:void 0,i=e?e.idealAspect:void 0,{width:r,height:a,model:o,aspect:s}=this[lm],{dpr:l,scaleFactor:c}=this[dm];let h=r*c*l,u=a*c*l,p=0,d=0;if(!0===i)if(o.fieldOfViewAspect>s){const e=u;u=Math.round(h/o.fieldOfViewAspect),d=(e-u)/2}else{const e=h;h=Math.round(u*o.fieldOfViewAspect),p=(e-h)/2}Gf.width=h,Gf.height=u;try{return new Promise(async(e,i)=>(null==kf&&(kf=Gf.getContext("2d")),kf.drawImage(this[dm].displayCanvas(this[lm]),p,d,h,u,0,0,h,u),!Gf.msToBlob||t&&"image/png"!==t?Gf.toBlob?void Gf.toBlob(t=>{if(!t)return i(new Error("Unable to retrieve canvas blob"));e(t)},t,n):e(await(async e=>new Promise((t,n)=>{const i=e.match(/data:(.*);/);if(!i)return n(new Error(e+" is not a valid data Url"));const r=i[1],a=e.replace(/data:image\/\w+;base64,/,""),o=atob(a),s=[];for(let e=0;e<o.length;e+=512){const t=o.slice(e,e+512),n=new Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);const i=new Uint8Array(n);s.push(i)}t(new Blob(s,{type:r}))}))(Gf.toDataURL(t,n))):e(Gf.msToBlob())))}finally{this[Qf]({width:r,height:a})}}get[tm](){return null==this.alt||"null"===this.alt?this[Wf]:this.alt}[mm](){return this[Kf]}[gm](){return this.loaded&&this[$f]}[vm](){return!!this.src&&this[$f]}[ym](){return this[Kf]}[Qf]({width:e,height:t}){this[am].style.width=e+"px",this[am].style.height=t+"px",this[pm]({width:parseFloat(e),height:parseFloat(t)})}[hm](e,t){}[rm](){this[Kf]||(this[Kf]=!0,this[nm]=performance.now())}[cm](){this[lm].isDirty=!0}[um](){}[pm](e){this[lm].setSize(e.width,e.height)}[Jf](e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))}async[im](){if(this.loaded||!this[vm]())return;const e=this[fm].beginActivity(),t=this.src;try{await this[lm].setModelSource(t,t=>e(.8*t));const n={url:t};this.dispatchEvent(new CustomEvent("preload",{detail:n}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:e}))}finally{e(.9),requestAnimationFrame(()=>{e(1)})}}}Hf([a({type:String})],bm.prototype,"alt",void 0),Hf([a({type:String})],bm.prototype,"src",void 0);
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var wm=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const _m=Symbol("changeAnimation"),Mm=Symbol("paused"),Sm=Symbol("annotationRenderer"),Tm=Symbol("hotspotMap"),Em=Symbol("mutationCallback"),Am=Symbol("observer"),Lm=Symbol("addHotspot"),Rm=Symbol("removeHotspot"),Pm=new M,Cm=new k,Om=e=>t=>{try{const n=Uh(t),i=(n.length?n[0].terms:[]).filter(e=>e&&"ident"===e.type).map(e=>e.value).filter(t=>e.indexOf(t)>-1),r=new Set;for(const e of i)r.add(e);return r}catch(e){}return new Set}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/;var Im=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const Dm=(()=>{const e=document.createElement("a");return e.setAttribute("rel","ar"),e.appendChild(document.createElement("img")),(t,n)=>{const i=new URL(t,self.location.toString());"fixed"===n&&(i.hash="allowsContentScaling=0"),e.setAttribute("href",i.toString()),e.click()}})(),Nm=(()=>{const e=document.createElement("a");let t=!1;return(n,i,r)=>{if(t)return;const a=self.location.toString(),o=new URL(a),s=new URL(n,a),l=s.protocol.replace(":","");o.hash="#model-viewer-no-ar-fallback";let c=`?file=${encodeURIComponent(s.toString())}&mode=ar_only&link=${a}&title=${encodeURIComponent(i)}`;"fixed"===r&&(c+="&resizable=false");const h=`intent://arvr.google.com/scene-viewer/1.0${c}#Intent;scheme=${l};package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(o.toString())};end;`;self.addEventListener("hashchange",()=>{"#model-viewer-no-ar-fallback"!==self.location.hash||t||(t=!0,self.history.back())},{once:!0}),e.setAttribute("href",h),e.click()}})(),zm=Om(["safari","chrome"]),Um=Om(["quick-look","scene-viewer","webxr","none"]),Fm="quick-look",Bm="scene-viewer",Hm="webxr",Gm="none",km=Symbol("arButtonContainer"),Vm=Symbol("enterARWithWebXR"),jm=Symbol("canActivateAR"),Wm=Symbol("arMode"),qm=Symbol("arModes"),Xm=Symbol("canLaunchQuickLook"),Ym=Symbol("quickLookBrowsers"),Jm=Symbol("onARButtonContainerClick"),Zm=Symbol("onARStatus");
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var Km,Qm,$m;const eg=Symbol("evaluate"),tg=Symbol("lastValue");class ng{constructor(){this[Km]=null}static evaluatableFor(e,t=Wh){if(e instanceof ng)return e;if("number"===e.type)return"%"===e.unit?new ag(e,t):e;switch(e.name.value){case"calc":return new hg(e,t);case"env":return new sg(e)}return Wh}static evaluate(e){return e instanceof ng?e.evaluate():e}static isConstant(e){return!(e instanceof ng)||e.isConstant}static applyIntrinsics(e,t){const{basis:n,keywords:i}=t,{auto:r}=i;return n.map((t,n)=>{const a=null==r[n]?t:r[n];let o=e[n]?e[n]:a;if("ident"===o.type){const e=o.value;e in i&&(o=i[e][n])}return null!=o&&"ident"!==o.type||(o=a),"%"===o.unit?zh(o.number/100*t.number,t.unit):(o=Yh(o,t),o.unit!==t.unit?t:o)})}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[tg]||(this[tg]=this[eg]()),this[tg]}}Km=tg;const ig=Symbol("percentage"),rg=Symbol("basis");class ag extends ng{constructor(e,t){super(),this[ig]=e,this[rg]=t}get isConstant(){return!0}[eg](){return zh(this[ig].number/100*this[rg].number,this[rg].unit)}}const og=Symbol("identNode");class sg extends ng{constructor(e){super(),this[Qm]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[og]=t)}get isConstant(){return!1}[(Qm=og,eg)](){if(null!=this[og])switch(this[og].value){case"window-scroll-y":return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return Wh}}const lg=/[\*\/]/,cg=Symbol("evalutor");class hg extends ng{constructor(e,t=Wh){if(super(),this[$m]=null,1!==e.arguments.length)return;const n=e.arguments[0].terms.slice(),i=[];for(;n.length;){const e=n.shift();if(i.length>0){const n=i[i.length-1];if("operator"===n.type&&lg.test(n.value)){const n=i.pop(),r=i.pop();if(null==r)return;i.push(new fg(n,ng.evaluatableFor(r,t),ng.evaluatableFor(e,t)));continue}}i.push("operator"===e.type?e:ng.evaluatableFor(e,t))}for(;i.length>2;){const[e,n,r]=i.splice(0,3);if("operator"!==n.type)return;i.unshift(new fg(n,ng.evaluatableFor(e,t),ng.evaluatableFor(r,t)))}1===i.length&&(this[cg]=i[0])}get isConstant(){return null==this[cg]||ng.isConstant(this[cg])}[($m=cg,eg)](){return null!=this[cg]?ng.evaluate(this[cg]):Wh}}const ug=Symbol("operator"),pg=Symbol("left"),dg=Symbol("right");class fg extends ng{constructor(e,t,n){super(),this[ug]=e,this[pg]=t,this[dg]=n}get isConstant(){return ng.isConstant(this[pg])&&ng.isConstant(this[dg])}[eg](){const e=Yh(ng.evaluate(this[pg])),t=Yh(ng.evaluate(this[dg])),{number:n,unit:i}=e,{number:r,unit:a}=t;if(null!=a&&null!=i&&a!=i)return Wh;const o=i||a;let s;switch(this[ug].value){case"+":s=n+r;break;case"-":s=n-r;break;case"/":s=n/r;break;case"*":s=n*r;break;default:return Wh}return{type:"number",number:s,unit:o}}}const mg=Symbol("evaluatables"),gg=Symbol("intrinsics");class vg extends ng{constructor(e,t){super(),this[gg]=t;const n=e[0],i=null!=n?n.terms:[];this[mg]=t.basis.map((e,t)=>{const n=i[t];return null==n?{type:"ident",value:"auto"}:"ident"===n.type?n:ng.evaluatableFor(n,e)})}get isConstant(){for(const e of this[mg])if(!ng.isConstant(e))return!1;return!0}[eg](){const e=this[mg].map(e=>ng.evaluate(e));return ng.applyIntrinsics(e,this[gg]).map(e=>e.number)}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var yg,xg,bg,wg;const _g=Symbol("instances"),Mg=Symbol("activateListener"),Sg=Symbol("deactivateListener"),Tg=Symbol("notifyInstances"),Eg=Symbol("notify"),Ag=Symbol("callback");class Lg{constructor(e){this[Ag]=e}static[Tg](){for(const e of Lg[_g])e[Eg]()}static[(yg=_g,Mg)](){window.addEventListener("scroll",this[Tg],{passive:!0})}static[Sg](){window.removeEventListener("scroll",this[Tg])}observe(){0===Lg[_g].size&&Lg[Mg](),Lg[_g].add(this)}disconnect(){Lg[_g].delete(this),0===Lg[_g].size&&Lg[Sg]()}[Eg](){this[Ag]()}}Lg[yg]=new Set;const Rg=Symbol("computeStyleCallback"),Pg=Symbol("astWalker"),Cg=Symbol("dependencies"),Og=Symbol("scrollHandler"),Ig=Symbol("onScroll");class Dg{constructor(e){this[xg]={},this[bg]=new jh(["function"]),this[wg]=()=>this[Ig](),this[Rg]=e}observeEffectsFor(e){const t={},n=this[Cg];this[Pg].walk(e,e=>{const{name:i}=e,r=e.arguments[0].terms[0];if("env"===i.value&&null!=r&&"ident"===r.type)switch(r.value){case"window-scroll-y":if(null==t["window-scroll"]){const e="window-scroll"in n?n["window-scroll"]:new Lg(this[Og]);e.observe(),delete n["window-scroll"],t["window-scroll"]=e}}});for(const e in n){n[e].disconnect()}this[Cg]=t}dispose(){for(const e in this[Cg]){this[Cg][e].disconnect()}}[(xg=Cg,bg=Pg,wg=Og,Ig)](){this[Rg]({relatedState:"window-scroll"})}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const Ng=e=>{const t=e.observeEffects||!1,n=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(i,r)=>{const a=i.updated,o=i.connectedCallback,s=i.disconnectedCallback,l=Symbol(r+"StyleEffector"),c=Symbol(r+"StyleEvaluator"),h=Symbol(r+"UpdateEvaluator"),u=Symbol(r+"EvaluateAndSync");Object.defineProperties(i,{[l]:{value:null,writable:!0},[c]:{value:null,writable:!0},[h]:{value:function(){const e=Uh(this[r]);this[c]=new vg(e,n(this)),null==this[l]&&t&&(this[l]=new Dg(()=>this[u]())),null!=this[l]&&this[l].observeEffectsFor(e)}},[u]:{value:function(){if(null==this[c])return;const t=this[c].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(r)&&(this[h](),this[u]()),a.call(this,e)}},connectedCallback:{value:function(){o.call(this),this.requestUpdate(r,this[r])}},disconnectedCallback:{value:function(){s.call(this),null!=this[l]&&(this[l].dispose(),this[l]=null)}}})}};
|
|
/* @license
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var zg,Ug,Fg,Bg,Hg,Gg,kg,Vg,jg,Wg,qg;const Xg=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,eventHandlingBehavior:"prevent-all",interactionPolicy:"always-allow"}),Yg=Symbol("spherical"),Jg=Symbol("goalSpherical"),Zg=Symbol("thetaDamper"),Kg=Symbol("phiDamper"),Qg=Symbol("radiusDamper"),$g=Symbol("fov"),ev=Symbol("goalLogFov"),tv=Symbol("fovDamper"),nv=Symbol("options"),iv=Symbol("touchMode"),rv=Symbol("canInteract"),av=Symbol("interactionEnabled"),ov=Symbol("userAdjustOrbit"),sv=Symbol("isUserChange"),lv=Symbol("isMoving"),cv=Symbol("moveCamera"),hv=Symbol("isUserPointing"),uv=Symbol("pointerIsDown"),pv=Symbol("lastPointerPosition"),dv=Symbol("lastTouches"),fv=Symbol("pixelLengthToSphericalAngle"),mv=Symbol("twoTouchDistance"),gv=Symbol("wrapAngle"),vv=Symbol("onMouseMove"),yv=Symbol("onMouseDown"),xv=Symbol("onMouseUp"),bv=Symbol("onTouchStart"),wv=Symbol("onTouchEnd"),_v=Symbol("onTouchMove"),Mv=Symbol("onWheel"),Sv=Symbol("onKeyDown"),Tv=Symbol("handlePointerMove"),Ev=Symbol("handleSinglePointerMove"),Av=Symbol("handlePointerDown"),Lv=Symbol("handleSinglePointerDown"),Rv=Symbol("handlePointerUp"),Pv=Symbol("handleWheel"),Cv=Symbol("handleKey"),Ov=/^touch(start|end|move)$/,Iv=Math.PI/8,Dv=33,Nv=34,zv=37,Uv=38,Fv=39,Bv=40,Hv="user-interaction",Gv="none";class kv extends y{constructor(e,t){super(),this.camera=e,this.element=t,this[zg]=!1,this[Ug]=!1,this[Fg]=!1,this[Bg]=new sc,this[Hg]=new sc,this[Gg]=new Ih,this[kg]=new Ih,this[Vg]=new Ih,this[jg]=new Ih,this[Wg]=!1,this[qg]={clientX:0,clientY:0},this[vv]=e=>this[Tv](e),this[yv]=e=>this[Av](e),this[xv]=e=>this[Rv](e),this[Mv]=e=>this[Pv](e),this[Sv]=e=>this[Cv](e),this[bv]=e=>this[Av](e),this[wv]=e=>this[Rv](e),this[_v]=e=>this[Tv](e),this[nv]=Object.assign({},Xg),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this[av]}enableInteraction(){if(!1===this[av]){const{element:e}=this;e.addEventListener("mousemove",this[vv]),e.addEventListener("mousedown",this[yv]),e.addEventListener("wheel",this[Mv]),e.addEventListener("keydown",this[Sv]),e.addEventListener("touchstart",this[bv]),e.addEventListener("touchmove",this[_v]),self.addEventListener("mouseup",this[xv]),self.addEventListener("touchend",this[wv]),this.element.style.cursor="grab",this[av]=!0}}disableInteraction(){if(!0===this[av]){const{element:e}=this;e.removeEventListener("mousemove",this[vv]),e.removeEventListener("mousedown",this[yv]),e.removeEventListener("wheel",this[Mv]),e.removeEventListener("keydown",this[Sv]),e.removeEventListener("touchstart",this[bv]),e.removeEventListener("touchmove",this[_v]),self.removeEventListener("mouseup",this[xv]),self.removeEventListener("touchend",this[wv]),e.style.cursor="",this[av]=!1}}get options(){return this[nv]}getCameraSpherical(e=new sc){return e.copy(this[Yg])}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this[nv],e),this.setOrbit(),this.setFieldOfView(Math.exp(this[ev]))}updateNearFar(e,t){this.camera.near=Math.max(e,t/1e3),this.camera.far=t,this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this[Jg].theta,t=this[Jg].phi,n=this[Jg].radius){const{minimumAzimuthalAngle:i,maximumAzimuthalAngle:r,minimumPolarAngle:a,maximumPolarAngle:o,minimumRadius:s,maximumRadius:l}=this[nv],{theta:c,phi:h,radius:u}=this[Jg],p=Du(e,i,r);isFinite(i)||isFinite(r)||(this[Yg].theta=this[gv](this[Yg].theta-p)+p);const d=Du(t,a,o),f=Du(n,s,l);return(p!==c||d!==h||f!==u)&&(this[Jg].theta=p,this[Jg].phi=d,this[Jg].radius=f,this[Jg].makeSafe(),this[sv]=!1,!0)}setRadius(e){this[Jg].radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:n}=this[nv];e=Du(e,t,n),this[ev]=Math.log(e)}adjustOrbit(e,t,n){const{theta:i,phi:r,radius:a}=this[Jg],{minimumRadius:o,maximumRadius:s,minimumFieldOfView:l,maximumFieldOfView:c}=this[nv],h=this[Yg].theta-i,u=Math.PI-.001,p=i-Du(e,-u-h,u-h),d=r-t,f=0===n?0:n>0?(s-a)/(Math.log(c)-this[ev]):(a-o)/(this[ev]-Math.log(l)),m=a+n*Math.min(isFinite(f)?f:1/0,s-o);let g=this.setOrbit(p,d,m);if(0!==n){const e=this[ev]+n;this.setFieldOfView(Math.exp(e)),g=!0}return g}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this[lv]())return;const{maximumPolarAngle:n,maximumRadius:i}=this[nv],r=this[Yg].theta-this[Jg].theta;Math.abs(r)>Math.PI&&!isFinite(this[nv].minimumAzimuthalAngle)&&!isFinite(this[nv].maximumAzimuthalAngle)&&(this[Yg].theta-=2*Math.sign(r)*Math.PI),this[Yg].theta=this[Zg].update(this[Yg].theta,this[Jg].theta,t,Math.PI),this[Yg].phi=this[Kg].update(this[Yg].phi,this[Jg].phi,t,n),this[Yg].radius=this[Qg].update(this[Yg].radius,this[Jg].radius,t,i),this[$g]=this[tv].update(this[$g],this[ev],t,1),this[cv]()}[(zg=av,Ug=sv,Fg=hv,Bg=Yg,Hg=Jg,Gg=Zg,kg=Kg,Vg=Qg,jg=tv,Wg=uv,qg=pv,lv)](){return this[Jg].theta===this[Yg].theta&&this[Jg].phi===this[Yg].phi&&this[Jg].radius===this[Yg].radius&&this[ev]===this[$g]}[cv](){this[Yg].makeSafe(),this.camera.position.setFromSpherical(this[Yg]),this.camera.setRotationFromEuler(new W(this[Yg].phi-Math.PI/2,this[Yg].theta,0,"YXZ")),this.camera.fov!==Math.exp(this[$g])&&(this.camera.fov=Math.exp(this[$g]),this.camera.updateProjectionMatrix());const e=this[sv]?Hv:Gv;this.dispatchEvent({type:"change",source:e})}get[rv](){if("allow-when-focused"==this[nv].interactionPolicy){return this.element.getRootNode().activeElement===this.element}return"always-allow"===this[nv].interactionPolicy}[ov](e,t,n){const i=this.adjustOrbit(e,t,n);return this[sv]=!0,this.dispatchEvent({type:"change",source:Hv}),i}[gv](e){const t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}[fv](e){return 2*Math.PI*e/this.element.clientHeight}[mv](e,t){const{clientX:n,clientY:i}=e,{clientX:r,clientY:a}=t,o=r-n,s=a-i;return Math.sqrt(o*o+s*s)}[Tv](e){if(!this[uv]||!this[rv])return;let t=!1;if(Ov.test(e.type)){const{touches:n}=e;switch(this[iv]){case"zoom":if(this[dv].length>1&&n.length>1){const e=.04*(this[mv](this[dv][0],this[dv][1])-this[mv](n[0],n[1]))/10;t=this[ov](0,0,e)}break;case"rotate":t=this[Ev](n[0])}this[dv]=n}else t=this[Ev](e);(t||"prevent-all"===this[nv].eventHandlingBehavior)&&e.cancelable&&e.preventDefault()}[Ev](e){const{clientX:t,clientY:n}=e,i=this[fv](t-this[pv].clientX),r=this[fv](n-this[pv].clientY);return this[pv].clientX=t,this[pv].clientY=n,!1===this[hv]&&(this[hv]=!0,this.dispatchEvent({type:"pointer-change-start",pointer:Object.assign({},e)})),this[ov](i,r,0)}[Av](e){if(this[uv]=!0,this[hv]=!1,Ov.test(e.type)){const{touches:t}=e;switch(t.length){default:case 1:this[iv]="rotate",this[Lv](t[0]);break;case 2:this[iv]="zoom"}this[dv]=t}else this[Lv](e)}[Lv](e){this[pv].clientX=e.clientX,this[pv].clientY=e.clientY,this.element.style.cursor="grabbing"}[Rv](e){this.element.style.cursor="grab",this[uv]=!1,this[hv]&&this.dispatchEvent({type:"pointer-change-end",pointer:Object.assign({},this[pv])})}[Pv](e){if(!this[rv])return;const t=.04*e.deltaY/30;(this[ov](0,0,t)||"prevent-all"===this[nv].eventHandlingBehavior)&&e.cancelable&&e.preventDefault()}[Cv](e){let t=!1,n=!1;switch(e.keyCode){case Dv:t=!0,n=this[ov](0,0,.04);break;case Nv:t=!0,n=this[ov](0,0,-.04);break;case Uv:t=!0,n=this[ov](0,-Iv,0);break;case Bv:t=!0,n=this[ov](0,Iv,0);break;case zv:t=!0,n=this[ov](-Iv,0,0);break;case Fv:t=!0,n=this[ov](Iv,0,0)}t&&(n||"prevent-all"===this[nv].eventHandlingBehavior)&&e.cancelable&&e.preventDefault()}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const Vv=e=>e<.5?2*e*e:(4-2*e)*e-1,jv=(e,t,n=Vv)=>i=>e+(t-e)*n(i),Wv=(e,t)=>{const n=[],i=[];let r=e;for(let e=0;e<t.length;++e){const a=t[e],{value:o,frames:s}=a,l=a.ease||Vv,c=jv(r,o,l);n.push(c),i.push(s),r=o}return((e,t)=>{const n=t.reduce((e,t)=>e+t,0),i=t.map(e=>e/n);return t=>{let n=0,r=1/0,a=()=>0;for(let o=0;o<i.length&&(r=i[o],a=e[o],!(t<=n+r));++o)n+=r;return a((t-n)/r)}})(n,i)};
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var qv=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const Xv=Wv(0,[{frames:6,value:0},{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:12,value:0}]),Yv=Wv(0,[{frames:2,value:0},{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:4,value:0}]),Jv=1.1*hu,Zv=["front","right","back","left"],Kv=["upper-","","lower-"],Qv="auto",$v="when-focused",ey="wiggle",ty="always-allow",ny=e=>({basis:[zh(e[Oy]*Math.PI/180,"rad")],keywords:{auto:[null]}}),iy={basis:[qh(zh(25,"deg"))],keywords:{auto:[null]}},ry=e=>{const t=e[lm];return{basis:[qh(zh(45,"deg"))],keywords:{auto:[zh(t.framedFieldOfView,"deg")]}}},ay=(()=>{const e=Uh("0deg 75deg 105%")[0].terms,t=Yh(e[0]),n=Yh(e[1]);return e=>{const i=e[lm].model.idealCameraDistance;return{basis:[t,n,zh(i,"m")],keywords:{auto:[null,null,zh(105,"%")]}}}})(),oy=e=>{const t=Jv*e[lm].model.idealCameraDistance;return{basis:[zh(-1/0,"rad"),zh(Math.PI/8,"rad"),zh(t,"m")],keywords:{auto:[null,null,null]}}},sy=e=>{const t=ay(e),n=new vg([],t).evaluate()[2];return{basis:[zh(1/0,"rad"),zh(Math.PI-Math.PI/8,"rad"),zh(n,"m")],keywords:{auto:[null,null,null]}}},ly=e=>{const t=e[lm].model.boundingBox.getCenter(new D);return{basis:[zh(t.x,"m"),zh(t.y,"m"),zh(t.z,"m")],keywords:{auto:[null,null,null]}}},cy=Math.PI/2,hy=Math.PI/3,uy=cy/2,py=2*Math.PI,dy=Symbol("controls"),fy=Symbol("promptElement"),my=Symbol("promptAnimatedContainer"),gy=Symbol("deferInteractionPrompt"),vy=Symbol("updateAria"),yy=Symbol("updateCameraForRadius"),xy=Symbol("blurHandler"),by=Symbol("focusHandler"),wy=Symbol("changeHandler"),_y=Symbol("pointerChangeHandler"),My=Symbol("onBlur"),Sy=Symbol("onFocus"),Ty=Symbol("onChange"),Ey=Symbol("onPointerChange"),Ay=Symbol("waitingToPromptUser"),Ly=Symbol("userHasInteracted"),Ry=Symbol("promptElementVisibleTime"),Py=Symbol("lastPromptOffset"),Cy=Symbol("focusedTime"),Oy=Symbol("zoomAdjustedFieldOfView"),Iy=Symbol("lastSpherical"),Dy=Symbol("jumpCamera"),Ny=Symbol("initialized"),zy=Symbol("maintainThetaPhi"),Uy=Symbol("syncCameraOrbit"),Fy=Symbol("syncFieldOfView"),By=Symbol("syncCameraTarget"),Hy=Symbol("syncMinCameraOrbit"),Gy=Symbol("syncMaxCameraOrbit"),ky=Symbol("syncMinFieldOfView"),Vy=Symbol("syncMaxFieldOfView");
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var jy=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const Wy=Symbol("currentEnvironmentMap"),qy=Symbol("applyEnvironmentMap"),Xy=Symbol("updateEnvironment"),Yy=Symbol("cancelEnvironmentUpdate"),Jy=Symbol("onPreload");
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var Zy,Ky;const Qy=Symbol("modelViewerStatusInstance"),$y=Symbol("updateStatus");Zy=Qy,Ky=$y;
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var ex=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const tx="auto",nx="manual",ix="auto",rx="eager",ax="interaction",ox=new class extends y{constructor(){super(),this[Zy]=null,this.registeredInstanceStatuses=new Map,this.loadingPromises=[],this.statusElement=document.createElement("p"),this.statusUpdateInProgress=!1,this[Ky]=Iu(()=>this.updateStatus(),100);const{statusElement:e}=this,{style:t}=e;e.setAttribute("role","status"),e.classList.add("screen-reader-only"),t.top=t.left="0",t.pointerEvents="none"}registerInstance(e){if(this.registeredInstanceStatuses.has(e))return;let t=()=>{};const n=!1===e.loaded&&!!e.src,i=new Promise(i=>{if(!n)return void i();const r=()=>{i(),e.removeEventListener("load",r),e.removeEventListener("error",r)};e.addEventListener("load",r),e.addEventListener("error",r),t=r});this.registeredInstanceStatuses.set(e,{onUnregistered:t}),this.loadingPromises.push(i),null==this.modelViewerStatusInstance&&(this.modelViewerStatusInstance=e)}unregisterInstance(e){if(!this.registeredInstanceStatuses.has(e))return;const t=this.registeredInstanceStatuses,n=t.get(e);t.delete(e),n.onUnregistered(),this.modelViewerStatusInstance===e&&(this.modelViewerStatusInstance=t.size>0?(e=>{if(null!=e.keys)return e.keys().next().value||null;let t=null;try{e.forEach((e,n,i)=>{throw t=n,new Error})}catch(e){}return t})(t):null)}get modelViewerStatusInstance(){return this[Qy]}set modelViewerStatusInstance(e){if(this[Qy]===e)return;const{statusElement:t}=this;null!=e&&null!=e.shadowRoot?e.shadowRoot.appendChild(t):null!=t.parentNode&&t.parentNode.removeChild(t),this[Qy]=e,this[$y]()}async updateStatus(){if(!this.statusUpdateInProgress&&0!==this.loadingPromises.length){for(this.statusElement.textContent="This page includes one or more 3D models that are loading",this.statusUpdateInProgress=!0,this.dispatchEvent({type:"initial-status-announced"});this.loadingPromises.length;){const{loadingPromises:e}=this;this.loadingPromises=[],await Promise.all(e)}this.statusElement.textContent="All 3D models in the page have loaded",this.statusUpdateInProgress=!1,this.dispatchEvent({type:"finished-loading-announced"})}}},sx=Symbol("defaultProgressBarElement"),lx=Symbol("defaultProgressMaskElement"),cx=Symbol("posterContainerElement"),hx=Symbol("defaultPosterElement"),ux=Symbol("posterDismissalSource"),px=Symbol("showPoster"),dx=Symbol("hidePoster"),fx=Symbol("modelIsRevealed"),mx=Symbol("updateProgressBar"),gx=Symbol("lastReportedProgress"),vx=Symbol("ariaLabelCallToAction"),yx=Symbol("clickHandler"),xx=Symbol("keydownHandler"),bx=Symbol("processHandler"),wx=Symbol("onClick"),_x=Symbol("onKeydown"),Mx=Symbol("onProgress"),Sx={Array:!0,ArrayBuffer:!0,BigInt:!0,BigInt64Array:!0,BigUint64Array:!0,Boolean:!0,Cache:!0,CustomEvent:!0,DataView:!0,Date:!0,Error:!0,EvalError:!0,Event:!0,EventTarget:!0,Float32Array:!0,Float64Array:!0,Function:!0,Infinity:!0,Int16Array:!0,Int32Array:!0,Int8Array:!0,Intl:!0,JSON:!0,Map:!0,Math:!0,MessagePort:!0,MessageEvent:!0,MessageChannel:!0,NaN:!0,Number:!0,Object:!0,Promise:!0,Proxy:!0,RangeError:!0,ReferenceError:!0,Reflect:!0,RegExp:!0,Set:!0,String:!0,Symbol:!0,SyntaxError:!0,TextDecoder:!0,TextEncoder:!0,TypeError:!0,URIError:!0,URL:!0,Uint16Array:!0,Uint32Array:!0,Uint8Array:!0,Uint8ClampedArray:!0,WeakMap:!0,WeakSet:!0,WebAssembly:!0,atob:!0,addEventListener:!0,removeEventListener:!0,btoa:!0,caches:!0,clearInterval:!0,clearTimeout:!0,console:!0,decodeURI:!0,decodeURIComponent:!0,document:!0,encodeURI:!0,encodeURIComponent:!0,escape:!0,fetch:!0,indexedDB:!0,isFinite:!0,isNaN:!0,location:!0,navigator:!0,onerror:!0,onrejectionhandled:!0,onunhandledrejection:!0,parseFloat:!0,parseInt:!0,performance:!0,postMessage:!0,requestAnimationFrame:!0,cancelAnimationFrame:!0,self:!0,setTimeout:!0,setInterval:!0,unescape:!0};
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
function Tx(e){const t=Symbol("kernel"),n=Symbol("uri"),i=Symbol("name");return class extends e{constructor(e,r){super(e),this[t]=e,this[n]=r.uri||null,this[i]=r.name}get name(){return this[i]}get type(){return null!=this.uri?"external":"embedded"}get uri(){return this[n]}async setURI(e){this[t].mutate(this,"uri",e)}}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/function Ex(e){var t,n,i;const r=Symbol("pbrMetallicRoughness"),a=Symbol("normalTexture"),o=Symbol("occlusionTexture"),s=Symbol("emissiveTexture"),l=Symbol("kernel"),c=Symbol("name");return t=a,n=o,i=s,class extends e{constructor(e,h){super(e,h),this[t]=null,this[n]=null,this[i]=null,this[l]=e,null!=h.name&&(this[c]=h.name);const{pbrMetallicRoughness:u,normalTexture:p,occlusionTexture:d,emissiveTexture:f}=h;this[r]=e.deserialize("pbr-metallic-roughness",u),null!=p&&(this[a]=e.deserialize("texture-info",p)),null!=d&&(this[o]=e.deserialize("texture-info",d)),null!=f&&(this[s]=e.deserialize("texture-info",f))}get pbrMetallicRoughness(){return this[r]}get normalTexture(){return this[a]}get occlusionTexture(){return this[o]}get emissiveTexture(){return this[s]}get name(){return this[c]}}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/function Ax(e,t,n,i,r,a,o,s,l){var c,h,u,p,d,f;const m={model:n,material:i,"pbr-metallic-roughness":r,"texture-info":l,sampler:a,image:o,texture:s},g=Symbol("onMessageEvent"),v=Symbol("messageEventHandler"),y=Symbol("port"),x=Symbol("model"),b=Symbol("elementsByLocalId"),w=Symbol("localIdsByElement"),_=Symbol("elementsByType"),M=Symbol("pendingMutations"),S=Symbol("nextMutationId");class T{constructor(e,t){this[c]=new Map,this[h]=new Map,this[u]=new Map,this[p]=e=>this[g](e),this[d]=new Map,this[f]=0;const n=Object.keys(m);for(const e of n)this[_].set(e,new Set);this[y]=e,this[y].addEventListener("message",this[v]),this[y].start(),this[x]=this.deserialize("model",t)}get model(){return this[x]}async mutate(n,i,r){if(!this[w].has(n))throw new Error("Cannot mutate unknown element");const a=this[w].get(n);return r instanceof t&&(r=this[w].get(r)),new Promise((t,n)=>{const o=this[S]++;this[y].postMessage({type:e.MUTATE,id:a,property:i,value:r,mutationId:o}),this[M].set(o,{resolve:t,reject:n})})}deserialize(e,t){if(!(e in m))throw new Error("Cannot deserialize unknown type: "+e);const{id:n}=t;if(this[b].has(n))return this[b].get(n);const i=new(0,m[e])(this,t);return this[b].set(n,i),this[w].set(i,n),this[_].get(e).add(i),i}getElementsByType(e){return this[_].has(e)?Array.from(this[_].get(e)):[]}deactivate(){this[y].close(),this[y].removeEventListener("message",this[v])}[(c=b,h=w,u=_,p=v,d=M,f=S,g)](t){const{data:n}=t;switch(n&&n.type){case e.MUTATION_RESULT:{const e=n,{applied:t,mutationId:i}=e,r=this[M].get(i);this[M].delete(i),null!=r&&(t?r.resolve():r.reject());break}}}}return T}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/function Lx(e){var t;const n=Symbol("material"),i=Symbol("kernel");return t=n,class extends e{constructor(e,n){super(e),this[t]=Object.freeze([]),this[i]=e;for(const e of n.materials)this[i].deserialize("material",e)}get materials(){return this[i].getElementsByType("material")}get ownerModel(){}}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/function Rx(e){var t,n;const i=Symbol("kernel"),r=Symbol("baseColorFactor"),a=Symbol("baseColorTexture"),o=Symbol("metallicRoughnessTexture"),s=Symbol("metallicFactor"),l=Symbol("roughnessFactor");return t=a,n=o,class extends e{constructor(e,c){super(e,c),this[t]=null,this[n]=null,this[i]=e,this[r]=Object.freeze(c.baseColorFactor),this[s]=Object.freeze(c.metallicFactor),this[l]=Object.freeze(c.roughnessFactor);const{baseColorTexture:h,metallicRoughnessTexture:u}=c;null!=h&&(this[a]=e.deserialize("texture-info",h)),null!=u&&(this[o]=e.deserialize("texture-info",u))}get baseColorFactor(){return this[r]}get metallicFactor(){return this[s]}get roughnessFactor(){return this[l]}get baseColorTexture(){return this[a]}get metallicRoughnessTexture(){return this[o]}async setBaseColorFactor(e){await this[i].mutate(this,"baseColorFactor",e),this[r]=Object.freeze(e)}async setMetallicFactor(e){await this[i].mutate(this,"metallicFactor",e),this[s]=Object.freeze(e)}async setRoughnessFactor(e){await this[i].mutate(this,"roughnessFactor",e),this[l]=Object.freeze(e)}}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/function Px(e){var t,n;const i=Symbol("kernel"),r=Symbol("minFilter"),a=Symbol("magFilter"),o=Symbol("wrapS"),s=Symbol("wrapT"),l=Symbol("name");return t=r,n=a,class extends e{constructor(e,c){super(e),this[t]=null,this[n]=null,this[i]=e,this[l]=c.name,this[r]=c.minFilter||null,this[a]=c.magFilter||null,this[o]=c.wrapS||10497,this[s]=c.wrapT||10497}get name(){return this[l]}get minFilter(){return this[r]}get magFilter(){return this[a]}get wrapS(){return this[o]}get wrapT(){return this[s]}async setMinFilter(e){await this[i].mutate(this,"minFilter",e),this[r]=e}async setMagFilter(e){await this[i].mutate(this,"magFilter",e),this[a]=e}async setWrapS(e){await this[i].mutate(this,"wrapS",e),this[o]=e}async setWrapT(e){await this[i].mutate(this,"wrapT",e),this[s]=e}}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/function Cx(e){var t;const n=Symbol("kernel"),i=Symbol("texture");return t=i,class extends e{constructor(e,r){super(e),this[t]=null,this[n]=e;const{texture:a}=r;null!=a&&(this[i]=e.deserialize("texture",a))}get texture(){return this[i]}async setTexture(e){await this[n].mutate(this,"texture",e),this[i]=e}}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/function Ox(e){var t,n;const i=Symbol("kernel"),r=Symbol("source"),a=Symbol("sampler"),o=Symbol("name");return t=r,n=a,class extends e{constructor(e,s){super(e),this[t]=null,this[n]=null,this[i]=e;const{sampler:l,source:c,name:h}=s;this[o]=h,null!=l&&(this[a]=e.deserialize("sampler",l)),null!=c&&(this[r]=e.deserialize("image",c))}get name(){return this[o]}get sampler(){return this[a]}get source(){return this[r]}async setSampler(e){await this[i].mutate(this,"sampler",e),this[a]=e}async setSource(e){await this[i].mutate(this,"source",e),this[r]=e}}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/function Ix(){const e=Symbol("ownerModel");return class{constructor(t){if(null==t)throw new Error("Illegal constructor");this[e]=t.model}get ownerModel(){return this[e]}}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const Dx={HANDSHAKE:1,IMPORT_SCRIPT:2,MODEL_CHANGE:3,MUTATION_RESULT:4,CONTEXT_INITIALIZED:5,MUTATE:6};
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const Nx={textures:
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
function(){const e={value:()=>{throw new Error('Capability "textures" not allowed')},configurable:!1,writable:!1};Object.defineProperties(this.Texture.prototype,{setSampler:e,setSource:e}),Object.defineProperties(this.Image.prototype,{setURI:e}),Object.defineProperties(this.Sampler.prototype,{setMinFilter:e,setMagFilter:e,setWrapS:e,setWrapT:e})},messaging:function(){const e=()=>{throw new Error('Capability "messaging" not allowed')},t=this.addEventListener;Object.defineProperties(this,{postMessage:{value:e,configurable:!1},MessageChannel:{value:e,configurable:!1},MessageEvent:{value:e,configurable:!1},onmessage:{set(){e()},configurable:!1},addEventListener:{value:function(n,i,r){"message"===n&&e(),t.call(this,n,i,r)},configurable:!1}})},"material-properties":function(){const e='Capability "material-properties" not allowed';Object.defineProperty(this.PBRMetallicRoughness.prototype,"setBaseColorFactor",{value:()=>{throw new Error(e)},configurable:!1,writable:!1}),Object.defineProperty(this.PBRMetallicRoughness.prototype,"setMetallicFactor",{value:()=>{throw new Error(e)},configurable:!1,writable:!1}),Object.defineProperty(this.PBRMetallicRoughness.prototype,"setRoughnessFactor",{value:()=>{throw new Error(e)},configurable:!1,writable:!1})},fetch:function(){Object.defineProperties(this,{fetch:{value:()=>{throw new Error('Capability "fetch" not allowed')},configurable:!1}})}};
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
function zx(e,t){for(;e&&e.constructor!==EventTarget;)Object.getOwnPropertyNames(e).forEach(n=>{if(!t.hasOwnProperty(n)||!0!==t[n])try{delete e[n]}catch(e){console.warn(e)}}),e=Object.getPrototypeOf(e)}const Ux=e=>`(${zx.toString()})(self, ${JSON.stringify(e)});`
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/;function Fx(e,t,n){let i=null;n.addEventListener("message",r=>{const{data:a}=r;if(a&&a.type&&a.type===e.HANDSHAKE){const a=r.ports[0];a.addEventListener("message",r=>{const{data:a}=r;if(a&&a.type)switch(a.type){case e.MODEL_CHANGE:{const e=null!=i?i.model:void 0,n=a.model,o=r.ports[0];if(null!=i)i.deactivate();else if(null==n)break;null!=n?(i=new t(o,n),this.model=i.model):(i=null,this.model=void 0);const s=new Event("model-change");s.previousModel=e,s.model=this.model,this.dispatchEvent(s);break}case e.IMPORT_SCRIPT:{const e=a.url;e&&n.importScripts(e);break}}}),a.start(),a.postMessage({type:e.CONTEXT_INITIALIZED})}})}const Bx=()=>Fx.toString()
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/;var Hx,Gx;const kx=Symbol("modelGraft"),Vx=Symbol("port"),jx=Symbol("messageEventHandler"),Wx=Symbol("onMessageEvent");class qx{constructor(e,t){this[Hx]=e=>this[Wx](e),this[kx]=e,this[Vx]=t,this[Vx].addEventListener("message",this[jx]),this[Vx].start()}dispose(){this[Vx].removeEventListener("message",this[jx]),this[Vx].close()}[(Hx=jx,Wx)](e){const{data:t}=e;if(t&&t.type&&t.type===Dx.MUTATE){let e=!1;const{mutationId:n}=t;try{this[kx].mutate(t.id,t.property,t.value),e=!0}finally{this[Vx].postMessage({type:Dx.MUTATION_RESULT,applied:e,mutationId:n})}}}}const Xx=Object.freeze(["messaging","material-properties","fetch"]),Yx=(e=Xx)=>`;(function() {\nvar preservedContext = {\n postMessage: self.postMessage.bind(self),\n addEventListener: self.addEventListener.bind(self),\n importScripts: self.importScripts.bind(self)\n};\n\n${Ux(Sx)}\n\nvar ThreeDOMMessageType = ${JSON.stringify(Dx)};\n\n${Ax.toString()}\n${Ix.toString()}\n${Lx.toString()}\n${Ex.toString()}\n${Rx.toString()}\n${Px.toString()}\n${Tx.toString()}\n${Ox.toString()}\n${Cx.toString()}\n\nvar ThreeDOMElement = ${Ix.name}();\nvar Model = ${Lx.name}(ThreeDOMElement);\nvar Material = ${Ex.name}(ThreeDOMElement);\nvar PBRMetallicRoughness = ${Rx.name}(ThreeDOMElement);\nvar Sampler = ${Px.name}(ThreeDOMElement);\nvar Image = ${Tx.name}(ThreeDOMElement);\nvar Texture = ${Ox.name}(ThreeDOMElement);\nvar TextureInfo = ${Cx.name}(ThreeDOMElement);\n\nvar ModelKernel = ${Ax.name}(\n ThreeDOMMessageType,\n ThreeDOMElement,\n Model,\n Material,\n PBRMetallicRoughness,\n Sampler,\n Image,\n Texture,\n TextureInfo\n);\n\n// Populate the global scope with constructors\n// so that author code can use instanceof checks\nself.ThreeDOMElement = ThreeDOMElement;\nself.Model = Model;\nself.Material = Material;\nself.PBRMetallicRoughness = PBRMetallicRoughness;\nself.Sampler = Sampler;\nself.Image = Image;\nself.Texture = Texture;\nself.TextureInfo = TextureInfo;\n\n${(e=>{const t=Object.keys(Nx),n=[];for(const i of t){if(e.indexOf(i)>-1)continue;const t=Nx[i];n.push(`(${t.toString()}).call(self);`)}return n.join("\n")})(e)}\n(${Bx()}).call(self, ThreeDOMMessageType, ModelKernel, preservedContext);\n\n})();`,Jx=Symbol("worker"),Zx=Symbol("workerInitializes"),Kx=Symbol("modelGraftManipulator");class Qx extends EventTarget{constructor(e){super(),this[Gx]=null;const t=Yx(e),n=URL.createObjectURL(new Blob([t],{type:"text/javascript"}));this[Jx]=new Worker(n),this[Zx]=new Promise(e=>{const{port1:t,port2:n}=new MessageChannel,i=n=>{n.data&&n.data.type===Dx.CONTEXT_INITIALIZED&&(t.removeEventListener("message",i),e(t))};this[Jx].postMessage({type:Dx.HANDSHAKE},[n]),t.addEventListener("message",i),t.start()})}get worker(){return this[Jx]}async changeModel(e){const t=await this[Zx],{port1:n,port2:i}=new MessageChannel;t.postMessage({type:Dx.MODEL_CHANGE,model:null!=e&&null!=e.model?e.model.toJSON():null},[i]);const r=this[Kx];null!=r&&(r.dispose(),this[Kx]=null),null!=e&&(this[Kx]=new qx(e,n))}async eval(e){await this.import(URL.createObjectURL(new Blob([e],{type:"text/javascript"})))}async import(e){(await this[Zx]).postMessage({type:Dx.IMPORT_SCRIPT,url:e})}async terminate(){this[Jx].terminate();const e=this[Kx];null!=e&&(e.dispose(),this[Kx]=null);(await this[Zx]).close()}}Gx=Kx;
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const $x=(()=>{let e=0;return()=>e++})(),eb=Symbol("callbacks"),tb=Symbol("visitMesh"),nb=Symbol("visitElement"),ib=Symbol("visitNode"),rb=Symbol("visitScene"),ab=Symbol("visitMaterial");class ob{constructor(e){this[eb]=e}visit(e,t={}){const n=!!t.allScenes,i=!!t.sparse,r=n?e.scenes||[]:e.scenes&&null!=e.scene?[e.scenes[e.scene]]:[],a={hierarchy:[],visited:new Set,sparse:i,gltf:e};for(const t of r)this[rb](e.scenes.indexOf(t),a)}[nb](e,t,n,i,r){if(null==t)return;const a=t[e],{sparse:o,hierarchy:s,visited:l}=n;null!=a&&(o&&l.has(a)||(l.add(a),s.push(a),null!=i&&i(a,e,s),null!=r&&r(a),s.pop()))}[rb](e,t){const{gltf:n}=t,{scene:i}=this[eb];this[nb](e,n.scenes,t,i,e=>{if(null!=e.nodes)for(const n of e.nodes)this[ib](n,t)})}[ib](e,t){const{gltf:n}=t,{node:i}=this[eb];this[nb](e,n.nodes,t,i,e=>{if(null!=e.mesh&&this[tb](e.mesh,t),null!=e.children)for(const n of e.children)this[ib](n,t)})}[tb](e,t){const{gltf:n}=t,{mesh:i}=this[eb];this[nb](e,n.meshes,t,i,e=>{for(const n of e.primitives)null!=n.material&&this[ab](n.material,t)})}[ab](e,t){const{gltf:n}=t,{material:i}=this[eb];this[nb](e,n.materials,t,i)}}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");const t=Object(e);for(let e=1;e<arguments.length;e++){const n=arguments[e];if(null!=n)for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t});function sb(){}Object.assign(sb.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var i=n.indexOf(t);-1!==i&&n.splice(i,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),i=0,r=n.length;i<r;i++)n[i].call(this,e)}}}});for(var lb=[],cb=0;cb<256;cb++)lb[cb]=(cb<16?"0":"")+cb.toString(16);var hb,ub={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(lb[255&e]+lb[e>>8&255]+lb[e>>16&255]+lb[e>>24&255]+"-"+lb[255&t]+lb[t>>8&255]+"-"+lb[t>>16&15|64]+lb[t>>24&255]+"-"+lb[63&n|128]+lb[n>>8&255]+"-"+lb[n>>16&255]+lb[n>>24&255]+lb[255&i]+lb[i>>8&255]+lb[i>>16&255]+lb[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*ub.DEG2RAD},radToDeg:function(e){return e*ub.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),c=a((t+i)/2),h=o((t+i)/2),u=a((t-i)/2),p=o((t-i)/2),d=a((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(s*h,l*u,l*p,s*c);break;case"YZY":e.set(l*p,s*h,l*u,s*c);break;case"ZXZ":e.set(l*u,l*p,s*h,s*c);break;case"XZX":e.set(s*h,l*f,l*d,s*c);break;case"YXY":e.set(l*d,s*h,l*f,s*c);break;case"ZYZ":e.set(l*f,l*d,s*h,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};function pb(e,t){this.x=e||0,this.y=t||0}function db(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.defineProperties(pb.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(pb.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}}),Object.assign(db.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,a,o,s,l){var c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],c=n[4],h=n[7],u=n[2],p=n[5],d=n[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],x=i[7],b=i[2],w=i[5],_=i[8];return r[0]=a*f+o*v+s*b,r[3]=a*m+o*y+s*w,r[6]=a*g+o*x+s*_,r[1]=l*f+c*v+h*b,r[4]=l*m+c*y+h*w,r[7]=l*g+c*x+h*_,r[2]=u*f+p*v+d*b,r[5]=u*m+p*y+d*w,r[8]=u*g+p*x+d*_,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8];return t*a*c-t*o*l-n*r*c+n*o*s+i*r*l-i*a*s},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var n=e.elements,i=this.elements,r=n[0],a=n[1],o=n[2],s=n[3],l=n[4],c=n[5],h=n[6],u=n[7],p=n[8],d=p*l-c*u,f=c*h-p*s,m=u*s-l*h,g=r*d+a*f+o*m;if(0===g)return this.set(0,0,0,0,0,0,0,0,0);var v=1/g;return i[0]=d*v,i[1]=(o*u-p*a)*v,i[2]=(c*a-o*l)*v,i[3]=f*v,i[4]=(p*r-o*h)*v,i[5]=(o*s-c*r)*v,i[6]=m*v,i[7]=(a*h-u*r)*v,i[8]=(l*r-a*s)*v,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,i,r,a,o){var s=Math.cos(r),l=Math.sin(r);this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-i*l,i*s,-i*(-l*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],a=i[3],o=i[6],s=i[1],l=i[4],c=i[7];return i[0]=t*r+n*s,i[3]=t*a+n*l,i[6]=t*o+n*c,i[1]=-n*r+t*s,i[4]=-n*a+t*l,i[7]=-n*o+t*c,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}});var fb={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===hb&&(hb=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),hb.width=e.width,hb.height=e.height;var n=hb.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=hb}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},mb=0;function gb(e,t,n,i,r,a,o,s,l,c){Object.defineProperty(this,"id",{value:mb++}),this.uuid=ub.generateUUID(),this.name="",this.image=void 0!==e?e:gb.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:gb.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:1001,this.wrapT=void 0!==i?i:1001,this.magFilter=void 0!==r?r:1006,this.minFilter=void 0!==a?a:1008,this.anisotropy=void 0!==l?l:1,this.format=void 0!==o?o:1023,this.internalFormat=null,this.type=void 0!==s?s:1009,this.offset=new pb(0,0),this.repeat=new pb(1,1),this.center=new pb(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new db,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==c?c:3e3,this.version=0,this.onUpdate=null}function vb(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function yb(e,t,n){this.width=e,this.height=t,this.scissor=new vb(0,0,e,t),this.scissorTest=!1,this.viewport=new vb(0,0,e,t),n=n||{},this.texture=new gb(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:1006,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function xb(e,t,n){yb.call(this,e,t,n),this.samples=4}function bb(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}gb.DEFAULT_IMAGE=void 0,gb.DEFAULT_MAPPING=300,gb.prototype=Object.assign(Object.create(sb.prototype),{constructor:gb,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var i=this.image;if(void 0===i.uuid&&(i.uuid=ub.generateUUID()),!t&&void 0===e.images[i.uuid]){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a<o;a++)r.push(fb.getDataURL(i[a]))}else r=fb.getDataURL(i);e.images[i.uuid]={uuid:i.uuid,url:r}}n.image=i.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(gb.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(vb.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(vb.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,a=e.elements,o=a[0],s=a[4],l=a[8],c=a[1],h=a[5],u=a[9],p=a[2],d=a[6],f=a[10];if(Math.abs(s-c)<.01&&Math.abs(l-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(s+c)<.1&&Math.abs(l+p)<.1&&Math.abs(u+d)<.1&&Math.abs(o+h+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,g=(h+1)/2,v=(f+1)/2,y=(s+c)/4,x=(l+p)/4,b=(u+d)/4;return m>g&&m>v?m<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(m)),r=x/n):g>v?g<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(g)),r=b/i):v<.01?(n=.707106781,i=.707106781,r=0):(n=x/(r=Math.sqrt(v)),i=b/r),this.set(n,i,r,t),this}var w=Math.sqrt((d-u)*(d-u)+(l-p)*(l-p)+(c-s)*(c-s));return Math.abs(w)<.001&&(w=1),this.x=(d-u)/w,this.y=(l-p)/w,this.z=(c-s)/w,this.w=Math.acos((o+h+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}),yb.prototype=Object.assign(Object.create(sb.prototype),{constructor:yb,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),xb.prototype=Object.assign(Object.create(yb.prototype),{constructor:xb,isWebGLMultisampleRenderTarget:!0,copy:function(e){return yb.prototype.copy.call(this,e),this.samples=e.samples,this}}),Object.assign(bb,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,a,o){var s=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3],u=r[a+0],p=r[a+1],d=r[a+2],f=r[a+3];if(h!==f||s!==u||l!==p||c!==d){var m=1-o,g=s*u+l*p+c*d+h*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,g*v);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var w=o*v;if(s=s*m+u*w,l=l*m+p*w,c=c*m+d*w,h=h*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+l*l+c*c+h*h);s*=_,l*=_,c*=_,h*=_}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=h},multiplyQuaternionsFlat:function(e,t,n,i,r,a){var o=n[i],s=n[i+1],l=n[i+2],c=n[i+3],h=r[a],u=r[a+1],p=r[a+2],d=r[a+3];return e[t]=o*d+c*h+s*p-l*u,e[t+1]=s*d+c*u+l*h-o*p,e[t+2]=l*d+c*p+o*u-s*h,e[t+3]=c*d-o*h-s*u-l*p,e}}),Object.defineProperties(bb.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(bb.prototype,{isQuaternion:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,i=e._y,r=e._z,a=e.order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),u=s(n/2),p=s(i/2),d=s(r/2);switch(a){case"XYZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"YXZ":this._x=u*c*h+l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"ZXY":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h-u*p*d;break;case"ZYX":this._x=u*c*h-l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h+u*p*d;break;case"YZX":this._x=u*c*h+l*p*d,this._y=l*p*h+u*c*d,this._z=l*c*d-u*p*h,this._w=l*c*h-u*p*d;break;case"XZY":this._x=u*c*h-l*p*d,this._y=l*p*h-u*c*d,this._z=l*c*d+u*p*h,this._w=l*c*h+u*p*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],r=n[4],a=n[8],o=n[1],s=n[5],l=n[9],c=n[2],h=n[6],u=n[10],p=i+s+u;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(h-l)*t,this._y=(a-c)*t,this._z=(o-r)*t):i>s&&i>u?(t=2*Math.sqrt(1+i-s-u),this._w=(h-l)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(a+c)/t):s>u?(t=2*Math.sqrt(1+s-i-u),this._w=(a-c)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(l+h)/t):(t=2*Math.sqrt(1+u-i-s),this._w=(o-r)/t,this._x=(a+c)/t,this._y=(l+h)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(ub.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+i*l-r*s,this._y=i*c+a*s+r*o-n*l,this._z=r*c+a*l+n*s-i*o,this._w=a*c-n*o-i*s-r*l,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*i+t*this._y,this._z=l*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var c=Math.sqrt(s),h=Math.atan2(c,o),u=Math.sin((1-t)*h)/c,p=Math.sin(t*h)/c;return this._w=a*u+this._w*p,this._x=n*u+this._x*p,this._y=i*u+this._y*p,this._z=r*u+this._z*p,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var wb=new Mb,_b=new bb;function Mb(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}Object.assign(Mb.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(_b.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(_b.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*i-o*n,c=s*n+o*t-r*i,h=s*i+r*n-a*t,u=-r*t-a*n-o*i;return this.x=l*s+u*-r+c*-o-h*-a,this.y=c*s+u*-a+h*-r-l*-o,this.z=h*s+u*-o+l*-a-c*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},projectOnVector:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return wb.copy(this).projectOnVector(e),this.sub(wb)},reflect:function(e){return this.sub(wb.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(ub.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}});var Sb=new Mb,Tb=new Cb,Eb=new Mb(0,0,0),Ab=new Mb(1,1,1),Lb=new Mb,Rb=new Mb,Pb=new Mb;function Cb(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.assign(Cb.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,a,o,s,l,c,h,u,p,d,f,m){var g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=o,g[13]=s,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=p,g[7]=d,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Cb).fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,i=1/Sb.setFromMatrixColumn(e,0).length(),r=1/Sb.setFromMatrixColumn(e,1).length(),a=1/Sb.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){var u=a*c,p=a*h,d=o*c,f=o*h;t[0]=s*c,t[4]=-s*h,t[8]=l,t[1]=p+d*l,t[5]=u-f*l,t[9]=-o*s,t[2]=f-u*l,t[6]=d+p*l,t[10]=a*s}else if("YXZ"===e.order){var m=s*c,g=s*h,v=l*c,y=l*h;t[0]=m+y*o,t[4]=v*o-g,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-o,t[2]=g*o-v,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*c,g=s*h,v=l*c,y=l*h;t[0]=m-y*o,t[4]=-a*h,t[8]=v+g*o,t[1]=g+v*o,t[5]=a*c,t[9]=y-m*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){u=a*c,p=a*h,d=o*c,f=o*h;t[0]=s*c,t[4]=d*l-p,t[8]=u*l+f,t[1]=s*h,t[5]=f*l+u,t[9]=p*l-d,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,b=a*l,w=o*s,_=o*l;t[0]=s*c,t[4]=_-x*h,t[8]=w*h+b,t[1]=h,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=b*h+w,t[10]=x-_*h}else if("XZY"===e.order){x=a*s,b=a*l,w=o*s,_=o*l;t[0]=s*c,t[4]=-h,t[8]=l*c,t[1]=x*h+_,t[5]=a*c,t[9]=b*h-w,t[2]=w*h-b,t[6]=o*c,t[10]=_*h+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(Eb,e,Ab)},lookAt:function(e,t,n){var i=this.elements;return Pb.subVectors(e,t),0===Pb.lengthSq()&&(Pb.z=1),Pb.normalize(),Lb.crossVectors(n,Pb),0===Lb.lengthSq()&&(1===Math.abs(n.z)?Pb.x+=1e-4:Pb.z+=1e-4,Pb.normalize(),Lb.crossVectors(n,Pb)),Lb.normalize(),Rb.crossVectors(Pb,Lb),i[0]=Lb.x,i[4]=Rb.x,i[8]=Pb.x,i[1]=Lb.y,i[5]=Rb.y,i[9]=Pb.y,i[2]=Lb.z,i[6]=Rb.z,i[10]=Pb.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],h=n[5],u=n[9],p=n[13],d=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],x=n[11],b=n[15],w=i[0],_=i[4],M=i[8],S=i[12],T=i[1],E=i[5],A=i[9],L=i[13],R=i[2],P=i[6],C=i[10],O=i[14],I=i[3],D=i[7],N=i[11],z=i[15];return r[0]=a*w+o*T+s*R+l*I,r[4]=a*_+o*E+s*P+l*D,r[8]=a*M+o*A+s*C+l*N,r[12]=a*S+o*L+s*O+l*z,r[1]=c*w+h*T+u*R+p*I,r[5]=c*_+h*E+u*P+p*D,r[9]=c*M+h*A+u*C+p*N,r[13]=c*S+h*L+u*O+p*z,r[2]=d*w+f*T+m*R+g*I,r[6]=d*_+f*E+m*P+g*D,r[10]=d*M+f*A+m*C+g*N,r[14]=d*S+f*L+m*O+g*z,r[3]=v*w+y*T+x*R+b*I,r[7]=v*_+y*E+x*P+b*D,r[11]=v*M+y*A+x*C+b*N,r[15]=v*S+y*L+x*O+b*z,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],l=e[13],c=e[2],h=e[6],u=e[10],p=e[14];return e[3]*(+r*s*h-i*l*h-r*o*u+n*l*u+i*o*p-n*s*p)+e[7]*(+t*s*p-t*l*u+r*a*u-i*a*p+i*l*c-r*s*c)+e[11]*(+t*l*h-t*o*p-r*a*h+n*a*p+r*o*c-n*l*c)+e[15]*(-i*o*c-t*s*h+t*o*u+i*a*h-n*a*u+n*s*c)},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},setPosition:function(e,t,n){var i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this},getInverse:function(e,t){void 0!==t&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var n=this.elements,i=e.elements,r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],c=i[5],h=i[6],u=i[7],p=i[8],d=i[9],f=i[10],m=i[11],g=i[12],v=i[13],y=i[14],x=i[15],b=d*y*u-v*f*u+v*h*m-c*y*m-d*h*x+c*f*x,w=g*f*u-p*y*u-g*h*m+l*y*m+p*h*x-l*f*x,_=p*v*u-g*d*u+g*c*m-l*v*m-p*c*x+l*d*x,M=g*d*h-p*v*h-g*c*f+l*v*f+p*c*y-l*d*y,S=r*b+a*w+o*_+s*M;if(0===S)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var T=1/S;return n[0]=b*T,n[1]=(v*f*s-d*y*s-v*o*m+a*y*m+d*o*x-a*f*x)*T,n[2]=(c*y*s-v*h*s+v*o*u-a*y*u-c*o*x+a*h*x)*T,n[3]=(d*h*s-c*f*s-d*o*u+a*f*u+c*o*m-a*h*m)*T,n[4]=w*T,n[5]=(p*y*s-g*f*s+g*o*m-r*y*m-p*o*x+r*f*x)*T,n[6]=(g*h*s-l*y*s-g*o*u+r*y*u+l*o*x-r*h*x)*T,n[7]=(l*f*s-p*h*s+p*o*u-r*f*u-l*o*m+r*h*m)*T,n[8]=_*T,n[9]=(g*d*s-p*v*s-g*a*m+r*v*m+p*a*x-r*d*x)*T,n[10]=(l*v*s-g*c*s+g*a*u-r*v*u-l*a*x+r*c*x)*T,n[11]=(p*c*s-l*d*s-p*a*u+r*d*u+l*a*m-r*c*m)*T,n[12]=M*T,n[13]=(p*v*o-g*d*o+g*a*f-r*v*f-p*a*y+r*d*y)*T,n[14]=(g*c*o-l*v*o-g*a*h+r*v*h+l*a*y-r*c*y)*T,n[15]=(l*d*o-p*c*o+p*a*h-r*d*h-l*a*f+r*c*f)*T,this},scale:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,l=r*a,c=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,c*o+n,c*s-i*a,0,l*s-i*o,c*s+i*a,r*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,l=r+r,c=a+a,h=o+o,u=r*l,p=r*c,d=r*h,f=a*c,m=a*h,g=o*h,v=s*l,y=s*c,x=s*h,b=n.x,w=n.y,_=n.z;return i[0]=(1-(f+g))*b,i[1]=(p+x)*b,i[2]=(d-y)*b,i[3]=0,i[4]=(p-x)*w,i[5]=(1-(u+g))*w,i[6]=(m+v)*w,i[7]=0,i[8]=(d+y)*_,i[9]=(m-v)*_,i[10]=(1-(u+f))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},decompose:function(e,t,n){var i=this.elements,r=Sb.set(i[0],i[1],i[2]).length(),a=Sb.set(i[4],i[5],i[6]).length(),o=Sb.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Tb.copy(this);var s=1/r,l=1/a,c=1/o;return Tb.elements[0]*=s,Tb.elements[1]*=s,Tb.elements[2]*=s,Tb.elements[4]*=l,Tb.elements[5]*=l,Tb.elements[6]*=l,Tb.elements[8]*=c,Tb.elements[9]*=c,Tb.elements[10]*=c,t.setFromRotationMatrix(Tb),n.x=r,n.y=a,n.z=o,this},makePerspective:function(e,t,n,i,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(t-e),l=2*r/(n-i),c=(t+e)/(t-e),h=(n+i)/(n-i),u=-(a+r)/(a-r),p=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,i,r,a){var o=this.elements,s=1/(t-e),l=1/(n-i),c=1/(a-r),h=(t+e)*s,u=(n+i)*l,p=(a+r)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}});var Ob=new Cb,Ib=new bb;function Db(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._order=i||Db.DefaultOrder}function Nb(){this.mask=1}Db.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Db.DefaultOrder="XYZ",Object.defineProperties(Db.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}}),Object.assign(Db.prototype,{isEuler:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var i=ub.clamp,r=e.elements,a=r[0],o=r[4],s=r[8],l=r[1],c=r[5],h=r[9],u=r[2],p=r[6],d=r[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,a),this._z=0);break;case"ZXY":this._x=Math.asin(i(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(p,d),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,a)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!1!==n&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return Ob.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ob,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return Ib.setFromEuler(this),this.setFromQuaternion(Ib,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new Mb(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}}),Object.assign(Nb.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return 0!=(this.mask&e.mask)}});let zb=0;const Ub=new Mb,Fb=new bb,Bb=new Cb,Hb=new Mb,Gb=new Mb,kb=new Mb,Vb=new bb,jb=new Mb(1,0,0),Wb=new Mb(0,1,0),qb=new Mb(0,0,1),Xb={type:"added"},Yb={type:"removed"};function Jb(){Object.defineProperty(this,"id",{value:zb++}),this.uuid=ub.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Jb.DefaultUp.clone();var e=new Mb,t=new Db,n=new bb,i=new Mb(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Cb},normalMatrix:{value:new db}}),this.matrix=new Cb,this.matrixWorld=new Cb,this.matrixAutoUpdate=Jb.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Nb,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}function Zb(){Jb.call(this),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Jb.DefaultUp=new Mb(0,1,0),Jb.DefaultMatrixAutoUpdate=!0,Jb.prototype=Object.assign(Object.create(sb.prototype),{constructor:Jb,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return Fb.setFromAxisAngle(e,t),this.quaternion.multiply(Fb),this},rotateOnWorldAxis:function(e,t){return Fb.setFromAxisAngle(e,t),this.quaternion.premultiply(Fb),this},rotateX:function(e){return this.rotateOnAxis(jb,e)},rotateY:function(e){return this.rotateOnAxis(Wb,e)},rotateZ:function(e){return this.rotateOnAxis(qb,e)},translateOnAxis:function(e,t){return Ub.copy(e).applyQuaternion(this.quaternion),this.position.add(Ub.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(jb,e)},translateY:function(e){return this.translateOnAxis(Wb,e)},translateZ:function(e){return this.translateOnAxis(qb,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(Bb.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?Hb.copy(e):Hb.set(e,t,n);var i=this.parent;this.updateWorldMatrix(!0,!1),Gb.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Bb.lookAt(Gb,Hb,this.up):Bb.lookAt(Hb,Gb,this.up),this.quaternion.setFromRotationMatrix(Bb),i&&(Bb.extractRotation(i.matrixWorld),Fb.setFromRotationMatrix(Bb),this.quaternion.premultiply(Fb.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Xb)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(Yb)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),Bb.getInverse(this.matrixWorld),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Bb.multiply(e.parent.matrixWorld)),e.applyMatrix4(Bb),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new Mb),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new bb),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Gb,e,kb),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new Mb),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Gb,Vb,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new Mb),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var i=this.children,r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var c=o[s];r(e.shapes,c)}else r(e.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var h=[];for(s=0,l=this.material.length;s<l;s++)h.push(r(e.materials,this.material[s]));i.material=h}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(s=0;s<this.children.length;s++)i.children.push(this.children[s].toJSON(e).object)}if(t){var u=m(e.geometries),p=m(e.materials),d=m(e.textures),f=m(e.images);o=m(e.shapes);u.length>0&&(n.geometries=u),p.length>0&&(n.materials=p),d.length>0&&(n.textures=d),f.length>0&&(n.images=f),o.length>0&&(n.shapes=o)}return n.object=i,n;function m(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;n<e.children.length;n++){var i=e.children[n];this.add(i.clone())}return this}}),Zb.prototype=Object.assign(Object.create(Jb.prototype),{constructor:Zb,isScene:!0,copy:function(e,t){return Jb.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=Jb.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Kb=[new Mb,new Mb,new Mb,new Mb,new Mb,new Mb,new Mb,new Mb],Qb=new Mb,$b=new hw,ew=new Mb,tw=new Mb,nw=new Mb,iw=new Mb,rw=new Mb,aw=new Mb,ow=new Mb,sw=new Mb,lw=new Mb,cw=new Mb;function hw(e,t){this.min=void 0!==e?e:new Mb(1/0,1/0,1/0),this.max=void 0!==t?t:new Mb(-1/0,-1/0,-1/0)}function uw(e,t,n,i,r){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){cw.fromArray(e,a);var s=r.x*Math.abs(cw.x)+r.y*Math.abs(cw.y)+r.z*Math.abs(cw.z),l=t.dot(cw),c=n.dot(cw),h=i.dot(cw);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>s)return!1}return!0}Object.assign(hw.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;s<l;s+=3){var c=e[s],h=e[s+1],u=e[s+2];c<t&&(t=c),h<n&&(n=h),u<i&&(i=u),c>r&&(r=c),h>a&&(a=h),u>o&&(o=u)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;s<l;s++){var c=e.getX(s),h=e.getY(s),u=e.getZ(s);c<t&&(t=c),h<n&&(n=h),u<i&&(i=u),c>r&&(r=c),h>a&&(a=h),u>o&&(o=u)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=Qb.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new Mb),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new Mb),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),$b.copy(t.boundingBox),$b.applyMatrix4(e.matrixWorld),this.union($b));for(var n=e.children,i=0,r=n.length;i<r;i++)this.expandByObject(n[i]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new Mb),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,Qb),Qb.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(ow),sw.subVectors(this.max,ow),ew.subVectors(e.a,ow),tw.subVectors(e.b,ow),nw.subVectors(e.c,ow),iw.subVectors(tw,ew),rw.subVectors(nw,tw),aw.subVectors(ew,nw);var t=[0,-iw.z,iw.y,0,-rw.z,rw.y,0,-aw.z,aw.y,iw.z,0,-iw.x,rw.z,0,-rw.x,aw.z,0,-aw.x,-iw.y,iw.x,0,-rw.y,rw.x,0,-aw.y,aw.x,0];return!!uw(t,ew,tw,nw,sw)&&(!!uw(t=[1,0,0,0,1,0,0,0,1],ew,tw,nw,sw)&&(lw.crossVectors(iw,rw),uw(t=[lw.x,lw.y,lw.z],ew,tw,nw,sw)))},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new Mb),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Qb.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(Qb).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()||(Kb[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Kb[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Kb[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Kb[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Kb[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Kb[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Kb[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Kb[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Kb)),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var pw=new hw;function dw(e,t){this.center=void 0!==e?e:new Mb,this.radius=void 0!==t?t:-1}Object.assign(dw.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;void 0!==t?n.copy(t):pw.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new Mb),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new hw),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var fw=new Mb,mw=new Mb,gw=new Mb,vw=new Mb,yw=new Mb,xw=new Mb,bw=new Mb;function ww(e,t){this.origin=void 0!==e?e:new Mb,this.direction=void 0!==t?t:new Mb(0,0,-1)}Object.assign(ww.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new Mb),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,fw)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new Mb),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=fw.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(fw.copy(this.direction).multiplyScalar(t).add(this.origin),fw.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,i){mw.copy(e).add(t).multiplyScalar(.5),gw.copy(t).sub(e).normalize(),vw.copy(this.origin).sub(mw);var r,a,o,s,l=.5*e.distanceTo(t),c=-this.direction.dot(gw),h=vw.dot(this.direction),u=-vw.dot(gw),p=vw.lengthSq(),d=Math.abs(1-c*c);if(d>0)if(a=c*h-u,s=l*d,(r=c*u-h)>=0)if(a>=-s)if(a<=s){var f=1/d;o=(r*=f)*(r+c*(a*=f)+2*h)+a*(c*r+a+2*u)+p}else a=l,o=-(r=Math.max(0,-(c*a+h)))*r+a*(a+2*u)+p;else a=-l,o=-(r=Math.max(0,-(c*a+h)))*r+a*(a+2*u)+p;else a<=-s?o=-(r=Math.max(0,-(-c*l+h)))*r+(a=r>0?-l:Math.min(Math.max(-l,-u),l))*(a+2*u)+p:a<=s?(r=0,o=(a=Math.min(Math.max(-l,-u),l))*(a+2*u)+p):o=-(r=Math.max(0,-(c*l+h)))*r+(a=r>0?l:Math.min(Math.max(-l,-u),l))*(a+2*u)+p;else a=c>0?-l:l,o=-(r=Math.max(0,-(c*a+h)))*r+a*(a+2*u)+p;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(gw).multiplyScalar(a).add(mw),o},intersectSphere:function(e,t){fw.subVectors(e.center,this.origin);var n=fw.dot(this.direction),i=fw.dot(fw)-n*n,r=e.radius*e.radius;if(i>r)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,a,o,s,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),c>=0?(r=(e.min.y-u.y)*c,a=(e.max.y-u.y)*c):(r=(e.max.y-u.y)*c,a=(e.min.y-u.y)*c),n>a||r>i?null:((r>n||n!=n)&&(n=r),(a<i||i!=i)&&(i=a),h>=0?(o=(e.min.z-u.z)*h,s=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,s=(e.min.z-u.z)*h),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,fw)},intersectTriangle:function(e,t,n,i,r){yw.subVectors(t,e),xw.subVectors(n,e),bw.crossVectors(yw,xw);var a,o=this.direction.dot(bw);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}vw.subVectors(this.origin,e);var s=a*this.direction.dot(xw.crossVectors(vw,xw));if(s<0)return null;var l=a*this.direction.dot(yw.cross(vw));if(l<0)return null;if(s+l>o)return null;var c=-a*vw.dot(bw);return c<0?null:this.at(c/o,r)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var _w=new Mb,Mw=new Mb,Sw=new db;function Tw(e,t){this.normal=void 0!==e?e:new Mb(1,0,0),this.constant=void 0!==t?t:0}Object.assign(Tw.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var i=_w.subVectors(n,t).cross(Mw.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new Mb),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new Mb);var n=e.delta(_w),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?void 0:t.copy(n).multiplyScalar(r).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new Mb),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||Sw.getNormalMatrix(e),i=this.coplanarPoint(_w).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var Ew=new Mb,Aw=new Mb,Lw=new Mb,Rw=new Mb,Pw=new Mb,Cw=new Mb,Ow=new Mb,Iw=new Mb,Dw=new Mb,Nw=new Mb;function zw(e,t,n){this.a=void 0!==e?e:new Mb,this.b=void 0!==t?t:new Mb,this.c=void 0!==n?n:new Mb}Object.assign(zw,{getNormal:function(e,t,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new Mb),i.subVectors(n,t),Ew.subVectors(e,t),i.cross(Ew);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)},getBarycoord:function(e,t,n,i,r){Ew.subVectors(i,t),Aw.subVectors(n,t),Lw.subVectors(e,t);var a=Ew.dot(Ew),o=Ew.dot(Aw),s=Ew.dot(Lw),l=Aw.dot(Aw),c=Aw.dot(Lw),h=a*l-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new Mb),0===h)return r.set(-2,-1,-1);var u=1/h,p=(l*s-o*c)*u,d=(a*c-o*s)*u;return r.set(1-p-d,d,p)},containsPoint:function(e,t,n,i){return zw.getBarycoord(e,t,n,i,Rw),Rw.x>=0&&Rw.y>=0&&Rw.x+Rw.y<=1},getUV:function(e,t,n,i,r,a,o,s){return this.getBarycoord(e,t,n,i,Rw),s.set(0,0),s.addScaledVector(r,Rw.x),s.addScaledVector(a,Rw.y),s.addScaledVector(o,Rw.z),s},isFrontFacing:function(e,t,n,i){return Ew.subVectors(n,t),Aw.subVectors(e,t),Ew.cross(Aw).dot(i)<0}}),Object.assign(zw.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return Ew.subVectors(this.c,this.b),Aw.subVectors(this.a,this.b),.5*Ew.cross(Aw).length()},getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new Mb),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return zw.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new Tw),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return zw.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,i,r){return zw.getUV(e,this.a,this.b,this.c,t,n,i,r)},containsPoint:function(e){return zw.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return zw.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new Mb);var n,i,r=this.a,a=this.b,o=this.c;Pw.subVectors(a,r),Cw.subVectors(o,r),Iw.subVectors(e,r);var s=Pw.dot(Iw),l=Cw.dot(Iw);if(s<=0&&l<=0)return t.copy(r);Dw.subVectors(e,a);var c=Pw.dot(Dw),h=Cw.dot(Dw);if(c>=0&&h<=c)return t.copy(a);var u=s*h-c*l;if(u<=0&&s>=0&&c<=0)return n=s/(s-c),t.copy(r).addScaledVector(Pw,n);Nw.subVectors(e,o);var p=Pw.dot(Nw),d=Cw.dot(Nw);if(d>=0&&p<=d)return t.copy(o);var f=p*l-s*d;if(f<=0&&l>=0&&d<=0)return i=l/(l-d),t.copy(r).addScaledVector(Cw,i);var m=c*d-p*h;if(m<=0&&h-c>=0&&p-d>=0)return Ow.subVectors(o,a),i=(h-c)/(h-c+(p-d)),t.copy(a).addScaledVector(Ow,i);var g=1/(m+f+u);return n=f*g,i=u*g,t.copy(r).addScaledVector(Pw,n).addScaledVector(Cw,i)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var Uw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Fw={h:0,s:0,l:0},Bw={h:0,s:0,l:0};function Hw(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function Gw(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function kw(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Vw(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function jw(e,t,n,i,r,a){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new Mb,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new Hw,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}Object.assign(Hw.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=ub.euclideanModulo(e,1),t=ub.clamp(t,0,1),n=ub.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Gw(r,i,e+1/3),this.g=Gw(r,i,e),this.b=Gw(r,i,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],a=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(o,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var c=n[1],h=c.length;if(3===h)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=Uw[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=kw(e.r),this.g=kw(e.g),this.b=kw(e.b),this},copyLinearToSRGB:function(e){return this.r=Vw(e.r),this.g=Vw(e.g),this.b=Vw(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,i=this.r,r=this.g,a=this.b,o=Math.max(i,r,a),s=Math.min(i,r,a),l=(s+o)/2;if(s===o)t=0,n=0;else{var c=o-s;switch(n=l<=.5?c/(o+s):c/(2-o-s),o){case i:t=(r-a)/c+(r<a?6:0);break;case r:t=(a-i)/c+2;break;case a:t=(i-r)/c+4}t/=6}return e.h=t,e.s=n,e.l=l,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(e,t,n){return this.getHSL(Fw),Fw.h+=e,Fw.s+=t,Fw.l+=n,this.setHSL(Fw.h,Fw.s,Fw.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL(Fw),e.getHSL(Bw);var n=ub.lerp(Fw.h,Bw.h,t),i=ub.lerp(Fw.s,Bw.s,t),r=ub.lerp(Fw.l,Bw.l,t);return this.setHSL(n,i,r),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}}),Hw.NAMES=Uw,Object.assign(jw.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var Ww=0;function qw(){Object.defineProperty(this,"id",{value:Ww++}),this.uuid=ub.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function Xw(e){qw.call(this),this.type="MeshBasicMaterial",this.color=new Hw(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(e)}qw.prototype=Object.assign(Object.create(sb.prototype),{constructor:qw,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(qw.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Xw.prototype=Object.create(qw.prototype),Xw.prototype.constructor=Xw,Xw.prototype.isMeshBasicMaterial=!0,Xw.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var Yw=new Mb;function Jw(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function Zw(e,t,n){Jw.call(this,new Int8Array(e),t,n)}function Kw(e,t,n){Jw.call(this,new Uint8Array(e),t,n)}function Qw(e,t,n){Jw.call(this,new Uint8ClampedArray(e),t,n)}function $w(e,t,n){Jw.call(this,new Int16Array(e),t,n)}function e_(e,t,n){Jw.call(this,new Uint16Array(e),t,n)}function t_(e,t,n){Jw.call(this,new Int32Array(e),t,n)}function n_(e,t,n){Jw.call(this,new Uint32Array(e),t,n)}function i_(e,t,n){Jw.call(this,new Float32Array(e),t,n)}function r_(e,t,n){Jw.call(this,new Float64Array(e),t,n)}function a_(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function o_(e){if(0===e.length)return-1/0;let t=e[0];for(let n=1,i=e.length;n<i;++n)e[n]>t&&(t=e[n]);return t}Object.defineProperty(Jw.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Jw.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new Hw),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new pb),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new Mb),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new vb),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)Yw.x=this.getX(t),Yw.y=this.getY(t),Yw.z=this.getZ(t),Yw.applyMatrix3(e),this.setXYZ(t,Yw.x,Yw.y,Yw.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)Yw.x=this.getX(t),Yw.y=this.getY(t),Yw.z=this.getZ(t),Yw.applyMatrix4(e),this.setXYZ(t,Yw.x,Yw.y,Yw.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)Yw.x=this.getX(t),Yw.y=this.getY(t),Yw.z=this.getZ(t),Yw.applyNormalMatrix(e),this.setXYZ(t,Yw.x,Yw.y,Yw.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)Yw.x=this.getX(t),Yw.y=this.getY(t),Yw.z=this.getZ(t),Yw.transformDirection(e),this.setXYZ(t,Yw.x,Yw.y,Yw.z);return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),Zw.prototype=Object.create(Jw.prototype),Zw.prototype.constructor=Zw,Kw.prototype=Object.create(Jw.prototype),Kw.prototype.constructor=Kw,Qw.prototype=Object.create(Jw.prototype),Qw.prototype.constructor=Qw,$w.prototype=Object.create(Jw.prototype),$w.prototype.constructor=$w,e_.prototype=Object.create(Jw.prototype),e_.prototype.constructor=e_,t_.prototype=Object.create(Jw.prototype),t_.prototype.constructor=t_,n_.prototype=Object.create(Jw.prototype),n_.prototype.constructor=n_,i_.prototype=Object.create(Jw.prototype),i_.prototype.constructor=i_,r_.prototype=Object.create(Jw.prototype),r_.prototype.constructor=r_,Object.assign(a_.prototype,{computeGroups:function(e){for(var t,n=[],i=void 0,r=e.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==i&&(i=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,n.push(t)),t={start:3*a,materialIndex:i})}void 0!==t&&(t.count=3*a-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,i=e.vertices,r=e.faceVertexUvs,a=r[0]&&r[0].length>0,o=r[1]&&r[1].length>0,s=e.morphTargets,l=s.length;if(l>0){t=[];for(var c=0;c<l;c++)t[c]={name:s[c].name,data:[]};this.morphTargets.position=t}var h,u=e.morphNormals,p=u.length;if(p>0){h=[];for(c=0;c<p;c++)h[c]={name:u[c].name,data:[]};this.morphTargets.normal=h}var d=e.skinIndices,f=e.skinWeights,m=d.length===i.length,g=f.length===i.length;i.length>0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(c=0;c<n.length;c++){var v=n[c];this.vertices.push(i[v.a],i[v.b],i[v.c]);var y=v.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=v.normal;this.normals.push(x,x,x)}var b,w=v.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var _=v.color;this.colors.push(_,_,_)}if(!0===a)void 0!==(b=r[0][c])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",c),this.uvs.push(new pb,new pb,new pb));if(!0===o)void 0!==(b=r[1][c])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",c),this.uvs2.push(new pb,new pb,new pb));for(var M=0;M<l;M++){var S=s[M].vertices;t[M].data.push(S[v.a],S[v.b],S[v.c])}for(M=0;M<p;M++){var T=u[M].vertexNormals[c];h[M].data.push(T.a,T.b,T.c)}m&&this.skinIndices.push(d[v.a],d[v.b],d[v.c]),g&&this.skinWeights.push(f[v.a],f[v.b],f[v.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}});var s_=1,l_=new Cb,c_=new Jb,h_=new Mb,u_=new hw,p_=new hw,d_=new Mb;function f_(){Object.defineProperty(this,"id",{value:s_+=2}),this.uuid=ub.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}f_.prototype=Object.assign(Object.create(sb.prototype),{constructor:f_,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(o_(e)>65535?n_:e_)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new db).getNormalMatrix(e);n.applyNormalMatrix(i),n.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return l_.makeRotationX(e),this.applyMatrix4(l_),this},rotateY:function(e){return l_.makeRotationY(e),this.applyMatrix4(l_),this},rotateZ:function(e){return l_.makeRotationZ(e),this.applyMatrix4(l_),this},translate:function(e,t,n){return l_.makeTranslation(e,t,n),this.applyMatrix4(l_),this},scale:function(e,t,n){return l_.makeScale(e,t,n),this.applyMatrix4(l_),this},lookAt:function(e){return c_.lookAt(e),c_.updateMatrix(),this.applyMatrix4(c_.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(h_).negate(),this.translate(h_.x,h_.y,h_.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new i_(3*t.vertices.length,3),i=new i_(3*t.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new i_(t.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new i_(t,3)),this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var i=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(i=void 0,n.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(n);i.verticesNeedUpdate=n.verticesNeedUpdate,i.normalsNeedUpdate=n.normalsNeedUpdate,i.colorsNeedUpdate=n.colorsNeedUpdate,i.uvsNeedUpdate=n.uvsNeedUpdate,i.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=i}return!0===n.verticesNeedUpdate&&(void 0!==(t=this.attributes.position)&&(t.copyVector3sArray(n.vertices),t.needsUpdate=!0),n.verticesNeedUpdate=!1),!0===n.normalsNeedUpdate&&(void 0!==(t=this.attributes.normal)&&(t.copyVector3sArray(n.normals),t.needsUpdate=!0),n.normalsNeedUpdate=!1),!0===n.colorsNeedUpdate&&(void 0!==(t=this.attributes.color)&&(t.copyColorsArray(n.colors),t.needsUpdate=!0),n.colorsNeedUpdate=!1),n.uvsNeedUpdate&&(void 0!==(t=this.attributes.uv)&&(t.copyVector2sArray(n.uvs),t.needsUpdate=!0),n.uvsNeedUpdate=!1),n.lineDistancesNeedUpdate&&(void 0!==(t=this.attributes.lineDistance)&&(t.copyArray(n.lineDistances),t.needsUpdate=!0),n.lineDistancesNeedUpdate=!1),n.groupsNeedUpdate&&(n.computeGroups(e.geometry),this.groups=n.groups,n.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new a_).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.setAttribute("position",new Jw(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.setAttribute("normal",new Jw(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.setAttribute("color",new Jw(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new Jw(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new Jw(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],l=e.morphTargets[o],c=0,h=l.length;c<h;c++){var u=l[c],p=new i_(3*u.data.length,3);p.name=u.name,s.push(p.copyVector3sArray(u.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var d=new i_(4*e.skinIndices.length,4);this.setAttribute("skinIndex",d.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new i_(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new hw);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n<i;n++){var r=t[n];u_.setFromBufferAttribute(r),this.morphTargetsRelative?(d_.addVectors(this.boundingBox.min,u_.min),this.boundingBox.expandByPoint(d_),d_.addVectors(this.boundingBox.max,u_.max),this.boundingBox.expandByPoint(d_)):(this.boundingBox.expandByPoint(u_.min),this.boundingBox.expandByPoint(u_.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new dw);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(u_.setFromBufferAttribute(e),t)for(var i=0,r=t.length;i<r;i++){var a=t[i];p_.setFromBufferAttribute(a),this.morphTargetsRelative?(d_.addVectors(u_.min,p_.min),u_.expandByPoint(d_),d_.addVectors(u_.max,p_.max),u_.expandByPoint(d_)):(u_.expandByPoint(p_.min),u_.expandByPoint(p_.max))}u_.getCenter(n);var o=0;for(i=0,r=e.count;i<r;i++)d_.fromBufferAttribute(e,i),o=Math.max(o,n.distanceToSquared(d_));if(t)for(i=0,r=t.length;i<r;i++){a=t[i];for(var s=this.morphTargetsRelative,l=0,c=a.count;l<c;l++)d_.fromBufferAttribute(a,l),s&&(h_.fromBufferAttribute(e,l),d_.add(h_)),o=Math.max(o,n.distanceToSquared(d_))}this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(void 0===t.normal)this.setAttribute("normal",new Jw(new Float32Array(n.length),3));else for(var i=t.normal.array,r=0,a=i.length;r<a;r++)i[r]=0;var o,s,l,c=t.normal.array,h=new Mb,u=new Mb,p=new Mb,d=new Mb,f=new Mb;if(e){var m=e.array;for(r=0,a=e.count;r<a;r+=3)o=3*m[r+0],s=3*m[r+1],l=3*m[r+2],h.fromArray(n,o),u.fromArray(n,s),p.fromArray(n,l),d.subVectors(p,u),f.subVectors(h,u),d.cross(f),c[o]+=d.x,c[o+1]+=d.y,c[o+2]+=d.z,c[s]+=d.x,c[s+1]+=d.y,c[s+2]+=d.z,c[l]+=d.x,c[l+1]+=d.y,c[l+2]+=d.z}else for(r=0,a=n.length;r<a;r+=9)h.fromArray(n,r),u.fromArray(n,r+3),p.fromArray(n,r+6),d.subVectors(p,u),f.subVectors(h,u),d.cross(f),c[r]=d.x,c[r+1]=d.y,c[r+2]=d.z,c[r+3]=d.x,c[r+4]=d.y,c[r+5]=d.z,c[r+6]=d.x,c[r+7]=d.y,c[r+8]=d.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var i in n)if(void 0!==e.attributes[i])for(var r=n[i].array,a=e.attributes[i],o=a.array,s=a.itemSize*t,l=Math.min(o.length,r.length-s),c=0,h=s;c<l;c++,h++)r[h]=o[c];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)d_.x=e.getX(t),d_.y=e.getY(t),d_.z=e.getZ(t),d_.normalize(),e.setXYZ(t,d_.x,d_.y,d_.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i),o=0,s=0,l=0,c=t.length;l<c;l++){o=t[l]*i;for(var h=0;h<i;h++)a[s++]=n[o++]}return new Jw(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new f_,n=this.index.array,i=this.attributes;for(var r in i){var a=e(i[r],n);t.setAttribute(r,a)}var o=this.morphAttributes;for(r in o){for(var s=[],l=o[r],c=0,h=l.length;c<h;c++){a=e(l[c],n);s.push(a)}t.morphAttributes[r]=s}t.morphTargetsRelative=this.morphTargetsRelative;for(var u=this.groups,p=(c=0,u.length);c<p;c++){var d=u[c];t.addGroup(d.start,d.count,d.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var n in r){var a=(p=r[n]).toJSON();""!==p.name&&(a.name=p.name),e.data.attributes[n]=a}var o={},s=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],c=[],h=0,u=l.length;h<u;h++){var p;a=(p=l[h]).toJSON();""!==p.name&&(a.name=p.name),c.push(a)}c.length>0&&(o[n]=c,s=!0)}s&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);var d=this.groups;d.length>0&&(e.data.groups=JSON.parse(JSON.stringify(d)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new f_).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var l=[],c=s[t];for(n=0,i=c.length;n<i;n++)l.push(c[n].clone());this.morphAttributes[t]=l}this.morphTargetsRelative=e.morphTargetsRelative;var h=e.groups;for(n=0,i=h.length;n<i;n++){var u=h[n];this.addGroup(u.start,u.count,u.materialIndex)}var p=e.boundingBox;null!==p&&(this.boundingBox=p.clone());var d=e.boundingSphere;return null!==d&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var m_=new Cb,g_=new ww,v_=new dw,y_=new Mb,x_=new Mb,b_=new Mb,w_=new Mb,__=new Mb,M_=new Mb,S_=new Mb,T_=new Mb,E_=new Mb,A_=new pb,L_=new pb,R_=new pb,P_=new Mb,C_=new Mb;function O_(e,t){Jb.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new f_,this.material=void 0!==t?t:new Xw,this.updateMorphTargets()}function I_(e,t,n,i,r,a,o,s){if(null===(1===t.side?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,2!==t.side,s)))return null;C_.copy(s),C_.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(C_);return l<n.near||l>n.far?null:{distance:l,point:C_.clone(),object:e}}function D_(e,t,n,i,r,a,o,s,l,c,h,u){y_.fromBufferAttribute(r,c),x_.fromBufferAttribute(r,h),b_.fromBufferAttribute(r,u);var p=e.morphTargetInfluences;if(t.morphTargets&&a&&p){S_.set(0,0,0),T_.set(0,0,0),E_.set(0,0,0);for(var d=0,f=a.length;d<f;d++){var m=p[d],g=a[d];0!==m&&(w_.fromBufferAttribute(g,c),__.fromBufferAttribute(g,h),M_.fromBufferAttribute(g,u),o?(S_.addScaledVector(w_,m),T_.addScaledVector(__,m),E_.addScaledVector(M_,m)):(S_.addScaledVector(w_.sub(y_),m),T_.addScaledVector(__.sub(x_),m),E_.addScaledVector(M_.sub(b_),m)))}y_.add(S_),x_.add(T_),b_.add(E_)}e.isSkinnedMesh&&(e.boneTransform(c,y_),e.boneTransform(h,x_),e.boneTransform(u,b_));var v=I_(e,t,n,i,y_,x_,b_,P_);if(v){s&&(A_.fromBufferAttribute(s,c),L_.fromBufferAttribute(s,h),R_.fromBufferAttribute(s,u),v.uv=zw.getUV(P_,y_,x_,b_,A_,L_,R_,new pb)),l&&(A_.fromBufferAttribute(l,c),L_.fromBufferAttribute(l,h),R_.fromBufferAttribute(l,u),v.uv2=zw.getUV(P_,y_,x_,b_,A_,L_,R_,new pb));var y=new jw(c,h,u);zw.getNormal(y_,x_,b_,y.normal),v.face=y}return v}O_.prototype=Object.assign(Object.create(Jb.prototype),{constructor:O_,isMesh:!0,copy:function(e){return Jb.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var n,i=this.geometry,r=this.material,a=this.matrixWorld;if(void 0!==r&&(null===i.boundingSphere&&i.computeBoundingSphere(),v_.copy(i.boundingSphere),v_.applyMatrix4(a),!1!==e.ray.intersectsSphere(v_)&&(m_.getInverse(a),g_.copy(e.ray).applyMatrix4(m_),null===i.boundingBox||!1!==g_.intersectsBox(i.boundingBox))))if(i.isBufferGeometry){var o,s,l,c,h,u,p,d,f,m=i.index,g=i.attributes.position,v=i.morphAttributes.position,y=i.morphTargetsRelative,x=i.attributes.uv,b=i.attributes.uv2,w=i.groups,_=i.drawRange;if(null!==m)if(Array.isArray(r))for(c=0,u=w.length;c<u;c++)for(f=r[(d=w[c]).materialIndex],h=Math.max(d.start,_.start),p=Math.min(d.start+d.count,_.start+_.count);h<p;h+=3)o=m.getX(h),s=m.getX(h+1),l=m.getX(h+2),(n=D_(this,f,e,g_,g,v,y,x,b,o,s,l))&&(n.faceIndex=Math.floor(h/3),n.face.materialIndex=d.materialIndex,t.push(n));else for(c=Math.max(0,_.start),u=Math.min(m.count,_.start+_.count);c<u;c+=3)o=m.getX(c),s=m.getX(c+1),l=m.getX(c+2),(n=D_(this,r,e,g_,g,v,y,x,b,o,s,l))&&(n.faceIndex=Math.floor(c/3),t.push(n));else if(void 0!==g)if(Array.isArray(r))for(c=0,u=w.length;c<u;c++)for(f=r[(d=w[c]).materialIndex],h=Math.max(d.start,_.start),p=Math.min(d.start+d.count,_.start+_.count);h<p;h+=3)(n=D_(this,f,e,g_,g,v,y,x,b,o=h,s=h+1,l=h+2))&&(n.faceIndex=Math.floor(h/3),n.face.materialIndex=d.materialIndex,t.push(n));else for(c=Math.max(0,_.start),u=Math.min(g.count,_.start+_.count);c<u;c+=3)(n=D_(this,r,e,g_,g,v,y,x,b,o=c,s=c+1,l=c+2))&&(n.faceIndex=Math.floor(c/3),t.push(n))}else if(i.isGeometry){var M,S,T,E,A=Array.isArray(r),L=i.vertices,R=i.faces,P=i.faceVertexUvs[0];P.length>0&&(E=P);for(var C=0,O=R.length;C<O;C++){var I=R[C],D=A?r[I.materialIndex]:r;if(void 0!==D&&(M=L[I.a],S=L[I.b],T=L[I.c],n=I_(this,D,e,g_,M,S,T,P_))){if(E&&E[C]){var N=E[C];A_.copy(N[0]),L_.copy(N[1]),R_.copy(N[2]),n.uv=zw.getUV(P_,M,S,T,A_,L_,R_,new pb)}n.face=I,n.faceIndex=C,t.push(n)}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var N_=0,z_=new Cb,U_=new Jb,F_=new Mb;function B_(){Object.defineProperty(this,"id",{value:N_+=2}),this.uuid=ub.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}B_.prototype=Object.assign(Object.create(sb.prototype),{constructor:B_,isGeometry:!0,applyMatrix4:function(e){for(var t=(new db).getNormalMatrix(e),n=0,i=this.vertices.length;n<i;n++){this.vertices[n].applyMatrix4(e)}for(n=0,i=this.faces.length;n<i;n++){var r=this.faces[n];r.normal.applyMatrix3(t).normalize();for(var a=0,o=r.vertexNormals.length;a<o;a++)r.vertexNormals[a].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return z_.makeRotationX(e),this.applyMatrix4(z_),this},rotateY:function(e){return z_.makeRotationY(e),this.applyMatrix4(z_),this},rotateZ:function(e){return z_.makeRotationZ(e),this.applyMatrix4(z_),this},translate:function(e,t,n){return z_.makeTranslation(e,t,n),this.applyMatrix4(z_),this},scale:function(e,t,n){return z_.makeScale(e,t,n),this.applyMatrix4(z_),this},lookAt:function(e){return U_.lookAt(e),U_.updateMatrix(),this.applyMatrix4(U_.matrix),this},fromBufferGeometry:function(e){var t=this,n=null!==e.index?e.index.array:void 0,i=e.attributes;if(void 0===i.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var r=i.position.array,a=void 0!==i.normal?i.normal.array:void 0,o=void 0!==i.color?i.color.array:void 0,s=void 0!==i.uv?i.uv.array:void 0,l=void 0!==i.uv2?i.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var c=0;c<r.length;c+=3)t.vertices.push((new Mb).fromArray(r,c)),void 0!==o&&t.colors.push((new Hw).fromArray(o,c));function h(e,n,i,r){var c=void 0===o?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[i].clone()],h=new jw(e,n,i,void 0===a?[]:[(new Mb).fromArray(a,3*e),(new Mb).fromArray(a,3*n),(new Mb).fromArray(a,3*i)],c,r);t.faces.push(h),void 0!==s&&t.faceVertexUvs[0].push([(new pb).fromArray(s,2*e),(new pb).fromArray(s,2*n),(new pb).fromArray(s,2*i)]),void 0!==l&&t.faceVertexUvs[1].push([(new pb).fromArray(l,2*e),(new pb).fromArray(l,2*n),(new pb).fromArray(l,2*i)])}var u=e.groups;if(u.length>0)for(c=0;c<u.length;c++)for(var p=u[c],d=p.start,f=d,m=d+p.count;f<m;f+=3)void 0!==n?h(n[f],n[f+1],n[f+2],p.materialIndex):h(f,f+1,f+2,p.materialIndex);else if(void 0!==n)for(c=0;c<n.length;c+=3)h(n[c],n[c+1],n[c+2]);else for(c=0;c<r.length/3;c+=3)h(c,c+1,c+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(F_).negate(),this.translate(F_.x,F_.y,F_.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,i=new Cb;return i.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(i),this},computeFaceNormals:function(){for(var e=new Mb,t=new Mb,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){var t,n,i,r,a,o;for(void 0===e&&(e=!0),o=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)o[t]=new Mb;if(e){var s,l,c,h=new Mb,u=new Mb;for(i=0,r=this.faces.length;i<r;i++)a=this.faces[i],s=this.vertices[a.a],l=this.vertices[a.b],c=this.vertices[a.c],h.subVectors(c,l),u.subVectors(s,l),h.cross(u),o[a.a].add(h),o[a.b].add(h),o[a.c].add(h)}else for(this.computeFaceNormals(),i=0,r=this.faces.length;i<r;i++)o[(a=this.faces[i]).a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(i=0,r=this.faces.length;i<r;i++){var p=(a=this.faces[i]).vertexNormals;3===p.length?(p[0].copy(o[a.a]),p[1].copy(o[a.b]),p[2].copy(o[a.c])):(p[0]=o[a.a].clone(),p[1]=o[a.b].clone(),p[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){var i=(n=this.faces[e]).vertexNormals;3===i.length?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n<i;n++)for((r=this.faces[n]).__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),e=0,t=r.vertexNormals.length;e<t;e++)r.__originalVertexNormals[e]?r.__originalVertexNormals[e].copy(r.vertexNormals[e]):r.__originalVertexNormals[e]=r.vertexNormals[e].clone();var a=new B_;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals;for(n=0,i=this.faces.length;n<i;n++)l=new Mb,c={a:new Mb,b:new Mb,c:new Mb},o.push(l),s.push(c)}var l,c,h=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,i=this.faces.length;n<i;n++)r=this.faces[n],l=h.faceNormals[n],c=h.vertexNormals[n],l.copy(r.normal),c.a.copy(r.vertexNormals[0]),c.b.copy(r.vertexNormals[1]),c.c.copy(r.vertexNormals[2])}for(n=0,i=this.faces.length;n<i;n++)(r=this.faces[n]).normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new hw),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new dw),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var i,r=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,l=e.faces,c=this.colors,h=e.colors;void 0===n&&(n=0),void 0!==t&&(i=(new db).getNormalMatrix(t));for(var u=0,p=o.length;u<p;u++){var d=o[u].clone();void 0!==t&&d.applyMatrix4(t),a.push(d)}for(u=0,p=h.length;u<p;u++)c.push(h[u].clone());for(u=0,p=l.length;u<p;u++){var f,m,g,v=l[u],y=v.vertexNormals,x=v.vertexColors;(f=new jw(v.a+r,v.b+r,v.c+r)).normal.copy(v.normal),void 0!==i&&f.normal.applyMatrix3(i).normalize();for(var b=0,w=y.length;b<w;b++)m=y[b].clone(),void 0!==i&&m.applyMatrix3(i).normalize(),f.vertexNormals.push(m);f.color.copy(v.color);for(b=0,w=x.length;b<w;b++)g=x[b],f.vertexColors.push(g.clone());f.materialIndex=v.materialIndex+n,s.push(f)}for(u=0,p=e.faceVertexUvs.length;u<p;u++){var _=e.faceVertexUvs[u];void 0===this.faceVertexUvs[u]&&(this.faceVertexUvs[u]=[]);for(b=0,w=_.length;b<w;b++){for(var M=_[b],S=[],T=0,E=M.length;T<E;T++)S.push(M[T].clone());this.faceVertexUvs[u].push(S)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){var e,t,n,i,r,a,o,s,l={},c=[],h=[],u=Math.pow(10,4);for(n=0,i=this.vertices.length;n<i;n++)e=this.vertices[n],void 0===l[t=Math.round(e.x*u)+"_"+Math.round(e.y*u)+"_"+Math.round(e.z*u)]?(l[t]=n,c.push(this.vertices[n]),h[n]=c.length-1):h[n]=h[l[t]];var p=[];for(n=0,i=this.faces.length;n<i;n++){(r=this.faces[n]).a=h[r.a],r.b=h[r.b],r.c=h[r.c],a=[r.a,r.b,r.c];for(var d=0;d<3;d++)if(a[d]===a[(d+1)%3]){p.push(n);break}}for(n=p.length-1;n>=0;n--){var f=p[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o<s;o++)this.faceVertexUvs[o].splice(f,1)}var m=this.vertices.length-c.length;return this.vertices=c,m},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var i=e[t];this.vertices.push(new Mb(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));var i,r,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(i=[]),o&&o.length===t&&(r=[]);for(n=0;n<t;n++){var s=e[n]._id;i&&i.push(a[s]),r&&r.push(o[s])}i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}for(var i=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];i.push(a.x,a.y,a.z)}var o=[],s=[],l={},c=[],h={},u=[],p={};for(r=0;r<this.faces.length;r++){var d=this.faces[r],f=void 0!==this.faceVertexUvs[0][r],m=d.normal.length()>0,g=d.vertexNormals.length>0,v=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=d.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,g),x=M(x,6,v),x=M(x,7,y),o.push(x),o.push(d.a,d.b,d.c),o.push(d.materialIndex),f){var b=this.faceVertexUvs[0][r];o.push(E(b[0]),E(b[1]),E(b[2]))}if(m&&o.push(S(d.normal)),g){var w=d.vertexNormals;o.push(S(w[0]),S(w[1]),S(w[2]))}if(v&&o.push(T(d.color)),y){var _=d.vertexColors;o.push(T(_[0]),T(_[1]),T(_[2]))}}function M(e,t,n){return n?e|1<<t:e&~(1<<t)}function S(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==l[t]||(l[t]=s.length/3,s.push(e.x,e.y,e.z)),l[t]}function T(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==h[t]||(h[t]=c.length,c.push(e.getHex())),h[t]}function E(e){var t=e.x.toString()+e.y.toString();return void 0!==p[t]||(p[t]=u.length/2,u.push(e.x,e.y)),p[t]}return e.data={},e.data.vertices=i,e.data.normals=s,c.length>0&&(e.data.colors=c),u.length>0&&(e.data.uvs=[u]),e.data.faces=o,e},clone:function(){return(new B_).copy(this)},copy:function(e){var t,n,i,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var l=e.colors;for(t=0,n=l.length;t<n;t++)this.colors.push(l[t].clone());var c=e.faces;for(t=0,n=c.length;t<n;t++)this.faces.push(c[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var h=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),i=0,r=h.length;i<r;i++){var u=h[i],p=[];for(a=0,o=u.length;a<o;a++){var d=u[a];p.push(d.clone())}this.faceVertexUvs[t].push(p)}}var f=e.morphTargets;for(t=0,n=f.length;t<n;t++){var m={};if(m.name=f[t].name,void 0!==f[t].vertices)for(m.vertices=[],i=0,r=f[t].vertices.length;i<r;i++)m.vertices.push(f[t].vertices[i].clone());if(void 0!==f[t].normals)for(m.normals=[],i=0,r=f[t].normals.length;i<r;i++)m.normals.push(f[t].normals[i].clone());this.morphTargets.push(m)}var g=e.morphNormals;for(t=0,n=g.length;t<n;t++){var v={};if(void 0!==g[t].vertexNormals)for(v.vertexNormals=[],i=0,r=g[t].vertexNormals.length;i<r;i++){var y=g[t].vertexNormals[i],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),v.vertexNormals.push(x)}if(void 0!==g[t].faceNormals)for(v.faceNormals=[],i=0,r=g[t].faceNormals.length;i<r;i++)v.faceNormals.push(g[t].faceNormals[i].clone());this.morphNormals.push(v)}var b=e.skinWeights;for(t=0,n=b.length;t<n;t++)this.skinWeights.push(b[t].clone());var w=e.skinIndices;for(t=0,n=w.length;t<n;t++)this.skinIndices.push(w[t].clone());var _=e.lineDistances;for(t=0,n=_.length;t<n;t++)this.lineDistances.push(_[t]);var M=e.boundingBox;null!==M&&(this.boundingBox=M.clone());var S=e.boundingSphere;return null!==S&&(this.boundingSphere=S.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class H_ extends f_{constructor(e,t,n,i,r,a){super(),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;e=e||1,t=t||1,n=n||1,i=Math.floor(i)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;const s=[],l=[],c=[],h=[];let u=0,p=0;function d(e,t,n,i,r,a,d,f,m,g,v){const y=a/m,x=d/g,b=a/2,w=d/2,_=f/2,M=m+1,S=g+1;let T=0,E=0;const A=new Mb;for(let a=0;a<S;a++){const o=a*x-w;for(let s=0;s<M;s++){const u=s*y-b;A[e]=u*i,A[t]=o*r,A[n]=_,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=f>0?1:-1,c.push(A.x,A.y,A.z),h.push(s/m),h.push(1-a/g),T+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){const n=u+t+M*e,i=u+t+M*(e+1),r=u+(t+1)+M*(e+1),a=u+(t+1)+M*e;s.push(n,i,a),s.push(i,r,a),E+=6}o.addGroup(p,E,v),p+=E,u+=T}d("z","y","x",-1,-1,n,t,e,a,r,0),d("z","y","x",1,-1,n,t,-e,a,r,1),d("x","z","y",1,1,e,n,t,i,a,2),d("x","z","y",1,-1,e,n,-t,i,a,3),d("x","y","z",1,-1,e,t,n,i,r,4),d("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(s),this.setAttribute("position",new i_(l,3)),this.setAttribute("normal",new i_(c,3)),this.setAttribute("uv",new i_(h,2))}}function G_(e){var t={};for(var n in e)for(var i in t[n]={},e[n]){var r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}return t}function k_(e){for(var t={},n=0;n<e.length;n++){var i=G_(e[n]);for(var r in i)t[r]=i[r]}return t}var V_={clone:G_,merge:k_};function j_(e){qw.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function W_(){Jb.call(this),this.type="Camera",this.matrixWorldInverse=new Cb,this.projectionMatrix=new Cb,this.projectionMatrixInverse=new Cb}function q_(e,t,n,i){W_.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}j_.prototype=Object.create(qw.prototype),j_.prototype.constructor=j_,j_.prototype.isShaderMaterial=!0,j_.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=G_(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this},j_.prototype.toJSON=function(e){var t=qw.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var r={};for(var a in this.extensions)!0===this.extensions[a]&&(r[a]=!0);return Object.keys(r).length>0&&(t.extensions=r),t},W_.prototype=Object.assign(Object.create(Jb.prototype),{constructor:W_,isCamera:!0,copy:function(e,t){return Jb.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new Mb),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){Jb.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){Jb.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),q_.prototype=Object.assign(Object.create(W_.prototype),{constructor:q_,isPerspectiveCamera:!0,copy:function(e,t){return W_.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*ub.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*ub.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*ub.RAD2DEG*Math.atan(Math.tan(.5*ub.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*ub.DEG2RAD*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(r+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Jb.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});function X_(e,t,n){if(Jb.call(this),this.type="CubeCamera",!0===n.isWebGLCubeRenderTarget){this.renderTarget=n;var i=new q_(90,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new Mb(1,0,0)),this.add(i);var r=new q_(90,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new Mb(-1,0,0)),this.add(r);var a=new q_(90,1,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new Mb(0,1,0)),this.add(a);var o=new q_(90,1,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new Mb(0,-1,0)),this.add(o);var s=new q_(90,1,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new Mb(0,0,1)),this.add(s);var l=new q_(90,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new Mb(0,0,-1)),this.add(l),this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var c=e.xr.enabled,h=e.getRenderTarget();e.xr.enabled=!1;var u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=u,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(h),e.xr.enabled=c},this.clear=function(e,t,i,r){for(var a=e.getRenderTarget(),o=0;o<6;o++)e.setRenderTarget(n,o),e.clear(t,i,r);e.setRenderTarget(a)}}else console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")}function Y_(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),yb.call(this,e,e,t)}function J_(e,t,n,i,r,a,o,s,l,c,h,u){gb.call(this,null,a,o,s,l,c,i,r,h,u),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==l?l:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}X_.prototype=Object.create(Jb.prototype),X_.prototype.constructor=X_,Y_.prototype=Object.create(yb.prototype),Y_.prototype.constructor=Y_,Y_.prototype.isWebGLCubeRenderTarget=!0,Y_.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new Zb,i={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include <begin_vertex>","\t#include <project_vertex>","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#include <common>","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV = equirectUv( direction );","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},r=new j_({type:"CubemapFromEquirect",uniforms:G_(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;var a=new O_(new H_(5,5,5),r);return n.add(a),new X_(1,10,this).update(e,n),a.geometry.dispose(),a.material.dispose(),this},J_.prototype=Object.create(gb.prototype),J_.prototype.constructor=J_,J_.prototype.isDataTexture=!0;var Z_=new dw,K_=new Mb;function Q_(e,t,n,i,r,a){this.planes=[void 0!==e?e:new Tw,void 0!==t?t:new Tw,void 0!==n?n:new Tw,void 0!==i?i:new Tw,void 0!==r?r:new Tw,void 0!==a?a:new Tw]}Object.assign(Q_.prototype,{set:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],h=n[7],u=n[8],p=n[9],d=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return t[0].setComponents(o-i,h-s,f-u,y-m).normalize(),t[1].setComponents(o+i,h+s,f+u,y+m).normalize(),t[2].setComponents(o+r,h+l,f+p,y+g).normalize(),t[3].setComponents(o-r,h-l,f-p,y-g).normalize(),t[4].setComponents(o-a,h-c,f-d,y-v).normalize(),t[5].setComponents(o+a,h+c,f+d,y+v).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Z_.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Z_)},intersectsSprite:function(e){return Z_.center.set(0,0,0),Z_.radius=.7071067811865476,Z_.applyMatrix4(e.matrixWorld),this.intersectsSphere(Z_)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(n)<i)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var i=t[n];if(K_.x=i.normal.x>0?e.max.x:e.min.x,K_.y=i.normal.y>0?e.max.y:e.min.y,K_.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(K_)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var $_={common:{diffuse:{value:new Hw(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new db},uv2Transform:{value:new db},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new pb(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Hw(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Hw(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new db}},sprite:{diffuse:{value:new Hw(15658734)},opacity:{value:1},center:{value:new pb(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new db}}};function eM(){var e=null,t=!1,n=null;function i(r,a){!1!==t&&(n(r,a),e.requestAnimationFrame(i))}return{start:function(){!0!==t&&null!==n&&(e.requestAnimationFrame(i),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function tM(e,t){var n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){t.isInterleavedBufferAttribute&&(t=t.data);var a=i.get(t);void 0===a?i.set(t,function(t,n){var i=t.array,r=t.usage,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,i,r),t.onUploadCallback();var o=5126;return i instanceof Float32Array?o=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?o=5123:i instanceof Int16Array?o=5122:i instanceof Uint32Array?o=5125:i instanceof Int32Array?o=5124:i instanceof Int8Array?o=5120:i instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(t,r)):a.version<t.version&&(!function(t,i,r){var a=i.array,o=i.updateRange;e.bindBuffer(r,t),-1===o.count?e.bufferSubData(r,0,a):(n?e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(a.buffer,t,r),a.version=t.version)}}}function nM(e,t,n,i){B_.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new iM(e,t,n,i)),this.mergeVertices()}function iM(e,t,n,i){f_.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};var r,a,o=(e=e||1)/2,s=(t=t||1)/2,l=Math.floor(n)||1,c=Math.floor(i)||1,h=l+1,u=c+1,p=e/l,d=t/c,f=[],m=[],g=[],v=[];for(a=0;a<u;a++){var y=a*d-s;for(r=0;r<h;r++){var x=r*p-o;m.push(x,-y,0),g.push(0,0,1),v.push(r/l),v.push(1-a/c)}}for(a=0;a<c;a++)for(r=0;r<l;r++){var b=r+h*a,w=r+h*(a+1),_=r+1+h*(a+1),M=r+1+h*a;f.push(b,w,M),f.push(w,_,M)}this.setIndex(f),this.setAttribute("position",new i_(m,3)),this.setAttribute("normal",new i_(g,3)),this.setAttribute("uv",new i_(v,2))}nM.prototype=Object.create(B_.prototype),nM.prototype.constructor=nM,iM.prototype=Object.create(f_.prototype),iM.prototype.constructor=iM;var rM={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\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\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",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",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#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; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\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 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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return 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}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) {\n uv = vec2(-direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) {\n uv = vec2(-direction.x, direction.y) / abs(direction.z); } else if (face == 3.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) {\n uv = vec2(-direction.x, direction.z) / abs(direction.y); } else {\n uv = vec2(direction.x, direction.y) / abs(direction.z); }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif",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",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\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}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\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#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\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",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\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",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\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",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\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",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV = equirectUv( reflectVec );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",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",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",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 texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",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 GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\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\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\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\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\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\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",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.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_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_Diffuse_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 CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * 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}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\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\tgetPointDirectLightIrradiance( 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 *= all( bvec2( 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\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\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ 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\tgetDirectionalDirectLightIrradiance( 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 *= all( bvec2( 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 );\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 );\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",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",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",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",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",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",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",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",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}\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 linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",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;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",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",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#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#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ 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#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\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\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",shadowmap_pars_vertex:"#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#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ 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#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",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, vSpotShadowCoord[ 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}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",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",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",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\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",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"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}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\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}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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 <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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 <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\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\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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 <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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 <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#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\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\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 <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#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\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#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\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#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\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\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 <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\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 <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},aM={basic:{uniforms:k_([$_.common,$_.specularmap,$_.envmap,$_.aomap,$_.lightmap,$_.fog]),vertexShader:rM.meshbasic_vert,fragmentShader:rM.meshbasic_frag},lambert:{uniforms:k_([$_.common,$_.specularmap,$_.envmap,$_.aomap,$_.lightmap,$_.emissivemap,$_.fog,$_.lights,{emissive:{value:new Hw(0)}}]),vertexShader:rM.meshlambert_vert,fragmentShader:rM.meshlambert_frag},phong:{uniforms:k_([$_.common,$_.specularmap,$_.envmap,$_.aomap,$_.lightmap,$_.emissivemap,$_.bumpmap,$_.normalmap,$_.displacementmap,$_.fog,$_.lights,{emissive:{value:new Hw(0)},specular:{value:new Hw(1118481)},shininess:{value:30}}]),vertexShader:rM.meshphong_vert,fragmentShader:rM.meshphong_frag},standard:{uniforms:k_([$_.common,$_.envmap,$_.aomap,$_.lightmap,$_.emissivemap,$_.bumpmap,$_.normalmap,$_.displacementmap,$_.roughnessmap,$_.metalnessmap,$_.fog,$_.lights,{emissive:{value:new Hw(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:rM.meshphysical_vert,fragmentShader:rM.meshphysical_frag},toon:{uniforms:k_([$_.common,$_.specularmap,$_.aomap,$_.lightmap,$_.emissivemap,$_.bumpmap,$_.normalmap,$_.displacementmap,$_.gradientmap,$_.fog,$_.lights,{emissive:{value:new Hw(0)},specular:{value:new Hw(1118481)},shininess:{value:30}}]),vertexShader:rM.meshtoon_vert,fragmentShader:rM.meshtoon_frag},matcap:{uniforms:k_([$_.common,$_.bumpmap,$_.normalmap,$_.displacementmap,$_.fog,{matcap:{value:null}}]),vertexShader:rM.meshmatcap_vert,fragmentShader:rM.meshmatcap_frag},points:{uniforms:k_([$_.points,$_.fog]),vertexShader:rM.points_vert,fragmentShader:rM.points_frag},dashed:{uniforms:k_([$_.common,$_.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:rM.linedashed_vert,fragmentShader:rM.linedashed_frag},depth:{uniforms:k_([$_.common,$_.displacementmap]),vertexShader:rM.depth_vert,fragmentShader:rM.depth_frag},normal:{uniforms:k_([$_.common,$_.bumpmap,$_.normalmap,$_.displacementmap,{opacity:{value:1}}]),vertexShader:rM.normal_vert,fragmentShader:rM.normal_frag},sprite:{uniforms:k_([$_.sprite,$_.fog]),vertexShader:rM.sprite_vert,fragmentShader:rM.sprite_frag},background:{uniforms:{uvTransform:{value:new db},t2D:{value:null}},vertexShader:rM.background_vert,fragmentShader:rM.background_frag},cube:{uniforms:k_([$_.envmap,{opacity:{value:1}}]),vertexShader:rM.cube_vert,fragmentShader:rM.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:rM.equirect_vert,fragmentShader:rM.equirect_frag},distanceRGBA:{uniforms:k_([$_.common,$_.displacementmap,{referencePosition:{value:new Mb},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:rM.distanceRGBA_vert,fragmentShader:rM.distanceRGBA_frag},shadow:{uniforms:k_([$_.lights,$_.fog,{color:{value:new Hw(0)},opacity:{value:1}}]),vertexShader:rM.shadow_vert,fragmentShader:rM.shadow_frag}};function oM(e,t,n,i){var r,a,o=new Hw(0),s=0,l=null,c=0,h=null;function u(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,i)}return{getClearColor:function(){return o},setClearColor:function(e,t){o.set(e),u(o,s=void 0!==t?t:1)},getClearAlpha:function(){return s},setClearAlpha:function(e){u(o,s=e)},render:function(t,i,p,d){var f=i.background,m=e.xr,g=m.getSession&&m.getSession();if(g&&"additive"===g.environmentBlendMode&&(f=null),null===f?u(o,s):f&&f.isColor&&(u(f,1),d=!0),(e.autoClear||d)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||f.isWebGLCubeRenderTarget||306===f.mapping)){void 0===a&&((a=new O_(new H_(1,1,1),new j_({type:"BackgroundCubeMaterial",uniforms:G_(aM.cube.uniforms),vertexShader:aM.cube.vertexShader,fragmentShader:aM.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(a));var v=f.isWebGLCubeRenderTarget?f.texture:f;a.material.uniforms.envMap.value=v,a.material.uniforms.flipEnvMap.value=v.isCubeTexture?-1:1,l===f&&c===v.version&&h===e.toneMapping||(a.material.needsUpdate=!0,l=f,c=v.version,h=e.toneMapping),t.unshift(a,a.geometry,a.material,0,0,null)}else f&&f.isTexture&&(void 0===r&&((r=new O_(new iM(2,2),new j_({type:"BackgroundMaterial",uniforms:G_(aM.background.uniforms),vertexShader:aM.background.vertexShader,fragmentShader:aM.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(r.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(r)),r.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),r.material.uniforms.uvTransform.value.copy(f.matrix),l===f&&c===f.version&&h===e.toneMapping||(r.material.needsUpdate=!0,l=f,c=f.version,h=e.toneMapping),t.unshift(r,r.geometry,r.material,0,0,null))}}}function sM(e,t,n,i){var r,a=i.isWebGL2;this.setMode=function(e){r=e},this.render=function(t,i){e.drawArrays(r,t,i),n.update(i,r)},this.renderInstances=function(i,o,s,l){if(0!==l){var c,h;if(a)c=e,h="drawArraysInstanced";else if(h="drawArraysInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](r,o,s,l),n.update(s,r,l)}}}function lM(e,t,n){var i;function r(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),u=e.getParameter(3379),p=e.getParameter(34076),d=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),v=h>0,y=a||!!t.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:a?e.getParameter(36183):0}}function cM(){var e=this,t=null,n=0,i=!1,r=!1,a=new Tw,o=new db,s={value:null,needsUpdate:!1};function l(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function c(t,n,i,r){var l=null!==t?t.length:0,c=null;if(0!==l){if(c=s.value,!0!==r||null===c){var h=i+4*l,u=n.matrixWorldInverse;o.getNormalMatrix(u),(null===c||c.length<h)&&(c=new Float32Array(h));for(var p=0,d=i;p!==l;++p,d+=4)a.copy(t[p]).applyMatrix4(u,o),a.normal.toArray(c,d),c[d+3]=a.constant}s.value=c,s.needsUpdate=!0}return e.numPlanes=l,e.numIntersection=0,c}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,r,a){var o=0!==e.length||r||0!==n||i;return i=r,t=c(e,a,0),n=e.length,o},this.beginShadows=function(){r=!0,c(null)},this.endShadows=function(){r=!1,l()},this.setState=function(e,a,o,h,u,p){if(!i||null===e||0===e.length||r&&!o)r?c(null):l();else{var d=r?0:n,f=4*d,m=u.clippingState||null;s.value=m,m=c(e,h,f,p);for(var g=0;g!==f;++g)m[g]=t[g];u.clippingState=m,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=d}}}function hM(e){var t={};return{get:function(n){if(void 0!==t[n])return t[n];var i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=i,i}}}function uM(e,t,n){var i=new WeakMap,r=new WeakMap;function a(e){var o=e.target,s=i.get(o);for(var l in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[l]);o.removeEventListener("dispose",a),i.delete(o);var c=r.get(s);c&&(t.remove(c),r.delete(s)),n.memory.geometries--}function o(e){var n=[],i=e.index,a=e.attributes.position,o=0;if(null!==i){var s=i.array;o=i.version;for(var l=0,c=s.length;l<c;l+=3){var h=s[l+0],u=s[l+1],p=s[l+2];n.push(h,u,u,p,p,h)}}else{s=a.array;o=a.version;for(l=0,c=s.length/3-1;l<c;l+=3){h=l+0,u=l+1,p=l+2;n.push(h,u,u,p,p,h)}}var d=new(o_(n)>65535?n_:e_)(n,1);d.version=o,t.update(d,34963);var f=r.get(e);f&&t.remove(f),r.set(e,d)}return{get:function(e,t){var r=i.get(t);return r||(t.addEventListener("dispose",a),t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new f_).setFromObject(e)),r=t._bufferGeometry),i.set(t,r),n.memory.geometries++,r)},update:function(e){var n=e.index,i=e.attributes;for(var r in null!==n&&t.update(n,34963),i)t.update(i[r],34962);var a=e.morphAttributes;for(var r in a)for(var o=a[r],s=0,l=o.length;s<l;s++)t.update(o[s],34962)},getWireframeAttribute:function(e){var t=r.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&o(e)}else o(e);return r.get(e)}}}function pM(e,t,n,i){var r,a,o,s=i.isWebGL2;this.setMode=function(e){r=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,i){e.drawElements(r,i,a,t*o),n.update(i,r)},this.renderInstances=function(i,l,c,h){if(0!==h){var u,p;if(s)u=e,p="drawElementsInstanced";else if(p="drawElementsInstancedANGLE",null===(u=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[p](r,c,a,l*o,h),n.update(c,r,h)}}}function dM(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,i){switch(i=i||1,t.calls++,n){case 4:t.triangles+=i*(e/3);break;case 1:t.lines+=i*(e/2);break;case 3:t.lines+=i*(e-1);break;case 2:t.lines+=i*e;break;case 0:t.points+=i*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function fM(e,t){return Math.abs(t[1])-Math.abs(e[1])}function mM(e){var t={},n=new Float32Array(8);return{update:function(i,r,a,o){var s=i.morphTargetInfluences,l=void 0===s?0:s.length,c=t[r.id];if(void 0===c){c=[];for(var h=0;h<l;h++)c[h]=[h,0];t[r.id]=c}var u=a.morphTargets&&r.morphAttributes.position,p=a.morphNormals&&r.morphAttributes.normal;for(h=0;h<l;h++){0!==(f=c[h])[1]&&(u&&r.deleteAttribute("morphTarget"+h),p&&r.deleteAttribute("morphNormal"+h))}for(h=0;h<l;h++){(f=c[h])[0]=h,f[1]=s[h]}c.sort(fM);var d=0;for(h=0;h<8;h++){var f;if(f=c[h]){var m=f[0],g=f[1];if(g){u&&r.setAttribute("morphTarget"+h,u[m]),p&&r.setAttribute("morphNormal"+h,p[m]),n[h]=g,d+=g;continue}}n[h]=0}var v=r.morphTargetsRelative?1:1-d;o.getUniforms().setValue(e,"morphTargetBaseInfluence",v),o.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function gM(e,t,n,i){var r=new WeakMap;return{update:function(e){var a=i.render.frame,o=e.geometry,s=t.get(e,o);return r.get(s)!==a&&(o.isGeometry&&s.updateFromObject(e),t.update(s),r.set(s,a)),e.isInstancedMesh&&n.update(e.instanceMatrix,34962),s},dispose:function(){r=new WeakMap}}}function vM(e,t,n,i,r,a,o,s,l,c){e=void 0!==e?e:[],t=void 0!==t?t:301,o=void 0!==o?o:1022,gb.call(this,e,t,n,i,r,a,o,s,l,c),this.flipY=!1}function yM(e,t,n,i){gb.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function xM(e,t,n,i){gb.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}aM.physical={uniforms:k_([aM.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new pb(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new Hw(0)},transparency:{value:0}}]),vertexShader:rM.meshphysical_vert,fragmentShader:rM.meshphysical_frag},vM.prototype=Object.create(gb.prototype),vM.prototype.constructor=vM,vM.prototype.isCubeTexture=!0,Object.defineProperty(vM.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),yM.prototype=Object.create(gb.prototype),yM.prototype.constructor=yM,yM.prototype.isDataTexture2DArray=!0,xM.prototype=Object.create(gb.prototype),xM.prototype.constructor=xM,xM.prototype.isDataTexture3D=!0;var bM=new gb,wM=new yM,_M=new xM,MM=new vM,SM=[],TM=[],EM=new Float32Array(16),AM=new Float32Array(9),LM=new Float32Array(4);function RM(e,t,n){var i=e[0];if(i<=0||i>0)return e;var r=t*n,a=SM[r];if(void 0===a&&(a=new Float32Array(r),SM[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function PM(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function CM(e,t){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]}function OM(e,t){var n=TM[t];void 0===n&&(n=new Int32Array(t),TM[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function IM(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function DM(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(PM(n,t))return;e.uniform2fv(this.addr,t),CM(n,t)}}function NM(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(PM(n,t))return;e.uniform3fv(this.addr,t),CM(n,t)}}function zM(e,t){var n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(PM(n,t))return;e.uniform4fv(this.addr,t),CM(n,t)}}function UM(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(PM(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),CM(n,t)}else{if(PM(n,i))return;LM.set(i),e.uniformMatrix2fv(this.addr,!1,LM),CM(n,i)}}function FM(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(PM(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),CM(n,t)}else{if(PM(n,i))return;AM.set(i),e.uniformMatrix3fv(this.addr,!1,AM),CM(n,i)}}function BM(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(PM(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),CM(n,t)}else{if(PM(n,i))return;EM.set(i),e.uniformMatrix4fv(this.addr,!1,EM),CM(n,i)}}function HM(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(t||bM,r)}function GM(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||wM,r)}function kM(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||_M,r)}function VM(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(t||MM,r)}function jM(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function WM(e,t){var n=this.cache;PM(n,t)||(e.uniform2iv(this.addr,t),CM(n,t))}function qM(e,t){var n=this.cache;PM(n,t)||(e.uniform3iv(this.addr,t),CM(n,t))}function XM(e,t){var n=this.cache;PM(n,t)||(e.uniform4iv(this.addr,t),CM(n,t))}function YM(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function JM(e,t){e.uniform1fv(this.addr,t)}function ZM(e,t){e.uniform1iv(this.addr,t)}function KM(e,t){e.uniform2iv(this.addr,t)}function QM(e,t){e.uniform3iv(this.addr,t)}function $M(e,t){e.uniform4iv(this.addr,t)}function eS(e,t){var n=RM(t,this.size,2);e.uniform2fv(this.addr,n)}function tS(e,t){var n=RM(t,this.size,3);e.uniform3fv(this.addr,n)}function nS(e,t){var n=RM(t,this.size,4);e.uniform4fv(this.addr,n)}function iS(e,t){var n=RM(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function rS(e,t){var n=RM(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function aS(e,t){var n=RM(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function oS(e,t,n){var i=t.length,r=OM(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.safeSetTexture2D(t[a]||bM,r[a])}function sS(e,t,n){var i=t.length,r=OM(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.safeSetTextureCube(t[a]||MM,r[a])}function lS(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return IM;case 35664:return DM;case 35665:return NM;case 35666:return zM;case 35674:return UM;case 35675:return FM;case 35676:return BM;case 5124:case 35670:return jM;case 35667:case 35671:return WM;case 35668:case 35672:return qM;case 35669:case 35673:return XM;case 5125:return YM;case 35678:case 36198:case 36298:case 36306:case 35682:return HM;case 35679:case 36299:case 36307:return kM;case 35680:case 36300:case 36308:case 36293:return VM;case 36289:case 36303:case 36311:case 36292:return GM}}(t.type)}function cS(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return JM;case 35664:return eS;case 35665:return tS;case 35666:return nS;case 35674:return iS;case 35675:return rS;case 35676:return aS;case 5124:case 35670:return ZM;case 35667:case 35671:return KM;case 35668:case 35672:return QM;case 35669:case 35673:return $M;case 35678:case 36198:case 36298:case 36306:case 35682:return oS;case 35680:case 36300:case 36308:case 36293:return sS}}(t.type)}function hS(e){this.id=e,this.seq=[],this.map={}}cS.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),CM(t,e)},hS.prototype.setValue=function(e,t,n){for(var i=this.seq,r=0,a=i.length;r!==a;++r){var o=i[r];o.setValue(e,t[o.id],n)}};var uS=/([\w\d_]+)(\])?(\[|\.)?/g;function pS(e,t){e.seq.push(t),e.map[t.id]=t}function dS(e,t,n){var i=e.name,r=i.length;for(uS.lastIndex=0;;){var a=uS.exec(i),o=uS.lastIndex,s=a[1],l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===r){pS(n,void 0===c?new lS(s,e,t):new cS(s,e,t));break}var h=n.map[s];void 0===h&&pS(n,h=new hS(s)),n=h}}function fS(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),i=0;i<n;++i){var r=e.getActiveUniform(t,i);dS(r,e.getUniformLocation(t,r.name),this)}}function mS(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}fS.prototype.setValue=function(e,t,n,i){var r=this.map[t];void 0!==r&&r.setValue(e,n,i)},fS.prototype.setOptional=function(e,t,n){var i=t[n];void 0!==i&&this.setValue(e,n,i)},fS.upload=function(e,t,n,i){for(var r=0,a=t.length;r!==a;++r){var o=t[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,i)}},fS.seqWithValue=function(e,t){for(var n=[],i=0,r=e.length;i!==r;++i){var a=e[i];a.id in t&&n.push(a)}return n};var gS=0;function vS(e){switch(e){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:throw new Error("unsupported encoding: "+e)}}function yS(e,t,n){var i=e.getShaderParameter(t,35713),r=e.getShaderInfoLog(t).trim();return i&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+r+function(e){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(e.getShaderSource(t))}function xS(e,t){var n=vS(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function bS(e,t){var n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="Uncharted2";break;case 4:n="OptimizedCineon";break;case 5:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function wS(e){return""!==e}function _S(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function MS(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var SS=/^[ \t]*#include +<([\w\d./]+)>/gm;function TS(e){return e.replace(SS,ES)}function ES(e,t){var n=rM[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return TS(n)}var AS=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,LS=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g;function RS(e){return e.replace(LS,CS).replace(AS,PS)}function PS(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),CS(e,t,n,i)}function CS(e,t,n,i){for(var r="",a=parseInt(t);a<parseInt(n);a++)r+=i.replace(/\[ i \]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function OS(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function IS(e,t,n){var i,r,a,o,s,l=e.getContext(),c=n.defines,h=n.vertexShader,u=n.fragmentShader,p=function(e){var t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),d=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:case 307:t="ENVMAP_TYPE_CUBE_UV";break;case 303:case 304:t="ENVMAP_TYPE_EQUIREC";break;case 305:t="ENVMAP_TYPE_SPHERE"}return t}(n),f=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case 302:case 304:t="ENVMAP_MODE_REFRACTION"}return t}(n),m=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),g=e.gammaFactor>0?e.gammaFactor:1,v=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(wS).join("\n")}(n),y=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(c),x=l.createProgram();if(n.isRawShaderMaterial?((i=[y].filter(wS).join("\n")).length>0&&(i+="\n"),(r=[v,y].filter(wS).join("\n")).length>0&&(r+="\n")):(i=[OS(n),"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+g,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+p:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.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"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\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(wS).join("\n"),r=[v,OS(n),"#define SHADER_NAME "+n.shaderName,y,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",n.envMap?"#define "+m:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+p:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?rM.tonemapping_pars_fragment:"",0!==n.toneMapping?bS("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?rM.encodings_pars_fragment:"",n.mapEncoding?xS("mapTexelToLinear",n.mapEncoding):"",n.matcapEncoding?xS("matcapTexelToLinear",n.matcapEncoding):"",n.envMapEncoding?xS("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?xS("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMapEncoding?xS("lightMapTexelToLinear",n.lightMapEncoding):"",n.outputEncoding?(a="linearToOutputTexel",o=n.outputEncoding,s=vS(o),"vec4 "+a+"( vec4 value ) { return LinearTo"+s[0]+s[1]+"; }"):"",n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(wS).join("\n")),h=MS(h=_S(h=TS(h),n),n),u=MS(u=_S(u=TS(u),n),n),h=RS(h),u=RS(u),n.isWebGL2&&!n.isRawShaderMaterial){var b=!1,w=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&null!==h.match(w)&&null!==u.match(w)&&(b=!0,h=h.replace(w,""),u=u.replace(w,"")),i=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,r=["#version 300 es\n","#define varying in",b?"":"out highp vec4 pc_fragColor;",b?"":"#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"+r}var _,M,S=r+u,T=mS(l,35633,i+h),E=mS(l,35632,S);if(l.attachShader(x,T),l.attachShader(x,E),void 0!==n.index0AttributeName?l.bindAttribLocation(x,0,n.index0AttributeName):!0===n.morphTargets&&l.bindAttribLocation(x,0,"position"),l.linkProgram(x),e.debug.checkShaderErrors){var A=l.getProgramInfoLog(x).trim(),L=l.getShaderInfoLog(T).trim(),R=l.getShaderInfoLog(E).trim(),P=!0,C=!0;if(!1===l.getProgramParameter(x,35714)){P=!1;var O=yS(l,T,"vertex"),I=yS(l,E,"fragment");console.error("THREE.WebGLProgram: shader error: ",l.getError(),"35715",l.getProgramParameter(x,35715),"gl.getProgramInfoLog",A,O,I)}else""!==A?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",A):""!==L&&""!==R||(C=!1);C&&(this.diagnostics={runnable:P,programLog:A,vertexShader:{log:L,prefix:i},fragmentShader:{log:R,prefix:r}})}return l.deleteShader(T),l.deleteShader(E),this.getUniforms=function(){return void 0===_&&(_=new fS(l,x)),_},this.getAttributes=function(){return void 0===M&&(M=function(e,t){for(var n={},i=e.getProgramParameter(t,35721),r=0;r<i;r++){var a=e.getActiveAttrib(t,r).name;n[a]=e.getAttribLocation(t,a)}return n}(l,x)),M},this.destroy=function(){l.deleteProgram(x),this.program=void 0},this.name=n.shaderName,this.id=gS++,this.cacheKey=t,this.usedTimes=1,this.program=x,this.vertexShader=T,this.fragmentShader=E,this}function DS(e,t,n){var i=[],r=n.isWebGL2,a=n.logarithmicDepthBuffer,o=n.floatVertexTextures,s=n.precision,l=n.maxVertexUniforms,c=n.vertexTextures,h={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},u=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen"];function p(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=3e3,t}this.getParameters=function(i,u,d,f,m,g,v){var y=f.fog,x=i.isMeshStandardMaterial?f.environment:null,b=i.envMap||x,w=h[i.type],_=v.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(o)return 1024;var n=l,i=Math.floor((n-20)/4),r=Math.min(i,t.length);return r<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+r+"."),0):r}(v):0;null!==i.precision&&(s=n.getMaxPrecision(i.precision))!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",s,"instead.");var M=function(e,t){var n;if(t){var i=aM[t];n={name:e.type,uniforms:V_.clone(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader}}else n={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};return n}(i,w);i.onBeforeCompile(M,e);var S=e.getRenderTarget();return{isWebGL2:r,shaderID:w,shaderName:M.name,uniforms:M.uniforms,vertexShader:M.vertexShader,fragmentShader:M.fragmentShader,defines:i.defines,isRawShaderMaterial:i.isRawShaderMaterial,isShaderMaterial:i.isShaderMaterial,precision:s,instancing:!0===v.isInstancedMesh,supportsVertexTextures:c,outputEncoding:null!==S?p(S.texture):e.outputEncoding,map:!!i.map,mapEncoding:p(i.map),matcap:!!i.matcap,matcapEncoding:p(i.matcap),envMap:!!b,envMapMode:b&&b.mapping,envMapEncoding:p(b),envMapCubeUV:!!b&&(306===b.mapping||307===b.mapping),lightMap:!!i.lightMap,lightMapEncoding:p(i.lightMap),aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:p(i.emissiveMap),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,objectSpaceNormalMap:1===i.normalMapType,tangentSpaceNormalMap:0===i.normalMapType,clearcoatMap:!!i.clearcoatMap,clearcoatRoughnessMap:!!i.clearcoatRoughnessMap,clearcoatNormalMap:!!i.clearcoatNormalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,gradientMap:!!i.gradientMap,sheen:!!i.sheen,combine:i.combine,vertexTangents:i.normalMap&&i.vertexTangents,vertexColors:i.vertexColors,vertexUvs:!!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatMap||i.clearcoatRoughnessMap||i.clearcoatNormalMap||i.displacementMap),uvsVertexOnly:!(i.map||i.bumpMap||i.normalMap||i.specularMap||i.alphaMap||i.emissiveMap||i.roughnessMap||i.metalnessMap||i.clearcoatNormalMap||!i.displacementMap),fog:!!y,useFog:i.fog,fogExp2:y&&y.isFogExp2,flatShading:i.flatShading,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:a,skinning:i.skinning&&_>0,maxBones:_,useVertexTexture:o,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:u.directional.length,numPointLights:u.point.length,numSpotLights:u.spot.length,numRectAreaLights:u.rectArea.length,numHemiLights:u.hemi.length,numDirLightShadows:u.directionalShadowMap.length,numPointLightShadows:u.pointShadowMap.length,numSpotLightShadows:u.spotShadowMap.length,numClippingPlanes:m,numClipIntersection:g,dithering:i.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:i.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:2===i.side,flipSided:1===i.side,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:r||null!==t.get("EXT_frag_depth"),rendererExtensionDrawBuffers:r||null!==t.get("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:r||null!==t.get("EXT_shader_texture_lod"),onBeforeCompile:i.onBeforeCompile}},this.getProgramCacheKey=function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);if(void 0===t.isRawShaderMaterial){for(var r=0;r<u.length;r++)n.push(t[u[r]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.onBeforeCompile.toString()),n.join()},this.acquireProgram=function(t,n){for(var r,a=0,o=i.length;a<o;a++){var s=i[a];if(s.cacheKey===n){++(r=s).usedTimes;break}}return void 0===r&&(r=new IS(e,n,t),i.push(r)),r},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=i.indexOf(e);i[t]=i[i.length-1],i.pop(),e.destroy()}},this.programs=i}function NS(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function zS(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function US(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function FS(){var e=[],t=0,n=[],i=[],r={id:-1};function a(n,i,a,o,s,l){var c=e[t];return void 0===c?(c={id:n.id,object:n,geometry:i,material:a,program:a.program||r,groupOrder:o,renderOrder:n.renderOrder,z:s,group:l},e[t]=c):(c.id=n.id,c.object=n,c.geometry=i,c.material=a,c.program=a.program||r,c.groupOrder=o,c.renderOrder=n.renderOrder,c.z=s,c.group=l),t++,c}return{opaque:n,transparent:i,init:function(){t=0,n.length=0,i.length=0},push:function(e,t,r,o,s,l){var c=a(e,t,r,o,s,l);(!0===r.transparent?i:n).push(c)},unshift:function(e,t,r,o,s,l){var c=a(e,t,r,o,s,l);(!0===r.transparent?i:n).unshift(c)},finish:function(){for(var n=t,i=e.length;n<i;n++){var r=e[n];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.program=null,r.group=null}},sort:function(e,t){n.length>1&&n.sort(e||zS),i.length>1&&i.sort(t||US)}}}function BS(){var e=new WeakMap;function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}return{get:function(n,i){var r,a=e.get(n);return void 0===a?(r=new FS,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):void 0===(r=a.get(i))&&(r=new FS,a.set(i,r)),r},dispose:function(){e=new WeakMap}}}function HS(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new Mb,color:new Hw};break;case"SpotLight":n={position:new Mb,direction:new Mb,color:new Hw,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Mb,color:new Hw,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Mb,skyColor:new Hw,groundColor:new Hw};break;case"RectAreaLight":n={color:new Hw,position:new Mb,halfWidth:new Mb,halfHeight:new Mb}}return e[t.id]=n,n}}}var GS=0;function kS(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function VS(){for(var e,t=new HS,n=(e={},{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new pb};break;case"PointLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new pb,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=0;r<9;r++)i.probe.push(new Mb);var a=new Mb,o=new Cb,s=new Cb;return{setup:function(e,r,l){for(var c=0,h=0,u=0,p=0;p<9;p++)i.probe[p].set(0,0,0);var d=0,f=0,m=0,g=0,v=0,y=0,x=0,b=0,w=l.matrixWorldInverse;e.sort(kS),p=0;for(var _=e.length;p<_;p++){var M=e[p],S=M.color,T=M.intensity,E=M.distance,A=M.shadow&&M.shadow.map?M.shadow.map.texture:null;if(M.isAmbientLight)c+=S.r*T,h+=S.g*T,u+=S.b*T;else if(M.isLightProbe)for(var L=0;L<9;L++)i.probe[L].addScaledVector(M.sh.coefficients[L],T);else if(M.isDirectionalLight){if((C=t.get(M)).color.copy(M.color).multiplyScalar(M.intensity),C.direction.setFromMatrixPosition(M.matrixWorld),a.setFromMatrixPosition(M.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(w),M.castShadow){var R=M.shadow;(P=n.get(M)).shadowBias=R.bias,P.shadowRadius=R.radius,P.shadowMapSize=R.mapSize,i.directionalShadow[d]=P,i.directionalShadowMap[d]=A,i.directionalShadowMatrix[d]=M.shadow.matrix,y++}i.directional[d]=C,d++}else if(M.isSpotLight){if((C=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(w),C.color.copy(S).multiplyScalar(T),C.distance=E,C.direction.setFromMatrixPosition(M.matrixWorld),a.setFromMatrixPosition(M.target.matrixWorld),C.direction.sub(a),C.direction.transformDirection(w),C.coneCos=Math.cos(M.angle),C.penumbraCos=Math.cos(M.angle*(1-M.penumbra)),C.decay=M.decay,M.castShadow){R=M.shadow;(P=n.get(M)).shadowBias=R.bias,P.shadowRadius=R.radius,P.shadowMapSize=R.mapSize,i.spotShadow[m]=P,i.spotShadowMap[m]=A,i.spotShadowMatrix[m]=M.shadow.matrix,b++}i.spot[m]=C,m++}else if(M.isRectAreaLight){(C=t.get(M)).color.copy(S).multiplyScalar(T),C.position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(w),s.identity(),o.copy(M.matrixWorld),o.premultiply(w),s.extractRotation(o),C.halfWidth.set(.5*M.width,0,0),C.halfHeight.set(0,.5*M.height,0),C.halfWidth.applyMatrix4(s),C.halfHeight.applyMatrix4(s),i.rectArea[g]=C,g++}else if(M.isPointLight){if((C=t.get(M)).position.setFromMatrixPosition(M.matrixWorld),C.position.applyMatrix4(w),C.color.copy(M.color).multiplyScalar(M.intensity),C.distance=M.distance,C.decay=M.decay,M.castShadow){var P;R=M.shadow;(P=n.get(M)).shadowBias=R.bias,P.shadowRadius=R.radius,P.shadowMapSize=R.mapSize,P.shadowCameraNear=R.camera.near,P.shadowCameraFar=R.camera.far,i.pointShadow[f]=P,i.pointShadowMap[f]=A,i.pointShadowMatrix[f]=M.shadow.matrix,x++}i.point[f]=C,f++}else if(M.isHemisphereLight){var C;(C=t.get(M)).direction.setFromMatrixPosition(M.matrixWorld),C.direction.transformDirection(w),C.direction.normalize(),C.skyColor.copy(M.color).multiplyScalar(T),C.groundColor.copy(M.groundColor).multiplyScalar(T),i.hemi[v]=C,v++}}i.ambient[0]=c,i.ambient[1]=h,i.ambient[2]=u;var O=i.hash;O.directionalLength===d&&O.pointLength===f&&O.spotLength===m&&O.rectAreaLength===g&&O.hemiLength===v&&O.numDirectionalShadows===y&&O.numPointShadows===x&&O.numSpotShadows===b||(i.directional.length=d,i.spot.length=m,i.rectArea.length=g,i.point.length=f,i.hemi.length=v,i.directionalShadow.length=y,i.directionalShadowMap.length=y,i.pointShadow.length=x,i.pointShadowMap.length=x,i.spotShadow.length=b,i.spotShadowMap.length=b,i.directionalShadowMatrix.length=y,i.pointShadowMatrix.length=x,i.spotShadowMatrix.length=b,O.directionalLength=d,O.pointLength=f,O.spotLength=m,O.rectAreaLength=g,O.hemiLength=v,O.numDirectionalShadows=y,O.numPointShadows=x,O.numSpotShadows=b,i.version=GS++)},state:i}}function jS(){var e=new VS,t=[],n=[];return{init:function(){t.length=0,n.length=0},state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:function(i){e.setup(t,n,i)},pushLight:function(e){t.push(e)},pushShadow:function(e){n.push(e)}}}function WS(){var e=new WeakMap;function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}return{get:function(n,i){var r;return!1===e.has(n)?(r=new jS,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):!1===e.get(n).has(i)?(r=new jS,e.get(n).set(i,r)):r=e.get(n).get(i),r},dispose:function(){e=new WeakMap}}}function qS(e){qw.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function XS(e){qw.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Mb,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}qS.prototype=Object.create(qw.prototype),qS.prototype.constructor=qS,qS.prototype.isMeshDepthMaterial=!0,qS.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},XS.prototype=Object.create(qw.prototype),XS.prototype.constructor=XS,XS.prototype.isMeshDistanceMaterial=!0,XS.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};function YS(e,t,n){var i=new Q_,r=new pb,a=new pb,o=new vb,s=[],l=[],c={},h={0:1,1:0,2:2},u=new j_({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new pb},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=u.clone();p.defines.HORIZONAL_PASS=1;var d=new f_;d.setAttribute("position",new Jw(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var f=new O_(d,u),m=this;function g(n,i){var r=t.update(f);u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,u,f,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,p,f,null)}function v(e,t,n){var i=e<<0|t<<1|n<<2,r=s[i];return void 0===r&&(r=new qS({depthPacking:3201,morphTargets:e,skinning:t}),s[i]=r),r}function y(e,t,n){var i=e<<0|t<<1|n<<2,r=l[i];return void 0===r&&(r=new XS({morphTargets:e,skinning:t}),l[i]=r),r}function x(t,n,i,r,a,o,s){var l=null,u=v,p=t.customDepthMaterial;if(!0===r.isPointLight&&(u=y,p=t.customDistanceMaterial),void 0===p){var d=!1;!0===i.morphTargets&&(d=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var f=!1;!0===t.isSkinnedMesh&&(!0===i.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),l=u(d,f,!0===t.isInstancedMesh)}else l=p;if(e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var m=l.uuid,g=i.uuid,x=c[m];void 0===x&&(x={},c[m]=x);var b=x[g];void 0===b&&(b=l.clone(),x[g]=b),l=b}return l.visible=i.visible,l.wireframe=i.wireframe,l.side=3===s?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:h[i.side],l.clipShadows=i.clipShadows,l.clippingPlanes=i.clippingPlanes,l.clipIntersection=i.clipIntersection,l.wireframeLinewidth=i.wireframeLinewidth,l.linewidth=i.linewidth,!0===r.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(r.matrixWorld),l.nearDistance=a,l.farDistance=o),l}function b(n,r,a,o,s){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),c=n.material;if(Array.isArray(c))for(var h=l.groups,u=0,p=h.length;u<p;u++){var d=h[u],f=c[d.materialIndex];if(f&&f.visible){var m=x(n,l,f,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,m,n,d)}}else if(c.visible){m=x(n,l,c,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,m,n,null)}}for(var g=n.children,v=0,y=g.length;v<y;v++)b(g[v],r,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,s,l){if(!1!==m.enabled&&(!1!==m.autoUpdate||!1!==m.needsUpdate)&&0!==t.length){var c=e.getRenderTarget(),h=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),p=e.state;p.setBlending(0),p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);for(var d=0,f=t.length;d<f;d++){var v=t[d],y=v.shadow;if(void 0!==y){r.copy(y.mapSize);var x=y.getFrameExtents();if(r.multiply(x),a.copy(y.mapSize),(r.x>n||r.y>n)&&(r.x>n&&(a.x=Math.floor(n/x.x),r.x=a.x*x.x,y.mapSize.x=a.x),r.y>n&&(a.y=Math.floor(n/x.y),r.y=a.y*x.y,y.mapSize.y=a.y)),null===y.map&&!y.isPointLightShadow&&3===this.type){var w={minFilter:1006,magFilter:1006,format:1023};y.map=new yb(r.x,r.y,w),y.map.texture.name=v.name+".shadowMap",y.mapPass=new yb(r.x,r.y,w),y.camera.updateProjectionMatrix()}if(null===y.map){w={minFilter:1003,magFilter:1003,format:1023};y.map=new yb(r.x,r.y,w),y.map.texture.name=v.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var _=y.getViewportCount(),M=0;M<_;M++){var S=y.getViewport(M);o.set(a.x*S.x,a.y*S.y,a.x*S.z,a.y*S.w),p.viewport(o),y.updateMatrices(v,M),i=y.getFrustum(),b(s,l,y.camera,v,this.type)}y.isPointLightShadow||3!==this.type||g(y,l)}else console.warn("THREE.WebGLShadowMap:",v,"has no shadow.")}m.needsUpdate=!1,e.setRenderTarget(c,h,u)}}}function JS(e,t,n){var i=n.isWebGL2;var r=new function(){var t=!1,n=new vb,i=null,r=new vb(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},a=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(e){e?F(2929):B(2929)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},o=new function(){var t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(e){t||(e?F(2960):B(2960))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null}}},s=e.getParameter(34921),l=new Uint8Array(s),c=new Uint8Array(s),h=new Uint8Array(s),u={},p=null,d=null,f=null,m=null,g=null,v=null,y=null,x=null,b=null,w=!1,_=null,M=null,S=null,T=null,E=null,A=e.getParameter(35661),L=!1,R=0,P=e.getParameter(7938);-1!==P.indexOf("WebGL")?(R=parseFloat(/^WebGL\ ([0-9])/.exec(P)[1]),L=R>=1):-1!==P.indexOf("OpenGL ES")&&(R=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(P)[1]),L=R>=2);var C=null,O={},I=new vb,D=new vb;function N(t,n,i){var r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<i;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,r);return a}var z={};function U(n,r){(l[n]=1,0===c[n]&&(e.enableVertexAttribArray(n),c[n]=1),h[n]!==r)&&((i?e:t.get("ANGLE_instanced_arrays"))[i?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),h[n]=r)}function F(t){!0!==u[t]&&(e.enable(t),u[t]=!0)}function B(t){!1!==u[t]&&(e.disable(t),u[t]=!1)}z[3553]=N(3553,3553,1),z[34067]=N(34067,34069,6),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),F(2929),a.setFunc(3),j(!1),W(1),F(2884),V(0);var H={100:32774,101:32778,102:32779};if(i)H[103]=32775,H[104]=32776;else{var G=t.get("EXT_blend_minmax");null!==G&&(H[103]=G.MIN_EXT,H[104]=G.MAX_EXT)}var k={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function V(t,n,i,r,a,o,s,l){if(0!==t){if(d||(F(3042),d=!0),5===t)a=a||n,o=o||i,s=s||r,n===m&&a===y||(e.blendEquationSeparate(H[n],H[a]),m=n,y=a),i===g&&r===v&&o===x&&s===b||(e.blendFuncSeparate(k[i],k[r],k[o],k[s]),g=i,v=r,x=o,b=s),f=t,w=null;else if(t!==f||l!==w){if(100===m&&100===y||(e.blendEquation(32774),m=100,y=100),l)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,0,769,771);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFunc(0,769);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}g=null,v=null,x=null,b=null,f=t,w=l}}else d&&(B(3042),d=!1)}function j(t){_!==t&&(t?e.frontFace(2304):e.frontFace(2305),_=t)}function W(t){0!==t?(F(2884),t!==M&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):B(2884),M=t}function q(t,n,i){t?(F(32823),T===n&&E===i||(e.polygonOffset(n,i),T=n,E=i)):B(32823)}function X(t){void 0===t&&(t=33984+A-1),C!==t&&(e.activeTexture(t),C=t)}return{buffers:{color:r,depth:a,stencil:o},initAttributes:function(){for(var e=0,t=l.length;e<t;e++)l[e]=0},enableAttribute:function(e){U(e,0)},enableAttributeAndDivisor:U,disableUnusedAttributes:function(){for(var t=0,n=c.length;t!==n;++t)c[t]!==l[t]&&(e.disableVertexAttribArray(t),c[t]=0)},vertexAttribPointer:function(t,n,r,a,o,s){!0!==i||5124!==r&&5125!==r?e.vertexAttribPointer(t,n,r,a,o,s):e.vertexAttribIPointer(t,n,r,a,o,s)},enable:F,disable:B,useProgram:function(t){return p!==t&&(e.useProgram(t),p=t,!0)},setBlending:V,setMaterial:function(e,t){2===e.side?B(2884):F(2884);var n=1===e.side;t&&(n=!n),j(n),1===e.blending&&!1===e.transparent?V(0):V(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),r.setMask(e.colorWrite);var i=e.stencilWrite;o.setTest(i),i&&(o.setMask(e.stencilWriteMask),o.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),o.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),q(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:j,setCullFace:W,setLineWidth:function(t){t!==S&&(L&&e.lineWidth(t),S=t)},setPolygonOffset:q,setScissorTest:function(e){e?F(3089):B(3089)},activeTexture:X,bindTexture:function(t,n){null===C&&X();var i=O[C];void 0===i&&(i={type:void 0,texture:void 0},O[C]=i),i.type===t&&i.texture===n||(e.bindTexture(t,n||z[t]),i.type=t,i.texture=n)},unbindTexture:function(){var t=O[C];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===I.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),I.copy(t))},viewport:function(t){!1===D.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),D.copy(t))},reset:function(){for(var t=0;t<c.length;t++)1===c[t]&&(e.disableVertexAttribArray(t),c[t]=0);u={},C=null,O={},p=null,f=null,_=null,M=null,r.reset(),a.reset(),o.reset()}}}function ZS(e,t,n,i,r,a,o){var s,l=r.isWebGL2,c=r.maxTextures,h=r.maxCubemapSize,u=r.maxTextureSize,p=r.maxSamples,d=new WeakMap,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function m(e,t){return f?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function g(e,t,n,i){var r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?ub.floorPowerOfTwo:Math.floor,o=a(r*e.width),l=a(r*e.height);void 0===s&&(s=m(o,l));var c=n?m(o,l):s;return c.width=o,c.height=l,c.getContext("2d").drawImage(e,0,0,o,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+l+")."),c}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function v(e){return ub.isPowerOfTwo(e.width)&&ub.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function x(t,n,r,a){e.generateMipmap(t),i.get(n).__maxMipLevel=Math.log(Math.max(r,a))*Math.LOG2E}function b(n,i,r){if(!1===l)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var a=i;return 6403===i&&(5126===r&&(a=33326),5131===r&&(a=33325),5121===r&&(a=33321)),6407===i&&(5126===r&&(a=34837),5131===r&&(a=34843),5121===r&&(a=32849)),6408===i&&(5126===r&&(a=34836),5131===r&&(a=34842),5121===r&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||t.get("EXT_color_buffer_float"),a}function w(e){return 1003===e||1004===e||1005===e?9728:9729}function _(t){var n=t.target;n.removeEventListener("dispose",_),function(t){var n=i.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),i.remove(t)}(n),n.isVideoTexture&&d.delete(n),o.memory.textures--}function M(t){var n=t.target;n.removeEventListener("dispose",M),function(t){var n=i.get(t),r=i.get(t.texture);if(!t)return;void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);i.remove(t.texture),i.remove(t)}(n),o.memory.textures--}var S=0;function T(e,t){var r=i.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;d.get(e)!==t&&(d.set(e,t),e.update())}(e),e.version>0&&r.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void O(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}function E(t,r){if(6===t.image.length){var o=i.get(t);if(t.version>0&&o.__version!==t.version){C(o,t),n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&(t.isCompressedTexture||t.image[0].isCompressedTexture),c=t.image[0]&&t.image[0].isDataTexture,u=[],p=0;p<6;p++)u[p]=s||c?c?t.image[p].image:t.image[p]:g(t.image[p],!1,!0,h);var d,f=u[0],m=v(f)||l,w=a.convert(t.format),_=a.convert(t.type),M=b(t.internalFormat,w,_);if(P(34067,t,m),s){for(p=0;p<6;p++){d=u[p].mipmaps;for(var S=0;S<d.length;S++){var T=d[S];1023!==t.format&&1022!==t.format?null!==w?n.compressedTexImage2D(34069+p,S,M,T.width,T.height,0,T.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+p,S,M,T.width,T.height,0,w,_,T.data)}}o.__maxMipLevel=d.length-1}else{d=t.mipmaps;for(p=0;p<6;p++)if(c){n.texImage2D(34069+p,0,M,u[p].width,u[p].height,0,w,_,u[p].data);for(S=0;S<d.length;S++){var E=(T=d[S]).image[p].image;n.texImage2D(34069+p,S+1,M,E.width,E.height,0,w,_,E.data)}}else{n.texImage2D(34069+p,0,M,w,_,u[p]);for(S=0;S<d.length;S++){T=d[S];n.texImage2D(34069+p,S+1,M,w,_,T.image[p])}}o.__maxMipLevel=d.length}y(t,m)&&x(34067,t,f.width,f.height),o.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture)}}function A(e,t){n.activeTexture(33984+t),n.bindTexture(34067,i.get(e).__webglTexture)}var L={1e3:10497,1001:33071,1002:33648},R={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function P(n,a,o){o?(e.texParameteri(n,10242,L[a.wrapS]),e.texParameteri(n,10243,L[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,L[a.wrapR]),e.texParameteri(n,10240,R[a.magFilter]),e.texParameteri(n,10241,R[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),1001===a.wrapS&&1001===a.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,w(a.magFilter)),e.texParameteri(n,10241,w(a.minFilter)),1003!==a.minFilter&&1006!==a.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var s=t.get("EXT_texture_filter_anisotropic");if(s){if(1015===a.type&&null===t.get("OES_texture_float_linear"))return;if(1016===a.type&&null===(l||t.get("OES_texture_half_float_linear")))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function C(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",_),t.__webglTexture=e.createTexture(),o.memory.textures++)}function O(t,i,r){var o=3553;i.isDataTexture2DArray&&(o=35866),i.isDataTexture3D&&(o=32879),C(t,i),n.activeTexture(33984+r),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment);var s=function(e){return!l&&(1001!==e.wrapS||1001!==e.wrapT||1003!==e.minFilter&&1006!==e.minFilter)}(i)&&!1===v(i.image),c=g(i.image,s,!1,u),h=v(c)||l,p=a.convert(i.format),d=a.convert(i.type),f=b(i.internalFormat,p,d);P(o,i,h);var m,w=i.mipmaps;if(i.isDepthTexture)f=6402,l?f=1015===i.type?36012:1014===i.type?33190:1020===i.type?35056:33189:1015===i.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===i.format&&6402===f&&1012!==i.type&&1014!==i.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=1012,d=a.convert(i.type)),1027===i.format&&6402===f&&(f=34041,1020!==i.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=1020,d=a.convert(i.type))),n.texImage2D(3553,0,f,c.width,c.height,0,p,d,null);else if(i.isDataTexture)if(w.length>0&&h){for(var _=0,M=w.length;_<M;_++)m=w[_],n.texImage2D(3553,_,f,m.width,m.height,0,p,d,m.data);i.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,f,c.width,c.height,0,p,d,c.data),t.__maxMipLevel=0;else if(i.isCompressedTexture){for(_=0,M=w.length;_<M;_++)m=w[_],1023!==i.format&&1022!==i.format?null!==p?n.compressedTexImage2D(3553,_,f,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,_,f,m.width,m.height,0,p,d,m.data);t.__maxMipLevel=w.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,f,c.width,c.height,c.depth,0,p,d,c.data),t.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,f,c.width,c.height,c.depth,0,p,d,c.data),t.__maxMipLevel=0;else if(w.length>0&&h){for(_=0,M=w.length;_<M;_++)m=w[_],n.texImage2D(3553,_,f,p,d,m);i.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,f,p,d,c),t.__maxMipLevel=0;y(i,h)&&x(o,i,c.width,c.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}function I(t,r,o,s){var l=a.convert(r.texture.format),c=a.convert(r.texture.type),h=b(r.texture.internalFormat,l,c);n.texImage2D(s,0,h,r.width,r.height,0,l,c,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,i.get(r.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function D(t,n,i){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var r=33189;if(i){var o=n.depthTexture;o&&o.isDepthTexture&&(1015===o.type?r=36012:1014===o.type&&(r=33190));var s=z(n);e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(i){s=z(n);e.renderbufferStorageMultisample(36161,s,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var l=a.convert(n.texture.format),c=a.convert(n.texture.type);r=b(n.texture.internalFormat,l,c);if(i){s=z(n);e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height)}e.bindRenderbuffer(36161,null)}function N(t){var n=i.get(t),r=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),T(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(1026===n.depthTexture.format)e.framebufferTexture2D(36160,36096,3553,r,0);else{if(1027!==n.depthTexture.format)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,r,0)}}(n.__webglFramebuffer,t)}else if(r){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),D(n.__webglDepthbuffer[a],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),D(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}function z(e){return l&&e.isWebGLMultisampleRenderTarget?Math.min(p,e.samples):0}var U=!1,F=!1;this.allocateTextureUnit=function(){var e=S;return e>=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),S+=1,e},this.resetTextureUnits=function(){S=0},this.setTexture2D=T,this.setTexture2DArray=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?O(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?O(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=E,this.setTextureCubeDynamic=A,this.setupRenderTarget=function(t){var r=i.get(t),s=i.get(t.texture);t.addEventListener("dispose",M),s.__webglTexture=e.createTexture(),o.memory.textures++;var c=!0===t.isWebGLCubeRenderTarget,h=!0===t.isWebGLMultisampleRenderTarget,u=v(t)||l;if(!l||1022!==t.texture.format||1015!==t.texture.type&&1016!==t.texture.type||(t.texture.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){r.__webglFramebuffer=[];for(var p=0;p<6;p++)r.__webglFramebuffer[p]=e.createFramebuffer()}else if(r.__webglFramebuffer=e.createFramebuffer(),h)if(l){r.__webglMultisampledFramebuffer=e.createFramebuffer(),r.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,r.__webglColorRenderbuffer);var d=a.convert(t.texture.format),f=a.convert(t.texture.type),m=b(t.texture.internalFormat,d,f),g=z(t);e.renderbufferStorageMultisample(36161,g,m,t.width,t.height),e.bindFramebuffer(36160,r.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,r.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(r.__webglDepthRenderbuffer=e.createRenderbuffer(),D(r.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,s.__webglTexture),P(34067,t.texture,u);for(p=0;p<6;p++)I(r.__webglFramebuffer[p],t,36064,34069+p);y(t.texture,u)&&x(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,s.__webglTexture),P(3553,t.texture,u),I(r.__webglFramebuffer,t,36064,3553),y(t.texture,u)&&x(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&N(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(y(t,v(e)||l)){var r=e.isWebGLCubeRenderTarget?34067:3553,a=i.get(t).__webglTexture;n.bindTexture(r,a),x(r,t,e.width,e.height),n.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(l){var n=i.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var r=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,r,a,0,0,r,a,o,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===U&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),U=!0),e=e.texture),T(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),F=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?E(e,t):A(e,t)}}function KS(e,t,n){var i=n.isWebGL2;return{convert:function(e){var n;if(1009===e)return 5121;if(1017===e)return 32819;if(1018===e)return 32820;if(1019===e)return 33635;if(1010===e)return 5120;if(1011===e)return 5122;if(1012===e)return 5123;if(1013===e)return 5124;if(1014===e)return 5125;if(1015===e)return 5126;if(1016===e)return i?5131:null!==(n=t.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(1021===e)return 6406;if(1022===e)return 6407;if(1023===e)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(1026===e)return 6402;if(1027===e)return 34041;if(1028===e)return 6403;if(1029===e)return 36244;if(1030===e)return 33319;if(1031===e)return 33320;if(1032===e)return 36248;if(1033===e)return 36249;if(33776===e||33777===e||33778===e||33779===e){if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===e)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===e||35841===e||35842===e||35843===e){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===e)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===e)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===e)return null!==(n=t.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===e||37496===e)&&null!==(n=t.get("WEBGL_compressed_texture_etc"))){if(37492===e)return n.COMPRESSED_RGB8_ETC2;if(37496===e)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e||37840===e||37841===e||37842===e||37843===e||37844===e||37845===e||37846===e||37847===e||37848===e||37849===e||37850===e||37851===e||37852===e||37853===e?null!==(n=t.get("WEBGL_compressed_texture_astc"))?e:null:36492===e?null!==(n=t.get("EXT_texture_compression_bptc"))?e:null:1020===e?i?34042:null!==(n=t.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function QS(e){q_.call(this),this.cameras=e||[]}function $S(){Jb.call(this),this.type="Group"}function eT(){this._targetRay=null,this._grip=null}function tT(e,t){var n=this,i=null,r=1,a=null,o="local-floor",s=null,l=[],c=new Map,h=new q_;h.layers.enable(1),h.viewport=new vb;var u=new q_;u.layers.enable(2),u.viewport=new vb;var p=[h,u],d=new QS;d.layers.enable(1),d.layers.enable(2);var f=null,m=null;function g(e){var t=c.get(e.inputSource);t&&t.dispatchEvent({type:e.type})}function v(){c.forEach((function(e,t){e.disconnect(t)})),c.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),S.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(e){a=e,S.setContext(i),S.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}function x(e){for(var t=i.inputSources,n=0;n<l.length;n++)c.set(t[n],l[n]);for(n=0;n<e.removed.length;n++){var r=e.removed[n];(a=c.get(r))&&(a.dispatchEvent({type:"disconnected",data:r}),c.delete(r))}for(n=0;n<e.added.length;n++){var a;r=e.added[n];(a=c.get(r))&&a.dispatchEvent({type:"connected",data:r})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=l[e];return void 0===t&&(t=new eT,l[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=l[e];return void 0===t&&(t=new eT,l[e]=t),t.getGripSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getSession=function(){return i},this.setSession=function(e){if(null!==(i=e)){i.addEventListener("select",g),i.addEventListener("selectstart",g),i.addEventListener("selectend",g),i.addEventListener("squeeze",g),i.addEventListener("squeezestart",g),i.addEventListener("squeezeend",g),i.addEventListener("end",v);var n=t.getContextAttributes();!0!==n.xrCompatible&&t.makeXRCompatible();var a={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:r},s=new XRWebGLLayer(i,t,a);i.updateRenderState({baseLayer:s}),i.requestReferenceSpace(o).then(y),i.addEventListener("inputsourceschange",x)}};var b=new Mb,w=new Mb;function _(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){d.near=u.near=h.near=e.near,d.far=u.far=h.far=e.far,f===d.near&&m===d.far||(i.updateRenderState({depthNear:d.near,depthFar:d.far}),f=d.near,m=d.far);var t=e.parent,n=d.cameras;_(d,t);for(var r=0;r<n.length;r++)_(n[r],t);e.matrixWorld.copy(d.matrixWorld);for(var a=e.children,o=(r=0,a.length);r<o;r++)a[r].updateMatrixWorld(!0);return 2===n.length?function(e,t,n){b.setFromMatrixPosition(t.matrixWorld),w.setFromMatrixPosition(n.matrixWorld);var i=b.distanceTo(w),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(a[8]+1)/a[0],p=o*h,d=o*u,f=i/(-h+u),m=f*-h;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var g=o+f,v=s+f,y=p-m,x=d+(i-m),_=l*s/v*g,M=c*s/v*g;e.projectionMatrix.makePerspective(y,x,_,M,g,v)}(d,h,u):d.projectionMatrix.copy(h.projectionMatrix),d};var M=null;var S=new eM;S.setAnimationLoop((function(t,n){if(null!==(s=n.getViewerPose(a))){var r=s.views,o=i.renderState.baseLayer;e.setFramebuffer(o.framebuffer);var c=!1;r.length!==d.cameras.length&&(d.cameras.length=0,c=!0);for(var h=0;h<r.length;h++){var u=r[h],f=o.getViewport(u),m=p[h];m.matrix.fromArray(u.transform.matrix),m.projectionMatrix.fromArray(u.projectionMatrix),m.viewport.set(f.x,f.y,f.width,f.height),0===h&&d.matrix.copy(m.matrix),!0===c&&d.cameras.push(m)}}var g=i.inputSources;for(h=0;h<l.length;h++){var v=l[h],y=g[h];v.update(y,n,a)}M&&M(t,n)})),this.setAnimationLoop=function(e){M=e},this.dispose=function(){}}function nT(e){function t(t,n,i){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);var r,a,o=n.envMap||i;o&&(t.envMap.value=o,t.flipEnvMap.value=o.isCubeTexture?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio,t.maxMipLevel.value=e.get(o).__maxMipLevel),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap&&(r=n.emissiveMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix)),n.aoMap?a=n.aoMap:n.lightMap&&(a=n.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),t.uv2Transform.value.copy(a.matrix))}function n(e,t,n){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),(t.envMap||n)&&(e.envMapIntensity.value=t.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,i,r,a,o){i.isMeshBasicMaterial?t(e,i):i.isMeshLambertMaterial?(t(e,i),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,i)):i.isMeshToonMaterial?(t(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.gradientMap&&(e.gradientMap.value=t.gradientMap);t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshPhongMaterial?(t(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshStandardMaterial?(t(e,i,r),i.isMeshPhysicalMaterial?function(e,t,i){n(e,t,i),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap);t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate());e.transparency.value=t.transparency}(e,i,r):n(e,i,r)):i.isMeshMatcapMaterial?(t(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDepthMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDistanceMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?(t(e,i),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var r;t.map?r=t.map:t.alphaMap&&(r=t.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i,a,o):i.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function iT(e){var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,u=null,p=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var d,f,m,g,v,y,x,b,w,_,M,S,T,E,A,L,R,P,C,O=this,I=!1,D=null,N=0,z=0,U=null,F=null,B=-1,H={geometry:null,program:null,wireframe:!1},G=null,k=null,V=new vb,j=new vb,W=null,q=t.width,X=t.height,Y=1,J=null,Z=null,K=new vb(0,0,q,X),Q=new vb(0,0,q,X),$=!1,ee=new Q_,te=new cM,ne=!1,ie=!1,re=new Cb,ae=new Mb;function oe(){return null===U?Y:1}try{var se={alpha:i,depth:r,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if(t.addEventListener("webglcontextlost",ue,!1),t.addEventListener("webglcontextrestored",pe,!1),null===(d=n||t.getContext("webgl",se)||t.getContext("experimental-webgl",se)))throw null!==t.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===d.getShaderPrecisionFormat&&(d.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function le(){f=new hM(d),!1===(m=new lM(d,f,e)).isWebGL2&&(f.get("WEBGL_depth_texture"),f.get("OES_texture_float"),f.get("OES_texture_half_float"),f.get("OES_texture_half_float_linear"),f.get("OES_standard_derivatives"),f.get("OES_element_index_uint"),f.get("ANGLE_instanced_arrays")),f.get("OES_texture_float_linear"),C=new KS(d,f,m),(g=new JS(d,f,m)).scissor(j.copy(Q).multiplyScalar(Y).floor()),g.viewport(V.copy(K).multiplyScalar(Y).floor()),v=new dM(d),y=new NS,x=new ZS(d,f,g,y,m,C,v),b=new tM(d,m),w=new uM(d,b,v),_=new gM(d,w,b,v),L=new mM(d),M=new DS(O,f,m),S=new nT(y),T=new BS,E=new WS,A=new oM(O,g,_,s),R=new sM(d,f,v,m),P=new pM(d,f,v,m),v.programs=M.programs,O.capabilities=m,O.extensions=f,O.properties=y,O.renderLists=T,O.state=g,O.info=v}le();var ce=new tT(O,d);this.xr=ce;var he=new YS(O,_,m.maxTextureSize);function ue(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),I=!0}function pe(){console.log("THREE.WebGLRenderer: Context Restored."),I=!1,le()}function de(e){var t=e.target;t.removeEventListener("dispose",de),function(e){fe(e),y.remove(e)}(t)}function fe(e){var t=y.get(e).program;e.program=void 0,void 0!==t&&M.releaseProgram(t)}this.shadowMap=he,this.getContext=function(){return d},this.getContextAttributes=function(){return d.getContextAttributes()},this.forceContextLoss=function(){var e=f.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=f.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(e){void 0!==e&&(Y=e,this.setSize(q,X,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new pb),e.set(q,X)},this.setSize=function(e,n,i){ce.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(q=e,X=n,t.width=Math.floor(e*Y),t.height=Math.floor(n*Y),!1!==i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new pb),e.set(q*Y,X*Y).floor()},this.setDrawingBufferSize=function(e,n,i){q=e,X=n,Y=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new vb),e.copy(V)},this.getViewport=function(e){return e.copy(K)},this.setViewport=function(e,t,n,i){e.isVector4?K.set(e.x,e.y,e.z,e.w):K.set(e,t,n,i),g.viewport(V.copy(K).multiplyScalar(Y).floor())},this.getScissor=function(e){return e.copy(Q)},this.setScissor=function(e,t,n,i){e.isVector4?Q.set(e.x,e.y,e.z,e.w):Q.set(e,t,n,i),g.scissor(j.copy(Q).multiplyScalar(Y).floor())},this.getScissorTest=function(){return $},this.setScissorTest=function(e){g.setScissorTest($=e)},this.setOpaqueSort=function(e){J=e},this.setTransparentSort=function(e){Z=e},this.getClearColor=function(){return A.getClearColor()},this.setClearColor=function(){A.setClearColor.apply(A,arguments)},this.getClearAlpha=function(){return A.getClearAlpha()},this.setClearAlpha=function(){A.setClearAlpha.apply(A,arguments)},this.clear=function(e,t,n){var i=0;(void 0===e||e)&&(i|=16384),(void 0===t||t)&&(i|=256),(void 0===n||n)&&(i|=1024),d.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ue,!1),t.removeEventListener("webglcontextrestored",pe,!1),T.dispose(),E.dispose(),y.dispose(),_.dispose(),ce.dispose(),ve.stop()},this.renderBufferImmediate=function(e,t){g.initAttributes();var n=y.get(e);e.hasPositions&&!n.position&&(n.position=d.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=d.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=d.createBuffer()),e.hasColors&&!n.color&&(n.color=d.createBuffer());var i=t.getAttributes();e.hasPositions&&(d.bindBuffer(34962,n.position),d.bufferData(34962,e.positionArray,35048),g.enableAttribute(i.position),d.vertexAttribPointer(i.position,3,5126,!1,0,0)),e.hasNormals&&(d.bindBuffer(34962,n.normal),d.bufferData(34962,e.normalArray,35048),g.enableAttribute(i.normal),d.vertexAttribPointer(i.normal,3,5126,!1,0,0)),e.hasUvs&&(d.bindBuffer(34962,n.uv),d.bufferData(34962,e.uvArray,35048),g.enableAttribute(i.uv),d.vertexAttribPointer(i.uv,2,5126,!1,0,0)),e.hasColors&&(d.bindBuffer(34962,n.color),d.bufferData(34962,e.colorArray,35048),g.enableAttribute(i.color),d.vertexAttribPointer(i.color,3,5126,!1,0,0)),g.disableUnusedAttributes(),d.drawArrays(4,0,e.count),e.count=0};var me=new Zb;this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=me);var o=r.isMesh&&r.matrixWorld.determinant()<0,s=_e(e,t,i,r);g.setMaterial(i,o);var l=!1;H.geometry===n.id&&H.program===s.id&&H.wireframe===(!0===i.wireframe)||(H.geometry=n.id,H.program=s.id,H.wireframe=!0===i.wireframe,l=!0),(i.morphTargets||i.morphNormals)&&(L.update(r,n,i,s),l=!0),!0===r.isInstancedMesh&&(l=!0);var c=n.index,h=n.attributes.position;if(null===c){if(void 0===h||0===h.count)return}else if(0===c.count)return;var u,p=1;!0===i.wireframe&&(c=w.getWireframeAttribute(n),p=2);var v=R;null!==c&&(u=b.get(c),(v=P).setIndex(u)),l&&(!function(e,t,n,i){if(!1===m.isWebGL2&&(e.isInstancedMesh||t.isInstancedBufferGeometry)&&null===f.get("ANGLE_instanced_arrays"))return;g.initAttributes();var r=t.attributes,a=i.getAttributes(),o=n.defaultAttributeValues;for(var s in a){var l=a[s];if(l>=0){var c=r[s];if(void 0!==c){var h=c.normalized,u=c.itemSize;if(void 0===(M=b.get(c)))continue;var p=M.buffer,v=M.type,y=M.bytesPerElement;if(c.isInterleavedBufferAttribute){var x=c.data,w=x.stride,_=c.offset;x&&x.isInstancedInterleavedBuffer?(g.enableAttributeAndDivisor(l,x.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=x.meshPerAttribute*x.count)):g.enableAttribute(l),d.bindBuffer(34962,p),g.vertexAttribPointer(l,u,v,h,w*y,_*y)}else c.isInstancedBufferAttribute?(g.enableAttributeAndDivisor(l,c.meshPerAttribute),void 0===t._maxInstanceCount&&(t._maxInstanceCount=c.meshPerAttribute*c.count)):g.enableAttribute(l),d.bindBuffer(34962,p),g.vertexAttribPointer(l,u,v,h,0,0)}else if("instanceMatrix"===s){var M;if(void 0===(M=b.get(e.instanceMatrix)))continue;p=M.buffer,v=M.type;g.enableAttributeAndDivisor(l+0,1),g.enableAttributeAndDivisor(l+1,1),g.enableAttributeAndDivisor(l+2,1),g.enableAttributeAndDivisor(l+3,1),d.bindBuffer(34962,p),d.vertexAttribPointer(l+0,4,v,!1,64,0),d.vertexAttribPointer(l+1,4,v,!1,64,16),d.vertexAttribPointer(l+2,4,v,!1,64,32),d.vertexAttribPointer(l+3,4,v,!1,64,48)}else if(void 0!==o){var S=o[s];if(void 0!==S)switch(S.length){case 2:d.vertexAttrib2fv(l,S);break;case 3:d.vertexAttrib3fv(l,S);break;case 4:d.vertexAttrib4fv(l,S);break;default:d.vertexAttrib1fv(l,S)}}}}g.disableUnusedAttributes()}(r,n,i,s),null!==c&&d.bindBuffer(34963,u.buffer));var y=null!==c?c.count:h.count,x=n.drawRange.start*p,_=n.drawRange.count*p,M=null!==a?a.start*p:0,S=null!==a?a.count*p:1/0,T=Math.max(x,M),E=Math.min(y,x+_,M+S)-1,A=Math.max(0,E-T+1);if(0!==A){if(r.isMesh)!0===i.wireframe?(g.setLineWidth(i.wireframeLinewidth*oe()),v.setMode(1)):v.setMode(4);else if(r.isLine){var C=i.linewidth;void 0===C&&(C=1),g.setLineWidth(C*oe()),r.isLineSegments?v.setMode(1):r.isLineLoop?v.setMode(2):v.setMode(3)}else r.isPoints?v.setMode(0):r.isSprite&&v.setMode(4);if(r.isInstancedMesh)v.renderInstances(n,T,A,r.count);else if(n.isInstancedBufferGeometry){var O=Math.min(n.instanceCount,n._maxInstanceCount);v.renderInstances(n,T,A,O)}else v.render(T,A)}},this.compile=function(e,t){(p=E.get(e,t)).init(),e.traverse((function(e){e.isLight&&(p.pushLight(e),e.castShadow&&p.pushShadow(e))})),p.setupLights(t);const n={};e.traverse((function(t){let i=t.material;if(i)if(Array.isArray(i))for(let r=0;r<i.length;r++){let a=i[r];a.uuid in n==!1&&(we(a,e,t),n[a.uuid]=!0)}else i.uuid in n==!1&&(we(i,e,t),n[i.uuid]=!0)}))};var ge=null;var ve=new eM;function ye(e,t,n,i){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)p.pushLight(e),e.castShadow&&p.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ee.intersectsSprite(e)){i&&ae.setFromMatrixPosition(e.matrixWorld).applyMatrix4(re);var r=_.update(e);(a=e.material).visible&&u.push(e,r,a,n,ae.z,null)}}else if(e.isImmediateRenderObject)i&&ae.setFromMatrixPosition(e.matrixWorld).applyMatrix4(re),u.push(e,null,e.material,n,ae.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==v.render.frame&&(e.skeleton.update(),e.skeleton.frame=v.render.frame),!e.frustumCulled||ee.intersectsObject(e))){i&&ae.setFromMatrixPosition(e.matrixWorld).applyMatrix4(re);r=_.update(e);var a=e.material;if(Array.isArray(a))for(var o=r.groups,s=0,l=o.length;s<l;s++){var c=o[s],h=a[c.materialIndex];h&&h.visible&&u.push(e,r,h,n,ae.z,c)}else a.visible&&u.push(e,r,a,n,ae.z,null)}var d=e.children;for(s=0,l=d.length;s<l;s++)ye(d[s],t,n,i)}}function xe(e,t,n,i){for(var r=0,a=e.length;r<a;r++){var o=e[r],s=o.object,l=o.geometry,c=void 0===i?o.material:i,h=o.group;if(n.isArrayCamera){k=n;for(var u=n.cameras,d=0,f=u.length;d<f;d++){var m=u[d];s.layers.test(m.layers)&&(g.viewport(V.copy(m.viewport)),p.setupLights(m),be(s,t,m,l,c,h))}}else k=null,be(s,t,n,l,c,h)}}function be(e,t,n,i,r,a){if(e.onBeforeRender(O,t,n,i,r,a),p=E.get(t,k||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=_e(n,t,r,e);g.setMaterial(r),H.geometry=null,H.program=null,H.wireframe=!1,function(e,t){e.render((function(e){O.renderBufferImmediate(e,t)}))}(e,o)}else O.renderBufferDirect(n,t,i,r,e,a);e.onAfterRender(O,t,n,i,r,a),p=E.get(t,k||n)}function we(e,t,n){var i=y.get(e),r=p.state.lights,a=p.state.shadowsArray,o=r.state.version,s=M.getParameters(e,r.state,a,t,te.numPlanes,te.numIntersection,n),l=M.getProgramCacheKey(s),c=i.program,h=!0;if(void 0===c)e.addEventListener("dispose",de);else if(c.cacheKey!==l)fe(e);else if(i.lightsStateVersion!==o)i.lightsStateVersion=o,h=!1;else{if(void 0!==s.shaderID)return;h=!1}h&&(c=M.acquireProgram(s,l),i.program=c,i.uniforms=s.uniforms,i.outputEncoding=s.outputEncoding,e.program=c);var u=c.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var d=0;d<O.maxMorphTargets;d++)u["morphTarget"+d]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(d=0;d<O.maxMorphNormals;d++)u["morphNormal"+d]>=0&&e.numSupportedMorphNormals++}var f=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=te.numPlanes,i.numIntersection=te.numIntersection,f.clippingPlanes=te.uniform),i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=o,i.needsLights&&(f.ambientLightColor.value=r.state.ambient,f.lightProbe.value=r.state.probe,f.directionalLights.value=r.state.directional,f.directionalLightShadows.value=r.state.directionalShadow,f.spotLights.value=r.state.spot,f.spotLightShadows.value=r.state.spotShadow,f.rectAreaLights.value=r.state.rectArea,f.pointLights.value=r.state.point,f.pointLightShadows.value=r.state.pointShadow,f.hemisphereLights.value=r.state.hemi,f.directionalShadowMap.value=r.state.directionalShadowMap,f.directionalShadowMatrix.value=r.state.directionalShadowMatrix,f.spotShadowMap.value=r.state.spotShadowMap,f.spotShadowMatrix.value=r.state.spotShadowMatrix,f.pointShadowMap.value=r.state.pointShadowMap,f.pointShadowMatrix.value=r.state.pointShadowMatrix);var m=i.program.getUniforms(),g=fS.seqWithValue(m.seq,f);i.uniformsList=g}function _e(e,t,n,i){x.resetTextureUnits();var r=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=null===U?O.outputEncoding:U.texture.encoding,s=y.get(n),l=p.state.lights;if(ne&&(ie||e!==G)){var c=e===G&&n.id===B;te.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,s,c)}n.version===s.__version?void 0===s.program||n.fog&&s.fog!==r||s.environment!==a||s.needsLights&&s.lightsStateVersion!==l.state.version?we(n,t,i):void 0===s.numClippingPlanes||s.numClippingPlanes===te.numPlanes&&s.numIntersection===te.numIntersection?s.outputEncoding!==o&&we(n,t,i):we(n,t,i):(we(n,t,i),s.__version=n.version);var h,u,f=!1,v=!1,b=!1,w=s.program,_=w.getUniforms(),M=s.uniforms;if(g.useProgram(w.program)&&(f=!0,v=!0,b=!0),n.id!==B&&(B=n.id,v=!0),f||G!==e){if(_.setValue(d,"projectionMatrix",e.projectionMatrix),m.logarithmicDepthBuffer&&_.setValue(d,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),G!==e&&(G=e,v=!0,b=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var T=_.map.cameraPosition;void 0!==T&&T.setValue(d,ae.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&_.setValue(d,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&_.setValue(d,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){_.setOptional(d,i,"bindMatrix"),_.setOptional(d,i,"bindMatrixInverse");var E=i.skeleton;if(E){var A=E.bones;if(m.floatVertexTextures){if(void 0===E.boneTexture){var L=Math.sqrt(4*A.length);L=ub.ceilPowerOfTwo(L),L=Math.max(L,4);var R=new Float32Array(L*L*4);R.set(E.boneMatrices);var P=new J_(R,L,L,1023,1015);E.boneMatrices=R,E.boneTexture=P,E.boneTextureSize=L}_.setValue(d,"boneTexture",E.boneTexture,x),_.setValue(d,"boneTextureSize",E.boneTextureSize)}else _.setOptional(d,E,"boneMatrices")}}return(v||s.receiveShadow!==i.receiveShadow)&&(s.receiveShadow=i.receiveShadow,_.setValue(d,"receiveShadow",i.receiveShadow)),v&&(_.setValue(d,"toneMappingExposure",O.toneMappingExposure),_.setValue(d,"toneMappingWhitePoint",O.toneMappingWhitePoint),s.needsLights&&(u=b,(h=M).ambientLightColor.needsUpdate=u,h.lightProbe.needsUpdate=u,h.directionalLights.needsUpdate=u,h.directionalLightShadows.needsUpdate=u,h.pointLights.needsUpdate=u,h.pointLightShadows.needsUpdate=u,h.spotLights.needsUpdate=u,h.spotLightShadows.needsUpdate=u,h.rectAreaLights.needsUpdate=u,h.hemisphereLights.needsUpdate=u),r&&n.fog&&S.refreshFogUniforms(M,r),S.refreshMaterialUniforms(M,n,a,Y,X),void 0!==M.ltc_1&&(M.ltc_1.value=$_.LTC_1),void 0!==M.ltc_2&&(M.ltc_2.value=$_.LTC_2),fS.upload(d,s.uniformsList,M,x)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(fS.upload(d,s.uniformsList,M,x),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&_.setValue(d,"center",i.center),_.setValue(d,"modelViewMatrix",i.modelViewMatrix),_.setValue(d,"normalMatrix",i.normalMatrix),_.setValue(d,"modelMatrix",i.matrixWorld),w}ve.setAnimationLoop((function(e){ce.isPresenting||ge&&ge(e)})),"undefined"!=typeof window&&ve.setContext(window),this.setAnimationLoop=function(e){ge=e,ce.setAnimationLoop(e),ve.start()},this.render=function(e,t){var n,i;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),i=arguments[3]),t&&t.isCamera){if(!I){H.geometry=null,H.program=null,H.wireframe=!1,B=-1,G=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),ce.enabled&&ce.isPresenting&&(t=ce.getCamera(t)),e.onBeforeRender(O,e,t,n||U),(p=E.get(e,t)).init(),re.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ee.setFromProjectionMatrix(re),ie=this.localClippingEnabled,ne=te.init(this.clippingPlanes,ie,t),(u=T.get(e,t)).init(),ye(e,t,0,O.sortObjects),u.finish(),!0===O.sortObjects&&u.sort(J,Z),ne&&te.beginShadows();var r=p.state.shadowsArray;he.render(r,e,t),p.setupLights(t),ne&&te.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),A.render(u,e,t,i);var a=u.opaque,o=u.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&xe(a,e,t,s),o.length&&xe(o,e,t,s)}else a.length&&xe(a,e,t),o.length&&xe(o,e,t);e.onAfterRender(O,e,t),null!==U&&(x.updateRenderTargetMipmap(U),x.updateMultisampleRenderTarget(U)),g.buffers.depth.setTest(!0),g.buffers.depth.setMask(!0),g.buffers.color.setMask(!0),g.setPolygonOffset(!1),u=null,p=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(e){D!==e&&null===U&&d.bindFramebuffer(36160,e),D=e},this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return z},this.getRenderTarget=function(){return U},this.setRenderTarget=function(e,t,n){U=e,N=t,z=n,e&&void 0===y.get(e).__webglFramebuffer&&x.setupRenderTarget(e);var i=D,r=!1;if(e){var a=y.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=a[t||0],r=!0):i=e.isWebGLMultisampleRenderTarget?y.get(e).__webglMultisampledFramebuffer:a,V.copy(e.viewport),j.copy(e.scissor),W=e.scissorTest}else V.copy(K).multiplyScalar(Y).floor(),j.copy(Q).multiplyScalar(Y).floor(),W=$;if(F!==i&&(d.bindFramebuffer(36160,i),F=i),g.viewport(V),g.scissor(j),g.setScissorTest(W),r){var o=y.get(e.texture);d.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(e&&e.isWebGLRenderTarget){var s=y.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){var l=!1;s!==F&&(d.bindFramebuffer(36160,s),l=!0);try{var c=e.texture,h=c.format,u=c.type;if(1023!==h&&C.convert(h)!==d.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(1009===u||C.convert(u)===d.getParameter(35738)||1015===u&&(m.isWebGL2||f.get("OES_texture_float")||f.get("WEBGL_color_buffer_float"))||1016===u&&(m.isWebGL2?f.get("EXT_color_buffer_float"):f.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===d.checkFramebufferStatus(36160)?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&d.readPixels(t,n,i,r,C.convert(h),C.convert(u),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&d.bindFramebuffer(36160,F)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),o=C.convert(t.format);x.setTexture2D(t,0),d.copyTexImage2D(3553,n,o,e.x,e.y,r,a,0),g.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i){void 0===i&&(i=0);var r=t.image.width,a=t.image.height,o=C.convert(n.format),s=C.convert(n.type);x.setTexture2D(n,0),t.isDataTexture?d.texSubImage2D(3553,i,e.x,e.y,r,a,o,s,t.image.data):t.isCompressedTexture?d.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):d.texSubImage2D(3553,i,e.x,e.y,o,s,t.image),0===i&&n.generateMipmaps&&d.generateMipmap(3553),g.unbindTexture()},this.initTexture=function(e){x.setTexture2D(e,0),g.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function rT(e,t){this.name="",this.color=new Hw(e),this.density=void 0!==t?t:25e-5}function aT(e,t,n){this.name="",this.color=new Hw(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function oT(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}QS.prototype=Object.assign(Object.create(q_.prototype),{constructor:QS,isArrayCamera:!0}),$S.prototype=Object.assign(Object.create(Jb.prototype),{constructor:$S,isGroup:!0}),Object.assign(eT.prototype,{constructor:eT,getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new $S,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new $S,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),this},update:function(e,t,n){var i=null,r=null,a=this._targetRay,o=this._grip;return e&&(null!==a&&null!==(i=t.getPose(e.targetRaySpace,n))&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)),null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale))),null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),this}}),Object.assign(tT.prototype,sb.prototype),Object.assign(rT.prototype,{isFogExp2:!0,clone:function(){return new rT(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(aT.prototype,{isFog:!0,clone:function(){return new aT(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(oT.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(oT.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});var sT,lT=new Mb;function cT(e,t,n,i){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}function hT(e){qw.call(this),this.type="SpriteMaterial",this.color=new Hw(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.defineProperties(cT.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(cT.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)lT.x=this.getX(t),lT.y=this.getY(t),lT.z=this.getZ(t),lT.applyMatrix4(e),this.setXYZ(t,lT.x,lT.y,lT.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this},clone:function(){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,i=0;i<this.itemSize;i++)e.push(this.data.array[n+i]);return new Jw(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,i=0;i<this.itemSize;i++)e.push(this.data.array[n+i]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}),hT.prototype=Object.create(qw.prototype),hT.prototype.constructor=hT,hT.prototype.isSpriteMaterial=!0,hT.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var uT=new Mb,pT=new Mb,dT=new Mb,fT=new pb,mT=new pb,gT=new Cb,vT=new Mb,yT=new Mb,xT=new Mb,bT=new pb,wT=new pb,_T=new pb;function MT(e){if(Jb.call(this),this.type="Sprite",void 0===sT){sT=new f_;var t=new oT(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);sT.setIndex([0,1,2,0,2,3]),sT.setAttribute("position",new cT(t,3,0,!1)),sT.setAttribute("uv",new cT(t,2,3,!1))}this.geometry=sT,this.material=void 0!==e?e:new hT,this.center=new pb(.5,.5)}function ST(e,t,n,i,r,a){fT.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(mT.x=a*fT.x-r*fT.y,mT.y=r*fT.x+a*fT.y):mT.copy(fT),e.copy(t),e.x+=mT.x,e.y+=mT.y,e.applyMatrix4(gT)}MT.prototype=Object.assign(Object.create(Jb.prototype),{constructor:MT,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),pT.setFromMatrixScale(this.matrixWorld),gT.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),dT.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&pT.multiplyScalar(-dT.z);var n,i,r=this.material.rotation;0!==r&&(i=Math.cos(r),n=Math.sin(r));var a=this.center;ST(vT.set(-.5,-.5,0),dT,a,pT,n,i),ST(yT.set(.5,-.5,0),dT,a,pT,n,i),ST(xT.set(.5,.5,0),dT,a,pT,n,i),bT.set(0,0),wT.set(1,0),_T.set(1,1);var o=e.ray.intersectTriangle(vT,yT,xT,!1,uT);if(null!==o||(ST(yT.set(-.5,.5,0),dT,a,pT,n,i),wT.set(0,1),null!==(o=e.ray.intersectTriangle(vT,xT,yT,!1,uT)))){var s=e.ray.origin.distanceTo(uT);s<e.near||s>e.far||t.push({distance:s,point:uT.clone(),uv:zw.getUV(uT,vT,yT,xT,bT,wT,_T,new pb),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return Jb.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var TT=new Mb,ET=new Mb;function AT(){Jb.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function LT(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),O_.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Cb,this.bindMatrixInverse=new Cb}AT.prototype=Object.assign(Object.create(Jb.prototype),{constructor:AT,isLOD:!0,copy:function(e){Jb.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n<i;n++){var r=t[n];this.addLevel(r.object.clone(),r.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){TT.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(TT);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){TT.setFromMatrixPosition(e.matrixWorld),ET.setFromMatrixPosition(this.matrixWorld);var n=TT.distanceTo(ET)/e.zoom;t[0].object.visible=!0;for(var i=1,r=t.length;i<r&&n>=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}},toJSON:function(e){var t=Jb.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,i=0,r=n.length;i<r;i++){var a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),LT.prototype=Object.assign(Object.create(O_.prototype),{constructor:LT,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new vb,t=this.geometry.attributes.skinWeight,n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){O_.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:function(){var e=new Mb,t=new vb,n=new vb,i=new Mb,r=new Cb;return function(a,o){var s=this.skeleton,l=this.geometry;t.fromBufferAttribute(l.attributes.skinIndex,a),n.fromBufferAttribute(l.attributes.skinWeight,a),e.fromBufferAttribute(l.attributes.position,a).applyMatrix4(this.bindMatrix),o.set(0,0,0);for(var c=0;c<4;c++){var h=n.getComponent(c);if(0!==h){var u=t.getComponent(c);r.multiplyMatrices(s.bones[u].matrixWorld,s.boneInverses[u]),o.addScaledVector(i.copy(e).applyMatrix4(r),h)}}return o.applyMatrix4(this.bindMatrixInverse)}}()});var RT=new Cb,PT=new Cb;function CT(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Cb)}}function OT(){Jb.call(this),this.type="Bone"}Object.assign(CT.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new Cb;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)(e=this.bones[t])&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture,r=0,a=e.length;r<a;r++){var o=e[r]?e[r].matrixWorld:PT;RT.multiplyMatrices(o,t[r]),RT.toArray(n,16*r)}void 0!==i&&(i.needsUpdate=!0)},clone:function(){return new CT(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var i=this.bones[t];if(i.name===e)return i}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),OT.prototype=Object.assign(Object.create(Jb.prototype),{constructor:OT,isBone:!0});var IT=new Cb,DT=new Cb,NT=[],zT=new O_;function UT(e,t,n){O_.call(this,e,t),this.instanceMatrix=new Jw(new Float32Array(16*n),16),this.count=n,this.frustumCulled=!1}function FT(e){qw.call(this),this.type="LineBasicMaterial",this.color=new Hw(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}UT.prototype=Object.assign(Object.create(O_.prototype),{constructor:UT,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){var n=this.matrixWorld,i=this.count;if(zT.geometry=this.geometry,zT.material=this.material,void 0!==zT.material)for(var r=0;r<i;r++){this.getMatrixAt(r,IT),DT.multiplyMatrices(n,IT),zT.matrixWorld=DT,zT.raycast(e,NT);for(var a=0,o=NT.length;a<o;a++){var s=NT[a];s.instanceId=r,s.object=this,t.push(s)}NT.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),FT.prototype=Object.create(qw.prototype),FT.prototype.constructor=FT,FT.prototype.isLineBasicMaterial=!0,FT.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this};var BT=new Mb,HT=new Mb,GT=new Cb,kT=new ww,VT=new dw;function jT(e,t,n){1===n&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),Jb.call(this),this.type="Line",this.geometry=void 0!==e?e:new f_,this.material=void 0!==t?t:new FT,this.updateMorphTargets()}jT.prototype=Object.assign(Object.create(Jb.prototype),{constructor:jT,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],i=1,r=t.count;i<r;i++)BT.fromBufferAttribute(t,i-1),HT.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=BT.distanceTo(HT);e.setAttribute("lineDistance",new i_(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;(n=e.lineDistances)[0]=0;for(i=1,r=a.length;i<r;i++)n[i]=n[i-1],n[i]+=a[i-1].distanceTo(a[i])}return this},raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),VT.copy(n.boundingSphere),VT.applyMatrix4(i),VT.radius+=r,!1!==e.ray.intersectsSphere(VT)){GT.getInverse(i),kT.copy(e.ray).applyMatrix4(GT);var a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new Mb,l=new Mb,c=new Mb,h=new Mb,u=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var p=n.index,d=n.attributes.position.array;if(null!==p)for(var f=p.array,m=0,g=f.length-1;m<g;m+=u){var v=f[m],y=f[m+1];if(s.fromArray(d,3*v),l.fromArray(d,3*y),!(kT.distanceSqToSegment(s,l,h,c)>o))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,g=d.length/3-1;m<g;m+=u){if(s.fromArray(d,3*m),l.fromArray(d,3*m+3),!(kT.distanceSqToSegment(s,l,h,c)>o))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(n.isGeometry){var x=n.vertices,b=x.length;for(m=0;m<b-1;m+=u){var w;if(!(kT.distanceSqToSegment(x[m],x[m+1],h,c)>o))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))<e.near||w>e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var WT=new Mb,qT=new Mb;function XT(e,t){jT.call(this,e,t),this.type="LineSegments"}function YT(e,t){jT.call(this,e,t),this.type="LineLoop"}function JT(e){qw.call(this),this.type="PointsMaterial",this.color=new Hw(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}XT.prototype=Object.assign(Object.create(jT.prototype),{constructor:XT,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],i=0,r=t.count;i<r;i+=2)WT.fromBufferAttribute(t,i),qT.fromBufferAttribute(t,i+1),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+WT.distanceTo(qT);e.setAttribute("lineDistance",new i_(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for(n=e.lineDistances,i=0,r=a.length;i<r;i+=2)WT.copy(a[i]),qT.copy(a[i+1]),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+WT.distanceTo(qT)}return this}}),YT.prototype=Object.assign(Object.create(jT.prototype),{constructor:YT,isLineLoop:!0}),JT.prototype=Object.create(qw.prototype),JT.prototype.constructor=JT,JT.prototype.isPointsMaterial=!0,JT.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};var ZT=new Cb,KT=new ww,QT=new dw,$T=new Mb;function eE(e,t){Jb.call(this),this.type="Points",this.geometry=void 0!==e?e:new f_,this.material=void 0!==t?t:new JT,this.updateMorphTargets()}function tE(e,t,n,i,r,a,o){var s=KT.distanceSqToPoint(e);if(s<n){var l=new Mb;KT.closestPointToPoint(e,l),l.applyMatrix4(i);var c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}function nE(e,t,n,i,r,a,o,s,l){gb.call(this,e,t,n,i,r,a,o,s,l),this.format=void 0!==o?o:1022,this.minFilter=void 0!==a?a:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1}function iE(e,t,n,i,r,a,o,s,l,c,h,u){gb.call(this,null,a,o,s,l,c,i,r,h,u),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function rE(e,t,n,i,r,a,o,s,l){gb.call(this,e,t,n,i,r,a,o,s,l),this.needsUpdate=!0}function aE(e,t,n,i,r,a,o,s,l,c){if(1026!==(c=void 0!==c?c:1026)&&1027!==c)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&1026===c&&(n=1012),void 0===n&&1027===c&&(n=1020),gb.call(this,null,i,r,a,o,s,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:1003,this.minFilter=void 0!==s?s:1003,this.flipY=!1,this.generateMipmaps=!1}function oE(e){f_.call(this),this.type="WireframeGeometry";var t,n,i,r,a,o,s,l,c,h,u=[],p=[0,0],d={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,i=m.length;t<i;t++){var g=m[t];for(n=0;n<3;n++)s=g[f[n]],l=g[f[(n+1)%3]],p[0]=Math.min(s,l),p[1]=Math.max(s,l),void 0===d[c=p[0]+","+p[1]]&&(d[c]={index1:p[0],index2:p[1]})}for(c in d)o=d[c],h=e.vertices[o.index1],u.push(h.x,h.y,h.z),h=e.vertices[o.index2],u.push(h.x,h.y,h.z)}else if(e&&e.isBufferGeometry){var v,y,x,b,w,_,M;if(h=new Mb,null!==e.index){for(v=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),r=0,a=x.length;r<a;++r)for(t=w=(b=x[r]).start,i=w+b.count;t<i;t+=3)for(n=0;n<3;n++)s=y.getX(t+n),l=y.getX(t+(n+1)%3),p[0]=Math.min(s,l),p[1]=Math.max(s,l),void 0===d[c=p[0]+","+p[1]]&&(d[c]={index1:p[0],index2:p[1]});for(c in d)o=d[c],h.fromBufferAttribute(v,o.index1),u.push(h.x,h.y,h.z),h.fromBufferAttribute(v,o.index2),u.push(h.x,h.y,h.z)}else for(t=0,i=(v=e.attributes.position).count/3;t<i;t++)for(n=0;n<3;n++)_=3*t+n,h.fromBufferAttribute(v,_),u.push(h.x,h.y,h.z),M=3*t+(n+1)%3,h.fromBufferAttribute(v,M),u.push(h.x,h.y,h.z)}this.setAttribute("position",new i_(u,3))}function sE(e,t,n){B_.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new lE(e,t,n)),this.mergeVertices()}function lE(e,t,n){f_.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var i,r,a=[],o=[],s=[],l=[],c=1e-5,h=new Mb,u=new Mb,p=new Mb,d=new Mb,f=new Mb;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var m=t+1;for(i=0;i<=n;i++){var g=i/n;for(r=0;r<=t;r++){var v=r/t;e(v,g,u),o.push(u.x,u.y,u.z),v-c>=0?(e(v-c,g,p),d.subVectors(u,p)):(e(v+c,g,p),d.subVectors(p,u)),g-c>=0?(e(v,g-c,p),f.subVectors(u,p)):(e(v,g+c,p),f.subVectors(p,u)),h.crossVectors(d,f).normalize(),s.push(h.x,h.y,h.z),l.push(v,g)}}for(i=0;i<n;i++)for(r=0;r<t;r++){var y=i*m+r,x=i*m+r+1,b=(i+1)*m+r+1,w=(i+1)*m+r;a.push(y,x,w),a.push(x,b,w)}this.setIndex(a),this.setAttribute("position",new i_(o,3)),this.setAttribute("normal",new i_(s,3)),this.setAttribute("uv",new i_(l,2))}function cE(e,t,n,i){B_.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},this.fromBufferGeometry(new hE(e,t,n,i)),this.mergeVertices()}function hE(e,t,n,i){f_.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},n=n||1;var r=[],a=[];function o(e,t,n,i){var r,a,o=Math.pow(2,i),l=[];for(r=0;r<=o;r++){l[r]=[];var c=e.clone().lerp(n,r/o),h=t.clone().lerp(n,r/o),u=o-r;for(a=0;a<=u;a++)l[r][a]=0===a&&r===o?c:c.clone().lerp(h,a/u)}for(r=0;r<o;r++)for(a=0;a<2*(o-r)-1;a++){var p=Math.floor(a/2);a%2==0?(s(l[r][p+1]),s(l[r+1][p]),s(l[r][p])):(s(l[r][p+1]),s(l[r+1][p+1]),s(l[r+1][p]))}}function s(e){r.push(e.x,e.y,e.z)}function l(t,n){var i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function c(e,t,n,i){i<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=i/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function u(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}!function(e){for(var n=new Mb,i=new Mb,r=new Mb,a=0;a<t.length;a+=3)l(t[a+0],n),l(t[a+1],i),l(t[a+2],r),o(n,i,r,e)}(i=i||0),function(e){for(var t=new Mb,n=0;n<r.length;n+=3)t.x=r[n+0],t.y=r[n+1],t.z=r[n+2],t.normalize().multiplyScalar(e),r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z}(n),function(){for(var e=new Mb,t=0;t<r.length;t+=3){e.x=r[t+0],e.y=r[t+1],e.z=r[t+2];var n=h(e)/2/Math.PI+.5,i=u(e)/Math.PI+.5;a.push(n,1-i)}(function(){for(var e=new Mb,t=new Mb,n=new Mb,i=new Mb,o=new pb,s=new pb,l=new pb,u=0,p=0;u<r.length;u+=9,p+=6){e.set(r[u+0],r[u+1],r[u+2]),t.set(r[u+3],r[u+4],r[u+5]),n.set(r[u+6],r[u+7],r[u+8]),o.set(a[p+0],a[p+1]),s.set(a[p+2],a[p+3]),l.set(a[p+4],a[p+5]),i.copy(e).add(t).add(n).divideScalar(3);var d=h(i);c(o,p+0,e,d),c(s,p+2,t,d),c(l,p+4,n,d)}})(),function(){for(var e=0;e<a.length;e+=6){var t=a[e+0],n=a[e+2],i=a[e+4],r=Math.max(t,n,i),o=Math.min(t,n,i);r>.9&&o<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new i_(r,3)),this.setAttribute("normal",new i_(r.slice(),3)),this.setAttribute("uv",new i_(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function uE(e,t){B_.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new pE(e,t)),this.mergeVertices()}function pE(e,t){hE.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function dE(e,t){B_.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new fE(e,t)),this.mergeVertices()}function fE(e,t){hE.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function mE(e,t){B_.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new gE(e,t)),this.mergeVertices()}function gE(e,t){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];hE.call(this,i,[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],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function vE(e,t){B_.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new yE(e,t)),this.mergeVertices()}function yE(e,t){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i];hE.call(this,r,[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],e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function xE(e,t,n,i,r,a){B_.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new bE(e,t,n,i,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function bE(e,t,n,i,r){f_.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},t=t||64,n=n||1,i=i||8,r=r||!1;var a=e.computeFrenetFrames(t,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,l=new Mb,c=new Mb,h=new pb,u=new Mb,p=[],d=[],f=[],m=[];function g(r){u=e.getPointAt(r/t,u);var o=a.normals[r],h=a.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,m=Math.sin(f),g=-Math.cos(f);c.x=g*o.x+m*h.x,c.y=g*o.y+m*h.y,c.z=g*o.z+m*h.z,c.normalize(),d.push(c.x,c.y,c.z),l.x=u.x+n*c.x,l.y=u.y+n*c.y,l.z=u.z+n*c.z,p.push(l.x,l.y,l.z)}}!function(){for(o=0;o<t;o++)g(o);g(!1===r?t:0),function(){for(o=0;o<=t;o++)for(s=0;s<=i;s++)h.x=o/t,h.y=s/i,f.push(h.x,h.y)}(),function(){for(s=1;s<=t;s++)for(o=1;o<=i;o++){var e=(i+1)*(s-1)+(o-1),n=(i+1)*s+(o-1),r=(i+1)*s+o,a=(i+1)*(s-1)+o;m.push(e,n,a),m.push(n,r,a)}}()}(),this.setIndex(m),this.setAttribute("position",new i_(p,3)),this.setAttribute("normal",new i_(d,3)),this.setAttribute("uv",new i_(f,2))}function wE(e,t,n,i,r,a,o){B_.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new _E(e,t,n,i,r,a)),this.mergeVertices()}function _E(e,t,n,i,r,a){f_.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,i=Math.floor(i)||8,r=r||2,a=a||3;var o,s,l=[],c=[],h=[],u=[],p=new Mb,d=new Mb,f=new Mb,m=new Mb,g=new Mb,v=new Mb,y=new Mb;for(o=0;o<=n;++o){var x=o/n*r*Math.PI*2;for(A(x,r,a,e,f),A(x+.01,r,a,e,m),v.subVectors(m,f),y.addVectors(m,f),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize(),s=0;s<=i;++s){var b=s/i*Math.PI*2,w=-t*Math.cos(b),_=t*Math.sin(b);p.x=f.x+(w*y.x+_*g.x),p.y=f.y+(w*y.y+_*g.y),p.z=f.z+(w*y.z+_*g.z),c.push(p.x,p.y,p.z),d.subVectors(p,f).normalize(),h.push(d.x,d.y,d.z),u.push(o/n),u.push(s/i)}}for(s=1;s<=n;s++)for(o=1;o<=i;o++){var M=(i+1)*(s-1)+(o-1),S=(i+1)*s+(o-1),T=(i+1)*s+o,E=(i+1)*(s-1)+o;l.push(M,S,E),l.push(S,T,E)}function A(e,t,n,i,r){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,l=Math.cos(s);r.x=i*(2+l)*.5*a,r.y=i*(2+l)*o*.5,r.z=i*Math.sin(s)*.5}this.setIndex(l),this.setAttribute("position",new i_(c,3)),this.setAttribute("normal",new i_(h,3)),this.setAttribute("uv",new i_(u,2))}function ME(e,t,n,i,r){B_.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new SE(e,t,n,i,r)),this.mergeVertices()}function SE(e,t,n,i,r){f_.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},e=e||1,t=t||.4,n=Math.floor(n)||8,i=Math.floor(i)||6,r=r||2*Math.PI;var a,o,s=[],l=[],c=[],h=[],u=new Mb,p=new Mb,d=new Mb;for(a=0;a<=n;a++)for(o=0;o<=i;o++){var f=o/i*r,m=a/n*Math.PI*2;p.x=(e+t*Math.cos(m))*Math.cos(f),p.y=(e+t*Math.cos(m))*Math.sin(f),p.z=t*Math.sin(m),l.push(p.x,p.y,p.z),u.x=e*Math.cos(f),u.y=e*Math.sin(f),d.subVectors(p,u).normalize(),c.push(d.x,d.y,d.z),h.push(o/i),h.push(a/n)}for(a=1;a<=n;a++)for(o=1;o<=i;o++){var g=(i+1)*a+o-1,v=(i+1)*(a-1)+o-1,y=(i+1)*(a-1)+o,x=(i+1)*a+o;s.push(g,v,x),s.push(v,y,x)}this.setIndex(s),this.setAttribute("position",new i_(l,3)),this.setAttribute("normal",new i_(c,3)),this.setAttribute("uv",new i_(h,2))}eE.prototype=Object.assign(Object.create(Jb.prototype),{constructor:eE,isPoints:!0,raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),QT.copy(n.boundingSphere),QT.applyMatrix4(i),QT.radius+=r,!1!==e.ray.intersectsSphere(QT)){ZT.getInverse(i),KT.copy(e.ray).applyMatrix4(ZT);var a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,l=n.attributes.position.array;if(null!==s)for(var c=s.array,h=0,u=c.length;h<u;h++){var p=c[h];$T.fromArray(l,3*p),tE($T,p,o,i,e,t,this)}else{h=0;for(var d=l.length/3;h<d;h++)$T.fromArray(l,3*h),tE($T,h,o,i,e,t,this)}}else{var f=n.vertices;for(h=0,d=f.length;h<d;h++)tE(f[h],h,o,i,e,t,this)}}},updateMorphTargets:function(){var e,t,n,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e<t;e++)n=o[e].name||String(e),this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}else{var s=i.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),nE.prototype=Object.assign(Object.create(gb.prototype),{constructor:nE,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),iE.prototype=Object.create(gb.prototype),iE.prototype.constructor=iE,iE.prototype.isCompressedTexture=!0,rE.prototype=Object.create(gb.prototype),rE.prototype.constructor=rE,rE.prototype.isCanvasTexture=!0,aE.prototype=Object.create(gb.prototype),aE.prototype.constructor=aE,aE.prototype.isDepthTexture=!0,oE.prototype=Object.create(f_.prototype),oE.prototype.constructor=oE,sE.prototype=Object.create(B_.prototype),sE.prototype.constructor=sE,lE.prototype=Object.create(f_.prototype),lE.prototype.constructor=lE,cE.prototype=Object.create(B_.prototype),cE.prototype.constructor=cE,hE.prototype=Object.create(f_.prototype),hE.prototype.constructor=hE,uE.prototype=Object.create(B_.prototype),uE.prototype.constructor=uE,pE.prototype=Object.create(hE.prototype),pE.prototype.constructor=pE,dE.prototype=Object.create(B_.prototype),dE.prototype.constructor=dE,fE.prototype=Object.create(hE.prototype),fE.prototype.constructor=fE,mE.prototype=Object.create(B_.prototype),mE.prototype.constructor=mE,gE.prototype=Object.create(hE.prototype),gE.prototype.constructor=gE,vE.prototype=Object.create(B_.prototype),vE.prototype.constructor=vE,yE.prototype=Object.create(hE.prototype),yE.prototype.constructor=yE,xE.prototype=Object.create(B_.prototype),xE.prototype.constructor=xE,bE.prototype=Object.create(f_.prototype),bE.prototype.constructor=bE,bE.prototype.toJSON=function(){var e=f_.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},wE.prototype=Object.create(B_.prototype),wE.prototype.constructor=wE,_E.prototype=Object.create(f_.prototype),_E.prototype.constructor=_E,ME.prototype=Object.create(B_.prototype),ME.prototype.constructor=ME,SE.prototype=Object.create(f_.prototype),SE.prototype.constructor=SE;var TE=function(e,t,n){n=n||2;var i,r,a,o,s,l,c,h=t&&t.length,u=h?t[0]*n:e.length,p=EE(e,0,u,n,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=function(e,t,n,i){var r,a,o,s,l,c=[];for(r=0,a=t.length;r<a;r++)o=t[r]*i,s=r<a-1?t[r+1]*i:e.length,(l=EE(e,o,s,i,!1))===l.next&&(l.steiner=!0),c.push(UE(l));for(c.sort(IE),r=0;r<c.length;r++)DE(c[r],n),n=AE(n,n.next);return n}(e,t,p,n)),e.length>80*n){i=a=e[0],r=o=e[1];for(var f=n;f<u;f+=n)(s=e[f])<i&&(i=s),(l=e[f+1])<r&&(r=l),s>a&&(a=s),l>o&&(o=l);c=0!==(c=Math.max(a-i,o-r))?1/c:0}return LE(p,d,n,i,r,c),d};function EE(e,t,n,i,r){var a,o;if(r===function(e,t,n,i){for(var r=0,a=t,o=n-i;a<n;a+=i)r+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return r}(e,t,n,i)>0)for(a=t;a<n;a+=i)o=XE(a,e[a],e[a+1],o);else for(a=n-i;a>=t;a-=i)o=XE(a,e[a],e[a+1],o);return o&&GE(o,o.next)&&(YE(o),o=o.next),o}function AE(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!GE(i,i.next)&&0!==HE(i.prev,i,i.next))i=i.next;else{if(YE(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function LE(e,t,n,i,r,a,o){if(e){!o&&a&&function(e,t,n,i){var r=e;do{null===r.z&&(r.z=zE(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,a,o,s,l,c=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t<c&&(s++,i=i.nextZ);t++);for(l=c;s>0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,a);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?PE(e,i,r,a):RE(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),YE(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?LE(e=CE(AE(e),t,n),t,n,i,r,a,2):2===o&&OE(e,t,n,i,r,a):LE(AE(e),t,n,i,r,a,1);break}}}function RE(e){var t=e.prev,n=e,i=e.next;if(HE(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(FE(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&HE(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function PE(e,t,n,i){var r=e.prev,a=e,o=e.next;if(HE(r,a,o)>=0)return!1;for(var s=r.x<a.x?r.x<o.x?r.x:o.x:a.x<o.x?a.x:o.x,l=r.y<a.y?r.y<o.y?r.y:o.y:a.y<o.y?a.y:o.y,c=r.x>a.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,h=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,u=zE(s,l,t,n,i),p=zE(c,h,t,n,i),d=e.prevZ,f=e.nextZ;d&&d.z>=u&&f&&f.z<=p;){if(d!==e.prev&&d!==e.next&&FE(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&HE(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,f!==e.prev&&f!==e.next&&FE(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&HE(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;d&&d.z>=u;){if(d!==e.prev&&d!==e.next&&FE(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&HE(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;f&&f.z<=p;){if(f!==e.prev&&f!==e.next&&FE(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&HE(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function CE(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!GE(r,a)&&kE(r,i,i.next,a)&&WE(r,a)&&WE(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),YE(i),YE(i.next),i=e=a),i=i.next}while(i!==e);return AE(i)}function OE(e,t,n,i,r,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&BE(o,s)){var l=qE(o,s);return o=AE(o,o.next),l=AE(l,l.next),LE(o,t,n,i,r,a),void LE(l,t,n,i,r,a)}s=s.next}o=o.next}while(o!==e)}function IE(e,t){return e.x-t.x}function DE(e,t){if(t=function(e,t){var n,i=t,r=e.x,a=e.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>o){if(o=s,s===r){if(a===i.y)return i;if(a===i.next.y)return i.next}n=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!n)return null;if(r===o)return n;var l,c=n,h=n.x,u=n.y,p=1/0;i=n;do{r>=i.x&&i.x>=h&&r!==i.x&&FE(a<u?r:o,a,h,u,a<u?o:r,a,i.x,i.y)&&(l=Math.abs(a-i.y)/(r-i.x),WE(i,e)&&(l<p||l===p&&(i.x>n.x||i.x===n.x&&NE(n,i)))&&(n=i,p=l)),i=i.next}while(i!==c);return n}(e,t)){var n=qE(t,e);AE(t,t.next),AE(n,n.next)}}function NE(e,t){return HE(e.prev,e,t.prev)<0&&HE(t.next,e,e.next)<0}function zE(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function UE(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function FE(e,t,n,i,r,a,o,s){return(r-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(i-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(r-o)*(i-s)>=0}function BE(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&kE(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(WE(e,t)&&WE(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(HE(e.prev,e,t.prev)||HE(e,t.prev,t))||GE(e,t)&&HE(e.prev,e,e.next)>0&&HE(t.prev,t,t.next)>0)}function HE(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function GE(e,t){return e.x===t.x&&e.y===t.y}function kE(e,t,n,i){var r=jE(HE(e,t,n)),a=jE(HE(e,t,i)),o=jE(HE(n,i,e)),s=jE(HE(n,i,t));return r!==a&&o!==s||(!(0!==r||!VE(e,n,t))||(!(0!==a||!VE(e,i,t))||(!(0!==o||!VE(n,e,i))||!(0!==s||!VE(n,t,i)))))}function VE(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function jE(e){return e>0?1:e<0?-1:0}function WE(e,t){return HE(e.prev,e,e.next)<0?HE(e,t,e.next)>=0&&HE(e,e.prev,t)>=0:HE(e,t,e.prev)<0||HE(e,e.next,t)<0}function qE(e,t){var n=new JE(e.i,e.x,e.y),i=new JE(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function XE(e,t,n,i){var r=new JE(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function YE(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function JE(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ZE={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n},isClockWise:function(e){return ZE.area(e)<0},triangulateShape:function(e,t){var n=[],i=[],r=[];KE(e),QE(n,e);var a=e.length;t.forEach(KE);for(var o=0;o<t.length;o++)i.push(a),a+=t[o].length,QE(n,t[o]);var s=TE(n,i);for(o=0;o<s.length;o+=3)r.push(s.slice(o,o+3));return r}};function KE(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function QE(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function $E(e,t){B_.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new eA(e,t)),this.mergeVertices()}function eA(e,t){f_.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,i=[],r=[],a=0,o=e.length;a<o;a++){s(e[a])}function s(e){var a=[],o=void 0!==t.curveSegments?t.curveSegments:12,s=void 0!==t.steps?t.steps:1,l=void 0!==t.depth?t.depth:100,c=void 0===t.bevelEnabled||t.bevelEnabled,h=void 0!==t.bevelThickness?t.bevelThickness:6,u=void 0!==t.bevelSize?t.bevelSize:h-2,p=void 0!==t.bevelOffset?t.bevelOffset:0,d=void 0!==t.bevelSegments?t.bevelSegments:3,f=t.extrudePath,m=void 0!==t.UVGenerator?t.UVGenerator:tA;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=t.amount);var g,v,y,x,b,w,_,M,S=!1;f&&(g=f.getSpacedPoints(s),S=!0,c=!1,v=f.computeFrenetFrames(s,!1),y=new Mb,x=new Mb,b=new Mb),c||(d=0,h=0,u=0,p=0);var T=e.extractPoints(o),E=T.shape,A=T.holes;if(!ZE.isClockWise(E))for(E=E.reverse(),_=0,M=A.length;_<M;_++)w=A[_],ZE.isClockWise(w)&&(A[_]=w.reverse());var L=ZE.triangulateShape(E,A),R=E;for(_=0,M=A.length;_<M;_++)w=A[_],E=E.concat(w);function P(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var C,O,I,D,N,z,U=E.length,F=L.length;function B(e,t,n){var i,r,a,o=e.x-t.x,s=e.y-t.y,l=n.x-e.x,c=n.y-e.y,h=o*o+s*s,u=o*c-s*l;if(Math.abs(u)>Number.EPSILON){var p=Math.sqrt(h),d=Math.sqrt(l*l+c*c),f=t.x-s/p,m=t.y+o/p,g=((n.x-c/d-f)*c-(n.y+l/d-m)*l)/(o*c-s*l),v=(i=f+o*g-e.x)*i+(r=m+s*g-e.y)*r;if(v<=2)return new pb(i,r);a=Math.sqrt(v/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),y?(i=-s,r=o,a=Math.sqrt(h)):(i=o,r=s,a=Math.sqrt(h/2))}return new pb(i/a,r/a)}for(var H=[],G=0,k=R.length,V=k-1,j=G+1;G<k;G++,V++,j++)V===k&&(V=0),j===k&&(j=0),H[G]=B(R[G],R[V],R[j]);var W,q,X=[],Y=H.concat();for(_=0,M=A.length;_<M;_++){for(w=A[_],W=[],G=0,V=(k=w.length)-1,j=G+1;G<k;G++,V++,j++)V===k&&(V=0),j===k&&(j=0),W[G]=B(w[G],w[V],w[j]);X.push(W),Y=Y.concat(W)}for(C=0;C<d;C++){for(I=C/d,D=h*Math.cos(I*Math.PI/2),O=u*Math.sin(I*Math.PI/2)+p,G=0,k=R.length;G<k;G++)Z((N=P(R[G],H[G],O)).x,N.y,-D);for(_=0,M=A.length;_<M;_++)for(w=A[_],W=X[_],G=0,k=w.length;G<k;G++)Z((N=P(w[G],W[G],O)).x,N.y,-D)}for(O=u+p,G=0;G<U;G++)N=c?P(E[G],Y[G],O):E[G],S?(x.copy(v.normals[0]).multiplyScalar(N.x),y.copy(v.binormals[0]).multiplyScalar(N.y),b.copy(g[0]).add(x).add(y),Z(b.x,b.y,b.z)):Z(N.x,N.y,0);for(q=1;q<=s;q++)for(G=0;G<U;G++)N=c?P(E[G],Y[G],O):E[G],S?(x.copy(v.normals[q]).multiplyScalar(N.x),y.copy(v.binormals[q]).multiplyScalar(N.y),b.copy(g[q]).add(x).add(y),Z(b.x,b.y,b.z)):Z(N.x,N.y,l/s*q);for(C=d-1;C>=0;C--){for(I=C/d,D=h*Math.cos(I*Math.PI/2),O=u*Math.sin(I*Math.PI/2)+p,G=0,k=R.length;G<k;G++)Z((N=P(R[G],H[G],O)).x,N.y,l+D);for(_=0,M=A.length;_<M;_++)for(w=A[_],W=X[_],G=0,k=w.length;G<k;G++)N=P(w[G],W[G],O),S?Z(N.x,N.y+g[s-1].y,g[s-1].x+D):Z(N.x,N.y,l+D)}function J(e,t){var n,i;for(G=e.length;--G>=0;){n=G,(i=G-1)<0&&(i=e.length-1);var r=0,a=s+2*d;for(r=0;r<a;r++){var o=U*r,l=U*(r+1);Q(t+n+o,t+i+o,t+i+l,t+n+l)}}}function Z(e,t,n){a.push(e),a.push(t),a.push(n)}function K(e,t,r){$(e),$(t),$(r);var a=i.length/3,o=m.generateTopUV(n,i,a-3,a-2,a-1);ee(o[0]),ee(o[1]),ee(o[2])}function Q(e,t,r,a){$(e),$(t),$(a),$(t),$(r),$(a);var o=i.length/3,s=m.generateSideWallUV(n,i,o-6,o-3,o-2,o-1);ee(s[0]),ee(s[1]),ee(s[3]),ee(s[1]),ee(s[2]),ee(s[3])}function $(e){i.push(a[3*e+0]),i.push(a[3*e+1]),i.push(a[3*e+2])}function ee(e){r.push(e.x),r.push(e.y)}!function(){var e=i.length/3;if(c){var t=0,r=U*t;for(G=0;G<F;G++)K((z=L[G])[2]+r,z[1]+r,z[0]+r);for(r=U*(t=s+2*d),G=0;G<F;G++)K((z=L[G])[0]+r,z[1]+r,z[2]+r)}else{for(G=0;G<F;G++)K((z=L[G])[2],z[1],z[0]);for(G=0;G<F;G++)K((z=L[G])[0]+U*s,z[1]+U*s,z[2]+U*s)}n.addGroup(e,i.length/3-e,0)}(),function(){var e=i.length/3,t=0;for(J(R,t),t+=R.length,_=0,M=A.length;_<M;_++)J(w=A[_],t),t+=w.length;n.addGroup(e,i.length/3-e,1)}()}this.setAttribute("position",new i_(i,3)),this.setAttribute("uv",new i_(r,2)),this.computeVertexNormals()}$E.prototype=Object.create(B_.prototype),$E.prototype.constructor=$E,$E.prototype.toJSON=function(){var e=B_.prototype.toJSON.call(this);return nA(this.parameters.shapes,this.parameters.options,e)},eA.prototype=Object.create(f_.prototype),eA.prototype.constructor=eA,eA.prototype.toJSON=function(){var e=f_.prototype.toJSON.call(this);return nA(this.parameters.shapes,this.parameters.options,e)};var tA={generateTopUV:function(e,t,n,i,r){var a=t[3*n],o=t[3*n+1],s=t[3*i],l=t[3*i+1],c=t[3*r],h=t[3*r+1];return[new pb(a,o),new pb(s,l),new pb(c,h)]},generateSideWallUV:function(e,t,n,i,r,a){var o=t[3*n],s=t[3*n+1],l=t[3*n+2],c=t[3*i],h=t[3*i+1],u=t[3*i+2],p=t[3*r],d=t[3*r+1],f=t[3*r+2],m=t[3*a],g=t[3*a+1],v=t[3*a+2];return Math.abs(s-h)<.01?[new pb(o,1-l),new pb(c,1-u),new pb(p,1-f),new pb(m,1-v)]:[new pb(s,1-l),new pb(h,1-u),new pb(d,1-f),new pb(g,1-v)]}};function nA(e,t,n){if(n.shapes=[],Array.isArray(e))for(var i=0,r=e.length;i<r;i++){var a=e[i];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function iA(e,t){B_.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new rA(e,t)),this.mergeVertices()}function rA(e,t){var n=(t=t||{}).font;if(!n||!n.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new B_;var i=n.generateShapes(e,t.size);t.depth=void 0!==t.height?t.height:50,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),eA.call(this,i,t),this.type="TextBufferGeometry"}function aA(e,t,n,i,r,a,o){B_.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new oA(e,t,n,i,r,a,o)),this.mergeVertices()}function oA(e,t,n,i,r,a,o){f_.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;var s,l,c=Math.min(a+o,Math.PI),h=0,u=[],p=new Mb,d=new Mb,f=[],m=[],g=[],v=[];for(l=0;l<=n;l++){var y=[],x=l/n,b=0;for(0==l&&0==a?b=.5/t:l==n&&c==Math.PI&&(b=-.5/t),s=0;s<=t;s++){var w=s/t;p.x=-e*Math.cos(i+w*r)*Math.sin(a+x*o),p.y=e*Math.cos(a+x*o),p.z=e*Math.sin(i+w*r)*Math.sin(a+x*o),m.push(p.x,p.y,p.z),d.copy(p).normalize(),g.push(d.x,d.y,d.z),v.push(w+b,1-x),y.push(h++)}u.push(y)}for(l=0;l<n;l++)for(s=0;s<t;s++){var _=u[l][s+1],M=u[l][s],S=u[l+1][s],T=u[l+1][s+1];(0!==l||a>0)&&f.push(_,M,T),(l!==n-1||c<Math.PI)&&f.push(M,S,T)}this.setIndex(f),this.setAttribute("position",new i_(m,3)),this.setAttribute("normal",new i_(g,3)),this.setAttribute("uv",new i_(v,2))}function sA(e,t,n,i,r,a){B_.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new lA(e,t,n,i,r,a)),this.mergeVertices()}function lA(e,t,n,i,r,a){f_.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},e=e||.5,t=t||1,r=void 0!==r?r:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var o,s,l,c=[],h=[],u=[],p=[],d=e,f=(t-e)/(i=void 0!==i?Math.max(1,i):1),m=new Mb,g=new pb;for(s=0;s<=i;s++){for(l=0;l<=n;l++)o=r+l/n*a,m.x=d*Math.cos(o),m.y=d*Math.sin(o),h.push(m.x,m.y,m.z),u.push(0,0,1),g.x=(m.x/t+1)/2,g.y=(m.y/t+1)/2,p.push(g.x,g.y);d+=f}for(s=0;s<i;s++){var v=s*(n+1);for(l=0;l<n;l++){var y=o=l+v,x=o+n+1,b=o+n+2,w=o+1;c.push(y,x,w),c.push(x,b,w)}}this.setIndex(c),this.setAttribute("position",new i_(h,3)),this.setAttribute("normal",new i_(u,3)),this.setAttribute("uv",new i_(p,2))}function cA(e,t,n,i){B_.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},this.fromBufferGeometry(new hA(e,t,n,i)),this.mergeVertices()}function hA(e,t,n,i){f_.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t)||12,n=n||0,i=i||2*Math.PI,i=ub.clamp(i,0,2*Math.PI);var r,a,o,s=[],l=[],c=[],h=1/t,u=new Mb,p=new pb;for(a=0;a<=t;a++){var d=n+a*h*i,f=Math.sin(d),m=Math.cos(d);for(o=0;o<=e.length-1;o++)u.x=e[o].x*f,u.y=e[o].y,u.z=e[o].x*m,l.push(u.x,u.y,u.z),p.x=a/t,p.y=o/(e.length-1),c.push(p.x,p.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var g=r=o+a*e.length,v=r+e.length,y=r+e.length+1,x=r+1;s.push(g,v,x),s.push(v,y,x)}if(this.setIndex(s),this.setAttribute("position",new i_(l,3)),this.setAttribute("uv",new i_(c,2)),this.computeVertexNormals(),i===2*Math.PI){var b=this.attributes.normal.array,w=new Mb,_=new Mb,M=new Mb;for(r=t*e.length*3,a=0,o=0;a<e.length;a++,o+=3)w.x=b[o+0],w.y=b[o+1],w.z=b[o+2],_.x=b[r+o+0],_.y=b[r+o+1],_.z=b[r+o+2],M.addVectors(w,_).normalize(),b[o+0]=b[r+o+0]=M.x,b[o+1]=b[r+o+1]=M.y,b[o+2]=b[r+o+2]=M.z}}function uA(e,t){B_.call(this),this.type="ShapeGeometry","object"==typeof t&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new pA(e,t)),this.mergeVertices()}function pA(e,t){f_.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],i=[],r=[],a=[],o=0,s=0;if(!1===Array.isArray(e))c(e);else for(var l=0;l<e.length;l++)c(e[l]),this.addGroup(o,s,l),o+=s,s=0;function c(e){var o,l,c,h=i.length/3,u=e.extractPoints(t),p=u.shape,d=u.holes;for(!1===ZE.isClockWise(p)&&(p=p.reverse()),o=0,l=d.length;o<l;o++)c=d[o],!0===ZE.isClockWise(c)&&(d[o]=c.reverse());var f=ZE.triangulateShape(p,d);for(o=0,l=d.length;o<l;o++)c=d[o],p=p.concat(c);for(o=0,l=p.length;o<l;o++){var m=p[o];i.push(m.x,m.y,0),r.push(0,0,1),a.push(m.x,m.y)}for(o=0,l=f.length;o<l;o++){var g=f[o],v=g[0]+h,y=g[1]+h,x=g[2]+h;n.push(v,y,x),s+=3}}this.setIndex(n),this.setAttribute("position",new i_(i,3)),this.setAttribute("normal",new i_(r,3)),this.setAttribute("uv",new i_(a,2))}function dA(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}function fA(e,t){f_.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,i,r,a,o=[],s=Math.cos(ub.DEG2RAD*t),l=[0,0],c={},h=["a","b","c"];e.isBufferGeometry?(a=new B_).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var u=a.vertices,p=a.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],g=0;g<3;g++)n=m[h[g]],i=m[h[(g+1)%3]],l[0]=Math.min(n,i),l[1]=Math.max(n,i),void 0===c[r=l[0]+","+l[1]]?c[r]={index1:l[0],index2:l[1],face1:d,face2:void 0}:c[r].face2=d;for(r in c){var v=c[r];if(void 0===v.face2||p[v.face1].normal.dot(p[v.face2].normal)<=s){var y=u[v.index1];o.push(y.x,y.y,y.z),y=u[v.index2],o.push(y.x,y.y,y.z)}}this.setAttribute("position",new i_(o,3))}function mA(e,t,n,i,r,a,o,s){B_.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new gA(e,t,n,i,r,a,o,s)),this.mergeVertices()}function gA(e,t,n,i,r,a,o,s){f_.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s};var l=this;e=void 0!==e?e:1,t=void 0!==t?t:1,n=n||1,i=Math.floor(i)||8,r=Math.floor(r)||1,a=void 0!==a&&a,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI;var c=[],h=[],u=[],p=[],d=0,f=[],m=n/2,g=0;function v(n){var r,a,f,v=new pb,y=new Mb,x=0,b=!0===n?e:t,w=!0===n?1:-1;for(a=d,r=1;r<=i;r++)h.push(0,m*w,0),u.push(0,w,0),p.push(.5,.5),d++;for(f=d,r=0;r<=i;r++){var _=r/i*s+o,M=Math.cos(_),S=Math.sin(_);y.x=b*S,y.y=m*w,y.z=b*M,h.push(y.x,y.y,y.z),u.push(0,w,0),v.x=.5*M+.5,v.y=.5*S*w+.5,p.push(v.x,v.y),d++}for(r=0;r<i;r++){var T=a+r,E=f+r;!0===n?c.push(E,E+1,T):c.push(E+1,E,T),x+=3}l.addGroup(g,x,!0===n?1:2),g+=x}!function(){var a,v,y=new Mb,x=new Mb,b=0,w=(t-e)/n;for(v=0;v<=r;v++){var _=[],M=v/r,S=M*(t-e)+e;for(a=0;a<=i;a++){var T=a/i,E=T*s+o,A=Math.sin(E),L=Math.cos(E);x.x=S*A,x.y=-M*n+m,x.z=S*L,h.push(x.x,x.y,x.z),y.set(A,w,L).normalize(),u.push(y.x,y.y,y.z),p.push(T,1-M),_.push(d++)}f.push(_)}for(a=0;a<i;a++)for(v=0;v<r;v++){var R=f[v][a],P=f[v+1][a],C=f[v+1][a+1],O=f[v][a+1];c.push(R,P,O),c.push(P,C,O),b+=6}l.addGroup(g,b,0),g+=b}(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new i_(h,3)),this.setAttribute("normal",new i_(u,3)),this.setAttribute("uv",new i_(p,2))}function vA(e,t,n,i,r,a,o){mA.call(this,0,e,t,n,i,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function yA(e,t,n,i,r,a,o){gA.call(this,0,e,t,n,i,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function xA(e,t,n,i){B_.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new bA(e,t,n,i)),this.mergeVertices()}function bA(e,t,n,i){f_.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,a,o=[],s=[],l=[],c=[],h=new Mb,u=new pb;for(s.push(0,0,0),l.push(0,0,1),c.push(.5,.5),a=0,r=3;a<=t;a++,r+=3){var p=n+a/t*i;h.x=e*Math.cos(p),h.y=e*Math.sin(p),s.push(h.x,h.y,h.z),l.push(0,0,1),u.x=(s[r]/e+1)/2,u.y=(s[r+1]/e+1)/2,c.push(u.x,u.y)}for(r=1;r<=t;r++)o.push(r,r+1,0);this.setIndex(o),this.setAttribute("position",new i_(s,3)),this.setAttribute("normal",new i_(l,3)),this.setAttribute("uv",new i_(c,2))}iA.prototype=Object.create(B_.prototype),iA.prototype.constructor=iA,rA.prototype=Object.create(eA.prototype),rA.prototype.constructor=rA,aA.prototype=Object.create(B_.prototype),aA.prototype.constructor=aA,oA.prototype=Object.create(f_.prototype),oA.prototype.constructor=oA,sA.prototype=Object.create(B_.prototype),sA.prototype.constructor=sA,lA.prototype=Object.create(f_.prototype),lA.prototype.constructor=lA,cA.prototype=Object.create(B_.prototype),cA.prototype.constructor=cA,hA.prototype=Object.create(f_.prototype),hA.prototype.constructor=hA,uA.prototype=Object.create(B_.prototype),uA.prototype.constructor=uA,uA.prototype.toJSON=function(){var e=B_.prototype.toJSON.call(this);return dA(this.parameters.shapes,e)},pA.prototype=Object.create(f_.prototype),pA.prototype.constructor=pA,pA.prototype.toJSON=function(){var e=f_.prototype.toJSON.call(this);return dA(this.parameters.shapes,e)},fA.prototype=Object.create(f_.prototype),fA.prototype.constructor=fA,mA.prototype=Object.create(B_.prototype),mA.prototype.constructor=mA,gA.prototype=Object.create(f_.prototype),gA.prototype.constructor=gA,vA.prototype=Object.create(mA.prototype),vA.prototype.constructor=vA,yA.prototype=Object.create(gA.prototype),yA.prototype.constructor=yA,xA.prototype=Object.create(B_.prototype),xA.prototype.constructor=xA,bA.prototype=Object.create(f_.prototype),bA.prototype.constructor=bA;var wA=Object.freeze({__proto__:null,WireframeGeometry:oE,ParametricGeometry:sE,ParametricBufferGeometry:lE,TetrahedronGeometry:uE,TetrahedronBufferGeometry:pE,OctahedronGeometry:dE,OctahedronBufferGeometry:fE,IcosahedronGeometry:mE,IcosahedronBufferGeometry:gE,DodecahedronGeometry:vE,DodecahedronBufferGeometry:yE,PolyhedronGeometry:cE,PolyhedronBufferGeometry:hE,TubeGeometry:xE,TubeBufferGeometry:bE,TorusKnotGeometry:wE,TorusKnotBufferGeometry:_E,TorusGeometry:ME,TorusBufferGeometry:SE,TextGeometry:iA,TextBufferGeometry:rA,SphereGeometry:aA,SphereBufferGeometry:oA,RingGeometry:sA,RingBufferGeometry:lA,PlaneGeometry:nM,PlaneBufferGeometry:iM,LatheGeometry:cA,LatheBufferGeometry:hA,ShapeGeometry:uA,ShapeBufferGeometry:pA,ExtrudeGeometry:$E,ExtrudeBufferGeometry:eA,EdgesGeometry:fA,ConeGeometry:vA,ConeBufferGeometry:yA,CylinderGeometry:mA,CylinderBufferGeometry:gA,CircleGeometry:xA,CircleBufferGeometry:bA,BoxGeometry:class extends B_{constructor(e,t,n,i,r,a){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new H_(e,t,n,i,r,a)),this.mergeVertices()}},BoxBufferGeometry:H_});function _A(e){qw.call(this),this.type="ShadowMaterial",this.color=new Hw(0),this.transparent=!0,this.setValues(e)}function MA(e){j_.call(this,e),this.type="RawShaderMaterial"}function SA(e){qw.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Hw(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Hw(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new pb(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function TA(e){SA.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new pb(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}function EA(e){qw.call(this),this.type="MeshPhongMaterial",this.color=new Hw(16777215),this.specular=new Hw(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Hw(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new pb(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function AA(e){qw.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Hw(16777215),this.specular=new Hw(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Hw(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new pb(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function LA(e){qw.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new pb(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function RA(e){qw.call(this),this.type="MeshLambertMaterial",this.color=new Hw(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Hw(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function PA(e){qw.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Hw(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new pb(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function CA(e){FT.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}_A.prototype=Object.create(qw.prototype),_A.prototype.constructor=_A,_A.prototype.isShadowMaterial=!0,_A.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.color.copy(e.color),this},MA.prototype=Object.create(j_.prototype),MA.prototype.constructor=MA,MA.prototype.isRawShaderMaterial=!0,SA.prototype=Object.create(qw.prototype),SA.prototype.constructor=SA,SA.prototype.isMeshStandardMaterial=!0,SA.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},TA.prototype=Object.create(SA.prototype),TA.prototype.constructor=TA,TA.prototype.isMeshPhysicalMaterial=!0,TA.prototype.copy=function(e){return SA.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new Hw).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this},EA.prototype=Object.create(qw.prototype),EA.prototype.constructor=EA,EA.prototype.isMeshPhongMaterial=!0,EA.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},AA.prototype=Object.create(qw.prototype),AA.prototype.constructor=AA,AA.prototype.isMeshToonMaterial=!0,AA.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},LA.prototype=Object.create(qw.prototype),LA.prototype.constructor=LA,LA.prototype.isMeshNormalMaterial=!0,LA.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},RA.prototype=Object.create(qw.prototype),RA.prototype.constructor=RA,RA.prototype.isMeshLambertMaterial=!0,RA.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},PA.prototype=Object.create(qw.prototype),PA.prototype.constructor=PA,PA.prototype.isMeshMatcapMaterial=!0,PA.prototype.copy=function(e){return qw.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},CA.prototype=Object.create(FT.prototype),CA.prototype.constructor=CA,CA.prototype.isLineDashedMaterial=!0,CA.prototype.copy=function(e){return FT.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var OA=Object.freeze({__proto__:null,ShadowMaterial:_A,SpriteMaterial:hT,RawShaderMaterial:MA,ShaderMaterial:j_,PointsMaterial:JT,MeshPhysicalMaterial:TA,MeshStandardMaterial:SA,MeshPhongMaterial:EA,MeshToonMaterial:AA,MeshNormalMaterial:LA,MeshLambertMaterial:RA,MeshDepthMaterial:qS,MeshDistanceMaterial:XS,MeshBasicMaterial:Xw,MeshMatcapMaterial:PA,LineDashedMaterial:CA,LineBasicMaterial:FT,Material:qw}),IA={arraySlice:function(e,t,n){return IA.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,l=0;l!==t;++l)r[o++]=e[s+l];return r},flattenJSON:function(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}},subclip:function(e,t,n,i,r){r=r||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var l=a.tracks[s],c=l.getValueSize(),h=[],u=[],p=0;p<l.times.length;++p){var d=l.times[p]*r;if(!(d<n||d>=i)){h.push(l.times[p]);for(var f=0;f<c;++f)u.push(l.values[p*c+f])}}0!==h.length&&(l.times=IA.convertArray(h,l.times.constructor),l.values=IA.convertArray(u,l.values.constructor),o.push(l))}a.tracks=o;var m=1/0;for(s=0;s<a.tracks.length;++s)m>a.tracks[s].times[0]&&(m=a.tracks[s].times[0]);for(s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*m);return a.resetDuration(),a},makeClipAdditive:function(e,t,n,i){void 0===t&&(t=0),void 0===n&&(n=e),(void 0===i||i<=0)&&(i=30);for(var r=e.tracks.length,a=t/i,o=0;o<r;++o){var s=n.tracks[o],l=s.ValueTypeName;if("bool"!==l&&"string"!==l){var c=e.tracks.find((function(e){return e.name===s.name&&e.ValueTypeName===l}));if(void 0!==c){var h,u=s.getValueSize(),p=s.times.length-1;if(a<=s.times[0])h=IA.arraySlice(s.values,0,s.valueSize);else if(a>=s.times[p]){var d=p*u;h=IA.arraySlice(s.values,d)}else{var f=s.createInterpolant();f.evaluate(a),h=f.resultBuffer}if("quaternion"===l)new bb(h[0],h[1],h[2],h[3]).normalize().conjugate().toArray(h);for(var m=c.times.length,g=0;g<m;++g){var v=g*u;if("quaternion"===l)bb.multiplyQuaternionsFlat(c.values,v,h,0,c.values,v);else for(var y=0;y<u;++y)c.values[v+y]-=h[y]}}}}return e.blendMode=2501,e}};function DA(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function NA(e,t,n,i){DA.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function zA(e,t,n,i){DA.call(this,e,t,n,i)}function UA(e,t,n,i){DA.call(this,e,t,n,i)}function FA(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=IA.convertArray(t,this.TimeBufferType),this.values=IA.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}function BA(e,t,n){FA.call(this,e,t,n)}function HA(e,t,n,i){FA.call(this,e,t,n,i)}function GA(e,t,n,i){FA.call(this,e,t,n,i)}function kA(e,t,n,i){DA.call(this,e,t,n,i)}function VA(e,t,n,i){FA.call(this,e,t,n,i)}function jA(e,t,n,i){FA.call(this,e,t,n,i)}function WA(e,t,n,i){FA.call(this,e,t,n,i)}function qA(e,t,n,i){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.blendMode=void 0!==i?i:2500,this.uuid=ub.generateUUID(),this.duration<0&&this.resetDuration()}function XA(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return GA;case"vector":case"vector2":case"vector3":case"vector4":return WA;case"color":return HA;case"quaternion":return VA;case"bool":case"boolean":return BA;case"string":return jA}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],i=[];IA.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(DA.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var a;n:{i:if(!(e<i)){for(var o=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,r)}if(n===o)break;if(r=i,e<(i=t[++n]))break t}a=t.length;break n}if(e>=r)break e;var s=t[1];e<s&&(n=2,r=s);for(o=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===o)break;if(i=r,e>=(r=t[--n-1]))break t}a=n,n=0}for(;n<a;){var l=n+a>>>1;e<t[l]?a=l:n=l+1}if(i=t[n],void 0===(r=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,r,e)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i,a=0;a!==i;++a)t[a]=n[r+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(DA.prototype,{beforeStart_:DA.prototype.copySampleValue_,afterEnd_:DA.prototype.copySampleValue_}),NA.prototype=Object.assign(Object.create(DA.prototype),{constructor:NA,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(e,t,n){var i=this.parameterPositions,r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:o=t+i[r=i.length-2]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=e,s=2*n-t;break;case 2402:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}var l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=r*c,this._offsetNext=a*c},interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(n-t)/(i-t),f=d*d,m=f*d,g=-u*m+2*u*f-u*d,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==o;++b)r[b]=g*a[c+b]+v*a[l+b]+y*a[s+b]+x*a[h+b];return r}}),zA.prototype=Object.assign(Object.create(DA.prototype),{constructor:zA,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=(n-t)/(i-t),h=1-c,u=0;u!==o;++u)r[u]=a[l+u]*h+a[s+u]*c;return r}}),UA.prototype=Object.assign(Object.create(DA.prototype),{constructor:UA,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(FA,{toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:IA.convertArray(e.times,Array),values:IA.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}}),Object.assign(FA.prototype,{constructor:FA,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new UA(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new zA(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new NA(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,i=n.length,r=0,a=i-1;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=IA.arraySlice(n,r,a),this.values=IA.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&IA.isTypedArray(i)){o=0;for(var l=i.length;o!==l;++o){var c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}}return e},optimize:function(){for(var e=IA.arraySlice(this.times),t=IA.arraySlice(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=1,a=e.length-1,o=1;o<a;++o){var s=!1,l=e[o];if(l!==e[o+1]&&(1!==o||l!==l[0]))if(i)s=!0;else for(var c=o*n,h=c-n,u=c+n,p=0;p!==n;++p){var d=t[c+p];if(d!==t[h+p]||d!==t[u+p]){s=!0;break}}if(s){if(o!==r){e[r]=e[o];var f=o*n,m=r*n;for(p=0;p!==n;++p)t[m+p]=t[f+p]}++r}}if(a>0){e[r]=e[a];for(f=a*n,m=r*n,p=0;p!==n;++p)t[m+p]=t[f+p];++r}return r!==e.length?(this.times=IA.arraySlice(e,0,r),this.values=IA.arraySlice(t,0,r*n)):(this.times=e,this.values=t),this},clone:function(){var e=IA.arraySlice(this.times,0),t=IA.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),BA.prototype=Object.assign(Object.create(FA.prototype),{constructor:BA,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),HA.prototype=Object.assign(Object.create(FA.prototype),{constructor:HA,ValueTypeName:"color"}),GA.prototype=Object.assign(Object.create(FA.prototype),{constructor:GA,ValueTypeName:"number"}),kA.prototype=Object.assign(Object.create(DA.prototype),{constructor:kA,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=(n-t)/(i-t),c=s+o;s!==c;s+=4)bb.slerpFlat(r,0,a,s-o,a,s,l);return r}}),VA.prototype=Object.assign(Object.create(FA.prototype),{constructor:VA,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new kA(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),jA.prototype=Object.assign(Object.create(FA.prototype),{constructor:jA,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),WA.prototype=Object.assign(Object.create(FA.prototype),{constructor:WA,ValueTypeName:"vector"}),Object.assign(qA,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(XA(n[r]).scale(i));return new qA(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},r=0,a=n.length;r!==a;++r)t.push(FA.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,a=[],o=0;o<r;o++){var s=[],l=[];s.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);var c=IA.getKeyframeOrder(s);s=IA.sortedArray(s,1,c),l=IA.sortedArray(l,1,c),i||0!==s[0]||(s.push(r),l.push(l[0])),a.push(new GA(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/n))}return new qA(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var i=e;n=i.geometry&&i.geometry.animations||i.animations}for(var r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],l=s.name.match(r);if(l&&l.length>1){var c=i[u=l[1]];c||(i[u]=c=[]),c.push(s)}}var h=[];for(var u in i)h.push(qA.CreateFromMorphTargetSequence(u,i[u],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];IA.flattenJSON(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.blendMode,l=e.hierarchy||[],c=0;c<l.length;c++){var h=l[c].keys;if(h&&0!==h.length)if(h[0].morphTargets){for(var u={},p=0;p<h.length;p++)if(h[p].morphTargets)for(var d=0;d<h[p].morphTargets.length;d++)u[h[p].morphTargets[d]]=-1;for(var f in u){var m=[],g=[];for(d=0;d!==h[p].morphTargets.length;++d){var v=h[p];m.push(v.time),g.push(v.morphTarget===f?1:0)}i.push(new GA(".morphTargetInfluence["+f+"]",m,g))}a=u.length*(o||1)}else{var y=".bones["+t[c].name+"]";n(WA,y+".position",h,"pos",i),n(VA,y+".quaternion",h,"rot",i),n(WA,y+".scale",h,"scl",i)}}return 0===i.length?null:new qA(r,a,i,s)}}),Object.assign(qA.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new qA(this.name,this.duration,e,this.blendMode)}});var YA={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function JA(e,t,n){var i=this,r=!1,a=0,o=0,s=void 0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===r&&void 0!==i.onStart&&i.onStart(e,a,o),r=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,o),a===o&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){var t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=l.length;t<n;t+=2){var i=l[t],r=l[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null}}var ZA=new JA;function KA(e){this.manager=void 0!==e?e:ZA,this.crossOrigin="anonymous",this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(KA.prototype,{load:function(){},loadAsync:function(e,t){var n=this;return new Promise((function(i,r){n.load(e,i,t,r)}))},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}});var QA={};function $A(e){KA.call(this,e)}function eL(e){KA.call(this,e)}function tL(e){KA.call(this,e)}function nL(e){KA.call(this,e)}function iL(e){KA.call(this,e)}function rL(e){KA.call(this,e)}function aL(e){KA.call(this,e)}function oL(){this.type="Curve",this.arcLengthDivisions=200}function sL(e,t,n,i,r,a,o,s){oL.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function lL(e,t,n,i,r,a){sL.call(this,e,t,n,n,i,r,a),this.type="ArcCurve"}function cL(){var e=0,t=0,n=0,i=0;function r(r,a,o,s){e=r,t=o,n=-3*r+3*a-2*o-s,i=2*r-2*a+o+s}return{initCatmullRom:function(e,t,n,i,a){r(t,n,a*(n-e),a*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,a,o,s){var l=(t-e)/a-(n-e)/(a+o)+(n-t)/o,c=(n-t)/o-(i-t)/(o+s)+(i-n)/s;r(t,n,l*=o,c*=o)},calc:function(r){var a=r*r;return e+t*r+n*a+i*(a*r)}}}$A.prototype=Object.assign(Object.create(KA.prototype),{constructor:$A,load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=YA.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;if(void 0===QA[e]){var o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],l=!!o[2],c=o[3];c=decodeURIComponent(c),l&&(c=atob(c));try{var h,u=(this.responseType||"").toLowerCase();switch(u){case"arraybuffer":case"blob":for(var p=new Uint8Array(c.length),d=0;d<c.length;d++)p[d]=c.charCodeAt(d);h="blob"===u?new Blob([p.buffer],{type:s}):p.buffer;break;case"document":var f=new DOMParser;h=f.parseFromString(c,s);break;case"json":h=JSON.parse(c);break;default:h=c}setTimeout((function(){t&&t(h),r.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}),0)}}else{QA[e]=[],QA[e].push({onLoad:t,onProgress:n,onError:i});var m=new XMLHttpRequest;for(var g in m.open("GET",e,!0),m.addEventListener("load",(function(t){var n=this.response,i=QA[e];if(delete QA[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),YA.add(e,n);for(var a=0,o=i.length;a<o;a++){(s=i[a]).onLoad&&s.onLoad(n)}r.manager.itemEnd(e)}else{for(a=0,o=i.length;a<o;a++){var s;(s=i[a]).onError&&s.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}}),!1),m.addEventListener("progress",(function(t){for(var n=QA[e],i=0,r=n.length;i<r;i++){var a=n[i];a.onProgress&&a.onProgress(t)}}),!1),m.addEventListener("error",(function(t){var n=QA[e];delete QA[e];for(var i=0,a=n.length;i<a;i++){var o=n[i];o.onError&&o.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}),!1),m.addEventListener("abort",(function(t){var n=QA[e];delete QA[e];for(var i=0,a=n.length;i<a;i++){var o=n[i];o.onError&&o.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(g,this.requestHeader[g]);m.send(null)}return r.manager.itemStart(e),m}QA[e].push({onLoad:t,onProgress:n,onError:i})},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}}),eL.prototype=Object.assign(Object.create(KA.prototype),{constructor:eL,load:function(e,t,n,i){var r=this,a=new $A(r.manager);a.setPath(r.path),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var i=qA.parse(e[n]);t.push(i)}return t}}),tL.prototype=Object.assign(Object.create(KA.prototype),{constructor:tL,load:function(e,t,n,i){var r=this,a=[],o=new iE;o.image=a;var s=new $A(this.manager);function l(l){s.load(e[l],(function(e){var n=r.parse(e,!0);a[l]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(c+=1)&&(1===n.mipmapCount&&(o.minFilter=1006),o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,i)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(e))for(var c=0,h=0,u=e.length;h<u;++h)l(h);else s.load(e,(function(e){var n=r.parse(e,!0);if(n.isCubemap)for(var i=n.mipmaps.length/n.mipmapCount,s=0;s<i;s++){a[s]={mipmaps:[]};for(var l=0;l<n.mipmapCount;l++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+l]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=1006),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,i);return o}}),nL.prototype=Object.assign(Object.create(KA.prototype),{constructor:nL,load:function(e,t,n,i){var r=this,a=new J_,o=new $A(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,(function(e){var n=r.parse(e);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:1001,a.wrapT=void 0!==n.wrapT?n.wrapT:1001,a.magFilter=void 0!==n.magFilter?n.magFilter:1006,a.minFilter=void 0!==n.minFilter?n.minFilter:1006,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=1008),1===n.mipmapCount&&(a.minFilter=1006),a.needsUpdate=!0,t&&t(a,n))}),n,i),a}}),iL.prototype=Object.assign(Object.create(KA.prototype),{constructor:iL,load:function(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=YA.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),YA.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}),rL.prototype=Object.assign(Object.create(KA.prototype),{constructor:rL,load:function(e,t,n,i){var r=new vM,a=new iL(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],(function(e){r.images[n]=e,6===++o&&(r.needsUpdate=!0,t&&t(r))}),void 0,i)}for(var l=0;l<e.length;++l)s(l);return r}}),aL.prototype=Object.assign(Object.create(KA.prototype),{constructor:aL,load:function(e,t,n,i){var r=new gb,a=new iL(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(n){r.image=n;var i=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);r.format=i?1022:1023,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}),Object.assign(oL.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,i=[],r=this.getPoint(0),a=0;for(i.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(r),i.push(a),r=t;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=i[r=Math.floor(s+(l-s)/2)]-n)<0)s=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(a-1);var c=i[r];return(r+(n-c)/(i[r+1]-c))/(a-1)},getTangent:function(e,t){var n=e-1e-4,i=e+1e-4;n<0&&(n=0),i>1&&(i=1);var r=this.getPoint(n),a=this.getPoint(i),o=t||(r.isVector2?new pb:new Mb);return o.copy(a).sub(r).normalize(),o},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n,i,r,a=new Mb,o=[],s=[],l=[],c=new Mb,h=new Cb;for(n=0;n<=e;n++)i=n/e,o[n]=this.getTangentAt(i,new Mb),o[n].normalize();s[0]=new Mb,l[0]=new Mb;var u=Number.MAX_VALUE,p=Math.abs(o[0].x),d=Math.abs(o[0].y),f=Math.abs(o[0].z);for(p<=u&&(u=p,a.set(1,0,0)),d<=u&&(u=d,a.set(0,1,0)),f<=u&&a.set(0,0,1),c.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],c),l[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),c.crossVectors(o[n-1],o[n]),c.length()>Number.EPSILON&&(c.normalize(),r=Math.acos(ub.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(h.makeRotationAxis(c,r))),l[n].crossVectors(o[n],s[n]);if(!0===t)for(r=Math.acos(ub.clamp(s[0].dot(s[e]),-1,1)),r/=e,o[0].dot(c.crossVectors(s[0],s[e]))>0&&(r=-r),n=1;n<=e;n++)s[n].applyMatrix4(h.makeRotationAxis(o[n],r*n)),l[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:l}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),sL.prototype=Object.create(oL.prototype),sL.prototype.constructor=sL,sL.prototype.isEllipseCurve=!0,sL.prototype.getPoint=function(e,t){for(var n=t||new pb,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=a?0:i),!0!==this.aClockwise||a||(r===i?r=-i:r-=i);var o=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var c=Math.cos(this.aRotation),h=Math.sin(this.aRotation),u=s-this.aX,p=l-this.aY;s=u*c-p*h+this.aX,l=u*h+p*c+this.aY}return n.set(s,l)},sL.prototype.copy=function(e){return oL.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},sL.prototype.toJSON=function(){var e=oL.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},sL.prototype.fromJSON=function(e){return oL.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},lL.prototype=Object.create(sL.prototype),lL.prototype.constructor=lL,lL.prototype.isArcCurve=!0;var hL=new Mb,uL=new cL,pL=new cL,dL=new cL;function fL(e,t,n,i){oL.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=i||.5}function mL(e,t,n,i,r){var a=.5*(i-t),o=.5*(r-n),s=e*e;return(2*n-2*i+a+o)*(e*s)+(-3*n+3*i-2*a-o)*s+a*e+n}function gL(e,t,n,i){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function vL(e,t,n,i,r){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}function yL(e,t,n,i){oL.call(this),this.type="CubicBezierCurve",this.v0=e||new pb,this.v1=t||new pb,this.v2=n||new pb,this.v3=i||new pb}function xL(e,t,n,i){oL.call(this),this.type="CubicBezierCurve3",this.v0=e||new Mb,this.v1=t||new Mb,this.v2=n||new Mb,this.v3=i||new Mb}function bL(e,t){oL.call(this),this.type="LineCurve",this.v1=e||new pb,this.v2=t||new pb}function wL(e,t){oL.call(this),this.type="LineCurve3",this.v1=e||new Mb,this.v2=t||new Mb}function _L(e,t,n){oL.call(this),this.type="QuadraticBezierCurve",this.v0=e||new pb,this.v1=t||new pb,this.v2=n||new pb}function ML(e,t,n){oL.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new Mb,this.v1=t||new Mb,this.v2=n||new Mb}function SL(e){oL.call(this),this.type="SplineCurve",this.points=e||[]}fL.prototype=Object.create(oL.prototype),fL.prototype.constructor=fL,fL.prototype.isCatmullRomCurve3=!0,fL.prototype.getPoint=function(e,t){var n,i,r,a,o=t||new Mb,s=this.points,l=s.length,c=(l-(this.closed?0:1))*e,h=Math.floor(c),u=c-h;if(this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/l)+1)*l:0===u&&h===l-1&&(h=l-2,u=1),this.closed||h>0?n=s[(h-1)%l]:(hL.subVectors(s[0],s[1]).add(s[0]),n=hL),i=s[h%l],r=s[(h+1)%l],this.closed||h+2<l?a=s[(h+2)%l]:(hL.subVectors(s[l-1],s[l-2]).add(s[l-1]),a=hL),"centripetal"===this.curveType||"chordal"===this.curveType){var p="chordal"===this.curveType?.5:.25,d=Math.pow(n.distanceToSquared(i),p),f=Math.pow(i.distanceToSquared(r),p),m=Math.pow(r.distanceToSquared(a),p);f<1e-4&&(f=1),d<1e-4&&(d=f),m<1e-4&&(m=f),uL.initNonuniformCatmullRom(n.x,i.x,r.x,a.x,d,f,m),pL.initNonuniformCatmullRom(n.y,i.y,r.y,a.y,d,f,m),dL.initNonuniformCatmullRom(n.z,i.z,r.z,a.z,d,f,m)}else"catmullrom"===this.curveType&&(uL.initCatmullRom(n.x,i.x,r.x,a.x,this.tension),pL.initCatmullRom(n.y,i.y,r.y,a.y,this.tension),dL.initCatmullRom(n.z,i.z,r.z,a.z,this.tension));return o.set(uL.calc(u),pL.calc(u),dL.calc(u)),o},fL.prototype.copy=function(e){oL.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},fL.prototype.toJSON=function(){var e=oL.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},fL.prototype.fromJSON=function(e){oL.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new Mb).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},yL.prototype=Object.create(oL.prototype),yL.prototype.constructor=yL,yL.prototype.isCubicBezierCurve=!0,yL.prototype.getPoint=function(e,t){var n=t||new pb,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(vL(e,i.x,r.x,a.x,o.x),vL(e,i.y,r.y,a.y,o.y)),n},yL.prototype.copy=function(e){return oL.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},yL.prototype.toJSON=function(){var e=oL.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},yL.prototype.fromJSON=function(e){return oL.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},xL.prototype=Object.create(oL.prototype),xL.prototype.constructor=xL,xL.prototype.isCubicBezierCurve3=!0,xL.prototype.getPoint=function(e,t){var n=t||new Mb,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(vL(e,i.x,r.x,a.x,o.x),vL(e,i.y,r.y,a.y,o.y),vL(e,i.z,r.z,a.z,o.z)),n},xL.prototype.copy=function(e){return oL.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},xL.prototype.toJSON=function(){var e=oL.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},xL.prototype.fromJSON=function(e){return oL.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},bL.prototype=Object.create(oL.prototype),bL.prototype.constructor=bL,bL.prototype.isLineCurve=!0,bL.prototype.getPoint=function(e,t){var n=t||new pb;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},bL.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},bL.prototype.getTangent=function(e,t){return(t||new pb).copy(this.v2).sub(this.v1).normalize()},bL.prototype.copy=function(e){return oL.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},bL.prototype.toJSON=function(){var e=oL.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},bL.prototype.fromJSON=function(e){return oL.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},wL.prototype=Object.create(oL.prototype),wL.prototype.constructor=wL,wL.prototype.isLineCurve3=!0,wL.prototype.getPoint=function(e,t){var n=t||new Mb;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},wL.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},wL.prototype.copy=function(e){return oL.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},wL.prototype.toJSON=function(){var e=oL.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},wL.prototype.fromJSON=function(e){return oL.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},_L.prototype=Object.create(oL.prototype),_L.prototype.constructor=_L,_L.prototype.isQuadraticBezierCurve=!0,_L.prototype.getPoint=function(e,t){var n=t||new pb,i=this.v0,r=this.v1,a=this.v2;return n.set(gL(e,i.x,r.x,a.x),gL(e,i.y,r.y,a.y)),n},_L.prototype.copy=function(e){return oL.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},_L.prototype.toJSON=function(){var e=oL.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},_L.prototype.fromJSON=function(e){return oL.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ML.prototype=Object.create(oL.prototype),ML.prototype.constructor=ML,ML.prototype.isQuadraticBezierCurve3=!0,ML.prototype.getPoint=function(e,t){var n=t||new Mb,i=this.v0,r=this.v1,a=this.v2;return n.set(gL(e,i.x,r.x,a.x),gL(e,i.y,r.y,a.y),gL(e,i.z,r.z,a.z)),n},ML.prototype.copy=function(e){return oL.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ML.prototype.toJSON=function(){var e=oL.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ML.prototype.fromJSON=function(e){return oL.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},SL.prototype=Object.create(oL.prototype),SL.prototype.constructor=SL,SL.prototype.isSplineCurve=!0,SL.prototype.getPoint=function(e,t){var n=t||new pb,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,s=i[0===a?a:a-1],l=i[a],c=i[a>i.length-2?i.length-1:a+1],h=i[a>i.length-3?i.length-1:a+2];return n.set(mL(o,s.x,l.x,c.x,h.x),mL(o,s.y,l.y,c.y,h.y)),n},SL.prototype.copy=function(e){oL.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this},SL.prototype.toJSON=function(){var e=oL.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e},SL.prototype.fromJSON=function(e){oL.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new pb).fromArray(i))}return this};var TL=Object.freeze({__proto__:null,ArcCurve:lL,CatmullRomCurve3:fL,CubicBezierCurve:yL,CubicBezierCurve3:xL,EllipseCurve:sL,LineCurve:bL,LineCurve3:wL,QuadraticBezierCurve:_L,QuadraticBezierCurve3:ML,SplineCurve:SL});function EL(){oL.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function AL(e){EL.call(this),this.type="Path",this.currentPoint=new pb,e&&this.setFromPoints(e)}function LL(e){AL.call(this,e),this.uuid=ub.generateUUID(),this.type="Shape",this.holes=[]}function RL(e,t){Jb.call(this),this.type="Light",this.color=new Hw(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function PL(e,t,n){RL.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(Jb.DefaultUp),this.updateMatrix(),this.groundColor=new Hw(t)}function CL(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new pb(512,512),this.map=null,this.mapPass=null,this.matrix=new Cb,this._frustum=new Q_,this._frameExtents=new pb(1,1),this._viewportCount=1,this._viewports=[new vb(0,0,1,1)]}function OL(){CL.call(this,new q_(50,1,.5,500))}function IL(e,t,n,i,r,a){RL.call(this,e,t),this.type="SpotLight",this.position.copy(Jb.DefaultUp),this.updateMatrix(),this.target=new Jb,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new OL}function DL(){CL.call(this,new q_(90,1,.5,500)),this._frameExtents=new pb(4,2),this._viewportCount=6,this._viewports=[new vb(2,1,1,1),new vb(0,1,1,1),new vb(3,1,1,1),new vb(1,1,1,1),new vb(3,0,1,1),new vb(1,0,1,1)],this._cubeDirections=[new Mb(1,0,0),new Mb(-1,0,0),new Mb(0,0,1),new Mb(0,0,-1),new Mb(0,1,0),new Mb(0,-1,0)],this._cubeUps=[new Mb(0,1,0),new Mb(0,1,0),new Mb(0,1,0),new Mb(0,1,0),new Mb(0,0,1),new Mb(0,0,-1)]}function NL(e,t,n,i){RL.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new DL}function zL(e,t,n,i,r,a){W_.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==n?n:1,this.bottom=void 0!==i?i:-1,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function UL(){CL.call(this,new zL(-5,5,5,-5,.5,500))}function FL(e,t){RL.call(this,e,t),this.type="DirectionalLight",this.position.copy(Jb.DefaultUp),this.updateMatrix(),this.target=new Jb,this.shadow=new UL}function BL(e,t){RL.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function HL(e,t,n,i){RL.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}function GL(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new Mb)}function kL(e,t){RL.call(this,void 0,t),this.type="LightProbe",this.sh=void 0!==e?e:new GL}function VL(e){KA.call(this,e),this.textures={}}EL.prototype=Object.assign(Object.create(oL.prototype),{constructor:EL,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new bL(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),i=0;i<n.length;){if(n[i]>=t){var r=n[i]-t,a=this.curves[i],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,n=[],i=0,r=this.curves;i<r.length;i++)for(var a=r[i],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),l=0;l<s.length;l++){var c=s[l];t&&t.equals(c)||(n.push(c),t=c)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){oL.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=oL.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e},fromJSON:function(e){oL.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push((new TL[i.type]).fromJSON(i))}return this}}),AL.prototype=Object.assign(Object.create(EL.prototype),{constructor:AL,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new bL(this.currentPoint.clone(),new pb(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,i){var r=new _L(this.currentPoint.clone(),new pb(e,t),new pb(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this},bezierCurveTo:function(e,t,n,i,r,a){var o=new yL(this.currentPoint.clone(),new pb(e,t),new pb(n,i),new pb(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this},splineThru:function(e){var t=new SL([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,i,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,i,r,a),this},absarc:function(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this},ellipse:function(e,t,n,i,r,a,o,s){var l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,i,r,a,o,s),this},absellipse:function(e,t,n,i,r,a,o,s){var l=new sL(e,t,n,i,r,a,o,s);if(this.curves.length>0){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var h=l.getPoint(1);return this.currentPoint.copy(h),this},copy:function(e){return EL.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=EL.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return EL.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),LL.prototype=Object.assign(Object.create(AL.prototype),{constructor:LL,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){AL.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push(i.clone())}return this},toJSON:function(){var e=AL.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e},fromJSON:function(e){AL.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push((new AL).fromJSON(i))}return this}}),RL.prototype=Object.assign(Object.create(Jb.prototype),{constructor:RL,isLight:!0,copy:function(e){return Jb.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=Jb.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),PL.prototype=Object.assign(Object.create(RL.prototype),{constructor:PL,isHemisphereLight:!0,copy:function(e){return RL.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(CL.prototype,{_projScreenMatrix:new Cb,_lightPositionWorld:new Mb,_lookTarget:new Mb,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,i=this._projScreenMatrix,r=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),r.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(r),t.updateMatrixWorld(),i.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(i),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}),OL.prototype=Object.assign(Object.create(CL.prototype),{constructor:OL,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=2*ub.RAD2DEG*e.angle,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),CL.prototype.updateMatrices.call(this,e)}}),IL.prototype=Object.assign(Object.create(RL.prototype),{constructor:IL,isSpotLight:!0,copy:function(e){return RL.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),DL.prototype=Object.assign(Object.create(CL.prototype),{constructor:DL,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var n=this.camera,i=this.matrix,r=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;r.setFromMatrixPosition(e.matrixWorld),n.position.copy(r),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),i.makeTranslation(-r.x,-r.y,-r.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),NL.prototype=Object.assign(Object.create(RL.prototype),{constructor:NL,isPointLight:!0,copy:function(e){return RL.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),zL.prototype=Object.assign(Object.create(W_.prototype),{constructor:zL,isOrthographicCamera:!0,copy:function(e,t){return W_.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(r+=l*this.view.offsetX)+l*this.view.width,s=(o-=c*this.view.offsetY)-c*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Jb.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),UL.prototype=Object.assign(Object.create(CL.prototype),{constructor:UL,isDirectionalLightShadow:!0,updateMatrices:function(e){CL.prototype.updateMatrices.call(this,e)}}),FL.prototype=Object.assign(Object.create(RL.prototype),{constructor:FL,isDirectionalLight:!0,copy:function(e){return RL.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),BL.prototype=Object.assign(Object.create(RL.prototype),{constructor:BL,isAmbientLight:!0}),HL.prototype=Object.assign(Object.create(RL.prototype),{constructor:HL,isRectAreaLight:!0,copy:function(e){return RL.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=RL.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(GL.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*r),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*i*1.092548),t.addScaledVector(a[5],i*r*1.092548),t.addScaledVector(a[6],.315392*(3*r*r-1)),t.addScaledVector(a[7],n*r*1.092548),t.addScaledVector(a[8],.546274*(n*n-i*i)),t},getIrradianceAt:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*i),t.addScaledVector(a[2],1.023328*r),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*i),t.addScaledVector(a[5],.858086*i*r),t.addScaledVector(a[6],.743125*r*r-.247708),t.addScaledVector(a[7],.858086*n*r),t.addScaledVector(a[8],.429043*(n*n-i*i)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return(new this.constructor).copy(this)},fromArray:function(e,t){void 0===t&&(t=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this},toArray:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}}),Object.assign(GL,{getBasisAt:function(e,t){var n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}),kL.prototype=Object.assign(Object.create(RL.prototype),{constructor:kL,isLightProbe:!0,copy:function(e){return RL.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=RL.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),VL.prototype=Object.assign(Object.create(KA.prototype),{constructor:VL,load:function(e,t,n,i){var r=this,a=new $A(r.manager);a.setPath(r.path),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)},parse:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i=new OA[e.type];if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=(new Hw).setHex(e.sheen)),void 0!==e.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&i.specular.setHex(e.specular),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),1!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(i.skinning=e.skinning),void 0!==e.morphTargets&&(i.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(i.morphNormals=e.morphNormals),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.vertexTangents&&(i.vertexTangents=e.vertexTangents),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var r in e.uniforms){var a=e.uniforms[r];switch(i.uniforms[r]={},a.type){case"t":i.uniforms[r].value=n(a.value);break;case"c":i.uniforms[r].value=(new Hw).setHex(a.value);break;case"v2":i.uniforms[r].value=(new pb).fromArray(a.value);break;case"v3":i.uniforms[r].value=(new Mb).fromArray(a.value);break;case"v4":i.uniforms[r].value=(new vb).fromArray(a.value);break;case"m3":i.uniforms[r].value=(new db).fromArray(a.value);case"m4":i.uniforms[r].value=(new Cb).fromArray(a.value);break;default:i.uniforms[r].value=a.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var o in e.extensions)i.extensions[o]=e.extensions[o];if(void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),i.normalScale=(new pb).fromArray(s)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new pb).fromArray(e.clearcoatNormalScale)),i},setTextures:function(e){return this.textures=e,this}});var jL=function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)};function WL(){f_.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function qL(e,t,n,i){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),Jw.call(this,e,t,n),this.meshPerAttribute=i||1}function XL(e){KA.call(this,e)}WL.prototype=Object.assign(Object.create(f_.prototype),{constructor:WL,isInstancedBufferGeometry:!0,copy:function(e){return f_.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=f_.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),qL.prototype=Object.assign(Object.create(Jw.prototype),{constructor:qL,isInstancedBufferAttribute:!0,copy:function(e){return Jw.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=Jw.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),XL.prototype=Object.assign(Object.create(KA.prototype),{constructor:XL,load:function(e,t,n,i){var r=this,a=new $A(r.manager);a.setPath(r.path),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)},parse:function(e){var t=e.isInstancedBufferGeometry?new WL:new f_,n=e.data.index;if(void 0!==n){var i=new YL[n.type](n.array);t.setIndex(new Jw(i,1))}var r=e.data.attributes;for(var a in r){var o=r[a],s=(i=new YL[o.type](o.array),new(o.isInstancedBufferAttribute?qL:Jw)(i,o.itemSize,o.normalized));void 0!==o.name&&(s.name=o.name),t.setAttribute(a,s)}var l=e.data.morphAttributes;if(l)for(var a in l){for(var c=l[a],h=[],u=0,p=c.length;u<p;u++){o=c[u],s=new Jw(i=new YL[o.type](o.array),o.itemSize,o.normalized);void 0!==o.name&&(s.name=o.name),h.push(s)}t.morphAttributes[a]=h}e.data.morphTargetsRelative&&(t.morphTargetsRelative=!0);var d=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==d){u=0;for(var f=d.length;u!==f;++u){var m=d[u];t.addGroup(m.start,m.count,m.materialIndex)}}var g=e.data.boundingSphere;if(void 0!==g){var v=new Mb;void 0!==g.center&&v.fromArray(g.center),t.boundingSphere=new dw(v,g.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var YL={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function JL(e){KA.call(this,e)}JL.prototype=Object.assign(Object.create(KA.prototype),{constructor:JL,load:function(e,t,n,i){var r=this,a=""===this.path?jL(e):this.path;this.resourcePath=this.resourcePath||a;var o=new $A(r.manager);o.setPath(this.path),o.load(e,(function(n){var a=null;try{a=JSON.parse(n)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var o=a.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?r.parse(a,t):console.error("THREE.ObjectLoader: Can't load "+e)}),n,i)},parse:function(e,t){var n=this.parseShape(e.shapes),i=this.parseGeometries(e.geometries,n),r=this.parseImages(e.images,(function(){void 0!==t&&t(s)})),a=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,i,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var n=0,i=e.length;n<i;n++){var r=(new LL).fromJSON(e[n]);t[r.uuid]=r}return t},parseGeometries:function(e,t){var n={};if(void 0!==e)for(var i=new XL,r=0,a=e.length;r<a;r++){var o,s=e[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new wA[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new wA[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new wA[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new wA[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new wA[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new wA[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new wA[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new wA[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new wA[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new wA[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new wA[s.type]((new TL[s.path.type]).fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new wA[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new wA[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var l=[],c=0,h=s.shapes.length;c<h;c++){var u=t[s.shapes[c]];l.push(u)}o=new wA[s.type](l,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(l=[],c=0,h=s.shapes.length;c<h;c++){u=t[s.shapes[c]];l.push(u)}var p=s.options.extrudePath;void 0!==p&&(s.options.extrudePath=(new TL[p.type]).fromJSON(p)),o=new wA[s.type](l,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(s);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),!0===o.isBufferGeometry&&void 0!==s.userData&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},i={};if(void 0!==e){var r=new VL;r.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if("MultiMaterial"===s.type){for(var l=[],c=0;c<s.materials.length;c++){var h=s.materials[c];void 0===n[h.uuid]&&(n[h.uuid]=r.parse(h)),l.push(n[h.uuid])}i[s.uuid]=l}else void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n],r=qA.parse(i);void 0!==i.uuid&&(r.uuid=i.uuid),t.push(r)}return t},parseImages:function(e,t){var n=this,i={};function r(e){return n.manager.itemStart(e),a.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}if(void 0!==e&&e.length>0){var a=new iL(new JA(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var l=e[o],c=l.url;if(Array.isArray(c)){i[l.uuid]=[];for(var h=0,u=c.length;h<u;h++){var p=c[h],d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(p)?p:n.resourcePath+p;i[l.uuid].push(r(d))}}else{d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:n.resourcePath+l.url;i[l.uuid]=r(d)}}}return i},parseTextures:function(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var i={};if(void 0!==e)for(var r=0,a=e.length;r<a;r++){var o,s=e[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image),(o=Array.isArray(t[s.image])?new vM(t[s.image]):new gb(t[s.image])).needsUpdate=!0,o.uuid=s.uuid,void 0!==s.name&&(o.name=s.name),void 0!==s.mapping&&(o.mapping=n(s.mapping,KL)),void 0!==s.offset&&o.offset.fromArray(s.offset),void 0!==s.repeat&&o.repeat.fromArray(s.repeat),void 0!==s.center&&o.center.fromArray(s.center),void 0!==s.rotation&&(o.rotation=s.rotation),void 0!==s.wrap&&(o.wrapS=n(s.wrap[0],QL),o.wrapT=n(s.wrap[1],QL)),void 0!==s.format&&(o.format=s.format),void 0!==s.type&&(o.type=s.type),void 0!==s.encoding&&(o.encoding=s.encoding),void 0!==s.minFilter&&(o.minFilter=n(s.minFilter,$L)),void 0!==s.magFilter&&(o.magFilter=n(s.magFilter,$L)),void 0!==s.anisotropy&&(o.anisotropy=s.anisotropy),void 0!==s.flipY&&(o.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(o.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(o.unpackAlignment=s.unpackAlignment),i[s.uuid]=o}return i},parseObject:function(e,t,n){var i;function r(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function a(e){if(void 0!==e){if(Array.isArray(e)){for(var t=[],i=0,r=e.length;i<r;i++){var a=e[i];void 0===n[a]&&console.warn("THREE.ObjectLoader: Undefined material",a),t.push(n[a])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}switch(e.type){case"Scene":i=new Zb,void 0!==e.background&&Number.isInteger(e.background)&&(i.background=new Hw(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?i.fog=new aT(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(i.fog=new rT(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":i=new q_(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(i.focus=e.focus),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.filmGauge&&(i.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(i.filmOffset=e.filmOffset),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"OrthographicCamera":i=new zL(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(i.zoom=e.zoom),void 0!==e.view&&(i.view=Object.assign({},e.view));break;case"AmbientLight":i=new BL(e.color,e.intensity);break;case"DirectionalLight":i=new FL(e.color,e.intensity);break;case"PointLight":i=new NL(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":i=new HL(e.color,e.intensity,e.width,e.height);break;case"SpotLight":i=new IL(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":i=new PL(e.color,e.groundColor,e.intensity);break;case"LightProbe":i=(new kL).fromJSON(e);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":i=new O_(o=r(e.geometry),s=a(e.material));break;case"InstancedMesh":var o=r(e.geometry),s=a(e.material),l=e.count,c=e.instanceMatrix;(i=new UT(o,s,l)).instanceMatrix=new Jw(new Float32Array(c.array),16);break;case"LOD":i=new AT;break;case"Line":i=new jT(r(e.geometry),a(e.material),e.mode);break;case"LineLoop":i=new YT(r(e.geometry),a(e.material));break;case"LineSegments":i=new XT(r(e.geometry),a(e.material));break;case"PointCloud":case"Points":i=new eE(r(e.geometry),a(e.material));break;case"Sprite":i=new MT(a(e.material));break;case"Group":i=new $S;break;default:i=new Jb}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(i.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.frustumCulled&&(i.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(i.renderOrder=e.renderOrder),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.layers&&(i.layers.mask=e.layers),void 0!==e.children)for(var h=e.children,u=0;u<h.length;u++)i.add(this.parseObject(h[u],t,n));if("LOD"===e.type){void 0!==e.autoUpdate&&(i.autoUpdate=e.autoUpdate);for(var p=e.levels,d=0;d<p.length;d++){var f=p[d],m=i.getObjectByProperty("uuid",f.object);void 0!==m&&i.addLevel(m,f.distance)}}return i}});var ZL,KL={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,SphericalReflectionMapping:305,CubeUVReflectionMapping:306,CubeUVRefractionMapping:307},QL={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},$L={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008};function eR(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),KA.call(this,e),this.options=void 0}function tR(){this.type="ShapePath",this.color=new Hw,this.subPaths=[],this.currentPath=null}function nR(e){this.type="Font",this.data=e}function iR(e,t,n,i,r){var a=r.glyphs[e]||r.glyphs["?"];if(a){var o,s,l,c,h,u,p,d,f=new tR;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),g=0,v=m.length;g<v;){switch(m[g++]){case"m":o=m[g++]*t+n,s=m[g++]*t+i,f.moveTo(o,s);break;case"l":o=m[g++]*t+n,s=m[g++]*t+i,f.lineTo(o,s);break;case"q":l=m[g++]*t+n,c=m[g++]*t+i,h=m[g++]*t+n,u=m[g++]*t+i,f.quadraticCurveTo(h,u,l,c);break;case"b":l=m[g++]*t+n,c=m[g++]*t+i,h=m[g++]*t+n,u=m[g++]*t+i,p=m[g++]*t+n,d=m[g++]*t+i,f.bezierCurveTo(h,u,p,d,l,c)}}return{offsetX:a.ha*t,path:f}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+r.familyName+".")}function rR(e){KA.call(this,e)}eR.prototype=Object.assign(Object.create(KA.prototype),{constructor:eR,setOptions:function(e){return this.options=e,this},load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=YA.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;fetch(e).then((function(e){return e.blob()})).then((function(e){return void 0===r.options?createImageBitmap(e):createImageBitmap(e,r.options)})).then((function(n){YA.add(e,n),t&&t(n),r.manager.itemEnd(e)})).catch((function(t){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)})),r.manager.itemStart(e)}}),Object.assign(tR.prototype,{moveTo:function(e,t){return this.currentPath=new AL,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this},bezierCurveTo:function(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n],a=new LL;a.curves=r.curves,t.push(a)}return t}function i(e,t){for(var n=t.length,i=!1,r=n-1,a=0;a<n;r=a++){var o=t[r],s=t[a],l=s.x-o.x,c=s.y-o.y;if(Math.abs(c)>Number.EPSILON){if(c<0&&(o=t[a],l=-l,s=t[r],c=-c),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var h=c*(e.x-o.x)-l*(e.y-o.y);if(0===h)return!0;if(h<0)continue;i=!i}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return i}var r=ZE.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,l,c=[];if(1===a.length)return s=a[0],(l=new LL).curves=s.curves,c.push(l),c;var h=!r(a[0].getPoints());h=e?!h:h;var u,p,d=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var v=0,y=a.length;v<y;v++)o=r(u=(s=a[v]).getPoints()),(o=e?!o:o)?(!h&&f[g]&&g++,f[g]={s:new LL,p:u},f[g].s.curves=s.curves,h&&g++,m[g]=[]):m[g].push({h:s,p:u[0]});if(!f[0])return n(a);if(f.length>1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)d[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],S=0;S<M.length;S++){for(var T=M[S],E=!0,A=0;A<f.length;A++)i(T.p,f[A].p)&&(w!==A&&b.push({froms:w,tos:A,hole:S}),E?(E=!1,d[A].push(T)):x=!0);E&&d[w].push(T)}b.length>0&&(x||(m=d))}v=0;for(var L=f.length;v<L;v++){l=f[v].s,c.push(l);for(var R=0,P=(p=m[v]).length;R<P;R++)l.holes.push(p[R].h)}return c}}),Object.assign(nR.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var n=[],i=function(e,t,n){for(var i=Array.from?Array.from(e):String(e).split(""),r=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,o=[],s=0,l=0,c=0;c<i.length;c++){var h=i[c];if("\n"===h)s=0,l-=a;else{var u=iR(h,r,s,l,n);s+=u.offsetX,o.push(u.path)}}return o}(e,t,this.data),r=0,a=i.length;r<a;r++)Array.prototype.push.apply(n,i[r].toShapes());return n}}),rR.prototype=Object.assign(Object.create(KA.prototype),{constructor:rR,load:function(e,t,n,i){var r=this,a=new $A(this.manager);a.setPath(this.path),a.load(e,(function(e){var n;try{n=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(e.substring(65,e.length-2))}var i=r.parse(n);t&&t(i)}),n,i)},parse:function(e){return new nR(e)}});var aR=function(){return void 0===ZL&&(ZL=new(window.AudioContext||window.webkitAudioContext)),ZL};function oR(e){KA.call(this,e)}function sR(e,t,n){kL.call(this,void 0,n);var i=(new Hw).set(e),r=(new Hw).set(t),a=new Mb(i.r,i.g,i.b),o=new Mb(r.r,r.g,r.b),s=Math.sqrt(Math.PI),l=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(l)}function lR(e,t){kL.call(this,void 0,t);var n=(new Hw).set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}oR.prototype=Object.assign(Object.create(KA.prototype),{constructor:oR,load:function(e,t,n,i){var r=this,a=new $A(r.manager);a.setResponseType("arraybuffer"),a.setPath(r.path),a.load(e,(function(n){try{var a=n.slice(0);aR().decodeAudioData(a,(function(e){t(e)}))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}}),sR.prototype=Object.assign(Object.create(kL.prototype),{constructor:sR,isHemisphereLightProbe:!0,copy:function(e){return kL.prototype.copy.call(this,e),this},toJSON:function(e){return kL.prototype.toJSON.call(this,e)}}),lR.prototype=Object.assign(Object.create(kL.prototype),{constructor:lR,isAmbientLightProbe:!0,copy:function(e){return kL.prototype.copy.call(this,e),this},toJSON:function(e){return kL.prototype.toJSON.call(this,e)}});var cR=new Cb,hR=new Cb;function uR(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(function(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new q_,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new q_,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var n,i,r=e.projectionMatrix.clone(),a=t.eyeSep/2,o=a*t.near/t.focus,s=t.near*Math.tan(ub.DEG2RAD*t.fov*.5)/t.zoom;hR.elements[12]=-a,cR.elements[12]=a,n=-s*t.aspect+o,i=s*t.aspect+o,r.elements[0]=2*t.near/(i-n),r.elements[8]=(i+n)/(i-n),this.cameraL.projectionMatrix.copy(r),n=-s*t.aspect-o,i=s*t.aspect-o,r.elements[0]=2*t.near/(i-n),r.elements[8]=(i+n)/(i-n),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(hR),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(cR)}}),Object.assign(uR.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=("undefined"==typeof performance?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});var pR=new Mb,dR=new bb,fR=new Mb,mR=new Mb;function gR(){Jb.call(this),this.type="AudioListener",this.context=aR(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new uR}function vR(e){Jb.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this._startedAt=0,this._progress=0,this.filters=[]}gR.prototype=Object.assign(Object.create(Jb.prototype),{constructor:gR,getInput:function(){return this.gain},removeFilter:function(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){Jb.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(pR,dR,fR),mR.set(0,0,-1).applyQuaternion(dR),t.positionX){var i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(pR.x,i),t.positionY.linearRampToValueAtTime(pR.y,i),t.positionZ.linearRampToValueAtTime(pR.z,i),t.forwardX.linearRampToValueAtTime(mR.x,i),t.forwardY.linearRampToValueAtTime(mR.y,i),t.forwardZ.linearRampToValueAtTime(mR.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(pR.x,pR.y,pR.z),t.setOrientation(mR.x,mR.y,mR.z,n.x,n.y,n.z)}}),vR.prototype=Object.assign(Object.create(Jb.prototype),{constructor:vR,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(e){if(void 0===e&&(e=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")},pause:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),!0===this.isPlaying?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});var yR=new Mb,xR=new bb,bR=new Mb,wR=new Mb;function _R(e){vR.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}function MR(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=void 0!==t?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}function SR(e,t,n){var i,r,a;switch(this.binding=e,this.valueSize=n,t){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}_R.prototype=Object.assign(Object.create(vR.prototype),{constructor:_R,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(Jb.prototype.updateMatrixWorld.call(this,e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(yR,xR,bR),wR.set(0,0,1).applyQuaternion(xR);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(yR.x,n),t.positionY.linearRampToValueAtTime(yR.y,n),t.positionZ.linearRampToValueAtTime(yR.z,n),t.orientationX.linearRampToValueAtTime(wR.x,n),t.orientationY.linearRampToValueAtTime(wR.y,n),t.orientationZ.linearRampToValueAtTime(wR.z,n)}else t.setPosition(yR.x,yR.y,yR.z),t.setOrientation(wR.x,wR.y,wR.z)}}}),Object.assign(MR.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}}),Object.assign(SR.prototype,{accumulate:function(e,t){var n=this.buffer,i=this.valueSize,r=e*i+i,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==i;++o)n[r+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,r,0,s,i)}this.cumulativeWeight=a},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){var s=t*this._origIndex;this._mixBufferRegion(n,i,s,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(var l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){o.setValue(n,i);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(var r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[4*this._addIndex+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,i,r){if(i>=.5)for(var a=0;a!==r;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,i){bb.slerpFlat(e,t,e,t,e,n,i)},_slerpAdditive:function(e,t,n,i,r){var a=this._workIndex*r;bb.multiplyQuaternionsFlat(e,a,e,t,e,n),bb.slerpFlat(e,t,e,t,e,a,i)},_lerp:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}},_lerpAdditive:function(e,t,n,i,r){for(var a=0;a!==r;++a){var o=t+a;e[o]=e[o]+e[n+a]*i}}});var TR=new RegExp("[\\[\\]\\.:\\/]","g"),ER="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",AR=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),LR=/(WCOD+)?/.source.replace("WCOD",ER),RR=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),PR=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),CR=new RegExp("^"+AR+LR+RR+PR+"$"),OR=["material","materials","bones"];function IR(e,t,n){var i=n||DR.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}function DR(e,t,n){this.path=t,this.parsedPath=n||DR.parseTrackName(t),this.node=DR.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function NR(e,t,n,i){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=i||t.blendMode;for(var r=t.tracks,a=r.length,o=new Array(a),s={endingStart:2400,endingEnd:2400},l=0;l!==a;++l){var c=r[l].createInterpolant(null);o[l]=c,c.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function zR(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function UR(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function FR(e,t,n){oT.call(this,e,t),this.meshPerAttribute=n||1}function BR(e,t,n,i){this.ray=new ww(e,t),this.near=n||0,this.far=i||1/0,this.camera=null,this.layers=new Nb,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function HR(e,t){return e.distance-t.distance}function GR(e,t,n,i){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===i)for(var r=e.children,a=0,o=r.length;a<o;a++)GR(r[a],t,n,!0)}Object.assign(IR.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(DR,{Composite:IR,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new DR.Composite(e,t,n):new DR(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(TR,"")},parseTrackName:function(e){var t=CR.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var r=n.nodeName.substring(i+1);-1!==OR.indexOf(r)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var i=function(e){for(var n=0;n<e.length;n++){var r=e[n];if(r.name===t||r.uuid===t)return r;var a=i(r.children);if(a)return a}return null},r=i(e.children);if(r)return r}return null}}),Object.assign(DR.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)e[t++]=n[i]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=DR.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==a){if(void 0===e[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[i];if(void 0!==s){var l=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(c=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}else{var h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(DR.prototype,{_getValue_unbound:DR.prototype.getValue,_setValue_unbound:DR.prototype.setValue}),Object.assign(function(){this.uuid=ub.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,l=void 0,c=0,h=arguments.length;c!==h;++c){var u=arguments[c],p=u.uuid,d=i[p];if(void 0===d){d=t++,i[p]=d,e.push(u);for(var f=0,m=s;f!==m;++f)o[f].push(new DR(u,r[f],a[f]))}else if(d<n){l=e[d];var g=--n,v=e[g];i[v.uuid]=d,e[d]=v,i[p]=g,e[g]=u;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[g],b=y[d];y[d]=x,void 0===b&&(b=new DR(u,r[f],a[f])),y[g]=b}}else e[d]!==l&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,r=i.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,c=n[l];if(void 0!==c&&c>=t){var h=t++,u=e[h];n[u.uuid]=c,e[c]=u,n[l]=h,e[h]=s;for(var p=0,d=r;p!==d;++p){var f=i[p],m=f[h],g=f[c];f[c]=m,f[h]=g}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],c=l.uuid,h=i[c];if(void 0!==h)if(delete i[c],h<n){var u=--n,p=e[u],d=e[y=--t];i[p.uuid]=h,e[h]=p,i[d.uuid]=u,e[u]=d,e.pop();for(var f=0,m=a;f!==m;++f){var g=(x=r[f])[u],v=x[y];x[h]=g,x[u]=v,x.pop()}}else{var y;i[(d=e[y=--t]).uuid]=h,e[h]=d,e.pop();for(f=0,m=a;f!==m;++f){var x;(x=r[f])[h]=x[y],x.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(void 0!==i)return r[i];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,a.push(e),o.push(t),r.push(h);for(var u=c,p=s.length;u!==p;++u){var d=s[u];h[u]=new DR(d,e,t)}return h},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}),Object.assign(NR.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var i=this._mixer,r=i.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,l=a.sampleValues;return s[0]=r,s[1]=r+n,l[0]=e/o,l[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,i){if(this.enabled){var r=this._startTime;if(null!==r){var a=(e-r)*n;if(a<0||0===n)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case 2501:for(var h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulateAdditive(s);break;case 2500:default:for(h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulate(i,s)}}}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,i=this.loop,r=this._loopCount,a=2202===i;if(0===e)return-1===r?t:a&&1==(1&r)?n-t:t;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&1==(1&r))return n-t}return t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,i.endingEnd=t?this.zeroSlopeAtEnd?2401:2400:2402)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}}),zR.prototype=Object.assign(Object.create(sb.prototype),{constructor:zR,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var h=0;h!==r;++h){var u=i[h],p=u.name,d=c[p];if(void 0!==d)a[h]=d;else{if(void 0!==(d=a[h])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;++(d=new SR(DR.create(n,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),a[h]=d}o[h].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var i=this._actions,r=this._actionsByClip,a=r[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;var r=e._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,l=s[s.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_addInactiveBinding:function(e,t,n){var i=this._bindingsByRootAndName,r=i[t],a=this._bindings;void 0===r&&(r={},i[t]=r),r[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],s=t[t.length-1],l=e._cacheIndex;s._cacheIndex=l,t[l]=s,t.pop(),delete o[r],0===Object.keys(o).length&&delete a[i]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new zA(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var i=t||this._root,r=i.uuid,a="string"==typeof e?qA.findByName(i,e):e,o=null!==a?a.uuid:e,s=this._actionsByClip[o],l=null;if(void 0===n&&(n=null!==a?a.blendMode:2500),void 0!==s){var c=s.actionByRoot[r];if(void 0!==c&&c.blendMode===n)return c;l=s.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;var h=new NR(this,a,t,n);return this._bindAction(h,l),this._addInactiveAction(h,o,r),h},existingAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?qA.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[i]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(i,e,r,a)}var s=this._bindings,l=this._nActiveBindings;for(o=0;o!==l;++o)s[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var c=l._cacheIndex,h=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,h._cacheIndex=c,t[c]=h,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),UR.prototype.clone=function(){return new UR(void 0===this.value.clone?this.value:this.value.clone())},FR.prototype=Object.assign(Object.create(oT.prototype),{constructor:FR,isInstancedInterleavedBuffer:!0,copy:function(e){return oT.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(BR.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var i=n||[];return GR(e,this,i,t),i.sort(HR),i},intersectObjects:function(e,t,n){var i=n||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var r=0,a=e.length;r<a;r++)GR(e[r],this,i,t);return i.sort(HR),i}}),Object.assign(function(e,t,n){return this.radius=void 0!==e?e:1,this.phi=void 0!==t?t:0,this.theta=void 0!==n?n:0,this}.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(ub.clamp(t/this.radius,-1,1))),this}}),Object.assign(function(e,t,n){return this.radius=void 0!==e?e:1,this.theta=void 0!==t?t:0,this.y=void 0!==n?n:0,this}.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}});var kR=new pb;function VR(e,t){this.min=void 0!==e?e:new pb(1/0,1/0),this.max=void 0!==t?t:new pb(-1/0,-1/0)}Object.assign(VR.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=kR.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new pb),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new pb),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new pb),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new pb),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return kR.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var jR=new Mb,WR=new Mb;function qR(e,t){this.start=void 0!==e?e:new Mb,this.end=void 0!==t?t:new Mb}function XR(e){Jb.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}Object.assign(qR.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new Mb),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new Mb),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new Mb),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){jR.subVectors(e,this.start),WR.subVectors(this.end,this.start);var n=WR.dot(WR),i=WR.dot(jR)/n;return t&&(i=ub.clamp(i,0,1)),i},closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Mb),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),XR.prototype=Object.create(Jb.prototype),XR.prototype.constructor=XR,XR.prototype.isImmediateRenderObject=!0;var YR=new Mb;function JR(e,t){Jb.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new f_,i=[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],r=0,a=1;r<32;r++,a++){var o=r/32*Math.PI*2,s=a/32*Math.PI*2;i.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new i_(i,3));var l=new FT({fog:!1,toneMapped:!1});this.cone=new XT(n,l),this.add(this.cone),this.update()}JR.prototype=Object.create(Jb.prototype),JR.prototype.constructor=JR,JR.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},JR.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),YR.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(YR),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var ZR=new Mb,KR=new Cb,QR=new Cb;function $R(e){for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var i=0;i<t.children.length;i++)n.push.apply(n,e(t.children[i]));return n}(e),n=new f_,i=[],r=[],a=new Hw(0,0,1),o=new Hw(0,1,0),s=0;s<t.length;s++){var l=t[s];l.parent&&l.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new i_(i,3)),n.setAttribute("color",new i_(r,3));var c=new FT({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});XT.call(this,n,c),this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function eP(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var i=new oA(t,4,2),r=new Xw({wireframe:!0,fog:!1,toneMapped:!1});O_.call(this,i,r),this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}$R.prototype=Object.create(XT.prototype),$R.prototype.constructor=$R,$R.prototype.isSkeletonHelper=!0,$R.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,i=n.getAttribute("position");QR.getInverse(this.root.matrixWorld);for(var r=0,a=0;r<t.length;r++){var o=t[r];o.parent&&o.parent.isBone&&(KR.multiplyMatrices(QR,o.matrixWorld),ZR.setFromMatrixPosition(KR),i.setXYZ(a,ZR.x,ZR.y,ZR.z),KR.multiplyMatrices(QR,o.parent.matrixWorld),ZR.setFromMatrixPosition(KR),i.setXYZ(a+1,ZR.x,ZR.y,ZR.z),a+=2)}n.getAttribute("position").needsUpdate=!0,Jb.prototype.updateMatrixWorld.call(this,e)},eP.prototype=Object.create(O_.prototype),eP.prototype.constructor=eP,eP.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},eP.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var tP=new Mb,nP=new Hw,iP=new Hw;function rP(e,t,n){Jb.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var i=new fE(t);i.rotateY(.5*Math.PI),this.material=new Xw({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);var r=i.getAttribute("position"),a=new Float32Array(3*r.count);i.setAttribute("color",new Jw(a,3)),this.add(new O_(i,this.material)),this.update()}function aP(e,t,n,i){e=e||10,t=t||10,n=new Hw(void 0!==n?n:4473924),i=new Hw(void 0!==i?i:8947848);for(var r=t/2,a=e/t,o=e/2,s=[],l=[],c=0,h=0,u=-o;c<=t;c++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var p=c===r?n:i;p.toArray(l,h),h+=3,p.toArray(l,h),h+=3,p.toArray(l,h),h+=3,p.toArray(l,h),h+=3}var d=new f_;d.setAttribute("position",new i_(s,3)),d.setAttribute("color",new i_(l,3));var f=new FT({vertexColors:!0,toneMapped:!1});XT.call(this,d,f),this.type="GridHelper"}function oP(e,t,n,i,r,a){e=e||10,t=t||16,n=n||8,i=i||64,r=new Hw(void 0!==r?r:4473924),a=new Hw(void 0!==a?a:8947848);var o,s,l,c,h,u,p,d=[],f=[];for(c=0;c<=t;c++)l=c/t*(2*Math.PI),o=Math.sin(l)*e,s=Math.cos(l)*e,d.push(0,0,0),d.push(o,0,s),p=1&c?r:a,f.push(p.r,p.g,p.b),f.push(p.r,p.g,p.b);for(c=0;c<=n;c++)for(p=1&c?r:a,u=e-e/n*c,h=0;h<i;h++)l=h/i*(2*Math.PI),o=Math.sin(l)*u,s=Math.cos(l)*u,d.push(o,0,s),f.push(p.r,p.g,p.b),l=(h+1)/i*(2*Math.PI),o=Math.sin(l)*u,s=Math.cos(l)*u,d.push(o,0,s),f.push(p.r,p.g,p.b);var m=new f_;m.setAttribute("position",new i_(d,3)),m.setAttribute("color",new i_(f,3));var g=new FT({vertexColors:!0,toneMapped:!1});XT.call(this,m,g),this.type="PolarGridHelper"}rP.prototype=Object.create(Jb.prototype),rP.prototype.constructor=rP,rP.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},rP.prototype.update=function(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");nP.copy(this.light.color),iP.copy(this.light.groundColor);for(var n=0,i=t.count;n<i;n++){var r=n<i/2?nP:iP;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}e.lookAt(tP.setFromMatrixPosition(this.light.matrixWorld).negate())},aP.prototype=Object.assign(Object.create(XT.prototype),{constructor:aP,copy:function(e){return XT.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),oP.prototype=Object.create(XT.prototype),oP.prototype.constructor=oP;var sP=new Mb,lP=new Mb,cP=new Mb;function hP(e,t,n){Jb.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);var i=new f_;i.setAttribute("position",new i_([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var r=new FT({fog:!1,toneMapped:!1});this.lightPlane=new jT(i,r),this.add(this.lightPlane),(i=new f_).setAttribute("position",new i_([0,0,0,0,0,1],3)),this.targetLine=new jT(i,r),this.add(this.targetLine),this.update()}hP.prototype=Object.create(Jb.prototype),hP.prototype.constructor=hP,hP.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},hP.prototype.update=function(){sP.setFromMatrixPosition(this.light.matrixWorld),lP.setFromMatrixPosition(this.light.target.matrixWorld),cP.subVectors(lP,sP),this.lightPlane.lookAt(lP),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(lP),this.targetLine.scale.z=cP.length()};var uP=new Mb,pP=new W_;function dP(e){var t=new f_,n=new FT({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],a={},o=new Hw(16755200),s=new Hw(16711680),l=new Hw(43775),c=new Hw(16777215),h=new Hw(3355443);function u(e,t,n){p(e,n),p(t,n)}function p(e,t){i.push(0,0,0),r.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(i.length/3-1)}u("n1","n2",o),u("n2","n4",o),u("n4","n3",o),u("n3","n1",o),u("f1","f2",o),u("f2","f4",o),u("f4","f3",o),u("f3","f1",o),u("n1","f1",o),u("n2","f2",o),u("n3","f3",o),u("n4","f4",o),u("p","n1",s),u("p","n2",s),u("p","n3",s),u("p","n4",s),u("u1","u2",l),u("u2","u3",l),u("u3","u1",l),u("c","t",c),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),t.setAttribute("position",new i_(i,3)),t.setAttribute("color",new i_(r,3)),XT.call(this,t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function fP(e,t,n,i,r,a,o){uP.set(r,a,o).unproject(i);var s=t[e];if(void 0!==s)for(var l=n.getAttribute("position"),c=0,h=s.length;c<h;c++)l.setXYZ(s[c],uP.x,uP.y,uP.z)}dP.prototype=Object.create(XT.prototype),dP.prototype.constructor=dP,dP.prototype.update=function(){var e=this.geometry,t=this.pointMap;pP.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),fP("c",t,e,pP,0,0,-1),fP("t",t,e,pP,0,0,1),fP("n1",t,e,pP,-1,-1,-1),fP("n2",t,e,pP,1,-1,-1),fP("n3",t,e,pP,-1,1,-1),fP("n4",t,e,pP,1,1,-1),fP("f1",t,e,pP,-1,-1,1),fP("f2",t,e,pP,1,-1,1),fP("f3",t,e,pP,-1,1,1),fP("f4",t,e,pP,1,1,1),fP("u1",t,e,pP,.7,1.1,-1),fP("u2",t,e,pP,-.7,1.1,-1),fP("u3",t,e,pP,0,2,-1),fP("cf1",t,e,pP,-1,0,1),fP("cf2",t,e,pP,1,0,1),fP("cf3",t,e,pP,0,-1,1),fP("cf4",t,e,pP,0,1,1),fP("cn1",t,e,pP,-1,0,-1),fP("cn2",t,e,pP,1,0,-1),fP("cn3",t,e,pP,0,-1,-1),fP("cn4",t,e,pP,0,1,-1),e.getAttribute("position").needsUpdate=!0};var mP=new hw;function gP(e,t){this.object=e,void 0===t&&(t=16776960);var n=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]),i=new Float32Array(24),r=new f_;r.setIndex(new Jw(n,1)),r.setAttribute("position",new Jw(i,3)),XT.call(this,r,new FT({color:t,toneMapped:!1})),this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}function vP(e,t){this.type="Box3Helper",this.box=e,t=t||16776960;var n=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]),i=new f_;i.setIndex(new Jw(n,1)),i.setAttribute("position",new i_([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),XT.call(this,i,new FT({color:t,toneMapped:!1})),this.type="Box3Helper",this.geometry.computeBoundingSphere()}function yP(e,t,n){this.plane=e,this.size=void 0===t?1:t;var i=void 0!==n?n:16776960,r=new f_;r.setAttribute("position",new i_([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),r.computeBoundingSphere(),jT.call(this,r,new FT({color:i,toneMapped:!1})),this.type="PlaneHelper";var a=new f_;a.setAttribute("position",new i_([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new O_(a,new Xw({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}gP.prototype=Object.create(XT.prototype),gP.prototype.constructor=gP,gP.prototype.update=function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&mP.setFromObject(this.object),!mP.isEmpty()){var t=mP.min,n=mP.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}},gP.prototype.setFromObject=function(e){return this.object=e,this.update(),this},gP.prototype.copy=function(e){return XT.prototype.copy.call(this,e),this.object=e.object,this},gP.prototype.clone=function(){return(new this.constructor).copy(this)},vP.prototype=Object.create(XT.prototype),vP.prototype.constructor=vP,vP.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),Jb.prototype.updateMatrixWorld.call(this,e))},yP.prototype=Object.create(jT.prototype),yP.prototype.constructor=yP,yP.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?1:0,this.lookAt(this.plane.normal),Jb.prototype.updateMatrixWorld.call(this,e)};var xP,bP,wP=new Mb;function _P(e,t,n,i,r,a){Jb.call(this),this.type="ArrowHelper",void 0===e&&(e=new Mb(0,0,1)),void 0===t&&(t=new Mb(0,0,0)),void 0===n&&(n=1),void 0===i&&(i=16776960),void 0===r&&(r=.2*n),void 0===a&&(a=.2*r),void 0===xP&&((xP=new f_).setAttribute("position",new i_([0,0,0,0,1,0],3)),(bP=new gA(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new jT(xP,new FT({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new O_(bP,new Xw({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,a)}function MP(e){var t=[0,0,0,e=e||1,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new f_;n.setAttribute("position",new i_(t,3)),n.setAttribute("color",new i_([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var i=new FT({vertexColors:!0,toneMapped:!1});XT.call(this,n,i),this.type="AxesHelper"}_P.prototype=Object.create(Jb.prototype),_P.prototype.constructor=_P,_P.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{wP.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(wP,t)}},_P.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},_P.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},_P.prototype.copy=function(e){return Jb.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},_P.prototype.clone=function(){return(new this.constructor).copy(this)},MP.prototype=Object.create(XT.prototype),MP.prototype.constructor=MP;var SP,TP=[.125,.215,.35,.446,.526,.582],EP=5+TP.length,{_lodPlanes:AP,_sizeLods:LP,_sigmas:RP}=(new zL,function(){for(var e=[],t=[],n=[],i=8,r=0;r<EP;r++){var a=Math.pow(2,i);t.push(a);var o=1/a;r>4?o=TP[r-8+4-1]:0==r&&(o=0),n.push(o);for(var s=1/(a-1),l=-s/2,c=1+s/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=new Float32Array(108),p=new Float32Array(72),d=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,g=f>2?0:-1,v=[m,g,0,m+2/3,g,0,m+2/3,g+1,0,m,g,0,m+2/3,g+1,0,m,g+1,0];u.set(v,18*f),p.set(h,12*f);var y=[f,f,f,f,f,f];d.set(y,6*f)}var x=new f_;x.setAttribute("position",new Jw(u,3)),x.setAttribute("uv",new Jw(p,2)),x.setAttribute("faceIndex",new Jw(d,1)),e.push(x),i>4&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}());function PP(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),fL.call(this,e),this.type="catmullrom"}oL.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(oL.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(EL.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new B_,n=0,i=e.length;n<i;n++){var r=e[n];t.vertices.push(new Mb(r.x,r.y,r.z||0))}return t}}),Object.assign(AL.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),PP.prototype=Object.create(fL.prototype),Object.assign(PP.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),aP.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},$R.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(KA.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),jL(e)}}),KA.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Object.assign(JL.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(VR.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(hw.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(dw.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),Q_.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},qR.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(ub,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),ub.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),ub.ceilPowerOfTwo(e)}}),Object.assign(db.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(Cb.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Mb).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,i,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,a)}}),Tw.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},bb.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(ww.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(zw.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(zw,{barycoordFromPoint:function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),zw.getBarycoord(e,t,n,i,r)},normal:function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),zw.getNormal(e,t,n,i)}}),Object.assign(LL.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new $E(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new uA(this,e)}}),Object.assign(pb.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Mb.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(vb.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(B_.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.assign(Jb.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(Jb.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.assign(O_.prototype,{setDrawMode:function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}),Object.defineProperties(O_.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(AT.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(CT.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),LT.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(oL.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),q_.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==t&&(this.filmGauge=t),this.setFocalLength(e)},Object.defineProperties(RL.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}}),Object.defineProperties(Jw.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),Object.assign(Jw.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?35048:35044),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(f_.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Jw(arguments[1],arguments[2])))},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(f_.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(WL.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}}),Object.defineProperties(BR.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(oT.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),35048===this.usage},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(oT.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?35048:35044),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(eA.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.defineProperties(UR.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(qw.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Hw}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(EA.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(j_.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(iT.prototype,{clearTarget:function(e,t,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,i)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(iT.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?3001:3e3}}}),Object.defineProperties(YS.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(yb.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(vR.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new oR).load(e,(function(e){t.setBuffer(e)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),MR.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},X_.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},fb.crossOrigin=void 0,fb.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new aL;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},fb.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new rL;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},fb.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},fb.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"117"}}))
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/;const CP=Symbol("correlatedObjects"),OP=Symbol("sourceObject"),IP=Symbol("graft"),DP=Symbol("id");class NP{constructor(e,t,n=null){this[SP]=$x(),this[IP]=e,this[OP]=t,this[CP]=n,e.adopt(this)}get ownerModel(){return this[IP].model}get internalID(){return this[DP]}get name(){return this[OP].name||null}get correlatedObjects(){return this[CP]}get sourceObject(){return this[OP]}mutate(e,t){throw new Error("Mutation not implemented for this element")}toJSON(){const e={id:this[DP]},{name:t}=this;return null!=t&&(e.name=t),e}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var zP;SP=DP;const UP=new iL,FP=Symbol("threeTextures"),BP=Symbol("bufferViewImages");class HP extends NP{constructor(e,t,n){if(super(e,t,n),this[zP]=new WeakMap,null!=t.bufferView)for(const e of n)this[BP].set(e,e.image)}get[FP](){return this[CP]}async mutate(e,t){let n=null;if("uri"!==e)throw new Error(`Cannot configure property "${e}" on Image`);null!=t&&(n=await new Promise((e,n)=>{UP.load(t,e,void 0,n)}));for(const e of this[FP])null==n&&null!=this.sourceObject.bufferView?e.image=this[BP].get(e):e.image=n,e.needsUpdate=!0}toJSON(){const e=super.toJSON(),{uri:t}=this.sourceObject;return null!=t&&(e.uri=t),e}}zP=BP;
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const GP=(()=>{const e=[9728,9729,9984,9985,9986,9987];return t=>e.indexOf(t)>-1})(),kP=(()=>{const e=[9728,9729];return t=>e.indexOf(t)>-1})(),VP=(()=>{const e=[33071,33648,10497];return t=>e.indexOf(t)>-1})(),jP={minFilter:9987,magFilter:9729,wrapS:10497,wrapT:10497},WP=Symbol("threeTextures");class qP extends NP{get[WP](){return this[CP]}constructor(e,t,n){super(e,t,n)}async mutate(e,t){const n=this.sourceObject;if(null!=t){if(((e,t)=>{switch(e){case"minFilter":return GP(t);case"magFilter":return kP(t);case"wrapS":case"wrapT":return VP(t);default:throw new Error(`Cannot configure property "${e}" on Sampler`)}})(e,t)){n[e]=t;for(const n of this[WP])n[e]=t,n.needsUpdate=!0}}else if(e in n){delete n[e];for(const t of this[WP])t[e]=jP[e],t.needsUpdate=!0}}toJSON(){const e=super.toJSON(),{minFilter:t,magFilter:n,wrapS:i,wrapT:r}=this.sourceObject;return null!=t&&(e.minFilter=t),null!=n&&(e.magFilter=n),10497!==i&&(e.wrapS=i),10497!==r&&(e.wrapT=r),e}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var XP,YP;const JP=Symbol("source"),ZP=Symbol("sampler");class KP extends NP{constructor(e,t,n){super(e,t,n),this[XP]=null,this[YP]=null;const i=e.correlatedSceneGraph.gltf,{sampler:r,source:a}=t;if(null!=r){const t=i.samplers&&i.samplers[r];null!=t&&(this[ZP]=new qP(e,t,n))}if(null!=a){const t=i.images&&i.images[a];null!=t&&(this[JP]=new HP(e,t,n))}}get sampler(){return this[ZP]}get source(){return this[JP]}toJSON(){const e=super.toJSON(),{sampler:t,source:n}=this;return null!=t&&(e.sampler=t.toJSON()),null!=n&&(e.source=n.toJSON()),e}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var QP;XP=JP,YP=ZP;const $P=Symbol("texture");class eC extends NP{constructor(e,t,n){super(e,t,n),this[QP]=null;const i=e.correlatedSceneGraph.gltf,{index:r}=t,a=null!=r&&null!=i.textures?i.textures[r]:null;null!=a&&(this[$P]=new KP(e,a,n))}get texture(){return this[$P]}toJSON(){const e=super.toJSON(),{texture:t}=this;return null!=t&&(e.texture=t.toJSON()),e}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var tC,nC;QP=$P;const iC=Symbol("threeMaterials"),rC=Symbol("baseColorTexture"),aC=Symbol("metallicRoughnessTexture");class oC extends NP{constructor(e,t,n){super(e,t,n),this[tC]=null,this[nC]=null;const{baseColorTexture:i,metallicRoughnessTexture:r}=t,a=new Set,o=new Set;for(const e of n)null!=i&&null!=e.map&&a.add(e.map),null!=r&&null!=e.metalnessMap&&o.add(e.metalnessMap);a.size>0&&(this[rC]=new eC(e,i,a)),o.size>0&&(this[aC]=new eC(e,r,o))}get[(tC=rC,nC=aC,iC)](){return this[CP]}get baseColorFactor(){return this.sourceObject.baseColorFactor||[1,1,1,1]}get metallicFactor(){return this.sourceObject.metallicFactor||0}get roughnessFactor(){return this.sourceObject.roughnessFactor||0}get baseColorTexture(){return this[rC]}get metallicRoughnessTexture(){return this[aC]}async mutate(e,t){if(!["baseColorFactor","metallicFactor","roughnessFactor"].includes(e))throw new Error(`Cannot mutate ${e} on PBRMetallicRoughness`);switch(e){case"baseColorFactor":for(const e of this[iC]){e.color.fromArray(t),e.opacity=t[3];const n=this[OP];1===t&&1===t&&1===t&&1===t?delete n.baseColorFactor:n.baseColorFactor=t}break;case"metallicFactor":for(const e of this[iC]){e.metalness=t;this[OP].metallicFactor=t}break;case"roughnessFactor":for(const e of this[iC]){e.roughness=t;this[OP].roughnessFactor=t}}}toJSON(){const e=super.toJSON(),{baseColorTexture:t,metallicRoughnessTexture:n,baseColorFactor:i,roughnessFactor:r,metallicFactor:a}=this;return null!=t&&(e.baseColorTexture=t.toJSON()),null!=i&&(e.baseColorFactor=i),null!=a&&(e.metallicFactor=a),null!=r&&(e.roughnessFactor=r),null!=n&&(e.metallicRoughnessTexture=n.toJSON()),e}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var sC,lC,cC,hC;const uC=Symbol("pbrMetallicRoughness"),pC=Symbol("normalTexture"),dC=Symbol("occlusionTexture"),fC=Symbol("emissiveTexture");class mC extends NP{constructor(e,t,n){super(e,t,n),this[sC]=null,this[lC]=null,this[cC]=null,this[hC]=null;const{pbrMetallicRoughness:i,normalTexture:r,occlusionTexture:a,emissiveTexture:o}=t;null!=i&&(this[uC]=new oC(e,i,n));const s=new Set,l=new Set,c=new Set;for(const e of n){const{normalMap:t,aoMap:n,emissiveMap:i}=e;null!=r&&null!=t&&s.add(t),null!=a&&null!=n&&l.add(n),null!=o&&null!=i&&c.add(i)}s.size>0&&(this[pC]=new eC(e,r,s)),l.size>0&&(this[dC]=new eC(e,a,l)),c.size>0&&(this[fC]=new eC(e,o,c))}get pbrMetallicRoughness(){return this[uC]}get normalTexture(){return this[pC]}get occlusionTexture(){return this[dC]}get emissiveTexture(){return this[fC]}toJSON(){const e=super.toJSON(),{pbrMetallicRoughness:t,normalTexture:n,occlusionTexture:i,emissiveTexture:r}=this;return null!=t&&(e.pbrMetallicRoughness=t.toJSON()),null!=n&&(e.normalTexture=n.toJSON()),null!=i&&(e.occlusionTexture=i.toJSON()),null!=r&&(e.emissiveTexture=r.toJSON()),e}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var gC,vC;sC=uC,lC=pC,cC=dC,hC=fC;const yC=Symbol("modelUri"),xC=Symbol("materials");class bC extends NP{constructor(e,t,n){super(e,n.gltf),this[gC]="",this[vC]=[],this[yC]=t;new ob({material:t=>{this[xC].push(new mC(e,t,n.gltfElementMap.get(t)))}}).visit(n.gltf,{sparse:!0})}get materials(){return this[xC]}toJSON(){const e=super.toJSON();return e.modelUri=this[yC],e.materials=this[xC].map(e=>e.toJSON()),e}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var wC;gC=yC,vC=xC;const _C=Symbol("model"),MC=Symbol("correlatedSceneGraph"),SC=Symbol("elementsByInternalId");class TC extends EventTarget{constructor(e,t){super(),this[wC]=new Map,this[MC]=t,this[_C]=new bC(this,e,t)}get correlatedSceneGraph(){return this[MC]}get model(){return this[_C]}getElementByInternalId(e){const t=this[SC].get(e);return null==t?null:t}adopt(e){this[SC].set(e.internalID,e)}async mutate(e,t,n){const i=this.getElementByInternalId(e);null!=i&&(await i.mutate(t,n),this.dispatchEvent(new CustomEvent("mutation",{detail:{element:i}})))}}wC=SC;var EC=0,AC=1,LC=2,RC=3,PC=4,CC=5121,OC=5123,IC=5126,DC=5125,NC=34962,zC=34963,UC=9728,FC=9729,BC=9984,HC=9985,GC=9986,kC=9987,VC=33071,jC=33648,WC=10497,qC={};qC[1003]=UC,qC[1004]=BC,qC[1005]=GC,qC[1006]=FC,qC[1007]=HC,qC[1008]=kC,qC[1001]=VC,qC[1e3]=WC,qC[1002]=jC;var XC={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},YC=function(){};YC.prototype={constructor:YC,parse:function(e,t,n){var i={binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],forcePowerOfTwoTextures:!1,includeCustomExtensions:!1};(n=Object.assign({},i,n)).animations.length>0&&(n.trs=!0);var r,a={asset:{version:"2.0",generator:"GLTFExporter"}},o=0,s=[],l=[],c=new Map,h=[],u={},p={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},d=new Map,f=0;function m(e){return d.has(e)||d.set(e,f++),d.get(e)}function g(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))}function v(e){return 4*Math.ceil(e/4)}function y(e,t){t=t||0;var n=v(e.byteLength);if(n!==e.byteLength){var i=new Uint8Array(n);if(i.set(new Uint8Array(e)),0!==t)for(var r=e.byteLength;r<n;r++)i[r]=t;return i.buffer}return e}function x(e,t){if(0!==Object.keys(e.userData).length)try{var i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){for(var r in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[r]=i.gltfExtensions[r],u[r]=!0;delete i.gltfExtensions}Object.keys(i).length>0&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}function b(e,t){var n=!1,i={};0===t.offset.x&&0===t.offset.y||(i.offset=t.offset.toArray(),n=!0),0!==t.rotation&&(i.rotation=t.rotation,n=!0),1===t.repeat.x&&1===t.repeat.y||(i.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,u.KHR_texture_transform=!0)}function w(e){return a.buffers||(a.buffers=[{byteLength:0}]),s.push(e),0}function M(e,t,i,r){var s;if(e.array.constructor===Float32Array)s=IC;else if(e.array.constructor===Uint32Array)s=DC;else if(e.array.constructor===Uint16Array)s=OC;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");s=CC}if(void 0===i&&(i=0),void 0===r&&(r=e.count),n.truncateDrawRange&&void 0!==t&&null===t.index){var l=i+r,c=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;i=Math.max(i,t.drawRange.start),(r=Math.min(l,c)-i)<0&&(r=0)}if(0===r)return null;var h,u=function(e,t,n){for(var i={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},r=t;r<t+n;r++)for(var a=0;a<e.itemSize;a++){var o=e.array[r*e.itemSize+a];i.min[a]=Math.min(i.min[a],o),i.max[a]=Math.max(i.max[a],o)}return i}(e,i,r);void 0!==t&&(h=e===t.index?zC:NC);var p=function(e,t,n,i,r){var s;a.bufferViews||(a.bufferViews=[]),s=t===CC?1:t===OC?2:4;for(var l=v(i*e.itemSize*s),c=new DataView(new ArrayBuffer(l)),h=0,u=n;u<n+i;u++)for(var p=0;p<e.itemSize;p++){var d;e.itemSize>4?d=e.array[u*e.itemSize+p]:0===p?d=e.getX(u):1===p?d=e.getY(u):2===p?d=e.getZ(u):3===p&&(d=e.getW(u)),t===IC?c.setFloat32(h,d,!0):t===DC?c.setUint32(h,d,!0):t===OC?c.setUint16(h,d,!0):t===CC&&c.setUint8(h,d),h+=s}var f={buffer:w(c.buffer),byteOffset:o,byteLength:l};return void 0!==r&&(f.target=r),r===NC&&(f.byteStride=e.itemSize*s),o+=l,a.bufferViews.push(f),{id:a.bufferViews.length-1,byteLength:0}}(e,s,i,r,h),d={bufferView:p.id,byteOffset:p.byteOffset,componentType:s,count:r,max:u.max,min:u.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(d.normalized=!0),a.accessors||(a.accessors=[]),a.accessors.push(d),a.accessors.length-1}function S(e,t,i){p.images.has(e)||p.images.set(e,{});var s=p.images.get(e),c=1023===t?"image/png":"image/jpeg",h=c+":flipY/"+i.toString();if(void 0!==s[h])return s[h];a.images||(a.images=[]);var u={mimeType:c};if(n.embedImages){var d=r=r||document.createElement("canvas");d.width=Math.min(e.width,n.maxTextureSize),d.height=Math.min(e.height,n.maxTextureSize),n.forcePowerOfTwoTextures&&!function(e){return _.isPowerOfTwo(e.width)&&_.isPowerOfTwo(e.height)}(d)&&(console.warn("GLTFExporter: Resized non-power-of-two image.",e),d.width=_.floorPowerOfTwo(d.width),d.height=_.floorPowerOfTwo(d.height));var f=d.getContext("2d");!0===i&&(f.translate(0,d.height),f.scale(1,-1)),f.drawImage(e,0,0,d.width,d.height),!0===n.binary?l.push(new Promise((function(e){d.toBlob((function(t){(function(e){return a.bufferViews||(a.bufferViews=[]),new Promise((function(t){var n=new window.FileReader;n.readAsArrayBuffer(e),n.onloadend=function(){var e=y(n.result),i={buffer:w(e),byteOffset:o,byteLength:e.byteLength};o+=e.byteLength,a.bufferViews.push(i),t(a.bufferViews.length-1)}}))})(t).then((function(t){u.bufferView=t,e()}))}),c)}))):u.uri=d.toDataURL(c)}else u.uri=e.src;a.images.push(u);var m=a.images.length-1;return s[h]=m,m}function T(e){a.samplers||(a.samplers=[]);var t={magFilter:qC[e.magFilter],minFilter:qC[e.minFilter],wrapS:qC[e.wrapS],wrapT:qC[e.wrapT]};return a.samplers.push(t),a.samplers.length-1}function E(e){if(p.textures.has(e))return p.textures.get(e);a.textures||(a.textures=[]);var t={sampler:T(e),source:S(e.image,e.format,e.flipY)};e.name&&(t.name=e.name),a.textures.push(t);var n=a.textures.length-1;return p.textures.set(e,n),n}function A(e){if(p.materials.has(e))return p.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;a.materials||(a.materials=[]);var t={pbrMetallicRoughness:{}};e.isMeshBasicMaterial?(t.extensions={KHR_materials_unlit:{}},u.KHR_materials_unlit=!0):e.isGLTFSpecularGlossinessMaterial?(t.extensions={KHR_materials_pbrSpecularGlossiness:{}},u.KHR_materials_pbrSpecularGlossiness=!0):e.isMeshStandardMaterial||console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");var n=e.color.toArray().concat([e.opacity]);if(g(n,[1,1,1,1])||(t.pbrMetallicRoughness.baseColorFactor=n),e.isMeshStandardMaterial?(t.pbrMetallicRoughness.metallicFactor=e.metalness,t.pbrMetallicRoughness.roughnessFactor=e.roughness):e.isMeshBasicMaterial?(t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9):(t.pbrMetallicRoughness.metallicFactor=.5,t.pbrMetallicRoughness.roughnessFactor=.5),e.isGLTFSpecularGlossinessMaterial){t.pbrMetallicRoughness.baseColorFactor&&(t.extensions.KHR_materials_pbrSpecularGlossiness.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);var i=[1,1,1];e.specular.toArray(i,0),t.extensions.KHR_materials_pbrSpecularGlossiness.specularFactor=i,t.extensions.KHR_materials_pbrSpecularGlossiness.glossinessFactor=e.glossiness}if(e.metalnessMap||e.roughnessMap)if(e.metalnessMap===e.roughnessMap){var r={index:E(e.metalnessMap)};b(r,e.metalnessMap),t.pbrMetallicRoughness.metallicRoughnessTexture=r}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(e.map){var o={index:E(e.map)};b(o,e.map),e.isGLTFSpecularGlossinessMaterial&&(t.extensions.KHR_materials_pbrSpecularGlossiness.diffuseTexture=o),t.pbrMetallicRoughness.baseColorTexture=o}if(e.isGLTFSpecularGlossinessMaterial&&e.specularMap){var s={index:E(e.specularMap)};b(s,e.specularMap),t.extensions.KHR_materials_pbrSpecularGlossiness.specularGlossinessTexture=s}if(e.emissive){var l=e.emissive.clone().multiplyScalar(e.emissiveIntensity).toArray();if(g(l,[0,0,0])||(t.emissiveFactor=l),e.emissiveMap){var c={index:E(e.emissiveMap)};b(c,e.emissiveMap),t.emissiveTexture=c}}if(e.normalMap){var h={index:E(e.normalMap)};e.normalScale&&-1!==e.normalScale.x&&(e.normalScale.x!==e.normalScale.y&&console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."),h.scale=e.normalScale.x),b(h,e.normalMap),t.normalTexture=h}if(e.aoMap){var d={index:E(e.aoMap),texCoord:1};1!==e.aoMapIntensity&&(d.strength=e.aoMapIntensity),b(d,e.aoMap),t.occlusionTexture=d}e.transparent?t.alphaMode="BLEND":e.alphaTest>0&&(t.alphaMode="MASK",t.alphaCutoff=e.alphaTest),2===e.side&&(t.doubleSided=!0),""!==e.name&&(t.name=e.name),x(e,t),a.materials.push(t);var f=a.materials.length-1;return p.materials.set(e,f),f}function L(e){var t=[e.geometry.uuid];if(Array.isArray(e.material))for(var n=0,i=e.material.length;n<i;n++)t.push(e.material[n].uuid);else t.push(e.material.uuid);var r=t.join(":");if(p.meshes.has(r))return p.meshes.get(r);var o,s=e.geometry;o=e.isLineSegments?AC:e.isLineLoop?LC:e.isLine?RC:e.isPoints?EC:e.material.wireframe?AC:PC,s.isBufferGeometry||(console.warn("GLTFExporter: Exporting THREE.Geometry will increase file size. Use BufferGeometry instead."),s=(new Tt).setFromObject(e));var l={},c={},h=[],u=[],d={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=s.getAttribute("normal");void 0===f||function(e){if(p.attributesNormalized.has(e))return!1;for(var t=new D,n=0,i=e.count;n<i;n++)if(Math.abs(t.fromArray(e.array,3*n).length()-1)>5e-4)return!1;return!0}(f)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",function(e){if(p.attributesNormalized.has(e))return p.attributesNormalized.get(e);for(var t=e.clone(),n=new D,i=0,r=t.count;i<r;i++)n.fromArray(t.array,3*i),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),n.toArray(t.array,3*i);return p.attributesNormalized.set(e,t),t}(f)));var g=null;for(var v in s.attributes)if("morph"!==v.substr(0,5)){var y=s.attributes[v];v=d[v]||v.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(v)||(v="_"+v),p.attributes.has(m(y)))c[v]=p.attributes.get(m(y));else{g=null;var b=y.array;"JOINTS_0"!==v||b instanceof Uint16Array||b instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),g=new ot(new Uint16Array(b),y.itemSize,y.normalized));var w=M(g||y,s);null!==w&&(c[v]=w,p.attributes.set(m(y),w))}}if(void 0!==f&&s.setAttribute("normal",f),0===Object.keys(c).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){var _=[],S=[],T={};if(void 0!==e.morphTargetDictionary)for(var E in e.morphTargetDictionary)T[e.morphTargetDictionary[E]]=E;for(n=0;n<e.morphTargetInfluences.length;++n){var L={},R=!1;for(var v in s.morphAttributes)if("position"===v||"normal"===v){y=s.morphAttributes[v][n];var P=v.toUpperCase(),C=s.attributes[v];if(p.attributes.has(m(y)))L[P]=p.attributes.get(m(y));else{var O=y.clone();if(!s.morphTargetsRelative)for(var I=0,N=y.count;I<N;I++)O.setXYZ(I,y.getX(I)-C.getX(I),y.getY(I)-C.getY(I),y.getZ(I)-C.getZ(I));L[P]=M(O,s),p.attributes.set(m(C),L[P])}}else R||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),R=!0);u.push(L),_.push(e.morphTargetInfluences[n]),void 0!==e.morphTargetDictionary&&S.push(T[n])}l.weights=_,S.length>0&&(l.extras={},l.extras.targetNames=S)}var z=Array.isArray(e.material);if(z&&0===s.groups.length)return null;for(var U=z?e.material:[e.material],F=z?s.groups:[{materialIndex:0,start:void 0,count:void 0}],B=(n=0,F.length);n<B;n++){var H={mode:o,attributes:c};if(x(s,H),u.length>0&&(H.targets=u),null!==s.index){var G=m(s.index);void 0===F[n].start&&void 0===F[n].count||(G+=":"+F[n].start+":"+F[n].count),p.attributes.has(G)?H.indices=p.attributes.get(G):(H.indices=M(s.index,s,F[n].start,F[n].count),p.attributes.set(G,H.indices)),null===H.indices&&delete H.indices}var k=A(U[F[n].materialIndex]);null!==k&&(H.material=k),h.push(H)}l.primitives=h,a.meshes||(a.meshes=[]),a.meshes.push(l);var V=a.meshes.length-1;return p.meshes.set(r,V),V}function R(e,t){a.animations||(a.animations=[]);for(var n=(e=YC.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,i=[],r=[],o=0;o<n.length;++o){var s=n[o],l=$l.parseTrackName(s.name),h=$l.findNode(t,l.nodeName),u=XC[l.propertyName];if("bones"===l.objectName&&(h=!0===h.isSkinnedMesh?h.skeleton.getBoneByName(l.objectIndex):void 0),!h||!u)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',s.name),null;var p,d=s.values.length/s.times.length;u===XC.morphTargetInfluences&&(d/=h.morphTargetInfluences.length),!0===s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",d/=3):p=2300===s.getInterpolation()?"STEP":"LINEAR",r.push({input:M(new ot(s.times,1)),output:M(new ot(s.values,d)),interpolation:p}),i.push({sampler:r.length-1,target:{node:c.get(h),path:u}})}return a.animations.push({name:e.name||"clip_"+a.animations.length,samplers:r,channels:i}),a.animations.length-1}function P(e){var t=a.nodes[c.get(e)],n=e.skeleton;if(void 0===n)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var r=[],o=new Float32Array(16*n.bones.length),s=0;s<n.bones.length;++s)r.push(c.get(n.bones[s])),n.boneInverses[s].toArray(o,16*s);return void 0===a.skins&&(a.skins=[]),a.skins.push({inverseBindMatrices:M(new ot(o,16)),joints:r,skeleton:c.get(i)}),t.skin=a.skins.length-1}function C(e){var t={};e.name&&(t.name=e.name),t.color=e.color.toArray(),t.intensity=e.intensity,e.isDirectionalLight?t.type="directional":e.isPointLight?(t.type="point",e.distance>0&&(t.range=e.distance)):e.isSpotLight&&(t.type="spot",e.distance>0&&(t.range=e.distance),t.spot={},t.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,t.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1.");var n=a.extensions.KHR_lights_punctual.lights;return n.push(t),n.length-1}function O(e){a.nodes||(a.nodes=[]);var t={};if(n.trs){var i=e.quaternion.toArray(),r=e.position.toArray(),o=e.scale.toArray();g(i,[0,0,0,1])||(t.rotation=i),g(r,[0,0,0])||(t.translation=r),g(o,[1,1,1])||(t.scale=o)}else e.matrixAutoUpdate&&e.updateMatrix(),g(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])||(t.matrix=e.matrix.elements);if(""!==e.name&&(t.name=String(e.name)),x(e,t),e.isMesh||e.isLine||e.isPoints){var s=L(e);null!==s&&(t.mesh=s)}else if(e.isCamera)t.camera=function(e){a.cameras||(a.cameras=[]);var t=e.isOrthographicCamera,n={type:t?"orthographic":"perspective"};return t?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:_.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),a.cameras.push(n),a.cameras.length-1}(e);else if(e.isDirectionalLight||e.isPointLight||e.isSpotLight)u.KHR_lights_punctual||(a.extensions=a.extensions||{},a.extensions.KHR_lights_punctual={lights:[]},u.KHR_lights_punctual=!0),t.extensions=t.extensions||{},t.extensions.KHR_lights_punctual={light:C(e)};else if(e.isLight)return console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e),null;if(e.isSkinnedMesh&&h.push(e),e.children.length>0){for(var l=[],p=0,d=e.children.length;p<d;p++){var f=e.children[p];if(f.visible||!1===n.onlyVisible){var m=O(f);null!==m&&l.push(m)}}l.length>0&&(t.children=l)}a.nodes.push(t);var v=a.nodes.length-1;return c.set(e,v),v}function I(e){a.scenes||(a.scenes=[],a.scene=0);var t={};""!==e.name&&(t.name=e.name),a.scenes.push(t);for(var i=[],r=0,o=e.children.length;r<o;r++){var s=e.children[r];if(s.visible||!1===n.onlyVisible){var l=O(s);null!==l&&i.push(l)}}i.length>0&&(t.nodes=i),x(e,t)}!function(e){e=e instanceof Array?e:[e];for(var t=[],i=0;i<e.length;i++)e[i]instanceof se?I(e[i]):t.push(e[i]);for(t.length>0&&function(e){var t=new se;t.name="AuxScene";for(var n=0;n<e.length;n++)t.children.push(e[n]);I(t)}(t),i=0;i<h.length;++i)P(h[i]);for(i=0;i<n.animations.length;++i)R(n.animations[i],e[0])}(e),Promise.all(l).then((function(){var e=new Blob(s,{type:"application/octet-stream"}),i=Object.keys(u);if(i.length>0&&(a.extensionsUsed=i),a.buffers&&a.buffers.length>0&&(a.buffers[0].byteLength=e.size),!0===n.binary){(r=new window.FileReader).readAsArrayBuffer(e),r.onloadend=function(){var e=y(r.result),n=new DataView(new ArrayBuffer(8));n.setUint32(0,e.byteLength,!0),n.setUint32(4,5130562,!0);var i=y(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t=new Uint8Array(new ArrayBuffer(e.length)),n=0,i=e.length;n<i;n++){var r=e.charCodeAt(n);t[n]=r>255?32:r}return t.buffer}(JSON.stringify(a)),32),o=new DataView(new ArrayBuffer(8));o.setUint32(0,i.byteLength,!0),o.setUint32(4,1313821514,!0);var s=new ArrayBuffer(12),l=new DataView(s);l.setUint32(0,1179937895,!0),l.setUint32(4,2,!0);var c=12+o.byteLength+i.byteLength+n.byteLength+e.byteLength;l.setUint32(8,c,!0);var h=new Blob([s,o,i,n,e],{type:"application/octet-stream"}),u=new window.FileReader;u.readAsArrayBuffer(h),u.onloadend=function(){t(u.result)}}}else{var r;if(a.buffers&&a.buffers.length>0)(r=new window.FileReader).readAsDataURL(e),r.onloadend=function(){var e=r.result;a.buffers[0].uri=e,t(a)};else t(a)}}))}},YC.Utils={insertKeyframe:function(e,t){var n,i=e.getValueSize(),r=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+i),o=e.createInterpolant(new e.ValueBufferType(i));if(0===e.times.length){r[0]=t;for(var s=0;s<i;s++)a[s]=0;n=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;r[0]=t,r.set(e.times,1),a.set(o.evaluate(t),0),a.set(e.values,i),n=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;r[r.length-1]=t,r.set(e.times,0),a.set(e.values,0),a.set(o.evaluate(t),e.values.length),n=r.length-1}else for(s=0;s<e.times.length;s++){if(Math.abs(e.times[s]-t)<.001)return s;if(e.times[s]<t&&e.times[s+1]>t){r.set(e.times.slice(0,s+1),0),r[s+1]=t,r.set(e.times.slice(s+1),s+2),a.set(e.values.slice(0,(s+1)*i),0),a.set(o.evaluate(t),(s+1)*i),a.set(e.values.slice((s+1)*i),(s+2)*i),n=s+1;break}}return e.times=r,e.values=a,n},mergeMorphTargetTracks:function(e,t){for(var n=[],i={},r=e.tracks,a=0;a<r.length;++a){var o=r[a],s=$l.parseTrackName(o.name),l=$l.findNode(t,s.nodeName);if("morphTargetInfluences"===s.propertyName&&void 0!==s.propertyIndex){if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(2301)}var c,h=l.morphTargetInfluences.length,u=l.morphTargetDictionary[s.propertyIndex];if(void 0===u)throw new Error("THREE.GLTFExporter: Morph target name not found: "+s.propertyIndex);if(void 0!==i[l.uuid]){var p=o.createInterpolant(new o.ValueBufferType(1));c=i[l.uuid];for(m=0;m<c.times.length;m++)c.values[m*h+u]=p.evaluate(c.times[m]);for(m=0;m<o.times.length;m++){var d=this.insertKeyframe(c,o.times[m]);c.values[d*h+u]=o.values[m]}}else{for(var f=new((c=o.clone()).ValueBufferType)(h*c.times.length),m=0;m<c.times.length;m++)f[m*h+u]=c.values[m];c.name=s.nodeName+".morphTargetInfluences",c.values=f,i[l.uuid]=c,n.push(c)}}else n.push(o)}return e.tracks=n,e}};const JC=new Set(["messaging","fetch","material-properties","textures"]),ZC=Symbol("onChildListMutation"),KC=Symbol("childListMutationHandler"),QC=Symbol("mutationObserver"),$C=Symbol("createExecutionContext"),eO=Symbol("onScriptElementAdded"),tO=Symbol("executionContext"),nO=Symbol("updateExecutionContextModel"),iO=Symbol("currentGLTF"),rO=Symbol("modelGraft"),aO=Symbol("onModelGraftMutation"),oO=Symbol("modelGraftMutationHandler"),sO=Symbol("isValid3DOMScript");
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var lO=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const cO=Math.PI/32,hO=Symbol("autoRotateStartTime"),uO=Symbol("cameraChangeHandler"),pO=Symbol("onCameraChange"),dO=(e=>{var t,n,i,r;class a extends e{constructor(...e){super(...e),this[t]=new Nh,this[n]=new Map,this[i]=e=>{e.forEach(e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach(e=>{this[Lm](e)}),e.removedNodes.forEach(e=>{this[Rm](e)}),this[cm]())})},this[r]=new MutationObserver(this[Em]);const a=this.shadowRoot,{domElement:o}=this[Sm];o.classList.add("annotation-container"),a.querySelector(".container").appendChild(o),o.appendChild(a.querySelector(".default"))}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[Lm](this.children[e]);const{ShadyDOM:e}=self;null==e?this[Am].observe(this,{childList:!0}):this[Am]=e.observeChildren(this,this[Em])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[Am].disconnect():e.unobserveChildren(this[Am])}updateHotspot(e){const t=this[Tm].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal))}positionAndNormalFromPoint(e,t){const n=this[lm],{width:i,height:r,model:a}=n;Pm.set(e/i,t/r).multiplyScalar(2).subScalar(1),Pm.y*=-1;const o=n.positionAndNormalFromPoint(Pm);if(null==o)return null;Cm.getInverse(a.matrixWorld);return{position:xm(o.position.applyMatrix4(Cm)),normal:xm(o.normal)}}[(t=Sm,n=Tm,i=Em,r=Am,hm)](e,t){super[hm](e,t);const n=this[lm],i=n.getCamera();n.isDirty&&(n.model.updateHotspots(i.position),this[Sm].render(n,i))}[pm](e){super[pm](e),this[Sm].setSize(e.width,e.height)}[Lm](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[Tm].get(e.slot);null!=t?t.increment():(t=new ru({name:e.slot,position:e.dataset.position,normal:e.dataset.normal}),this[Tm].set(e.slot,t),this[lm].model.addHotspot(t),this[Sm].domElement.appendChild(t.element)),this[lm].isDirty=!0}[Rm](e){if(!(e instanceof HTMLElement))return;const t=this[Tm].get(e.slot);t&&(t.decrement()&&(this[lm].model.removeHotspot(t),this[Tm].delete(e.slot)),this[lm].isDirty=!0)}}return a})((e=>{var t,n,i,r,o,s;class l extends e{constructor(){super(...arguments),this[s]=null,this[t]=e=>this[ZC](e),this[n]=e=>this[aO](e),this[i]=new MutationObserver(this[KC]),this[r]=null,this[o]=null}get worklet(){const e=this[tO];return null!=e?e.worker:null}connectedCallback(){super.connectedCallback(),this[QC].observe(this,{childList:!0});const e=this.querySelector('script[type="experimental-scene-graph-worklet"]:last-of-type');null!=e&&this[sO](e)&&this[eO](e)}async disconnectedCallback(){super.disconnectedCallback(),this[QC].disconnect();const e=this[tO];null!=e&&(await e.terminate(),this[tO]=null)}updated(e){if(super.updated(e),e.has(rO)){const t=e.get(rO);null!=t&&t.removeEventListener("mutation",this[oO]);const n=this[rO];null!=n&&n.addEventListener("mutation",this[oO])}}[(s=rO,t=KC,n=oO,i=QC,r=tO,o=iO,um)](){super[um](),this[nO]()}[sO](e){return e instanceof HTMLScriptElement&&(e.textContent||e.src)&&"experimental-scene-graph-worklet"===e.getAttribute("type")}[ZC](e){if(null==this.parentNode)return;let t=null;for(const n of e)for(const e of Array.from(n.addedNodes))this[sO](e)&&(t=e);null!=t&&this[eO](t)}[eO](e){if(!this[sO](e))return;const t=(e.getAttribute("allow")||"").split(";").map(e=>e.trim()).filter(e=>JC.has(e));e.src?this[$C](e.src,t):this[$C](e.textContent,t,{eval:!0})}async[$C](e,t,n={eval:!1}){let i=this[tO];null!=i&&await i.terminate(),this[tO]=i=new Qx(t),this.dispatchEvent(new CustomEvent("worklet-created",{detail:{worklet:this.worklet}})),n.eval?await i.eval(e):await i.import(e),this[nO]()}[nO](){const e=this[tO];if(null==e||null==this.parentNode)return;const t=this[lm],{model:n}=t,{currentGLTF:i}=n;let r=null;if(null!=i){const{correlatedSceneGraph:e}=i,t=this[rO];if(null!=e){if(null!=t&&i===this[iO])return;r=new TC(n.url||"",e)}}e.changeModel(r),this[rO]=r,this[iO]=i}[aO](e){this[cm]()}async exportScene(e){const{model:t}=this[lm];return new Promise(async(n,i)=>{if(null==t)return i("Model missing or not yet loaded");const r={animations:t.animations,binary:(null==e?void 0:e.binary)||!1,trs:(null==e?void 0:e.trs)||!0,onlyVisible:(null==e?void 0:e.onlyVisible)||!0,maxTextureSize:(null==e?void 0:e.maxTextureSize)||1/0,forcePowerOfTwoTextures:(null==e?void 0:e.forcePowerOfTwoTextures)||!1,includeCustomExtensions:(null==e?void 0:e.includeCustomExtensions)||!1,embedImages:(null==e?void 0:e.embedImages)||!0,truncateDrawRange:!0};(new YC).parse(t,e=>n(new Blob([r.binary?e:JSON.stringify(e)],{type:r.binary?"application/octet-stream":"application/json"})),r)})}}return function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);a>3&&o&&Object.defineProperty(t,n,o)}([a({type:Object})],l.prototype,s,void 0),l})((e=>{var t,n;class i extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this[t]=performance.now(),this[n]=e=>this[pO](e)}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[uO]),this[hO]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[uO]),this[hO]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[hO]=performance.now())}[(t=hO,n=uO,hm)](e,t){if(super[hm](e,t),!this.autoRotate||!this.modelIsVisible||this[dm].isPresenting)return;const n=Math.min(t,e-this[hO]-this.autoRotateDelay);n>0&&(this[lm].yaw=this.turntableRotation+cO*n*.001)}[pO](e){this.autoRotate&&"user-interaction"===e.detail.source&&(this[hO]=performance.now())}get turntableRotation(){return this[lm].yaw}resetTurntableRotation(){this[lm].yaw=0}}return lO([a({type:Boolean,attribute:"auto-rotate"})],i.prototype,"autoRotate",void 0),lO([a({type:Number,attribute:"auto-rotate-delay"})],i.prototype,"autoRotateDelay",void 0),i})((e=>{var t,n,i;class r extends e{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this[t]=null,this[n]=null,this[i]=e=>{e.element===this&&this[Xy]()}}connectedCallback(){super.connectedCallback(),this[dm].loader.addEventListener("preload",this[Jy])}disconnectedCallback(){super.disconnectedCallback(),this[dm].loader.removeEventListener("preload",this[Jy])}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[lm].setShadowIntensity(.1*this.shadowIntensity),this[cm]()),e.has("shadowSoftness")&&(this[lm].setShadowSoftness(this.shadowSoftness),this[cm]()),e.has("exposure")&&(this[lm].exposure=this.exposure,this[cm]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[vm]()&&this[Xy]()}[(t=Wy,n=Yy,i=Jy,um)](){super[um](),null!=this[Wy]&&this[qy](this[Wy])}async[Xy](){const{skyboxImage:e,environmentImage:t}=this;null!=this[Yy]&&(this[Yy](),this[Yy]=null);const{textureUtils:n}=this[dm];if(null!=n)try{const{environmentMap:i,skybox:r}=await new Promise(async(i,r)=>{const a=n.generateEnvironmentMapAndSkybox(Pu(e),Pu(t),{progressTracker:this[fm]});this[Yy]=()=>r(a),i(await a)});this[lm].background=null!=r?r.texture:null,this[qy](i.texture),this[lm].model.dispatchEvent({type:"envmap-update"})}catch(e){if(e instanceof Error)throw this[qy](null),e}}[qy](e){this[Wy]=e,this[lm].environment=this[Wy],this.dispatchEvent(new CustomEvent("environment-change")),this[cm]()}}return jy([a({type:String,attribute:"environment-image"})],r.prototype,"environmentImage",void 0),jy([a({type:String,attribute:"skybox-image"})],r.prototype,"skyboxImage",void 0),jy([a({type:Number,attribute:"shadow-intensity"})],r.prototype,"shadowIntensity",void 0),jy([a({type:Number,attribute:"shadow-softness"})],r.prototype,"shadowSoftness",void 0),jy([a({type:Number})],r.prototype,"exposure",void 0),r})((e=>{var t,n,i,r,o,s,l,c,h,u,p,d,f,m,g,v,y;class x extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit="0deg 75deg 105%",this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPromptStyle=ey,this.interactionPrompt=Qv,this.interactionPolicy=ty,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[n]=this.shadowRoot.querySelector(".interaction-prompt > .animated-container"),this[i]=1/0,this[r]=0,this[o]=1/0,this[s]=!1,this[l]=!1,this[c]=new kv(this[lm].camera,this[om]),this[h]=0,this[u]=new sc,this[p]=!1,this[d]=!1,this[f]=!1,this[m]=e=>this[Ty](e),this[g]=e=>this[Ey](e),this[v]=()=>this[Sy](),this[y]=()=>this[My]()}getCameraOrbit(){const{theta:e,phi:t,radius:n}=this[Iy];return{theta:e,phi:t,radius:n}}getCameraTarget(){return this[lm].getTarget()}getFieldOfView(){return this[dy].getFieldOfView()}getMinimumFieldOfView(){return this[dy].options.minimumFieldOfView}getMaximumFieldOfView(){return this[dy].options.maximumFieldOfView}jumpCameraToGoal(){this[Dy]=!0,this.requestUpdate(Dy,!1)}resetInteractionPrompt(){this[Py]=0,this[Ry]=1/0,this[Ly]=!1,this[Ay]=this.interactionPrompt===Qv&&this.cameraControls}connectedCallback(){super.connectedCallback(),this[dy].addEventListener("change",this[wy]),this[dy].addEventListener("pointer-change-start",this[_y]),this[dy].addEventListener("pointer-change-end",this[_y])}disconnectedCallback(){super.disconnectedCallback(),this[dy].removeEventListener("change",this[wy]),this[dy].removeEventListener("pointer-change-start",this[_y]),this[dy].removeEventListener("pointer-change-end",this[_y])}updated(e){super.updated(e);const t=this[dy],n=this[om];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===Qv&&(this[Ay]=!0),n.addEventListener("focus",this[by]),n.addEventListener("blur",this[xy])):(n.removeEventListener("focus",this[by]),n.removeEventListener("blur",this[xy]),t.disableInteraction(),this[gy]())),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===Qv&&this.cameraControls&&!this[Ly]?this[Ay]=!0:this[gy]()),e.has("interactionPromptStyle")&&this[fy].classList.toggle("wiggle",this.interactionPromptStyle===ey),e.has("interactionPolicy")){const e=this.interactionPolicy;t.applyOptions({interactionPolicy:e})}!0===this[Dy]&&Promise.resolve().then(()=>{this[dy].jumpToGoal(),this[lm].jumpToGoal(),this[Dy]=!1})}[(t=fy,n=my,i=Cy,r=Py,o=Ry,s=Ly,l=Ay,c=dy,h=Oy,u=Iy,p=Dy,d=Ny,f=zy,m=wy,g=_y,v=by,y=xy,Fy)](e){this[dy].setFieldOfView(180*e[0]/Math.PI)}[Uy](e){if(this[zy]){const{theta:t,phi:n}=this.getCameraOrbit();e[0]=t,e[1]=n,this[zy]=!1}this[dy].setOrbit(e[0],e[1],e[2])}[Hy](e){this[dy].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[Gy](e){this[dy].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[yy](e[2]),this.jumpCameraToGoal()}[ky](e){this[dy].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[Vy](e){this[dy].applyOptions({maximumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[By](e){const[t,n,i]=e;this[lm].setTarget(t,n,i),this[dm].arRenderer.updateTarget()}[hm](e,t){if(super[hm](e,t),this[dm].isPresenting||!this.modelIsVisible)return;const n=performance.now();if(this[Ay]){const e=this.interactionPrompt===Qv?this[nm]:this[Cy];this.loaded&&n>e+this.interactionPromptThreshold&&(this[om].setAttribute("aria-label","Use mouse, touch or arrow keys to control the camera!"),this[Ay]=!1,this[Ry]=n,this[fy].classList.add("visible"))}if(isFinite(this[Ry])&&this.interactionPromptStyle===ey){const e=this[lm],t=(n-this[Ry])/5e3%1,i=Xv(t),r=Yv(t);if(this[my].style.opacity=""+r,i!==this[Py]){const t=i*e.width*.05,n=(i-this[Py])*Math.PI/16;this[my].style.transform=`translateX(${t}px)`,this[dy].adjustOrbit(n,0,0),this[Py]=i}}this[dy].update(e,t),this[lm].updateTarget(t)}[gy](){this[Ay]=!1,this[fy].classList.remove("visible"),this[Ry]=1/0}[yy](e){const{idealCameraDistance:t}=this[lm].model,n=2*Math.max(t,e);this[dy].updateNearFar(0,n)}[vy](){const{theta:e,phi:t}=this[Iy],{theta:n,phi:i}=this[dy].getCameraSpherical(this[Iy]),r=this.getRootNode();if(null!=r&&r.activeElement===this){const r=(4+Math.floor((e%py+uy)/cy))%4,a=(4+Math.floor((n%py+uy)/cy))%4,o=Math.floor(t/hy),s=Math.floor(i/hy);if(a!==r||s!==o){const e=`View from stage ${Kv[s]}${Zv[a]}`;this[om].setAttribute("aria-label",e)}}}[pm](e){const t=this[dy],n=this[lm].framedFieldOfView;super[pm](e);const i=this[lm].framedFieldOfView,r=t.getFieldOfView()/n;this[Oy]=i*r,t.updateAspect(this[lm].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.jumpCameraToGoal()}[um](){super[um]();const{framedFieldOfView:e}=this[lm];this[Oy]=e,this[Ny]?this[zy]=!0:this[Ny]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}[Sy](){const e=this[om];isFinite(this[Cy])||(this[Cy]=performance.now());const t=this[tm];e.getAttribute("aria-label")!==t&&e.setAttribute("aria-label",t),this.interactionPrompt!==$v||this[Ly]||(this[Ay]=!0)}[My](){this.interactionPrompt===$v&&(this[Ay]=!1,this[fy].classList.remove("visible"),this[Ry]=1/0,this[Cy]=1/0)}[Ty]({source:e}){this[vy](),this[cm](),e===Hv&&(this[Ly]=!0,this[gy]()),this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))}[Ey](e){"pointer-change-start"===e.type?this[am].classList.add("pointer-tumbling"):this[am].classList.remove("pointer-tumbling")}}return qv([a({type:Boolean,attribute:"camera-controls"})],x.prototype,"cameraControls",void 0),qv([Ng({intrinsics:ay,observeEffects:!0,updateHandler:Uy}),a({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],x.prototype,"cameraOrbit",void 0),qv([Ng({intrinsics:ly,observeEffects:!0,updateHandler:By}),a({type:String,attribute:"camera-target",hasChanged:()=>!0})],x.prototype,"cameraTarget",void 0),qv([Ng({intrinsics:ny,observeEffects:!0,updateHandler:Fy}),a({type:String,attribute:"field-of-view",hasChanged:()=>!0})],x.prototype,"fieldOfView",void 0),qv([Ng({intrinsics:oy,updateHandler:Hy}),a({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],x.prototype,"minCameraOrbit",void 0),qv([Ng({intrinsics:sy,updateHandler:Gy}),a({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],x.prototype,"maxCameraOrbit",void 0),qv([Ng({intrinsics:iy,updateHandler:ky}),a({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],x.prototype,"minFieldOfView",void 0),qv([Ng({intrinsics:ry,updateHandler:Vy}),a({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],x.prototype,"maxFieldOfView",void 0),qv([a({type:Number,attribute:"interaction-prompt-threshold"})],x.prototype,"interactionPromptThreshold",void 0),qv([a({type:String,attribute:"interaction-prompt-style"})],x.prototype,"interactionPromptStyle",void 0),qv([a({type:String,attribute:"interaction-prompt"})],x.prototype,"interactionPrompt",void 0),qv([a({type:String,attribute:"interaction-policy"})],x.prototype,"interactionPolicy",void 0),x})((e=>{var t,n,i,r,o,s,l;class c extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.quickLookBrowsers="safari",this[t]=!1,this[n]=this.shadowRoot.querySelector(".ar-button"),this[i]=new Set,this[r]=Gm,this[o]=new Set,this[s]=e=>{e.preventDefault(),this.activateAR()},this[l]=({status:e})=>{e!==Ep&&this[dm].arRenderer.presentedScene!==this[lm]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})))}}get canActivateAR(){return this[Wm]!==Gm}async activateAR(){switch(this[Wm]){case Fm:Dm(this.iosSrc,this.arScale);break;case Hm:await this[Vm]();break;case Bm:Nm(this.src,this.alt||"",this.arScale);break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(t=jm,n=km,i=qm,r=Wm,o=Ym,s=Jm,l=Zm,Vm)](){console.log("Attempting to present in AR...");try{await this[dm].arRenderer.present(this[lm])}catch(e){console.warn("Error while trying to present to AR"),console.error(e),await this[dm].arRenderer.stopPresenting()}}connectedCallback(){super.connectedCallback(),this[dm].arRenderer.addEventListener("status",this[Zm]),this.setAttribute("ar-status",Ep)}disconnectedCallback(){super.disconnectedCallback(),this[dm].arRenderer.removeEventListener("status",this[Zm])}async update(e){if(super.update(e),e.has("quickLookBrowsers")&&(this[Ym]=zm(this.quickLookBrowsers)),e.has("ar")||e.has("arModes")||e.has("iosSrc")){if(e.has("arModes")&&(this[qm]=Um(this.arModes)),e.has("arScale")&&(this[lm].canScale="fixed"!==this.arScale),this[Wm]=Gm,this.ar){const e=[];this[qm].forEach(t=>{e.push(t)});for(const t of e){if("webxr"===t&&h&&await this[dm].arRenderer.supportsPresentation()){this[Wm]=Hm;break}if("scene-viewer"===t&&u){this[Wm]=Bm;break}if("quick-look"===t&&this.iosSrc&&this[Xm]&&d){this[Wm]=Fm;break}}}this.canActivateAR?(this[km].classList.add("enabled"),this[km].addEventListener("click",this[Jm])):(this[km].removeEventListener("click",this[Jm]),this[km].classList.remove("enabled"))}}get[Xm](){return m?this[Ym].has("chrome"):!!g&&this[Ym].has("safari")}}return Im([a({type:Boolean,attribute:"ar"})],c.prototype,"ar",void 0),Im([a({type:String,attribute:"ar-scale"})],c.prototype,"arScale",void 0),Im([a({type:String,attribute:"ar-modes"})],c.prototype,"arModes",void 0),Im([a({type:String,attribute:"ios-src"})],c.prototype,"iosSrc",void 0),Im([a({type:String,attribute:"quick-look-browsers"})],c.prototype,"quickLookBrowsers",void 0),c})((e=>{var t,n,i,r,o,s,l,c,h,u,p,d;class f extends e{constructor(...e){super(...e),this.poster=null,this.reveal=tx,this.loading=ix,this[t]=!1,this[n]=0,this[i]=null,this[r]=this.shadowRoot.querySelector(".slot.poster"),this[o]=this.shadowRoot.querySelector("#default-poster"),this[s]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .mask"),this[c]=this[hx].getAttribute("aria-label"),this[h]=()=>this[wx](),this[u]=e=>this[_x](e),this[p]=e=>this[Mx](e),this[d]=((e,t)=>{let n=null;const i=(...i)=>{null==n&&(e(...i),n=self.setTimeout(()=>n=null,t))};return i.flush=()=>{null!=n&&(self.clearTimeout(n),n=null)},i})(e=>{const t=this[sx].parentNode;requestAnimationFrame(()=>{this[lx].style.opacity=""+.2*(1-e),this[sx].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[sx]),t.appendChild(this[sx])),1===e?this[sx].classList.add("hide"):this[sx].classList.remove("hide")})},100);const a=(self.ModelViewerElement||{}).dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.3.5/";Ph.setDRACODecoderLocation(a)}static set dracoDecoderLocation(e){Ph.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return Ph.getDRACODecoderLocation()}static mapURLs(e){Mf.singleton.loader[Ah].manager.setURLModifier(e)}dismissPoster(){this[ym]()?this[dx]():(this[ux]=ax,this[im]())}connectedCallback(){super.connectedCallback(),this[cx].addEventListener("click",this[yx]),this[cx].addEventListener("keydown",this[xx]),this[fm].addEventListener("progress",this[bx]),ox.registerInstance(this)}disconnectedCallback(){super.disconnectedCallback(),this[cx].removeEventListener("click",this[yx]),this[cx].removeEventListener("keydown",this[xx]),this[fm].removeEventListener("progress",this[bx]),ox.unregisterInstance(this)}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[hx].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[hx].setAttribute("aria-label",`${this[tm]}. ${this[vx]}`),(e.has("reveal")||e.has("loaded"))&&(this[ym]()||this[im]())}[(t=fx,n=gx,i=ux,r=cx,o=hx,s=sx,l=lx,c=vx,h=yx,u=xx,p=bx,d=mx,wx)](){this.reveal!==nx&&this.dismissPoster()}[_x](e){if(this.reveal!==nx)switch(e.keyCode){case 32:case 13:this.dismissPoster()}}[Mx](e){const t=e.detail.totalProgress;this[gx]=Math.max(t,this[gx]),1===t&&(this[mx].flush(),!this[ym]()||null==this[ux]&&this.reveal!==tx||this[dx]()),this[mx](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t}}))}[vm](){return!!this.src&&(null!=this[ux]||this.loading===rx||this.reveal===tx&&this[$f])}[ym](){const{src:e}=this;return!!e&&super[ym]()&&1===this[gx]}[px](){const e=this[cx],t=this[hx],n=parseFloat(self.getComputedStyle(e).opacity);t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden"),e.classList.add("show"),n<1&&e.addEventListener("transitionend",()=>{const e=this.modelIsVisible;this[fx]=!1,this[em](e)},{once:!0})}[dx](){this[ux]=null;const e=this[cx],t=this[hx];e.classList.contains("show")&&(e.classList.remove("show"),e.addEventListener("transitionend",()=>{const e=this.modelIsVisible;requestAnimationFrame(()=>{this[fx]=!0,this[em](e);const n=this.getRootNode();n&&n.activeElement===this&&this[om].focus(),t.setAttribute("aria-hidden","true"),t.tabIndex=-1})},{once:!0}))}[gm](){return super[gm]()&&this[fx]}async[im](){this[gx]=0,this[px](),await super[im]()}}return ex([a({type:String})],f.prototype,"poster",void 0),ex([a({type:String})],f.prototype,"reveal",void 0),ex([a({type:String})],f.prototype,"loading",void 0),f})((e=>{var t;class n extends e{constructor(){super(...arguments),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0}get availableAnimations(){return this.loaded?this[lm].model.animationNames:[]}get paused(){return this[Mm]}get currentTime(){return this[lm].model.animationTime}set currentTime(e){this[lm].model.animationTime=e,this[dm].threeRenderer.shadowMap.needsUpdate=!0,this[cm]()}pause(){this[Mm]||(this[Mm]=!0,this[dm].threeRenderer.shadowMap.autoUpdate=!1,this.dispatchEvent(new CustomEvent("pause")))}play(){this[Mm]&&this.availableAnimations.length>0&&(this[Mm]=!1,this[dm].threeRenderer.shadowMap.autoUpdate=!0,this[lm].model.hasActiveAnimation||this[_m](),this.dispatchEvent(new CustomEvent("play")))}[(t=Mm,um)](){this[Mm]=!0,this.autoplay&&(this[_m](),this.play())}[hm](e,t){if(super[hm](e,t),this[Mm]||!this.modelIsVisible)return;const{model:n}=this[lm];n.updateAnimation(t/1e3),this[cm]()}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[_m]()}async[im](){return this[lm].model.stopAnimation(),super[im]()}[_m](){const{model:e}=this[lm];e.playAnimation(this.animationName,this.animationCrossfadeDuration/1e3),this[Mm]&&(e.updateAnimation(0),this[cm]())}}return wm([a({type:Boolean})],n.prototype,"autoplay",void 0),wm([a({type:String,attribute:"animation-name"})],n.prototype,"animationName",void 0),wm([a({type:Number,attribute:"animation-crossfade-duration"})],n.prototype,"animationCrossfadeDuration",void 0),n})((e=>{var t;const n=Symbol("endPolyfillCoordination");return t=n,class extends e{constructor(){super(...arguments),this[t]=null}connectedCallback(){super.connectedCallback&&super.connectedCallback(),null==this[n]&&(this[n]=(e=>{if(null==e.shadowRoot||e.hasAttribute("data-js-focus-visible"))return()=>{};if(!self.applyFocusVisiblePolyfill){const t=()=>{self.applyFocusVisiblePolyfill(e.shadowRoot)};return self.addEventListener("focus-visible-polyfill-ready",t,{once:!0}),()=>{self.removeEventListener("focus-visible-polyfill-ready",t)}}return self.applyFocusVisiblePolyfill(e.shadowRoot),()=>{}})(this))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),null!=this[n]&&(this[n](),this[n]=null)}}})(bm)))))))));customElements.define("model-viewer",dO);export{dO as ModelViewerElement};
|
|
//# sourceMappingURL=model-viewer.min.js.map
|