Team:Estonia TUIT/modelviewerjs

function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _get(e,t,n){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=_superPropBase(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf(e)););return e}function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?t[Symbol.hasInstance](e):e instanceof t}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}function asyncGeneratorStep(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){asyncGeneratorStep(a,r,i,o,s,"next",e)}function s(e){asyncGeneratorStep(a,r,i,o,s,"throw",e)}o(void 0)})}}function _classCallCheck(e,t){if(!_instanceof(e,t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _wrapNativeSuper(e){var t="function"==typeof Map?new Map:void 0;return(_wrapNativeSuper=function(e){if(null===e||!_isNativeFunction(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return _construct(e,arguments,_getPrototypeOf(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(n,e)})(e)}function isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function _construct(e,t,n){return(_construct=isNativeReflectConstruct()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&_setPrototypeOf(i,n.prototype),i}).apply(null,arguments)}function _isNativeFunction(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e){"use strict";function t(e,t,n,i){var a=t&&t.prototype instanceof r?t:r,o=Object.create(a.prototype),s=new p(i||[]);return o._invoke=c(e,n,s),o}function n(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function r(){}function i(){}function a(){}function o(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function s(e){function t(r,i,a,o){var s=n(e[r],e,i);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"==typeof l&&v.call(l,"__await")?Promise.resolve(l.__await).then(function(e){t("next",e,a,o)},function(e){t("throw",e,a,o)}):Promise.resolve(l).then(function(e){c.value=e,a(c)},o)}o(s.arg)}var r;this._invoke=function(e,n){function i(){return new Promise(function(r,i){t(e,n,r,i)})}return r=r?r.then(i,i):i()}}function c(e,t,r){var i="suspendedStart";return function(a,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===a)throw o;return{value:void 0,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var c=l(s,r);if(c){if(c===M)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===i)throw i="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i="executing";var u=n(e,t,r);if("normal"===u.type){if(i=r.done?"completed":"suspendedYield",u.arg===M)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(i="completed",r.method="throw",r.arg=u.arg)}}}function l(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,l(e,t),"throw"===t.method))return M;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return M}var i=n(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,M;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,M):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,M)}function u(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function h(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function p(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(u,this),this.reset(!0)}function d(e){if(e){var t=e[y];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(v.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:f}}function f(){return{value:void 0,done:!0}}var m=Object.prototype,v=m.hasOwnProperty,g="function"==typeof Symbol?Symbol:{},y=g.iterator||"@@iterator",x=g.asyncIterator||"@@asyncIterator",b=g.toStringTag||"@@toStringTag",w="object"==typeof module,_=e.regeneratorRuntime;if(_)w&&(module.exports=_);else{(_=e.regeneratorRuntime=w?module.exports:{}).wrap=t;var M={},S={};S[y]=function(){return this};var T=Object.getPrototypeOf,E=T&&T(T(d([])));E&&E!==m&&v.call(E,y)&&(S=E);var A=a.prototype=r.prototype=Object.create(S);i.prototype=A.constructor=a,a.constructor=i,a[b]=i.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===i||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,!(b in e)&&(e[b]="GeneratorFunction")),e.prototype=Object.create(A),e},_.awrap=function(e){return{__await:e}},o(s.prototype),s.prototype[x]=function(){return this},_.AsyncIterator=s,_.async=function(e,n,r,i){var a=new s(t(e,n,r,i));return _.isGeneratorFunction(n)?a:a.next().then(function(e){return e.done?e.value:a.next()})},o(A),A[b]="Generator",A[y]=function(){return this},A.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,p.prototype={constructor:p,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(h),!e)for(var t in this)"t"===t.charAt(0)&&v.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){function t(t,r){return a.type="throw",a.arg=e,n.next=t,r&&(n.method="next",n.arg=void 0),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;0<=r;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var o=v.call(i,"catchLoc"),s=v.call(i,"finallyLoc");if(o&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var n,r=this.tryEntries.length-1;0<=r;--r)if((n=this.tryEntries[r]).tryLoc<=this.prev&&v.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,M):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),M},finish:function(e){for(var t,n=this.tryEntries.length-1;0<=n;--n)if((t=this.tryEntries[n]).finallyLoc===e)return this.complete(t.completion,t.afterLoc),h(t),M},catch:function(e){for(var t,n=this.tryEntries.length-1;0<=n;--n)if((t=this.tryEntries[n]).tryLoc===e){var r=t.completion;if("throw"===r.type){var i=r.arg;h(t)}return i}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),M}}}}(function(){return this}()||Function("return this")()),function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";void 0!==window.customElements&&window.customElements.polyfillWrapFlushCallback,"Template:Lit-".concat(String(Math.random()).slice(2),"");try{var e={get capture(){return!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(ph){}(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.0.0"),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."),window.JSCompiler_renameProperty=function(e,t){return e};var t={toAttribute:function(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute:function(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}},n=function(e,t){return t!==e&&(t==t||e==e)},r={attribute:!0,type:String,converter:t,reflect:!1,hasChanged:n},i=Promise.resolve(!0),a=function(e){function a(){var e;return _classCallCheck(this,a),(e=_possibleConstructorReturn(this,_getPrototypeOf(a).call(this)))._updateState=0,e._instanceProperties=void 0,e._updatePromise=i,e._hasConnectedResolver=void 0,e._changedProperties=new Map,e._reflectingProperties=void 0,e.initialize(),e}return _inherits(a,_wrapNativeSuper(HTMLElement)),_createClass(a,[{key:"initialize",value:function(){this._saveInstanceProperties()}},{key:"_saveInstanceProperties",value:function(){var e=this;this.constructor._classProperties.forEach(function(t,n){if(e.hasOwnProperty(n)){var r=e[n];delete e[n],e._instanceProperties||(e._instanceProperties=new Map),e._instanceProperties.set(n,r)}})}},{key:"_applyInstanceProperties",value:function(){var e=this;this._instanceProperties.forEach(function(t,n){return e[n]=t}),this._instanceProperties=void 0}},{key:"connectedCallback",value:function(){this._updateState=32|this._updateState,this._hasConnectedResolver?(this._hasConnectedResolver(),this._hasConnectedResolver=void 0):this.requestUpdate()}},{key:"disconnectedCallback",value:function(){}},{key:"attributeChangedCallback",value:function(e,t,n){t!==n&&this._attributeToProperty(e,n)}},{key:"_propertyToAttribute",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r,i=this.constructor,a=i._attributeNameForProperty(e,n);if(void 0!==a){var o=i._propertyValueToAttribute(t,n);if(void 0===o)return;this._updateState=8|this._updateState,null==o?this.removeAttribute(a):this.setAttribute(a,o),this._updateState=-9&this._updateState}}},{key:"_attributeToProperty",value:function(e,t){if(!(8&this._updateState)){var n=this.constructor,i=n._attributeToPropertyMap.get(e);if(void 0!==i){var a=n._classProperties.get(i)||r;this._updateState=16|this._updateState,this[i]=n._propertyValueFromAttribute(t,a),this._updateState=-17&this._updateState}}}},{key:"requestUpdate",value:function(e,t){var n=!0;if(void 0!==e&&!this._changedProperties.has(e)){var i=this.constructor,a=i._classProperties.get(e)||r;i._valueHasChanged(this[e],t,a.hasChanged)?(this._changedProperties.set(e,t),!0!==a.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,a))):n=!1}return!this._hasRequestedUpdate&&n&&this._enqueueUpdate(),this.updateComplete}},{key:"_enqueueUpdate",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r,i=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this._updateState=4|this._updateState,n=this._updatePromise,this._updatePromise=new Promise(function(e){return t=e}),e.next=5,n;case 5:if(this._hasConnected){e.next=8;break}return e.next=8,new Promise(function(e){return i._hasConnectedResolver=e});case 8:if(null==(r=this.performUpdate())||"function"!=typeof r.then){e.next=12;break}return e.next=12,r;case 12:t(!this._hasRequestedUpdate);case 13:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"performUpdate",value:function(){if(this._instanceProperties&&this._applyInstanceProperties(),this.shouldUpdate(this._changedProperties)){var e=this._changedProperties;this.update(e),this._markUpdated(),1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(e)),this.updated(e)}else this._markUpdated()}},{key:"_markUpdated",value:function(){this._changedProperties=new Map,this._updateState=-5&this._updateState}},{key:"shouldUpdate",value:function(e){return!0}},{key:"update",value:function(e){var t=this;void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(function(e,n){return t._propertyToAttribute(n,t[n],e)}),this._reflectingProperties=void 0)}},{key:"updated",value:function(e){}},{key:"firstUpdated",value:function(e){}},{key:"_hasConnected",get:function(){return 32&this._updateState}},{key:"_hasRequestedUpdate",get:function(){return 4&this._updateState}},{key:"hasUpdated",get:function(){return 1&this._updateState}},{key:"updateComplete",get:function(){return this._updatePromise}}],[{key:"_ensureClassProperties",value:function(){var e=this;if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;var t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach(function(t,n){return e._classProperties.set(n,t)})}}},{key:"createProperty",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;if(this._ensureClassProperties(),this._classProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){var n="symbol"===_typeof(e)?Symbol():"__".concat(e);Object.defineProperty(this.prototype,e,{get:function(){return this[n]},set:function(t){var r=this[e];this[n]=t,this.requestUpdate(e,r)},configurable:!0,enumerable:!0})}}},{key:"finalize",value:function(){if(!this.hasOwnProperty(JSCompiler_renameProperty("finalized",this))||!this.finalized){var e=Object.getPrototypeOf(this);if("function"==typeof e.finalize&&e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){var t=this.properties,n=[].concat(_toConsumableArray(Object.getOwnPropertyNames(t)),_toConsumableArray("function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[])),r=!0,i=!1,a=void 0;try{for(var o,s=n[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value;this.createProperty(c,t[c])}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}}}}},{key:"_attributeNameForProperty",value:function(e,t){var n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}},{key:"_valueHasChanged",value:function(e,t){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:n)(e,t)}},{key:"_propertyValueFromAttribute",value:function(e,n){var r=n.type,i=n.converter||t,a="function"==typeof i?i:i.fromAttribute;return a?a(e,r):e}},{key:"_propertyValueToAttribute",value:function(e,n){if(void 0!==n.reflect){var r=n.type,i=n.converter;return(i&&i.toAttribute||t.toAttribute)(e,r)}}},{key:"observedAttributes",get:function(){var e=this;this.finalize();var t=[];return this._classProperties.forEach(function(n,r){var i=e._attributeNameForProperty(r,n);void 0!==i&&(e._attributeToPropertyMap.set(i,r),t.push(i))}),t}}]),a}();a.finalized=!0;var o=function(e,t){return"method"!==t.kind||!t.descriptor||"value"in t.descriptor?{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer:function(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher:function(n){n.createProperty(t.key,e)}}:Object.assign({},t,{finisher:function(n){n.createProperty(t.key,e)}})},s=function(e,t,n){t.constructor.createProperty(n,e)};function c(e){return function(t,n){return void 0!==n?s(e,t,n):o(e,t)}}"adoptedStyleSheets"in Document.prototype&&CSSStyleSheet.prototype;(window.litElementVersions||(window.litElementVersions=[])).push("2.0.1");var l,u,h,p=null!=navigator.xr&&null!=self.XRSession&&null!=self.XRDevice&&null!=self.XRDevice.prototype.supportsSession,d=p&&self.XRSession.prototype.requestHitTest,f=null!=document.documentElement&&null!=document.documentElement.requestFullscreen,m=null!=self.ResizeObserver,v=null!=self.IntersectionObserver,g=d&&f,y=(l=navigator.userAgent||navigator.vendor||self.opera,u=!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(l)||/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(l.substr(0,4)))&&(u=!0),/android/i.test(navigator.userAgent)),x=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream,b=(h=document.createElement("a"),Boolean(h.relList&&h.relList.supports&&h.relList.supports("ar"))),w=document.createElement("template");w.innerHTML='\n <style>\n  :host {\n display: block;\n position: relative;\n contain: strict;\n width: 300px;\n height: 150px;\n }\n\n .container {\n position: relative;\n }\n\n canvas {\n width: 100%;\n height: 100%;\n display: none;\n }\n\n canvas.show {\n display: block;\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 .slot.poster {\n opacity: 0;\n transition: opacity 0.3s 0.3s;\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 position: absolute;\n background-size: cover;\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: 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.controls-prompt {\n 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 opacity: 0;\n transform-origin: center center;\n transform: scale(0.9);\n transition: transform 0.3s, opacity 0.3s;\n }\n\n .slot.controls-prompt > * {\n pointer-events: none;\n }\n\n .slot.controls-prompt svg {\n transform: scale(0.5);\n }\n\n .slot.controls-prompt.visible {\n opacity: 1;\n transform: scale(1);\n }\n\n .slot.ar-button {\n -moz-user-select: none;\n -webkit-tap-highlight-color: transparent;\n user-select: none;\n }\n\n .slot.ar-button:not(.enabled),\n .fullscreen .slot.ar-button {\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 }\n\n  :not(.fullscreen) .slot.exit-fullscreen-button {\n display: none;\n }\n\n #default-exit-fullscreen-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-fullscreen-button > svg {\n fill: #fff;\n }\n </style>\n
\n <canvas tabindex="1"\n aria-label="A depiction of a 3D model"\n aria-live="polite">\n </canvas>\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
\n <slot name="poster">\n
\n </slot>\n
\n\n
\n <slot name="progress-bar">\n
\n
\n
\n
\n </slot>\n
\n\n
\n <slot name="ar-button">\n <a id="default-ar-button" class="fab" href="#"\n tabindex="2"\n aria-label="View this 3D model up close">\n '.concat('\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
\n\n
\n <slot name="exit-fullscreen-button">\n <a id="default-exit-fullscreen-button"\n tabindex="3"\n aria-label="Exit fullscreen"\n aria-hidden="true">\n ').concat('\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
\n\n
\n <slot name="controls-prompt" aria-hidden="true">\n ').concat('\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="250px" height="200px" viewBox="0 0 250 200" fill="transparent" focusable="false" aria-hidden="true">\n \x3c!-- Rotation arc --\x3e\n <path id="orbit"\n d="M50,75 C55,50 195,50 200,75 C195,100 55,100 50,75"\n stroke-linecap="round"\n stroke-dasharray="180 180"\n stroke-dashoffset="-40"\n stroke="#a1a1a1"\n stroke-width="7"\n fill="transparent">\n <animate attributeName="stroke-dashoffset"\n dur="1.75s"\n calcMode="linear"\n values="-40;-40.56;-42.08;-44.32;-47.04;-50;-52.96;-55.68;-57.92;-59.44;-60;-59.44;-57.92;-55.68;-52.96;-50;-47.04;-44.32;-42.08;-40.56;-40"\n keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"\n repeatCount="indefinite" />\n </path>\n\n <path d="M50,75 C55,50 195,50 200,75 C195,100 55,100 50,75"\n opacity="1"\n stroke-linecap="round"\n stroke-dasharray="140 220"\n stroke-dashoffset="-225"\n stroke="white"\n stroke-width="7"\n fill="transparent">\n <animate attributeName="stroke-dashoffset"\n dur="1.75s"\n calcMode="linear"\n values="-225;-225.56;-227.07999999999998;-229.32;-232.04;-235;-237.96;-240.68;-242.92;-244.44;-245;-244.44;-242.92;-240.68;-237.96;-235;-232.04;-229.32;-227.07999999999998;-225.56;-225"\n keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"\n repeatCount="indefinite" />\n </path>\n\n \x3c!-- Hand Icon --\x3e\n <defs>\n <path id="a" d="M0 0h24v24H0V0z"/>\n </defs>\n <clipPath id="b">\n <use xlink:href="#a" overflow="visible"/>\n </clipPath>\n\n <g transform="translate(100, 70) scale(3.5)">\n <g transform="translate(0, 0)">\n <animateTransform\n attributeName="transform"\n type="translate"\n repeatCount="indefinite"\n keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"\n values="0,0;-0.16800000000000015,0;-0.6239999999999988,0;-1.2960000000000003,0;-2.111999999999999,0;-3,0;-3.8879999999999995,0;-4.704,0;-5.3759999999999994,0;-5.832,0;-6,0;-5.832,0;-5.3759999999999994,0;-4.704,0;-3.8879999999999995,0;-3,0;-2.111999999999999,0;-1.2960000000000003,0;-0.6239999999999988,0;-0.16800000000000015,0;0,0"\n dur="1.75s" />\n <path clip-path="url(#b)"\n fill="white"\n d="M9 11.24V7.5C9 6.12 10.12 5 11.5 5S14 6.12 14 7.5v3.74c1.21-.81 2-2.18 2-3.74C16 5.01 13.99 3 11.5 3S7 5.01 7 7.5c0 1.56.79 2.93 2 3.74zm9.84 4.63l-4.54-2.26c-.17-.07-.35-.11-.54-.11H13v-6c0-.83-.67-1.5-1.5-1.5S10 6.67 10 7.5v10.74l-3.43-.72c-.08-.01-.15-.03-.24-.03-.31 0-.59.13-.79.33l-.79.8 4.94 4.94c.27.27.65.44 1.06.44h6.79c.75 0 1.33-.55 1.44-1.28l.75-5.27c.01-.07.02-.14.02-.2 0-.62-.38-1.16-.91-1.38z"/>\n </g>\n </g>\n\n <path id="orbit-hidden"\n d="M-30,15 C-35,-10 115,-10 120,15 C115,40 -35,40 -30,15"\n stroke-width="0"\n fill="transparent"></path>\n \n \x3c!-- Arrow --\x3e\n <g transform="translate(80, 60)">\n <polyline id="Path-3" stroke="#a1a1a1" stroke-width="7" stroke-linecap="round" stroke-linejoin="round" transform="translate(-33.952293, -4) rotate(-39.000000)" points="35.5366949 39.6822958 26.6550872 26.0761929 41.2494988 29.5432078">\n <animateMotion\n calcMode="linear"\n keyPoints="0.095;0.09668;0.10124;0.10796;0.11612;0.125;0.13388;0.14204;0.14876;0.15332;0.155;0.15332;0.14876;0.14204;0.13388;0.125;0.11612;0.10796;0.10124;0.09668;0.095"\n keyTimes="0;0.05;0.1;0.15;0.2;0.25;0.3;0.35;0.4;0.45;0.5;0.55;0.6;0.65;0.7;0.75;0.8;0.85;0.9;0.95;1"\n dur="1.75s"\n repeatCount="indefinite">\n <mpath xlink:href="#orbit-hidden"/>\n </animateMotion>\n </polyline>\n </g>\n</svg>','\n </slot>\n
\n\n
\n <slot></slot>\n
\n
');function _(){}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");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r)for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}),Object.assign(_.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 r=n.indexOf(t);-1!==r&&n.splice(r,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),r=0,i=n.length;r<i;r++)n[r].call(this,e)}}}});var M,S,T,E,A,L,P,R,C,O,I,k,D="101",N=0,z=1,U=2,B=1,F=2,G=0,H=1,j=2,V=0,W=1,q=2,X=0,Y=1,J=2,Z=3,K=4,Q=5,$=100,ee=101,te=102,ne=103,re=104,ie=200,ae=201,oe=202,se=203,ce=204,le=205,ue=206,he=207,pe=208,de=209,fe=210,me=0,ve=1,ge=2,ye=3,xe=4,be=5,we=6,_e=7,Me=0,Se=1,Te=2,Ee=0,Ae=1,Le=2,Pe=3,Re=4,Ce=5,Oe=301,Ie=302,ke=303,De=304,Ne=305,ze=306,Ue=307,Be=1e3,Fe=1001,Ge=1002,He=1003,je=1004,Ve=1005,We=1006,qe=1007,Xe=1008,Ye=1009,Je=1010,Ze=1011,Ke=1012,Qe=1013,$e=1014,et=1015,tt=1016,nt=1017,rt=1018,it=1019,at=1020,ot=1021,st=1022,ct=1023,lt=1024,ut=1025,ht=ct,pt=1026,dt=1027,ft=1028,mt=33776,vt=33777,gt=33778,yt=33779,xt=35840,bt=35841,wt=35842,_t=35843,Mt=36196,St=37808,Tt=37809,Et=37810,At=37811,Lt=37812,Pt=37813,Rt=37814,Ct=37815,Ot=37816,It=37817,kt=37818,Dt=37819,Nt=37820,zt=37821,Ut=2201,Bt=2400,Ft=0,Gt=1,Ht=2,jt=3e3,Vt=3001,Wt=3007,qt=3002,Xt=3004,Yt=3005,Jt=3006,Zt=3200,Kt=3201,Qt=0,$t=1,en={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var e=[],t=0;t<256;t++)e[t]=(t<16?"0":"")+t.toString(16);return function(){var t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&n]+e[n>>8&255]+"-"+e[n>>16&15|64]+e[n>>24&255]+"-"+e[63&r|128]+e[r>>8&255]+"-"+e[r>>16&255]+e[r>>24&255]+e[255&i]+e[i>>8&255]+e[i>>16&255]+e[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,r,i){return r+(e-t)*(i-r)/(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*en.DEG2RAD},radToDeg:function(e){return e*en.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))}};function tn(e,t){this.x=e||0,this.y=t||0}function nn(){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.")}function rn(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==r?r:1}function an(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}function on(){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(tn.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(tn.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,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[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:(M=new tn,S=new tn,function(e,t){return M.set(e,e),S.set(t,t),this.clamp(M,S)}),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(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},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.subVectors(t,e).multiplyScalar(n).add(e)},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),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}}),Object.assign(nn.prototype,{isMatrix4:!0,set:function(e,t,n,r,i,a,o,s,c,l,u,h,p,d,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=r,v[1]=i,v[5]=a,v[9]=o,v[13]=s,v[2]=c,v[6]=l,v[10]=u,v[14]=h,v[3]=p,v[7]=d,v[11]=f,v[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 nn).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:(O=new an,function(e){var t=this.elements,n=e.elements,r=1/O.setFromMatrixColumn(e,0).length(),i=1/O.setFromMatrixColumn(e,1).length(),a=1/O.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,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,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if("XYZ"===e.order){var h=a*l,p=a*u,d=o*l,f=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=p+d*c,t[5]=h-f*c,t[9]=-o*s,t[2]=f-h*c,t[6]=d+p*c,t[10]=a*s}else if("YXZ"===e.order){var m=s*l,v=s*u,g=c*l,y=c*u;t[0]=m+y*o,t[4]=g*o-v,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=v*o-g,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*l,v=s*u,g=c*l,y=c*u;t[0]=m-y*o,t[4]=-a*u,t[8]=g+v*o,t[1]=v+g*o,t[5]=a*l,t[9]=y-m*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){h=a*l,p=a*u,d=o*l,f=o*u;t[0]=s*l,t[4]=d*c-p,t[8]=h*c+f,t[1]=s*u,t[5]=f*c+h,t[9]=p*c-d,t[2]=-c,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,b=a*c,w=o*s,_=o*c;t[0]=s*l,t[4]=_-x*u,t[8]=w*u+b,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=b*u+w,t[10]=x-_*u}else if("XZY"===e.order){x=a*s,b=a*c,w=o*s,_=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=x*u+_,t[5]=a*l,t[9]=b*u-w,t[2]=w*u-b,t[6]=o*l,t[10]=_*u+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:(R=new an(0,0,0),C=new an(1,1,1),function(e){return this.compose(R,e,C)}),lookAt:(A=new an,L=new an,P=new an,function(e,t,n){var r=this.elements;return P.subVectors(e,t),0===P.lengthSq()&&(P.z=1),P.normalize(),A.crossVectors(n,P),0===A.lengthSq()&&(1===Math.abs(n.z)?P.x+=1e-4:P.z+=1e-4,P.normalize(),A.crossVectors(n,P)),A.normalize(),L.crossVectors(P,A),r[0]=A.x,r[4]=L.x,r[8]=P.x,r[1]=A.y,r[5]=L.y,r[9]=P.y,r[2]=A.z,r[6]=L.z,r[10]=P.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,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],h=n[9],p=n[13],d=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],b=n[15],w=r[0],_=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],P=r[2],R=r[6],C=r[10],O=r[14],I=r[3],k=r[7],D=r[11],N=r[15];return i[0]=a*w+o*T+s*P+c*I,i[4]=a*_+o*E+s*R+c*k,i[8]=a*M+o*A+s*C+c*D,i[12]=a*S+o*L+s*O+c*N,i[1]=l*w+u*T+h*P+p*I,i[5]=l*_+u*E+h*R+p*k,i[9]=l*M+u*A+h*C+p*D,i[13]=l*S+u*L+h*O+p*N,i[2]=d*w+f*T+m*P+v*I,i[6]=d*_+f*E+m*R+v*k,i[10]=d*M+f*A+m*C+v*D,i[14]=d*S+f*L+m*O+v*N,i[3]=g*w+y*T+x*P+b*I,i[7]=g*_+y*E+x*R+b*k,i[11]=g*M+y*A+x*C+b*D,i[15]=g*S+y*L+x*O+b*N,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},applyToBufferAttribute:function(){var e=new an;return function(t){for(var n=0,r=t.count;n<r;n++)e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.applyMatrix4(this),t.setXYZ(n,e.x,e.y,e.z);return t}}(),determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],h=e[10],p=e[14];return e[3]*(+i*s*u-r*c*u-i*o*h+n*c*h+r*o*p-n*s*p)+e[7]*(+t*s*p-t*c*h+i*a*h-r*a*p+r*c*l-i*s*l)+e[11]*(+t*c*u-t*o*p-i*a*u+n*a*p+i*o*l-n*c*l)+e[15]*(-r*o*l-t*s*u+t*o*h+r*a*u-n*a*h+n*s*l)},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){var t=this.elements;return t[12]=e.x,t[13]=e.y,t[14]=e.z,this},getInverse:function(e,t){var n=this.elements,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],h=r[7],p=r[8],d=r[9],f=r[10],m=r[11],v=r[12],g=r[13],y=r[14],x=r[15],b=d*y*h-g*f*h+g*u*m-l*y*m-d*u*x+l*f*x,w=v*f*h-p*y*h-v*u*m+c*y*m+p*u*x-c*f*x,_=p*g*h-v*d*h+v*l*m-c*g*m-p*l*x+c*d*x,M=v*d*u-p*g*u-v*l*f+c*g*f+p*l*y-c*d*y,S=i*b+a*w+o*_+s*M;if(0===S){var T="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(T);return console.warn(T),this.identity()}var E=1/S;return n[0]=b*E,n[1]=(g*f*s-d*y*s-g*o*m+a*y*m+d*o*x-a*f*x)*E,n[2]=(l*y*s-g*u*s+g*o*h-a*y*h-l*o*x+a*u*x)*E,n[3]=(d*u*s-l*f*s-d*o*h+a*f*h+l*o*m-a*u*m)*E,n[4]=w*E,n[5]=(p*y*s-v*f*s+v*o*m-i*y*m-p*o*x+i*f*x)*E,n[6]=(v*u*s-c*y*s-v*o*h+i*y*h+c*o*x-i*u*x)*E,n[7]=(c*f*s-p*u*s+p*o*h-i*f*h-c*o*m+i*u*m)*E,n[8]=_*E,n[9]=(v*d*s-p*g*s-v*a*m+i*g*m+p*a*x-i*d*x)*E,n[10]=(c*g*s-v*l*s+v*a*h-i*g*h-c*a*x+i*l*x)*E,n[11]=(p*l*s-c*d*s-p*a*h+i*d*h+c*a*m-i*l*m)*E,n[12]=M*E,n[13]=(p*g*o-v*d*o+v*a*f-i*g*f-p*a*y+i*d*y)*E,n[14]=(v*l*o-c*g*o-v*a*u+i*g*u+c*a*y-i*l*y)*E,n[15]=(c*d*o-p*l*o+p*a*u-i*d*u-c*a*f+i*l*f)*E,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,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],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},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),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*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 r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,h=i*c,p=i*l,d=i*u,f=a*l,m=a*u,v=o*u,g=s*c,y=s*l,x=s*u,b=n.x,w=n.y,_=n.z;return r[0]=(1-(f+v))*b,r[1]=(p+x)*b,r[2]=(d-y)*b,r[3]=0,r[4]=(p-x)*w,r[5]=(1-(h+v))*w,r[6]=(m+g)*w,r[7]=0,r[8]=(d+y)*_,r[9]=(m-g)*_,r[10]=(1-(h+f))*_,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:(T=new an,E=new nn,function(e,t,n){var r=this.elements,i=T.set(r[0],r[1],r[2]).length(),a=T.set(r[4],r[5],r[6]).length(),o=T.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],E.copy(this);var s=1/i,c=1/a,l=1/o;return E.elements[0]*=s,E.elements[1]*=s,E.elements[2]*=s,E.elements[4]*=c,E.elements[5]*=c,E.elements[6]*=c,E.elements[8]*=l,E.elements[9]*=l,E.elements[10]*=l,t.setFromRotationMatrix(E),n.x=i,n.y=a,n.z=o,this}),makePerspective:function(e,t,n,r,i,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*i/(t-e),c=2*i/(n-r),l=(t+e)/(t-e),u=(n+r)/(n-r),h=-(a+i)/(a-i),p=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),c=1/(n-r),l=1/(a-i),u=(t+e)*s,h=(n+r)*c,p=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*l,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,r=0;r<16;r++)if(t[r]!==n[r])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}}),Object.assign(rn,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,a,o){var s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],h=i[a+0],p=i[a+1],d=i[a+2],f=i[a+3];if(u!==f||s!==h||c!==p||l!==d){var m=1-o,v=s*h+c*p+l*d+u*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var w=o*g;if(s=s*m+h*w,c=c*m+p*w,l=l*m+d*w,u=u*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=_,c*=_,l*=_,u*=_}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}}),Object.defineProperties(rn.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(rn.prototype,{isQuaternion:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,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,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),h=s(n/2),p=s(r/2),d=s(i/2);return"XYZ"===a?(this._x=h*l*u+c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u-h*p*d):"YXZ"===a?(this._x=h*l*u+c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u+h*p*d):"ZXY"===a?(this._x=h*l*u-c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u-h*p*d):"ZYX"===a?(this._x=h*l*u-c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u+h*p*d):"YZX"===a?(this._x=h*l*u+c*p*d,this._y=c*p*u+h*l*d,this._z=c*l*d-h*p*u,this._w=c*l*u-h*p*d):"XZY"===a&&(this._x=h*l*u-c*p*d,this._y=c*p*u-h*l*d,this._z=c*l*d+h*p*u,this._w=c*l*u+h*p*d),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,r=n[0],i=n[4],a=n[8],o=n[1],s=n[5],c=n[9],l=n[2],u=n[6],h=n[10],p=r+s+h;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(u-c)*t,this._y=(a-l)*t,this._z=(o-i)*t):r>s&&r>h?(t=2*Math.sqrt(1+r-s-h),this._w=(u-c)/t,this._x=.25*t,this._y=(i+o)/t,this._z=(a+l)/t):s>h?(t=2*Math.sqrt(1+s-r-h),this._w=(a-l)/t,this._x=(i+o)/t,this._y=.25*t,this._z=(c+u)/t):(t=2*Math.sqrt(1+h-r-s),this._w=(o-i)/t,this._x=(a+l)/t,this._y=(c+u)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t=new an;return function(n,r){return void 0===t&&(t=new an),(e=n.dot(r)+1)<1e-6?(e=0,Math.abs(n.x)>Math.abs(n.z)?t.set(-n.y,n.x,0):t.set(0,-n.z,n.y)):t.crossVectors(n,r),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),angleTo:function(e){return 2*Math.acos(Math.abs(en.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var r=Math.min(1,t/n);return this.slerp(e,r),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,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*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=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*n+t*this._x,this._y=c*r+t*this._y,this._z=c*i+t*this._z,this.normalize()}var l=Math.sqrt(s),u=Math.atan2(l,o),h=Math.sin((1-t)*u)/l,p=Math.sin(t*u)/l;return this._w=a*h+this._w*p,this._x=n*h+this._x*p,this._y=r*h+this._y*p,this._z=i*h+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},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(an.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:(I=new rn,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(){var e=new rn;return function(t,n){return this.applyQuaternion(e.setFromAxisAngle(t,n))}}(),applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*n,l=s*n+o*t-i*r,u=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=c*s+h*-i+l*-o-u*-a,this.y=l*s+h*-a+u*-i-c*-o,this.z=u*s+h*-o+c*-a-l*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(){var e=new nn;return function(t){return this.applyMatrix4(e.getInverse(t.projectionMatrix)).applyMatrix4(t.matrixWorld)}}(),transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,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(){var e=new an,t=new an;return function(n,r){return e.set(n,n,n),t.set(r,r,r),this.clamp(e,t)}}(),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.subVectors(t,e).multiplyScalar(n).add(e)},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,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e=new an;return function(t){return e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e=new an;return function(t){return this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(en.clamp(t,-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,r=this.z-e.z;return t*t+n*n+r*r},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 r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*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(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*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}}),Object.assign(on.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,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},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},applyToBufferAttribute:function(){var e=new an;return function(t){for(var n=0,r=t.count;n<r;n++)e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.applyMatrix3(this),t.setXYZ(n,e.x,e.y,e.z);return t}}(),multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],h=n[2],p=n[5],d=n[8],f=r[0],m=r[3],v=r[6],g=r[1],y=r[4],x=r[7],b=r[2],w=r[5],_=r[8];return i[0]=a*f+o*g+s*b,i[3]=a*m+o*y+s*w,i[6]=a*v+o*x+s*_,i[1]=c*f+l*g+u*b,i[4]=c*m+l*y+u*w,i[7]=c*v+l*x+u*_,i[2]=h*f+p*g+d*b,i[5]=h*m+p*y+d*w,i[8]=h*v+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],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s},getInverse:function(e,t){e&&e.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var n=e.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7],p=n[8],d=p*c-l*h,f=l*u-p*s,m=h*s-c*u,v=i*d+a*f+o*m;if(0===v){var g="THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";if(!0===t)throw new Error(g);return console.warn(g),this.identity()}var y=1/v;return r[0]=d*y,r[1]=(o*h-p*a)*y,r[2]=(l*a-o*c)*y,r[3]=f*y,r[4]=(p*i-o*u)*y,r[5]=(o*s-l*i)*y,r[6]=m*y,r[7]=(a*u-h*i)*y,r[8]=(c*i-a*s)*y,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,r,i,a,o){var s=Math.cos(i),c=Math.sin(i);this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*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),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],c=r[4],l=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*c,r[6]=t*o+n*l,r[1]=-n*i+t*s,r[4]=-n*a+t*c,r[7]=-n*o+t*l,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,r=0;r<9;r++)if(t[r]!==n[r])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 sn,cn,ln,un,hn,pn={getDataURL:function(e){var t;if("undefined"==typeof HTMLCanvasElement)return e.src;if(_instanceof(e,HTMLCanvasElement))t=e;else{void 0===k&&(k=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),k.width=e.width,k.height=e.height;var n=k.getContext("2d");_instanceof(e,ImageData)?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=k}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},dn=0;function fn(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(this,"id",{value:dn++}),this.uuid=en.generateUUID(),this.name="",this.image=void 0!==e?e:fn.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:fn.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:Fe,this.wrapT=void 0!==r?r:Fe,this.magFilter=void 0!==i?i:We,this.minFilter=void 0!==a?a:Xe,this.anisotropy=void 0!==c?c:1,this.format=void 0!==o?o:ct,this.type=void 0!==s?s:Ye,this.offset=new tn(0,0),this.repeat=new tn(1,1),this.center=new tn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new on,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:jt,this.version=0,this.onUpdate=null}function mn(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==r?r:1}function vn(e,t,n){this.width=e,this.height=t,this.scissor=new mn(0,0,e,t),this.scissorTest=!1,this.viewport=new mn(0,0,e,t),n=n||{},this.texture=new fn(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:We,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 gn(e,t,n){vn.call(this,e,t,n),this.samples=4}function yn(e,t,n){vn.call(this,e,t,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function xn(e,t,n,r,i,a,o,s,c,l,u,h){fn.call(this,null,a,o,s,c,l,r,i,u,h),this.image={data:e,width:t,height:n},this.magFilter=void 0!==c?c:He,this.minFilter=void 0!==l?l:He,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function bn(e,t){this.min=void 0!==e?e:new an(1/0,1/0,1/0),this.max=void 0!==t?t:new an(-1/0,-1/0,-1/0)}function wn(e,t){this.center=void 0!==e?e:new an,this.radius=void 0!==t?t:0}function _n(e,t){this.normal=void 0!==e?e:new an(1,0,0),this.constant=void 0!==t?t:0}function Mn(e,t,n,r,i,a){this.planes=[void 0!==e?e:new _n,void 0!==t?t:new _n,void 0!==n?n:new _n,void 0!==r?r:new _n,void 0!==i?i:new _n,void 0!==a?a:new _n]}fn.DEFAULT_IMAGE=void 0,fn.DEFAULT_MAPPING=300,fn.prototype=Object.assign(Object.create(_.prototype),{constructor:fn,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.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 r=this.image;if(void 0===r.uuid&&(r.uuid=en.generateUUID()),!t&&void 0===e.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)i.push(pn.getDataURL(r[a]))}else i=pn.getDataURL(r);e.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.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 Be:e.x=e.x-Math.floor(e.x);break;case Fe:e.x=e.x<0?0:1;break;case Ge: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 Be:e.y=e.y-Math.floor(e.y);break;case Fe:e.y=e.y<0?0:1;break;case Ge: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(fn.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(mn.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,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,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,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,r,i,a=e.elements,o=a[0],s=a[4],c=a[8],l=a[1],u=a[5],h=a[9],p=a[2],d=a[6],f=a[10];if(Math.abs(s-l)<.01&&Math.abs(c-p)<.01&&Math.abs(h-d)<.01){if(Math.abs(s+l)<.1&&Math.abs(c+p)<.1&&Math.abs(h+d)<.1&&Math.abs(o+u+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,v=(u+1)/2,g=(f+1)/2,y=(s+l)/4,x=(c+p)/4,b=(h+d)/4;return m>v&&m>g?m<.01?(n=0,r=.707106781,i=.707106781):(r=y/(n=Math.sqrt(m)),i=x/n):v>g?v<.01?(n=.707106781,r=0,i=.707106781):(n=y/(r=Math.sqrt(v)),i=b/r):g<.01?(n=.707106781,r=.707106781,i=0):(n=x/(i=Math.sqrt(g)),r=b/i),this.set(n,r,i,t),this}var w=Math.sqrt((d-h)*(d-h)+(c-p)*(c-p)+(l-s)*(l-s));return Math.abs(w)<.001&&(w=1),this.x=(d-h)/w,this.y=(c-p)/w,this.z=(l-s)/w,this.w=Math.acos((o+u+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(){var e,t;return function(n,r){return void 0===e&&(e=new mn,t=new mn),e.set(n,n,n,n),t.set(r,r,r,r),this.clamp(e,t)}}(),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.subVectors(t,e).multiplyScalar(n).add(e)},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}}),vn.prototype=Object.assign(Object.create(_.prototype),{constructor:vn,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.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"})}}),gn.prototype=Object.assign(Object.create(vn.prototype),{constructor:gn,isWebGLMultisampleRenderTarget:!0,copy:function(e){return vn.prototype.copy.call(this,e),this.samples=e.samples,this}}),yn.prototype=Object.create(vn.prototype),yn.prototype.constructor=yn,yn.prototype.isWebGLRenderTargetCube=!0,xn.prototype=Object.create(fn.prototype),xn.prototype.constructor=xn,xn.prototype.isDataTexture=!0,Object.assign(bn.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,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],u=e[s+1],h=e[s+2];l<t&&(t=l),u<n&&(n=u),h<r&&(r=h),l>i&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),u=e.getY(s),h=e.getZ(s);l<t&&(t=l),u<n&&(n=u),h<r&&(r=h),l>i&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,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(){var e=new an;return function(t,n){var r=e.copy(n).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),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 an),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 an),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(){var e,t,n,r=new an;function i(i){var a=i.geometry;if(void 0!==a)if(a.isGeometry){var o=a.vertices;for(t=0,n=o.length;t<n;t++)r.copy(o[t]),r.applyMatrix4(i.matrixWorld),e.expandByPoint(r)}else if(a.isBufferGeometry){var s=a.attributes.position;if(void 0!==s)for(t=0,n=s.count;t<n;t++)r.fromBufferAttribute(s,t).applyMatrix4(i.matrixWorld),e.expandByPoint(r)}}return function(t){return e=this,t.updateMatrixWorld(!0),t.traverse(i),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 an),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:(cn=new an,function(e){return this.clampPoint(e.center,cn),cn.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(){var e=new an,t=new an,n=new an,r=new an,i=new an,a=new an,o=new an,s=new an,c=new an,l=new an;function u(r){var i,a;for(i=0,a=r.length-3;i<=a;i+=3){o.fromArray(r,i);var s=c.x*Math.abs(o.x)+c.y*Math.abs(o.y)+c.z*Math.abs(o.z),l=e.dot(o),u=t.dot(o),h=n.dot(o);if(Math.max(-Math.max(l,u,h),Math.min(l,u,h))>s)return!1}return!0}return function(o){if(this.isEmpty())return!1;this.getCenter(s),c.subVectors(this.max,s),e.subVectors(o.a,s),t.subVectors(o.b,s),n.subVectors(o.c,s),r.subVectors(t,e),i.subVectors(n,t),a.subVectors(e,n);var h=[0,-r.z,r.y,0,-i.z,i.y,0,-a.z,a.y,r.z,0,-r.x,i.z,0,-i.x,a.z,0,-a.x,-r.y,r.x,0,-i.y,i.x,0,-a.y,a.x,0];return!!u(h)&&(!!u(h=[1,0,0,0,1,0,0,0,1])&&(l.crossVectors(r,i),u(h=[l.x,l.y,l.z])))}}(),clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new an),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new an;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new an;return function(t){return void 0===t&&(console.warn("THREE.Box3: .getBoundingSphere() target is now required"),t=new wn),this.getCenter(t.center),t.radius=.5*this.getSize(e).length(),t}}(),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:(sn=[new an,new an,new an,new an,new an,new an,new an,new an],function(e){return this.isEmpty()?this:(sn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),sn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),sn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),sn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),sn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),sn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),sn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),sn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(sn),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)}}),Object.assign(wn.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(ln=new bn,function(e,t){var n=this.center;void 0!==t?n.copy(t):ln.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this}),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},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 an),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 bn),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}}),Object.assign(_n.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new an,t=new an;return function(n,r,i){var a=e.subVectors(i,r).cross(t.subVectors(n,r)).normalize();return this.setFromNormalAndCoplanarPoint(a,n),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 an),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(){var e=new an;return function(t,n){void 0===n&&(console.warn("THREE.Plane: .intersectLine() target is now required"),n=new an);var r=t.delta(e),i=this.normal.dot(r);if(0===i)return 0===this.distanceToPoint(t.start)?n.copy(t.start):void 0;var a=-(t.start.dot(this.normal)+this.constant)/i;return a<0||a>1?void 0:n.copy(r).multiplyScalar(a).add(t.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 an),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new an,t=new on;return function(n,r){var i=r||t.getNormalMatrix(n),a=this.coplanarPoint(e).applyMatrix4(n),o=this.normal.applyMatrix3(i).normalize();return this.constant=-a.dot(o),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}}),Object.assign(Mn.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),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},setFromMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],h=n[8],p=n[9],d=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(o-r,u-s,f-h,y-m).normalize(),t[1].setComponents(o+r,u+s,f+h,y+m).normalize(),t[2].setComponents(o+i,u+c,f+p,y+v).normalize(),t[3].setComponents(o-i,u-c,f-p,y-v).normalize(),t[4].setComponents(o-a,u-l,f-d,y-g).normalize(),t[5].setComponents(o+a,u+l,f+d,y+g).normalize(),this},intersectsObject:(hn=new wn,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),hn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(hn)}),intersectsSprite:function(){var e=new wn;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){if(t[i].distanceToPoint(n)<r)return!1}return!0},intersectsBox:(un=new an,function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(un.x=r.normal.x>0?e.max.x:e.min.x,un.y=r.normal.y>0?e.max.y:e.min.y,un.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(un)<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 Sn={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( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",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 );",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}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\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( specularColor, dotNV );\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}",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\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - 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#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\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, uv ).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 = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = 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#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",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 = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",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 TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * 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 = 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;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\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#endif",lights_pars_begin:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",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\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#endif\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#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\tfloat clearCoatInv = 1.0 - clearCoatDHR;\n\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec3 singleScattering = vec3( 0.0 );\n\t\tvec3 multiScattering = vec3( 0.0 );\n\t\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\t\tvec3 diffuse = material.diffuseColor;\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;\n\t\treflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;\n\t\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#else\n\t\treflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#endif\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif",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, irradiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = 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#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\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#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif",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:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\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 += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif",normal_fragment_maps:"#ifdef USE_NORMALMAP\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t#ifdef FLIP_SIDED\n\t\t\tnormal = - normal;\n\t\t#endif\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tnormal = normalize( normalMatrix * normal );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef OBJECTSPACE_NORMALMAP\n\t\tuniform mat3 normalMatrix;\n\t#else\n\t\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\t\tvec2 st0 = dFdx( vUv.st );\n\t\t\tvec2 st1 = dFdy( vUv.st );\n\t\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\t\tvec3 N = normalize( surf_norm );\n\t\t\tmat3 tsn = mat3( S, T, N );\n\t\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\t\tmapN.xy *= normalScale;\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\treturn normalize( tsn * mapN );\n\t\t}\n\t#endif\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",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_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",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#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 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\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_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif",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:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = mapTexelToLinear( texColor );\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>\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\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",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>\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}",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;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_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 <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\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 <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_pars_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\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * 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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_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_pars_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\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\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 <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 <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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_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 <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 <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}",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_pars_fragment>\n#include <gradientmap_pars_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 PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <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_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 <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 <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\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 PHYSICAL\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}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\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( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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>\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#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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_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 <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_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 = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\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 <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 <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 <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 = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );\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}"};function Tn(e){var t={};for(var n in e)for(var r in t[n]={},e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function En(e){for(var t={},n=0;n<e.length;n++){var r=Tn(e[n]);for(var i in r)t[i]=r[i]}return t}var An,Ln,Pn,Rn={clone:Tn,merge:En},Cn={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};function On(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}Object.assign(On.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(){function e(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}return function(t,n,r){if(t=en.euclideanModulo(t,1),n=en.clamp(n,0,1),r=en.clamp(r,0,1),0===n)this.r=this.g=this.b=r;else{var i=r<=.5?r*(1+n):r+n-r*n,a=2*r-i;this.r=e(a,i,t+1/3),this.g=e(a,i,t),this.b=e(a,i,t-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 r,i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(o,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l,u=(l=n[1]).length;if(3===u)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}e&&e.length>0&&(void 0!==(l=Cn[e])?this.setHex(l):console.warn("THREE.Color: Unknown color "+e));return 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(){function e(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}return function(t){return this.r=e(t.r),this.g=e(t.g),this.b=e(t.b),this}}(),copyLinearToSRGB:function(){function e(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}return function(t){return this.r=e(t.r),this.g=e(t.g),this.b=e(t.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,r=this.r,i=this.g,a=this.b,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(s+o)/2;if(s===o)t=0,n=0;else{var l=o-s;switch(n=c<=.5?l/(o+s):l/(2-o-s),o){case r:t=(i-a)/l+(i<a?6:0);break;case i:t=(a-r)/l+2;break;case a:t=(r-i)/l+4}t/=6}return e.h=t,e.s=n,e.l=c,e},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:(Pn={},function(e,t,n){return this.getHSL(Pn),Pn.h+=e,Pn.s+=t,Pn.l+=n,this.setHSL(Pn.h,Pn.s,Pn.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:(An={h:0,s:0,l:0},Ln={h:0,s:0,l:0},function(e,t){this.getHSL(An),e.getHSL(Ln);var n=en.lerp(An.h,Ln.h,t),r=en.lerp(An.s,Ln.s,t),i=en.lerp(An.l,Ln.l,t);return this.setHSL(n,r,i),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()}});var In,kn={common:{diffuse:{value:new On(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new on},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 tn(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 On(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},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 On(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new on}},sprite:{diffuse:{value:new On(15658734)},opacity:{value:1},center:{value:new tn(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new on}}},Dn={basic:{uniforms:En([kn.common,kn.specularmap,kn.envmap,kn.aomap,kn.lightmap,kn.fog]),vertexShader:Sn.meshbasic_vert,fragmentShader:Sn.meshbasic_frag},lambert:{uniforms:En([kn.common,kn.specularmap,kn.envmap,kn.aomap,kn.lightmap,kn.emissivemap,kn.fog,kn.lights,{emissive:{value:new On(0)}}]),vertexShader:Sn.meshlambert_vert,fragmentShader:Sn.meshlambert_frag},phong:{uniforms:En([kn.common,kn.specularmap,kn.envmap,kn.aomap,kn.lightmap,kn.emissivemap,kn.bumpmap,kn.normalmap,kn.displacementmap,kn.gradientmap,kn.fog,kn.lights,{emissive:{value:new On(0)},specular:{value:new On(1118481)},shininess:{value:30}}]),vertexShader:Sn.meshphong_vert,fragmentShader:Sn.meshphong_frag},standard:{uniforms:En([kn.common,kn.envmap,kn.aomap,kn.lightmap,kn.emissivemap,kn.bumpmap,kn.normalmap,kn.displacementmap,kn.roughnessmap,kn.metalnessmap,kn.fog,kn.lights,{emissive:{value:new On(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Sn.meshphysical_vert,fragmentShader:Sn.meshphysical_frag},matcap:{uniforms:En([kn.common,kn.bumpmap,kn.normalmap,kn.displacementmap,kn.fog,{matcap:{value:null}}]),vertexShader:Sn.meshmatcap_vert,fragmentShader:Sn.meshmatcap_frag},points:{uniforms:En([kn.points,kn.fog]),vertexShader:Sn.points_vert,fragmentShader:Sn.points_frag},dashed:{uniforms:En([kn.common,kn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Sn.linedashed_vert,fragmentShader:Sn.linedashed_frag},depth:{uniforms:En([kn.common,kn.displacementmap]),vertexShader:Sn.depth_vert,fragmentShader:Sn.depth_frag},normal:{uniforms:En([kn.common,kn.bumpmap,kn.normalmap,kn.displacementmap,{opacity:{value:1}}]),vertexShader:Sn.normal_vert,fragmentShader:Sn.normal_frag},sprite:{uniforms:En([kn.sprite,kn.fog]),vertexShader:Sn.sprite_vert,fragmentShader:Sn.sprite_frag},background:{uniforms:{uvTransform:{value:new on},t2D:{value:null}},vertexShader:Sn.background_vert,fragmentShader:Sn.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Sn.cube_vert,fragmentShader:Sn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Sn.equirect_vert,fragmentShader:Sn.equirect_frag},distanceRGBA:{uniforms:En([kn.common,kn.displacementmap,{referencePosition:{value:new an},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Sn.distanceRGBA_vert,fragmentShader:Sn.distanceRGBA_frag},shadow:{uniforms:En([kn.lights,kn.fog,{color:{value:new On(0)},opacity:{value:1}}]),vertexShader:Sn.shadow_vert,fragmentShader:Sn.shadow_frag}};function Nn(){var e=null,t=!1,n=null;function r(i,a){!1!==t&&(n(i,a),e.requestAnimationFrame(r))}return{start:function(){!0!==t&&null!==n&&(e.requestAnimationFrame(r),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function zn(e){var t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);var r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))},update:function(n,r){n.isInterleavedBufferAttribute&&(n=n.data);var i=t.get(n);void 0===i?t.set(n,function(t,n){var r=t.array,i=t.dynamic?35048:35044,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,r,i),t.onUploadCallback();var o=5126;return _instanceof(r,Float32Array)?o=5126:_instanceof(r,Float64Array)?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):_instanceof(r,Uint16Array)?o=5123:_instanceof(r,Int16Array)?o=5122:_instanceof(r,Uint32Array)?o=5125:_instanceof(r,Int32Array)?o=5124:_instanceof(r,Int8Array)?o=5120:_instanceof(r,Uint8Array)&&(o=5121),{buffer:a,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version}}(n,r)):i.version<n.version&&(function(t,n,r){var i=n.array,a=n.updateRange;e.bindBuffer(r,t),!1===n.dynamic?e.bufferData(r,i,35044):-1===a.count?e.bufferSubData(r,0,i):0===a.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(e.bufferSubData(r,a.offset*i.BYTES_PER_ELEMENT,i.subarray(a.offset,a.offset+a.count)),a.count=-1)}(i.buffer,n,r),i.version=n.version)}}}function Un(e,t,n,r,i,a){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new an,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new On,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==a?a:0}function Bn(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||Bn.DefaultOrder}function Fn(){this.mask=1}Dn.physical={uniforms:En([Dn.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Sn.meshphysical_vert,fragmentShader:Sn.meshphysical_frag},Object.assign(Un.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}}),Bn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Bn.DefaultOrder="XYZ",Object.defineProperties(Bn.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(Bn.prototype,{isEuler:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||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 r=en.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],u=i[9],h=i[2],p=i[6],d=i[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(p,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,a),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a))):"ZYX"===t?(this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l))):"YZX"===t?(this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===t?(this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(p,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var e=new nn;return function(t,n,r){return e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,n,r)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(In=new rn,function(e){return In.setFromEuler(this),this.setFromQuaternion(In,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 an(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(Fn.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},test:function(e){return 0!=(this.mask&e.mask)}});var Gn,Hn,jn=0;function Vn(){Object.defineProperty(this,"id",{value:jn++}),this.uuid=en.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Vn.DefaultUp.clone();var e=new an,t=new Bn,n=new rn,r=new an(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:r},modelViewMatrix:{value:new nn},normalMatrix:{value:new on}}),this.matrix=new nn,this.matrixWorld=new nn,this.matrixAutoUpdate=Vn.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Fn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}Vn.DefaultUp=new an(0,1,0),Vn.DefaultMatrixAutoUpdate=!0,Vn.prototype=Object.assign(Object.create(_.prototype),{constructor:Vn,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(e){this.matrix.multiplyMatrices(e,this.matrix),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:(Hn=new rn,function(e,t){return Hn.setFromAxisAngle(e,t),this.quaternion.multiply(Hn),this}),rotateOnWorldAxis:function(){var e=new rn;return function(t,n){return e.setFromAxisAngle(t,n),this.quaternion.premultiply(e),this}}(),rotateX:function(){var e=new an(1,0,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateY:function(){var e=new an(0,1,0);return function(t){return this.rotateOnAxis(e,t)}}(),rotateZ:function(){var e=new an(0,0,1);return function(t){return this.rotateOnAxis(e,t)}}(),translateOnAxis:function(){var e=new an;return function(t,n){return e.copy(t).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(n)),this}}(),translateX:function(){var e=new an(1,0,0);return function(t){return this.translateOnAxis(e,t)}}(),translateY:function(){var e=new an(0,1,0);return function(t){return this.translateOnAxis(e,t)}}(),translateZ:function(){var e=new an(0,0,1);return function(t){return this.translateOnAxis(e,t)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:(Gn=new nn,function(e){return e.applyMatrix4(Gn.getInverse(this.matrixWorld))}),lookAt:function(){var e=new rn,t=new nn,n=new an,r=new an;return function(i,a,o){i.isVector3?n.copy(i):n.set(i,a,o);var s=this.parent;this.updateWorldMatrix(!0,!1),r.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?t.lookAt(r,n,this.up):t.lookAt(n,r,this.up),this.quaternion.setFromRotationMatrix(t),s&&(t.extractRotation(s.matrixWorld),e.setFromRotationMatrix(t),this.quaternion.premultiply(e.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,e.dispatchEvent({type:"added"}),this.children.push(e)):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,e.dispatchEvent({type:"removed"}),this.children.splice(n,1)),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,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new an),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new an,t=new an;return function(n){return void 0===n&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),n=new rn),this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,n,t),n}}(),getWorldScale:function(){var e=new an,t=new rn;return function(n){return void 0===n&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),n=new an),this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,n),n}}(),getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new an),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,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,r=t.length;n<r;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,r=t.length;n<r;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 r=this.children,i=0,a=r.length;i<a;i++)r[i].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 r={};function i(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isMesh&&this.drawMode!==Ft&&(r.drawMode=this.drawMode),this.isMesh||this.isLine||this.isPoints){r.geometry=i(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,c=o.length;s<c;s++){var l=o[s];i(e.shapes,l)}else i(e.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){var u=[];for(s=0,c=this.material.length;s<c;s++)u.push(i(e.materials,this.material[s]));r.material=u}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(e).object)}if(t){var h=m(e.geometries),p=m(e.materials),d=m(e.textures),f=m(e.images);o=m(e.shapes);h.length>0&&(n.geometries=h),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=r,n;function m(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}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 r=e.children[n];this.add(r.clone())}return this}});var Wn,qn,Xn=0;function Yn(){Object.defineProperty(this,"id",{value:Xn+=2}),this.uuid=en.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}function Jn(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.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Zn(e,t,n){Jn.call(this,new Int8Array(e),t,n)}function Kn(e,t,n){Jn.call(this,new Uint8Array(e),t,n)}function Qn(e,t,n){Jn.call(this,new Uint8ClampedArray(e),t,n)}function $n(e,t,n){Jn.call(this,new Int16Array(e),t,n)}function er(e,t,n){Jn.call(this,new Uint16Array(e),t,n)}function tr(e,t,n){Jn.call(this,new Int32Array(e),t,n)}function nr(e,t,n){Jn.call(this,new Uint32Array(e),t,n)}function rr(e,t,n){Jn.call(this,new Float32Array(e),t,n)}function ir(e,t,n){Jn.call(this,new Float64Array(e),t,n)}function ar(){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 or(e){if(0===e.length)return-1/0;for(var t=e[0],n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}Yn.prototype=Object.assign(Object.create(_.prototype),{constructor:Yn,isGeometry:!0,applyMatrix:function(e){for(var t=(new on).getNormalMatrix(e),n=0,r=this.vertices.length;n<r;n++){this.vertices[n].applyMatrix4(e)}for(n=0,r=this.faces.length;n<r;n++){var i=this.faces[n];i.normal.applyMatrix3(t).normalize();for(var a=0,o=i.vertexNormals.length;a<o;a++)i.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(){var e=new nn;return function(t){return e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e=new nn;return function(t){return e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e=new nn;return function(t){return e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e=new nn;return function(t,n,r){return e.makeTranslation(t,n,r),this.applyMatrix(e),this}}(),scale:function(){var e=new nn;return function(t,n,r){return e.makeScale(t,n,r),this.applyMatrix(e),this}}(),lookAt:(qn=new Vn,function(e){qn.lookAt(e),qn.updateMatrix(),this.applyMatrix(qn.matrix)}),fromBufferGeometry:function(e){var t=this,n=null!==e.index?e.index.array:void 0,r=e.attributes,i=r.position.array,a=void 0!==r.normal?r.normal.array:void 0,o=void 0!==r.color?r.color.array:void 0,s=void 0!==r.uv?r.uv.array:void 0,c=void 0!==r.uv2?r.uv2.array:void 0;void 0!==c&&(this.faceVertexUvs[1]=[]);for(var l=0,u=0;l<i.length;l+=3,u+=2)t.vertices.push((new an).fromArray(i,l)),void 0!==o&&t.colors.push((new On).fromArray(o,l));function h(e,n,r,i){var l=void 0===o?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[r].clone()],u=new Un(e,n,r,void 0===a?[]:[(new an).fromArray(a,3*e),(new an).fromArray(a,3*n),(new an).fromArray(a,3*r)],l,i);t.faces.push(u),void 0!==s&&t.faceVertexUvs[0].push([(new tn).fromArray(s,2*e),(new tn).fromArray(s,2*n),(new tn).fromArray(s,2*r)]),void 0!==c&&t.faceVertexUvs[1].push([(new tn).fromArray(c,2*e),(new tn).fromArray(c,2*n),(new tn).fromArray(c,2*r)])}var p=e.groups;if(p.length>0)for(l=0;l<p.length;l++)for(var d=p[l],f=d.start,m=(u=f,f+d.count);u<m;u+=3)void 0!==n?h(n[u],n[u+1],n[u+2],d.materialIndex):h(u,u+1,u+2,d.materialIndex);else if(void 0!==n)for(l=0;l<n.length;l+=3)h(n[l],n[l+1],n[l+2]);else for(l=0;l<i.length/3;l+=3)h(l,l+1,l+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:(Wn=new an,function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Wn).negate(),this.translate(Wn.x,Wn.y,Wn.z),this}),normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,r=new nn;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix(r),this},computeFaceNormals:function(){for(var e=new an,t=new an,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){var t,n,r,i,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 an;if(e){var s,c,l,u=new an,h=new an;for(r=0,i=this.faces.length;r<i;r++)a=this.faces[r],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),h.subVectors(s,c),u.cross(h),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)o[(a=this.faces[r]).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(r=0,i=this.faces.length;r<i;r++){var p=(a=this.faces[r]).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 r=(n=this.faces[e]).vertexNormals;3===r.length?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for((i=this.faces[n]).__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new Yn;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,r=this.faces.length;n<r;n++)c=new an,l={a:new an,b:new an,c:new an},o.push(c),s.push(l)}var c,l,u=this.morphNormals[e];for(a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals(),n=0,r=this.faces.length;n<r;n++)i=this.faces[n],c=u.faceNormals[n],l=u.vertexNormals[n],c.copy(i.normal),l.a.copy(i.vertexNormals[0]),l.b.copy(i.vertexNormals[1]),l.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)(i=this.faces[n]).normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new bn),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new wn),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var r,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.faceVertexUvs[0],u=e.faceVertexUvs[0],h=this.colors,p=e.colors;void 0===n&&(n=0),void 0!==t&&(r=(new on).getNormalMatrix(t));for(var d=0,f=o.length;d<f;d++){var m=o[d].clone();void 0!==t&&m.applyMatrix4(t),a.push(m)}for(d=0,f=p.length;d<f;d++)h.push(p[d].clone());for(d=0,f=c.length;d<f;d++){var v,g,y,x=c[d],b=x.vertexNormals,w=x.vertexColors;(v=new Un(x.a+i,x.b+i,x.c+i)).normal.copy(x.normal),void 0!==r&&v.normal.applyMatrix3(r).normalize();for(var _=0,M=b.length;_<M;_++)g=b[_].clone(),void 0!==r&&g.applyMatrix3(r).normalize(),v.vertexNormals.push(g);v.color.copy(x.color);for(_=0,M=w.length;_<M;_++)y=w[_],v.vertexColors.push(y.clone());v.materialIndex=x.materialIndex+n,s.push(v)}for(d=0,f=u.length;d<f;d++){var S=u[d],T=[];if(void 0!==S){for(_=0,M=S.length;_<M;_++)T.push(S[_].clone());l.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,r,i,a,o,s,c={},l=[],u=[],h=Math.pow(10,4);for(n=0,r=this.vertices.length;n<r;n++)e=this.vertices[n],void 0===c[t=Math.round(e.x*h)+"_"+Math.round(e.y*h)+"_"+Math.round(e.z*h)]?(c[t]=n,l.push(this.vertices[n]),u[n]=l.length-1):u[n]=u[c[t]];var p=[];for(n=0,r=this.faces.length;n<r;n++){(i=this.faces[n]).a=u[i.a],i.b=u[i.b],i.c=u[i.c],a=[i.a,i.b,i.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-l.length;return this.vertices=l,m},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];this.vertices.push(new an(r.x,r.y,r.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 r,i,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(r=[]),o&&o.length===t&&(i=[]);for(n=0;n<t;n++){var s=e[n]._id;r&&r.push(a[s]),i&&i.push(o[s])}r&&(this.faceVertexUvs[0]=r),i&&(this.faceVertexUvs[1]=i)},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 r=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];r.push(a.x,a.y,a.z)}var o=[],s=[],c={},l=[],u={},h=[],p={};for(i=0;i<this.faces.length;i++){var d=this.faces[i],f=void 0!==this.faceVertexUvs[0][i],m=d.normal.length()>0,v=d.vertexNormals.length>0,g=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,v),x=M(x,6,g),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][i];o.push(E(b[0]),E(b[1]),E(b[2]))}if(m&&o.push(S(d.normal)),v){var w=d.vertexNormals;o.push(S(w[0]),S(w[1]),S(w[2]))}if(g&&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!==c[t]?c[t]:(c[t]=s.length/3,s.push(e.x,e.y,e.z),c[t])}function T(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==u[t]?u[t]:(u[t]=l.length,l.push(e.getHex()),u[t])}function E(e){var t=e.x.toString()+e.y.toString();return void 0!==p[t]?p[t]:(p[t]=h.length/2,h.push(e.x,e.y),p[t])}return e.data={},e.data.vertices=r,e.data.normals=s,l.length>0&&(e.data.colors=l),h.length>0&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return(new Yn).copy(this)},copy:function(e){var t,n,r,i,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 c=e.colors;for(t=0,n=c.length;t<n;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,n=l.length;t<n;t++)this.faces.push(l[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(void 0===this.faceVertexUvs[t]&&(this.faceVertexUvs[t]=[]),r=0,i=u.length;r<i;r++){var h=u[r],p=[];for(a=0,o=h.length;a<o;a++){var d=h[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=[],r=0,i=f[t].vertices.length;r<i;r++)m.vertices.push(f[t].vertices[r].clone());if(void 0!==f[t].normals)for(m.normals=[],r=0,i=f[t].normals.length;r<i;r++)m.normals.push(f[t].normals[r].clone());this.morphTargets.push(m)}var v=e.morphNormals;for(t=0,n=v.length;t<n;t++){var g={};if(void 0!==v[t].vertexNormals)for(g.vertexNormals=[],r=0,i=v[t].vertexNormals.length;r<i;r++){var y=v[t].vertexNormals[r],x={};x.a=y.a.clone(),x.b=y.b.clone(),x.c=y.c.clone(),g.vertexNormals.push(x)}if(void 0!==v[t].faceNormals)for(g.faceNormals=[],r=0,i=v[t].faceNormals.length;r<i;r++)g.faceNormals.push(v[t].faceNormals[r].clone());this.morphNormals.push(g)}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"})}}),Object.defineProperty(Jn.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Jn.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==e?e.length/this.itemSize:0,this.array=e,this},setDynamic:function(e){return this.dynamic=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.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new On),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new tn),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new an),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new mn),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}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,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),Zn.prototype=Object.create(Jn.prototype),Zn.prototype.constructor=Zn,Kn.prototype=Object.create(Jn.prototype),Kn.prototype.constructor=Kn,Qn.prototype=Object.create(Jn.prototype),Qn.prototype.constructor=Qn,$n.prototype=Object.create(Jn.prototype),$n.prototype.constructor=$n,er.prototype=Object.create(Jn.prototype),er.prototype.constructor=er,tr.prototype=Object.create(Jn.prototype),tr.prototype.constructor=tr,nr.prototype=Object.create(Jn.prototype),nr.prototype.constructor=nr,rr.prototype=Object.create(Jn.prototype),rr.prototype.constructor=rr,ir.prototype=Object.create(Jn.prototype),ir.prototype.constructor=ir,Object.assign(ar.prototype,{computeGroups:function(e){for(var t,n=[],r=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==r&&(r=o.materialIndex,void 0!==t&&(t.count=3*a-t.start,n.push(t)),t={start:3*a,materialIndex:r})}void 0!==t&&(t.count=3*a-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t,n=e.faces,r=e.vertices,i=e.faceVertexUvs,a=i[0]&&i[0].length>0,o=i[1]&&i[1].length>0,s=e.morphTargets,c=s.length;if(c>0){t=[];for(var l=0;l<c;l++)t[l]={name:s[l].name,data:[]};this.morphTargets.position=t}var u,h=e.morphNormals,p=h.length;if(p>0){u=[];for(l=0;l<p;l++)u[l]={name:h[l].name,data:[]};this.morphTargets.normal=u}var d=e.skinIndices,f=e.skinWeights,m=d.length===r.length,v=f.length===r.length;r.length>0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(l=0;l<n.length;l++){var g=n[l];this.vertices.push(r[g.a],r[g.b],r[g.c]);var y=g.vertexNormals;if(3===y.length)this.normals.push(y[0],y[1],y[2]);else{var x=g.normal;this.normals.push(x,x,x)}var b,w=g.vertexColors;if(3===w.length)this.colors.push(w[0],w[1],w[2]);else{var _=g.color;this.colors.push(_,_,_)}if(!0===a)void 0!==(b=i[0][l])?this.uvs.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new tn,new tn,new tn));if(!0===o)void 0!==(b=i[1][l])?this.uvs2.push(b[0],b[1],b[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new tn,new tn,new tn));for(var M=0;M<c;M++){var S=s[M].vertices;t[M].data.push(S[g.a],S[g.b],S[g.c])}for(M=0;M<p;M++){var T=h[M].vertexNormals[l];u[M].data.push(T.a,T.b,T.c)}m&&this.skinIndices.push(d[g.a],d[g.b],d[g.c]),v&&this.skinWeights.push(f[g.a],f[g.b],f[g.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,this}});var sr=1;function cr(){Object.defineProperty(this,"id",{value:sr+=2}),this.uuid=en.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}function lr(e,t,n,r,i,a){Yn.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a},this.fromBufferGeometry(new ur(e,t,n,r,i,a)),this.mergeVertices()}function ur(e,t,n,r,i,a){cr.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};var o=this;e=e||1,t=t||1,n=n||1,r=Math.floor(r)||1,i=Math.floor(i)||1,a=Math.floor(a)||1;var s=[],c=[],l=[],u=[],h=0,p=0;function d(e,t,n,r,i,a,d,f,m,v,g){var y,x,b=a/m,w=d/v,_=a/2,M=d/2,S=f/2,T=m+1,E=v+1,A=0,L=0,P=new an;for(x=0;x<E;x++){var R=x*w-M;for(y=0;y<T;y++){var C=y*b-_;P[e]=C*r,P[t]=R*i,P[n]=S,c.push(P.x,P.y,P.z),P[e]=0,P[t]=0,P[n]=f>0?1:-1,l.push(P.x,P.y,P.z),u.push(y/m),u.push(1-x/v),A+=1}}for(x=0;x<v;x++)for(y=0;y<m;y++){var O=h+y+T*x,I=h+y+T*(x+1),k=h+(y+1)+T*(x+1),D=h+(y+1)+T*x;s.push(O,I,D),s.push(I,k,D),L+=6}o.addGroup(p,L,g),p+=L,h+=A}d("z","y","x",-1,-1,n,t,e,a,i,0),d("z","y","x",1,-1,n,t,-e,a,i,1),d("x","z","y",1,1,e,n,t,r,a,2),d("x","z","y",1,-1,e,n,-t,r,a,3),d("x","y","z",1,-1,e,t,n,r,i,4),d("x","y","z",-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.addAttribute("position",new rr(c,3)),this.addAttribute("normal",new rr(l,3)),this.addAttribute("uv",new rr(u,2))}function hr(e,t,n,r){Yn.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new pr(e,t,n,r)),this.mergeVertices()}function pr(e,t,n,r){cr.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};var i,a,o=(e=e||1)/2,s=(t=t||1)/2,c=Math.floor(n)||1,l=Math.floor(r)||1,u=c+1,h=l+1,p=e/c,d=t/l,f=[],m=[],v=[],g=[];for(a=0;a<h;a++){var y=a*d-s;for(i=0;i<u;i++){var x=i*p-o;m.push(x,-y,0),v.push(0,0,1),g.push(i/c),g.push(1-a/l)}}for(a=0;a<l;a++)for(i=0;i<c;i++){var b=i+u*a,w=i+u*(a+1),_=i+1+u*(a+1),M=i+1+u*a;f.push(b,w,M),f.push(w,_,M)}this.setIndex(f),this.addAttribute("position",new rr(m,3)),this.addAttribute("normal",new rr(v,3)),this.addAttribute("uv",new rr(g,2))}cr.prototype=Object.assign(Object.create(_.prototype),{constructor:cr,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(or(e)>65535?nr:er)(e,1):this.index=e},addAttribute:function(e,t){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):(this.attributes[e]=t,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(e,new Jn(arguments[1],arguments[2])))},getAttribute:function(e){return this.attributes[e]},removeAttribute: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},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new on).getNormalMatrix(e).applyToBufferAttribute(n),n.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e=new nn;return function(t){return e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e=new nn;return function(t){return e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e=new nn;return function(t){return e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e=new nn;return function(t,n,r){return e.makeTranslation(t,n,r),this.applyMatrix(e),this}}(),scale:function(){var e=new nn;return function(t,n,r){return e.makeScale(t,n,r),this.applyMatrix(e),this}}(),lookAt:function(){var e=new Vn;return function(t){e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){var e=new an;return function(){return this.computeBoundingBox(),this.boundingBox.getCenter(e).negate(),this.translate(e.x,e.y,e.z),this}}(),setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new rr(3*t.vertices.length,3),r=new rr(3*t.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new rr(t.lineDistances.length,1);this.addAttribute("lineDistance",i.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,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.addAttribute("position",new rr(t,3)),this},updateFromObject:function(e){var t,n=e.geometry;if(e.isMesh){var r=n.__directGeometry;if(!0===n.elementsNeedUpdate&&(r=void 0,n.elementsNeedUpdate=!1),void 0===r)return this.fromGeometry(n);r.verticesNeedUpdate=n.verticesNeedUpdate,r.normalsNeedUpdate=n.normalsNeedUpdate,r.colorsNeedUpdate=n.colorsNeedUpdate,r.uvsNeedUpdate=n.uvsNeedUpdate,r.groupsNeedUpdate=n.groupsNeedUpdate,n.verticesNeedUpdate=!1,n.normalsNeedUpdate=!1,n.colorsNeedUpdate=!1,n.uvsNeedUpdate=!1,n.groupsNeedUpdate=!1,n=r}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 ar).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.addAttribute("position",new Jn(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.addAttribute("normal",new Jn(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(3*e.colors.length);this.addAttribute("color",new Jn(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new Jn(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new Jn(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,u=c.length;l<u;l++){var h=c[l],p=new rr(3*h.data.length,3);p.name=h.name,s.push(p.copyVector3sArray(h.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var d=new rr(4*e.skinIndices.length,4);this.addAttribute("skinIndex",d.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new rr(4*e.skinWeights.length,4);this.addAttribute("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 bn);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):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(){var e=new bn,t=new an;return function(){null===this.boundingSphere&&(this.boundingSphere=new wn);var n=this.attributes.position;if(n){var r=this.boundingSphere.center;e.setFromBufferAttribute(n),e.getCenter(r);for(var i=0,a=0,o=n.count;a<o;a++)t.x=n.getX(a),t.y=n.getY(a),t.z=n.getZ(a),i=Math.max(i,r.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(i),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.addAttribute("normal",new Jn(new Float32Array(n.length),3));else for(var r=t.normal.array,i=0,a=r.length;i<a;i++)r[i]=0;var o,s,c,l=t.normal.array,u=new an,h=new an,p=new an,d=new an,f=new an;if(e){var m=e.array;for(i=0,a=e.count;i<a;i+=3)o=3*m[i+0],s=3*m[i+1],c=3*m[i+2],u.fromArray(n,o),h.fromArray(n,s),p.fromArray(n,c),d.subVectors(p,h),f.subVectors(u,h),d.cross(f),l[o]+=d.x,l[o+1]+=d.y,l[o+2]+=d.z,l[s]+=d.x,l[s+1]+=d.y,l[s+2]+=d.z,l[c]+=d.x,l[c+1]+=d.y,l[c+2]+=d.z}else for(i=0,a=n.length;i<a;i+=9)u.fromArray(n,i),h.fromArray(n,i+3),p.fromArray(n,i+6),d.subVectors(p,h),f.subVectors(u,h),d.cross(f),l[i]=d.x,l[i+1]=d.y,l[i+2]=d.z,l[i+3]=d.x,l[i+4]=d.y,l[i+5]=d.z,l[i+6]=d.x,l[i+7]=d.y,l[i+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 r in n)if(void 0!==e.attributes[r])for(var i=n[r].array,a=e.attributes[r],o=a.array,s=0,c=a.itemSize*t;s<o.length;s++,c++)i[c]=o[s];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){var e=new an;return function(){for(var t=this.attributes.normal,n=0,r=t.count;n<r;n++)e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.normalize(),t.setXYZ(n,e.x,e.y,e.z)}}(),toNonIndexed:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=new n.constructor(t.length*r),a=0,o=0,s=0,c=t.length;s<c;s++){a=t[s]*r;for(var l=0;l<r;l++)i[o++]=n[a++]}return new Jn(i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new cr,n=this.index.array,r=this.attributes;for(var i in r){var a=e(r[i],n);t.addAttribute(i,a)}var o=this.morphAttributes;for(i in o){for(var s=[],c=o[i],l=0,u=c.length;l<u;l++){a=e(c[l],n);s.push(a)}t.morphAttributes[i]=s}for(var h=this.groups,p=(l=0,h.length);l<p;l++){var d=h[l];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 r=this.index;if(null!==r){var i=Array.prototype.slice.call(r.array);e.data.index={type:r.array.constructor.name,array:i}}var a=this.attributes;for(var n in a){var o=a[n];i=Array.prototype.slice.call(o.array);e.data.attributes[n]={itemSize:o.itemSize,type:o.array.constructor.name,array:i,normalized:o.normalized}}var s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e},clone:function(){return(new cr).copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;null!==i&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.addAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,r=l.length;n<r;n++)c.push(l[n].clone());this.morphAttributes[t]=c}var u=e.groups;for(n=0,r=u.length;n<r;n++){var h=u[n];this.addGroup(h.start,h.count,h.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"})}}),lr.prototype=Object.create(Yn.prototype),lr.prototype.constructor=lr,ur.prototype=Object.create(cr.prototype),ur.prototype.constructor=ur,hr.prototype=Object.create(Yn.prototype),hr.prototype.constructor=hr,pr.prototype=Object.create(cr.prototype),pr.prototype.constructor=pr;var dr,fr,mr,vr,gr,yr,xr,br,wr,_r,Mr,Sr,Tr=0;function Er(){Object.defineProperty(this,"id",{value:Tr++}),this.uuid=en.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=Y,this.side=G,this.flatShading=!1,this.vertexColors=V,this.opacity=1,this.transparent=!1,this.blendSrc=ce,this.blendDst=le,this.blendEquation=$,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=ye,this.depthTest=!0,this.depthWrite=!0,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.userData={},this.needsUpdate=!0}function Ar(e){Er.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 Lr(e,t){this.origin=void 0!==e?e:new an,this.direction=void 0!==t?t:new an}function Pr(e,t,n){this.a=void 0!==e?e:new an,this.b=void 0!==t?t:new an,this.c=void 0!==n?n:new an}function Rr(e){Er.call(this),this.type="MeshBasicMaterial",this.color=new On(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=Me,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.lights=!1,this.setValues(e)}function Cr(e,t){Vn.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new cr,this.material=void 0!==t?t:new Rr({color:16777215*Math.random()}),this.drawMode=Ft,this.updateMorphTargets()}function Or(e,t,n,r){var i,a,o=new On(0),s=0,c=null,l=0;function u(e,n){t.buffers.color.setClear(e.r,e.g,e.b,n,r)}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,r,h,p){var d=r.background;if(null===d?(u(o,s),c=null,l=0):d&&d.isColor&&(u(d,1),p=!0,c=null,l=0),(e.autoClear||p)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),d&&(d.isCubeTexture||d.isWebGLRenderTargetCube)){void 0===a&&((a=new Cr(new ur(1,1,1),new Ar({type:"BackgroundCubeMaterial",uniforms:Tn(Dn.cube.uniforms),vertexShader:Dn.cube.vertexShader,fragmentShader:Dn.cube.fragmentShader,side:H,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),a.geometry.removeAttribute("uv"),a.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.tCube.value}}),n.update(a));var f=d.isWebGLRenderTargetCube?d.texture:d;a.material.uniforms.tCube.value=f,a.material.uniforms.tFlip.value=d.isWebGLRenderTargetCube?1:-1,c===d&&l===f.version||(a.material.needsUpdate=!0,c=d,l=f.version),t.unshift(a,a.geometry,a.material,0,0,null)}else d&&d.isTexture&&(void 0===i&&((i=new Cr(new pr(2,2),new Ar({type:"BackgroundMaterial",uniforms:Tn(Dn.background.uniforms),vertexShader:Dn.background.vertexShader,fragmentShader:Dn.background.fragmentShader,side:G,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.removeAttribute("normal"),Object.defineProperty(i.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(i)),i.material.uniforms.t2D.value=d,!0===d.matrixAutoUpdate&&d.updateMatrix(),i.material.uniforms.uvTransform.value.copy(d.matrix),c===d&&l===d.version||(i.material.needsUpdate=!0,c=d,l=d.version),t.unshift(i,i.geometry,i.material,0,0,null))}}}function Ir(e,t,n,r){var i;this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i)},this.renderInstances=function(a,o,s){var c;if(r.isWebGL2)c=e;else if(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[r.isWebGL2?"drawArraysInstanced":"drawArraysInstancedANGLE"](i,o,s,a.maxInstancedCount),n.update(s,i,a.maxInstancedCount)}}function kr(e,t,n){var r;function i(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&&_instanceof(e,WebGL2RenderingContext),o=void 0!==n.precision?n.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var c=!0===n.logarithmicDepthBuffer,l=e.getParameter(34930),u=e.getParameter(35660),h=e.getParameter(3379),p=e.getParameter(34076),d=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),v=e.getParameter(36349),g=u>0,y=a||!!t.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==r)return r;var n=t.get("EXT_texture_filter_anisotropic");return r=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:c,maxTextures:l,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:a?e.getParameter(36183):0}}function Dr(){var e=this,t=null,n=0,r=!1,i=!1,a=new _n,o=new on,s={value:null,needsUpdate:!1};function c(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function l(t,n,r,i){var c=null!==t?t.length:0,l=null;if(0!==c){if(l=s.value,!0!==i||null===l){var u=r+4*c,h=n.matrixWorldInverse;o.getNormalMatrix(h),(null===l||l.length<u)&&(l=new Float32Array(u));for(var p=0,d=r;p!==c;++p,d+=4)a.copy(t[p]).applyMatrix4(h,o),a.normal.toArray(l,d),l[d+3]=a.constant}s.value=l,s.needsUpdate=!0}return e.numPlanes=c,l}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,i,a){var o=0!==e.length||i||0!==n||r;return r=i,t=l(e,a,0),n=e.length,o},this.beginShadows=function(){i=!0,l(null)},this.endShadows=function(){i=!1,c()},this.setState=function(e,a,o,u,h,p){if(!r||null===e||0===e.length||i&&!o)i?l(null):c();else{var d=i?0:n,f=4*d,m=h.clippingState||null;s.value=m,m=l(e,u,f,p);for(var v=0;v!==f;++v)m[v]=t[v];h.clippingState=m,this.numIntersection=a?this.numPlanes:0,this.numPlanes+=d}}}function Nr(e){var t={};return{get:function(n){if(void 0!==t[n])return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=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":r=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":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=r,r}}}function zr(e,t,n){var r={},i={};function a(e){var o=e.target,s=r[o.id];for(var c in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[c]);o.removeEventListener("dispose",a),delete r[o.id];var l=i[s.id];l&&(t.remove(l),delete i[s.id]),n.memory.geometries--}return{get:function(e,t){var i=r[t.id];return i||(t.addEventListener("dispose",a),t.isBufferGeometry?i=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new cr).setFromObject(e)),i=t._bufferGeometry),r[t.id]=i,n.memory.geometries++,i)},update:function(e){var n=e.index,r=e.attributes;for(var i in null!==n&&t.update(n,34963),r)t.update(r[i],34962);var a=e.morphAttributes;for(var i in a)for(var o=a[i],s=0,c=o.length;s<c;s++)t.update(o[s],34962)},getWireframeAttribute:function(e){var n=i[e.id];if(n)return n;var r,a=[],o=e.index,s=e.attributes;if(null!==o)for(var c=0,l=(r=o.array).length;c<l;c+=3){var u=r[c+0],h=r[c+1],p=r[c+2];a.push(u,h,h,p,p,u)}else for(c=0,l=(r=s.position.array).length/3-1;c<l;c+=3)u=c+0,h=c+1,p=c+2,a.push(u,h,h,p,p,u);return n=new(or(a)>65535?nr:er)(a,1),t.update(n,34963),i[e.id]=n,n}}}function Ur(e,t,n,r){var i,a,o;this.setMode=function(e){i=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,r){e.drawElements(i,r,a,t*o),n.update(r,i)},this.renderInstances=function(s,c,l){var u;if(r.isWebGL2)u=e;else if(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[r.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](i,l,a,c*o,s.maxInstancedCount),n.update(l,i,s.maxInstancedCount)}}function Br(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,r){switch(r=r||1,t.calls++,n){case 4:t.triangles+=r*(e/3);break;case 5:case 6:t.triangles+=r*(e-2);break;case 1:t.lines+=r*(e/2);break;case 3:t.lines+=r*(e-1);break;case 2:t.lines+=r*e;break;case 0:t.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function Fr(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Gr(e){var t={},n=new Float32Array(8);return{update:function(r,i,a,o){var s=r.morphTargetInfluences,c=s.length,l=t[i.id];if(void 0===l){l=[];for(var u=0;u<c;u++)l[u]=[u,0];t[i.id]=l}var h=a.morphTargets&&i.morphAttributes.position,p=a.morphNormals&&i.morphAttributes.normal;for(u=0;u<c;u++)0!==(d=l[u])[1]&&(h&&i.removeAttribute("morphTarget"+u),p&&i.removeAttribute("morphNormal"+u));for(u=0;u<c;u++)(d=l[u])[0]=u,d[1]=s[u];for(l.sort(Fr),u=0;u<8;u++){var d;if(d=l[u]){var f=d[0],m=d[1];if(m){h&&i.addAttribute("morphTarget"+u,h[f]),p&&i.addAttribute("morphNormal"+u,p[f]),n[u]=m;continue}}n[u]=0}o.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function Hr(e,t){var n={};return{update:function(r){var i=t.render.frame,a=r.geometry,o=e.get(r,a);return n[o.id]!==i&&(a.isGeometry&&o.updateFromObject(r),e.update(o),n[o.id]=i),o},dispose:function(){n={}}}}function jr(e,t,n,r,i,a,o,s,c,l){e=void 0!==e?e:[],t=void 0!==t?t:Oe,fn.call(this,e,t,n,r,i,a,o,s,c,l),this.flipY=!1}function Vr(e,t,n,r){fn.call(this,null),this.image={data:e,width:t,height:n,depth:r},this.magFilter=He,this.minFilter=He,this.generateMipmaps=!1,this.flipY=!1}Er.prototype=Object.assign(Object.create(_.prototype),{constructor:Er,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 r=this[t];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.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 r(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}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.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),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.map&&this.map.isTexture&&(n.map=this.map.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,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),this.blending!==Y&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==G&&(n.side=this.side),this.vertexColors!==V&&(n.vertexColors=this.vertexColors),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,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),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.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),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.lights=e.lights,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.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.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.shadowSide=e.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Ar.prototype=Object.create(Er.prototype),Ar.prototype.constructor=Ar,Ar.prototype.isShaderMaterial=!0,Ar.prototype.copy=function(e){return Er.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Tn(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=e.extensions,this},Ar.prototype.toJSON=function(e){var t=Er.prototype.toJSON.call(this,e);for(var n in t.uniforms={},this.uniforms){var r=this.uniforms[n].value;r&&r.isTexture?t.uniforms[n]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:"m4",value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)!0===this.extensions[a]&&(i[a]=!0);return Object.keys(i).length>0&&(t.extensions=i),t},Object.assign(Lr.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 an),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new an;return function(t){return this.origin.copy(this.at(t,e)),this}}(),closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new an),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(){var e=new an;return function(t){var n=e.subVectors(t,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(t):(e.copy(this.direction).multiplyScalar(n).add(this.origin),e.distanceToSquared(t))}}(),distanceSqToSegment:(fr=new an,mr=new an,vr=new an,function(e,t,n,r){fr.copy(e).add(t).multiplyScalar(.5),mr.copy(t).sub(e).normalize(),vr.copy(this.origin).sub(fr);var i,a,o,s,c=.5*e.distanceTo(t),l=-this.direction.dot(mr),u=vr.dot(this.direction),h=-vr.dot(mr),p=vr.lengthSq(),d=Math.abs(1-l*l);if(d>0)if(a=l*u-h,s=c*d,(i=l*h-u)>=0)if(a>=-s)if(a<=s){var f=1/d;o=(i*=f)*(i+l*(a*=f)+2*u)+a*(l*i+a+2*h)+p}else a=c,o=-(i=Math.max(0,-(l*a+u)))*i+a*(a+2*h)+p;else a=-c,o=-(i=Math.max(0,-(l*a+u)))*i+a*(a+2*h)+p;else a<=-s?o=-(i=Math.max(0,-(-l*c+u)))*i+(a=i>0?-c:Math.min(Math.max(-c,-h),c))*(a+2*h)+p:a<=s?(i=0,o=(a=Math.min(Math.max(-c,-h),c))*(a+2*h)+p):o=-(i=Math.max(0,-(l*c+u)))*i+(a=i>0?c:Math.min(Math.max(-c,-h),c))*(a+2*h)+p;else a=l>0?-c:c,o=-(i=Math.max(0,-(l*a+u)))*i+a*(a+2*h)+p;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(mr).multiplyScalar(a).add(fr),o}),intersectSphere:function(){var e=new an;return function(t,n){e.subVectors(t.center,this.origin);var r=e.dot(this.direction),i=e.dot(e)-r*r,a=t.radius*t.radius;if(i>a)return null;var o=Math.sqrt(a-i),s=r-o,c=r+o;return s<0&&c<0?null:s<0?this.at(c,n):this.at(s,n)}}(),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,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),l>=0?(i=(e.min.y-h.y)*l,a=(e.max.y-h.y)*l):(i=(e.max.y-h.y)*l,a=(e.min.y-h.y)*l),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),u>=0?(o=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s<r||r!=r)&&(r=s),r<0?null:this.at(n>=0?n:r,t)))},intersectsBox:(dr=new an,function(e){return null!==this.intersectBox(e,dr)}),intersectTriangle:function(){var e=new an,t=new an,n=new an,r=new an;return function(i,a,o,s,c){t.subVectors(a,i),n.subVectors(o,i),r.crossVectors(t,n);var l,u=this.direction.dot(r);if(u>0){if(s)return null;l=1}else{if(!(u<0))return null;l=-1,u=-u}e.subVectors(this.origin,i);var h=l*this.direction.dot(n.crossVectors(e,n));if(h<0)return null;var p=l*this.direction.dot(t.cross(e));if(p<0)return null;if(h+p>u)return null;var d=-l*e.dot(r);return d<0?null:this.at(d/u,c)}}(),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)}}),Object.assign(Pr,{getNormal:(yr=new an,function(e,t,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new an),r.subVectors(n,t),yr.subVectors(e,t),r.cross(yr);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}),getBarycoord:function(){var e=new an,t=new an,n=new an;return function(r,i,a,o,s){e.subVectors(o,i),t.subVectors(a,i),n.subVectors(r,i);var c=e.dot(e),l=e.dot(t),u=e.dot(n),h=t.dot(t),p=t.dot(n),d=c*h-l*l;if(void 0===s&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),s=new an),0===d)return s.set(-2,-1,-1);var f=1/d,m=(h*u-l*p)*f,v=(c*p-l*u)*f;return s.set(1-m-v,v,m)}}(),containsPoint:function(){var e=new an;return function(t,n,r,i){return Pr.getBarycoord(t,n,r,i,e),e.x>=0&&e.y>=0&&e.x+e.y<=1}}(),getUV:(gr=new an,function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,gr),s.set(0,0),s.addScaledVector(i,gr.x),s.addScaledVector(a,gr.y),s.addScaledVector(o,gr.z),s})}),Object.assign(Pr.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,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),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(){var e=new an,t=new an;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new an),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return Pr.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 an),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return Pr.getBarycoord(e,this.a,this.b,this.c,t)},containsPoint:function(e){return Pr.containsPoint(e,this.a,this.b,this.c)},getUV:function(e,t,n,r,i){return Pr.getUV(e,this.a,this.b,this.c,t,n,r,i)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:(xr=new an,br=new an,wr=new an,_r=new an,Mr=new an,Sr=new an,function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new an);var n,r,i=this.a,a=this.b,o=this.c;xr.subVectors(a,i),br.subVectors(o,i),_r.subVectors(e,i);var s=xr.dot(_r),c=br.dot(_r);if(s<=0&&c<=0)return t.copy(i);Mr.subVectors(e,a);var l=xr.dot(Mr),u=br.dot(Mr);if(l>=0&&u<=l)return t.copy(a);var h=s*u-l*c;if(h<=0&&s>=0&&l<=0)return n=s/(s-l),t.copy(i).addScaledVector(xr,n);Sr.subVectors(e,o);var p=xr.dot(Sr),d=br.dot(Sr);if(d>=0&&p<=d)return t.copy(o);var f=p*c-s*d;if(f<=0&&c>=0&&d<=0)return r=c/(c-d),t.copy(i).addScaledVector(br,r);var m=l*d-p*u;if(m<=0&&u-l>=0&&p-d>=0)return wr.subVectors(o,a),r=(u-l)/(u-l+(p-d)),t.copy(a).addScaledVector(wr,r);var v=1/(m+f+h);return n=f*v,r=h*v,t.copy(i).addScaledVector(xr,n).addScaledVector(br,r)}),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}),Rr.prototype=Object.create(Er.prototype),Rr.prototype.constructor=Rr,Rr.prototype.isMeshBasicMaterial=!0,Rr.prototype.copy=function(e){return Er.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},Cr.prototype=Object.assign(Object.create(Vn.prototype),{constructor:Cr,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return Vn.prototype.copy.call(this,e),this.drawMode=e.drawMode,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,r=this.geometry;if(r.isBufferGeometry){var i=r.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[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=r.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(){var e=new nn,t=new Lr,n=new wn,r=new an,i=new an,a=new an,o=new an,s=new an,c=new an,l=new tn,u=new tn,h=new tn,p=new an,d=new an;function f(e,t,n,r,i,a,o,s){if(null===(t.side===H?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side!==j,s)))return null;d.copy(s),d.applyMatrix4(e.matrixWorld);var c=n.ray.origin.distanceTo(d);return c<n.near||c>n.far?null:{distance:c,point:d.clone(),object:e}}function m(e,t,n,o,s,c,d,m,v){r.fromBufferAttribute(s,d),i.fromBufferAttribute(s,m),a.fromBufferAttribute(s,v);var g=f(e,t,n,o,r,i,a,p);if(g){c&&(l.fromBufferAttribute(c,d),u.fromBufferAttribute(c,m),h.fromBufferAttribute(c,v),g.uv=Pr.getUV(p,r,i,a,l,u,h,new tn));var y=new Un(d,m,v);Pr.getNormal(r,i,a,y.normal),g.face=y}return g}return function(d,v){var g,y=this.geometry,x=this.material,b=this.matrixWorld;if(void 0!==x&&(null===y.boundingSphere&&y.computeBoundingSphere(),n.copy(y.boundingSphere),n.applyMatrix4(b),!1!==d.ray.intersectsSphere(n)&&(e.getInverse(b),t.copy(d.ray).applyMatrix4(e),null===y.boundingBox||!1!==t.intersectsBox(y.boundingBox))))if(y.isBufferGeometry){var w,_,M,S,T,E,A,L,P,R=y.index,C=y.attributes.position,O=y.attributes.uv,I=y.groups,k=y.drawRange;if(null!==R)if(Array.isArray(x))for(S=0,E=I.length;S<E;S++)for(P=x[(L=I[S]).materialIndex],T=Math.max(L.start,k.start),A=Math.min(L.start+L.count,k.start+k.count);T<A;T+=3)w=R.getX(T),_=R.getX(T+1),M=R.getX(T+2),(g=m(this,P,d,t,C,O,w,_,M))&&(g.faceIndex=Math.floor(T/3),g.face.materialIndex=L.materialIndex,v.push(g));else for(S=Math.max(0,k.start),E=Math.min(R.count,k.start+k.count);S<E;S+=3)w=R.getX(S),_=R.getX(S+1),M=R.getX(S+2),(g=m(this,x,d,t,C,O,w,_,M))&&(g.faceIndex=Math.floor(S/3),v.push(g));else if(void 0!==C)if(Array.isArray(x))for(S=0,E=I.length;S<E;S++)for(P=x[(L=I[S]).materialIndex],T=Math.max(L.start,k.start),A=Math.min(L.start+L.count,k.start+k.count);T<A;T+=3)(g=m(this,P,d,t,C,O,w=T,_=T+1,M=T+2))&&(g.faceIndex=Math.floor(T/3),g.face.materialIndex=L.materialIndex,v.push(g));else for(S=Math.max(0,k.start),E=Math.min(C.count,k.start+k.count);S<E;S+=3)(g=m(this,x,d,t,C,O,w=S,_=S+1,M=S+2))&&(g.faceIndex=Math.floor(S/3),v.push(g))}else if(y.isGeometry){var D,N,z,U,B=Array.isArray(x),F=y.vertices,G=y.faces,H=y.faceVertexUvs[0];H.length>0&&(U=H);for(var j=0,V=G.length;j<V;j++){var W=G[j],q=B?x[W.materialIndex]:x;if(void 0!==q){if(D=F[W.a],N=F[W.b],z=F[W.c],!0===q.morphTargets){var X=y.morphTargets,Y=this.morphTargetInfluences;r.set(0,0,0),i.set(0,0,0),a.set(0,0,0);for(var J=0,Z=X.length;J<Z;J++){var K=Y[J];if(0!==K){var Q=X[J].vertices;r.addScaledVector(o.subVectors(Q[W.a],D),K),i.addScaledVector(s.subVectors(Q[W.b],N),K),a.addScaledVector(c.subVectors(Q[W.c],z),K)}}r.add(D),i.add(N),a.add(z),D=r,N=i,z=a}if(g=f(this,q,d,t,D,N,z,p)){if(U&&U[j]){var $=U[j];l.copy($[0]),u.copy($[1]),h.copy($[2]),g.uv=Pr.getUV(p,D,N,z,l,u,h,new tn)}g.face=W,g.faceIndex=j,v.push(g)}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),jr.prototype=Object.create(fn.prototype),jr.prototype.constructor=jr,jr.prototype.isCubeTexture=!0,Object.defineProperty(jr.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),Vr.prototype=Object.create(fn.prototype),Vr.prototype.constructor=Vr,Vr.prototype.isDataTexture3D=!0;var Wr=new fn,qr=new Vr,Xr=new jr;function Yr(){this.seq=[],this.map={}}var Jr=[],Zr=[],Kr=new Float32Array(16),Qr=new Float32Array(9),$r=new Float32Array(4);function ei(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=Jr[i];if(void 0===a&&(a=new Float32Array(i),Jr[i]=a),0!==t){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function ti(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function ni(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function ri(e,t){var n=Zr[t];void 0===n&&(n=new Int32Array(t),Zr[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocTextureUnit();return n}function ii(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function ai(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function oi(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(ti(n,t))return;e.uniform2fv(this.addr,t),ni(n,t)}}function si(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(ti(n,t))return;e.uniform3fv(this.addr,t),ni(n,t)}}function ci(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(ti(n,t))return;e.uniform4fv(this.addr,t),ni(n,t)}}function li(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(ti(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),ni(n,t)}else{if(ti(n,r))return;$r.set(r),e.uniformMatrix2fv(this.addr,!1,$r),ni(n,r)}}function ui(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(ti(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),ni(n,t)}else{if(ti(n,r))return;Qr.set(r),e.uniformMatrix3fv(this.addr,!1,Qr),ni(n,r)}}function hi(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(ti(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),ni(n,t)}else{if(ti(n,r))return;Kr.set(r),e.uniformMatrix4fv(this.addr,!1,Kr),ni(n,r)}}function pi(e,t,n){var r=this.cache,i=n.allocTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2D(t||Wr,i)}function di(e,t,n){var r=this.cache,i=n.allocTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||qr,i)}function fi(e,t,n){var r=this.cache,i=n.allocTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||Xr,i)}function mi(e,t){var n=this.cache;ti(n,t)||(e.uniform2iv(this.addr,t),ni(n,t))}function vi(e,t){var n=this.cache;ti(n,t)||(e.uniform3iv(this.addr,t),ni(n,t))}function gi(e,t){var n=this.cache;ti(n,t)||(e.uniform4iv(this.addr,t),ni(n,t))}function yi(e,t){var n=this.cache;ti(n,t)||(e.uniform1fv(this.addr,t),ni(n,t))}function xi(e,t){var n=this.cache;ti(n,t)||(e.uniform1iv(this.addr,t),ni(n,t))}function bi(e,t){var n=this.cache,r=ei(t,this.size,2);ti(n,r)||(e.uniform2fv(this.addr,r),this.updateCache(r))}function wi(e,t){var n=this.cache,r=ei(t,this.size,3);ti(n,r)||(e.uniform3fv(this.addr,r),this.updateCache(r))}function _i(e,t){var n=this.cache,r=ei(t,this.size,4);ti(n,r)||(e.uniform4fv(this.addr,r),this.updateCache(r))}function Mi(e,t){var n=this.cache,r=ei(t,this.size,4);ti(n,r)||(e.uniformMatrix2fv(this.addr,!1,r),this.updateCache(r))}function Si(e,t){var n=this.cache,r=ei(t,this.size,9);ti(n,r)||(e.uniformMatrix3fv(this.addr,!1,r),this.updateCache(r))}function Ti(e,t){var n=this.cache,r=ei(t,this.size,16);ti(n,r)||(e.uniformMatrix4fv(this.addr,!1,r),this.updateCache(r))}function Ei(e,t,n){var r=this.cache,i=t.length,a=ri(n,i);!1===ti(r,a)&&(e.uniform1iv(this.addr,a),ni(r,a));for(var o=0;o!==i;++o)n.setTexture2D(t[o]||Wr,a[o])}function Ai(e,t,n){var r=this.cache,i=t.length,a=ri(n,i);!1===ti(r,a)&&(e.uniform1iv(this.addr,a),ni(r,a));for(var o=0;o!==i;++o)n.setTextureCube(t[o]||Xr,a[o])}function Li(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return ii;case 35664:return oi;case 35665:return si;case 35666:return ci;case 35674:return li;case 35675:return ui;case 35676:return hi;case 35678:case 36198:return pi;case 35679:return di;case 35680:return fi;case 5124:case 35670:return ai;case 35667:case 35671:return mi;case 35668:case 35672:return vi;case 35669:case 35673:return gi}}(t.type)}function Pi(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return yi;case 35664:return bi;case 35665:return wi;case 35666:return _i;case 35674:return Mi;case 35675:return Si;case 35676:return Ti;case 35678:return Ei;case 35680:return Ai;case 5124:case 35670:return xi;case 35667:case 35671:return mi;case 35668:case 35672:return vi;case 35669:case 35673:return gi}}(t.type)}function Ri(e){this.id=e,Yr.call(this)}Pi.prototype.updateCache=function(e){var t=this.cache;_instanceof(e,Float32Array)&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),ni(t,e)},Ri.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}};var Ci=/([\w\d_]+)(\])?(\[|\.)?/g;function Oi(e,t){e.seq.push(t),e.map[t.id]=t}function Ii(e,t,n){var r=e.name,i=r.length;for(Ci.lastIndex=0;;){var a=Ci.exec(r),o=Ci.lastIndex,s=a[1],c="]"===a[2],l=a[3];if(c&&(s|=0),void 0===l||"["===l&&o+2===i){Oi(n,void 0===l?new Li(s,e,t):new Pi(s,e,t));break}var u=n.map[s];void 0===u&&Oi(n,u=new Ri(s)),n=u}}function ki(e,t,n){Yr.call(this),this.renderer=n;for(var r=e.getProgramParameter(t,35718),i=0;i<r;++i){var a=e.getActiveUniform(t,i);Ii(a,e.getUniformLocation(t,a.name),this)}}function Di(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),!1===e.getShaderParameter(r,35713)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==e.getShaderInfoLog(r)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",35633===t?"vertex":"fragment",e.getShaderInfoLog(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")}(n)),r}ki.prototype.setValue=function(e,t,n){var r=this.map[t];void 0!==r&&r.setValue(e,n,this.renderer)},ki.prototype.setOptional=function(e,t,n){var r=t[n];void 0!==r&&this.setValue(e,n,r)},ki.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,r)}},ki.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n};var Ni=0;function zi(e){switch(e){case jt:return["Linear","( value )"];case Vt:return["sRGB","( value )"];case qt:return["RGBE","( value )"];case Xt:return["RGBM","( value, 7.0 )"];case Yt:return["RGBM","( value, 16.0 )"];case Jt:return["RGBD","( value, 256.0 )"];case Wt:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+e)}}function Ui(e,t){var n=zi(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Bi(e,t){var n;switch(t){case Ae:n="Linear";break;case Le:n="Reinhard";break;case Pe:n="Uncharted2";break;case Re:n="OptimizedCineon";break;case Ce:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Fi(e){return""!==e}function Gi(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)}function Hi(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function ji(e){return e.replace(/^[ \t]*#include +<([\w\d.\/]+)>/gm,function(e,t){var n=Sn[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return ji(n)})}function Vi(e){return e.replace(/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,n,r){for(var i="",a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\[ i \]/g,"[ "+a+" ]");return i})}function Wi(e,t,n,r,i,a,o){var s=e.context,c=r.defines,l=i.vertexShader,u=i.fragmentShader,h="SHADOWMAP_TYPE_BASIC";a.shadowMapType===B?h="SHADOWMAP_TYPE_PCF":a.shadowMapType===F&&(h="SHADOWMAP_TYPE_PCF_SOFT");var p="ENVMAP_TYPE_CUBE",d="ENVMAP_MODE_REFLECTION",f="ENVMAP_BLENDING_MULTIPLY";if(a.envMap){switch(r.envMap.mapping){case Oe:case Ie:p="ENVMAP_TYPE_CUBE";break;case ze:case Ue:p="ENVMAP_TYPE_CUBE_UV";break;case ke:case De:p="ENVMAP_TYPE_EQUIREC";break;case Ne:p="ENVMAP_TYPE_SPHERE"}switch(r.envMap.mapping){case Ie:case De:d="ENVMAP_MODE_REFRACTION"}switch(r.combine){case Me:f="ENVMAP_BLENDING_MULTIPLY";break;case Se:f="ENVMAP_BLENDING_MIX";break;case Te:f="ENVMAP_BLENDING_ADD"}}var m,v,g,y,x,b=e.gammaFactor>0?e.gammaFactor:1,w=o.isWebGL2?"":function(e,t,n){return[(e=e||{}).derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap&&!t.objectSpaceNormalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Fi).join("\n")}(r.extensions,a,t),_=function(e){var t=[];for(var n in e){var r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(c),M=s.createProgram();if(r.isRawShaderMaterial?((m=[_].filter(Fi).join("\n")).length>0&&(m+="\n"),(v=[w,_].filter(Fi).join("\n")).length>0&&(v+="\n")):(m=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+i.name,_,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+b,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+d:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+h:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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(Fi).join("\n"),v=[w,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+i.name,_,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+b,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.matcap?"#define USE_MATCAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+p:"",a.envMap?"#define "+d:"",a.envMap?"#define "+f:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+h:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&(o.isWebGL2||t.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",a.toneMapping!==Ee?"#define TONE_MAPPING":"",a.toneMapping!==Ee?Sn.tonemapping_pars_fragment:"",a.toneMapping!==Ee?Bi("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.matcapEncoding||a.envMapEncoding||a.emissiveMapEncoding?Sn.encodings_pars_fragment:"",a.mapEncoding?Ui("mapTexelToLinear",a.mapEncoding):"",a.matcapEncoding?Ui("matcapTexelToLinear",a.matcapEncoding):"",a.envMapEncoding?Ui("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?Ui("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?(g="linearToOutputTexel",y=a.outputEncoding,x=zi(y),"vec4 "+g+"( vec4 value ) { return LinearTo"+x[0]+x[1]+"; }"):"",a.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(Fi).join("\n")),l=Hi(l=Gi(l=ji(l),a),a),u=Hi(u=Gi(u=ji(u),a),a),l=Vi(l),u=Vi(u),o.isWebGL2&&!r.isRawShaderMaterial){var S=!1,T=/^\s*#version\s+300\s+es\s*\n/;r.isShaderMaterial&&null!==l.match(T)&&null!==u.match(T)&&(S=!0,l=l.replace(T,""),u=u.replace(T,"")),m=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,v=["#version 300 es\n","#define varying in",S?"":"out highp vec4 pc_fragColor;",S?"":"#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"+v}var E=v+u,A=Di(s,35633,m+l),L=Di(s,35632,E);s.attachShader(M,A),s.attachShader(M,L),void 0!==r.index0AttributeName?s.bindAttribLocation(M,0,r.index0AttributeName):!0===a.morphTargets&&s.bindAttribLocation(M,0,"position"),s.linkProgram(M);var P,R,C=s.getProgramInfoLog(M).trim(),O=s.getShaderInfoLog(A).trim(),I=s.getShaderInfoLog(L).trim(),k=!0,D=!0;return!1===s.getProgramParameter(M,35714)?(k=!1,console.error("THREE.WebGLProgram: shader error: ",s.getError(),"35715",s.getProgramParameter(M,35715),"gl.getProgramInfoLog",C,O,I)):""!==C?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",C):""!==O&&""!==I||(D=!1),D&&(this.diagnostics={runnable:k,material:r,programLog:C,vertexShader:{log:O,prefix:m},fragmentShader:{log:I,prefix:v}}),s.deleteShader(A),s.deleteShader(L),this.getUniforms=function(){return void 0===P&&(P=new ki(s,M,e)),P},this.getAttributes=function(){return void 0===R&&(R=function(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i).name;n[a]=e.getAttribLocation(t,a)}return n}(s,M)),R},this.destroy=function(){s.deleteProgram(M),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.name=i.name,this.id=Ni++,this.code=n,this.usedTimes=1,this.program=M,this.vertexShader=A,this.fragmentShader=L,this}function qi(e,t,n){var r=[],i={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},a=["precision","supportsVertexTextures","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];function o(e,t){var n;return e?e.isTexture?n=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=e.texture.encoding):n=jt,n===jt&&t&&(n=Wt),n}this.getParameters=function(t,r,a,s,c,l,u){var h=i[t.type],p=u.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(n.floatVertexTextures)return 1024;var r=n.maxVertexUniforms,i=Math.floor((r-20)/4),a=Math.min(i,t.length);return a<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+a+"."),0):a}(u):0,d=n.precision;null!==t.precision&&(d=n.getMaxPrecision(t.precision))!==t.precision&&console.warn("THREE.WebGLProgram.getParameters:",t.precision,"not supported, using",d,"instead.");var f=e.getRenderTarget();return{shaderID:h,precision:d,supportsVertexTextures:n.vertexTextures,outputEncoding:o(f?f.texture:null,e.gammaOutput),map:!!t.map,mapEncoding:o(t.map,e.gammaInput),matcap:!!t.matcap,matcapEncoding:o(t.matcap,e.gammaInput),envMap:!!t.envMap,envMapMode:t.envMap&&t.envMap.mapping,envMapEncoding:o(t.envMap,e.gammaInput),envMapCubeUV:!!t.envMap&&(t.envMap.mapping===ze||t.envMap.mapping===Ue),lightMap:!!t.lightMap,aoMap:!!t.aoMap,emissiveMap:!!t.emissiveMap,emissiveMapEncoding:o(t.emissiveMap,e.gammaInput),bumpMap:!!t.bumpMap,normalMap:!!t.normalMap,objectSpaceNormalMap:t.normalMapType===$t,displacementMap:!!t.displacementMap,roughnessMap:!!t.roughnessMap,metalnessMap:!!t.metalnessMap,specularMap:!!t.specularMap,alphaMap:!!t.alphaMap,gradientMap:!!t.gradientMap,combine:t.combine,vertexColors:t.vertexColors,fog:!!s,useFog:t.fog,fogExp:s&&s.isFogExp2,flatShading:t.flatShading,sizeAttenuation:t.sizeAttenuation,logarithmicDepthBuffer:n.logarithmicDepthBuffer,skinning:t.skinning&&p>0,maxBones:p,useVertexTexture:n.floatVertexTextures,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:r.directional.length,numPointLights:r.point.length,numSpotLights:r.spot.length,numRectAreaLights:r.rectArea.length,numHemiLights:r.hemi.length,numClippingPlanes:c,numClipIntersection:l,dithering:t.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.receiveShadow&&a.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:t.side===j,flipSided:t.side===H,depthPacking:void 0!==t.depthPacking&&t.depthPacking}},this.getProgramCode=function(t,n){var r=[];if(n.shaderID?r.push(n.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)r.push(i),r.push(t.defines[i]);for(var o=0;o<a.length;o++)r.push(n[a[o]]);return r.push(t.onBeforeCompile.toString()),r.push(e.gammaOutput),r.push(e.gammaFactor),r.join()},this.acquireProgram=function(i,a,o,s){for(var c,l=0,u=r.length;l<u;l++){var h=r[l];if(h.code===s){++(c=h).usedTimes;break}}return void 0===c&&(c=new Wi(e,t,s,i,a,o,n),r.push(c)),c},this.releaseProgram=function(e){if(0==--e.usedTimes){var t=r.indexOf(e);r[t]=r[r.length-1],r.pop(),e.destroy()}},this.programs=r}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,r){e.get(t)[n]=r},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!==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=[],r=[];function i(n,r,i,a,o,s){var c=e[t];return void 0===c?(c={id:n.id,object:n,geometry:r,material:i,program:i.program,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},e[t]=c):(c.id=n.id,c.object=n,c.geometry=r,c.material=i,c.program=i.program,c.groupOrder=a,c.renderOrder=n.renderOrder,c.z=o,c.group=s),t++,c}return{opaque:n,transparent:r,init:function(){t=0,n.length=0,r.length=0},push:function(e,t,a,o,s,c){var l=i(e,t,a,o,s,c);(!0===a.transparent?r:n).push(l)},unshift:function(e,t,a,o,s,c){var l=i(e,t,a,o,s,c);(!0===a.transparent?r:n).unshift(l)},sort:function(){n.length>1&&n.sort(Yi),r.length>1&&r.sort(Ji)}}}function Ki(){var e={};function t(n){var r=n.target;r.removeEventListener("dispose",t),delete e[r.id]}return{get:function(n,r){var i,a=e[n.id];return void 0===a?(i=new Zi,e[n.id]={},e[n.id][r.id]=i,n.addEventListener("dispose",t)):void 0===(i=a[r.id])&&(i=new Zi,a[r.id]=i),i},dispose:function(){e={}}}}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 an,color:new On,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new tn};break;case"SpotLight":n={position:new an,direction:new an,color:new On,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new tn};break;case"PointLight":n={position:new an,color:new On,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new tn,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":n={direction:new an,skyColor:new On,groundColor:new On};break;case"RectAreaLight":n={color:new On,position:new an,halfWidth:new an,halfHeight:new an}}return e[t.id]=n,n}}}var $i=0;function ea(){var e=new Qi,t={id:$i++,hash:{stateID:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,shadowsLength:-1},ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},n=new an,r=new nn,i=new nn;return{setup:function(a,o,s){for(var c=0,l=0,u=0,h=0,p=0,d=0,f=0,m=0,v=s.matrixWorldInverse,g=0,y=a.length;g<y;g++){var x=a[g],b=x.color,w=x.intensity,_=x.distance,M=x.shadow&&x.shadow.map?x.shadow.map.texture:null;if(x.isAmbientLight)c+=b.r*w,l+=b.g*w,u+=b.b*w;else if(x.isDirectionalLight){if((T=e.get(x)).color.copy(x.color).multiplyScalar(x.intensity),T.direction.setFromMatrixPosition(x.matrixWorld),n.setFromMatrixPosition(x.target.matrixWorld),T.direction.sub(n),T.direction.transformDirection(v),T.shadow=x.castShadow,x.castShadow){var S=x.shadow;T.shadowBias=S.bias,T.shadowRadius=S.radius,T.shadowMapSize=S.mapSize}t.directionalShadowMap[h]=M,t.directionalShadowMatrix[h]=x.shadow.matrix,t.directional[h]=T,h++}else if(x.isSpotLight)(T=e.get(x)).position.setFromMatrixPosition(x.matrixWorld),T.position.applyMatrix4(v),T.color.copy(b).multiplyScalar(w),T.distance=_,T.direction.setFromMatrixPosition(x.matrixWorld),n.setFromMatrixPosition(x.target.matrixWorld),T.direction.sub(n),T.direction.transformDirection(v),T.coneCos=Math.cos(x.angle),T.penumbraCos=Math.cos(x.angle*(1-x.penumbra)),T.decay=x.decay,T.shadow=x.castShadow,x.castShadow&&(S=x.shadow,T.shadowBias=S.bias,T.shadowRadius=S.radius,T.shadowMapSize=S.mapSize),t.spotShadowMap[d]=M,t.spotShadowMatrix[d]=x.shadow.matrix,t.spot[d]=T,d++;else if(x.isRectAreaLight)(T=e.get(x)).color.copy(b).multiplyScalar(w),T.position.setFromMatrixPosition(x.matrixWorld),T.position.applyMatrix4(v),i.identity(),r.copy(x.matrixWorld),r.premultiply(v),i.extractRotation(r),T.halfWidth.set(.5*x.width,0,0),T.halfHeight.set(0,.5*x.height,0),T.halfWidth.applyMatrix4(i),T.halfHeight.applyMatrix4(i),t.rectArea[f]=T,f++;else if(x.isPointLight)(T=e.get(x)).position.setFromMatrixPosition(x.matrixWorld),T.position.applyMatrix4(v),T.color.copy(x.color).multiplyScalar(x.intensity),T.distance=x.distance,T.decay=x.decay,T.shadow=x.castShadow,x.castShadow&&(S=x.shadow,T.shadowBias=S.bias,T.shadowRadius=S.radius,T.shadowMapSize=S.mapSize,T.shadowCameraNear=S.camera.near,T.shadowCameraFar=S.camera.far),t.pointShadowMap[p]=M,t.pointShadowMatrix[p]=x.shadow.matrix,t.point[p]=T,p++;else if(x.isHemisphereLight){var T;(T=e.get(x)).direction.setFromMatrixPosition(x.matrixWorld),T.direction.transformDirection(v),T.direction.normalize(),T.skyColor.copy(x.color).multiplyScalar(w),T.groundColor.copy(x.groundColor).multiplyScalar(w),t.hemi[m]=T,m++}}t.ambient[0]=c,t.ambient[1]=l,t.ambient[2]=u,t.directional.length=h,t.spot.length=d,t.rectArea.length=f,t.point.length=p,t.hemi.length=m,t.hash.stateID=t.id,t.hash.directionalLength=h,t.hash.pointLength=p,t.hash.spotLength=d,t.hash.rectAreaLength=f,t.hash.hemiLength=m,t.hash.shadowsLength=o.length},state:t}}function ta(){var e=new ea,t=[],n=[];return{init:function(){t.length=0,n.length=0},state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:function(r){e.setup(t,n,r)},pushLight:function(e){t.push(e)},pushShadow:function(e){n.push(e)}}}function na(){var e={};function t(n){var r=n.target;r.removeEventListener("dispose",t),delete e[r.id]}return{get:function(n,r){var i;return void 0===e[n.id]?(i=new ta,e[n.id]={},e[n.id][r.id]=i,n.addEventListener("dispose",t)):void 0===e[n.id][r.id]?(i=new ta,e[n.id][r.id]=i):i=e[n.id][r.id],i},dispose:function(){e={}}}}function ra(e){Er.call(this),this.type="MeshDepthMaterial",this.depthPacking=Zt,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.lights=!1,this.setValues(e)}function ia(e){Er.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new an,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.lights=!1,this.setValues(e)}function aa(e,t,n){for(var r=new Mn,i=new nn,a=new tn,o=new tn(n,n),s=new an,c=new an,l=1,u=2,h=1+(l|u),p=new Array(h),d=new Array(h),f={},m={0:H,1:G,2:j},v=[new an(1,0,0),new an(-1,0,0),new an(0,0,1),new an(0,0,-1),new an(0,1,0),new an(0,-1,0)],g=[new an(0,1,0),new an(0,1,0),new an(0,1,0),new an(0,1,0),new an(0,0,1),new an(0,0,-1)],y=[new mn,new mn,new mn,new mn,new mn,new mn],x=0;x!==h;++x){var b=0!=(x&l),w=0!=(x&u),_=new ra({depthPacking:Kt,morphTargets:b,skinning:w});p[x]=_;var M=new ia({morphTargets:b,skinning:w});d[x]=M}var S=this;function T(t,n,r,i,a,o){var s=t.geometry,c=null,h=p,v=t.customDepthMaterial;if(r&&(h=d,v=t.customDistanceMaterial),v)c=v;else{var g=!1;n.morphTargets&&(s&&s.isBufferGeometry?g=s.morphAttributes&&s.morphAttributes.position&&s.morphAttributes.position.length>0:s&&s.isGeometry&&(g=s.morphTargets&&s.morphTargets.length>0)),t.isSkinnedMesh&&!1===n.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t);var y=t.isSkinnedMesh&&n.skinning,x=0;g&&(x|=l),y&&(x|=u),c=h[x]}if(e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var b=c.uuid,w=n.uuid,_=f[b];void 0===_&&(_={},f[b]=_);var M=_[w];void 0===M&&(M=c.clone(),_[w]=M),c=M}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=null!=n.shadowSide?n.shadowSide:m[n.side],c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,r&&c.isMeshDistanceMaterial&&(c.referencePosition.copy(i),c.nearDistance=a,c.farDistance=o),c}function E(n,i,a,o){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&n.castShadow&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var s=t.update(n),l=n.material;if(Array.isArray(l))for(var u=s.groups,h=0,p=u.length;h<p;h++){var d=u[h],f=l[d.materialIndex];if(f&&f.visible){var m=T(n,f,o,c,a.near,a.far);e.renderBufferDirect(a,null,s,m,n,d)}}else if(l.visible){m=T(n,l,o,c,a.near,a.far);e.renderBufferDirect(a,null,s,m,n,null)}}for(var v=n.children,g=0,y=v.length;g<y;g++)E(v[g],i,a,o)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=B,this.render=function(t,n,l){if(!1!==S.enabled&&(!1!==S.autoUpdate||!1!==S.needsUpdate)&&0!==t.length){var u,h=e.state;h.setBlending(X),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);for(var p=0,d=t.length;p<d;p++){var f=t[p],m=f.shadow,x=f&&f.isPointLight;if(void 0!==m){var b=m.camera;if(a.copy(m.mapSize),a.min(o),x){var w=a.x,_=a.y;y[0].set(2*w,_,w,_),y[1].set(0,_,w,_),y[2].set(3*w,_,w,_),y[3].set(w,_,w,_),y[4].set(3*w,0,w,_),y[5].set(w,0,w,_),a.x*=4,a.y*=2}if(null===m.map){var M={minFilter:He,magFilter:He,format:ct};m.map=new vn(a.x,a.y,M),m.map.texture.name=f.name+".shadowMap",b.updateProjectionMatrix()}m.isSpotLightShadow&&m.update(f);var T=m.map,A=m.matrix;c.setFromMatrixPosition(f.matrixWorld),b.position.copy(c),x?(u=6,A.makeTranslation(-c.x,-c.y,-c.z)):(u=1,s.setFromMatrixPosition(f.target.matrixWorld),b.lookAt(s),b.updateMatrixWorld(),A.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),A.multiply(b.projectionMatrix),A.multiply(b.matrixWorldInverse)),e.setRenderTarget(T),e.clear();for(var L=0;L<u;L++){if(x){s.copy(b.position),s.add(v[L]),b.up.copy(g[L]),b.lookAt(s),b.updateMatrixWorld();var P=y[L];h.viewport(P)}i.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse),r.setFromMatrix(i),E(n,l,b,x)}}else console.warn("THREE.WebGLShadowMap:",f,"has no shadow.")}S.needsUpdate=!1}}}function oa(e,t,n,r){var i=new function(){var t=!1,n=new mn,r=null,i=new mn(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,a,o,s){!0===s&&(t*=o,r*=o,a*=o),n.set(t,r,a,o),!1===i.equals(n)&&(e.clearColor(t,r,a,o),i.copy(n))},reset:function(){t=!1,r=null,i.set(-1,0,0,0)}}},a=new function(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){e?V(2929):W(2929)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case me:e.depthFunc(512);break;case ve:e.depthFunc(519);break;case ge:e.depthFunc(513);break;case ye:e.depthFunc(515);break;case xe:e.depthFunc(514);break;case be:e.depthFunc(518);break;case we:e.depthFunc(516);break;case _e:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);r=t}},setLocked:function(e){t=e},setClear:function(t){i!==t&&(e.clearDepth(t),i=t)},reset:function(){t=!1,n=null,r=null,i=null}}},o=new function(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null;return{setTest:function(e){e?V(2960):W(2960)},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,o){r===t&&i===n&&a===o||(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){o===t&&s===n&&c===r||(e.stencilOp(t,n,r),o=t,s=n,c=r)},setLocked:function(e){t=e},setClear:function(t){l!==t&&(e.clearStencil(t),l=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,c=null,l=null}}},s=e.getParameter(34921),c=new Uint8Array(s),l=new Uint8Array(s),u=new Uint8Array(s),h={},p=null,d=null,f=null,m=null,v=null,g=null,y=null,x=null,b=null,w=null,_=!1,M=null,S=null,T=null,E=null,A=null,L=e.getParameter(35661),P=!1,R=0,C=e.getParameter(7938);-1!==C.indexOf("WebGL")?(R=parseFloat(/^WebGL\ ([0-9])/.exec(C)[1]),P=R>=1):-1!==C.indexOf("OpenGL ES")&&(R=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(C)[1]),P=R>=2);var O=null,I={},k=new mn,D=new mn;function B(t,n,r){var i=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<r;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}var F={};function G(n,i){(c[n]=1,0===l[n]&&(e.enableVertexAttribArray(n),l[n]=1),u[n]!==i)&&((r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),u[n]=i)}function V(t){!0!==h[t]&&(e.enable(t),h[t]=!0)}function W(t){!1!==h[t]&&(e.disable(t),h[t]=!1)}function q(t,r,i,a,o,s,c,l){if(t!==X){if(f||(V(3042),f=!0),t===Q)o=o||r,s=s||i,c=c||a,r===v&&o===x||(e.blendEquationSeparate(n.convert(r),n.convert(o)),v=r,x=o),i===g&&a===y&&s===b&&c===w||(e.blendFuncSeparate(n.convert(i),n.convert(a),n.convert(s),n.convert(c)),g=i,y=a,b=s,w=c),m=t,_=null;else if(t!==m||l!==_){if(v===$&&x===$||(e.blendEquation(32774),v=$,x=$),l)switch(t){case Y:e.blendFuncSeparate(1,771,1,771);break;case J:e.blendFunc(1,1);break;case Z:e.blendFuncSeparate(0,0,769,771);break;case K:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case Y:e.blendFuncSeparate(770,771,1,771);break;case J:e.blendFunc(770,1);break;case Z:e.blendFunc(0,769);break;case K:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}g=null,y=null,b=null,w=null,m=t,_=l}}else f&&(W(3042),f=!1)}function ee(t){M!==t&&(t?e.frontFace(2304):e.frontFace(2305),M=t)}function te(t){t!==N?(V(2884),t!==S&&(t===z?e.cullFace(1029):t===U?e.cullFace(1028):e.cullFace(1032))):W(2884),S=t}function ne(t,n,r){t?(V(32823),E===n&&A===r||(e.polygonOffset(n,r),E=n,A=r)):W(32823)}function re(t){void 0===t&&(t=33984+L-1),O!==t&&(e.activeTexture(t),O=t)}return F[3553]=B(3553,3553,1),F[34067]=B(34067,34069,6),i.setClear(0,0,0,1),a.setClear(1),o.setClear(0),V(2929),a.setFunc(ye),ee(!1),te(z),V(2884),q(X),{buffers:{color:i,depth:a,stencil:o},initAttributes:function(){for(var e=0,t=c.length;e<t;e++)c[e]=0},enableAttribute:function(e){G(e,0)},enableAttributeAndDivisor:G,disableUnusedAttributes:function(){for(var t=0,n=l.length;t!==n;++t)l[t]!==c[t]&&(e.disableVertexAttribArray(t),l[t]=0)},enable:V,disable:W,getCompressedTextureFormats:function(){if(null===p&&(p=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")||t.get("WEBGL_compressed_texture_etc1")||t.get("WEBGL_compressed_texture_astc")))for(var n=e.getParameter(34467),r=0;r<n.length;r++)p.push(n[r]);return p},useProgram:function(t){return d!==t&&(e.useProgram(t),d=t,!0)},setBlending:q,setMaterial:function(e,t){e.side===j?W(2884):V(2884);var n=e.side===H;t&&(n=!n),ee(n),e.blending===Y&&!1===e.transparent?q(X):q(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),i.setMask(e.colorWrite),ne(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:ee,setCullFace:te,setLineWidth:function(t){t!==T&&(P&&e.lineWidth(t),T=t)},setPolygonOffset:ne,setScissorTest:function(e){e?V(3089):W(3089)},activeTexture:re,bindTexture:function(t,n){null===O&&re();var r=I[O];void 0===r&&(r={type:void 0,texture:void 0},I[O]=r),r.type===t&&r.texture===n||(e.bindTexture(t,n||F[t]),r.type=t,r.texture=n)},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===k.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),k.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<l.length;t++)1===l[t]&&(e.disableVertexAttribArray(t),l[t]=0);h={},p=null,O=null,I={},d=null,m=null,M=null,S=null,i.reset(),a.reset(),o.reset()}}}function sa(e,t,n,r,i,a,o){var s,c={};function l(e,t,n,r){var i=1;if((e.width>r||e.height>r)&&(i=r/Math.max(e.width,e.height)),i<1||!0===t){if(_instanceof(e,HTMLImageElement)||_instanceof(e,HTMLCanvasElement)||_instanceof(e,ImageBitmap)){void 0===s&&(s=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"));var a=n?document.createElementNS("http://www.w3.org/1999/xhtml","canvas"):s,o=t?en.floorPowerOfTwo:Math.floor;return a.width=o(i*e.width),a.height=o(i*e.height),a.getContext("2d").drawImage(e,0,0,a.width,a.height),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+a.width+"x"+a.height+")."),a}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function u(e){return en.isPowerOfTwo(e.width)&&en.isPowerOfTwo(e.height)}function h(e,t){return e.generateMipmaps&&t&&e.minFilter!==He&&e.minFilter!==We}function p(t,n,i,a){e.generateMipmap(t),r.get(n).__maxMipLevel=Math.log(Math.max(i,a))*Math.LOG2E}function d(e,n){if(!i.isWebGL2)return e;var r=e;return 6403===e&&(5126===n&&(r=33326),5131===n&&(r=33325),5121===n&&(r=33321)),6407===e&&(5126===n&&(r=34837),5131===n&&(r=34843),5121===n&&(r=32849)),6408===e&&(5126===n&&(r=34836),5131===n&&(r=34842),5121===n&&(r=32856)),33325===r||33326===r||34842===r||34836===r?t.get("EXT_color_buffer_float"):34843!==r&&34837!==r||console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),r}function f(e){return e===He||e===je||e===Ve?9728:9729}function m(t){var n=t.target;n.removeEventListener("dispose",m),function(t){var n=r.get(t);if(t.image&&n.__image__webglTextureCube)e.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture)}r.remove(t)}(n),n.isVideoTexture&&delete c[n.id],o.memory.textures--}function v(t){var n=t.target;n.removeEventListener("dispose",v),function(t){var n=r.get(t),i=r.get(t.texture);if(!t)return;void 0!==i.__webglTexture&&e.deleteTexture(i.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)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);r.remove(t.texture),r.remove(t)}(n),o.memory.textures--}function g(e,t){var i=r.get(e);if(e.isVideoTexture&&function(e){var t=e.id,n=o.render.frame;c[t]!==n&&(c[t]=n,e.update())}(e),e.version>0&&i.__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 x(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}function y(n,o,s){var c;if(s?(e.texParameteri(n,10242,a.convert(o.wrapS)),e.texParameteri(n,10243,a.convert(o.wrapT)),e.texParameteri(n,10240,a.convert(o.magFilter)),e.texParameteri(n,10241,a.convert(o.minFilter))):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),o.wrapS===Fe&&o.wrapT===Fe||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,f(o.magFilter)),e.texParameteri(n,10241,f(o.minFilter)),o.minFilter!==He&&o.minFilter!==We&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),c=t.get("EXT_texture_filter_anisotropic")){if(o.type===et&&null===t.get("OES_texture_float_linear"))return;if(o.type===tt&&null===(i.isWebGL2||t.get("OES_texture_half_float_linear")))return;(o.anisotropy>1||r.get(o).__currentAnisotropy)&&(e.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,i.getMaxAnisotropy())),r.get(o).__currentAnisotropy=o.anisotropy)}}function x(t,r,s){var c;c=r.isDataTexture3D?32879:3553,void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",m),t.__webglTexture=e.createTexture(),o.memory.textures++),n.activeTexture(33984+s),n.bindTexture(c,t.__webglTexture),e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment);var f=function(e){return!i.isWebGL2&&(e.wrapS!==Fe||e.wrapT!==Fe||e.minFilter!==He&&e.minFilter!==We)}(r)&&!1===u(r.image),v=l(r.image,f,!1,i.maxTextureSize),g=u(v)||i.isWebGL2,x=a.convert(r.format),b=a.convert(r.type),w=d(x,b);y(c,r,g);var _,M=r.mipmaps;if(r.isDepthTexture){if(w=6402,r.type===et){if(!i.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");w=36012}else i.isWebGL2&&(w=33189);r.format===pt&&6402===w&&r.type!==Ke&&r.type!==$e&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Ke,b=a.convert(r.type)),r.format===dt&&(w=34041,r.type!==at&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=at,b=a.convert(r.type))),n.texImage2D(3553,0,w,v.width,v.height,0,x,b,null)}else if(r.isDataTexture)if(M.length>0&&g){for(var S=0,T=M.length;S<T;S++)_=M[S],n.texImage2D(3553,S,w,_.width,_.height,0,x,b,_.data);r.generateMipmaps=!1,t.__maxMipLevel=M.length-1}else n.texImage2D(3553,0,w,v.width,v.height,0,x,b,v.data),t.__maxMipLevel=0;else if(r.isCompressedTexture){for(S=0,T=M.length;S<T;S++)_=M[S],r.format!==ct&&r.format!==st?n.getCompressedTextureFormats().indexOf(x)>-1?n.compressedTexImage2D(3553,S,w,_.width,_.height,0,_.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,S,w,_.width,_.height,0,x,b,_.data);t.__maxMipLevel=M.length-1}else if(r.isDataTexture3D)n.texImage3D(32879,0,w,v.width,v.height,v.depth,0,x,b,v.data),t.__maxMipLevel=0;else if(M.length>0&&g){for(S=0,T=M.length;S<T;S++)_=M[S],n.texImage2D(3553,S,w,x,b,_);r.generateMipmaps=!1,t.__maxMipLevel=M.length-1}else n.texImage2D(3553,0,w,x,b,v),t.__maxMipLevel=0;h(r,g)&&p(3553,r,v.width,v.height),t.__version=r.version,r.onUpdate&&r.onUpdate(r)}function b(t,i,o,s){var c=a.convert(i.texture.format),l=a.convert(i.texture.type),u=d(c,l);n.texImage2D(s,0,u,i.width,i.height,0,c,l,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,r.get(i.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function w(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){if(r){var i=M(n);e.renderbufferStorageMultisample(36161,i,33189,n.width,n.height)}else e.renderbufferStorage(36161,33189,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(r){i=M(n);e.renderbufferStorageMultisample(36161,i,34041,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var o=d(a.convert(n.texture.format),a.convert(n.texture.type));if(r){i=M(n);e.renderbufferStorageMultisample(36161,i,o,n.width,n.height)}else e.renderbufferStorage(36161,o,n.width,n.height)}e.bindRenderbuffer(36161,null)}function _(t){var n=r.get(t),i=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLRenderTargetCube)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");r.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),g(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===pt)e.framebufferTexture2D(36160,36096,3553,i,0);else{if(n.depthTexture.format!==dt)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,i,0)}}(n.__webglFramebuffer,t)}else if(i){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),w(n.__webglDepthbuffer[a],t)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),w(n.__webglDepthbuffer,t);e.bindFramebuffer(36160,null)}function M(e){return i.isWebGL2&&e.isWebGLMultisampleRenderTarget?Math.min(i.maxSamples,e.samples):0}this.setTexture2D=g,this.setTexture3D=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?x(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=function(t,s){var c=r.get(t);if(6===t.image.length)if(t.version>0&&c.__version!==t.version){c.__image__webglTextureCube||(t.addEventListener("dispose",m),c.__image__webglTextureCube=e.createTexture(),o.memory.textures++),n.activeTexture(33984+s),n.bindTexture(34067,c.__image__webglTextureCube),e.pixelStorei(37440,t.flipY);for(var f=t&&t.isCompressedTexture,v=t.image[0]&&t.image[0].isDataTexture,g=[],x=0;x<6;x++)g[x]=f||v?v?t.image[x].image:t.image[x]:l(t.image[x],!1,!0,i.maxCubemapSize);var b=g[0],w=u(b)||i.isWebGL2,_=a.convert(t.format),M=a.convert(t.type),S=d(_,M);for(y(34067,t,w),x=0;x<6;x++)if(f)for(var T,E=g[x].mipmaps,A=0,L=E.length;A<L;A++)T=E[A],t.format!==ct&&t.format!==st?n.getCompressedTextureFormats().indexOf(_)>-1?n.compressedTexImage2D(34069+x,A,S,T.width,T.height,0,T.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+x,A,S,T.width,T.height,0,_,M,T.data);else v?n.texImage2D(34069+x,0,S,g[x].width,g[x].height,0,_,M,g[x].data):n.texImage2D(34069+x,0,S,_,M,g[x]);c.__maxMipLevel=f?E.length-1:0,h(t,w)&&p(34067,t,b.width,b.height),c.__version=t.version,t.onUpdate&&t.onUpdate(t)}else n.activeTexture(33984+s),n.bindTexture(34067,c.__image__webglTextureCube)},this.setTextureCubeDynamic=function(e,t){n.activeTexture(33984+t),n.bindTexture(34067,r.get(e).__webglTexture)},this.setupRenderTarget=function(t){var s=r.get(t),c=r.get(t.texture);t.addEventListener("dispose",v),c.__webglTexture=e.createTexture(),o.memory.textures++;var l=!0===t.isWebGLRenderTargetCube,f=!0===t.isWebGLMultisampleRenderTarget,m=u(t)||i.isWebGL2;if(l){s.__webglFramebuffer=[];for(var g=0;g<6;g++)s.__webglFramebuffer[g]=e.createFramebuffer()}else if(s.__webglFramebuffer=e.createFramebuffer(),f)if(i.isWebGL2){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,s.__webglColorRenderbuffer);var x=d(a.convert(t.texture.format),a.convert(t.texture.type)),S=M(t);e.renderbufferStorageMultisample(36161,S,x,t.width,t.height),e.bindFramebuffer(36160,s.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,s.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(s.__webglDepthRenderbuffer=e.createRenderbuffer(),w(s.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(l){for(n.bindTexture(34067,c.__webglTexture),y(34067,t.texture,m),g=0;g<6;g++)b(s.__webglFramebuffer[g],t,36064,34069+g);h(t.texture,m)&&p(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,c.__webglTexture),y(3553,t.texture,m),b(s.__webglFramebuffer,t,36064,3553),h(t.texture,m)&&p(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&_(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(h(t,u(e)||i.isWebGL2)){var a=e.isWebGLRenderTargetCube?34067:3553,o=r.get(t).__webglTexture;n.bindTexture(a,o),p(a,t,e.width,e.height),n.bindTexture(a,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(i.isWebGL2){var n=r.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var a=t.width,o=t.height,s=16384;t.depthBuffer&&(s|=256),t.stencilBuffer&&(s|=1024),e.blitFramebuffer(0,0,a,o,0,0,a,o,s,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}}function ca(e,t,n){return{convert:function(e){var r;if(e===Be)return 10497;if(e===Fe)return 33071;if(e===Ge)return 33648;if(e===He)return 9728;if(e===je)return 9984;if(e===Ve)return 9986;if(e===We)return 9729;if(e===qe)return 9985;if(e===Xe)return 9987;if(e===Ye)return 5121;if(e===nt)return 32819;if(e===rt)return 32820;if(e===it)return 33635;if(e===Je)return 5120;if(e===Ze)return 5122;if(e===Ke)return 5123;if(e===Qe)return 5124;if(e===$e)return 5125;if(e===et)return 5126;if(e===tt){if(n.isWebGL2)return 5131;if(null!==(r=t.get("OES_texture_half_float")))return r.HALF_FLOAT_OES}if(e===ot)return 6406;if(e===st)return 6407;if(e===ct)return 6408;if(e===lt)return 6409;if(e===ut)return 6410;if(e===pt)return 6402;if(e===dt)return 34041;if(e===ft)return 6403;if(e===$)return 32774;if(e===ee)return 32778;if(e===te)return 32779;if(e===ie)return 0;if(e===ae)return 1;if(e===oe)return 768;if(e===se)return 769;if(e===ce)return 770;if(e===le)return 771;if(e===ue)return 772;if(e===he)return 773;if(e===pe)return 774;if(e===de)return 775;if(e===fe)return 776;if((e===mt||e===vt||e===gt||e===yt)&&null!==(r=t.get("WEBGL_compressed_texture_s3tc"))){if(e===mt)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===vt)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===gt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===yt)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((e===xt||e===bt||e===wt||e===_t)&&null!==(r=t.get("WEBGL_compressed_texture_pvrtc"))){if(e===xt)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===bt)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===wt)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===_t)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===Mt&&null!==(r=t.get("WEBGL_compressed_texture_etc1")))return r.COMPRESSED_RGB_ETC1_WEBGL;if((e===St||e===Tt||e===Et||e===At||e===Lt||e===Pt||e===Rt||e===Ct||e===Ot||e===It||e===kt||e===Dt||e===Nt||e===zt)&&null!==(r=t.get("WEBGL_compressed_texture_astc")))return e;if(e===ne||e===re){if(n.isWebGL2){if(e===ne)return 32775;if(e===re)return 32776}if(null!==(r=t.get("EXT_blend_minmax"))){if(e===ne)return r.MIN_EXT;if(e===re)return r.MAX_EXT}}if(e===at){if(n.isWebGL2)return 34042;if(null!==(r=t.get("WEBGL_depth_texture")))return r.UNSIGNED_INT_24_8_WEBGL}return 0}}}function la(){Vn.call(this),this.type="Group"}function ua(){Vn.call(this),this.type="Camera",this.matrixWorldInverse=new nn,this.projectionMatrix=new nn,this.projectionMatrixInverse=new nn}function ha(e,t,n,r){ua.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!==r?r:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function pa(e){ha.call(this),this.cameras=e||[]}ra.prototype=Object.create(Er.prototype),ra.prototype.constructor=ra,ra.prototype.isMeshDepthMaterial=!0,ra.prototype.copy=function(e){return Er.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},ia.prototype=Object.create(Er.prototype),ia.prototype.constructor=ia,ia.prototype.isMeshDistanceMaterial=!0,ia.prototype.copy=function(e){return Er.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},la.prototype=Object.assign(Object.create(Vn.prototype),{constructor:la,isGroup:!0}),ua.prototype=Object.assign(Object.create(Vn.prototype),{constructor:ua,isCamera:!0,copy:function(e,t){return Vn.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 an),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){Vn.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),ha.prototype=Object.assign(Object.create(ua.prototype),{constructor:ha,isPerspectiveCamera:!0,copy:function(e,t){return ua.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*en.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*en.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*en.RAD2DEG*Math.atan(Math.tan(.5*en.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,r,i,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=r,this.view.width=i,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*en.DEG2RAD*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var c=this.filmOffset;0!==c&&(i+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Vn.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}}),pa.prototype=Object.assign(Object.create(ha.prototype),{constructor:pa,isArrayCamera:!0});var da,fa,ma,va,ga,ya,xa=new an,ba=new an;function wa(e,t,n){xa.setFromMatrixPosition(t.matrixWorld),ba.setFromMatrixPosition(n.matrixWorld);var r=xa.distanceTo(ba),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],h=(a[8]+1)/a[0],p=o*u,d=o*h,f=r/(-u+h),m=f*-u;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 v=o+f,g=s+f,y=p-m,x=d+(r-m),b=c*s/g*v,w=l*s/g*v;e.projectionMatrix.makePerspective(y,x,b,w,v,g)}function _a(e){var t=this,n=null,r=null,i=null,a=[],o=new nn,s=new nn,c=1,l="stage";"undefined"!=typeof window&&"VRFrameData"in window&&(r=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",x,!1));var u=new nn,h=new rn,p=new an,d=new ha;d.bounds=new mn(0,0,.5,1),d.layers.enable(1);var f=new ha;f.bounds=new mn(.5,0,.5,1),f.layers.enable(2);var m,v,g=new pa([d,f]);function y(){return null!==n&&!0===n.isPresenting}function x(){if(y()){var r=n.getEyeParameters("left"),i=r.renderWidth*c,a=r.renderHeight*c;v=e.getPixelRatio(),m=e.getSize(),e.setDrawingBufferSize(2*i,a,1),_.start()}else t.enabled&&e.setDrawingBufferSize(m.width,m.height,v),_.stop()}g.layers.enable(1),g.layers.enable(2);var b=[];function w(e){for(var t=navigator.getGamepads&&navigator.getGamepads(),n=0,r=0,i=t.length;n<i;n++){var a=t[n];if(a&&("Daydream Controller"===a.id||"Gear VR Controller"===a.id||"Oculus Go Controller"===a.id||"OpenVR Gamepad"===a.id||a.id.startsWith("Oculus Touch")||a.id.startsWith("Spatial Controller"))){if(r===e)return a;r++}}}this.enabled=!1,this.getController=function(e){var t=a[e];return void 0===t&&((t=new la).matrixAutoUpdate=!1,t.visible=!1,a[e]=t),t},this.getDevice=function(){return n},this.setDevice=function(e){void 0!==e&&(n=e),_.setContext(e)},this.setFramebufferScaleFactor=function(e){c=e},this.setFrameOfReferenceType=function(e){l=e},this.setPoseTarget=function(e){void 0!==e&&(i=e)},this.getCamera=function(e){var t="stage"===l?1.6:0;if(null===n)return e.position.set(0,t,0),e;if(n.depthNear=e.near,n.depthFar=e.far,n.getFrameData(r),"stage"===l){var c=n.stageParameters;c?o.fromArray(c.sittingToStandingTransform):o.makeTranslation(0,t,0)}var m=r.pose,v=null!==i?i:e;if(v.matrix.copy(o),v.matrix.decompose(v.position,v.quaternion,v.scale),null!==m.orientation&&(h.fromArray(m.orientation),v.quaternion.multiply(h)),null!==m.position&&(h.setFromRotationMatrix(o),p.fromArray(m.position),p.applyQuaternion(h),v.position.add(p)),v.updateMatrixWorld(),!1===n.isPresenting)return e;d.near=e.near,f.near=e.near,d.far=e.far,f.far=e.far,d.matrixWorldInverse.fromArray(r.leftViewMatrix),f.matrixWorldInverse.fromArray(r.rightViewMatrix),s.getInverse(o),"stage"===l&&(d.matrixWorldInverse.multiply(s),f.matrixWorldInverse.multiply(s));var y=v.parent;null!==y&&(u.getInverse(y.matrixWorld),d.matrixWorldInverse.multiply(u),f.matrixWorldInverse.multiply(u)),d.matrixWorld.getInverse(d.matrixWorldInverse),f.matrixWorld.getInverse(f.matrixWorldInverse),d.projectionMatrix.fromArray(r.leftProjectionMatrix),f.projectionMatrix.fromArray(r.rightProjectionMatrix),wa(g,d,f);var x=n.getLayers();if(x.length){var _=x[0];null!==_.leftBounds&&4===_.leftBounds.length&&d.bounds.fromArray(_.leftBounds),null!==_.rightBounds&&4===_.rightBounds.length&&f.bounds.fromArray(_.rightBounds)}return function(){for(var e=0;e<a.length;e++){var t=a[e],n=w(e);if(void 0!==n&&void 0!==n.pose){if(null===n.pose)return;var r=n.pose;!1===r.hasPosition&&t.position.set(.2,-.6,-.05),null!==r.position&&t.position.fromArray(r.position),null!==r.orientation&&t.quaternion.fromArray(r.orientation),t.matrix.compose(t.position,t.quaternion,t.scale),t.matrix.premultiply(o),t.matrix.decompose(t.position,t.quaternion,t.scale),t.matrixWorldNeedsUpdate=!0,t.visible=!0;var i="Daydream Controller"===n.id?0:1;b[e]!==n.buttons[i].pressed&&(b[e]=n.buttons[i].pressed,!0===b[e]?t.dispatchEvent({type:"selectstart"}):(t.dispatchEvent({type:"selectend"}),t.dispatchEvent({type:"select"})))}else t.visible=!1}}(),g},this.getStandingMatrix=function(){return o},this.isPresenting=y;var _=new Nn;this.setAnimationLoop=function(e){_.setAnimationLoop(e)},this.submitFrame=function(){y()&&n.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",x)}}function Ma(e){var t=e.context,n=null,r=null,i=1,a=null,o="stage",s=null,c=[],l=[];function u(){return null!==r&&null!==a}var h=new ha;h.layers.enable(1),h.viewport=new mn;var p=new ha;p.layers.enable(2),p.viewport=new mn;var d=new pa([h,p]);function f(e){var t=c[l.indexOf(e.inputSource)];t&&t.dispatchEvent({type:e.type})}function m(){e.setFramebuffer(null),y.stop()}function v(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}d.layers.enable(1),d.layers.enable(2),this.enabled=!1,this.getController=function(e){var t=c[e];return void 0===t&&((t=new la).matrixAutoUpdate=!1,t.visible=!1,c[e]=t),t},this.getDevice=function(){return n},this.setDevice=function(e){void 0!==e&&(n=e),_instanceof(e,XRDevice)&&t.setCompatibleXRDevice(e)},this.setFramebufferScaleFactor=function(e){i=e},this.setFrameOfReferenceType=function(e){o=e},this.setSession=function(n){null!==(r=n)&&(r.addEventListener("select",f),r.addEventListener("selectstart",f),r.addEventListener("selectend",f),r.addEventListener("end",m),r.baseLayer=new XRWebGLLayer(r,t,{framebufferScaleFactor:i}),r.requestFrameOfReference(o).then(function(t){a=t,e.setFramebuffer(r.baseLayer.framebuffer),y.setContext(r),y.start()}),l=r.getInputSources(),r.addEventListener("inputsourceschange",function(){l=r.getInputSources(),console.log(l);for(var e=0;e<c.length;e++){c[e].userData.inputSource=l[e]}}))},this.getCamera=function(e){if(u()){var t=e.parent,n=d.cameras;v(d,t);for(var r=0;r<n.length;r++)v(n[r],t);e.matrixWorld.copy(d.matrixWorld);for(var i=e.children,a=(r=0,i.length);r<a;r++)i[r].updateMatrixWorld(!0);return wa(d,h,p),d}return e},this.isPresenting=u;var g=null;var y=new Nn;y.setAnimationLoop(function(e,t){if(null!==(s=t.getDevicePose(a)))for(var n=r.baseLayer,i=t.views,o=0;o<i.length;o++){var u=i[o],h=n.getViewport(u),p=s.getViewMatrix(u),f=d.cameras[o];f.matrix.fromArray(p).getInverse(f.matrix),f.projectionMatrix.fromArray(u.projectionMatrix),f.viewport.set(h.x,h.y,h.width,h.height),0===o&&d.matrix.copy(f.matrix)}for(o=0;o<c.length;o++){var m=c[o],v=l[o];if(v){var y=t.getInputPose(v,a);if(null!==y){"targetRay"in y?m.matrix.elements=y.targetRay.transformMatrix:"pointerMatrix"in y&&(m.matrix.elements=y.pointerMatrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.visible=!0;continue}}m.visible=!1}g&&g(e)}),this.setAnimationLoop=function(e){g=e},this.dispose=function(){},this.getStandingMatrix=function(){return console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed."),new THREE.Matrix4},this.submitFrame=function(){}}function Sa(e){console.log("THREE.WebGLRenderer",D);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,r=void 0!==e.alpha&&e.alpha,i=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,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,l=void 0!==e.powerPreference?e.powerPreference:"default",u=null,h=null;this.domElement=t,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Ae,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var p,d,f,m,v,g,y,x,b,w,_,M,S,T,E,A,L,P,R=this,C=!1,O=null,I=null,k=null,N=-1,z={geometry:null,program:null,wireframe:!1},U=null,B=null,F=new mn,G=new mn,j=null,V=0,W=t.width,q=t.height,X=1,Y=new mn(0,0,W,q),J=new mn(0,0,W,q),Z=!1,K=new Mn,Q=new Dr,$=!1,ee=!1,te=new nn,ne=new an;function re(){return null===I?X:1}try{var ie={alpha:r,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l};if(t.addEventListener("webglcontextlost",ce,!1),t.addEventListener("webglcontextrestored",le,!1),null===(p=n||t.getContext("webgl",ie)||t.getContext("experimental-webgl",ie)))throw null!==t.getContext("webgl")?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");void 0===p.getShaderPrecisionFormat&&(p.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){console.error("THREE.WebGLRenderer: "+e.message)}function ae(){d=new Nr(p),(f=new kr(p,d,e)).isWebGL2||(d.get("WEBGL_depth_texture"),d.get("OES_texture_float"),d.get("OES_texture_half_float"),d.get("OES_texture_half_float_linear"),d.get("OES_standard_derivatives"),d.get("OES_element_index_uint"),d.get("ANGLE_instanced_arrays")),d.get("OES_texture_float_linear"),P=new ca(p,d,f),(m=new oa(p,d,P,f)).scissor(G.copy(J).multiplyScalar(X)),m.viewport(F.copy(Y).multiplyScalar(X)),v=new Br(p),g=new Xi,y=new sa(p,d,m,g,f,P,v),x=new zn(p),b=new zr(p,x,v),w=new Hr(b,v),E=new Gr(p),_=new qi(R,d,f),M=new Ki,S=new na,T=new Or(R,m,w,s),A=new Ir(p,d,v,f),L=new Ur(p,d,v,f),v.programs=_.programs,R.context=p,R.capabilities=f,R.extensions=d,R.properties=g,R.renderLists=M,R.state=m,R.info=v}ae();var oe=null;"undefined"!=typeof navigator&&(oe="xr"in navigator?new Ma(R):new _a(R)),this.vr=oe;var se=new aa(R,w,f.maxTextureSize);function ce(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),C=!0}function le(){console.log("THREE.WebGLRenderer: Context Restored."),C=!1,ae()}function ue(e){var t=e.target;t.removeEventListener("dispose",ue),function(e){he(e),g.remove(e)}(t)}function he(e){var t=g.get(e).program;e.program=void 0,void 0!==t&&_.releaseProgram(t)}this.shadowMap=se,this.getContext=function(){return p},this.getContextAttributes=function(){return p.getContextAttributes()},this.forceContextLoss=function(){var e=d.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=d.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return X},this.setPixelRatio=function(e){void 0!==e&&(X=e,this.setSize(W,q,!1))},this.getSize=function(){return{width:W,height:q}},this.setSize=function(e,n,r){oe.isPresenting()?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(W=e,q=n,t.width=e*X,t.height=n*X,!1!==r&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(){return{width:W*X,height:q*X}},this.setDrawingBufferSize=function(e,n,r){W=e,q=n,X=r,t.width=e*r,t.height=n*r,this.setViewport(0,0,e,n)},this.getCurrentViewport=function(){return F},this.setViewport=function(e,t,n,r){Y.set(e,q-t-r,n,r),m.viewport(F.copy(Y).multiplyScalar(X))},this.setScissor=function(e,t,n,r){J.set(e,q-t-r,n,r),m.scissor(G.copy(J).multiplyScalar(X))},this.setScissorTest=function(e){m.setScissorTest(Z=e)},this.getClearColor=function(){return T.getClearColor()},this.setClearColor=function(){T.setClearColor.apply(T,arguments)},this.getClearAlpha=function(){return T.getClearAlpha()},this.setClearAlpha=function(){T.setClearAlpha.apply(T,arguments)},this.clear=function(e,t,n){var r=0;(void 0===e||e)&&(r|=16384),(void 0===t||t)&&(r|=256),(void 0===n||n)&&(r|=1024),p.clear(r)},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",ce,!1),t.removeEventListener("webglcontextrestored",le,!1),M.dispose(),S.dispose(),g.dispose(),w.dispose(),oe.dispose(),fe.stop()},this.renderBufferImmediate=function(e,t){m.initAttributes();var n=g.get(e);e.hasPositions&&!n.position&&(n.position=p.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=p.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=p.createBuffer()),e.hasColors&&!n.color&&(n.color=p.createBuffer());var r=t.getAttributes();e.hasPositions&&(p.bindBuffer(34962,n.position),p.bufferData(34962,e.positionArray,35048),m.enableAttribute(r.position),p.vertexAttribPointer(r.position,3,5126,!1,0,0)),e.hasNormals&&(p.bindBuffer(34962,n.normal),p.bufferData(34962,e.normalArray,35048),m.enableAttribute(r.normal),p.vertexAttribPointer(r.normal,3,5126,!1,0,0)),e.hasUvs&&(p.bindBuffer(34962,n.uv),p.bufferData(34962,e.uvArray,35048),m.enableAttribute(r.uv),p.vertexAttribPointer(r.uv,2,5126,!1,0,0)),e.hasColors&&(p.bindBuffer(34962,n.color),p.bufferData(34962,e.colorArray,35048),m.enableAttribute(r.color),p.vertexAttribPointer(r.color,3,5126,!1,0,0)),m.disableUnusedAttributes(),p.drawArrays(4,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,r,i,a){var o=i.isMesh&&i.normalMatrix.determinant()<0;m.setMaterial(r,o);var s=ye(e,t,r,i),c=!1;z.geometry===n.id&&z.program===s.id&&z.wireframe===(!0===r.wireframe)||(z.geometry=n.id,z.program=s.id,z.wireframe=!0===r.wireframe,c=!0),i.morphTargetInfluences&&(E.update(i,n,r,s),c=!0);var l,u=n.index,h=n.attributes.position,v=1;!0===r.wireframe&&(u=b.getWireframeAttribute(n),v=2);var g=A;null!==u&&(l=x.get(u),(g=L).setIndex(l)),c&&(!function(e,t,n){if(n&&n.isInstancedBufferGeometry&!f.isWebGL2&&null===d.get("ANGLE_instanced_arrays"))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");m.initAttributes();var r=n.attributes,i=t.getAttributes(),a=e.defaultAttributeValues;for(var o in i){var s=i[o];if(s>=0){var c=r[o];if(void 0!==c){var l=c.normalized,u=c.itemSize,h=x.get(c);if(void 0===h)continue;var v=h.buffer,g=h.type,y=h.bytesPerElement;if(c.isInterleavedBufferAttribute){var b=c.data,w=b.stride,_=c.offset;b&&b.isInstancedInterleavedBuffer?(m.enableAttributeAndDivisor(s,b.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=b.meshPerAttribute*b.count)):m.enableAttribute(s),p.bindBuffer(34962,v),p.vertexAttribPointer(s,u,g,l,w*y,_*y)}else c.isInstancedBufferAttribute?(m.enableAttributeAndDivisor(s,c.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=c.meshPerAttribute*c.count)):m.enableAttribute(s),p.bindBuffer(34962,v),p.vertexAttribPointer(s,u,g,l,0,0)}else if(void 0!==a){var M=a[o];if(void 0!==M)switch(M.length){case 2:p.vertexAttrib2fv(s,M);break;case 3:p.vertexAttrib3fv(s,M);break;case 4:p.vertexAttrib4fv(s,M);break;default:p.vertexAttrib1fv(s,M)}}}}m.disableUnusedAttributes()}(r,s,n),null!==u&&p.bindBuffer(34963,l.buffer));var y=1/0;null!==u?y=u.count:void 0!==h&&(y=h.count);var w=n.drawRange.start*v,_=n.drawRange.count*v,M=null!==a?a.start*v:0,S=null!==a?a.count*v:1/0,T=Math.max(w,M),P=Math.min(y,w+_,M+S)-1,R=Math.max(0,P-T+1);if(0!==R){if(i.isMesh)if(!0===r.wireframe)m.setLineWidth(r.wireframeLinewidth*re()),g.setMode(1);else switch(i.drawMode){case Ft:g.setMode(4);break;case Gt:g.setMode(5);break;case Ht:g.setMode(6)}else if(i.isLine){var C=r.linewidth;void 0===C&&(C=1),m.setLineWidth(C*re()),i.isLineSegments?g.setMode(1):i.isLineLoop?g.setMode(2):g.setMode(3)}else i.isPoints?g.setMode(0):i.isSprite&&g.setMode(4);n&&n.isInstancedBufferGeometry?n.maxInstancedCount>0&&g.renderInstances(n,T,R):g.render(T,R)}},this.compile=function(e,t){(h=S.get(e,t)).init(),e.traverse(function(e){e.isLight&&(h.pushLight(e),e.castShadow&&h.pushShadow(e))}),h.setupLights(t),e.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var n=0;n<t.material.length;n++)ge(t.material[n],e.fog,t);else ge(t.material,e.fog,t)})};var pe=null;var de,fe=new Nn;function me(e,t,n,r){for(var i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,c=o.geometry,l=void 0===r?o.material:r,u=o.group;if(n.isArrayCamera){B=n;for(var p=n.cameras,d=0,f=p.length;d<f;d++){var v=p[d];if(s.layers.test(v.layers)){if("viewport"in v)m.viewport(F.copy(v.viewport));else{var g=v.bounds,y=g.x*W,x=g.y*q,b=g.z*W,w=g.w*q;m.viewport(F.set(y,x,b,w).multiplyScalar(X))}h.setupLights(v),ve(s,t,v,c,l,u)}}}else B=null,ve(s,t,n,c,l,u)}}function ve(e,t,n,r,i,a){if(e.onBeforeRender(R,t,n,r,i,a),h=S.get(t,B||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){m.setMaterial(i);var o=ye(n,t.fog,i,e);z.geometry=null,z.program=null,z.wireframe=!1,function(e,t){e.render(function(e){R.renderBufferImmediate(e,t)})}(e,o)}else R.renderBufferDirect(n,t.fog,r,i,e,a);e.onAfterRender(R,t,n,r,i,a),h=S.get(t,B||n)}function ge(e,t,n){var r=g.get(e),i=h.state.lights,a=h.state.shadowsArray,o=r.lightsHash,s=i.state.hash,c=_.getParameters(e,i.state,a,t,Q.numPlanes,Q.numIntersection,n),l=_.getProgramCode(e,c),u=r.program,p=!0;if(void 0===u)e.addEventListener("dispose",ue);else if(u.code!==l)he(e);else if(o.stateID!==s.stateID||o.directionalLength!==s.directionalLength||o.pointLength!==s.pointLength||o.spotLength!==s.spotLength||o.rectAreaLength!==s.rectAreaLength||o.hemiLength!==s.hemiLength||o.shadowsLength!==s.shadowsLength)o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,p=!1;else{if(void 0!==c.shaderID)return;p=!1}if(p){if(c.shaderID){var d=Dn[c.shaderID];r.shader={name:e.type,uniforms:Tn(d.uniforms),vertexShader:d.vertexShader,fragmentShader:d.fragmentShader}}else r.shader={name:e.type,uniforms:e.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader};e.onBeforeCompile(r.shader,R),l=_.getProgramCode(e,c),u=_.acquireProgram(e,r.shader,c,l),r.program=u,e.program=u}var f=u.getAttributes();if(e.morphTargets){e.numSupportedMorphTargets=0;for(var m=0;m<R.maxMorphTargets;m++)f["morphTarget"+m]>=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(m=0;m<R.maxMorphNormals;m++)f["morphNormal"+m]>=0&&e.numSupportedMorphNormals++}var v=r.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=Q.numPlanes,r.numIntersection=Q.numIntersection,v.clippingPlanes=Q.uniform),r.fog=t,void 0===o&&(r.lightsHash=o={}),o.stateID=s.stateID,o.directionalLength=s.directionalLength,o.pointLength=s.pointLength,o.spotLength=s.spotLength,o.rectAreaLength=s.rectAreaLength,o.hemiLength=s.hemiLength,o.shadowsLength=s.shadowsLength,e.lights&&(v.ambientLightColor.value=i.state.ambient,v.directionalLights.value=i.state.directional,v.spotLights.value=i.state.spot,v.rectAreaLights.value=i.state.rectArea,v.pointLights.value=i.state.point,v.hemisphereLights.value=i.state.hemi,v.directionalShadowMap.value=i.state.directionalShadowMap,v.directionalShadowMatrix.value=i.state.directionalShadowMatrix,v.spotShadowMap.value=i.state.spotShadowMap,v.spotShadowMatrix.value=i.state.spotShadowMatrix,v.pointShadowMap.value=i.state.pointShadowMap,v.pointShadowMatrix.value=i.state.pointShadowMatrix);var y=r.program.getUniforms(),x=ki.seqWithValue(y.seq,v);r.uniformsList=x}function ye(e,t,n,r){V=0;var i=g.get(n),a=h.state.lights,o=i.lightsHash,s=a.state.hash;if($&&(ee||e!==U)){var c=e===U&&n.id===N;Q.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,i,c)}!1===n.needsUpdate&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==t?n.needsUpdate=!0:(!n.lights||o.stateID===s.stateID&&o.directionalLength===s.directionalLength&&o.pointLength===s.pointLength&&o.spotLength===s.spotLength&&o.rectAreaLength===s.rectAreaLength&&o.hemiLength===s.hemiLength&&o.shadowsLength===s.shadowsLength)&&(void 0===i.numClippingPlanes||i.numClippingPlanes===Q.numPlanes&&i.numIntersection===Q.numIntersection)||(n.needsUpdate=!0)),n.needsUpdate&&(ge(n,t,r),n.needsUpdate=!1);var l,u,d=!1,v=!1,y=!1,x=i.program,b=x.getUniforms(),w=i.shader.uniforms;if(m.useProgram(x.program)&&(d=!0,v=!0,y=!0),n.id!==N&&(N=n.id,v=!0),d||U!==e){if(b.setValue(p,"projectionMatrix",e.projectionMatrix),f.logarithmicDepthBuffer&&b.setValue(p,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),U!==e&&(U=e,v=!0,y=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var _=b.map.cameraPosition;void 0!==_&&_.setValue(p,ne.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&b.setValue(p,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){b.setOptional(p,r,"bindMatrix"),b.setOptional(p,r,"bindMatrixInverse");var M=r.skeleton;if(M){var S=M.bones;if(f.floatVertexTextures){if(void 0===M.boneTexture){var T=Math.sqrt(4*S.length);T=en.ceilPowerOfTwo(T),T=Math.max(T,4);var E=new Float32Array(T*T*4);E.set(M.boneMatrices);var A=new xn(E,T,T,ct,et);A.needsUpdate=!0,M.boneMatrices=E,M.boneTexture=A,M.boneTextureSize=T}b.setValue(p,"boneTexture",M.boneTexture),b.setValue(p,"boneTextureSize",M.boneTextureSize)}else b.setOptional(p,M,"boneMatrices")}}return v&&(b.setValue(p,"toneMappingExposure",R.toneMappingExposure),b.setValue(p,"toneMappingWhitePoint",R.toneMappingWhitePoint),n.lights&&(u=y,(l=w).ambientLightColor.needsUpdate=u,l.directionalLights.needsUpdate=u,l.pointLights.needsUpdate=u,l.spotLights.needsUpdate=u,l.rectAreaLights.needsUpdate=u,l.hemisphereLights.needsUpdate=u),t&&n.fog&&function(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(w,t),n.isMeshBasicMaterial?xe(w,n):n.isMeshLambertMaterial?(xe(w,n),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(w,n)):n.isMeshPhongMaterial?(xe(w,n),n.isMeshToonMaterial?function(e,t){be(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(w,n):be(w,n)):n.isMeshStandardMaterial?(xe(w,n),n.isMeshPhysicalMaterial?function(e,t){we(e,t),e.reflectivity.value=t.reflectivity,e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness}(w,n):we(w,n)):n.isMeshMatcapMaterial?(xe(w,n),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===H&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===H&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(w,n)):n.isMeshDepthMaterial?(xe(w,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(w,n)):n.isMeshDistanceMaterial?(xe(w,n),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}(w,n)):n.isMeshNormalMaterial?(xe(w,n),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===H&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===H&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(w,n)):n.isLineBasicMaterial?(function(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}(w,n),n.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(w,n)):n.isPointsMaterial?function(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*X,e.scale.value=.5*q,e.map.value=t.map,null!==t.map&&(!0===t.map.matrixAutoUpdate&&t.map.updateMatrix(),e.uvTransform.value.copy(t.map.matrix))}(w,n):n.isSpriteMaterial?function(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity,e.rotation.value=t.rotation,e.map.value=t.map,null!==t.map&&(!0===t.map.matrixAutoUpdate&&t.map.updateMatrix(),e.uvTransform.value.copy(t.map.matrix))}(w,n):n.isShadowMaterial&&(w.color.value=n.color,w.opacity.value=n.opacity),void 0!==w.ltc_1&&(w.ltc_1.value=kn.LTC_1),void 0!==w.ltc_2&&(w.ltc_2.value=kn.LTC_2),ki.upload(p,i.uniformsList,w,R)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(ki.upload(p,i.uniformsList,w,R),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&b.setValue(p,"center",r.center),b.setValue(p,"modelViewMatrix",r.modelViewMatrix),b.setValue(p,"normalMatrix",r.normalMatrix),b.setValue(p,"modelMatrix",r.matrixWorld),x}function xe(e,t){var n;e.opacity.value=t.opacity,t.color&&(e.diffuse.value=t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=g.get(t.envMap).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function be(e,t){e.specular.value=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,t.side===H&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===H&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function we(e,t){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,t.side===H&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===H&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}fe.setAnimationLoop(function(e){oe.isPresenting()||pe&&pe(e)}),"undefined"!=typeof window&&fe.setContext(window),this.setAnimationLoop=function(e){pe=e,oe.setAnimationLoop(e),fe.start()},this.render=function(e,t,n,r){if(t&&t.isCamera){if(!C){z.geometry=null,z.program=null,z.wireframe=!1,N=-1,U=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),oe.enabled&&(t=oe.getCamera(t)),(h=S.get(e,t)).init(),e.onBeforeRender(R,e,t,n),te.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),K.setFromMatrix(te),ee=this.localClippingEnabled,$=Q.init(this.clippingPlanes,ee,t),(u=M.get(e,t)).init(),function e(t,n,r,i){if(!1===t.visible)return;var a=t.layers.test(n.layers);if(a)if(t.isGroup)r=t.renderOrder;else if(t.isLight)h.pushLight(t),t.castShadow&&h.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||K.intersectsSprite(t)){i&&ne.setFromMatrixPosition(t.matrixWorld).applyMatrix4(te);var o=w.update(t),s=t.material;u.push(t,o,s,r,ne.z,null)}}else if(t.isImmediateRenderObject)i&&ne.setFromMatrixPosition(t.matrixWorld).applyMatrix4(te),u.push(t,null,t.material,r,ne.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||K.intersectsObject(t))){i&&ne.setFromMatrixPosition(t.matrixWorld).applyMatrix4(te);var o=w.update(t),s=t.material;if(Array.isArray(s))for(var c=o.groups,l=0,p=c.length;l<p;l++){var d=c[l],f=s[d.materialIndex];f&&f.visible&&u.push(t,o,f,r,ne.z,d)}else s.visible&&u.push(t,o,s,r,ne.z,null)}var m=t.children;for(var l=0,p=m.length;l<p;l++)e(m[l],n,r,i)}(e,t,0,R.sortObjects),!0===R.sortObjects&&u.sort(),$&&Q.beginShadows();var i=h.state.shadowsArray;se.render(i,e,t),h.setupLights(t),$&&Q.endShadows(),this.info.autoReset&&this.info.reset(),void 0===n&&(n=null),this.setRenderTarget(n),T.render(u,e,t,r);var a=u.opaque,o=u.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&me(a,e,t,s),o.length&&me(o,e,t,s)}else a.length&&me(a,e,t),o.length&&me(o,e,t);n&&(y.updateRenderTargetMipmap(n),y.updateMultisampleRenderTarget(n)),m.buffers.depth.setTest(!0),m.buffers.depth.setMask(!0),m.buffers.color.setMask(!0),m.setPolygonOffset(!1),e.onAfterRender(R,e,t),oe.enabled&&oe.submitFrame(),u=null,h=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.allocTextureUnit=function(){var e=V;return e>=f.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+f.maxTextures),V+=1,e},this.setTexture2D=(de=!1,function(e,t){e&&e.isWebGLRenderTarget&&(de||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),de=!0),e=e.texture),y.setTexture2D(e,t)}),this.setTexture3D=function(e,t){y.setTexture3D(e,t)},this.setTexture=function(){var e=!1;return function(t,n){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),y.setTexture2D(t,n)}}(),this.setTextureCube=function(){var e=!1;return function(t,n){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?y.setTextureCube(t,n):y.setTextureCubeDynamic(t,n)}}(),this.setFramebuffer=function(e){O=e},this.getRenderTarget=function(){return I},this.setRenderTarget=function(e){I=e,e&&void 0===g.get(e).__webglFramebuffer&&y.setupRenderTarget(e);var t=O,n=!1;if(e){var r=g.get(e).__webglFramebuffer;e.isWebGLRenderTargetCube?(t=r[e.activeCubeFace],n=!0):t=e.isWebGLMultisampleRenderTarget?g.get(e).__webglMultisampledFramebuffer:r,F.copy(e.viewport),G.copy(e.scissor),j=e.scissorTest}else F.copy(Y).multiplyScalar(X),G.copy(J).multiplyScalar(X),j=Z;if(k!==t&&(p.bindFramebuffer(36160,t),k=t),m.viewport(F),m.scissor(G),m.setScissorTest(j),n){var i=g.get(e.texture);p.framebufferTexture2D(36160,36064,34069+e.activeCubeFace,i.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,n,r,i,a){if(e&&e.isWebGLRenderTarget){var o=g.get(e).__webglFramebuffer;if(o){var s=!1;o!==k&&(p.bindFramebuffer(36160,o),s=!0);try{var c=e.texture,l=c.format,u=c.type;if(l!==ct&&P.convert(l)!==p.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u===Ye||P.convert(u)===p.getParameter(35738)||u===et&&(f.isWebGL2||d.get("OES_texture_float")||d.get("WEBGL_color_buffer_float"))||u===tt&&(f.isWebGL2?d.get("EXT_color_buffer_float"):d.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===p.checkFramebufferStatus(36160)?t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&p.readPixels(t,n,r,i,P.convert(l),P.convert(u),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&p.bindFramebuffer(36160,k)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){var r=t.image.width,i=t.image.height,a=P.convert(t.format);this.setTexture2D(t,0),p.copyTexImage2D(3553,n||0,a,e.x,e.y,r,i,0)},this.copyTextureToTexture=function(e,t,n,r){var i=t.image.width,a=t.image.height,o=P.convert(n.format),s=P.convert(n.type);this.setTexture2D(n,0),t.isDataTexture?p.texSubImage2D(3553,r||0,e.x,e.y,i,a,o,s,t.image.data):p.texSubImage2D(3553,r||0,e.x,e.y,o,s,t.image)}}function Ta(e,t){this.name="",this.color=new On(e),this.density=void 0!==t?t:25e-5}function Ea(e,t,n){this.name="",this.color=new On(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function Aa(){Vn.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function La(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}function Pa(e,t,n,r){this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===r}function Ra(e){Er.call(this),this.type="SpriteMaterial",this.color=new On(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=!0,this.lights=!1,this.transparent=!0,this.setValues(e)}function Ca(e){if(Vn.call(this),this.type="Sprite",void 0===da){da=new cr;var t=new La(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);da.setIndex([0,1,2,0,2,3]),da.addAttribute("position",new Pa(t,3,0,!1)),da.addAttribute("uv",new Pa(t,2,3,!1))}this.geometry=da,this.material=void 0!==e?e:new Ra,this.center=new tn(.5,.5)}function Oa(){Vn.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Ia(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),Cr.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new nn,this.bindMatrixInverse=new nn}function ka(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),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,r=this.bones.length;n<r;n++)this.boneInverses.push(new nn)}}function Da(){Vn.call(this),this.type="Bone"}function Na(e){Er.call(this),this.type="LineBasicMaterial",this.color=new On(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(e)}function za(e,t,n){1===n&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),Vn.call(this),this.type="Line",this.geometry=void 0!==e?e:new cr,this.material=void 0!==t?t:new Na({color:16777215*Math.random()})}function Ua(e,t){za.call(this,e,t),this.type="LineSegments"}function Ba(e,t){za.call(this,e,t),this.type="LineLoop"}function Fa(e){Er.call(this),this.type="PointsMaterial",this.color=new On(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.lights=!1,this.setValues(e)}function Ga(e,t){Vn.call(this),this.type="Points",this.geometry=void 0!==e?e:new cr,this.material=void 0!==t?t:new Fa({color:16777215*Math.random()})}function Ha(e,t,n,r,i,a,o,s,c){fn.call(this,e,t,n,r,i,a,o,s,c),this.format=void 0!==o?o:st,this.minFilter=void 0!==a?a:We,this.magFilter=void 0!==i?i:We,this.generateMipmaps=!1}function ja(e,t,n,r,i,a,o,s,c,l,u,h){fn.call(this,null,a,o,s,c,l,r,i,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Va(e,t,n,r,i,a,o,s,c){fn.call(this,e,t,n,r,i,a,o,s,c),this.needsUpdate=!0}function Wa(e,t,n,r,i,a,o,s,c,l){if((l=void 0!==l?l:pt)!==pt&&l!==dt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===pt&&(n=Ke),void 0===n&&l===dt&&(n=at),fn.call(this,null,r,i,a,o,s,l,n,c),this.image={width:e,height:t},this.magFilter=void 0!==o?o:He,this.minFilter=void 0!==s?s:He,this.flipY=!1,this.generateMipmaps=!1}function qa(e){cr.call(this),this.type="WireframeGeometry";var t,n,r,i,a,o,s,c,l,u,h=[],p=[0,0],d={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,r=m.length;t<r;t++){var v=m[t];for(n=0;n<3;n++)s=v[f[n]],c=v[f[(n+1)%3]],p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[l=p[0]+","+p[1]]&&(d[l]={index1:p[0],index2:p[1]})}for(l in d)o=d[l],u=e.vertices[o.index1],h.push(u.x,u.y,u.z),u=e.vertices[o.index2],h.push(u.x,u.y,u.z)}else if(e&&e.isBufferGeometry){var g,y,x,b,w,_,M;if(u=new an,null!==e.index){for(g=e.attributes.position,y=e.index,0===(x=e.groups).length&&(x=[{start:0,count:y.count,materialIndex:0}]),i=0,a=x.length;i<a;++i)for(t=w=(b=x[i]).start,r=w+b.count;t<r;t+=3)for(n=0;n<3;n++)s=y.getX(t+n),c=y.getX(t+(n+1)%3),p[0]=Math.min(s,c),p[1]=Math.max(s,c),void 0===d[l=p[0]+","+p[1]]&&(d[l]={index1:p[0],index2:p[1]});for(l in d)o=d[l],u.fromBufferAttribute(g,o.index1),h.push(u.x,u.y,u.z),u.fromBufferAttribute(g,o.index2),h.push(u.x,u.y,u.z)}else for(t=0,r=(g=e.attributes.position).count/3;t<r;t++)for(n=0;n<3;n++)_=3*t+n,u.fromBufferAttribute(g,_),h.push(u.x,u.y,u.z),M=3*t+(n+1)%3,u.fromBufferAttribute(g,M),h.push(u.x,u.y,u.z)}this.addAttribute("position",new rr(h,3))}function Xa(e,t,n){Yn.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new Ya(e,t,n)),this.mergeVertices()}function Ya(e,t,n){cr.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var r,i,a=[],o=[],s=[],c=[],l=new an,u=new an,h=new an,p=new an,d=new an;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var f=t+1;for(r=0;r<=n;r++){var m=r/n;for(i=0;i<=t;i++){var v=i/t;e(v,m,u),o.push(u.x,u.y,u.z),v-1e-5>=0?(e(v-1e-5,m,h),p.subVectors(u,h)):(e(v+1e-5,m,h),p.subVectors(h,u)),m-1e-5>=0?(e(v,m-1e-5,h),d.subVectors(u,h)):(e(v,m+1e-5,h),d.subVectors(h,u)),l.crossVectors(p,d).normalize(),s.push(l.x,l.y,l.z),c.push(v,m)}}for(r=0;r<n;r++)for(i=0;i<t;i++){var g=r*f+i,y=r*f+i+1,x=(r+1)*f+i+1,b=(r+1)*f+i;a.push(g,y,b),a.push(y,x,b)}this.setIndex(a),this.addAttribute("position",new rr(o,3)),this.addAttribute("normal",new rr(s,3)),this.addAttribute("uv",new rr(c,2))}function Ja(e,t,n,r){Yn.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new Za(e,t,n,r)),this.mergeVertices()}function Za(e,t,n,r){cr.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},n=n||1;var i=[],a=[];function o(e,t,n,r){var i,a,o=Math.pow(2,r),c=[];for(i=0;i<=o;i++){c[i]=[];var l=e.clone().lerp(n,i/o),u=t.clone().lerp(n,i/o),h=o-i;for(a=0;a<=h;a++)c[i][a]=0===a&&i===o?l:l.clone().lerp(u,a/h)}for(i=0;i<o;i++)for(a=0;a<2*(o-i)-1;a++){var p=Math.floor(a/2);a%2==0?(s(c[i][p+1]),s(c[i+1][p]),s(c[i][p])):(s(c[i][p+1]),s(c[i+1][p+1]),s(c[i+1][p]))}}function s(e){i.push(e.x,e.y,e.z)}function c(t,n){var r=3*t;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function l(e,t,n,r){r<0&&1===e.x&&(a[t]=e.x-1),0===n.x&&0===n.z&&(a[t]=r/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}!function(e){for(var n=new an,r=new an,i=new an,a=0;a<t.length;a+=3)c(t[a+0],n),c(t[a+1],r),c(t[a+2],i),o(n,r,i,e)}(r=r||0),function(e){for(var t=new an,n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}(n),function(){for(var e=new an,t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];var n=u(e)/2/Math.PI+.5,r=(o=e,Math.atan2(-o.y,Math.sqrt(o.x*o.x+o.z*o.z))/Math.PI+.5);a.push(n,1-r)}var o;(function(){for(var e=new an,t=new an,n=new an,r=new an,o=new tn,s=new tn,c=new tn,h=0,p=0;h<i.length;h+=9,p+=6){e.set(i[h+0],i[h+1],i[h+2]),t.set(i[h+3],i[h+4],i[h+5]),n.set(i[h+6],i[h+7],i[h+8]),o.set(a[p+0],a[p+1]),s.set(a[p+2],a[p+3]),c.set(a[p+4],a[p+5]),r.copy(e).add(t).add(n).divideScalar(3);var d=u(r);l(o,p+0,e,d),l(s,p+2,t,d),l(c,p+4,n,d)}})(),function(){for(var e=0;e<a.length;e+=6){var t=a[e+0],n=a[e+2],r=a[e+4],i=Math.max(t,n,r),o=Math.min(t,n,r);i>.9&&o<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}()}(),this.addAttribute("position",new rr(i,3)),this.addAttribute("normal",new rr(i.slice(),3)),this.addAttribute("uv",new rr(a,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}function Ka(e,t){Yn.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Qa(e,t)),this.mergeVertices()}function Qa(e,t){Za.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 $a(e,t){Yn.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new eo(e,t)),this.mergeVertices()}function eo(e,t){Za.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 to(e,t){Yn.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new no(e,t)),this.mergeVertices()}function no(e,t){var n=(1+Math.sqrt(5))/2,r=[-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];Za.call(this,r,[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 ro(e,t){Yn.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new io(e,t)),this.mergeVertices()}function io(e,t){var n=(1+Math.sqrt(5))/2,r=1/n,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,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];Za.call(this,i,[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 ao(e,t,n,r,i,a){Yn.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new oo(e,t,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function oo(e,t,n,r,i){cr.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},t=t||64,n=n||1,r=r||8,i=i||!1;var a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,c=new an,l=new an,u=new tn,h=new an,p=[],d=[],f=[],m=[];function v(i){h=e.getPointAt(i/t,h);var o=a.normals[i],u=a.binormals[i];for(s=0;s<=r;s++){var f=s/r*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);l.x=v*o.x+m*u.x,l.y=v*o.y+m*u.y,l.z=v*o.z+m*u.z,l.normalize(),d.push(l.x,l.y,l.z),c.x=h.x+n*l.x,c.y=h.y+n*l.y,c.z=h.z+n*l.z,p.push(c.x,c.y,c.z)}}!function(){for(o=0;o<t;o++)v(o);v(!1===i?t:0),function(){for(o=0;o<=t;o++)for(s=0;s<=r;s++)u.x=o/t,u.y=s/r,f.push(u.x,u.y)}(),function(){for(s=1;s<=t;s++)for(o=1;o<=r;o++){var e=(r+1)*(s-1)+(o-1),n=(r+1)*s+(o-1),i=(r+1)*s+o,a=(r+1)*(s-1)+o;m.push(e,n,a),m.push(n,i,a)}}()}(),this.setIndex(m),this.addAttribute("position",new rr(p,3)),this.addAttribute("normal",new rr(d,3)),this.addAttribute("uv",new rr(f,2))}function so(e,t,n,r,i,a,o){Yn.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},void 0!==o&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new co(e,t,n,r,i,a)),this.mergeVertices()}function co(e,t,n,r,i,a){cr.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,a=a||3;var o,s,c=[],l=[],u=[],h=[],p=new an,d=new an,f=new an,m=new an,v=new an,g=new an,y=new an;for(o=0;o<=n;++o){var x=o/n*i*Math.PI*2;for(A(x,i,a,e,f),A(x+.01,i,a,e,m),g.subVectors(m,f),y.addVectors(m,f),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize(),s=0;s<=r;++s){var b=s/r*Math.PI*2,w=-t*Math.cos(b),_=t*Math.sin(b);p.x=f.x+(w*y.x+_*v.x),p.y=f.y+(w*y.y+_*v.y),p.z=f.z+(w*y.z+_*v.z),l.push(p.x,p.y,p.z),d.subVectors(p,f).normalize(),u.push(d.x,d.y,d.z),h.push(o/n),h.push(s/r)}}for(s=1;s<=n;s++)for(o=1;o<=r;o++){var M=(r+1)*(s-1)+(o-1),S=(r+1)*s+(o-1),T=(r+1)*s+o,E=(r+1)*(s-1)+o;c.push(M,S,E),c.push(S,T,E)}function A(e,t,n,r,i){var a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}this.setIndex(c),this.addAttribute("position",new rr(l,3)),this.addAttribute("normal",new rr(u,3)),this.addAttribute("uv",new rr(h,2))}function lo(e,t,n,r,i){Yn.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new uo(e,t,n,r,i)),this.mergeVertices()}function uo(e,t,n,r,i){cr.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},e=e||1,t=t||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||2*Math.PI;var a,o,s=[],c=[],l=[],u=[],h=new an,p=new an,d=new an;for(a=0;a<=n;a++)for(o=0;o<=r;o++){var f=o/r*i,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),c.push(p.x,p.y,p.z),h.x=e*Math.cos(f),h.y=e*Math.sin(f),d.subVectors(p,h).normalize(),l.push(d.x,d.y,d.z),u.push(o/r),u.push(a/n)}for(a=1;a<=n;a++)for(o=1;o<=r;o++){var v=(r+1)*a+o-1,g=(r+1)*(a-1)+o-1,y=(r+1)*(a-1)+o,x=(r+1)*a+o;s.push(v,g,x),s.push(g,y,x)}this.setIndex(s),this.addAttribute("position",new rr(c,3)),this.addAttribute("normal",new rr(l,3)),this.addAttribute("uv",new rr(u,2))}Ta.prototype.isFogExp2=!0,Ta.prototype.clone=function(){return new Ta(this.color,this.density)},Ta.prototype.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},Ea.prototype.isFog=!0,Ea.prototype.clone=function(){return new Ea(this.color,this.near,this.far)},Ea.prototype.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},Aa.prototype=Object.assign(Object.create(Vn.prototype),{constructor:Aa,isScene:!0,copy:function(e,t){return Vn.prototype.copy.call(this,e,t),null!==e.background&&(this.background=e.background.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=Vn.prototype.toJSON.call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(La.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(La.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=void 0!==e?e.length/this.stride:0,this.array=e,this},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];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}}),Object.defineProperties(Pa.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Pa.prototype,{isInterleavedBufferAttribute:!0,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,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]=r,this},setXYZW:function(e,t,n,r,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]=r,this.data.array[e+3]=i,this}}),Ra.prototype=Object.create(Er.prototype),Ra.prototype.constructor=Ra,Ra.prototype.isSpriteMaterial=!0,Ra.prototype.copy=function(e){return Er.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this},Ca.prototype=Object.assign(Object.create(Vn.prototype),{constructor:Ca,isSprite:!0,raycast:function(){var e=new an,t=new an,n=new an,r=new tn,i=new tn,a=new nn,o=new an,s=new an,c=new an,l=new tn,u=new tn,h=new tn;function p(e,t,n,o,s,c){r.subVectors(e,n).addScalar(.5).multiply(o),void 0!==s?(i.x=c*r.x-s*r.y,i.y=s*r.x+c*r.y):i.copy(r),e.copy(t),e.x+=i.x,e.y+=i.y,e.applyMatrix4(a)}return function(r,i){t.setFromMatrixScale(this.matrixWorld),a.getInverse(this.modelViewMatrix).premultiply(this.matrixWorld),n.setFromMatrixPosition(this.modelViewMatrix);var d,f,m=this.material.rotation;0!==m&&(f=Math.cos(m),d=Math.sin(m));var v=this.center;p(o.set(-.5,-.5,0),n,v,t,d,f),p(s.set(.5,-.5,0),n,v,t,d,f),p(c.set(.5,.5,0),n,v,t,d,f),l.set(0,0),u.set(1,0),h.set(1,1);var g=r.ray.intersectTriangle(o,s,c,!1,e);if(null!==g||(p(s.set(-.5,.5,0),n,v,t,d,f),u.set(0,1),null!==(g=r.ray.intersectTriangle(o,c,s,!1,e)))){var y=r.ray.origin.distanceTo(e);y<r.near||y>r.far||i.push({distance:y,point:e.clone(),uv:Pr.getUV(e,o,s,c,l,u,h,new tn),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return Vn.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}}),Oa.prototype=Object.assign(Object.create(Vn.prototype),{constructor:Oa,copy:function(e){Vn.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n<r;n++){var i=t[n];this.addLevel(i.object.clone(),i.distance)}return this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);for(var n=this.levels,r=0;r<n.length&&!(t<n[r].distance);r++);n.splice(r,0,{distance:t,object:e}),this.add(e)},getObjectForDistance:function(e){for(var t=this.levels,n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object},raycast:(fa=new an,function(e,t){fa.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(fa);this.getObjectForDistance(n).raycast(e,t)}),update:function(){var e=new an,t=new an;return function(n){var r=this.levels;if(r.length>1){e.setFromMatrixPosition(n.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var i=e.distanceTo(t);r[0].object.visible=!0;for(var a=1,o=r.length;a<o&&i>=r[a].distance;a++)r[a-1].object.visible=!1,r[a].object.visible=!0;for(;a<o;a++)r[a].object.visible=!1}}}(),toJSON:function(e){var t=Vn.prototype.toJSON.call(this,e);t.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),Ia.prototype=Object.assign(Object.create(Cr.prototype),{constructor:Ia,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 mn,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){Cr.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)}}),Object.assign(ka.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new nn;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:(ma=new nn,va=new nn,function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:va;ma.multiplyMatrices(o,t[i]),ma.toArray(n,16*i)}void 0!==r&&(r.needsUpdate=!0)}),clone:function(){return new ka(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}}}),Da.prototype=Object.assign(Object.create(Vn.prototype),{constructor:Da,isBone:!0}),Na.prototype=Object.create(Er.prototype),Na.prototype.constructor=Na,Na.prototype.isLineBasicMaterial=!0,Na.prototype.copy=function(e){return Er.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this},za.prototype=Object.assign(Object.create(Vn.prototype),{constructor:za,isLine:!0,computeLineDistances:(ga=new an,ya=new an,function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)ga.fromBufferAttribute(t,r-1),ya.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=ga.distanceTo(ya);e.addAttribute("lineDistance",new rr(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices;for((n=e.lineDistances)[0]=0,r=1,i=a.length;r<i;r++)n[r]=n[r-1],n[r]+=a[r-1].distanceTo(a[r])}return this}),raycast:function(){var e=new nn,t=new Lr,n=new wn;return function(r,i){var a=r.linePrecision,o=this.geometry,s=this.matrixWorld;if(null===o.boundingSphere&&o.computeBoundingSphere(),n.copy(o.boundingSphere),n.applyMatrix4(s),n.radius+=a,!1!==r.ray.intersectsSphere(n)){e.getInverse(s),t.copy(r.ray).applyMatrix4(e);var c=a/((this.scale.x+this.scale.y+this.scale.z)/3),l=c*c,u=new an,h=new an,p=new an,d=new an,f=this&&this.isLineSegments?2:1;if(o.isBufferGeometry){var m=o.index,v=o.attributes.position.array;if(null!==m)for(var g=m.array,y=0,x=g.length-1;y<x;y+=f){var b=g[y],w=g[y+1];if(u.fromArray(v,3*b),h.fromArray(v,3*w),!(t.distanceSqToSegment(u,h,d,p)>l))d.applyMatrix4(this.matrixWorld),(S=r.ray.origin.distanceTo(d))<r.near||S>r.far||i.push({distance:S,point:p.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}else for(y=0,x=v.length/3-1;y<x;y+=f){if(u.fromArray(v,3*y),h.fromArray(v,3*y+3),!(t.distanceSqToSegment(u,h,d,p)>l))d.applyMatrix4(this.matrixWorld),(S=r.ray.origin.distanceTo(d))<r.near||S>r.far||i.push({distance:S,point:p.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else if(o.isGeometry){var _=o.vertices,M=_.length;for(y=0;y<M-1;y+=f){var S;if(!(t.distanceSqToSegment(_[y],_[y+1],d,p)>l))d.applyMatrix4(this.matrixWorld),(S=r.ray.origin.distanceTo(d))<r.near||S>r.far||i.push({distance:S,point:p.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}}}(),copy:function(e){return Vn.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return(new this.constructor).copy(this)}}),Ua.prototype=Object.assign(Object.create(za.prototype),{constructor:Ua,isLineSegments:!0,computeLineDistances:function(){var e=new an,t=new an;return function(){var n=this.geometry;if(n.isBufferGeometry)if(null===n.index){for(var r=n.attributes.position,i=[],a=0,o=r.count;a<o;a+=2)e.fromBufferAttribute(r,a),t.fromBufferAttribute(r,a+1),i[a]=0===a?0:i[a-1],i[a+1]=i[a]+e.distanceTo(t);n.addAttribute("lineDistance",new rr(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(n.isGeometry){var s=n.vertices;for(i=n.lineDistances,a=0,o=s.length;a<o;a+=2)e.copy(s[a]),t.copy(s[a+1]),i[a]=0===a?0:i[a-1],i[a+1]=i[a]+e.distanceTo(t)}return this}}()}),Ba.prototype=Object.assign(Object.create(za.prototype),{constructor:Ba,isLineLoop:!0}),Fa.prototype=Object.create(Er.prototype),Fa.prototype.constructor=Fa,Fa.prototype.isPointsMaterial=!0,Fa.prototype.copy=function(e){return Er.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this},Ga.prototype=Object.assign(Object.create(Vn.prototype),{constructor:Ga,isPoints:!0,raycast:function(){var e=new nn,t=new Lr,n=new wn;return function(r,i){var a=this,o=this.geometry,s=this.matrixWorld,c=r.params.Points.threshold;if(null===o.boundingSphere&&o.computeBoundingSphere(),n.copy(o.boundingSphere),n.applyMatrix4(s),n.radius+=c,!1!==r.ray.intersectsSphere(n)){e.getInverse(s),t.copy(r.ray).applyMatrix4(e);var l=c/((this.scale.x+this.scale.y+this.scale.z)/3),u=l*l,h=new an,p=new an;if(o.isBufferGeometry){var d=o.index,f=o.attributes.position.array;if(null!==d)for(var m=d.array,v=0,g=m.length;v<g;v++){var y=m[v];h.fromArray(f,3*y),w(h,y)}else{v=0;for(var x=f.length/3;v<x;v++)h.fromArray(f,3*v),w(h,v)}}else{var b=o.vertices;for(v=0,x=b.length;v<x;v++)w(b[v],v)}}function w(e,n){var o=t.distanceSqToPoint(e);if(o<u){t.closestPointToPoint(e,p),p.applyMatrix4(s);var c=r.ray.origin.distanceTo(p);if(c<r.near||c>r.far)return;i.push({distance:c,distanceToRay:Math.sqrt(o),point:p.clone(),index:n,face:null,object:a})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Ha.prototype=Object.assign(Object.create(fn.prototype),{constructor:Ha,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),ja.prototype=Object.create(fn.prototype),ja.prototype.constructor=ja,ja.prototype.isCompressedTexture=!0,Va.prototype=Object.create(fn.prototype),Va.prototype.constructor=Va,Va.prototype.isCanvasTexture=!0,Wa.prototype=Object.create(fn.prototype),Wa.prototype.constructor=Wa,Wa.prototype.isDepthTexture=!0,qa.prototype=Object.create(cr.prototype),qa.prototype.constructor=qa,Xa.prototype=Object.create(Yn.prototype),Xa.prototype.constructor=Xa,Ya.prototype=Object.create(cr.prototype),Ya.prototype.constructor=Ya,Ja.prototype=Object.create(Yn.prototype),Ja.prototype.constructor=Ja,Za.prototype=Object.create(cr.prototype),Za.prototype.constructor=Za,Ka.prototype=Object.create(Yn.prototype),Ka.prototype.constructor=Ka,Qa.prototype=Object.create(Za.prototype),Qa.prototype.constructor=Qa,$a.prototype=Object.create(Yn.prototype),$a.prototype.constructor=$a,eo.prototype=Object.create(Za.prototype),eo.prototype.constructor=eo,to.prototype=Object.create(Yn.prototype),to.prototype.constructor=to,no.prototype=Object.create(Za.prototype),no.prototype.constructor=no,ro.prototype=Object.create(Yn.prototype),ro.prototype.constructor=ro,io.prototype=Object.create(Za.prototype),io.prototype.constructor=io,ao.prototype=Object.create(Yn.prototype),ao.prototype.constructor=ao,oo.prototype=Object.create(cr.prototype),oo.prototype.constructor=oo,so.prototype=Object.create(Yn.prototype),so.prototype.constructor=so,co.prototype=Object.create(cr.prototype),co.prototype.constructor=co,lo.prototype=Object.create(Yn.prototype),lo.prototype.constructor=lo,uo.prototype=Object.create(cr.prototype),uo.prototype.constructor=uo;var ho=function(e,t,n){n=n||2;var r,i,a,o,s,c,l,u=t&&t.length,h=u?t[0]*n:e.length,p=po(e,0,h,n,!0),d=[];if(!p)return d;if(u&&(p=function(e,t,n,r){var i,a,o,s,c,l=[];for(i=0,a=t.length;i<a;i++)o=t[i]*r,s=i<a-1?t[i+1]*r:e.length,(c=po(e,o,s,r,!1))===c.next&&(c.steiner=!0),l.push(Mo(c));for(l.sort(bo),i=0;i<l.length;i++)wo(l[i],n),n=fo(n,n.next);return n}(e,t,p,n)),e.length>80*n){r=a=e[0],i=o=e[1];for(var f=n;f<h;f+=n)(s=e[f])<r&&(r=s),(c=e[f+1])<i&&(i=c),s>a&&(a=s),c>o&&(o=c);l=0!==(l=Math.max(a-r,o-i))?1/l:0}return mo(p,d,n,r,i,l),d};function po(e,t,n,r,i){var a,o;if(i===function(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r)>0)for(a=t;a<n;a+=r)o=Co(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Co(a,e[a],e[a+1],o);return o&&Ao(o,o.next)&&(Oo(o),o=o.next),o}function fo(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!Ao(r,r.next)&&0!==Eo(r.prev,r,r.next))r=r.next;else{if(Oo(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function mo(e,t,n,r,i,a,o){if(e){!o&&a&&function(e,t,n,r){var i=e;do{null===i.z&&(i.z=_o(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<l&&(s++,r=r.nextZ);t++);for(c=l;s>0||c>0&&r;)0!==s&&(0===c||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(e,r,i,a);for(var s,c,l=e;e.prev!==e.next;)if(s=e.prev,c=e.next,a?go(e,r,i,a):vo(e))t.push(s.i/n),t.push(e.i/n),t.push(c.i/n),Oo(e),e=c.next,l=c.next;else if((e=c)===l){o?1===o?mo(e=yo(e,t,n),t,n,r,i,a,2):2===o&&xo(e,t,n,r,i,a):mo(fo(e),t,n,r,i,a,1);break}}}function vo(e){var t=e.prev,n=e,r=e.next;if(Eo(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(So(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Eo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function go(e,t,n,r){var i=e.prev,a=e,o=e.next;if(Eo(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,c=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=_o(s,c,t,n,r),p=_o(l,u,t,n,r),d=e.nextZ;d&&d.z<=p;){if(d!==e.prev&&d!==e.next&&So(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Eo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=e.prevZ;d&&d.z>=h;){if(d!==e.prev&&d!==e.next&&So(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&Eo(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function yo(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Ao(i,a)&&Lo(i,r,r.next,a)&&Po(i,a)&&Po(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),Oo(r),Oo(r.next),r=e=a),r=r.next}while(r!==e);return r}function xo(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&To(o,s)){var c=Ro(o,s);return o=fo(o,o.next),c=fo(c,c.next),mo(o,t,n,r,i,a),void mo(c,t,n,r,i,a)}s=s.next}o=o.next}while(o!==e)}function bo(e,t){return e.x-t.x}function wo(e,t){if(t=function(e,t){var n,r=t,i=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(i===o)return n.prev;var c,l=n,u=n.x,h=n.y,p=1/0;r=n.next;for(;r!==l;)i>=r.x&&r.x>=u&&i!==r.x&&So(a<h?i:o,a,u,h,a<h?o:i,a,r.x,r.y)&&((c=Math.abs(a-r.y)/(i-r.x))<p||c===p&&r.x>n.x)&&Po(r,e)&&(n=r,p=c),r=r.next;return n}(e,t)){var n=Ro(t,e);fo(n,n.next)}}function _o(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Mo(e){var t=e,n=e;do{t.x<n.x&&(n=t),t=t.next}while(t!==e);return n}function So(e,t,n,r,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function To(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&&Lo(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&Po(e,t)&&Po(t,e)&&function(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)}function Eo(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ao(e,t){return e.x===t.x&&e.y===t.y}function Lo(e,t,n,r){return!!(Ao(e,t)&&Ao(n,r)||Ao(e,r)&&Ao(n,t))||Eo(e,t,n)>0!=Eo(e,t,r)>0&&Eo(n,r,e)>0!=Eo(n,r,t)>0}function Po(e,t){return Eo(e.prev,e,e.next)<0?Eo(e,t,e.next)>=0&&Eo(e,e.prev,t)>=0:Eo(e,t,e.prev)<0||Eo(e,e.next,t)<0}function Ro(e,t){var n=new Io(e.i,e.x,e.y),r=new Io(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Co(e,t,n,r){var i=new Io(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Oo(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 Io(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 ko={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return.5*n},isClockWise:function(e){return ko.area(e)<0},triangulateShape:function(e,t){var n=[],r=[],i=[];Do(e),No(n,e);var a=e.length;t.forEach(Do);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,No(n,t[o]);var s=ho(n,r);for(o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}};function Do(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function No(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function zo(e,t){Yn.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Uo(e,t)),this.mergeVertices()}function Uo(e,t){cr.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,r=[],i=[],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,c=void 0!==t.depth?t.depth:100,l=void 0===t.bevelEnabled||t.bevelEnabled,u=void 0!==t.bevelThickness?t.bevelThickness:6,h=void 0!==t.bevelSize?t.bevelSize:u-2,p=void 0!==t.bevelSegments?t.bevelSegments:3,d=t.extrudePath,f=void 0!==t.UVGenerator?t.UVGenerator:Bo;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),c=t.amount);var m,v,g,y,x,b,w,_,M=!1;d&&(m=d.getSpacedPoints(s),M=!0,l=!1,v=d.computeFrenetFrames(s,!1),g=new an,y=new an,x=new an),l||(p=0,u=0,h=0);var S=e.extractPoints(o),T=S.shape,E=S.holes;if(!ko.isClockWise(T))for(T=T.reverse(),w=0,_=E.length;w<_;w++)b=E[w],ko.isClockWise(b)&&(E[w]=b.reverse());var A=ko.triangulateShape(T,E),L=T;for(w=0,_=E.length;w<_;w++)b=E[w],T=T.concat(b);function P(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var R,C,O,I,k,D,N=T.length,z=A.length;function U(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,h=o*l-s*c;if(Math.abs(h)>Number.EPSILON){var p=Math.sqrt(u),d=Math.sqrt(c*c+l*l),f=t.x-s/p,m=t.y+o/p,v=((n.x-l/d-f)*l-(n.y+c/d-m)*c)/(o*l-s*c),g=(r=f+o*v-e.x)*r+(i=m+s*v-e.y)*i;if(g<=2)return new tn(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?c>Number.EPSILON&&(y=!0):o<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(l)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new tn(r/a,i/a)}for(var B=[],F=0,G=L.length,H=G-1,j=F+1;F<G;F++,H++,j++)H===G&&(H=0),j===G&&(j=0),B[F]=U(L[F],L[H],L[j]);var V,W,q=[],X=B.concat();for(w=0,_=E.length;w<_;w++){for(b=E[w],V=[],F=0,H=(G=b.length)-1,j=F+1;F<G;F++,H++,j++)H===G&&(H=0),j===G&&(j=0),V[F]=U(b[F],b[H],b[j]);q.push(V),X=X.concat(V)}for(R=0;R<p;R++){for(O=R/p,I=u*Math.cos(O*Math.PI/2),C=h*Math.sin(O*Math.PI/2),F=0,G=L.length;F<G;F++)J((k=P(L[F],B[F],C)).x,k.y,-I);for(w=0,_=E.length;w<_;w++)for(b=E[w],V=q[w],F=0,G=b.length;F<G;F++)J((k=P(b[F],V[F],C)).x,k.y,-I)}for(C=h,F=0;F<N;F++)k=l?P(T[F],X[F],C):T[F],M?(y.copy(v.normals[0]).multiplyScalar(k.x),g.copy(v.binormals[0]).multiplyScalar(k.y),x.copy(m[0]).add(y).add(g),J(x.x,x.y,x.z)):J(k.x,k.y,0);for(W=1;W<=s;W++)for(F=0;F<N;F++)k=l?P(T[F],X[F],C):T[F],M?(y.copy(v.normals[W]).multiplyScalar(k.x),g.copy(v.binormals[W]).multiplyScalar(k.y),x.copy(m[W]).add(y).add(g),J(x.x,x.y,x.z)):J(k.x,k.y,c/s*W);for(R=p-1;R>=0;R--){for(O=R/p,I=u*Math.cos(O*Math.PI/2),C=h*Math.sin(O*Math.PI/2),F=0,G=L.length;F<G;F++)J((k=P(L[F],B[F],C)).x,k.y,c+I);for(w=0,_=E.length;w<_;w++)for(b=E[w],V=q[w],F=0,G=b.length;F<G;F++)k=P(b[F],V[F],C),M?J(k.x,k.y+m[s-1].y,m[s-1].x+I):J(k.x,k.y,c+I)}function Y(e,t){var n,r;for(F=e.length;--F>=0;){n=F,(r=F-1)<0&&(r=e.length-1);var i=0,a=s+2*p;for(i=0;i<a;i++){var o=N*i,c=N*(i+1);K(t+n+o,t+r+o,t+r+c,t+n+c)}}}function J(e,t,n){a.push(e),a.push(t),a.push(n)}function Z(e,t,i){Q(e),Q(t),Q(i);var a=r.length/3,o=f.generateTopUV(n,r,a-3,a-2,a-1);$(o[0]),$(o[1]),$(o[2])}function K(e,t,i,a){Q(e),Q(t),Q(a),Q(t),Q(i),Q(a);var o=r.length/3,s=f.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);$(s[0]),$(s[1]),$(s[3]),$(s[1]),$(s[2]),$(s[3])}function Q(e){r.push(a[3*e+0]),r.push(a[3*e+1]),r.push(a[3*e+2])}function $(e){i.push(e.x),i.push(e.y)}!function(){var e=r.length/3;if(l){var t=0,i=N*t;for(F=0;F<z;F++)Z((D=A[F])[2]+i,D[1]+i,D[0]+i);for(i=N*(t=s+2*p),F=0;F<z;F++)Z((D=A[F])[0]+i,D[1]+i,D[2]+i)}else{for(F=0;F<z;F++)Z((D=A[F])[2],D[1],D[0]);for(F=0;F<z;F++)Z((D=A[F])[0]+N*s,D[1]+N*s,D[2]+N*s)}n.addGroup(e,r.length/3-e,0)}(),function(){var e=r.length/3,t=0;for(Y(L,t),t+=L.length,w=0,_=E.length;w<_;w++)Y(b=E[w],t),t+=b.length;n.addGroup(e,r.length/3-e,1)}()}this.addAttribute("position",new rr(r,3)),this.addAttribute("uv",new rr(i,2)),this.computeVertexNormals()}zo.prototype=Object.create(Yn.prototype),zo.prototype.constructor=zo,zo.prototype.toJSON=function(){var e=Yn.prototype.toJSON.call(this);return Fo(this.parameters.shapes,this.parameters.options,e)},Uo.prototype=Object.create(cr.prototype),Uo.prototype.constructor=Uo,Uo.prototype.toJSON=function(){var e=cr.prototype.toJSON.call(this);return Fo(this.parameters.shapes,this.parameters.options,e)};var Bo={generateTopUV:function(e,t,n,r,i){var a=t[3*n],o=t[3*n+1],s=t[3*r],c=t[3*r+1],l=t[3*i],u=t[3*i+1];return[new tn(a,o),new tn(s,c),new tn(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[3*n],s=t[3*n+1],c=t[3*n+2],l=t[3*r],u=t[3*r+1],h=t[3*r+2],p=t[3*i],d=t[3*i+1],f=t[3*i+2],m=t[3*a],v=t[3*a+1],g=t[3*a+2];return Math.abs(s-u)<.01?[new tn(o,1-c),new tn(l,1-h),new tn(p,1-f),new tn(m,1-g)]:[new tn(s,1-c),new tn(u,1-h),new tn(d,1-f),new tn(v,1-g)]}};function Fo(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function Go(e,t){Yn.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Ho(e,t)),this.mergeVertices()}function Ho(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 Yn;var r=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),Uo.call(this,r,t),this.type="TextBufferGeometry"}function jo(e,t,n,r,i,a,o){Yn.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Vo(e,t,n,r,i,a,o)),this.mergeVertices()}function Vo(e,t,n,r,i,a,o){cr.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI;var s,c,l=(a=void 0!==a?a:0)+(o=void 0!==o?o:Math.PI),u=0,h=[],p=new an,d=new an,f=[],m=[],v=[],g=[];for(c=0;c<=n;c++){var y=[],x=c/n;for(s=0;s<=t;s++){var b=s/t;p.x=-e*Math.cos(r+b*i)*Math.sin(a+x*o),p.y=e*Math.cos(a+x*o),p.z=e*Math.sin(r+b*i)*Math.sin(a+x*o),m.push(p.x,p.y,p.z),d.set(p.x,p.y,p.z).normalize(),v.push(d.x,d.y,d.z),g.push(b,1-x),y.push(u++)}h.push(y)}for(c=0;c<n;c++)for(s=0;s<t;s++){var w=h[c][s+1],_=h[c][s],M=h[c+1][s],S=h[c+1][s+1];(0!==c||a>0)&&f.push(w,_,S),(c!==n-1||l<Math.PI)&&f.push(_,M,S)}this.setIndex(f),this.addAttribute("position",new rr(m,3)),this.addAttribute("normal",new rr(v,3)),this.addAttribute("uv",new rr(g,2))}function Wo(e,t,n,r,i,a){Yn.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new qo(e,t,n,r,i,a)),this.mergeVertices()}function qo(e,t,n,r,i,a){cr.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=void 0!==i?i:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8;var o,s,c,l=[],u=[],h=[],p=[],d=e,f=(t-e)/(r=void 0!==r?Math.max(1,r):1),m=new an,v=new tn;for(s=0;s<=r;s++){for(c=0;c<=n;c++)o=i+c/n*a,m.x=d*Math.cos(o),m.y=d*Math.sin(o),u.push(m.x,m.y,m.z),h.push(0,0,1),v.x=(m.x/t+1)/2,v.y=(m.y/t+1)/2,p.push(v.x,v.y);d+=f}for(s=0;s<r;s++){var g=s*(n+1);for(c=0;c<n;c++){var y=o=c+g,x=o+n+1,b=o+n+2,w=o+1;l.push(y,x,w),l.push(x,b,w)}}this.setIndex(l),this.addAttribute("position",new rr(u,3)),this.addAttribute("normal",new rr(h,3)),this.addAttribute("uv",new rr(p,2))}function Xo(e,t,n,r){Yn.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new Yo(e,t,n,r)),this.mergeVertices()}function Yo(e,t,n,r){cr.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||2*Math.PI,r=en.clamp(r,0,2*Math.PI);var i,a,o,s=[],c=[],l=[],u=1/t,h=new an,p=new tn;for(a=0;a<=t;a++){var d=n+a*u*r,f=Math.sin(d),m=Math.cos(d);for(o=0;o<=e.length-1;o++)h.x=e[o].x*f,h.y=e[o].y,h.z=e[o].x*m,c.push(h.x,h.y,h.z),p.x=a/t,p.y=o/(e.length-1),l.push(p.x,p.y)}for(a=0;a<t;a++)for(o=0;o<e.length-1;o++){var v=i=o+a*e.length,g=i+e.length,y=i+e.length+1,x=i+1;s.push(v,g,x),s.push(g,y,x)}if(this.setIndex(s),this.addAttribute("position",new rr(c,3)),this.addAttribute("uv",new rr(l,2)),this.computeVertexNormals(),r===2*Math.PI){var b=this.attributes.normal.array,w=new an,_=new an,M=new an;for(i=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[i+o+0],_.y=b[i+o+1],_.z=b[i+o+2],M.addVectors(w,_).normalize(),b[o+0]=b[i+o+0]=M.x,b[o+1]=b[i+o+1]=M.y,b[o+2]=b[i+o+2]=M.z}}function Jo(e,t){Yn.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 Zo(e,t)),this.mergeVertices()}function Zo(e,t){cr.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],r=[],i=[],a=[],o=0,s=0;if(!1===Array.isArray(e))l(e);else for(var c=0;c<e.length;c++)l(e[c]),this.addGroup(o,s,c),o+=s,s=0;function l(e){var o,c,l,u=r.length/3,h=e.extractPoints(t),p=h.shape,d=h.holes;for(!1===ko.isClockWise(p)&&(p=p.reverse()),o=0,c=d.length;o<c;o++)l=d[o],!0===ko.isClockWise(l)&&(d[o]=l.reverse());var f=ko.triangulateShape(p,d);for(o=0,c=d.length;o<c;o++)l=d[o],p=p.concat(l);for(o=0,c=p.length;o<c;o++){var m=p[o];r.push(m.x,m.y,0),i.push(0,0,1),a.push(m.x,m.y)}for(o=0,c=f.length;o<c;o++){var v=f[o],g=v[0]+u,y=v[1]+u,x=v[2]+u;n.push(g,y,x),s+=3}}this.setIndex(n),this.addAttribute("position",new rr(r,3)),this.addAttribute("normal",new rr(i,3)),this.addAttribute("uv",new rr(a,2))}function Ko(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function Qo(e,t){cr.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0!==t?t:1;var n,r,i,a,o=[],s=Math.cos(en.DEG2RAD*t),c=[0,0],l={},u=["a","b","c"];e.isBufferGeometry?(a=new Yn).fromBufferGeometry(e):a=e.clone(),a.mergeVertices(),a.computeFaceNormals();for(var h=a.vertices,p=a.faces,d=0,f=p.length;d<f;d++)for(var m=p[d],v=0;v<3;v++)n=m[u[v]],r=m[u[(v+1)%3]],c[0]=Math.min(n,r),c[1]=Math.max(n,r),void 0===l[i=c[0]+","+c[1]]?l[i]={index1:c[0],index2:c[1],face1:d,face2:void 0}:l[i].face2=d;for(i in l){var g=l[i];if(void 0===g.face2||p[g.face1].normal.dot(p[g.face2].normal)<=s){var y=h[g.index1];o.push(y.x,y.y,y.z),y=h[g.index2],o.push(y.x,y.y,y.z)}}this.addAttribute("position",new rr(o,3))}function $o(e,t,n,r,i,a,o,s){Yn.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new es(e,t,n,r,i,a,o,s)),this.mergeVertices()}function es(e,t,n,r,i,a,o,s){cr.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};var c=this;e=void 0!==e?e:1,t=void 0!==t?t:1,n=n||1,r=Math.floor(r)||8,i=Math.floor(i)||1,a=void 0!==a&&a,o=void 0!==o?o:0,s=void 0!==s?s:2*Math.PI;var l=[],u=[],h=[],p=[],d=0,f=[],m=n/2,v=0;function g(n){var i,a,f,g=new tn,y=new an,x=0,b=!0===n?e:t,w=!0===n?1:-1;for(a=d,i=1;i<=r;i++)u.push(0,m*w,0),h.push(0,w,0),p.push(.5,.5),d++;for(f=d,i=0;i<=r;i++){var _=i/r*s+o,M=Math.cos(_),S=Math.sin(_);y.x=b*S,y.y=m*w,y.z=b*M,u.push(y.x,y.y,y.z),h.push(0,w,0),g.x=.5*M+.5,g.y=.5*S*w+.5,p.push(g.x,g.y),d++}for(i=0;i<r;i++){var T=a+i,E=f+i;!0===n?l.push(E,E+1,T):l.push(E+1,E,T),x+=3}c.addGroup(v,x,!0===n?1:2),v+=x}!function(){var a,g,y=new an,x=new an,b=0,w=(t-e)/n;for(g=0;g<=i;g++){var _=[],M=g/i,S=M*(t-e)+e;for(a=0;a<=r;a++){var T=a/r,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,u.push(x.x,x.y,x.z),y.set(A,w,L).normalize(),h.push(y.x,y.y,y.z),p.push(T,1-M),_.push(d++)}f.push(_)}for(a=0;a<r;a++)for(g=0;g<i;g++){var P=f[g][a],R=f[g+1][a],C=f[g+1][a+1],O=f[g][a+1];l.push(P,R,O),l.push(R,C,O),b+=6}c.addGroup(v,b,0),v+=b}(),!1===a&&(e>0&&g(!0),t>0&&g(!1)),this.setIndex(l),this.addAttribute("position",new rr(u,3)),this.addAttribute("normal",new rr(h,3)),this.addAttribute("uv",new rr(p,2))}function ts(e,t,n,r,i,a,o){$o.call(this,0,e,t,n,r,i,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function ns(e,t,n,r,i,a,o){es.call(this,0,e,t,n,r,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}function rs(e,t,n,r){Yn.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new is(e,t,n,r)),this.mergeVertices()}function is(e,t,n,r){cr.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var i,a,o=[],s=[],c=[],l=[],u=new an,h=new tn;for(s.push(0,0,0),c.push(0,0,1),l.push(.5,.5),a=0,i=3;a<=t;a++,i+=3){var p=n+a/t*r;u.x=e*Math.cos(p),u.y=e*Math.sin(p),s.push(u.x,u.y,u.z),c.push(0,0,1),h.x=(s[i]/e+1)/2,h.y=(s[i+1]/e+1)/2,l.push(h.x,h.y)}for(i=1;i<=t;i++)o.push(i,i+1,0);this.setIndex(o),this.addAttribute("position",new rr(s,3)),this.addAttribute("normal",new rr(c,3)),this.addAttribute("uv",new rr(l,2))}Go.prototype=Object.create(Yn.prototype),Go.prototype.constructor=Go,Ho.prototype=Object.create(Uo.prototype),Ho.prototype.constructor=Ho,jo.prototype=Object.create(Yn.prototype),jo.prototype.constructor=jo,Vo.prototype=Object.create(cr.prototype),Vo.prototype.constructor=Vo,Wo.prototype=Object.create(Yn.prototype),Wo.prototype.constructor=Wo,qo.prototype=Object.create(cr.prototype),qo.prototype.constructor=qo,Xo.prototype=Object.create(Yn.prototype),Xo.prototype.constructor=Xo,Yo.prototype=Object.create(cr.prototype),Yo.prototype.constructor=Yo,Jo.prototype=Object.create(Yn.prototype),Jo.prototype.constructor=Jo,Jo.prototype.toJSON=function(){var e=Yn.prototype.toJSON.call(this);return Ko(this.parameters.shapes,e)},Zo.prototype=Object.create(cr.prototype),Zo.prototype.constructor=Zo,Zo.prototype.toJSON=function(){var e=cr.prototype.toJSON.call(this);return Ko(this.parameters.shapes,e)},Qo.prototype=Object.create(cr.prototype),Qo.prototype.constructor=Qo,$o.prototype=Object.create(Yn.prototype),$o.prototype.constructor=$o,es.prototype=Object.create(cr.prototype),es.prototype.constructor=es,ts.prototype=Object.create($o.prototype),ts.prototype.constructor=ts,ns.prototype=Object.create(es.prototype),ns.prototype.constructor=ns,rs.prototype=Object.create(Yn.prototype),rs.prototype.constructor=rs,is.prototype=Object.create(cr.prototype),is.prototype.constructor=is;var as=Object.freeze({WireframeGeometry:qa,ParametricGeometry:Xa,ParametricBufferGeometry:Ya,TetrahedronGeometry:Ka,TetrahedronBufferGeometry:Qa,OctahedronGeometry:$a,OctahedronBufferGeometry:eo,IcosahedronGeometry:to,IcosahedronBufferGeometry:no,DodecahedronGeometry:ro,DodecahedronBufferGeometry:io,PolyhedronGeometry:Ja,PolyhedronBufferGeometry:Za,TubeGeometry:ao,TubeBufferGeometry:oo,TorusKnotGeometry:so,TorusKnotBufferGeometry:co,TorusGeometry:lo,TorusBufferGeometry:uo,TextGeometry:Go,TextBufferGeometry:Ho,SphereGeometry:jo,SphereBufferGeometry:Vo,RingGeometry:Wo,RingBufferGeometry:qo,PlaneGeometry:hr,PlaneBufferGeometry:pr,LatheGeometry:Xo,LatheBufferGeometry:Yo,ShapeGeometry:Jo,ShapeBufferGeometry:Zo,ExtrudeGeometry:zo,ExtrudeBufferGeometry:Uo,EdgesGeometry:Qo,ConeGeometry:ts,ConeBufferGeometry:ns,CylinderGeometry:$o,CylinderBufferGeometry:es,CircleGeometry:rs,CircleBufferGeometry:is,BoxGeometry:lr,BoxBufferGeometry:ur});function os(e){Er.call(this),this.type="ShadowMaterial",this.color=new On(0),this.transparent=!0,this.setValues(e)}function ss(e){Ar.call(this,e),this.type="RawShaderMaterial"}function cs(e){Er.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new On(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qt,this.normalScale=new tn(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.setValues(e)}function ls(e){cs.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}function us(e){Er.call(this),this.type="MeshPhongMaterial",this.color=new On(16777215),this.specular=new On(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qt,this.normalScale=new tn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Me,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 hs(e){us.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function ps(e){Er.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qt,this.normalScale=new tn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function ds(e){Er.call(this),this.type="MeshLambertMaterial",this.color=new On(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Me,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 fs(e){Er.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new On(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Qt,this.normalScale=new tn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.lights=!1,this.setValues(e)}function ms(e){Na.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}os.prototype=Object.create(Er.prototype),os.prototype.constructor=os,os.prototype.isShadowMaterial=!0,os.prototype.copy=function(e){return Er.prototype.copy.call(this,e),this.color.copy(e.color),this},ss.prototype=Object.create(Ar.prototype),ss.prototype.constructor=ss,ss.prototype.isRawShaderMaterial=!0,cs.prototype=Object.create(Er.prototype),cs.prototype.constructor=cs,cs.prototype.isMeshStandardMaterial=!0,cs.prototype.copy=function(e){return Er.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},ls.prototype=Object.create(cs.prototype),ls.prototype.constructor=ls,ls.prototype.isMeshPhysicalMaterial=!0,ls.prototype.copy=function(e){return cs.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this},us.prototype=Object.create(Er.prototype),us.prototype.constructor=us,us.prototype.isMeshPhongMaterial=!0,us.prototype.copy=function(e){return Er.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},hs.prototype=Object.create(us.prototype),hs.prototype.constructor=hs,hs.prototype.isMeshToonMaterial=!0,hs.prototype.copy=function(e){return us.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},ps.prototype=Object.create(Er.prototype),ps.prototype.constructor=ps,ps.prototype.isMeshNormalMaterial=!0,ps.prototype.copy=function(e){return Er.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},ds.prototype=Object.create(Er.prototype),ds.prototype.constructor=ds,ds.prototype.isMeshLambertMaterial=!0,ds.prototype.copy=function(e){return Er.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},fs.prototype=Object.create(Er.prototype),fs.prototype.constructor=fs,fs.prototype.isMeshMatcapMaterial=!0,fs.prototype.copy=function(e){return Er.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},ms.prototype=Object.create(Na.prototype),ms.prototype.constructor=ms,ms.prototype.isLineDashedMaterial=!0,ms.prototype.copy=function(e){return Na.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var vs=Object.freeze({ShadowMaterial:os,SpriteMaterial:Ra,RawShaderMaterial:ss,ShaderMaterial:Ar,PointsMaterial:Fa,MeshPhysicalMaterial:ls,MeshStandardMaterial:cs,MeshPhongMaterial:us,MeshToonMaterial:hs,MeshNormalMaterial:ps,MeshLambertMaterial:ds,MeshDepthMaterial:ra,MeshDistanceMaterial:ia,MeshBasicMaterial:Rr,MeshMatcapMaterial:fs,LineDashedMaterial:ms,LineBasicMaterial:Na,Material:Er}),gs={arraySlice:function(e,t,n){return gs.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)&&!_instanceof(e,DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),r=0;r!==t;++r)n[r]=r;return n.sort(function(t,n){return e[t]-e[n]}),n},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,c=0;c!==t;++c)i[o++]=e[s+c];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];void 0!==a&&void 0===a[r];)a=e[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[r])&&(t.push(a.time),n.push.apply(n,o)),a=e[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[r])&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++]}while(void 0!==a);else do{void 0!==(o=a[r])&&(t.push(a.time),n.push(o)),a=e[i++]}while(void 0!==a)}}};function ys(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function xs(e,t,n,r){ys.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function bs(e,t,n,r){ys.call(this,e,t,n,r)}function ws(e,t,n,r){ys.call(this,e,t,n,r)}function _s(e,t,n,r){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=gs.convertArray(t,this.TimeBufferType),this.values=gs.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}function Ms(e,t,n){_s.call(this,e,t,n)}function Ss(e,t,n,r){_s.call(this,e,t,n,r)}function Ts(e,t,n,r){_s.call(this,e,t,n,r)}function Es(e,t,n,r){ys.call(this,e,t,n,r)}function As(e,t,n,r){_s.call(this,e,t,n,r)}function Ls(e,t,n,r){_s.call(this,e,t,n,r)}function Ps(e,t,n,r){_s.call(this,e,t,n,r)}function Rs(e,t,n){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.uuid=en.generateUUID(),this.duration<0&&this.resetDuration()}function Cs(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 Ts;case"vector":case"vector2":case"vector3":case"vector4":return Ps;case"color":return Ss;case"quaternion":return As;case"bool":case"boolean":return Ms;case"string":return Ls}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],r=[];gs.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(ys.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var a;n:{r:if(!(e<r)){for(var o=n+2;;){if(void 0===r){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,e<(r=t[++n]))break t}a=t.length;break n}if(e>=i)break e;var s=t[1];e<s&&(n=2,i=s);for(o=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,e>=(i=t[--n-1]))break t}a=n,n=0}for(;n<a;){var c=n+a>>>1;e<t[c]?a=c:n=c+1}if(r=t[n],void 0===(i=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,r);if(void 0===r)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(ys.prototype,{beforeStart_:ys.prototype.copySampleValue_,afterEnd_:ys.prototype.copySampleValue_}),xs.prototype=Object.assign(Object.create(ys.prototype),{constructor:xs,DefaultSettings_:{endingStart:Bt,endingEnd:Bt},intervalChanged_:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:i=e,o=2*t-n;break;case 2402:o=t+r[i=r.length-2]-r[i+1];break;default:i=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+r[1]-r[0];break;default:a=e-1,s=t}var c=.5*(n-t),l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l},interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,p=this._weightNext,d=(n-t)/(r-t),f=d*d,m=f*d,v=-h*m+2*h*f-h*d,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*d+1,y=(-1-p)*m+(1.5+p)*f+.5*d,x=p*m-p*f,b=0;b!==o;++b)i[b]=v*a[l+b]+g*a[c+b]+y*a[s+b]+x*a[u+b];return i}}),bs.prototype=Object.assign(Object.create(ys.prototype),{constructor:bs,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l,h=0;h!==o;++h)i[h]=a[c+h]*u+a[s+h]*l;return i}}),ws.prototype=Object.assign(Object.create(ys.prototype),{constructor:ws,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(_s,{toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:gs.convertArray(e.times,Array),values:gs.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}),Object.assign(_s.prototype,{constructor:_s,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new ws(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new bs(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new xs(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,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=gs.arraySlice(n,i,a),this.values=gs.arraySlice(this.values,i*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,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;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!==r&&gs.isTypedArray(r)){o=0;for(var c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),r=2302===this.getInterpolation(),i=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o];if(c!==e[o+1]&&(1!==o||c!==c[0]))if(r)s=!0;else for(var l=o*n,u=l-n,h=l+n,p=0;p!==n;++p){var d=t[l+p];if(d!==t[u+p]||d!==t[h+p]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];var f=o*n,m=i*n;for(p=0;p!==n;++p)t[m+p]=t[f+p]}++i}}if(a>0){e[i]=e[a];for(f=a*n,m=i*n,p=0;p!==n;++p)t[m+p]=t[f+p];++i}return i!==e.length&&(this.times=gs.arraySlice(e,0,i),this.values=gs.arraySlice(t,0,i*n)),this},clone:function(){var e=gs.arraySlice(this.times,0),t=gs.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),Ms.prototype=Object.assign(Object.create(_s.prototype),{constructor:Ms,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ss.prototype=Object.assign(Object.create(_s.prototype),{constructor:Ss,ValueTypeName:"color"}),Ts.prototype=Object.assign(Object.create(_s.prototype),{constructor:Ts,ValueTypeName:"number"}),Es.prototype=Object.assign(Object.create(ys.prototype),{constructor:Es,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(n-t)/(r-t),l=s+o;s!==l;s+=4)rn.slerpFlat(i,0,a,s-o,a,s,c);return i}}),As.prototype=Object.assign(Object.create(_s.prototype),{constructor:As,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new Es(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Ls.prototype=Object.assign(Object.create(_s.prototype),{constructor:Ls,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Ps.prototype=Object.assign(Object.create(_s.prototype),{constructor:Ps,ValueTypeName:"vector"}),Object.assign(Rs,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Cs(n[i]).scale(r));return new Rs(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},i=0,a=n.length;i!==a;++i)t.push(_s.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var l=gs.getKeyframeOrder(s);s=gs.sortedArray(s,1,l),c=gs.sortedArray(c,1,l),r||0!==s[0]||(s.push(i),c.push(c[0])),a.push(new Ts(".morphTargetInfluences["+t[o].name+"]",s,c).scale(1/n))}return new Rs(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(i);if(c&&c.length>1){var l=r[h=c[1]];l||(r[h]=l=[]),l.push(s)}}var u=[];for(var h in r)u.push(Rs.CreateFromMorphTargetSequence(h,r[h],t,n));return u},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,r,i){if(0!==n.length){var a=[],o=[];gs.flattenJSON(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],c=0;c<s.length;c++){var l=s[c].keys;if(l&&0!==l.length)if(l[0].morphTargets){for(var u={},h=0;h<l.length;h++)if(l[h].morphTargets)for(var p=0;p<l[h].morphTargets.length;p++)u[l[h].morphTargets[p]]=-1;for(var d in u){var f=[],m=[];for(p=0;p!==l[h].morphTargets.length;++p){var v=l[h];f.push(v.time),m.push(v.morphTarget===d?1:0)}r.push(new Ts(".morphTargetInfluence["+d+"]",f,m))}a=u.length*(o||1)}else{var g=".bones["+t[c].name+"]";n(Ps,g+".position",l,"pos",r),n(As,g+".quaternion",l,"rot",r),n(Ps,g+".scale",l,"scl",r)}}return 0===r.length?null:new Rs(i,a,r)}}),Object.assign(Rs.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var r=this.tracks[t];e=Math.max(e,r.times[r.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 Rs(this.name,this.duration,e)}});var Os={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 Is(e,t,n){var r=this,i=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){o++,!1===i&&void 0!==r.onStart&&r.onStart(e,a,o),i=!0},this.itemEnd=function(e){a++,void 0!==r.onProgress&&r.onProgress(e,a,o),a===o&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this}}var ks=new Is,Ds={};function Ns(e){this.manager=void 0!==e?e:ks}function zs(e){this.manager=void 0!==e?e:ks,this._parser=null}function Us(e){this.manager=void 0!==e?e:ks}function Bs(e){this.manager=void 0!==e?e:ks}function Fs(e){this.manager=void 0!==e?e:ks}function Gs(){this.type="Curve",this.arcLengthDivisions=200}function Hs(e,t,n,r,i,a,o,s){Gs.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function js(e,t,n,r,i,a){Hs.call(this,e,t,n,n,r,i,a),this.type="ArcCurve"}function Vs(){var e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){var c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;i(t,n,c*=o,l*=o)},calc:function(i){var a=i*i;return e+t*i+n*a+r*(a*i)}}}Object.assign(Ns.prototype,{load:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Os.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;if(void 0===Ds[e]){var o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var s=o[1],c=!!o[2],l=o[3];l=decodeURIComponent(l),c&&(l=atob(l));try{var u,h=(this.responseType||"").toLowerCase();switch(h){case"arraybuffer":case"blob":for(var p=new Uint8Array(l.length),d=0;d<l.length;d++)p[d]=l.charCodeAt(d);u="blob"===h?new Blob([p.buffer],{type:s}):p.buffer;break;case"document":var f=new DOMParser;u=f.parseFromString(l,s);break;case"json":u=JSON.parse(l);break;default:u=l}setTimeout(function(){t&&t(u),i.manager.itemEnd(e)},0)}catch(t){setTimeout(function(){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)},0)}}else{Ds[e]=[],Ds[e].push({onLoad:t,onProgress:n,onError:r});var m=new XMLHttpRequest;for(var v in m.open("GET",e,!0),m.addEventListener("load",function(t){var n=this.response;Os.add(e,n);var r=Ds[e];if(delete Ds[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received.");for(var a=0,o=r.length;a<o;a++){(s=r[a]).onLoad&&s.onLoad(n)}i.manager.itemEnd(e)}else{for(a=0,o=r.length;a<o;a++){var s;(s=r[a]).onError&&s.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)}},!1),m.addEventListener("progress",function(t){for(var n=Ds[e],r=0,i=n.length;r<i;r++){var a=n[r];a.onProgress&&a.onProgress(t)}},!1),m.addEventListener("error",function(t){var n=Ds[e];delete Ds[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),m.addEventListener("abort",function(t){var n=Ds[e];delete Ds[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e),i.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(v,this.requestHeader[v]);m.send(null)}return i.manager.itemStart(e),m}Ds[e].push({onLoad:t,onProgress:n,onError:r})},setPath:function(e){return this.path=e,this},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}}),Object.assign(function(e){this.manager=void 0!==e?e:ks}.prototype,{load:function(e,t,n,r){var i=this,a=new Ns(i.manager);a.setPath(i.path),a.load(e,function(e){t(i.parse(JSON.parse(e)))},n,r)},parse:function(e,t){for(var n=[],r=0;r<e.length;r++){var i=Rs.parse(e[r]);n.push(i)}t(n)},setPath:function(e){return this.path=e,this}}),Object.assign(function(e){this.manager=void 0!==e?e:ks,this._parser=null}.prototype,{load:function(e,t,n,r){var i=this,a=[],o=new ja;o.image=a;var s=new Ns(this.manager);function c(c){s.load(e[c],function(e){var n=i._parser(e,!0);a[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(o.minFilter=We),o.format=n.format,o.needsUpdate=!0,t&&t(o))},n,r)}if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(e))for(var l=0,u=0,h=e.length;u<h;++u)c(u);else s.load(e,function(e){var n=i._parser(e,!0);if(n.isCubemap)for(var r=n.mipmaps.length/n.mipmapCount,s=0;s<r;s++){a[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),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=We),o.format=n.format,o.needsUpdate=!0,t&&t(o)},n,r);return o},setPath:function(e){return this.path=e,this}}),Object.assign(zs.prototype,{load:function(e,t,n,r){var i=this,a=new xn,o=new Ns(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,function(e){var n=i._parser(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:Fe,a.wrapT=void 0!==n.wrapT?n.wrapT:Fe,a.magFilter=void 0!==n.magFilter?n.magFilter:We,a.minFilter=void 0!==n.minFilter?n.minFilter:Xe,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),1===n.mipmapCount&&(a.minFilter=We),a.needsUpdate=!0,t&&t(a,n))},n,r),a},setPath:function(e){return this.path=e,this}}),Object.assign(Us.prototype,{crossOrigin:"anonymous",load:function(e,t,n,r){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Os.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.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",c,!1),Os.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",c,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Bs.prototype,{crossOrigin:"anonymous",load:function(e,t,n,r){var i=new jr,a=new Us(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],function(e){i.images[n]=e,6===++o&&(i.needsUpdate=!0,t&&t(i))},void 0,r)}for(var c=0;c<e.length;++c)s(c);return i},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Fs.prototype,{crossOrigin:"anonymous",load:function(e,t,n,r){var i=new fn,a=new Us(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(n){i.image=n;var r=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);i.format=r?st:ct,i.needsUpdate=!0,void 0!==t&&t(i)},n,r),i},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(Gs.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,r=[],i=this.getPoint(0),a=0;for(r.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(i),r.push(a),i=t;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t||e*r[a-1];for(var o,s=0,c=a-1;s<=c;)if((o=r[i=Math.floor(s+(c-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){c=i;break}c=i-1}if(r[i=c]===n)return i/(a-1);var l=r[i];return(i+(n-l)/(r[i+1]-l))/(a-1)},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),n>1&&(n=1);var r=this.getPoint(t);return this.getPoint(n).clone().sub(r).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,r,i,a=new an,o=[],s=[],c=[],l=new an,u=new nn;for(n=0;n<=e;n++)r=n/e,o[n]=this.getTangentAt(r),o[n].normalize();s[0]=new an,c[0]=new an;var h=Number.MAX_VALUE,p=Math.abs(o[0].x),d=Math.abs(o[0].y),f=Math.abs(o[0].z);for(p<=h&&(h=p,a.set(1,0,0)),d<=h&&(h=d,a.set(0,1,0)),f<=h&&a.set(0,0,1),l.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],l),c[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),l.crossVectors(o[n-1],o[n]),l.length()>Number.EPSILON&&(l.normalize(),i=Math.acos(en.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(l,i))),c[n].crossVectors(o[n],s[n]);if(!0===t)for(i=Math.acos(en.clamp(s[0].dot(s[e]),-1,1)),i/=e,o[0].dot(l.crossVectors(s[0],s[e]))>0&&(i=-i),n=1;n<=e;n++)s[n].applyMatrix4(u.makeRotationAxis(o[n],i*n)),c[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:c}},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}}),Hs.prototype=Object.create(Gs.prototype),Hs.prototype.constructor=Hs,Hs.prototype.isEllipseCurve=!0,Hs.prototype.getPoint=function(e,t){for(var n=t||new tn,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=a?0:r),!0!==this.aClockwise||a||(i===r?i=-r:i-=r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,p=c-this.aY;s=h*l-p*u+this.aX,c=h*u+p*l+this.aY}return n.set(s,c)},Hs.prototype.copy=function(e){return Gs.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},Hs.prototype.toJSON=function(){var e=Gs.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},Hs.prototype.fromJSON=function(e){return Gs.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},js.prototype=Object.create(Hs.prototype),js.prototype.constructor=js,js.prototype.isArcCurve=!0;var Ws=new an,qs=new Vs,Xs=new Vs,Ys=new Vs;function Js(e,t,n,r){Gs.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=r||.5}function Zs(e,t,n,r,i){var a=.5*(r-t),o=.5*(i-n),s=e*e;return(2*n-2*r+a+o)*(e*s)+(-3*n+3*r-2*a-o)*s+a*e+n}function Ks(e,t,n,r){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,r)}function Qs(e,t,n,r,i){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,r)+function(e,t){return e*e*e*t}(e,i)}function $s(e,t,n,r){Gs.call(this),this.type="CubicBezierCurve",this.v0=e||new tn,this.v1=t||new tn,this.v2=n||new tn,this.v3=r||new tn}function ec(e,t,n,r){Gs.call(this),this.type="CubicBezierCurve3",this.v0=e||new an,this.v1=t||new an,this.v2=n||new an,this.v3=r||new an}function tc(e,t){Gs.call(this),this.type="LineCurve",this.v1=e||new tn,this.v2=t||new tn}function nc(e,t){Gs.call(this),this.type="LineCurve3",this.v1=e||new an,this.v2=t||new an}function rc(e,t,n){Gs.call(this),this.type="QuadraticBezierCurve",this.v0=e||new tn,this.v1=t||new tn,this.v2=n||new tn}function ic(e,t,n){Gs.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new an,this.v1=t||new an,this.v2=n||new an}function ac(e){Gs.call(this),this.type="SplineCurve",this.points=e||[]}Js.prototype=Object.create(Gs.prototype),Js.prototype.constructor=Js,Js.prototype.isCatmullRomCurve3=!0,Js.prototype.getPoint=function(e,t){var n,r,i,a,o=t||new an,s=this.points,c=s.length,l=(c-(this.closed?0:1))*e,u=Math.floor(l),h=l-u;if(this.closed?u+=u>0?0:(Math.floor(Math.abs(u)/c)+1)*c:0===h&&u===c-1&&(u=c-2,h=1),this.closed||u>0?n=s[(u-1)%c]:(Ws.subVectors(s[0],s[1]).add(s[0]),n=Ws),r=s[u%c],i=s[(u+1)%c],this.closed||u+2<c?a=s[(u+2)%c]:(Ws.subVectors(s[c-1],s[c-2]).add(s[c-1]),a=Ws),"centripetal"===this.curveType||"chordal"===this.curveType){var p="chordal"===this.curveType?.5:.25,d=Math.pow(n.distanceToSquared(r),p),f=Math.pow(r.distanceToSquared(i),p),m=Math.pow(i.distanceToSquared(a),p);f<1e-4&&(f=1),d<1e-4&&(d=f),m<1e-4&&(m=f),qs.initNonuniformCatmullRom(n.x,r.x,i.x,a.x,d,f,m),Xs.initNonuniformCatmullRom(n.y,r.y,i.y,a.y,d,f,m),Ys.initNonuniformCatmullRom(n.z,r.z,i.z,a.z,d,f,m)}else"catmullrom"===this.curveType&&(qs.initCatmullRom(n.x,r.x,i.x,a.x,this.tension),Xs.initCatmullRom(n.y,r.y,i.y,a.y,this.tension),Ys.initCatmullRom(n.z,r.z,i.z,a.z,this.tension));return o.set(qs.calc(h),Xs.calc(h),Ys.calc(h)),o},Js.prototype.copy=function(e){Gs.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},Js.prototype.toJSON=function(){var e=Gs.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},Js.prototype.fromJSON=function(e){Gs.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push((new an).fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},$s.prototype=Object.create(Gs.prototype),$s.prototype.constructor=$s,$s.prototype.isCubicBezierCurve=!0,$s.prototype.getPoint=function(e,t){var n=t||new tn,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Qs(e,r.x,i.x,a.x,o.x),Qs(e,r.y,i.y,a.y,o.y)),n},$s.prototype.copy=function(e){return Gs.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},$s.prototype.toJSON=function(){var e=Gs.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},$s.prototype.fromJSON=function(e){return Gs.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},ec.prototype=Object.create(Gs.prototype),ec.prototype.constructor=ec,ec.prototype.isCubicBezierCurve3=!0,ec.prototype.getPoint=function(e,t){var n=t||new an,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Qs(e,r.x,i.x,a.x,o.x),Qs(e,r.y,i.y,a.y,o.y),Qs(e,r.z,i.z,a.z,o.z)),n},ec.prototype.copy=function(e){return Gs.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},ec.prototype.toJSON=function(){var e=Gs.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},ec.prototype.fromJSON=function(e){return Gs.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},tc.prototype=Object.create(Gs.prototype),tc.prototype.constructor=tc,tc.prototype.isLineCurve=!0,tc.prototype.getPoint=function(e,t){var n=t||new tn;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},tc.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},tc.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},tc.prototype.copy=function(e){return Gs.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},tc.prototype.toJSON=function(){var e=Gs.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},tc.prototype.fromJSON=function(e){return Gs.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},nc.prototype=Object.create(Gs.prototype),nc.prototype.constructor=nc,nc.prototype.isLineCurve3=!0,nc.prototype.getPoint=function(e,t){var n=t||new an;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},nc.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},nc.prototype.copy=function(e){return Gs.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},nc.prototype.toJSON=function(){var e=Gs.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},nc.prototype.fromJSON=function(e){return Gs.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},rc.prototype=Object.create(Gs.prototype),rc.prototype.constructor=rc,rc.prototype.isQuadraticBezierCurve=!0,rc.prototype.getPoint=function(e,t){var n=t||new tn,r=this.v0,i=this.v1,a=this.v2;return n.set(Ks(e,r.x,i.x,a.x),Ks(e,r.y,i.y,a.y)),n},rc.prototype.copy=function(e){return Gs.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},rc.prototype.toJSON=function(){var e=Gs.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},rc.prototype.fromJSON=function(e){return Gs.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ic.prototype=Object.create(Gs.prototype),ic.prototype.constructor=ic,ic.prototype.isQuadraticBezierCurve3=!0,ic.prototype.getPoint=function(e,t){var n=t||new an,r=this.v0,i=this.v1,a=this.v2;return n.set(Ks(e,r.x,i.x,a.x),Ks(e,r.y,i.y,a.y),Ks(e,r.z,i.z,a.z)),n},ic.prototype.copy=function(e){return Gs.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},ic.prototype.toJSON=function(){var e=Gs.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},ic.prototype.fromJSON=function(e){return Gs.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},ac.prototype=Object.create(Gs.prototype),ac.prototype.constructor=ac,ac.prototype.isSplineCurve=!0,ac.prototype.getPoint=function(e,t){var n=t||new tn,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Zs(o,s.x,c.x,l.x,u.x),Zs(o,s.y,c.y,l.y,u.y)),n},ac.prototype.copy=function(e){Gs.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this},ac.prototype.toJSON=function(){var e=Gs.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e},ac.prototype.fromJSON=function(e){Gs.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push((new tn).fromArray(r))}return this};var oc=Object.freeze({ArcCurve:js,CatmullRomCurve3:Js,CubicBezierCurve:$s,CubicBezierCurve3:ec,EllipseCurve:Hs,LineCurve:tc,LineCurve3:nc,QuadraticBezierCurve:rc,QuadraticBezierCurve3:ic,SplineCurve:ac});function sc(){Gs.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function cc(e){sc.call(this),this.type="Path",this.currentPoint=new tn,e&&this.setFromPoints(e)}function lc(e){cc.call(this,e),this.uuid=en.generateUUID(),this.type="Shape",this.holes=[]}function uc(e,t){Vn.call(this),this.type="Light",this.color=new On(e),this.intensity=void 0!==t?t:1,this.receiveShadow=void 0}function hc(e,t,n){uc.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(Vn.DefaultUp),this.updateMatrix(),this.groundColor=new On(t)}function pc(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new tn(512,512),this.map=null,this.matrix=new nn}function dc(){pc.call(this,new ha(50,1,.5,500))}function fc(e,t,n,r,i,a){uc.call(this,e,t),this.type="SpotLight",this.position.copy(Vn.DefaultUp),this.updateMatrix(),this.target=new Vn,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!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==a?a:1,this.shadow=new dc}function mc(e,t,n,r){uc.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!==r?r:1,this.shadow=new pc(new ha(90,1,.5,500))}function vc(e,t,n,r,i,a){ua.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!==r?r:-1,this.near=void 0!==i?i:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function gc(){pc.call(this,new vc(-5,5,5,-5,.5,500))}function yc(e,t){uc.call(this,e,t),this.type="DirectionalLight",this.position.copy(Vn.DefaultUp),this.updateMatrix(),this.target=new Vn,this.shadow=new gc}function xc(e,t){uc.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}function bc(e,t,n,r){uc.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function wc(e){this.manager=void 0!==e?e:ks,this.textures={}}sc.prototype=Object.assign(Object.create(Gs.prototype),{constructor:sc,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 tc(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}r++}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,r=this.curves.length;n<r;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=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];t&&t.equals(l)||(n.push(l),t=l)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){Gs.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Gs.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e},fromJSON:function(e){Gs.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push((new oc[r.type]).fromJSON(r))}return this}}),cc.prototype=Object.assign(Object.create(sc.prototype),{constructor:cc,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)},moveTo:function(e,t){this.currentPoint.set(e,t)},lineTo:function(e,t){var n=new tc(this.currentPoint.clone(),new tn(e,t));this.curves.push(n),this.currentPoint.set(e,t)},quadraticCurveTo:function(e,t,n,r){var i=new rc(this.currentPoint.clone(),new tn(e,t),new tn(n,r));this.curves.push(i),this.currentPoint.set(n,r)},bezierCurveTo:function(e,t,n,r,i,a){var o=new $s(this.currentPoint.clone(),new tn(e,t),new tn(n,r),new tn(i,a));this.curves.push(o),this.currentPoint.set(i,a)},splineThru:function(e){var t=new ac([this.currentPoint.clone()].concat(e));this.curves.push(t),this.currentPoint.copy(e[e.length-1])},arc:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(e+o,t+s,n,r,i,a)},absarc:function(e,t,n,r,i,a){this.absellipse(e,t,n,n,r,i,a)},ellipse:function(e,t,n,r,i,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;this.absellipse(e+c,t+l,n,r,i,a,o,s)},absellipse:function(e,t,n,r,i,a,o,s){var c=new Hs(e,t,n,r,i,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);this.currentPoint.copy(u)},copy:function(e){return sc.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=sc.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return sc.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),lc.prototype=Object.assign(Object.create(cc.prototype),{constructor:lc,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n<r;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){cc.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(r.clone())}return this},toJSON:function(){var e=cc.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e},fromJSON:function(e){cc.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push((new cc).fromJSON(r))}return this}}),uc.prototype=Object.assign(Object.create(Vn.prototype),{constructor:uc,isLight:!0,copy:function(e){return Vn.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=Vn.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}}),hc.prototype=Object.assign(Object.create(uc.prototype),{constructor:hc,isHemisphereLight:!0,copy:function(e){return uc.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(pc.prototype,{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}}),dc.prototype=Object.assign(Object.create(pc.prototype),{constructor:dc,isSpotLightShadow:!0,update:function(e){var t=this.camera,n=2*en.RAD2DEG*e.angle,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;n===t.fov&&r===t.aspect&&i===t.far||(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix())}}),fc.prototype=Object.assign(Object.create(uc.prototype),{constructor:fc,isSpotLight:!0,copy:function(e){return uc.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}}),mc.prototype=Object.assign(Object.create(uc.prototype),{constructor:mc,isPointLight:!0,copy:function(e){return uc.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),vc.prototype=Object.assign(Object.create(ua.prototype),{constructor:vc,isOrthographicCamera:!0,copy:function(e,t){return ua.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,r,i,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=r,this.view.width=i,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,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(null!==this.view&&this.view.enabled){var c=this.zoom/(this.view.width/this.view.fullWidth),l=this.zoom/(this.view.height/this.view.fullHeight),u=(this.right-this.left)/this.view.width,h=(this.top-this.bottom)/this.view.height;a=(i+=u*(this.view.offsetX/c))+u*(this.view.width/c),s=(o-=h*(this.view.offsetY/l))-h*(this.view.height/l)}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Vn.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}}),gc.prototype=Object.assign(Object.create(pc.prototype),{constructor:gc}),yc.prototype=Object.assign(Object.create(uc.prototype),{constructor:yc,isDirectionalLight:!0,copy:function(e){return uc.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),xc.prototype=Object.assign(Object.create(uc.prototype),{constructor:xc,isAmbientLight:!0}),bc.prototype=Object.assign(Object.create(uc.prototype),{constructor:bc,isRectAreaLight:!0,copy:function(e){return uc.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=uc.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}}),Object.assign(wc.prototype,{load:function(e,t,n,r){var i=this,a=new Ns(i.manager);a.setPath(i.path),a.load(e,function(e){t(i.parse(JSON.parse(e)))},n,r)},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 r=new vs[e.type];if(void 0!==e.uuid&&(r.uuid=e.uuid),void 0!==e.name&&(r.name=e.name),void 0!==e.color&&r.color.setHex(e.color),void 0!==e.roughness&&(r.roughness=e.roughness),void 0!==e.metalness&&(r.metalness=e.metalness),void 0!==e.emissive&&r.emissive.setHex(e.emissive),void 0!==e.specular&&r.specular.setHex(e.specular),void 0!==e.shininess&&(r.shininess=e.shininess),void 0!==e.clearCoat&&(r.clearCoat=e.clearCoat),void 0!==e.clearCoatRoughness&&(r.clearCoatRoughness=e.clearCoatRoughness),void 0!==e.vertexColors&&(r.vertexColors=e.vertexColors),void 0!==e.fog&&(r.fog=e.fog),void 0!==e.flatShading&&(r.flatShading=e.flatShading),void 0!==e.blending&&(r.blending=e.blending),void 0!==e.combine&&(r.combine=e.combine),void 0!==e.side&&(r.side=e.side),void 0!==e.opacity&&(r.opacity=e.opacity),void 0!==e.transparent&&(r.transparent=e.transparent),void 0!==e.alphaTest&&(r.alphaTest=e.alphaTest),void 0!==e.depthTest&&(r.depthTest=e.depthTest),void 0!==e.depthWrite&&(r.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(r.colorWrite=e.colorWrite),void 0!==e.wireframe&&(r.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(r.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(r.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(r.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(r.rotation=e.rotation),1!==e.linewidth&&(r.linewidth=e.linewidth),void 0!==e.dashSize&&(r.dashSize=e.dashSize),void 0!==e.gapSize&&(r.gapSize=e.gapSize),void 0!==e.scale&&(r.scale=e.scale),void 0!==e.polygonOffset&&(r.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(r.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(r.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(r.skinning=e.skinning),void 0!==e.morphTargets&&(r.morphTargets=e.morphTargets),void 0!==e.dithering&&(r.dithering=e.dithering),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.uniforms)for(var i in e.uniforms){var a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=n(a.value);break;case"c":r.uniforms[i].value=(new On).setHex(a.value);break;case"v2":r.uniforms[i].value=(new tn).fromArray(a.value);break;case"v3":r.uniforms[i].value=(new an).fromArray(a.value);break;case"v4":r.uniforms[i].value=(new mn).fromArray(a.value);break;case"m3":r.uniforms[i].value=(new on).fromArray(a.value);case"m4":r.uniforms[i].value=(new nn).fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(void 0!==e.defines&&(r.defines=e.defines),void 0!==e.vertexShader&&(r.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(r.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var o in e.extensions)r.extensions[o]=e.extensions[o];if(void 0!==e.shading&&(r.flatShading=1===e.shading),void 0!==e.size&&(r.size=e.size),void 0!==e.sizeAttenuation&&(r.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(r.map=n(e.map)),void 0!==e.alphaMap&&(r.alphaMap=n(e.alphaMap),r.transparent=!0),void 0!==e.bumpMap&&(r.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(r.bumpScale=e.bumpScale),void 0!==e.normalMap&&(r.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(r.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),r.normalScale=(new tn).fromArray(s)}return void 0!==e.displacementMap&&(r.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(r.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(r.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(r.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(r.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(r.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(r.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(r.specularMap=n(e.specularMap)),void 0!==e.envMap&&(r.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(r.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(r.reflectivity=e.reflectivity),void 0!==e.lightMap&&(r.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(r.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(r.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(r.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(r.gradientMap=n(e.gradientMap)),r},setPath:function(e){return this.path=e,this},setTextures:function(e){return this.textures=e,this}});var _c={decodeText:function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);return decodeURIComponent(escape(t))},extractUrlBase:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}};function Mc(e){this.manager=void 0!==e?e:ks}Object.assign(Mc.prototype,{load:function(e,t,n,r){var i=this,a=new Ns(i.manager);a.setPath(i.path),a.load(e,function(e){t(i.parse(JSON.parse(e)))},n,r)},parse:function(e){var t=new cr,n=e.data.index;if(void 0!==n){var r=new Sc[n.type](n.array);t.setIndex(new Jn(r,1))}var i=e.data.attributes;for(var a in i){var o=i[a];r=new Sc[o.type](o.array);t.addAttribute(a,new Jn(r,o.itemSize,o.normalized))}var s=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==s)for(var c=0,l=s.length;c!==l;++c){var u=s[c];t.addGroup(u.start,u.count,u.materialIndex)}var h=e.data.boundingSphere;if(void 0!==h){var p=new an;void 0!==h.center&&p.fromArray(h.center),t.boundingSphere=new wn(p,h.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t},setPath:function(e){return this.path=e,this}});var Sc={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Tc(e){this.manager=void 0!==e?e:ks,this.resourcePath=""}Object.assign(Tc.prototype,{crossOrigin:"anonymous",load:function(e,t,n,r){var i=this,a=void 0===this.path?_c.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new Ns(i.manager);o.setPath(this.path),o.load(e,function(n){var a=null;try{a=JSON.parse(n)}catch(t){return void 0!==r&&r(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()?i.parse(a,t):console.error("THREE.ObjectLoader: Can't load "+e)},n,r)},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setCrossOrigin:function(e){return this.crossOrigin=e,this},parse:function(e,t){var n=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,n),i=this.parseImages(e.images,function(){void 0!==t&&t(s)}),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,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,r=e.length;n<r;n++){var i=(new lc).fromJSON(e[n]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var n={};if(void 0!==e)for(var r=new Mc,i=0,a=e.length;i<a;i++){var o,s=e[i];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new as[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new as[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new as[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new as[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 as[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new as[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 as[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new as[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new as[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new as[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":o=new as[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new as[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var c=[],l=0,u=s.shapes.length;l<u;l++){var h=t[s.shapes[l]];c.push(h)}o=new as[s.type](c,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(c=[],l=0,u=s.shapes.length;l<u;l++){h=t[s.shapes[l]];c.push(h)}var p=s.options.extrudePath;void 0!==p&&(s.options.extrudePath=(new oc[p.type]).fromJSON(p)),o=new as[s.type](c,s.options);break;case"BufferGeometry":o=r.parse(s);break;case"Geometry":if("THREE"in window&&"LegacyJSONLoader"in THREE)o=(new THREE.LegacyJSONLoader).parse(s,this.resourcePath).geometry;else console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');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={},r={};if(void 0!==e){var i=new wc;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if("MultiMaterial"===s.type){for(var c=[],l=0;l<s.materials.length;l++){var u=s.materials[l];void 0===n[u.uuid]&&(n[u.uuid]=i.parse(u)),c.push(n[u.uuid])}r[s.uuid]=c}else void 0===n[s.uuid]&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=Rs.parse(r);void 0!==r.uuid&&(i.uuid=r.uuid),t.push(i)}return t},parseImages:function(e,t){var n=this,r={};function i(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 Us(new Is(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o<s;o++){var c=e[o],l=c.url;if(Array.isArray(l)){r[c.uuid]=[];for(var u=0,h=l.length;u<h;u++){var p=l[u],d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(p)?p:n.resourcePath+p;r[c.uuid].push(i(d))}}else{d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.resourcePath+c.url;r[c.uuid]=i(d)}}}return r},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 r={};if(void 0!==e)for(var i=0,a=e.length;i<a;i++){var o,s=e[i];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 jr(t[s.image]):new fn(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,Cc)),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],Oc),o.wrapT=n(s.wrap[1],Oc)),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,Ic)),void 0!==s.magFilter&&(o.magFilter=n(s.magFilter,Ic)),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),r[s.uuid]=o}return r},parseObject:function(e,t,n){var r;function i(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=[],r=0,i=e.length;r<i;r++){var a=e[r];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":r=new Aa,void 0!==e.background&&Number.isInteger(e.background)&&(r.background=new On(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?r.fog=new Ea(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(r.fog=new Ta(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":r=new ha(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(r.focus=e.focus),void 0!==e.zoom&&(r.zoom=e.zoom),void 0!==e.filmGauge&&(r.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(r.filmOffset=e.filmOffset),void 0!==e.view&&(r.view=Object.assign({},e.view));break;case"OrthographicCamera":r=new vc(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(r.zoom=e.zoom),void 0!==e.view&&(r.view=Object.assign({},e.view));break;case"AmbientLight":r=new xc(e.color,e.intensity);break;case"DirectionalLight":r=new yc(e.color,e.intensity);break;case"PointLight":r=new mc(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":r=new bc(e.color,e.intensity,e.width,e.height);break;case"SpotLight":r=new fc(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":r=new hc(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var o=i(e.geometry),s=a(e.material);r=o.bones&&o.bones.length>0?new Ia(o,s):new Cr(o,s),void 0!==e.drawMode&&r.setDrawMode(e.drawMode);break;case"LOD":r=new Oa;break;case"Line":r=new za(i(e.geometry),a(e.material),e.mode);break;case"LineLoop":r=new Ba(i(e.geometry),a(e.material));break;case"LineSegments":r=new Ua(i(e.geometry),a(e.material));break;case"PointCloud":case"Points":r=new Ga(i(e.geometry),a(e.material));break;case"Sprite":r=new Ca(a(e.material));break;case"Group":r=new la;break;default:r=new Vn}if(r.uuid=e.uuid,void 0!==e.name&&(r.name=e.name),void 0!==e.matrix?(r.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(r.matrixAutoUpdate=e.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==e.position&&r.position.fromArray(e.position),void 0!==e.rotation&&r.rotation.fromArray(e.rotation),void 0!==e.quaternion&&r.quaternion.fromArray(e.quaternion),void 0!==e.scale&&r.scale.fromArray(e.scale)),void 0!==e.castShadow&&(r.castShadow=e.castShadow),void 0!==e.receiveShadow&&(r.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(r.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(r.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&r.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(r.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(r.visible=e.visible),void 0!==e.frustumCulled&&(r.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(r.renderOrder=e.renderOrder),void 0!==e.userData&&(r.userData=e.userData),void 0!==e.layers&&(r.layers.mask=e.layers),void 0!==e.children)for(var c=e.children,l=0;l<c.length;l++)r.add(this.parseObject(c[l],t,n));if("LOD"===e.type)for(var u=e.levels,h=0;h<u.length;h++){var p=u[h],d=r.getObjectByProperty("uuid",p.object);void 0!==d&&r.addLevel(d,p.distance)}return r}});var Ec,Ac,Lc,Pc,Rc,Cc={UVMapping:300,CubeReflectionMapping:Oe,CubeRefractionMapping:Ie,EquirectangularReflectionMapping:ke,EquirectangularRefractionMapping:De,SphericalReflectionMapping:Ne,CubeUVReflectionMapping:ze,CubeUVRefractionMapping:Ue},Oc={RepeatWrapping:Be,ClampToEdgeWrapping:Fe,MirroredRepeatWrapping:Ge},Ic={NearestFilter:He,NearestMipMapNearestFilter:je,NearestMipMapLinearFilter:Ve,LinearFilter:We,LinearMipMapNearestFilter:qe,LinearMipMapLinearFilter:Xe};function kc(){this.type="ShapePath",this.color=new On,this.subPaths=[],this.currentPath=null}function Dc(e){this.type="Font",this.data=e}function Nc(e,t,n,r,i){var a=i.glyphs[e]||i.glyphs["?"];if(a){var o,s,c,l,u,h,p,d,f=new kc;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),v=0,g=m.length;v<g;){switch(m[v++]){case"m":o=m[v++]*t+n,s=m[v++]*t+r,f.moveTo(o,s);break;case"l":o=m[v++]*t+n,s=m[v++]*t+r,f.lineTo(o,s);break;case"q":c=m[v++]*t+n,l=m[v++]*t+r,u=m[v++]*t+n,h=m[v++]*t+r,f.quadraticCurveTo(u,h,c,l);break;case"b":c=m[v++]*t+n,l=m[v++]*t+r,u=m[v++]*t+n,h=m[v++]*t+r,p=m[v++]*t+n,d=m[v++]*t+r,f.bezierCurveTo(u,h,p,d,c,l)}}return{offsetX:a.ha*t,path:f}}}function zc(){}Object.assign(kc.prototype,{moveTo:function(e,t){this.currentPath=new cc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t)},lineTo:function(e,t){this.currentPath.lineTo(e,t)},quadraticCurveTo:function(e,t,n,r){this.currentPath.quadraticCurveTo(e,t,n,r)},bezierCurveTo:function(e,t,n,r,i,a){this.currentPath.bezierCurveTo(e,t,n,r,i,a)},splineThru:function(e){this.currentPath.splineThru(e)},toShapes:function(e,t){function n(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n],a=new lc;a.curves=i.curves,t.push(a)}return t}function r(e,t){for(var n=t.length,r=!1,i=n-1,a=0;a<n;i=a++){var o=t[i],s=t[a],c=s.x-o.x,l=s.y-o.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(o=t[a],c=-c,s=t[i],l=-l),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=l*(e.x-o.x)-c*(e.y-o.y);if(0===u)return!0;if(u<0)continue;r=!r}}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 r}var i=ko.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,c,l=[];if(1===a.length)return s=a[0],(c=new lc).curves=s.curves,l.push(c),l;var u=!i(a[0].getPoints());u=e?!u:u;var h,p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=a.length;g<y;g++)o=i(h=(s=a[g]).getPoints()),(o=e?!o:o)?(!u&&f[v]&&v++,f[v]={s:new lc,p:h},f[v].s.curves=s.curves,u&&v++,m[v]=[]):m[v].push({h:s,p:h[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++)r(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))}g=0;for(var L=f.length;g<L;g++){c=f[g].s,l.push(c);for(var P=0,R=(p=m[g]).length;P<R;P++)c.holes.push(p[P].h)}return l}}),Object.assign(Dc.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var n=[],r=function(e,t,n){for(var r=Array.from?Array.from(e):String(e).split(""),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,c=0,l=0;l<r.length;l++){var u=r[l];if("\n"===u)s=0,c-=a;else{var h=Nc(u,i,s,c,n);s+=h.offsetX,o.push(h.path)}}return o}(e,t,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}}),Object.assign(function(e){this.manager=void 0!==e?e:ks}.prototype,{load:function(e,t,n,r){var i=this,a=new Ns(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 r=i.parse(n);t&&t(r)},n,r)},parse:function(e){return new Dc(e)},setPath:function(e){return this.path=e,this}}),zc.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,r=t.length;n<r;n+=2){var i=t[n],a=t[n+1];if(i.test(e))return a}return null}},Object.assign(zc.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,n){for(var r=[],i=0;i<e.length;++i)r[i]=this.createMaterial(e[i],t,n);return r},createMaterial:(Ec={NoBlending:X,NormalBlending:Y,AdditiveBlending:J,SubtractiveBlending:Z,MultiplyBlending:K,CustomBlending:Q},Ac=new On,Lc=new Fs,Pc=new wc,function(e,t,n){var r={};function i(e,i,a,o,s){var c,l=t+e,u=zc.Handlers.get(l);null!==u?c=u.load(l):(Lc.setCrossOrigin(n),c=Lc.load(l)),void 0!==i&&(c.repeat.fromArray(i),1!==i[0]&&(c.wrapS=Be),1!==i[1]&&(c.wrapT=Be)),void 0!==a&&c.offset.fromArray(a),void 0!==o&&("repeat"===o[0]&&(c.wrapS=Be),"mirror"===o[0]&&(c.wrapS=Ge),"repeat"===o[1]&&(c.wrapT=Be),"mirror"===o[1]&&(c.wrapT=Ge)),void 0!==s&&(c.anisotropy=s);var h=en.generateUUID();return r[h]=c,h}var a={uuid:en.generateUUID(),type:"MeshLambertMaterial"};for(var o in e){var s=e[o];switch(o){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":a.name=s;break;case"blending":a.blending=Ec[s];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",o,"is no longer supported.");break;case"colorDiffuse":a.color=Ac.fromArray(s).getHex();break;case"colorSpecular":a.specular=Ac.fromArray(s).getHex();break;case"colorEmissive":a.emissive=Ac.fromArray(s).getHex();break;case"specularCoef":a.shininess=s;break;case"shading":"basic"===s.toLowerCase()&&(a.type="MeshBasicMaterial"),"phong"===s.toLowerCase()&&(a.type="MeshPhongMaterial"),"standard"===s.toLowerCase()&&(a.type="MeshStandardMaterial");break;case"mapDiffuse":a.map=i(s,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":a.emissiveMap=i(s,e.mapEmissiveRepeat,e.mapEmissiveOffset,e.mapEmissiveWrap,e.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":a.lightMap=i(s,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":a.aoMap=i(s,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":a.bumpMap=i(s,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":a.bumpScale=s;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":a.normalMap=i(s,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":a.normalScale=s;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":a.specularMap=i(s,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":a.metalnessMap=i(s,e.mapMetalnessRepeat,e.mapMetalnessOffset,e.mapMetalnessWrap,e.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":a.roughnessMap=i(s,e.mapRoughnessRepeat,e.mapRoughnessOffset,e.mapRoughnessWrap,e.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":a.alphaMap=i(s,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":a.side=H;break;case"doubleSided":a.side=j;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),a.opacity=s;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":a[o]=s;break;case"vertexColors":!0===s&&(a.vertexColors=q),"face"===s&&(a.vertexColors=W);break;default:console.error("THREE.Loader.createMaterial: Unsupported",o,s)}}return"MeshBasicMaterial"===a.type&&delete a.emissive,"MeshPhongMaterial"!==a.type&&delete a.specular,a.opacity<1&&(a.transparent=!0),Pc.setTextures(r),Pc.parse(a)})});var Uc,Bc,Fc,Gc,Hc,jc,Vc,Wc,qc,Xc,Yc={getContext:function(){return void 0===Rc&&(Rc=new(window.AudioContext||window.webkitAudioContext)),Rc},setContext:function(e){Rc=e}};function Jc(e){this.manager=void 0!==e?e:ks}function Zc(e,t,n,r){Vn.call(this),this.type="CubeCamera";var i=new ha(90,1,e,t);i.up.set(0,-1,0),i.lookAt(new an(1,0,0)),this.add(i);var a=new ha(90,1,e,t);a.up.set(0,-1,0),a.lookAt(new an(-1,0,0)),this.add(a);var o=new ha(90,1,e,t);o.up.set(0,0,1),o.lookAt(new an(0,1,0)),this.add(o);var s=new ha(90,1,e,t);s.up.set(0,0,-1),s.lookAt(new an(0,-1,0)),this.add(s);var c=new ha(90,1,e,t);c.up.set(0,-1,0),c.lookAt(new an(0,0,1)),this.add(c);var l=new ha(90,1,e,t);l.up.set(0,-1,0),l.lookAt(new an(0,0,-1)),this.add(l),r=r||{format:st,magFilter:We,minFilter:We},this.renderTarget=new yn(n,n,r),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=e.getRenderTarget(),r=this.renderTarget,u=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,r.activeCubeFace=0,e.render(t,i,r),r.activeCubeFace=1,e.render(t,a,r),r.activeCubeFace=2,e.render(t,o,r),r.activeCubeFace=3,e.render(t,s,r),r.activeCubeFace=4,e.render(t,c,r),r.texture.generateMipmaps=u,r.activeCubeFace=5,e.render(t,l,r),e.setRenderTarget(n)},this.clear=function(e,t,n,r){for(var i=e.getRenderTarget(),a=this.renderTarget,o=0;o<6;o++)a.activeCubeFace=o,e.setRenderTarget(a),e.clear(t,n,r);e.setRenderTarget(i)}}function Kc(e){this.autoStart=void 0===e||e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function Qc(){Vn.call(this),this.type="AudioListener",this.context=Yc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0}function $c(e){Vn.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.startTime=0,this.offset=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function el(e){$c.call(this,e),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function tl(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 nl(e,t,n){this.binding=e,this.valueSize=n;var r,i=Float64Array;switch(t){case"quaternion":r=this._slerp;break;case"string":case"bool":i=Array,r=this._select;break;default:r=this._lerp}this.buffer=new i(4*n),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}Object.assign(Jc.prototype,{load:function(e,t,n,r){var i=new Ns(this.manager);i.setResponseType("arraybuffer"),i.setPath(this.path),i.load(e,function(e){var n=e.slice(0);Yc.getContext().decodeAudioData(n,function(e){t(e)})},n,r)},setPath:function(e){return this.path=e,this}}),Object.assign(function(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ha,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ha,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}.prototype,{update:(qc=new nn,Xc=new nn,function(e){if(Uc!==this||Bc!==e.focus||Fc!==e.fov||Gc!==e.aspect*this.aspect||Hc!==e.near||jc!==e.far||Vc!==e.zoom||Wc!==this.eyeSep){Uc=this,Bc=e.focus,Fc=e.fov,Gc=e.aspect*this.aspect,Hc=e.near,jc=e.far,Vc=e.zoom;var t,n,r=e.projectionMatrix.clone(),i=(Wc=this.eyeSep/2)*Hc/Bc,a=Hc*Math.tan(en.DEG2RAD*Fc*.5)/Vc;Xc.elements[12]=-Wc,qc.elements[12]=Wc,t=-a*Gc+i,n=a*Gc+i,r.elements[0]=2*Hc/(n-t),r.elements[8]=(n+t)/(n-t),this.cameraL.projectionMatrix.copy(r),t=-a*Gc-i,n=a*Gc-i,r.elements[0]=2*Hc/(n-t),r.elements[8]=(n+t)/(n-t),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Xc),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(qc)})}),Zc.prototype=Object.create(Vn.prototype),Zc.prototype.constructor=Zc,Object.assign(Kc.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}}),Qc.prototype=Object.assign(Object.create(Vn.prototype),{constructor:Qc,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(){var e=new an,t=new rn,n=new an,r=new an,i=new Kc;return function(a){Vn.prototype.updateMatrixWorld.call(this,a);var o=this.context.listener,s=this.up;if(this.timeDelta=i.getDelta(),this.matrixWorld.decompose(e,t,n),r.set(0,0,-1).applyQuaternion(t),o.positionX){var c=this.context.currentTime+this.timeDelta;o.positionX.linearRampToValueAtTime(e.x,c),o.positionY.linearRampToValueAtTime(e.y,c),o.positionZ.linearRampToValueAtTime(e.z,c),o.forwardX.linearRampToValueAtTime(r.x,c),o.forwardY.linearRampToValueAtTime(r.y,c),o.forwardZ.linearRampToValueAtTime(r.z,c),o.upX.linearRampToValueAtTime(s.x,c),o.upY.linearRampToValueAtTime(s.y,c),o.upZ.linearRampToValueAtTime(s.z,c)}else o.setPosition(e.x,e.y,e.z),o.setOrientation(r.x,r.y,r.z,s.x,s.y,s.z)}}()}),$c.prototype=Object.assign(Object.create(Vn.prototype),{constructor:$c,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},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.onended=this.onEnded.bind(this),this.startTime=this.context.currentTime,e.start(this.startTime,this.offset),this.isPlaying=!0,this.source=e,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.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")},stop:function(){if(!1!==this.hasPlaybackControl)return this.source.stop(),this.source.onended=null,this.offset=0,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.")},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}),el.prototype=Object.assign(Object.create($c.prototype),{constructor:el,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(){var e=new an,t=new rn,n=new an,r=new an;return function(i){if(Vn.prototype.updateMatrixWorld.call(this,i),!1!==this.isPlaying){this.matrixWorld.decompose(e,t,n),r.set(0,0,1).applyQuaternion(t);var a=this.panner;if(a.positionX){var o=this.context.currentTime+this.listener.timeDelta;a.positionX.linearRampToValueAtTime(e.x,o),a.positionY.linearRampToValueAtTime(e.y,o),a.positionZ.linearRampToValueAtTime(e.z,o),a.orientationX.linearRampToValueAtTime(r.x,o),a.orientationY.linearRampToValueAtTime(r.y,o),a.orientationZ.linearRampToValueAtTime(r.z,o)}else a.setPosition(e.x,e.y,e.z),a.setOrientation(r.x,r.y,r.z)}}}()}),Object.assign(tl.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(nl.prototype,{accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,i<1){var o=3*t;this._mixBufferRegion(n,r,o,1-i,t)}for(var s=t,c=t+t;s!==c;++s)if(n[s]!==n[s+t]){a.setValue(n,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=3*n;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this.cumulativeWeight=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_select:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){rn.slerpFlat(e,t,e,t,e,n,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}}});var rl,il,al,ol,sl,cl,ll,ul,hl,pl,dl,fl,ml,vl,gl;function yl(e,t,n){var r=n||xl.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}function xl(e,t,n){this.path=t,this.parsedPath=n||xl.parseTrackName(t),this.node=xl.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function bl(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var r=t.tracks,i=r.length,a=new Array(i),o={endingStart:Bt,endingEnd:Bt},s=0;s!==i;++s){var c=r[s].createInterpolant(null);a[s]=c,c.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ut,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 wl(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function _l(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function Ml(){cr.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Sl(e,t,n){La.call(this,e,t),this.meshPerAttribute=n||1}function Tl(e,t,n,r){"number"==typeof n&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),Jn.call(this,e,t,n),this.meshPerAttribute=r||1}function El(e,t,n,r){this.ray=new Lr(e,t),this.near=n||0,this.far=r||1/0,this.params={Mesh:{},Line:{},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 Al(e,t){return e.distance-t.distance}function Ll(e,t,n,r){if(!1!==e.visible&&(e.raycast(t,n),!0===r))for(var i=e.children,a=0,o=i.length;a<o;a++)Ll(i[a],t,n,!0)}function Pl(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}function Rl(e,t){this.min=void 0!==e?e:new tn(1/0,1/0),this.max=void 0!==t?t:new tn(-1/0,-1/0)}function Cl(e,t){this.start=void 0!==e?e:new an,this.end=void 0!==t?t:new an}function Ol(e){Vn.call(this),this.material=e,this.render=function(){}}function Il(e,t,n,r){this.object=e,this.size=void 0!==t?t:1;var i=void 0!==n?n:16711680,a=void 0!==r?r:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var c=new cr,l=new rr(2*o*3,3);c.addAttribute("position",l),Ua.call(this,c,new Na({color:i,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function kl(e,t){Vn.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new cr,r=[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],i=0,a=1;i<32;i++,a++){var o=i/32*Math.PI*2,s=a/32*Math.PI*2;r.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}n.addAttribute("position",new rr(r,3));var c=new Na({fog:!1});this.cone=new Ua(n,c),this.add(this.cone),this.update()}function Dl(e){for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var r=0;r<t.children.length;r++)n.push.apply(n,e(t.children[r]));return n}(e),n=new cr,r=[],i=[],a=new On(0,0,1),o=new On(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}n.addAttribute("position",new rr(r,3)),n.addAttribute("color",new rr(i,3));var l=new Na({vertexColors:q,depthTest:!1,depthWrite:!1,transparent:!0});Ua.call(this,n,l),this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}function Nl(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var r=new Vo(t,4,2),i=new Rr({wireframe:!0,fog:!1});Cr.call(this,r,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function zl(e,t){this.type="RectAreaLightHelper",this.light=e,this.color=t;var n=new cr;n.addAttribute("position",new rr([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),n.computeBoundingSphere();var r=new Na({fog:!1});za.call(this,n,r);var i=new cr;i.addAttribute("position",new rr([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),i.computeBoundingSphere(),this.add(new Cr(i,new Rr({side:H,fog:!1}))),this.update()}function Ul(e,t,n){Vn.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var r=new eo(t);r.rotateY(.5*Math.PI),this.material=new Rr({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=q);var i=r.getAttribute("position"),a=new Float32Array(3*i.count);r.addAttribute("color",new Jn(a,3)),this.add(new Cr(r,this.material)),this.update()}function Bl(e,t,n,r){e=e||10,t=t||10,n=new On(void 0!==n?n:4473924),r=new On(void 0!==r?r:8947848);for(var i=t/2,a=e/t,o=e/2,s=[],c=[],l=0,u=0,h=-o;l<=t;l++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);var p=l===i?n:r;p.toArray(c,u),u+=3,p.toArray(c,u),u+=3,p.toArray(c,u),u+=3,p.toArray(c,u),u+=3}var d=new cr;d.addAttribute("position",new rr(s,3)),d.addAttribute("color",new rr(c,3));var f=new Na({vertexColors:q});Ua.call(this,d,f)}function Fl(e,t,n,r,i,a){e=e||10,t=t||16,n=n||8,r=r||64,i=new On(void 0!==i?i:4473924),a=new On(void 0!==a?a:8947848);var o,s,c,l,u,h,p,d=[],f=[];for(l=0;l<=t;l++)c=l/t*(2*Math.PI),o=Math.sin(c)*e,s=Math.cos(c)*e,d.push(0,0,0),d.push(o,0,s),p=1&l?i:a,f.push(p.r,p.g,p.b),f.push(p.r,p.g,p.b);for(l=0;l<=n;l++)for(p=1&l?i:a,h=e-e/n*l,u=0;u<r;u++)c=u/r*(2*Math.PI),o=Math.sin(c)*h,s=Math.cos(c)*h,d.push(o,0,s),f.push(p.r,p.g,p.b),c=(u+1)/r*(2*Math.PI),o=Math.sin(c)*h,s=Math.cos(c)*h,d.push(o,0,s),f.push(p.r,p.g,p.b);var m=new cr;m.addAttribute("position",new rr(d,3)),m.addAttribute("color",new rr(f,3));var v=new Na({vertexColors:q});Ua.call(this,m,v)}function Gl(e,t,n,r){this.object=e,this.size=void 0!==t?t:1;var i=void 0!==n?n:16776960,a=void 0!==r?r:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new cr,l=new rr(2*o*3,3);c.addAttribute("position",l),Ua.call(this,c,new Na({color:i,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}function Hl(e,t,n){Vn.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===t&&(t=1);var r=new cr;r.addAttribute("position",new rr([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new Na({fog:!1});this.lightPlane=new za(r,i),this.add(this.lightPlane),(r=new cr).addAttribute("position",new rr([0,0,0,0,0,1],3)),this.targetLine=new za(r,i),this.add(this.targetLine),this.update()}function jl(e){var t=new cr,n=new Na({color:16777215,vertexColors:W}),r=[],i=[],a={},o=new On(16755200),s=new On(16711680),c=new On(43775),l=new On(16777215),u=new On(3355443);function h(e,t,n){p(e,n),p(t,n)}function p(e,t){r.push(0,0,0),i.push(t.r,t.g,t.b),void 0===a[e]&&(a[e]=[]),a[e].push(r.length/3-1)}h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c),h("c","t",l),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u),t.addAttribute("position",new rr(r,3)),t.addAttribute("color",new rr(i,3)),Ua.call(this,t,n),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}function Vl(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]),r=new Float32Array(24),i=new cr;i.setIndex(new Jn(n,1)),i.addAttribute("position",new Jn(r,3)),Ua.call(this,i,new Na({color:t})),this.matrixAutoUpdate=!1,this.update()}function Wl(e,t){this.type="Box3Helper",this.box=e;var n=void 0!==t?t:16776960,r=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 cr;i.setIndex(new Jn(r,1)),i.addAttribute("position",new rr([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)),Ua.call(this,i,new Na({color:n})),this.geometry.computeBoundingSphere()}function ql(e,t,n){this.type="PlaneHelper",this.plane=e,this.size=void 0===t?1:t;var r=void 0!==n?n:16776960,i=new cr;i.addAttribute("position",new rr([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)),i.computeBoundingSphere(),za.call(this,i,new Na({color:r}));var a=new cr;a.addAttribute("position",new rr([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.add(new Cr(a,new Rr({color:r,opacity:.2,transparent:!0,depthWrite:!1})))}function Xl(e,t,n,r,i,a){Vn.call(this),void 0===e&&(e=new an(0,0,1)),void 0===t&&(t=new an(0,0,0)),void 0===n&&(n=1),void 0===r&&(r=16776960),void 0===i&&(i=.2*n),void 0===a&&(a=.2*i),void 0===fl&&((fl=new cr).addAttribute("position",new rr([0,0,0,0,1,0],3)),(ml=new es(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new za(fl,new Na({color:r})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Cr(ml,new Rr({color:r})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,a)}function Yl(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 cr;n.addAttribute("position",new rr(t,3)),n.addAttribute("color",new rr([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var r=new Na({vertexColors:q});Ua.call(this,n,r)}function Jl(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Js.call(this,e),this.type="catmullrom"}Object.assign(yl.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].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(xl,{Composite:yl,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new xl.Composite(e,t,n):new xl(e,t,n)},sanitizeNodeName:(hl=new RegExp("[\\[\\]\\.:\\/]","g"),function(e){return e.replace(/\s/g,"_").replace(hl,"")}),parseTrackName:(rl="[^\\[\\]\\.:\\/]",il="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",al=/((?:WC+[\/:])*)/.source.replace("WC",rl),ol=/(WCOD+)?/.source.replace("WCOD",il),sl=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",rl),cl=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",rl),ll=new RegExp("^"+al+ol+sl+cl+"$"),ul=["material","materials","bones"],function(e){var t=ll.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]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==ul.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}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||"root"===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 r=function e(n){for(var r=0;r<n.length;r++){var i=n[r];if(i.name===t||i.uuid===t)return i;var a=e(i.children);if(a)return a}return null}(e.children);if(r)return r}return null}}),Object.assign(xl.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,r=0,i=n.length;r!==i;++r)e[t++]=n[r]},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,r=0,i=n.length;r!==i;++r)n[r]=e[t++]},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=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,r=t.propertyName,i=t.propertyIndex;if(e||(e=xl.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[r];if(void 0!==s){var c=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?c=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(c=this.Versioning.MatrixWorldNeedsUpdate);var l=this.BindingType.Direct;if(void 0!==i){if("morphTargetInfluences"===r){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){if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);for(o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(e.geometry.morphAttributes.position[o].name===i){i=o;break}}else{if(!e.geometry.morphTargets)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);for(o=0;o<this.node.geometry.morphTargets.length;o++)if(e.geometry.morphTargets[o].name===i){i=o;break}}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][c]}else{var u=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+u+"."+r+" 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(xl.prototype,{_getValue_unbound:xl.prototype.getValue,_setValue_unbound:xl.prototype.setValue}),Object.assign(function(){this.uuid=en.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 r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var h=arguments[l],p=h.uuid,d=r[p];if(void 0===d){d=t++,r[p]=d,e.push(h);for(var f=0,m=s;f!==m;++f)o[f].push(new xl(h,i[f],a[f]))}else if(d<n){c=e[d];var v=--n,g=e[v];r[g.uuid]=d,e[d]=g,r[p]=v,e[v]=h;for(f=0,m=s;f!==m;++f){var y=o[f],x=y[v],b=y[d];y[d]=x,void 0===b&&(b=new xl(h,i[f],a[f])),y[v]=b}}else e[d]!==c&&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,r=this._bindings,i=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(void 0!==l&&l>=t){var u=t++,h=e[u];n[h.uuid]=l,e[l]=h,n[c]=u,e[u]=s;for(var p=0,d=i;p!==d;++p){var f=r[p],m=f[u],v=f[l];f[l]=m,f[u]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o].uuid,l=r[c];if(void 0!==l)if(delete r[c],l<n){var u=--n,h=e[u],p=e[g=--t];r[h.uuid]=l,e[l]=h,r[p.uuid]=u,e[u]=p,e.pop();for(var d=0,f=a;d!==f;++d){var m=(y=i[d])[u],v=y[g];y[l]=m,y[u]=v,y.pop()}}else{var g;r[(p=e[g=--t]).uuid]=l,e[l]=p,e.pop();for(d=0,f=a;d!==f;++d){var y;(y=i[d])[l]=y[g],y.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=new Array(c);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(u);for(var h=l,p=s.length;h!==p;++h){var d=s[h];u[h]=new xl(d,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}),Object.assign(bl.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 r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;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 r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;null===a&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+n,c[0]=e/o,c[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,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(e-i)*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)for(var c=this._interpolants,l=this._propertyBindings,u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(r,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 r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),0===r&&(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,r=this.loop,i=this._loopCount,a=2202===r;if(0===e)return-1===i?t:a&&1==(1&i)?n-t:t;if(2200===r){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===i&&(e>=0?(i=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,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}if(a&&1==(1&i))return this.time=t,n-t}return this.time=t,t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=2401,r.endingEnd=2401):(r.endingStart=e?this.zeroSlopeAtStart?2401:Bt:2402,r.endingEnd=t?this.zeroSlopeAtEnd?2401:Bt:2402)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}}),wl.prototype=Object.assign(Object.create(_.prototype),{constructor:wl,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];void 0===l&&(l={},c[s]=l);for(var u=0;u!==i;++u){var h=r[u],p=h.name,d=l[p];if(void 0!==d)a[u]=d;else{if(void 0!==(d=a[u])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[u].binding.parsedPath;++(d=new nl(xl.create(n,p,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),a[u]=d}o[u].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,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[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,r=t.length;n!==r;++n){var i=t[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}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 r=this._actions,i=this._actionsByClip,a=i[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_addInactiveBinding:function(e,t,n){var r=this._bindingsByRootAndName,i=r[t],a=this._bindings;void 0===i&&(i={},r[t]=i),i[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[i];e:{for(var l in o)break e;delete a[r]}},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new bs(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,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?Rs.findByName(n,e):e,a=null!==i?i.uuid:e,o=this._actionsByClip[a],s=null;if(void 0!==o){var c=o.actionByRoot[r];if(void 0!==c)return c;s=o.knownActions[0],null===i&&(i=s._clip)}if(null===i)return null;var l=new bl(this,i,t);return this._bindAction(l,s),this._addInactiveAction(l,a,r),l},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?Rs.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,n=this._bindings,r=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var i=0;i!==t;++i)e[i].reset();for(i=0;i!==r;++i)n[i].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){t[o]._update(r,e,i,a)}var s=this._bindings,c=this._nActiveBindings;for(o=0;o!==c;++o)s[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(void 0!==i){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}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))}}),_l.prototype.clone=function(){return new _l(void 0===this.value.clone?this.value:this.value.clone())},Ml.prototype=Object.assign(Object.create(cr.prototype),{constructor:Ml,isInstancedBufferGeometry:!0,copy:function(e){return cr.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)}}),Sl.prototype=Object.assign(Object.create(La.prototype),{constructor:Sl,isInstancedInterleavedBuffer:!0,copy:function(e){return La.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Tl.prototype=Object.assign(Object.create(Jn.prototype),{constructor:Tl,isInstancedBufferAttribute:!0,copy:function(e){return Jn.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}}),Object.assign(El.prototype,{linePrecision:1,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()):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)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var r=n||[];return Ll(e,this,r,t),r.sort(Al),r},intersectObjects:function(e,t,n){var r=n||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var i=0,a=e.length;i<a;i++)Ll(e[i],this,r,t);return r.sort(Al),r}}),Object.assign(Pl.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(en.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}}),Object.assign(Rl.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(){var e=new tn;return function(t,n){var r=e.copy(n).multiplyScalar(.5);return this.min.copy(t).sub(r),this.max.copy(t).add(r),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 tn),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 tn),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 tn),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 tn),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new tn;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).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)}}),Object.assign(Cl.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 an),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 an),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 an),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(pl=new an,dl=new an,function(e,t){pl.subVectors(e,this.start),dl.subVectors(this.end,this.start);var n=dl.dot(dl),r=dl.dot(pl)/n;return t&&(r=en.clamp(r,0,1)),r}),closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new an),this.delta(n).multiplyScalar(r).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)}}),Ol.prototype=Object.create(Vn.prototype),Ol.prototype.constructor=Ol,Ol.prototype.isImmediateRenderObject=!0,Il.prototype=Object.create(Ua.prototype),Il.prototype.constructor=Il,Il.prototype.update=function(){var e=new an,t=new an,n=new on;return function(){var r=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var i=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry;if(o&&o.isGeometry)for(var s=o.vertices,c=o.faces,l=0,u=0,h=c.length;u<h;u++)for(var p=c[u],d=0,f=p.vertexNormals.length;d<f;d++){var m=s[p[r[d]]],v=p.vertexNormals[d];e.copy(m).applyMatrix4(i),t.copy(v).applyMatrix3(n).normalize().multiplyScalar(this.size).add(e),a.setXYZ(l,e.x,e.y,e.z),l+=1,a.setXYZ(l,t.x,t.y,t.z),l+=1}else if(o&&o.isBufferGeometry){var g=o.attributes.position,y=o.attributes.normal;for(l=0,d=0,f=g.count;d<f;d++)e.set(g.getX(d),g.getY(d),g.getZ(d)).applyMatrix4(i),t.set(y.getX(d),y.getY(d),y.getZ(d)),t.applyMatrix3(n).normalize().multiplyScalar(this.size).add(e),a.setXYZ(l,e.x,e.y,e.z),l+=1,a.setXYZ(l,t.x,t.y,t.z),l+=1}a.needsUpdate=!0}}(),kl.prototype=Object.create(Vn.prototype),kl.prototype.constructor=kl,kl.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},kl.prototype.update=function(){var e=new an;return function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,n=t*Math.tan(this.light.angle);this.cone.scale.set(n,n,t),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}(),Dl.prototype=Object.create(Ua.prototype),Dl.prototype.constructor=Dl,Dl.prototype.updateMatrixWorld=function(){var e=new an,t=new nn,n=new nn;return function(r){var i=this.bones,a=this.geometry,o=a.getAttribute("position");n.getInverse(this.root.matrixWorld);for(var s=0,c=0;s<i.length;s++){var l=i[s];l.parent&&l.parent.isBone&&(t.multiplyMatrices(n,l.matrixWorld),e.setFromMatrixPosition(t),o.setXYZ(c,e.x,e.y,e.z),t.multiplyMatrices(n,l.parent.matrixWorld),e.setFromMatrixPosition(t),o.setXYZ(c+1,e.x,e.y,e.z),c+=2)}a.getAttribute("position").needsUpdate=!0,Vn.prototype.updateMatrixWorld.call(this,r)}}(),Nl.prototype=Object.create(Cr.prototype),Nl.prototype.constructor=Nl,Nl.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},Nl.prototype.update=function(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)},zl.prototype=Object.create(za.prototype),zl.prototype.constructor=zl,zl.prototype.update=function(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var e=this.material.color,t=Math.max(e.r,e.g,e.b);t>1&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}},zl.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()},Ul.prototype=Object.create(Vn.prototype),Ul.prototype.constructor=Ul,Ul.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},Ul.prototype.update=function(){var e=new an,t=new On,n=new On;return function(){var r=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var i=r.geometry.getAttribute("color");t.copy(this.light.color),n.copy(this.light.groundColor);for(var a=0,o=i.count;a<o;a++){var s=a<o/2?t:n;i.setXYZ(a,s.r,s.g,s.b)}i.needsUpdate=!0}r.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate())}}(),Bl.prototype=Object.create(Ua.prototype),Bl.prototype.constructor=Bl,Fl.prototype=Object.create(Ua.prototype),Fl.prototype.constructor=Fl,Gl.prototype=Object.create(Ua.prototype),Gl.prototype.constructor=Gl,Gl.prototype.update=function(){var e=new an,t=new an,n=new on;return function(){this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);for(var r=this.object.matrixWorld,i=this.geometry.attributes.position,a=this.object.geometry,o=a.vertices,s=a.faces,c=0,l=0,u=s.length;l<u;l++){var h=s[l],p=h.normal;e.copy(o[h.a]).add(o[h.b]).add(o[h.c]).divideScalar(3).applyMatrix4(r),t.copy(p).applyMatrix3(n).normalize().multiplyScalar(this.size).add(e),i.setXYZ(c,e.x,e.y,e.z),c+=1,i.setXYZ(c,t.x,t.y,t.z),c+=1}i.needsUpdate=!0}}(),Hl.prototype=Object.create(Vn.prototype),Hl.prototype.constructor=Hl,Hl.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()},Hl.prototype.update=function(){var e=new an,t=new an,n=new an;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),n.subVectors(t,e),this.lightPlane.lookAt(t),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(t),this.targetLine.scale.z=n.length()}}(),jl.prototype=Object.create(Ua.prototype),jl.prototype.constructor=jl,jl.prototype.update=function(){var e,t,n=new an,r=new ua;function i(i,a,o,s){n.set(a,o,s).unproject(r);var c=t[i];if(void 0!==c)for(var l=e.getAttribute("position"),u=0,h=c.length;u<h;u++)l.setXYZ(c[u],n.x,n.y,n.z)}return function(){e=this.geometry,t=this.pointMap;r.projectionMatrix.copy(this.camera.projectionMatrix),i("c",0,0,-1),i("t",0,0,1),i("n1",-1,-1,-1),i("n2",1,-1,-1),i("n3",-1,1,-1),i("n4",1,1,-1),i("f1",-1,-1,1),i("f2",1,-1,1),i("f3",-1,1,1),i("f4",1,1,1),i("u1",.7,1.1,-1),i("u2",-.7,1.1,-1),i("u3",0,2,-1),i("cf1",-1,0,1),i("cf2",1,0,1),i("cf3",0,-1,1),i("cf4",0,1,1),i("cn1",-1,0,-1),i("cn2",1,0,-1),i("cn3",0,-1,-1),i("cn4",0,1,-1),e.getAttribute("position").needsUpdate=!0}}(),Vl.prototype=Object.create(Ua.prototype),Vl.prototype.constructor=Vl,Vl.prototype.update=function(){var e=new bn;return function(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&e.setFromObject(this.object),!e.isEmpty()){var n=e.min,r=e.max,i=this.geometry.attributes.position,a=i.array;a[0]=r.x,a[1]=r.y,a[2]=r.z,a[3]=n.x,a[4]=r.y,a[5]=r.z,a[6]=n.x,a[7]=n.y,a[8]=r.z,a[9]=r.x,a[10]=n.y,a[11]=r.z,a[12]=r.x,a[13]=r.y,a[14]=n.z,a[15]=n.x,a[16]=r.y,a[17]=n.z,a[18]=n.x,a[19]=n.y,a[20]=n.z,a[21]=r.x,a[22]=n.y,a[23]=n.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),Vl.prototype.setFromObject=function(e){return this.object=e,this.update(),this},Vl.prototype.copy=function(e){return Ua.prototype.copy.call(this,e),this.object=e.object,this},Vl.prototype.clone=function(){return(new this.constructor).copy(this)},Wl.prototype=Object.create(Ua.prototype),Wl.prototype.constructor=Wl,Wl.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),Vn.prototype.updateMatrixWorld.call(this,e))},ql.prototype=Object.create(za.prototype),ql.prototype.constructor=ql,ql.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?H:G,this.lookAt(this.plane.normal),Vn.prototype.updateMatrixWorld.call(this,e)},Xl.prototype=Object.create(Vn.prototype),Xl.prototype.constructor=Xl,Xl.prototype.setDirection=(gl=new an,function(e){e.y>.99999?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(gl.set(e.z,0,-e.x).normalize(),vl=Math.acos(e.y),this.quaternion.setFromAxisAngle(gl,vl))}),Xl.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(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()},Xl.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},Xl.prototype.copy=function(e){return Vn.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},Xl.prototype.clone=function(){return(new this.constructor).copy(this)},Yl.prototype=Object.create(Ua.prototype),Yl.prototype.constructor=Yl,Gs.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Gs.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(sc.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 Yn,n=0,r=e.length;n<r;n++){var i=e[n];t.vertices.push(new an(i.x,i.y,i.z||0))}return t}}),Object.assign(cc.prototype,{fromPoints:function(e){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),Jl.prototype=Object.create(Js.prototype),Object.assign(Jl.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.")}}),Bl.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Dl.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign(zc.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),_c.extractUrlBase(e)}}),Object.assign(Tc.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}),Object.assign(Rl.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(bn.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)}}),Cl.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},Object.assign(en,{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()."),en.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),en.ceilPowerOfTwo(e)}}),Object.assign(on.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.")},applyToBuffer:function(e){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(nn.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(){var e;return function(){return void 0===e&&(e=new an),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),e.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.")},applyToBuffer:function(e){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,r,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,r,n,i,a)}}),_n.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},rn.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(Lr.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(Pr.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(Pr,{barycoordFromPoint:function(e,t,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Pr.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Pr.getNormal(e,t,n,r)}}),Object.assign(lc.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 zo(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Jo(this,e)}}),Object.assign(tn.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(an.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(mn.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(Yn.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.")}}),Object.assign(Vn.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.")}}),Object.defineProperties(Vn.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.defineProperties(Oa.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(ka.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Ia.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Gs.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}}),ha.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(uc.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(Jn.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")}}),Object.assign(cr.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},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.")}}),Object.defineProperties(cr.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.assign(Uo.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(_l.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(Er.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 On}},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}}}),Object.defineProperties(us.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(Ar.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(Sa.prototype,{clearTarget:function(e,t,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,r)},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.")}}),Object.defineProperties(Sa.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.")}}}),Object.defineProperties(aa.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(vn.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(_a.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}},userHeight:{set:function(){console.warn("THREE.WebVRManager: .userHeight has been removed.")}}}),$c.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new Jc).load(e,function(e){t.setBuffer(e)}),this},tl.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Zc.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},pn.crossOrigin=void 0,pn.loadTexture=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new Fs;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},pn.loadTextureCube=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Bs;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},pn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},pn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Zl,Kl=function(e){return null!=e&&"null"!==e?$l(e):null},Ql=function(){if(!g){var e=[];throw f||e.push("Fullscreen API"),p||e.push("WebXR Device API"),d||e.push("WebXR Hit Test API"),new Error("The following APIs are required for AR, but are missing in this browser: ".concat(e.join(", ")))}},$l=function(e){return new URL(e,window.location.toString()).toString()},eu=function(e,t){var n=null,r=function(){null==n&&(e.apply(void 0,arguments),n=self.setTimeout(function(){return n=null},t))};return r.flush=function(){null!=n&&(self.clearTimeout(n),n=null)},r},tu=function(e,t){var n=null;return function(){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];null!=n&&self.clearTimeout(n),n=self.setTimeout(function(){n=null,e.apply(void 0,i)},t)}},nu=function(e,t){return t<e?0:1},ru=function(e,t,n){return Math.max(t===-1/0?e:t,Math.min(n===1/0?e:n,e))},iu=((Zl=function(){var e=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[],t=!0,n=!1,r=void 0;try{for(var i,a=e[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){if("viewport"===i.value.name)return!0}}catch(e){n=!0,r=e}finally{try{t||null==a.return||a.return()}finally{if(n)throw r}}return!1}())||console.warn('No <meta name="viewport"> detected; <model-viewer> will cap pixel density at 1.'),function(){return Zl?window.devicePixelRatio:1}),au=function(){function e(e){this.manager=void 0!==e?e:ks,this.dracoLoader=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={constructor:e,crossOrigin:"anonymous",load:function(e,t,n,r){var i,a=this;i=void 0!==this.resourcePath?this.resourcePath:void 0!==this.path?this.path:_c.extractUrlBase(e),a.manager.itemStart(e);var o=function(t){r?r(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},s=new Ns(a.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.load(e,function(n){try{a.parse(n,i,function(n){t(n),a.manager.itemEnd(e)},o)}catch(e){o(e)}},n,o)},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setDRACOLoader:function(e){return this.dracoLoader=e,this},parse:function(e,t,s,c){var d,f={};if("string"==typeof e)d=e;else if(_c.decodeText(new Uint8Array(e,0,4))===o){try{f[n.KHR_BINARY_GLTF]=new l(e)}catch(e){return void(c&&c(e))}d=f[n.KHR_BINARY_GLTF].content}else d=_c.decodeText(new Uint8Array(e));var m=JSON.parse(d);if(void 0===m.asset||m.asset.version[0]<2)c&&c(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported. Use LegacyGLTFLoader instead."));else{if(m.extensionsUsed)for(var v=0;v<m.extensionsUsed.length;++v){var g=m.extensionsUsed[v],y=m.extensionsRequired||[];switch(g){case n.KHR_LIGHTS_PUNCTUAL:f[g]=new i(m);break;case n.KHR_MATERIALS_UNLIT:f[g]=new a(m);break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:f[g]=new p(m);break;case n.KHR_DRACO_MESH_COMPRESSION:f[g]=new u(m,this.dracoLoader);break;case n.MSFT_TEXTURE_DDS:f[n.MSFT_TEXTURE_DDS]=new r(m);break;case n.KHR_TEXTURE_TRANSFORM:f[n.KHR_TEXTURE_TRANSFORM]=new h(m);break;default:y.indexOf(g)>=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+g+'".')}}var x=new F(m,f,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager});x.parse(function(e,t,n,r,i){var a={scene:e,scenes:t,cameras:n,animations:r,asset:i.asset,parser:x,userData:{}};I(f,a,i),s(a)},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_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function r(){throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader")}function i(e){this.name=n.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[n.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function a(e){this.name=n.KHR_MATERIALS_UNLIT}i.prototype.loadLight=function(e){var t,n=this.lightDefs[e],r=new On(16777215);void 0!==n.color&&r.fromArray(n.color);var i=void 0!==n.range?n.range:0;switch(n.type){case"directional":(t=new yc(r)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new mc(r)).distance=i;break;case"spot":(t=new fc(r)).distance=i,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.decay=2,void 0!==n.intensity&&(t.intensity=n.intensity),t.name=n.name||"light_"+e,Promise.resolve(t)},a.prototype.getMaterialType=function(e){return Rr},a.prototype.extendParams=function(e,t,n){var r=[];e.color=new On(1,1,1),e.opacity=1;var i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var a=i.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==i.baseColorTexture&&r.push(n.assignTexture(e,"map",i.baseColorTexture))}return Promise.all(r)};var o="glTF",s=12,c={JSON:1313821514,BIN:5130562};function l(e){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,s);if(this.header={magic:_c.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==o)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected. Use LegacyGLTFLoader instead.");for(var r=new DataView(e,s),i=0;i<r.byteLength;){var a=r.getUint32(i,!0);i+=4;var l=r.getUint32(i,!0);if(i+=4,l===c.JSON){var u=new Uint8Array(e,s+i,a);this.content=_c.decodeText(u)}else if(l===c.BIN){var h=s+i;this.body=e.slice(h,h+a)}i+=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,(void 0)()}function h(e){this.name=n.KHR_TEXTURE_TRANSFORM}function p(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return Ar},extendParams:function(e,t,n){var r=t.extensions[this.name],i=Dn.standard,a=Rn.clone(i.uniforms),o=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),s=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),c=["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"),l=["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"),u=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb;","material.specularRoughness = clamp( 1.0 - glossinessFactor, 0.04, 1.0 );","material.specularColor = specularFactor.rgb;"].join("\n"),h=i.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",o).replace("#include <metalnessmap_pars_fragment>",s).replace("#include <roughnessmap_fragment>",c).replace("#include <metalnessmap_fragment>",l).replace("#include <lights_physical_fragment>",u);delete a.roughness,delete a.metalness,delete a.roughnessMap,delete a.metalnessMap,a.specular={value:(new On).setHex(1118481)},a.glossiness={value:.5},a.specularMap={value:null},a.glossinessMap={value:null},e.vertexShader=i.vertexShader,e.fragmentShader=h,e.uniforms=a,e.defines={STANDARD:""},e.color=new On(1,1,1),e.opacity=1;var p=[];if(Array.isArray(r.diffuseFactor)){var d=r.diffuseFactor;e.color.fromArray(d),e.opacity=d[3]}if(void 0!==r.diffuseTexture&&p.push(n.assignTexture(e,"map",r.diffuseTexture)),e.emissive=new On(0,0,0),e.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,e.specular=new On(1,1,1),Array.isArray(r.specularFactor)&&e.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var f=r.specularGlossinessTexture;p.push(n.assignTexture(e,"glossinessMap",f)),p.push(n.assignTexture(e,"specularMap",f))}return Promise.all(p)},createMaterial:function(e){var t=new Ar({defines:e.defines,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,fog:!0,lights:!0,opacity:e.opacity,transparent:e.transparent});return t.isGLTFSpecularGlossinessMaterial=!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,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.extensions.derivatives=!0,t},cloneMaterial:function(e){var t=e.clone();t.isGLTFSpecularGlossinessMaterial=!0;for(var n=this.specularGlossinessParams,r=0,i=n.length;r<i;r++)t[n[r]]=e[n[r]];return t},refreshUniforms:function(e,t,n,r,i,a){if(!0===i.isGLTFSpecularGlossinessMaterial){var o,s=i.uniforms,c=i.defines;s.opacity.value=i.opacity,s.diffuse.value.copy(i.color),s.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),s.map.value=i.map,s.specularMap.value=i.specularMap,s.alphaMap.value=i.alphaMap,s.lightMap.value=i.lightMap,s.lightMapIntensity.value=i.lightMapIntensity,s.aoMap.value=i.aoMap,s.aoMapIntensity.value=i.aoMapIntensity,i.map?o=i.map:i.specularMap?o=i.specularMap:i.displacementMap?o=i.displacementMap:i.normalMap?o=i.normalMap:i.bumpMap?o=i.bumpMap:i.glossinessMap?o=i.glossinessMap:i.alphaMap?o=i.alphaMap:i.emissiveMap&&(o=i.emissiveMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),s.uvTransform.value.copy(o.matrix)),i.envMap&&(s.envMap.value=i.envMap,s.envMapIntensity.value=i.envMapIntensity,s.flipEnvMap.value=i.envMap.isCubeTexture?-1:1,s.reflectivity.value=i.reflectivity,s.refractionRatio.value=i.refractionRatio,s.maxMipLevel.value=e.properties.get(i.envMap).__maxMipLevel),s.specular.value.copy(i.specular),s.glossiness.value=i.glossiness,s.glossinessMap.value=i.glossinessMap,s.emissiveMap.value=i.emissiveMap,s.bumpMap.value=i.bumpMap,s.normalMap.value=i.normalMap,s.displacementMap.value=i.displacementMap,s.displacementScale.value=i.displacementScale,s.displacementBias.value=i.displacementBias,null!==s.glossinessMap.value&&void 0===c.USE_GLOSSINESSMAP&&(c.USE_GLOSSINESSMAP="",c.USE_ROUGHNESSMAP=""),null===s.glossinessMap.value&&void 0!==c.USE_GLOSSINESSMAP&&(delete c.USE_GLOSSINESSMAP,delete c.USE_ROUGHNESSMAP)}}}}function d(e,t,n,r){ys.call(this,e,t,n,r)}u.prototype.decodePrimitive=function(e,t){var n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},c={};for(var l in a)l in T&&(o[T[l]]=a[l]);for(l in e.attributes)if(void 0!==T[l]&&void 0!==a[l]){var u=n.accessors[e.attributes[l]],h=w[u.componentType];c[T[l]]=h,s[T[l]]=!0===u.normalized}return t.getDependency("bufferView",i).then(function(e){return new Promise(function(t){r.decodeDracoFile(e,function(e){for(var n in e.attributes){var r=e.attributes[n],i=s[n];void 0!==i&&(r.normalized=i)}t(e)},o,c)})})},h.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(ys.prototype),d.prototype.constructor=d,d.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,a=0;a!==r;a++)t[a]=n[i+a];return t},d.prototype.beforeStart_=d.prototype.copySampleValue_,d.prototype.afterEnd_=d.prototype.copySampleValue_,d.prototype.interpolate_=function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,c=3*o,l=r-t,u=(n-t)/l,h=u*u,p=h*u,d=e*c,f=d-c,m=-2*p+3*h,v=p-h,g=1-m,y=v-h+u,x=0;x!==o;x++){var b=a[f+x+o],w=a[f+x+s]*l,_=a[d+x+o],M=a[d+x]*l;i[x]=g*b+y*w+m*_+v*M}return i};var f=0,m=1,v=2,g=3,y=4,x=5,b=6,w={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},_={9728:He,9729:We,9984:je,9985:qe,9986:Ve,9987:Xe},M={33071:Fe,33648:Ge,10497:Be},S={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},T={POSITION:"position",NORMAL:"normal",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},E={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},A={CUBICSPLINE:2302,LINEAR:2301,STEP:2300},L="OPAQUE",P="MASK",R="BLEND",C={"image/png":ct,"image/jpeg":st};function O(e,t){return"string"!=typeof e||""===e?"":/^(https?:)?\/\//i.test(e)?e:/^data:.*,.*$/i.test(e)?e:/^blob:.*$/i.test(e)?e:t+e}function I(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function k(e,t){void 0!==t.extras&&("object"===_typeof(t.extras)?e.userData=t.extras:console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function D(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(n=0,r=i.length;n<r;n++)e.morphTargetDictionary[i[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function N(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(e[n]!==t[n])return!1;return!0}function z(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function U(e,t){for(var r=0,i=e.length;r<i;r++){var a=e[r];if(o=a.primitive,s=t,c=void 0,l=void 0,c=o.extensions?o.extensions[n.KHR_DRACO_MESH_COMPRESSION]:void 0,l=s.extensions?s.extensions[n.KHR_DRACO_MESH_COMPRESSION]:void 0,c&&l?c.bufferView===l.bufferView&&N(c.attributes,l.attributes):o.indices===s.indices&&N(o.attributes,s.attributes))return a.promise}var o,s,c,l;return null}function B(e){if(e.isInterleavedBufferAttribute){for(var t=e.count,n=e.itemSize,r=e.array.slice(0,t*n),i=0,a=0;i<t;++i)r[a++]=e.getX(i),n>=2&&(r[a++]=e.getY(i)),n>=3&&(r[a++]=e.getZ(i)),n>=4&&(r[a++]=e.getW(i));return new Jn(r,n,e.normalized)}return e.clone()}function F(e,n,r){this.json=e||{},this.extensions=n||{},this.options=r||{},this.cache=new t,this.primitiveCache=[],this.multiplePrimitivesCache=[],this.multiPassGeometryCache=[],this.textureLoader=new Fs(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new Ns(this.options.manager),this.fileLoader.setResponseType("arraybuffer")}function H(e,t,n){var r=t.attributes,i=[];function a(t,r){return n.getDependency("accessor",t).then(function(t){e.addAttribute(r,t)})}for(var o in r){var s=T[o];s&&(s in e.attributes||i.push(a(r[o],s)))}if(void 0!==t.indices&&!e.index){var c=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});i.push(c)}return k(e,t),Promise.all(i).then(function(){return void 0!==t.targets?function(e,t,n){for(var r=!1,i=!1,a=0,o=t.length;a<o&&(void 0!==(l=t[a]).POSITION&&(r=!0),void 0!==l.NORMAL&&(i=!0),!r||!i);a++);if(!r&&!i)return Promise.resolve(e);var s=[],c=[];for(a=0,o=t.length;a<o;a++){var l=t[a];if(r){var u=void 0!==l.POSITION?n.getDependency("accessor",l.POSITION).then(function(e){return B(e)}):e.attributes.position;s.push(u)}i&&(u=void 0!==l.NORMAL?n.getDependency("accessor",l.NORMAL).then(function(e){return B(e)}):e.attributes.normal,c.push(u))}return Promise.all([Promise.all(s),Promise.all(c)]).then(function(n){for(var a=n[0],o=n[1],s=0,c=t.length;s<c;s++){var l=t[s],u="morphTarget"+s;if(r&&void 0!==l.POSITION){var h=a[s];h.name=u;for(var p=e.attributes.position,d=0,f=h.count;d<f;d++)h.setXYZ(d,h.getX(d)+p.getX(d),h.getY(d)+p.getY(d),h.getZ(d)+p.getZ(d))}if(i&&void 0!==l.NORMAL){var m=o[s];m.name=u;var v=e.attributes.normal;for(d=0,f=m.count;d<f;d++)m.setXYZ(d,m.getX(d)+v.getX(d),m.getY(d)+v.getY(d),m.getZ(d)+v.getZ(d))}}return r&&(e.morphAttributes.position=a),i&&(e.morphAttributes.normal=o),e})}(e,t.targets,n):e})}return F.prototype.parse=function(e,t){var n=this.json;this.cache.removeAll(),this.markDefs(),this.getMultiDependencies(["scene","animation","camera"]).then(function(t){var r=t.scenes||[],i=r[n.scene||0],a=t.animations||[],o=t.cameras||[];e(i,r,o,a,n)}).catch(t)},F.prototype.markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r={},i={},a=0,o=t.length;a<o;a++)for(var s=t[a].joints,c=0,l=s.length;c<l;c++)e[s[c]].isBone=!0;for(var u=0,h=e.length;u<h;u++){var p=e[u];void 0!==p.mesh&&(void 0===r[p.mesh]&&(r[p.mesh]=i[p.mesh]=0),r[p.mesh]++,void 0!==p.skin&&(n[p.mesh].isSkinnedMesh=!0))}this.json.meshReferences=r,this.json.meshUses=i},F.prototype.getDependency=function(e,t){var r=e+":"+t,i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this.loadNode(t);break;case"mesh":i=this.loadMesh(t);break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this.loadBufferView(t);break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this.loadMaterial(t);break;case"texture":i=this.loadTexture(t);break;case"skin":i=this.loadSkin(t);break;case"animation":i=this.loadAnimation(t);break;case"camera":i=this.loadCamera(t);break;case"light":i=this.extensions[n.KHR_LIGHTS_PUNCTUAL].loadLight(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,i)}return i},F.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var n=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t},F.prototype.getMultiDependencies=function(e){for(var t={},n=[],r=0,i=e.length;r<i;r++){var a=e[r],o=this.getDependencies(a);o=o.then(function(e,n){t[e]=n}.bind(this,a+("mesh"===a?"es":"s"))),n.push(o)}return Promise.all(n).then(function(){return t})},F.prototype.loadBuffer=function(e){var t=this.json.buffers[e],r=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 i=this.options;return new Promise(function(e,n){r.load(O(t.uri,i.path),e,void 0,function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})},F.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){var n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})},F.prototype.loadAccessor=function(e){var t=this,n=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse)return Promise.resolve(null);var i=[];return void 0!==r.bufferView?i.push(this.getDependency("bufferView",r.bufferView)):i.push(null),void 0!==r.sparse&&(i.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(i).then(function(e){var i,a=e[0],o=S[r.type],s=w[r.componentType],c=s.BYTES_PER_ELEMENT,l=c*o,u=r.byteOffset||0,h=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,p=!0===r.normalized;if(h&&h!==l){var d="InterleavedBuffer:"+r.bufferView+":"+r.componentType,f=t.cache.get(d);f||(f=new La(new s(a),h/c),t.cache.add(d,f)),i=new Pa(f,o,u/c,p)}else i=new Jn(null===a?new s(r.count*o):new s(a,u,r.count*o),o,p);if(void 0!==r.sparse){var m=S.SCALAR,v=w[r.sparse.indices.componentType],g=r.sparse.indices.byteOffset||0,y=r.sparse.values.byteOffset||0,x=new v(e[1],g,r.sparse.count*m),b=new s(e[2],y,r.sparse.count*o);null!==a&&i.setArray(i.array.slice());for(var _=0,M=x.length;_<M;_++){var T=x[_];if(i.setX(T,b[_*o]),o>=2&&i.setY(T,b[_*o+1]),o>=3&&i.setZ(T,b[_*o+2]),o>=4&&i.setW(T,b[_*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return i})},F.prototype.loadTexture=function(e){var t,r=this,i=this.json,a=this.options,o=this.textureLoader,s=window.URL||window.webkitURL,c=i.textures[e],l=c.extensions||{},u=(t=l[n.MSFT_TEXTURE_DDS]?i.images[l[n.MSFT_TEXTURE_DDS].source]:i.images[c.source]).uri,h=!1;return void 0!==t.bufferView&&(u=r.getDependency("bufferView",t.bufferView).then(function(e){h=!0;var n=new Blob([e],{type:t.mimeType});return u=s.createObjectURL(n)})),Promise.resolve(u).then(function(e){var t=zc.Handlers.get(e);return t||(t=l[n.MSFT_TEXTURE_DDS]?r.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:o),new Promise(function(n,r){t.load(O(e,a.path),n,void 0,r)})}).then(function(e){!0===h&&s.revokeObjectURL(u),e.flipY=!1,void 0!==c.name&&(e.name=c.name),t.mimeType in C&&(e.format=C[t.mimeType]);var n=(i.samplers||{})[c.sampler]||{};return e.magFilter=_[n.magFilter]||We,e.minFilter=_[n.minFilter]||Xe,e.wrapS=M[n.wrapS]||Be,e.wrapT=M[n.wrapT]||Be,e})},F.prototype.assignTexture=function(e,t,r){var i=this;return this.getDependency("texture",r.index).then(function(a){if(i.extensions[n.KHR_TEXTURE_TRANSFORM]){var o=void 0!==r.extensions?r.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;o&&(a=i.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(a,o))}e[t]=a})},F.prototype.loadMaterial=function(e){var t,r=this.json,i=this.extensions,a=r.materials[e],o={},s=a.extensions||{},c=[];if(s[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var l=i[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=l.getMaterialType(a),c.push(l.extendParams(o,a,this))}else if(s[n.KHR_MATERIALS_UNLIT]){var u=i[n.KHR_MATERIALS_UNLIT];t=u.getMaterialType(a),c.push(u.extendParams(o,a,this))}else{t=cs;var h=a.pbrMetallicRoughness||{};if(o.color=new On(1,1,1),o.opacity=1,Array.isArray(h.baseColorFactor)){var p=h.baseColorFactor;o.color.fromArray(p),o.opacity=p[3]}void 0!==h.baseColorTexture&&c.push(this.assignTexture(o,"map",h.baseColorTexture)),o.metalness=void 0!==h.metallicFactor?h.metallicFactor:1,o.roughness=void 0!==h.roughnessFactor?h.roughnessFactor:1,void 0!==h.metallicRoughnessTexture&&(c.push(this.assignTexture(o,"metalnessMap",h.metallicRoughnessTexture)),c.push(this.assignTexture(o,"roughnessMap",h.metallicRoughnessTexture)))}!0===a.doubleSided&&(o.side=j);var d=a.alphaMode||L;return d===R?o.transparent=!0:(o.transparent=!1,d===P&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==Rr&&(c.push(this.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new tn(1,1),void 0!==a.normalTexture.scale&&o.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&t!==Rr&&(c.push(this.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==Rr&&(o.emissive=(new On).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==Rr&&c.push(this.assignTexture(o,"emissiveMap",a.emissiveTexture)),Promise.all(c).then(function(){var e;return e=t===Ar?i[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(o):new t(o),void 0!==a.name&&(e.name=a.name),e.normalScale&&(e.normalScale.y=-e.normalScale.y),e.map&&(e.map.encoding=Vt),e.emissiveMap&&(e.emissiveMap.encoding=Vt),e.specularMap&&(e.specularMap.encoding=Vt),k(e,a),a.extensions&&I(i,e,a),e})},F.prototype.loadGeometries=function(e){var t,r=this,i=this.extensions,a=this.primitiveCache,o=function(e){if(e.length<2)return!1;var t=e[0],r=t.targets||[];if(void 0===t.indices)return!1;for(var i=1,a=e.length;i<a;i++){var o=e[i];if(t.mode!==o.mode)return!1;if(void 0===o.indices)return!1;if(o.extensions&&o.extensions[n.KHR_DRACO_MESH_COMPRESSION])return!1;if(!N(t.attributes,o.attributes))return!1;var s=o.targets||[];if(r.length!==s.length)return!1;for(var c=0,l=r.length;c<l;c++)if(!N(r[c],s[c]))return!1}return!0}(e);function s(e){return i[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then(function(t){return H(t,e,r)})}o&&(t=e,e=[e[0]]);for(var c=[],l=0,u=e.length;l<u;l++){var h,p=e[l],d=U(a,p);if(d)c.push(d);else h=p.extensions&&p.extensions[n.KHR_DRACO_MESH_COMPRESSION]?s(p):H(new cr,p,r),a.push({primitive:p,promise:h}),c.push(h)}return Promise.all(c).then(function(e){if(o){var n=e[0];if(null!==(h=function(e,t,n){for(var r=0,i=e.length;r<i;r++){var a=e[r];if(t===a.baseGeometry&&z(n,a.primitives))return a.geometry}return null}(u=r.multiPassGeometryCache,n,t)))return[h.geometry];var i=new cr;for(var a in i.name=n.name,i.userData=n.userData,n.attributes)i.addAttribute(a,n.attributes[a]);for(var a in n.morphAttributes)i.morphAttributes[a]=n.morphAttributes[a];for(var s=[],c=0,l=t.length;c<l;c++)s.push(r.getDependency("accessor",t[c].indices));return Promise.all(s).then(function(e){for(var r=[],a=0,o=0,s=t.length;o<s;o++){for(var c=e[o],l=0,h=c.count;l<h;l++)r.push(c.array[l]);i.addGroup(a,c.count,o),a+=c.count}return i.setIndex(r),u.push({geometry:i,baseGeometry:n,primitives:t}),[i]})}var u,h;return e.length,e})},F.prototype.loadMesh=function(e){for(var t=this,r=this.json,i=this.extensions,a=r.meshes[e],o=a.primitives,s=[],c=0,l=o.length;c<l;c++){var u=void 0===o[c].material?new cs({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:G}):this.getDependency("material",o[c].material);s.push(u)}return Promise.all(s).then(function(r){return t.loadGeometries(o).then(function(s){for(var c=1===s.length&&s[0].groups.length>0,l=[],u=0,h=s.length;u<h;u++){var p,d=s[u],w=o[u],_=c?r:r[u];if(w.mode===y||w.mode===x||w.mode===b||void 0===w.mode)!0===(p=!0===a.isSkinnedMesh?new Ia(d,_):new Cr(d,_)).isSkinnedMesh&&p.normalizeSkinWeights(),w.mode===x?p.drawMode=Gt:w.mode===b&&(p.drawMode=Ht);else if(w.mode===m)p=new Ua(d,_);else if(w.mode===g)p=new za(d,_);else if(w.mode===v)p=new Ba(d,_);else{if(w.mode!==f)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+w.mode);p=new Ga(d,_)}Object.keys(p.geometry.morphAttributes).length>0&&D(p,a),p.name=a.name||"mesh_"+e,s.length>1&&(p.name+="_"+u),k(p,a),l.push(p);for(var M=c?p.material:[p.material],S=void 0!==d.attributes.color,T=void 0===d.attributes.normal,E=!0===p.isSkinnedMesh,A=Object.keys(d.morphAttributes).length>0,L=A&&void 0!==d.morphAttributes.normal,P=0,R=M.length;P<R;P++){_=M[P];if(p.isPoints){var C="PointsMaterial:"+_.uuid,O=t.cache.get(C);O||(O=new Fa,Er.prototype.copy.call(O,_),O.color.copy(_.color),O.map=_.map,O.lights=!1,t.cache.add(C,O)),_=O}else if(p.isLine){C="LineBasicMaterial:"+_.uuid;var I=t.cache.get(C);I||(I=new Na,Er.prototype.copy.call(I,_),I.color.copy(_.color),I.lights=!1,t.cache.add(C,I)),_=I}if(S||T||E||A){C="ClonedMaterial:"+_.uuid+":";_.isGLTFSpecularGlossinessMaterial&&(C+="specular-glossiness:"),E&&(C+="skinning:"),S&&(C+="vertex-colors:"),T&&(C+="flat-shading:"),A&&(C+="morph-targets:"),L&&(C+="morph-normals:");var N=t.cache.get(C);N||(N=_.isGLTFSpecularGlossinessMaterial?i[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].cloneMaterial(_):_.clone(),E&&(N.skinning=!0),S&&(N.vertexColors=q),T&&(N.flatShading=!0),A&&(N.morphTargets=!0),L&&(N.morphNormals=!0),t.cache.add(C,N)),_=N}M[P]=_,_.aoMap&&void 0===d.attributes.uv2&&void 0!==d.attributes.uv&&(console.log("THREE.GLTFLoader: Duplicating UVs to support aoMap."),d.addAttribute("uv2",new Jn(d.attributes.uv.array,2))),_.isGLTFSpecularGlossinessMaterial&&(p.onBeforeRender=i[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].refreshUniforms)}p.material=c?M:M[0]}if(1===l.length)return l[0];var z=new la;for(u=0,h=l.length;u<h;u++)z.add(l[u]);return z})})},F.prototype.loadCamera=function(e){var t,n=this.json.cameras[e],r=n[n.type];if(r)return"perspective"===n.type?t=new ha(en.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(t=new vc(r.xmag/-2,r.xmag/2,r.ymag/2,r.ymag/-2,r.znear,r.zfar)),void 0!==n.name&&(t.name=n.name),k(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},F.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})},F.prototype.loadAnimation=function(e){for(var t=this.json.animations[e],n=[],r=[],i=[],a=[],o=[],s=0,c=t.channels.length;s<c;s++){var l=t.channels[s],u=t.samplers[l.sampler],h=l.target,p=void 0!==h.node?h.node:h.id,f=void 0!==t.parameters?t.parameters[u.input]:u.input,m=void 0!==t.parameters?t.parameters[u.output]:u.output;n.push(this.getDependency("node",p)),r.push(this.getDependency("accessor",f)),i.push(this.getDependency("accessor",m)),a.push(u),o.push(h)}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(i),Promise.all(a),Promise.all(o)]).then(function(n){for(var r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=[],l=0,u=r.length;l<u;l++){var h=r[l],p=i[l],f=a[l],m=o[l],v=s[l];if(void 0!==h){var g;switch(h.updateMatrix(),h.matrixAutoUpdate=!0,E[v.path]){case E.weights:g=Ts;break;case E.rotation:g=As;break;case E.position:case E.scale:default:g=Ps}var y=h.name?h.name:h.uuid,x=void 0!==m.interpolation?A[m.interpolation]:2301,b=[];E[v.path]===E.weights?h.traverse(function(e){!0===e.isMesh&&e.morphTargetInfluences&&b.push(e.name?e.name:e.uuid)}):b.push(y);for(var w=0,_=b.length;w<_;w++){var M=new g(b[w]+"."+E[v.path],gs.arraySlice(p.array,0),gs.arraySlice(f.array,0),x);"CUBICSPLINE"===m.interpolation&&(M.createInterpolant=function(e){return new d(this.times,this.values,this.getValueSize()/3,e)},M.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(M)}}}return new Rs(void 0!==t.name?t.name:"animation_"+e,void 0,c)})},F.prototype.loadNode=function(e){var t=this.json,r=this.extensions,i=this,a=t.meshReferences,o=t.meshUses,s=t.nodes[e];return(!0===s.isBone?Promise.resolve(new Da):void 0!==s.mesh?i.getDependency("mesh",s.mesh).then(function(e){var t;if(a[s.mesh]>1){var n=o[s.mesh]++;(t=e.clone()).name+="_instance_"+n,t.onBeforeRender=e.onBeforeRender;for(var r=0,i=t.children.length;r<i;r++)t.children[r].name+="_instance_"+n,t.children[r].onBeforeRender=e.children[r].onBeforeRender}else t=e;return void 0!==s.weights&&t.traverse(function(e){if(e.isMesh)for(var t=0,n=s.weights.length;t<n;t++)e.morphTargetInfluences[t]=s.weights[t]}),t}):void 0!==s.camera?i.getDependency("camera",s.camera):s.extensions&&s.extensions[n.KHR_LIGHTS_PUNCTUAL]&&void 0!==s.extensions[n.KHR_LIGHTS_PUNCTUAL].light?i.getDependency("light",s.extensions[n.KHR_LIGHTS_PUNCTUAL].light):Promise.resolve(new Vn)).then(function(e){if(void 0!==s.name&&(e.name=xl.sanitizeNodeName(s.name)),k(e,s),s.extensions&&I(r,e,s),void 0!==s.matrix){var t=new nn;t.fromArray(s.matrix),e.applyMatrix(t)}else void 0!==s.translation&&e.position.fromArray(s.translation),void 0!==s.rotation&&e.quaternion.fromArray(s.rotation),void 0!==s.scale&&e.scale.fromArray(s.scale);return e})},F.prototype.loadScene=function(){function e(t,n,r,i){var a=r.nodes[t];return i.getDependency("node",t).then(function(e){return void 0===a.skin?e:i.getDependency("skin",a.skin).then(function(e){for(var n=[],r=0,a=(t=e).joints.length;r<a;r++)n.push(i.getDependency("node",t.joints[r]));return Promise.all(n)}).then(function(n){for(var r=!0===e.isGroup?e.children:[e],i=0,a=r.length;i<a;i++){for(var o=r[i],s=[],c=[],l=0,u=n.length;l<u;l++){var h=n[l];if(h){s.push(h);var p=new nn;void 0!==t.inverseBindMatrices&&p.fromArray(t.inverseBindMatrices.array,16*l),c.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}o.bind(new ka(s,c),o.matrixWorld)}return e});var t}).then(function(t){n.add(t);var o=[];if(a.children)for(var s=a.children,c=0,l=s.length;c<l;c++){var u=s[c];o.push(e(u,t,r,i))}return Promise.all(o)})}return function(t){var n=this.json,r=this.extensions,i=this.json.scenes[t],a=new Aa;void 0!==i.name&&(a.name=i.name),k(a,i),i.extensions&&I(r,a,i);for(var o=i.nodes||[],s=[],c=0,l=o.length;c<l;c++)s.push(e(o[c],a,n,this));return Promise.all(s).then(function(){return a})}}(),e}(),ou=function(e){var t=null!=e.scene,n=Object.assign({},e,{scene:t?e.scene.clone(!0):null}),r={},i=!1;t&&e.scene.traverse(function(e){e.renderOrder=1e3,Array.isArray(e.material)?e.material=e.material.map(function(e){return e.clone()}):null!=e.material&&(e.material=e.material.clone()),e.isSkinnedMesh&&(i=!0,r[e.name]=e)});var a={},o={};for(var s in t&&i&&n.scene.traverse(function(e){e.isBone&&(a[e.name]=e),e.isSkinnedMesh&&(o[e.name]=e)}),r){for(var c=r[s].skeleton,l=o[s],u=[],h=0;h<c.bones.length;++h){var p=a[c.bones[h].name];u.push(p)}l.bind(new ka(u,c.boneInverses),l.matrixWorld)}return n},su=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=function(e){n(e.loaded/e.total)};return new Promise(function(n,i){t.load(e,n,r,i)})},cu=new Map,lu=new Map,uu=function(){function e(){_classCallCheck(this,e),this.loader=new au}return _createClass(e,[{key:"preload",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n,r=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:function(){},cu.has(t)||cu.set(t,su(t,this.loader,function(e){n(.9*e)})),e.next=4,cu.get(t);case 4:n&&n(1),lu.set(t,!0);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"load",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n,r,i,a=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>1&&void 0!==a[1]?a[1]:function(){},e.next=3,this.preload(t,n);case 3:return e.t0=ou,e.next=6,cu.get(t);case 6:return e.t1=e.sent,r=(0,e.t0)(e.t1),null!=(i=r.scene?r.scene:null)&&(i.userData.animations=r.animations),e.abrupt("return",i);case 11:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}],[{key:"clearCache",value:function(){cu.clear(),lu.clear()}},{key:"has",value:function(e){return cu.has(e)}},{key:"hasFinishedLoading",value:function(e){return!!lu.get(e)}},{key:"cache",get:function(){return cu}}]),e}(),hu=Symbol("cancelPendingSourceChange"),pu=function(e){function t(){var e;return _classCallCheck(this,t),(e=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).name="Model",e.loader=new uu,e.modelContainer=new Vn,e.modelContainer.name="ModelContainer",e.boundingBox=new bn,e.size=new an,e.url=null,e.mixer=new wl,e.animations=null,e.animationsByName=null,e.animationNames=[],e.currentAnimationAction=null,e.userData={url:null},e.add(e.modelContainer),e}return _inherits(t,Vn),_createClass(t,[{key:"hasModel",value:function(){return!!this.modelContainer.children.length}},{key:"applyEnvironmentMap",value:function(e){this.modelContainer.traverse(function(t){if(Array.isArray(t.material)){var n=!0,r=!1,i=void 0;try{for(var a,o=t.material[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;s.isMeshBasicMaterial||(s.envMap=e,s.needsUpdate=!0)}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}else t.material&&!t.material.isMeshBasicMaterial&&(t.material.envMap=e,t.material.needsUpdate=!0)}),this.dispatchEvent({type:"envmap-change",value:e})}},{key:"setEnvironmentMapIntensity",value:function(e){"number"==typeof e&&!self.isNaN(e)||(e=1),this.modelContainer.traverse(function(t){t&&t.isMesh&&t.material&&(Array.isArray(t.material)?t.material.forEach(function(t){return t.envMapIntensity=e}):t.material.envMapIntensity=e)})}},{key:"setObject",value:function(e){this.clear(),this.modelContainer.add(e),this.updateBoundingBox(),this.dispatchEvent({type:"model-load"})}},{key:"setSource",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t,n){var r,i,a,o,s,c,l,u,h,p,d=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&t!==this.url){e.next=3;break}return n&&n(1),e.abrupt("return");case 3:return null!=this[hu]&&(this[hu](),this[hu]=null),this.url=t,r=null,e.prev=6,e.next=9,new Promise(function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(r,i){var a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return d[hu]=function(){return i()},e.prev=1,e.next=4,d.loader.load(t,n);case 4:a=e.sent,r(a),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),i(e.t0);case 11:case"end":return e.stop()}},e,this,1,8)}));return function(t,n){return e.apply(this,arguments)}}());case 9:r=e.sent,e.next=17;break;case 12:if(e.prev=12,e.t0=e.catch(6),null!=e.t0){e.next=16;break}return e.abrupt("return");case 16:throw e.t0;case 17:for(this.clear();r&&r.children.length;)this.modelContainer.add(r.children.shift());if(this.modelContainer.traverse(function(e){e&&"Mesh"===e.type&&(e.castShadow=!0)}),i=r.userData.animations,a=new Map,o=[],null==i){e.next=43;break}for(s=!0,c=!1,l=void 0,e.prev=27,u=i[Symbol.iterator]();!(s=(h=u.next()).done);s=!0)p=h.value,a.set(p.name,p),o.push(p.name);e.next=35;break;case 31:e.prev=31,e.t1=e.catch(27),c=!0,l=e.t1;case 35:e.prev=35,e.prev=36,s||null==u.return||u.return();case 38:if(e.prev=38,!c){e.next=41;break}throw l;case 41:return e.finish(38);case 42:return e.finish(35);case 43:this.animations=i,this.animationsByName=a,this.animationNames=o,this.userData.url=t,this.updateBoundingBox(),this.dispatchEvent({type:"model-load",url:t});case 49:case"end":return e.stop()}},e,this,[[6,12],[27,31,35,43],[36,,38,42]])}));return function(t,n){return e.apply(this,arguments)}}()},{key:"playAnimation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.animations;if(null!=n&&0!==n.length){var r=null;null!=e&&(r=this.animationsByName.get(e)),null==r&&(r=n[0]);try{var i=this.currentAnimationAction;this.currentAnimationAction=this.mixer.clipAction(r,this).play(),this.currentAnimationAction.enabled=!0,null!=i&&this.currentAnimationAction!==i&&this.currentAnimationAction.crossFadeFrom(i,t)}catch(e){console.error(e)}}else console.warn("Cannot play animation (model does not have any animations)")}},{key:"stopAnimation",value:function(){null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction.reset(),this.currentAnimationAction=null),this.mixer.stopAllAction()}},{key:"updateAnimation",value:function(e){this.mixer.update(e)}},{key:"clear",value:function(){for(this.url=null,this.userData={url:null};this.modelContainer.children.length;)this.modelContainer.remove(this.modelContainer.children[0]);null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}},{key:"updateBoundingBox",value:function(){this.remove(this.modelContainer),this.boundingBox.setFromObject(this.modelContainer),this.boundingBox.getSize(this.size),this.add(this.modelContainer)}},{key:"animationTime",set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;null!=this.currentAnimationAction&&(this.currentAnimationAction.time=e)},get:function(){return null!=this.currentAnimationAction?this.currentAnimationAction.time:0}},{key:"hasActiveAnimation",get:function(){return null!=this.currentAnimationAction}}]),t}(),du=Symbol("camera"),fu=Symbol("renderTarget"),mu=new an,vu={near:.01,far:100,textureWidth:512,textureHeight:512},gu=new Rr({color:0}),yu=new Rr({transparent:!0,opacity:.1}),xu=function(e){function t(){var e;_classCallCheck(this,t);var n=new hr(1,1);return n.rotateX(-Math.PI/2),(e=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,n,yu.clone()))).name="StaticShadow",e[fu]=new vn(vu.textureWidth,vu.textureHeight,{format:ct}),e.material.map=e[fu].texture,e.material.needsUpdate=!0,e[du]=new vc,e}return _inherits(t,Cr),_createClass(t,[{key:"render",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=t.overrideMaterial,a=t.background,o=e.getClearAlpha(),s=e.getRenderTarget(),c=this.parent;r=Object.assign({},r,vu),e.setClearAlpha(0),t.overrideMaterial=gu,t.background=null,this[fu].width===r.textureWidth&&this[fu].height===r.textureHeight||this[fu].setSize(r.textureWidth,r.textureHeight),n.updateMatrixWorld(!0),n.target.updateMatrixWorld(!0),this[du].position.setFromMatrixPosition(n.matrixWorld),this[du].updateMatrixWorld(!0),this[du].lookAt(n.target.position),this.updateMatrixWorld(!0),mu.setFromMatrixScale(this.matrixWorld),this[du].top=mu.z/2,this[du].bottom=mu.z/-2,this[du].left=mu.x/-2,this[du].right=mu.x/2,this[du].near=r.near,this[du].far=r.far,this[du].updateProjectionMatrix(),c&&c.remove(this),e.render(t,this[du],this[fu],!0),c&&c.add(this),this.material.needsUpdate=!0,t.overrideMaterial=i,t.background=a,e.setClearAlpha(o),e.setRenderTarget(s)}},{key:"intensity",get:function(){return this.material.opacity/.1},set:function(e){var t="number"==typeof e&&!self.isNaN(e);this.material.opacity=.1*(t?e:0),this.visible=this.material.opacity>0}}]),t}(),bu={Framed:"framed",Lifesize:"lifesize"},wu="primary",_u="secondary",Mu=(Object.keys(bu).map(function(e){return bu[e]}),10),Su=3,Tu=4,Eu=45,Au=Symbol("paused"),Lu=Symbol("modelAlignmentMask"),Pu=Symbol("idealCameraDistance"),Ru=function(e){function t(e){var n,r=e.canvas,i=e.element,a=e.width,o=e.height,s=e.renderer;return _classCallCheck(this,t),(n=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).name="ModelScene",n.onModelLoad=n.onModelLoad.bind(_assertThisInitialized(_assertThisInitialized(n))),n[Au]=!1,n.element=i,n.canvas=r,n.context=r.getContext("2d"),n.renderer=s,n.scaleType=bu.Framed,n.exposure=1,n[Lu]=new an(1,1,1),n[Pu]=1,n.unscaledModelOffset=new an(0,0,0),n.model=new pu,n.shadow=new xu,n.light=new hc(12303291,4473924,Su),n.light.name="HemisphereLight",n.light.position.set(2,4,2),n.shadowLight=new yc(16777215,Tu),n.shadowLight.position.set(0,10,0),n.shadowLight.name="ShadowLight",n.camera=new ha(Eu,n.aspect,.1,100),n.camera.name="MainCamera",n.activeCamera=n.camera,n.pivot=new Vn,n.pivot.name="Pivot",n.add(n.pivot),n.add(n.light),n.add(n.shadowLight),n.pivot.add(n.model),n.isVisible=!1,n.isDirty=!1,n.roomBox=new bn,n.roomSize=new an,n.setSize(a,o),n.background=new On(16777215),n.model.addEventListener("model-load",n.onModelLoad),n}return _inherits(t,Aa),_createClass(t,[{key:"pause",value:function(){this[Au]=!0}},{key:"resume",value:function(){this[Au]=!1}},{key:"setModelSource",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.model.setSource(t,n);case 3:e.next=8;break;case 5:throw e.prev=5,e.t0=e.catch(0),new Error("Could not set model source to '".concat(t,"': ").concat(e.t0.message));case 8:case"end":return e.stop()}},e,this,0,5)}));return function(t,n){return e.apply(this,arguments)}}()},{key:"setModelAlignmentMask",value:function(){var e;(e=this[Lu]).set.apply(e,arguments),this.scaleModelToFitRoom(),this.isDirty=!0}},{key:"setSize",value:function(e,t){e===this.width&&t===this.height||(this.width=Math.max(e,1),this.height=Math.max(t,1),this.aspect=this.width/this.height,this.applyRoomSize())}},{key:"applyRoomSize",value:function(){var e=iu();this.canvas.width=this.width*e,this.canvas.height=this.height*e,this.canvas.style.width="".concat(this.width,"px"),this.canvas.style.height="".concat(this.height,"px");var t=this.aspect*Mu/2;this.roomBox.min.set(-t,0,-t),this.roomBox.max.set(t,Mu,t),this.roomBox.getSize(this.roomSize),this.scaleModelToFitRoom();var n=this.model.size;if(0!==n.length()&&n.y>=n.x&&n.y>=n.z){var r=Math.max(n.x,n.z)*this.model.scale.z*1.01;this.roomBox.max.z=r/2,this.roomBox.min.z=r/-2,this.roomSize.z=r}this.camera.near=Mu/2/Math.tan(Eu/2*Math.PI/180),this[Pu]=this.camera.near+this.roomBox.max.z,this.camera.position.z=this[Pu],this.camera.position.y=Mu/2,this.camera.aspect=this.aspect,this.camera.updateProjectionMatrix(),this.updateStaticShadow()}},{key:"configureStageLighting",value:function(e,t){this.light.intensity=e*(t===wu?Su:0),this.shadowLight.intensity=e*(t===wu?Tu:2),this.isDirty=!0}},{key:"getSize",value:function(){return{width:this.width,height:this.height}}},{key:"scaleModelToFitRoom",value:function(){if(this.model.hasModel()&&0!==this.model.size.length()){this.resetModelPose();var e=this.roomSize,t=this.model.size,n=this.roomBox.getCenter(new an),r=this.model.boundingBox.getCenter(new an),i=Math.min(e.x/t.x,e.y/t.y,e.z/t.z);i/=1.01,r.multiply(this[Lu]),this.unscaledModelOffset.copy(r).multiplyScalar(-1),r.multiplyScalar(i),this.model.scale.multiplyScalar(i),this.model.position.subVectors(n,r)}}},{key:"resetModelPose",value:function(){this.model.position.set(0,0,0),this.model.rotation.set(0,0,0),this.model.scale.set(1,1,1)}},{key:"getCamera",value:function(){return this.activeCamera}},{key:"setCamera",value:function(e){this.activeCamera=e}},{key:"onModelLoad",value:function(e){this.applyRoomSize(),this.dispatchEvent({type:"model-load",url:e.url})}},{key:"updateStaticShadow",value:function(){if(this.model.hasModel()&&0!==this.model.size.length()){var e=this.pivot.rotation.y;this.pivot.rotation.y=0,this.shadow.position.set(0,0,0),this.shadow.scale.x=this.roomSize.x,this.shadow.scale.z=this.roomSize.z,this.shadow.render(this.renderer.renderer,this,this.shadowLight),this.pivot.add(this.shadow),this.pivot.rotation.y=e;var t=this.model.size.y*this.model.scale.y;t<Mu&&(this.shadow.position.y=Mu/2-t/2)}else this.pivot.remove(this.shadow)}},{key:"idealCameraDistance",get:function(){return this[Pu]}},{key:"paused",get:function(){return this[Au]}}]),t}(),Cu=(new nn,new Float32Array(3)),Ou=new Float32Array(3),Iu=function(e){function t(e){var n;_classCallCheck(this,t),(n=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).name="Reticle";var r=new Wo(.1,.11,24,1),i=new Rr({color:16777215});return r.applyMatrix((new nn).makeRotationX(en.degToRad(-90))),n.ring=new Cr(r,i),n.add(n.ring),n.visible=!1,n.camera=e,n}return _inherits(t,Vn),_createClass(t,[{key:"update",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t,n){var r,i,a,o,s,c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.raycaster=this.raycaster||new El,this.raycaster.setFromCamera({x:0,y:0},this.camera),r=this.raycaster.ray,Cu.set(r.origin.toArray()),Ou.set(r.direction.toArray()),e.prev=5,e.next=8,t.requestHitTest(Cu,Ou,n);case 8:i=e.sent,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(5),i=[];case 14:i.length&&(a=i[0],o=(new nn).fromArray(a.hitMatrix),this.position.setFromMatrixPosition(o),s=(new an).setFromMatrixPosition(this.camera.matrixWorld),c=Math.atan2(s.x-this.position.x,s.z-this.position.z),this.rotation.set(0,c,0),this.visible=!0);case 15:case"end":return e.stop()}},e,this,5,11)}));return function(t,n){return e.apply(this,arguments)}}()}]),t}(),ku=function(e){if(null==e)throw new Error("WebGL is not available!");return e},Du=function(e,t){return ku(e.getContext("webgl",t)||e.getContext("experimental-webgl",t))},Nu=function(e){var 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 }"};var n=e.getExtension;e.getExtension=function(r){var i;return t[r]?(i=n.call(e,r))&&!function(e,n){var r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(r,t[n]),e.compileShader(r);var i=e.getShaderParameter(r,e.COMPILE_STATUS);return e.deleteShader(r),i}(e,r)&&(i=null):i=n.call(e,r),i}},zu=Symbol("presentedScene"),Uu=Symbol("device"),Bu=Symbol("devicePromise"),Fu=Symbol("rafId"),Gu=Symbol("currentSession"),Hu=Symbol("tick"),ju=Symbol("refSpace"),Vu=Symbol("resolveCleanup"),Wu=Symbol("outputCanvas"),qu=Symbol("outputContext"),Xu=Symbol("onWebXRFrame"),Yu=Symbol("postSessionCleanup"),Ju=new nn,Zu=new an,Ku=new Float32Array(3),Qu=new Float32Array(3),$u=function(e){function t(e,n){var r;return _classCallCheck(this,t),(r=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).renderer=null,r.inputCanvas=e,r.inputContext=n,r.camera=new ha,r.camera.matrixAutoUpdate=!1,r.scene=new Aa,r.dolly=new Vn,r.reticle=new Iu(r.camera),r.scene.add(r.reticle),r.scene.add(r.dolly),r[Wu]=null,r[qu]=null,r[Fu]=null,r[Gu]=null,r[ju]=null,r[zu]=null,r[Vu]=null,r[Uu]=null,r[Bu]=r.resolveDevice().then(function(e){return r[Uu]=e}).catch(function(e){console.warn(e),console.warn("Browser AR will be disabled")}),r}return _inherits(t,_),_createClass(t,null,[{key:"fromInlineRenderer",value:function(e){return new t(e.canvas,e.context)}}]),_createClass(t,[{key:"initializeRenderer",value:function(){null==this.renderer&&(this.renderer=new Sa({canvas:this.inputCanvas,context:this.inputContext}),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.setPixelRatio(1),this.renderer.autoClear=!1,this.renderer.gammaOutput=!0,this.renderer.gammaFactor=2.2)}},{key:"resolveDevice",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Ql(),e.next=3,navigator.xr.requestDevice();case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"resolveARSession",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Ql(),t=this[Uu],e.next=4,t.requestSession({environmentIntegration:!0,outputContext:this.outputContext});case 4:if(n=e.sent,!("setCompatibleXRDevice"in(r=ku(this.renderer.getContext())))){e.next=11;break}return e.next=9,r.setCompatibleXRDevice(t);case 9:e.next=13;break;case 11:return e.next=13,r.makeXRCompatible();case 13:return n.baseLayer=new XRWebGLLayer(n,r,{alpha:!0}),this.renderer.setFramebuffer(n.baseLayer.framebuffer),e.abrupt("return",n);case 16:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"supportsPresentation",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Ql(),e.next=4,this[Bu];case 4:return t=e.sent,e.next=7,t.supportsSession({environmentIntegration:!0,outputContext:this.outputContext});case 7:return e.abrupt("return",!0);case 10:return e.prev=10,e.t0=e.catch(0),e.abrupt("return",!1);case 13:case"end":return e.stop()}},e,this,0,10)}));return function(){return e.apply(this,arguments)}}()},{key:"present",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPresenting){e.next=3;break}return console.warn("Cannot present while a model is already presenting"),e.abrupt("return");case 3:return t.model.scale.set(1,1,1),this[zu]=t,this.initializeRenderer(),e.next=8,this.resolveARSession();case 8:return this[Gu]=e.sent,this[Gu].addEventListener("end",function(){n[Yu]()},{once:!0}),e.next=12,"requestFrameOfReference"in this[Gu]?this[Gu].requestFrameOfReference("eye-level"):this[Gu].requestReferenceSpace({type:"stationary",subtype:"eye-level"});case 12:return this[ju]=e.sent,this[Hu](),e.abrupt("return",this.outputCanvas);case 15:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"stopPresenting",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isPresenting){e.next=2;break}return e.abrupt("return");case 2:return t=new Promise(function(e){r[Vu]=e}),e.prev=3,n=this[Gu],this[Gu]=null,n.cancelAnimationFrame(this[Fu]),e.next=9,n.end();case 9:return e.next=11,t;case 11:e.next=18;break;case 13:e.prev=13,e.t0=e.catch(3),console.warn("Error while trying to end AR session"),console.warn(e.t0),this[Yu]();case 18:case"end":return e.stop()}},e,this,3,13)}));return function(){return e.apply(this,arguments)}}()},{key:Yu,value:function(){null!=this[zu]&&(this.dolly.remove(this[zu]),this[zu].skysphere.visible=!0,this[zu].scaleModelToFitRoom()),this[ju]=null,this[zu]=null,null!=this.outputCanvas.parentNode&&this.outputCanvas.parentNode.removeChild(this.outputCanvas),null!=this[Vu]&&this[Vu]()}},{key:"placeModel",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r,i,a,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=this[Gu]){e.next=2;break}return e.abrupt("return");case 2:return null==this.raycaster&&(this.raycaster=new El),this.raycaster.setFromCamera({x:0,y:0},this.camera),t=this.raycaster.ray,Ku.set(t.origin.toArray()),Qu.set(t.direction.toArray()),e.prev=7,e.next=10,this[Gu].requestHitTest(Ku,Qu,this[ju]);case 10:n=e.sent,e.next=15;break;case 13:e.prev=13,e.t0=e.catch(7);case 15:n&&n.length&&(r=this[zu],i=n[0],a=Ju.fromArray(i.hitMatrix),this.dolly.position.setFromMatrixPosition(a),o=Zu.setFromMatrixPosition(this.camera.matrix),this.dolly.lookAt(o.x,this.dolly.position.y,o.z),this.dolly.rotateY(-r.pivot.rotation.y),r.skysphere.visible=!1,this.dolly.add(r),this.dispatchEvent({type:"modelmove"}));case 16:case"end":return e.stop()}},e,this,7,13)}));return function(){return e.apply(this,arguments)}}()},{key:"processXRInput",value:function(e){var t=e.session.getInputSources().filter(function(e){return"screen"===e.targetRayMode});0!==t.length&&(e.getInputPose(t[0],this[ju])&&this.placeModel())}},{key:Hu,value:function(){var e=this;this[Fu]=this[Gu].requestAnimationFrame(function(t,n){return e[Xu](t,n)})}},{key:Xu,value:function(e,t){var n=t.session,r="getDevicePose"in t?t.getDevicePose(this[ju]):t.getViewerPose(this[ju]);if(this[Hu](),null!=r){var i=!0,a=!1,o=void 0;try{for(var s,c=t.views[Symbol.iterator]();!(i=(s=c.next()).done);i=!0){var l=s.value,u=n.baseLayer.getViewport(l);this.renderer.setViewport(0,0,u.width,u.height),this.renderer.setSize(u.width,u.height,!1),this.camera.projectionMatrix.fromArray(l.projectionMatrix);var h=Ju.fromArray(r.getViewMatrix(l));this.camera.matrix.getInverse(h),this.camera.updateMatrixWorld(!0),this.reticle.update(this[Gu],this[ju]),this.processXRInput(t),this.renderer.render(this.scene,this.camera)}}catch(e){a=!0,o=e}finally{try{i||null==c.return||c.return()}finally{if(a)throw o}}}}},{key:"presentedScene",get:function(){return this[zu]}},{key:"isPresenting",get:function(){return null!=this[zu]}},{key:"outputCanvas",get:function(){return null==this[Wu]&&(this[Wu]=document.createElement("canvas"),this[Wu].setAttribute("style","\ndisplay: block;\nposition: absolute;\ntop: 0px;\nleft: 0px;\nwidth: 100%;\nheight: 100%;")),this[Wu]}},{key:"outputContext",get:function(){return null==this[qu]&&(this[qu]=this.outputCanvas.getContext("xrpresent")),this[qu]}}]),t}(),eh=function(){var e,t=new ha(90,1,.1,10),n=new Aa,r=new Cr(new ur(1,1,1),((e=new Ar({uniforms:{equirectangularMap:{value:null}},vertexShader:"varying vec3 localPosition;\n \n void main() {\n localPosition = position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"#include <common>\n varying vec3 localPosition;\n uniform sampler2D equirectangularMap;\n \n vec2 EquirectangularSampleUV(vec3 v) {\n vec2 uv = vec2(atan(v.z, v.x), asin(v.y));\n uv *= vec2(0.1591, 0.3183); // inverse atan\n uv += 0.5;\n return uv;\n }\n \n void main() {\n vec2 uv = EquirectangularSampleUV(normalize(localPosition));\n gl_FragColor = texture2D(equirectangularMap, uv);\n }",blending:X})).type="EquirectangularToCubeGenerator",e));r.material.side=H,n.add(r);var i=function(e,t){this.sourceTexture=e,this.resolution=t.resolution||512,this.views=[{t:[1,0,0],u:[0,-1,0]},{t:[-1,0,0],u:[0,-1,0]},{t:[0,1,0],u:[0,0,1]},{t:[0,-1,0],u:[0,0,-1]},{t:[0,0,1],u:[0,-1,0]},{t:[0,0,-1],u:[0,-1,0]}];var n={format:t.format||this.sourceTexture.format,magFilter:this.sourceTexture.magFilter,minFilter:this.sourceTexture.minFilter,type:t.type||this.sourceTexture.type,generateMipmaps:this.sourceTexture.generateMipmaps,anisotropy:this.sourceTexture.anisotropy,encoding:this.sourceTexture.encoding};this.renderTarget=new yn(this.resolution,this.resolution,n)};return i.prototype={constructor:i,update:function(e){r.material.uniforms.equirectangularMap.value=this.sourceTexture;for(var i=0;i<6;i++){this.renderTarget.activeCubeFace=i;var a=this.views[i];t.position.set(0,0,0),t.up.set(a.u[0],a.u[1],a.u[2]),t.lookAt(a.t[0],a.t[1],a.t[2]),e.render(n,t,this.renderTarget,!0)}return this.renderTarget.texture},dispose:function(){this.renderTarget.dispose()}},i}(),th=function(){var e,t=new vc,n=new Aa,r=((e=new Ar({uniforms:{faceIndex:{value:0},mapSize:{value:0},envMap:{value:null},testColor:{value:new an(1,1,1)}},vertexShader:"precision highp float; varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }",fragmentShader:"precision highp float; varying vec2 vUv; uniform samplerCube envMap; uniform float mapSize; uniform vec3 testColor; uniform int faceIndex; void main() { vec3 sampleDirection; vec2 uv = vUv; uv = uv * 2.0 - 1.0; uv.y *= -1.0; if(faceIndex == 0) { sampleDirection = normalize(vec3(1.0, uv.y, -uv.x)); } else if(faceIndex == 1) { sampleDirection = normalize(vec3(uv.x, 1.0, uv.y)); } else if(faceIndex == 2) { sampleDirection = normalize(vec3(uv.x, uv.y, 1.0)); } else if(faceIndex == 3) { sampleDirection = normalize(vec3(-1.0, uv.y, uv.x)); } else if(faceIndex == 4) { sampleDirection = normalize(vec3(uv.x, -1.0, -uv.y)); } else { sampleDirection = normalize(vec3(-uv.x, uv.y, -1.0)); } vec4 color = envMapTexelToLinear( textureCube( envMap, sampleDirection ) ); gl_FragColor = linearToOutputTexel( color ); }",blending:X})).type="PMREMCubeUVPacker",e),i=function(e){this.cubeLods=e;var t=4*e[0].width,n=e[0].texture,i={format:n.format,magFilter:n.magFilter,minFilter:n.minFilter,type:n.type,generateMipmaps:n.generateMipmaps,anisotropy:n.anisotropy,encoding:n.encoding===qt?Yt:n.encoding};i.encoding===Yt&&(i.magFilter=We,i.minFilter=We),this.CubeUVRenderTarget=new vn(t,t,i),this.CubeUVRenderTarget.texture.name="PMREMCubeUVPacker.cubeUv",this.CubeUVRenderTarget.texture.mapping=ze,this.objects=[];var a=new pr(1,1),o=[];o.push(new tn(0,0)),o.push(new tn(1,0)),o.push(new tn(2,0)),o.push(new tn(0,1)),o.push(new tn(1,1)),o.push(new tn(2,1));var s=t;t=e[0].width;var c=0,l=4;this.numLods=Math.log(e[0].width)/Math.log(2)-2;for(var u=0;u<this.numLods;u++){var h=.5*(s-s/l);t>16&&(l*=2);for(var p=t>16?6:1,d=0,f=0,m=t,v=0;v<p;v++){for(var g=0;g<6;g++){var y=r.clone();y.uniforms.envMap.value=this.cubeLods[u].texture,y.envMap=this.cubeLods[u].texture,y.uniforms.faceIndex.value=g,y.uniforms.mapSize.value=m;var x=new Cr(a,y);x.position.x=o[g].x*m-h+d,x.position.y=o[g].y*m-h+c+f,x.material.side=H,x.scale.setScalar(m),this.objects.push(x)}f+=1.75*m,d+=1.25*m,m/=2}c+=2*t,t>16&&(t/=2)}};return i.prototype={constructor:i,update:function(e){var r=4*this.cubeLods[0].width;t.left=.5*-r,t.right=.5*r,t.top=.5*-r,t.bottom=.5*r,t.near=0,t.far=1,t.updateProjectionMatrix();for(var i=0;i<this.objects.length;i++)n.add(this.objects[i]);var a=e.gammaInput,o=e.gammaOutput,s=e.toneMapping,c=e.toneMappingExposure,l=e.getRenderTarget();e.gammaInput=!1,e.gammaOutput=!1,e.toneMapping=Ae,e.toneMappingExposure=1,e.render(n,t,this.CubeUVRenderTarget,!1),e.setRenderTarget(l),e.toneMapping=s,e.toneMappingExposure=c,e.gammaInput=a,e.gammaOutput=o;for(i=0;i<this.objects.length;i++)n.remove(this.objects[i])},dispose:function(){for(var e=0,t=this.objects.length;e<t;e++)this.objects[e].material.dispose();this.objects[0].geometry.dispose()}},i}(),nh=function(){var e,t=((e=new Ar({defines:{SAMPLES_PER_LEVEL:20},uniforms:{faceIndex:{value:0},roughness:{value:.5},mapSize:{value:.5},envMap:{value:null},tFlip:{value:-1}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform int faceIndex;\n\t\t\t\tuniform float roughness;\n\t\t\t\tuniform samplerCube envMap;\n\t\t\t\tuniform float mapSize;\n\t\t\t\tuniform float tFlip;\n\t\t\t\t\n\t\t\t\tfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\t\t\t\t\tfloat a = ggxRoughness + 0.0001;\n\t\t\t\t\ta *= a;\n\t\t\t\t\treturn ( 2.0 / a - 2.0 );\n\t\t\t\t}\n\t\t\t\tvec3 ImportanceSamplePhong(vec2 uv, mat3 vecSpace, float specPow) {\n\t\t\t\t\tfloat phi = uv.y * 2.0 * PI;\n\t\t\t\t\tfloat cosTheta = pow(1.0 - uv.x, 1.0 / (specPow + 1.0));\n\t\t\t\t\tfloat sinTheta = sqrt(1.0 - cosTheta * cosTheta);\n\t\t\t\t\tvec3 sampleDir = vec3(cos(phi) * sinTheta, sin(phi) * sinTheta, cosTheta);\n\t\t\t\t\treturn vecSpace * sampleDir;\n\t\t\t\t}\n\t\t\t\tvec3 ImportanceSampleGGX( vec2 uv, mat3 vecSpace, float Roughness )\n\t\t\t\t{\n\t\t\t\t\tfloat a = Roughness * Roughness;\n\t\t\t\t\tfloat Phi = 2.0 * PI * uv.x;\n\t\t\t\t\tfloat CosTheta = sqrt( (1.0 - uv.y) / ( 1.0 + (a*a - 1.0) * uv.y ) );\n\t\t\t\t\tfloat SinTheta = sqrt( 1.0 - CosTheta * CosTheta );\n\t\t\t\t\treturn vecSpace * vec3(SinTheta * cos( Phi ), SinTheta * sin( Phi ), CosTheta);\n\t\t\t\t}\n\t\t\t\tmat3 matrixFromVector(vec3 n) {\n\t\t\t\t\tfloat a = 1.0 / (1.0 + n.z);\n\t\t\t\t\tfloat b = -n.x * n.y * a;\n\t\t\t\t\tvec3 b1 = vec3(1.0 - n.x * n.x * a, b, -n.x);\n\t\t\t\t\tvec3 b2 = vec3(b, 1.0 - n.y * n.y * a, -n.y);\n\t\t\t\t\treturn mat3(b1, b2, n);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tvec4 testColorMap(float Roughness) {\n\t\t\t\t\tvec4 color;\n\t\t\t\t\tif(faceIndex == 0)\n\t\t\t\t\t\tcolor = vec4(1.0,0.0,0.0,1.0);\n\t\t\t\t\telse if(faceIndex == 1)\n\t\t\t\t\t\tcolor = vec4(0.0,1.0,0.0,1.0);\n\t\t\t\t\telse if(faceIndex == 2)\n\t\t\t\t\t\tcolor = vec4(0.0,0.0,1.0,1.0);\n\t\t\t\t\telse if(faceIndex == 3)\n\t\t\t\t\t\tcolor = vec4(1.0,1.0,0.0,1.0);\n\t\t\t\t\telse if(faceIndex == 4)\n\t\t\t\t\t\tcolor = vec4(0.0,1.0,1.0,1.0);\n\t\t\t\t\telse\n\t\t\t\t\t\tcolor = vec4(1.0,0.0,1.0,1.0);\n\t\t\t\t\tcolor *= ( 1.0 - Roughness );\n\t\t\t\t\treturn color;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec3 sampleDirection;\n\t\t\t\t\tvec2 uv = vUv*2.0 - 1.0;\n\t\t\t\t\tfloat offset = -1.0/mapSize;\n\t\t\t\t\tconst float a = -1.0;\n\t\t\t\t\tconst float b = 1.0;\n\t\t\t\t\tfloat c = -1.0 + offset;\n\t\t\t\t\tfloat d = 1.0 - offset;\n\t\t\t\t\tfloat bminusa = b - a;\n\t\t\t\t\tuv.x = (uv.x - a)/bminusa * d - (uv.x - b)/bminusa * c;\n\t\t\t\t\tuv.y = (uv.y - a)/bminusa * d - (uv.y - b)/bminusa * c;\n\t\t\t\t\tif (faceIndex==0) {\n\t\t\t\t\t\tsampleDirection = vec3(1.0, -uv.y, -uv.x);\n\t\t\t\t\t} else if (faceIndex==1) {\n\t\t\t\t\t\tsampleDirection = vec3(-1.0, -uv.y, uv.x);\n\t\t\t\t\t} else if (faceIndex==2) {\n\t\t\t\t\t\tsampleDirection = vec3(uv.x, 1.0, uv.y);\n\t\t\t\t\t} else if (faceIndex==3) {\n\t\t\t\t\t\tsampleDirection = vec3(uv.x, -1.0, -uv.y);\n\t\t\t\t\t} else if (faceIndex==4) {\n\t\t\t\t\t\tsampleDirection = vec3(uv.x, -uv.y, 1.0);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsampleDirection = vec3(-uv.x, -uv.y, -1.0);\n\t\t\t\t\t}\n\t\t\t\t\tvec3 correctedDirection = vec3( tFlip * sampleDirection.x, sampleDirection.yz );\n\t\t\t\t\tmat3 vecSpace = matrixFromVector( normalize( correctedDirection ) );\n\t\t\t\t\tvec3 rgbColor = vec3(0.0);\n\t\t\t\t\tconst int NumSamples = SAMPLES_PER_LEVEL;\n\t\t\t\t\tvec3 vect;\n\t\t\t\t\tfloat weight = 0.0;\n\t\t\t\t\tfor( int i = 0; i < NumSamples; i ++ ) {\n\t\t\t\t\t\tfloat sini = sin(float(i));\n\t\t\t\t\t\tfloat cosi = cos(float(i));\n\t\t\t\t\t\tfloat r = rand(vec2(sini, cosi));\n\t\t\t\t\t\tvect = ImportanceSampleGGX(vec2(float(i) / float(NumSamples), r), vecSpace, roughness);\n\t\t\t\t\t\tfloat dotProd = dot(vect, normalize(sampleDirection));\n\t\t\t\t\t\tweight += dotProd;\n\t\t\t\t\t\tvec3 color = envMapTexelToLinear(textureCube(envMap, vect)).rgb;\n\t\t\t\t\t\trgbColor.rgb += color;\n\t\t\t\t\t}\n\t\t\t\t\trgbColor /= float(NumSamples);\n\t\t\t\t\t//rgbColor = testColorMap( roughness ).rgb;\n\t\t\t\t\tgl_FragColor = linearToOutputTexel( vec4( rgbColor, 1.0 ) );\n\t\t\t\t}",blending:X})).type="PMREMGenerator",e),n=new vc(-1,1,1,-1,0,1e3),r=new Aa,i=new Cr(new pr(2,2,0),t);i.material.side=j,r.add(i),r.add(n);var a=function(e,t,n){this.sourceTexture=e,this.resolution=void 0!==n?n:256,this.samplesPerLevel=void 0!==t?t:32;var r=this.sourceTexture.encoding===jt||this.sourceTexture.encoding===Wt||this.sourceTexture.encoding===Vt;this.sourceTexture.minFilter=r?We:He,this.sourceTexture.magFilter=r?We:He,this.sourceTexture.generateMipmaps=this.sourceTexture.generateMipmaps&&r,this.cubeLods=[];var i=this.resolution,a={format:this.sourceTexture.format,magFilter:this.sourceTexture.magFilter,minFilter:this.sourceTexture.minFilter,type:this.sourceTexture.type,generateMipmaps:this.sourceTexture.generateMipmaps,anisotropy:this.sourceTexture.anisotropy,encoding:this.sourceTexture.encoding};this.numLods=Math.log(i)/Math.log(2)-2;for(var o=0;o<this.numLods;o++){var s=new yn(i,i,a);s.texture.name="PMREMGenerator.cube"+o,this.cubeLods.push(s),i=Math.max(16,i/2)}};return a.prototype={constructor:a,update:function(e){var n=this.sourceTexture.isCubeTexture?-1:1;t.defines.SAMPLES_PER_LEVEL=this.samplesPerLevel,t.uniforms.faceIndex.value=0,t.uniforms.envMap.value=this.sourceTexture,t.envMap=this.sourceTexture,t.needsUpdate=!0;var r=e.gammaInput,i=e.gammaOutput,a=e.toneMapping,o=e.toneMappingExposure,s=e.getRenderTarget();e.toneMapping=Ae,e.toneMappingExposure=1,e.gammaInput=!1,e.gammaOutput=!1;for(var c=0;c<this.numLods;c++){var l=c/(this.numLods-1);t.uniforms.roughness.value=.9*l,t.uniforms.tFlip.value=0==c?n:1;var u=this.cubeLods[c].width;t.uniforms.mapSize.value=u,this.renderToCubeMapTarget(e,this.cubeLods[c]),c<5&&(t.uniforms.envMap.value=this.cubeLods[c].texture)}e.setRenderTarget(s),e.toneMapping=a,e.toneMappingExposure=o,e.gammaInput=r,e.gammaOutput=i},renderToCubeMapTarget:function(e,t){for(var n=0;n<6;n++)this.renderToCubeMapTargetFace(e,t,n)},renderToCubeMapTargetFace:function(e,i,a){i.activeCubeFace=a,t.uniforms.faceIndex.value=a,e.render(r,n,i,!0)},dispose:function(){for(var e=0,t=this.cubeLods.length;e<t;e++)this.cubeLods[e].dispose()}},a}();function rh(e){this.manager=void 0!==e?e:ks}rh.prototype=Object.create(zs.prototype),rh.prototype._parser=function(e){var t=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},n=function(e,t,n){t=t||1024;for(var r=e.pos,i=-1,a=0,o="",s=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));0>(i=s.indexOf("\n"))&&a<t&&r<e.byteLength;)o+=s,a+=s.length,r+=128,s+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));return-1<i&&(!1!==n&&(e.pos+=a+i+1),o+s.slice(0,i))},r=new Uint8Array(e);r.pos=0;var i=function(e){var r,i,a=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,c=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,l={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(r=n(e)))return t(1,"no header found");if(!(i=r.match(/^#\?(\S+)$/)))return t(3,"bad initial token");for(l.valid|=1,l.programtype=i[1],l.string+=r+"\n";!1!==(r=n(e));)if(l.string+=r+"\n","#"!==r.charAt(0)){if((i=r.match(a))&&(l.gamma=parseFloat(i[1],10)),(i=r.match(o))&&(l.exposure=parseFloat(i[1],10)),(i=r.match(s))&&(l.valid|=2,l.format=i[1]),(i=r.match(c))&&(l.valid|=4,l.height=parseInt(i[1],10),l.width=parseInt(i[2],10)),2&l.valid&&4&l.valid)break}else l.comments+=r+"\n";return 2&l.valid?4&l.valid?l:t(3,"missing image size specifier"):t(3,"missing format specifier")}(r);if(-1!==i){var a=i.width,o=i.height,s=function(e,n,r){var i,a,o,s,c,l,u,h,p,d,f,m,v,g=n,y=r;if(g<8||g>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(g!==(e[2]<<8|e[3]))return t(3,"wrong scanline width");if(!(i=new Uint8Array(4*n*r))||!i.length)return t(4,"unable to allocate buffer space");for(a=0,o=0,h=4*g,v=new Uint8Array(4),l=new Uint8Array(h);y>0&&o<e.byteLength;){if(o+4>e.byteLength)return t(1);if(v[0]=e[o++],v[1]=e[o++],v[2]=e[o++],v[3]=e[o++],2!=v[0]||2!=v[1]||(v[2]<<8|v[3])!=g)return t(3,"bad rgbe scanline format");for(u=0;u<h&&o<e.byteLength;){if((m=(s=e[o++])>128)&&(s-=128),0===s||u+s>h)return t(3,"bad scanline data");if(m)for(c=e[o++],p=0;p<s;p++)l[u++]=c;else l.set(e.subarray(o,o+s),u),u+=s,o+=s}for(d=g,p=0;p<d;p++)f=0,i[a]=l[p+f],f+=g,i[a+1]=l[p+f],f+=g,i[a+2]=l[p+f],f+=g,i[a+3]=l[p+f],a+=4;y--}return i}(r.subarray(r.pos),a,o);if(-1!==s)return{width:a,height:o,data:s,header:i.string,gamma:i.gamma,exposure:i.exposure,format:ht,type:Ye}}return null};var ih=new Map,ah=function(e){function t(e){var n;_classCallCheck(this,t),(n=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).renderer=e,n.scene=new Aa;var r=_assertThisInitialized(_assertThisInitialized(n)).scene;r.position.y=-3.5;var i=new ur;i.removeAttribute("uv");var a=new cs({metalness:0,side:H}),o=new cs({metalness:0}),s=new mc(16777215,500,28,2);s.position.set(.418,16.199,.3),r.add(s);var c=new Cr(i,a);c.position.set(-.757,13.219,.717),c.scale.set(31.713,28.305,28.591),r.add(c);var l=new Cr(i,o);l.position.set(-10.906,2.009,1.846),l.rotation.set(0,-.195,0),l.scale.set(2.328,7.905,4.651),r.add(l);var u=new Cr(i,o);u.position.set(-5.607,-.754,-.758),u.rotation.set(0,.994,0),u.scale.set(1.97,1.534,3.955),r.add(u);var h=new Cr(i,o);h.position.set(6.167,.857,7.803),h.rotation.set(0,.561,0),h.scale.set(3.927,6.285,3.687),r.add(h);var p=new Cr(i,o);p.position.set(-2.017,.018,6.124),p.rotation.set(0,.333,0),p.scale.set(2.002,4.566,2.064),r.add(p);var d=new Cr(i,o);d.position.set(2.291,-.756,-2.621),d.rotation.set(0,-.286,0),d.scale.set(1.546,1.552,1.496),r.add(d);var f=new Cr(i,o);f.position.set(-2.193,-.369,-5.547),f.rotation.set(0,.516,0),f.scale.set(3.875,3.487,2.986),r.add(f);var m=new Cr(i,n.createAreaLightMaterial(50));m.position.set(-16.116,14.37,8.208),m.scale.set(.1,2.428,2.739),r.add(m);var v=new Cr(i,n.createAreaLightMaterial(50));v.position.set(-16.109,18.021,-8.207),v.scale.set(.1,2.425,2.751),r.add(v);var g=new Cr(i,n.createAreaLightMaterial(17));g.position.set(14.904,12.198,-1.832),g.scale.set(.15,4.265,6.331),r.add(g);var y=new Cr(i,n.createAreaLightMaterial(43));y.position.set(-.462,8.89,14.52),y.scale.set(4.38,5.441,.088),r.add(y);var x=new Cr(i,n.createAreaLightMaterial(20));return x.position.set(3.235,11.486,-12.541),x.scale.set(2.5,2,.1),r.add(x),n.camera=new Zc(.1,100,256),n.camera.renderTarget.texture.type=tt,n.camera.renderTarget.texture.format=ct,n.camera.renderTarget.texture.minFilter=Xe,n.camera.renderTarget.texture.generateMipmaps=!0,n.blurScene=new Aa,n.blurMaterial=new Ar({uniforms:{tCube:{value:null}},vertexShader:"\n varying vec3 vWorldDirection;\n #include <common>\n void main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n }\n ",fragmentShader:"\n uniform samplerCube tCube;\n varying vec3 vWorldDirection;\n void main() {\n vec4 texColor = textureCube( tCube, vec3( - vWorldDirection.x, vWorldDirection.yz ), 2.0 );\n gl_FragColor = mapTexelToLinear( texColor );\n }\n ",side:H,depthTest:!1,depthWrite:!1}),n.blurScene.add(new Cr(i,n.blurMaterial)),n.blurCamera=new Zc(.1,100,256),n.blurCamera.renderTarget.texture.type=tt,n.blurCamera.renderTarget.texture.format=ct,n.blurCamera.renderTarget.texture.minFilter=Xe,n.blurCamera.renderTarget.texture.generateMipmaps=!0,n.blurRenderTarget1=n.camera.renderTarget,n.blurRenderTarget2=n.blurCamera.renderTarget,n}return _inherits(t,_),_createClass(t,[{key:"createAreaLightMaterial",value:function(e){var t=new Rr;return t.color.setScalar(e),t}},{key:"generate",value:function(){if(!ih.has(this.renderer)){this.camera.clear(this.renderer);var e=this.renderer.gammaOutput,t=this.renderer.toneMapping,n=this.renderer.toneMappingExposure;this.renderer.toneMapping=Ae,this.renderer.toneMappingExposure=1,this.renderer.gammaOutput=!1,this.camera.update(this.renderer,this.scene);for(var r=0;r<16;r++)r%2==0?(this.blurMaterial.uniforms.tCube.value=this.blurRenderTarget1.texture,this.blurCamera.renderTarget=this.blurRenderTarget2):(this.blurMaterial.uniforms.tCube.value=this.blurRenderTarget2.texture,this.blurCamera.renderTarget=this.blurRenderTarget1),this.blurCamera.update(this.renderer,this.blurScene);this.renderer.toneMapping=t,this.renderer.toneMappingExposure=n,this.renderer.gammaOutput=e,ih.set(this.renderer,this.blurCamera.renderTarget.texture)}return ih.get(this.renderer)}},{key:"dispose",value:function(){this.camera.renderTarget.dispose(),this.blurRenderTarget1.dispose(),this.blurRenderTarget2.dispose()}}]),t}();Os.enabled=!0;var oh,sh,ch,lh,uh,hh,ph,dh,fh=/\.hdr$/,mh=new Fs,vh=new rh,gh=Symbol("cubeGenerator"),yh={cubemapSize:1024},xh={url:null,mapping:null},bh=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,t),(n=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).config=Object.assign({},yh,r),n.renderer=e,n.environmentMapGenerator=new ah(n.renderer),n[gh]=null,n}return _inherits(t,_),_createClass(t,[{key:"equirectangularToCubemap",value:function(e){var t=new eh(e,{resolution:this.config.cubemapSize});return t.update(this.renderer),t.renderTarget.texture.userData=Object.assign({},xh,{url:e.userData?e.userData.url:null,mapping:"Cube"}),this[gh]=t,t.renderTarget}},{key:"load",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n,r,i,a,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:function(){},e.prev=1,r=fh.test(t),i=r?vh:mh,e.next=6,new Promise(function(e,r){return i.load(t,e,function(e){n(e.loaded/e.total*.9)},r)});case 6:return a=e.sent,n(1),a.userData=Object.assign({},xh,{url:t,mapping:"Equirectangular"}),r?(a.encoding=qt,a.minFilter=He,a.magFilter=He,a.flipY=!0):a.encoding=Wt,e.abrupt("return",a);case 11:return e.prev=11,n&&n(1),e.finish(11);case 14:case"end":return e.stop()}},e,this,1,,11,14)}));return function(t){return e.apply(this,arguments)}}()},{key:"loadEquirectAsCubeMap",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n,r,i=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:function(){},r=null,e.prev=2,e.next=5,this.load(t,n);case 5:return r=e.sent,e.next=8,this.equirectangularToCubemap(r);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,null!=r&&r.dispose(),e.finish(9);case 12:case"end":return e.stop()}},e,this,2,,9,12)}));return function(t){return e.apply(this,arguments)}}()},{key:"generateEnvironmentMapAndSkybox",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r,i,a,o,s,c,l,u,h,p=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:null,n=p.length>1&&void 0!==p[1]?p[1]:null,r=p.length>2&&void 0!==p[2]?p[2]:{},i=r.progressTracker,a=function(){},o=Promise.resolve(null),s=Promise.resolve(null),c=null,l=null,e.prev=9,u=!1,n&&(s=this.loadEquirectAsCubeMap(n,i?i.beginActivity():function(){})),t&&(o=this.loadEquirectAsCubeMap(t,i?i.beginActivity():function(){})),a=i?i.beginActivity():function(){},e.next=16,s;case 16:return l=e.sent,e.next=19,o;case 19:return c=e.sent,null!=l?l=l.texture:null!=c?l=c.texture:(l=this.environmentMapGenerator.generate(),u=!0),r.pmrem?(h=l,l=this.pmremPass(h),u&&h.dispose()):u&&(l.userData=Object.assign({},xh,{mapping:"Cube"})),e.abrupt("return",{environmentMap:l,skybox:c});case 25:throw e.prev=25,e.t0=e.catch(9),null!=c&&c.dispose(),null!=l&&l.dispose(),e.t0;case 30:return e.prev=30,a(1),e.finish(30);case 33:case"end":return e.stop()}},e,this,9,25,30,33)}));return function(){return e.apply(this,arguments)}}()},{key:"pmremPass",value:function(e,t,n){var r=new nh(e,t,n);r.update(this.renderer);var i=new th(r.cubeLods);i.update(this.renderer);var a=i.CubeUVRenderTarget;return r.dispose(),i.dispose(),a.texture.userData=Object.assign({},xh,{url:e.userData?e.userData.url:null,mapping:"PMREM"}),a.texture}},{key:"dispose",value:function(){try{this.environmentMapGenerator.dispose(),this.environmentMapGenerator=null,this[gh]&&(this[gh].dispose(),this[gh]=null)}catch(e){}}}]),t}(),wh=Symbol("arRenderer"),_h=function(e){function t(){var e;_classCallCheck(this,t),e=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this));var n={alpha:!1,antialias:!0};g&&Object.assign(n,{alpha:!0,preserveDrawingBuffer:!0}),e.canvas=document.createElement("canvas");try{e.context=Du(e.canvas,n),Nu(e.context),e.renderer=new Sa({canvas:e.canvas,context:e.context}),e.renderer.autoClear=!1,e.renderer.gammaOutput=!0,e.renderer.gammaFactor=2.2,e.renderer.physicallyCorrectLights=!0,e.renderer.setPixelRatio(iu()),e.renderer.toneMapping=Ce}catch(t){e.context=null,console.warn(t)}return e[wh]=$u.fromInlineRenderer(_assertThisInitialized(_assertThisInitialized(e))),e.textureUtils=e.canRender?new bh(e.renderer,{pmremSamples:128}):null,e.scenes=new Set,e.scenesRendered=0,e.setRendererSize(1,1),e.lastTick=performance.now(),e}return _inherits(t,_),_createClass(t,[{key:"canRender",get:function(){return null!=this.renderer&&null!=this.context}}]),_createClass(t,[{key:"setRendererSize",value:function(e,t){this.canRender&&this.renderer.setSize(e,t,!1),this.width=e,this.height=t}},{key:"registerScene",value:function(e){var t=this;this.scenes.add(e),this.canRender&&this.scenes.size>0&&this.renderer.setAnimationLoop(function(e){return t.render(e)})}},{key:"unregisterScene",value:function(e){this.scenes.delete(e),this.canRender&&0===this.scenes.size&&this.renderer.setAnimationLoop(null)}},{key:"supportsPresentation",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.canRender&&this[wh].supportsPresentation());case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"present",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this[wh].present(t);case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),this[wh].stopPresenting(),e.t0;case 10:return e.prev=10,this.width=this.height=0,e.finish(10);case 13:case"end":return e.stop()}},e,this,0,6,10,13)}));return function(t){return e.apply(this,arguments)}}()},{key:"stopPresenting",value:function(){return this[wh].stopPresenting()}},{key:"render",value:function(e){if(this.canRender&&!this.isPresenting){this.scenesRendered=0;var t=e-this.lastTick,n=iu();n!==this.renderer.getPixelRatio()&&(console.warn("Updating pixel ratio",n),this.renderer.setPixelRatio(n));var r=!0,i=!1,a=void 0;try{for(var o,s=this.scenes[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value,l=c.element,u=c.width,h=c.height,p=c.context;if(l[Wh](e,t),c.isVisible&&c.isDirty&&!c.paused){var d=c.getCamera();if(u>this.width||h>this.height){var f=Math.max(u,this.width),m=Math.max(h,this.height);this.setRendererSize(f,m,!1)}var v=c.exposure,g="number"==typeof v&&!self.isNaN(v);this.renderer.toneMappingExposure=g?v:1,this.renderer.setRenderTarget(null),this.renderer.clearDepth(),this.renderer.setViewport(0,0,u,h),this.renderer.render(c,d);var y=u*n,x=h*n;p.drawImage(this.renderer.domElement,0,0,y,x,0,0,y,x),c.isDirty=!1,this.scenesRendered++}}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}this.lastTick=e}}},{key:"dispose",value:function(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.renderer&&this.renderer.dispose(),this.textureUtils=null,this.renderer=null,this.scenes.clear()}},{key:"presentedScene",get:function(){return this[wh].presentedScene}},{key:"isPresenting",get:function(){return null!=this[wh]&&this[wh].isPresenting}}]),t}(),Mh=Symbol("ongoingActivities"),Sh=Symbol("announceTotalProgress"),Th=Symbol("eventDelegate"),Eh=function(){function e(){var t=this;_classCallCheck(this,e),this[oh]=document.createDocumentFragment(),this.addEventListener=function(){var e;return(e=t[Th]).addEventListener.apply(e,arguments)},this.removeEventListener=function(){var e;return(e=t[Th]).removeEventListener.apply(e,arguments)},this.dispatchEvent=function(){var e;return(e=t[Th]).dispatchEvent.apply(e,arguments)},this[sh]=new Set}return _createClass(e,[{key:"beginActivity",value:function(){var e=this,t={progress:0};return this[Mh].add(t),1===this.ongoingActivityCount&&this[Sh](),function(n){var r;return(r=Math.max(ru(n,0,1),t.progress))!==t.progress&&(t.progress=r,e[Sh]()),t.progress}}},{key:(oh=Th,sh=Mh,Sh),value:function(){var e=0,t=0,n=0,r=!0,i=!1,a=void 0;try{for(var o,s=this[Mh][Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value.progress;e+=c*(.5/Math.pow(2,t++)),1===c&&n++}}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}n===this.ongoingActivityCount&&(e=1,this[Mh].clear()),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:e}}))}},{key:"ongoingActivityCount",get:function(){return this[Mh].size}}]),e}(),Ah=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":_typeof(Reflect))&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},Lh=new _h,Ph=50,Rh=Symbol("updateSize"),Ch=Symbol("loaded"),Oh=Symbol("template"),Ih=Symbol("fallbackResizeHandler"),kh=Symbol("defaultAriaLabel"),Dh=Symbol("resizeObserver"),Nh=Symbol("intersectionObserver"),zh=Symbol("lastDpr"),Uh=Symbol("ariaLabel"),Bh=Symbol("updateSource"),Fh=Symbol("markLoaded"),Gh=Symbol("container"),Hh=Symbol("canvas"),jh=Symbol("scene"),Vh=Symbol("needsRender"),Wh=Symbol("tick"),qh=Symbol("onModelLoad"),Xh=Symbol("onResize"),Yh=Symbol("renderer"),Jh=Symbol("resetRenderer"),Zh=Symbol("progressTracker"),Kh=function(e){function t(){var e;_classCallCheck(this,t),(e=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).alt=null,e.src=null,e[ch]=!1,e[lh]=iu(),e[uh]=tu(function(){var t=e.getBoundingClientRect();e[Rh](t)},Ph),e[hh]=null,e[ph]=null,e[dh]=new Eh;var n=e.constructor.template;window.ShadyCSS&&window.ShadyCSS.styleElement(_assertThisInitialized(_assertThisInitialized(e)),{}),e.attachShadow({mode:"open",delegatesFocus:!0});var r=e.shadowRoot;r.appendChild(n.content.cloneNode(!0)),e[Gh]=r.querySelector(".container"),e[Hh]=r.querySelector("canvas"),e[kh]=e[Hh].getAttribute("aria-label");var i=e.getBoundingClientRect(),a=i.width,o=i.height;return e[jh]=new Ru({canvas:e[Hh],element:_assertThisInitialized(_assertThisInitialized(e)),width:a,height:o,renderer:Lh}),e[jh].addEventListener("model-load",function(t){e[Fh](),e[qh](t),e.dispatchEvent(new CustomEvent("load",{detail:{url:t.url}}))}),Promise.resolve().then(function(){e[Rh](e.getBoundingClientRect(),!0)}),m&&(e[Dh]=new ResizeObserver(function(t){if(!Lh.isPresenting){var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;s.target===_assertThisInitialized(_assertThisInitialized(e))&&e[Rh](s.contentRect)}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}}})),v?e[Nh]=new IntersectionObserver(function(t){var n=!0,r=!1,i=void 0;try{for(var a,o=t[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;s.target===_assertThisInitialized(_assertThisInitialized(e))&&(e[jh].isVisible=s.isIntersecting)}}catch(e){r=!0,i=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw i}}},{root:null,rootMargin:"10px",threshold:0}):e[jh].isVisible=!0,e}return _inherits(t,a),_createClass(t,[{key:"connectedCallback",value:function(){_get(_getPrototypeOf(t.prototype),"connectedCallback",this)&&_get(_getPrototypeOf(t.prototype),"connectedCallback",this).call(this),m?this[Dh].observe(this):self.addEventListener("resize",this[Ih]),v&&this[Nh].observe(this),this[Yh].registerScene(this[jh]),this[jh].isDirty=!0}},{key:"disconnectedCallback",value:function(){_get(_getPrototypeOf(t.prototype),"disconnectedCallback",this)&&_get(_getPrototypeOf(t.prototype),"disconnectedCallback",this).call(this),m?this[Dh].unobserve(this):self.removeEventListener("resize",this[Ih]),v&&this[Nh].unobserve(this),this[Yh].unregisterScene(this[jh])}},{key:"updated",value:function(e){var n=this;if(_get(_getPrototypeOf(t.prototype),"updated",this).call(this,e),e.has("src")&&this.src!==this[jh].model.url&&(this[Ch]=!1,_asyncToGenerator(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=n[Zh].beginActivity(),e.next=3,n[Bh](function(e){return t(.9*e)});case 3:t(1);case 4:case"end":return e.stop()}},e,this)}))()),e.has("alt")){var r=null==this.alt?this[kh]:this.alt;this[Hh].setAttribute("aria-label",r)}}},{key:Rh,value:function(e){var t=e.width,n=e.height,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this[jh].getSize(),a=i.width,o=i.height,s=parseInt(t,10),c=parseInt(n,10);this[Gh].style.width="".concat(t,"px"),this[Gh].style.height="".concat(n,"px"),(r||a!==s||o!==c)&&this[Xh]({width:s,height:c})}},{key:Wh,value:function(e,t){var n=iu();n!==this[zh]&&(this[zh]=n,this[Ih]())}},{key:Fh,value:function(){this[Ch]||(this[Ch]=!0,this.requestUpdate())}},{key:Vh,value:function(){this[jh].isDirty=!0}},{key:qh,value:function(e){this[Vh]()}},{key:Xh,value:function(e){this[jh].setSize(e.width,e.height),this[Vh]()}},{key:Bh,value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:function(){},n=this.src,e.prev=2,this[Hh].classList.add("show"),e.next=6,this[jh].setModelSource(n,t);case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(2),this[Hh].classList.remove("show"),this.dispatchEvent(new CustomEvent("error",{detail:e.t0}));case 12:case"end":return e.stop()}},e,this,2,8)}));return function(){return e.apply(this,arguments)}}()},{key:"loaded",get:function(){return this[Ch]}},{key:(ch=Ch,lh=zh,uh=Ih,hh=Dh,ph=Nh,dh=Zh,Yh),get:function(){return Lh}},{key:"modelIsVisible",get:function(){return!0}},{key:Uh,get:function(){return null==this.alt||"null"===this.alt?this[kh]:this.alt}}],[{key:Jh,value:function(){Lh.dispose(),Lh=new _h}},{key:"is",get:function(){return"model-viewer"}},{key:"template",get:function(){var e,t;return this.hasOwnProperty(Oh)||(this[Oh]=(e=this.is,(t=document.createElement("template")).innerHTML=w.innerHTML,window.ShadyCSS&&window.ShadyCSS.prepareTemplate(t,e),t)),this[Oh]}}]),t}();Ah([c({type:String})],Kh.prototype,"alt",void 0),Ah([c({converter:{fromAttribute:Kl}})],Kh.prototype,"src",void 0);var Qh,$h,ep,tp,np,rp,ip,ap,op,sp,cp,lp,up,hp,pp,dp=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":_typeof(Reflect))&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},fp=Symbol("changeAnimation"),mp=Symbol("paused"),vp=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":_typeof(Reflect))&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},gp=((Qh=document.createElement("a")).setAttribute("rel","ar"),Qh.appendChild(document.createElement("img")),function(e){Qh.setAttribute("href",e),Qh.click()}),yp=function(){var e=document.createElement("a"),t=!1;return function(n,r){if(!t){var i=self.location.toString(),a=new URL(i),o=new URL(n),s=encodeURIComponent(i),c=o.protocol.replace(":","");a.hash="#model-viewer-no-ar-fallback",r=encodeURIComponent(r),o.protocol="intent://";var l="".concat(o.toString(),"?link=").concat(s,"&title=").concat(r,"#Intent;scheme=").concat(c,";package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=").concat(encodeURIComponent(a.toString()),";end;");self.addEventListener("hashchange",function(){"#model-viewer-no-ar-fallback"!==self.location.hash||t||(t=!0,self.history.back())},{once:!0}),e.setAttribute("href",l),e.click()}}}(),xp={QUICK_LOOK:"quick-look",AR_VIEWER:"ar-viewer",UNSTABLE_WEBXR:"unstable-webxr",NONE:"none"},bp=Symbol("exitFullscreenButtonContainer"),wp=Symbol("arButtonContainer"),_p=Symbol("defaultExitFullscreenButton"),Mp=Symbol("enterARWithWebXR"),Sp=Symbol("canActivateAR"),Tp=Symbol("arMode"),Ep=Symbol("arButtonContainerClickHandler"),Ap=Symbol("onARButtonContainerClick"),Lp=Symbol("exitFullscreenButtonContainerClickHandler"),Pp=Symbol("onExitFullscreenButtonClick"),Rp=Symbol("fullscreenHandler"),Cp=Symbol("onFullscreen"),Op=($h=/^((?:(?:#|[a-zA-Z])[a-zA-Z\d]*)|(?:-?[\d.]+))([a-zA-Z%]*)$/,function(e){var t=e.match($h)||[];return{type:"value",value:t[1],unit:t[2]||null}}),Ip=(ep=/\s+/g,function(e){return e?e.split(ep):[]}),kp=function(e){var t=parseFloat(e.value);return self.isNaN(t)?0:"deg"===e.unit?en.degToRad(t):t},Dp=function(e){try{var t=Ip(e.trim()).map(function(e){return Op(e)});if(3===t.length){var n=_slicedToArray(t,3),r=n[0],i=n[1],a=n[2];return[kp(r),kp(i),"auto"===a.value?"auto":function(e){var t,n=parseFloat(e.value);if(self.isNaN(n))return 0;switch(e.unit){default:case"m":t=1;break;case"cm":t=.01;break;case"mm":t=.001}return n*t}(a)]}}catch(e){}return null},Np=Object.freeze({minimumRadius:8,maximumRadius:32,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,decelerationMargin:.25,acceleration:.15,dampeningScale:.5,eventHandlingBehavior:"prevent-all",interactionPolicy:"allow-when-focused"}),zp=(up=new an,function(e,t,n){return up.set(e,t,n).length()}),Up=new an,Bp=Symbol("options"),Fp=Symbol("upQuaternion"),Gp=Symbol("upQuaternionInverse"),Hp=Symbol("spherical"),jp=Symbol("targetSpherical"),Vp=Symbol("velocity"),Wp=Symbol("dampeningFactor"),qp=Symbol("touchMode"),Xp=Symbol("previousPosition"),Yp=Symbol("canInteract"),Jp=Symbol("interactionEnabled"),Zp=Symbol("pointerIsDown"),Kp=Symbol("lastPointerPosition"),Qp=Symbol("lastTouches"),$p=Symbol("pixelLengthToSphericalAngle"),ed=Symbol("positionToSpherical"),td=Symbol("sphericalToPosition"),nd=Symbol("twoTouchDistance"),rd=Symbol("onMouseMove"),id=Symbol("onMouseDown"),ad=Symbol("onMouseUp"),od=Symbol("onTouchStart"),sd=Symbol("onTouchEnd"),cd=Symbol("onTouchMove"),ld=Symbol("onWheel"),ud=Symbol("onKeyDown"),hd=Symbol("handlePointerMove"),pd=Symbol("handlePointerDown"),dd=Symbol("handlePointerUp"),fd=Symbol("handleWheel"),md=Symbol("handleKey"),vd=/^touch(start|end|move)$/,gd=Math.PI/8,yd=2*Math.PI,xd=new an(0,1,0),bd=33,wd=34,_d=37,Md=38,Sd=39,Td=40,Ed=function(e){function t(e,n){var r;return _classCallCheck(this,t),(r=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).camera=e,r.element=n,r[tp]=!1,r[np]=new rn,r[rp]=new rn,r[ip]=new Pl,r[ap]=new Pl,r[op]=new an,r[sp]=!1,r[cp]=new tn,r[lp]=0,r.target=new an,r[Fp].setFromUnitVectors(e.up,xd),r[Gp].copy(r[Fp]).inverse(),r[rd]=function(e){return r[hd](e)},r[id]=function(e){return r[pd](e)},r[ad]=function(e){return r[dd](e)},r[ld]=function(e){return r[fd](e)},r[ud]=function(e){return r[md](e)},r[od]=function(e){return r[pd](e)},r[sd]=function(e){return r[dd](e)},r[cd]=function(e){return r[hd](e)},r[Xp].copy(r.camera.position),r[ed](r.camera.position,r[Hp]),r[jp].copy(r[Hp]),r[Bp]=Object.assign({},Np),r.setOrbit(),r}return _inherits(t,_),_createClass(t,[{key:"enableInteraction",value:function(){if(!1===this[Jp]){var e=this.element;e.addEventListener("mousemove",this[rd]),e.addEventListener("mousedown",this[id]),e.addEventListener("wheel",this[ld]),e.addEventListener("keydown",this[ud]),e.addEventListener("touchstart",this[od]),e.addEventListener("touchmove",this[cd]),self.addEventListener("mouseup",this[ad]),self.addEventListener("touchend",this[sd]),this.element.style.cursor="grab",this[Jp]=!0}}},{key:"disableInteraction",value:function(){if(!0===this[Jp]){var e=this.element;e.removeEventListener("mousemove",this[rd]),e.removeEventListener("mousedown",this[id]),e.removeEventListener("wheel",this[ld]),e.removeEventListener("keydown",this[ud]),e.removeEventListener("touchstart",this[od]),e.removeEventListener("touchmove",this[cd]),self.removeEventListener("mouseup",this[ad]),self.removeEventListener("touchend",this[sd]),e.style.cursor="",this[Jp]=!1}}},{key:"getCameraSpherical",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Pl).copy(this[Hp])}},{key:"applyOptions",value:function(e){Object.assign(this[Bp],e),this.setOrbit(),this[Hp].copy(this[jp])}},{key:"setOrbit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this[jp].theta,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this[jp].phi,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this[jp].radius,r=this[Bp],i=r.minimumAzimuthalAngle,a=r.maximumAzimuthalAngle,o=r.minimumPolarAngle,s=r.maximumPolarAngle,c=r.minimumRadius,l=r.maximumRadius,u=this[jp],h=u.theta,p=u.phi,d=u.radius,f=ru(e,i,a),m=ru(t,o,s),v=ru(n,c,l);return(f!==h||m!==p||v!==d)&&(this[jp].theta=f,this[jp].phi=m,this[jp].radius=v,this[jp].makeSafe(),!0)}},{key:"adjustOrbit",value:function(e,t,n){var r=this[jp],i=r.theta-e,a=r.phi-t,o=r.radius+n;return this.setOrbit(i,a,o)}},{key:"update",value:function(e,t){var n=this[jp].theta-this[Hp].theta,r=this[jp].phi-this[Hp].phi,i=this[jp].radius-this[Hp].radius,a=zp(n,r,i),o=t/(1e3/60),s=a>this[Bp].decelerationMargin,c=Math.min(this[Vp]+this[Bp].acceleration*o,1);s?this[Vp]=c:this[Vp]>0&&(this[Vp]=Math.max(c,0));var l=this[Wp]*(s?this[Vp]*o:o),u=n*l,h=r*l,p=i*l,d=nu(.001,Math.abs(u))*u,f=nu(.001,Math.abs(h))*h,m=nu(.001,Math.abs(p))*p;zp(d,f,m)>a&&(d=n,f=r,m=i),this[Hp].theta+=d,this[Hp].phi+=f,this[Hp].radius+=m,this[Hp].makeSafe(),this[td](this[Hp],this.camera.position),this.camera.lookAt(this.target),this[Xp].equals(this.camera.position)?this[jp].copy(this[Hp]):(this[Xp].copy(this.camera.position),this.dispatchEvent({type:"change"}))}},{key:$p,value:function(e){return yd*e/this.element.clientHeight}},{key:ed,value:function(e,t){Up.copy(e).sub(this.target),Up.applyQuaternion(this[Fp]),t.setFromVector3(Up),t.radius=Up.length()}},{key:td,value:function(e,t){t.setFromSpherical(e),t.applyQuaternion(this[Gp]),t.add(this.target)}},{key:nd,value:function(e,t){var n=e.clientX,r=e.clientY,i=t.clientX-n,a=t.clientY-r;return Math.sqrt(i*i+a*a)}},{key:hd,value:function(e){if(this[Zp]&&this[Yp]){var t=!1;if(vd.test(e.type)){var n=e.touches;switch(this[qp]){case"zoom":if(this[Qp].length>1&&n.length>1){var r=this[nd](this[Qp][0],this[Qp][1]),i=-1*(this[nd](n[0],n[1])-r)/10;t=this.adjustOrbit(0,0,i)}break;case"rotate":var a=this[Qp][0],o=a.clientX,s=a.clientY,c=n[0],l=c.clientX,u=c.clientY,h=this[$p](l-o),p=this[$p](u-s);t=this.adjustOrbit(h,p,0)}this[Qp]=n}else{var d=e.clientX,f=e.clientY,m=this[$p](d-this[Kp].x),v=this[$p](f-this[Kp].y);t=this.adjustOrbit(m,v,0),this[Kp].set(d,f)}(t||"prevent-all"===this[Bp].eventHandlingBehavior)&&e.cancelable&&e.preventDefault()}}},{key:pd,value:function(e){if(this[Zp]=!0,vd.test(e.type)){var t=e.touches;switch(t.length){default:case 1:this[qp]="rotate";break;case 2:this[qp]="zoom"}this[Qp]=t}else{var n=e.clientX,r=e.clientY;this[Kp].set(n,r),this.element.style.cursor="grabbing"}}},{key:dd,value:function(e){this.element.style.cursor="grab",this[Zp]=!1}},{key:fd,value:function(e){if(this[Yp]){var t=e.deltaY/10;(this.adjustOrbit(0,0,t)||"prevent-all"===this[Bp].eventHandlingBehavior)&&e.cancelable&&e.preventDefault()}}},{key:md,value:function(e){var t=!1,n=!1;switch(e.keyCode){case bd:t=!0,n=this.adjustOrbit(0,0,1);break;case wd:t=!0,n=this.adjustOrbit(0,0,-1);break;case Md:t=!0,n=this.adjustOrbit(0,-gd,0);break;case Td:t=!0,n=this.adjustOrbit(0,gd,0);break;case _d:t=!0,n=this.adjustOrbit(-gd,0,0);break;case Sd:t=!0,n=this.adjustOrbit(gd,0,0)}t&&(n||"prevent-all"===this[Bp].eventHandlingBehavior)&&e.cancelable&&e.preventDefault()}},{key:"interactionEnabled",get:function(){return this[Jp]}},{key:"options",get:function(){return this[Bp]}},{key:(tp=Jp,np=Fp,rp=Gp,ip=Hp,ap=jp,op=Xp,sp=Zp,cp=Kp,lp=Vp,Yp),get:function(){return"allow-when-focused"==this[Bp].interactionPolicy?this.element.getRootNode().activeElement===this.element:"always-allow"===this[Bp].interactionPolicy}},{key:Wp,get:function(){return.3-.25*this[Bp].dampeningScale}}]),t}(),Ad=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":_typeof(Reflect))&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},Ld="0deg 75deg auto",Pd=Math.PI/2,Rd=Math.PI/3,Cd=Pd/2,Od=2*Math.PI,Id=["front","right","back","left"],kd=["upper-","","lower-"],Dd=Mu/10,Nd=10*Mu,zd=3e3,Ud=Symbol("controls"),Bd=Symbol("promptElement"),Fd=Symbol("deferInteractionPrompt"),Gd=Symbol("updateAria"),Hd=Symbol("updateOrbitCamera"),jd=Symbol("orbitCamera"),Vd=Symbol("defaultCamera"),Wd=Symbol("blurHandler"),qd=Symbol("focusHandler"),Xd=Symbol("changeHandler"),Yd=Symbol("promptTransitionendHandler"),Jd=Symbol("onBlur"),Zd=Symbol("onFocus"),Kd=Symbol("onChange"),Qd=Symbol("onPromptTransitionend"),$d=Symbol("shouldPromptUserToInteract"),ef=Symbol("waitingToPromptUser"),tf=Symbol("userPromptedOnce"),nf=Symbol("idleTime"),rf=Symbol("lastSpherical"),af=0,of=1,sf=1,cf=1,lf=(new On("#ffffff"),Symbol("currentEnvironmentMap")),uf=Symbol("applyEnvironmentMap"),hf=Symbol("deallocateTextures"),pf=Symbol("updateLighting"),df=Symbol("updateToneMapping"),ff=Symbol("updateShadow"),mf=Symbol("updateEnvironment"),vf=Symbol("cancelEnvironmentUpdate"),gf=100,yf=Symbol("modelViewerStatusInstance"),xf=Symbol("updateStatus"),bf=function(e){function t(){var e;_classCallCheck(this,t),(e=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this)))[hp]=null,e.registeredInstanceStatuses=new Map,e.loadingPromises=[],e.statusElement=document.createElement("p"),e.statusUpdateInProgress=!1,e[pp]=tu(function(){return e.updateStatus()},gf);var n=_assertThisInitialized(_assertThisInitialized(e)).statusElement,r=n.style;return n.setAttribute("role","status"),r.position="absolute",r.color="transparent",r.top=r.left=r.margin="0",r.pointerEvents="none",e}return _inherits(t,_),_createClass(t,[{key:"registerInstance",value:function(e){if(!this.registeredInstanceStatuses.has(e)){var t=function(){},n=!1===e.loaded&&!!e.src,r=new Promise(function(r){if(n){var i=function t(){r(),e.removeEventListener("load",t),e.removeEventListener("error",t)};e.addEventListener("load",i),e.addEventListener("error",i),t=i}else r()});this.registeredInstanceStatuses.set(e,{onUnregistered:t}),this.loadingPromises.push(r),null==this.modelViewerStatusInstance&&(this.modelViewerStatusInstance=e)}}},{key:"unregisterInstance",value:function(e){if(this.registeredInstanceStatuses.has(e)){var t=this.registeredInstanceStatuses,n=t.get(e);t.delete(e),n.onUnregistered(),this.modelViewerStatusInstance===e&&(this.modelViewerStatusInstance=t.size>0?function(e){if(null!=e.keys)return e.keys().next().value||null;var t=null;try{e.forEach(function(e,n,r){throw t=n,new Error})}catch(e){}return t}(t):null)}}},{key:"updateStatus",value:function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.statusUpdateInProgress&&0!==this.loadingPromises.length){e.next=2;break}return e.abrupt("return");case 2:this.statusElement.textContent="This page includes one or more 3D models that are loading",this.statusUpdateInProgress=!0,this.dispatchEvent({type:"initial-status-announced"});case 5:if(!this.loadingPromises.length){e.next=12;break}return t=this.loadingPromises,this.loadingPromises=[],e.next=10,Promise.all(t);case 10:e.next=5;break;case 12:this.statusElement.textContent="All 3D models in the page have loaded",this.statusUpdateInProgress=!1,this.dispatchEvent({type:"finished-loading-announced"});case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"modelViewerStatusInstance",get:function(){return this[yf]},set:function(e){if(this[yf]!==e){var t=this.statusElement;null!=e&&null!=e.shadowRoot?e.shadowRoot.appendChild(t):null!=t.parentNode&&t.parentNode.removeChild(t),this[yf]=e,this[xf]()}}}]),t}();hp=yf,pp=xf;var wf=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":_typeof(Reflect))&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},_f=100,Mf=.2,Sf=0,Tf={AUTO:"auto",INTERACTION:"interaction"},Ef="interaction",Af=new uu,Lf=new bf,Pf=Symbol("defaultProgressBarElement"),Rf=Symbol("defaultProgressMaskElement"),Cf=Symbol("posterContainerElement"),Of=Symbol("defaultPosterElement"),If=Symbol("posterDismissalSource"),kf=Symbol("announceModelVisibility"),Df=Symbol("modelIsReadyForReveal"),Nf=Symbol("shouldAttemptPreload"),zf=Symbol("shouldRevealModel"),Uf=Symbol("showPoster"),Bf=Symbol("hidePoster"),Ff=Symbol("modelIsVisible"),Gf=Symbol("preloadAttempted"),Hf=Symbol("sourceUpdated"),jf=Symbol("updateLoadingAndVisibility"),Vf=Symbol("updateProgressBar"),Wf=Symbol("lastReportedProgress"),qf=Symbol("ariaLabelCallToAction"),Xf=Symbol("clickHandler"),Yf=Symbol("keydownHandler"),Jf=Symbol("processHandler"),Zf=Symbol("onClick"),Kf=Symbol("onKeydown"),Qf=Symbol("onProgress"),$f=Symbol("showMlModel"),em=Symbol("hideMlModel"),tm=Symbol("isHeliosBrowser"),nm=Symbol("mlModel"),rm=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":_typeof(Reflect))&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},im="center",am="origin",om=Math.PI/32,sm=/\s+/,cm=Symbol("updateAlignment"),lm=[function(e){var t,n=function(n){function r(){var e;return _classCallCheck(this,r),(e=_possibleConstructorReturn(this,_getPrototypeOf(r).apply(this,arguments))).autoplay=!1,e.animationName=void 0,e.animationCrossfadeDuration=300,e[t]=!0,e}return _inherits(r,e),_createClass(r,[{key:"pause",value:function(){this[mp]||(this[mp]=!0,this.dispatchEvent(new CustomEvent("pause")))}},{key:"play",value:function(){this[mp]&&this.availableAnimations.length>0&&(this[mp]=!1,this[jh].model.hasActiveAnimation||this[fp](),this.dispatchEvent(new CustomEvent("play")))}},{key:(t=mp,qh),value:function(){this[mp]=!0,this.autoplay&&(this[fp](),this.play())}},{key:Wh,value:function(e,t){_get(_getPrototypeOf(r.prototype),Wh,this).call(this,e,t),this[mp]||(this[jh].model.updateAnimation(t/1e3),this[Vh]())}},{key:"updated",value:function(e){_get(_getPrototypeOf(r.prototype),"updated",this).call(this,e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[fp]()}},{key:Bh,value:(i=_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:_get(_getPrototypeOf(r.prototype),Bh,this).call(this),this[jh].model.stopAnimation();case 2:case"end":return e.stop()}},e,this)})),function(){return i.apply(this,arguments)})},{key:fp,value:function(){var e=this[jh].model;e.playAnimation(this.animationName,this.animationCrossfadeDuration/1e3),this[mp]&&(e.updateAnimation(0),this[Vh]())}},{key:"availableAnimations",get:function(){return this.loaded?this[jh].model.animationNames:[]}},{key:"paused",get:function(){return this[mp]}},{key:"currentTime",get:function(){return this[jh].model.animationTime},set:function(e){this[jh].model.animationTime=e}}]),r;var i}();return dp([c({type:Boolean})],n.prototype,"autoplay",void 0),dp([c({type:String,attribute:"animation-name"})],n.prototype,"animationName",void 0),dp([c({type:Number,attribute:"animation-crossfade-duration"})],n.prototype,"animationCrossfadeDuration",void 0),n},function(e){var t,n,r,i,a,o,s,l,u,h,p,d,f,m,v,g=function(c){function g(){var e;return _classCallCheck(this,g),(e=_possibleConstructorReturn(this,_getPrototypeOf(g).apply(this,arguments))).poster=null,e.reveal=Tf.AUTO,e.preload=!1,e[t]=!1,e[n]=!1,e[r]=!1,e[i]=0,e[a]=null,e[o]=e.shadowRoot.querySelector(".slot.poster"),e[s]=e.shadowRoot.querySelector("#default-poster"),e[l]=e.shadowRoot.querySelector("#default-progress-bar > .bar"),e[u]=e.shadowRoot.querySelector("#default-progress-bar > .mask"),e[h]=e[Of].getAttribute("aria-label"),e[p]=function(){return e[Zf]()},e[d]=function(t){return e[Kf](t)},e[f]=function(t){return e[Qf](t)},e[m]=tu(function(t){e.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))},Sf),e[v]=eu(function(t){var n=e[Pf].parentNode;requestAnimationFrame(function(){e[Rf].style.opacity="".concat((1-t)*Mf),e[Pf].style.transform="scaleX(".concat(t,")"),0===t&&(n.removeChild(e[Pf]),n.appendChild(e[Pf])),1===t?e[Pf].classList.add("hide"):e[Pf].classList.remove("hide")})},_f),e}return _inherits(g,e),_createClass(g,[{key:"dismissPoster",value:function(){this[If]=Ef,this.requestUpdate()}},{key:"connectedCallback",value:function(){_get(_getPrototypeOf(g.prototype),"connectedCallback",this).call(this),this[Cf].addEventListener("click",this[Xf]),this[Cf].addEventListener("keydown",this[Yf]),this[Zh].addEventListener("progress",this[Jf]),Lf.registerInstance(this)}},{key:"disconnectedCallback",value:function(){_get(_getPrototypeOf(g.prototype),"disconnectedCallback",this).call(this),this[Cf].removeEventListener("click",this[Xf]),this[Cf].removeEventListener("keydown",this[Yf]),this[Zh].removeEventListener("progress",this[Jf]),Lf.unregisterInstance(this)}},{key:"updated",value:(b=_asyncToGenerator(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:_get(_getPrototypeOf(g.prototype),"updated",this).call(this,t),t.has("poster")&&null!=this.poster&&(this[Of].style.backgroundImage="url(".concat(this.poster,")")),t.has("src")&&(this[If]=null,this[Gf]=!1,this[Wf]=0,this[Hf]=!1),t.has("alt")&&this[Of].setAttribute("aria-label","".concat(this[Uh],". ").concat(this[qf])),this[jf]();case 5:case"end":return e.stop()}},e,this)})),function(e){return b.apply(this,arguments)})},{key:(t=Ff,n=Gf,r=Hf,i=Wf,a=If,o=Cf,s=Of,l=Pf,u=Rf,h=qf,p=Xf,d=Yf,f=Jf,m=kf,v=Vf,Zf),value:function(){this[If]=Ef,this.requestUpdate()}},{key:Kf,value:function(e){switch(e.keyCode){case 32:case 13:this[If]=Ef}this.requestUpdate()}},{key:Qf,value:function(e){var t=e.detail.totalProgress;this.requestUpdate(),1===t&&this[Vf].flush(),this[Vf](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t}})),this[Wf]=Math.max(t,this[Wf])}},{key:jf,value:(x=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this[Nf]||this[Gf]){e.next=18;break}return this[Gf]=!0,t=this[Zh].beginActivity(),e.prev=3,n=this.src,r={url:n},e.next=8,Af.preload(n,t);case 8:this.dispatchEvent(new CustomEvent("preload",{detail:r})),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),this.dispatchEvent(new CustomEvent("error",{detail:{type:"preload",sourceError:e.t0}}));case 14:return e.prev=14,t(1),this.requestUpdate(),e.finish(14);case 18:this[Df]?this[Hf]||(this[Bh](),this[Bf]()):this[Uf]();case 19:case"end":return e.stop()}},e,this,3,11,14,18)})),function(){return x.apply(this,arguments)})},{key:Uf,value:function(){var e=this,t=this[Cf],n=this[Of],r=parseFloat(self.getComputedStyle(t).opacity);n.tabIndex=1,n.removeAttribute("aria-hidden"),t.classList.add("show"),r<1&&t.addEventListener("transitionend",function(){e[Ff]=!1,e[kf](!1)},{once:!0})}},{key:Bf,value:function(){var e=this,t=this[Cf],n=this[Of];t.classList.contains("show")&&(t.classList.remove("show"),t.addEventListener("transitionend",function(){e[kf](!0),requestAnimationFrame(function(){e[Ff]=!0;var t=e.getRootNode();t&&t.activeElement===e&&e[Hh].focus(),n.setAttribute("aria-hidden","true"),n.removeAttribute("tabindex")})},{once:!0}))}},{key:Bh,value:(y=_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this[Df]){e.next=4;break}return this[Hf]=!0,e.next=4,_get(_getPrototypeOf(g.prototype),Bh,this).call(this);case 4:case"end":return e.stop()}},e,this)})),function(){return y.apply(this,arguments)})},{key:"loaded",get:function(){var e=this.src;return _get(_getPrototypeOf(g.prototype),"loaded",this)||!(!e||!uu.hasFinishedLoading(e))}},{key:"modelIsVisible",get:function(){return _get(_getPrototypeOf(g.prototype),"modelIsVisible",this)&&this[Ff]}},{key:Df,get:function(){var e=this.src;return!!e&&uu.hasFinishedLoading(e)&&1===this[Wf]&&this[zf]}},{key:zf,get:function(){return this.reveal===Tf.AUTO||!!this[If]}},{key:Nf,get:function(){var e=this.src;return!!e&&!uu.hasFinishedLoading(e)&&(this.preload||this[zf])}}]),g;var y,x,b}();return wf([c({converter:{fromAttribute:Kl}})],g.prototype,"poster",void 0),wf([c({type:String})],g.prototype,"reveal",void 0),wf([c({type:Boolean})],g.prototype,"preload",void 0),g},function(e){var t,n,r,i,a,o,s,l,u=function(c){function u(){var e;return _classCallCheck(this,u),(e=_possibleConstructorReturn(this,_getPrototypeOf(u).apply(this,arguments))).ar=!1,e.unstableWebxr=!1,e.iosSrc=null,e[t]=!1,e[n]=e.shadowRoot.querySelector(".ar-button"),e[r]=e.shadowRoot.querySelector(".slot.exit-fullscreen-button"),e[i]=e.shadowRoot.querySelector("#default-exit-fullscreen-button"),e[a]=function(t){return e[Ap](t)},e[o]=function(){return e[Pp]()},e[s]=function(){return e[Cp]()},e[l]=xp.NONE,e}return _inherits(u,e),_createClass(u,[{key:"activateAR",value:(d=_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=this[Tp],e.next=e.t0===xp.QUICK_LOOK?3:e.t0===xp.UNSTABLE_WEBXR?5:e.t0===xp.AR_VIEWER?8:11;break;case 3:return gp(this.iosSrc),e.abrupt("break",13);case 5:return e.next=7,this[Mp]();case 7:return e.abrupt("break",13);case 8:return this.requestFullscreen(),yp(this.src,this.alt||""),e.abrupt("break",13);case 11:return console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities"),e.abrupt("break",13);case 13:case"end":return e.stop()}},e,this)})),function(){return d.apply(this,arguments)})},{key:"connectedCallback",value:function(){_get(_getPrototypeOf(u.prototype),"connectedCallback",this).call(this),document.addEventListener("fullscreenchange",this[Rp])}},{key:"disconnectedCallback",value:function(){_get(_getPrototypeOf(u.prototype),"disconnectedCallback",this).call(this),document.removeEventListener("fullscreenchange",this[Rp])}},{key:(t=Sp,n=wp,r=bp,i=_p,a=Ep,o=Lp,s=Rp,l=Tp,Pp),value:function(){document.fullscreenElement===this&&document.exitFullscreen()}},{key:Cp,value:function(){var e=this[Yh],t=this[jh];if(document.fullscreenElement===this?this[Gh].classList.add("fullscreen"):this[Gh].classList.remove("fullscreen"),document.fullscreenElement!==this&&e.presentedScene===t)try{e.stopPresenting()}catch(e){console.warn("Unexpected error while stopping AR presentation"),console.error(e)}}},{key:Mp,value:(p=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this[Yh],console.log("Attempting to enter fullscreen and present in AR..."),e.prev=2,n=this.requestFullscreen(),e.prev=4,e.next=7,t.present(this[jh]);case 7:return r=e.sent,this.shadowRoot.appendChild(r),e.next=11,n;case 11:e.next=20;break;case 13:return e.prev=13,e.t0=e.catch(4),console.warn("Error while trying to present to AR"),console.error(e.t0),e.next=19,n;case 19:document.fullscreenElement===this&&(console.warn("Exiting fullscreen under dire circumstances"),document.exitFullscreen());case 20:e.next=26;break;case 22:e.prev=22,e.t1=e.catch(2),console.error(e.t1),console.warn("AR will not activate without fullscreen permission");case 26:case"end":return e.stop()}},e,this,[[2,22],[4,13]])})),function(){return p.apply(this,arguments)})},{key:"update",value:(h=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(_get(_getPrototypeOf(u.prototype),"update",this).call(this,t),t.has("unstableWebxr")||t.has("iosSrc")||t.has("ar")||t.has("src")||t.has("alt")){e.next=3;break}return e.abrupt("return");case 3:if(n=this[Yh],e.t0=this.unstableWebxr&&g,!e.t0){e.next=9;break}return e.next=8,n.supportsPresentation();case 8:e.t0=e.sent;case 9:r=e.t0,i=y&&this.ar,a=x&&b&&!!this.iosSrc,o=r||i||a,this[Tp]=r?xp.UNSTABLE_WEBXR:i?xp.AR_VIEWER:a?xp.QUICK_LOOK:xp.NONE,o?(this[wp].classList.add("enabled"),this[wp].addEventListener("click",this[Ep]),this[bp].addEventListener("click",this[Lp])):(this[wp].removeEventListener("click",this[Ep]),this[bp].removeEventListener("click",this[Lp]),this[wp].classList.remove("enabled"));case 15:case"end":return e.stop()}},e,this)})),function(e){return h.apply(this,arguments)})},{key:Ap,value:function(e){e.preventDefault(),this.activateAR()}},{key:"canActivateAR",get:function(){return this[Tp]!==xp.NONE}}]),u;var h,p,d}();return vp([c({attribute:"ar",type:Boolean})],u.prototype,"ar",void 0),vp([c({type:Boolean,attribute:"unstable-webxr"})],u.prototype,"unstableWebxr",void 0),vp([c({converter:{fromAttribute:Kl},attribute:"ios-src"})],u.prototype,"iosSrc",void 0),u},function(e){var t,n,r,i,a,o,s,l,u,h=function(c){function h(){var e;_classCallCheck(this,h),(e=_possibleConstructorReturn(this,_getPrototypeOf(h).call(this))).cameraControls=!1,e.cameraOrbit=Ld,e.interactionPromptThreshold=zd,e[t]=0,e[n]=!1,e[r]=!1,e[i]=!0,e[a]=new Pl,e[o]=function(){return e[Kd]()},e[s]=function(){return e[Zd]()},e[l]=function(){return e[Jd]()},e[u]=function(){return e[Qd]()};var c=e[jh];return e[Bd]=e.shadowRoot.querySelector(".controls-prompt"),e[Vd]=c.getCamera(),e[jd]=e[Vd].clone(),e[jd].near=Dd,e[jd].far=Nd,e[jd].updateProjectionMatrix(),e[Ud]=new Ed(e[jd],c.canvas),e[Ud].target.set(0,Mu/2,0),c.setCamera(e[jd]),e}return _inherits(h,e),_createClass(h,[{key:"getCameraOrbit",value:function(){var e=this[rf];return{theta:e.theta,phi:e.phi,radius:e.radius/Mu}}},{key:"connectedCallback",value:function(){_get(_getPrototypeOf(h.prototype),"connectedCallback",this).call(this),this[Yd](),this[Bd].addEventListener("transitionend",this[Yd]),this[Ud].addEventListener("change",this[Xd])}},{key:"disconnectedCallback",value:function(){_get(_getPrototypeOf(h.prototype),"disconnectedCallback",this).call(this),this[Bd].removeEventListener("transitionend",this[Yd]),this[Ud].removeEventListener("change",this[Xd])}},{key:"updated",value:function(e){_get(_getPrototypeOf(h.prototype),"updated",this).call(this,e);var t=this[Ud],n=this[jh];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),n.canvas.addEventListener("focus",this[qd]),n.canvas.addEventListener("blur",this[Wd]),this[Hd]()):(n.canvas.removeEventListener("focus",this[qd]),n.canvas.removeEventListener("blur",this[Wd]),t.disableInteraction())),e.has("cameraOrbit")){var r=Dp(this.cameraOrbit);null==r&&(r=Dp(Ld));var i=_slicedToArray(r,3),a=i[0],o=i[1],s=i[2];if("string"==typeof s)switch(s){default:case"auto":s=n.idealCameraDistance}else s*=Mu;t.setOrbit(a,o,s)}}},{key:(t=nf,n=tf,r=ef,i=$d,a=rf,o=Xd,s=qd,l=Wd,u=Yd,Wh),value:function(e,t){_get(_getPrototypeOf(h.prototype),Wh,this).call(this,e,t),this[ef]&&(this.loaded&&(this[nf]+=t),this[nf]>this.interactionPromptThreshold&&(this[jh].canvas.setAttribute("aria-label","Use mouse, touch or arrow keys to control the camera!"),this[tf]=!0,this[ef]=!1,this[Bd].classList.add("visible"))),this[Ud].update(e,t)}},{key:Fd,value:function(){this[ef]=!1,this[Bd].classList.remove("visible"),this[tf]&&(this[$d]=!1)}},{key:Hd,value:function(){var e=this[jd],t=this[Ud],n=this[jh];e.position.copy(this[Vd].position),e.aspect=this[Vd].aspect,e.rotation.set(0,0,0),e.updateProjectionMatrix();var r=Dd+Mu/2,i=n.idealCameraDistance;t.applyOptions({minimumRadius:r,maximumRadius:i}),t.target.set(0,Mu/2,0)}},{key:Gd,value:function(){var e=this[rf],t=e.theta,n=e.phi,r=this[Ud].getCameraSpherical(this[rf]),i=r.theta,a=r.phi,o=this.getRootNode();if(null!=o&&o.activeElement===this){var s=(4+Math.floor((t%Od+Cd)/Pd))%4,c=(4+Math.floor((i%Od+Cd)/Pd))%4,l=Math.floor(n/Rd),u=Math.floor(a/Rd);if(c!==s||u!==l){var h=this[jh].canvas,p=Id[c],d="View from stage ".concat(kd[u]).concat(p);h.setAttribute("aria-label",d)}}}},{key:Qd,value:function(){var e=this[Bd].querySelector("svg");null!=e&&(this[Bd].classList.contains("visible")?e.unpauseAnimations():e.pauseAnimations())}},{key:Xh,value:function(e){_get(_getPrototypeOf(h.prototype),Xh,this).call(this,e),this[Hd]()}},{key:qh,value:function(e){_get(_getPrototypeOf(h.prototype),qh,this).call(this,e),this[Hd]()}},{key:Zd,value:function(){var e=this[jh].canvas,t=this[Uh];e.getAttribute("aria-label")!==t&&e.setAttribute("aria-label",t),this[$d]&&(this[ef]=!0,this[nf]=0)}},{key:Jd,value:function(){this[ef]=!1,this[Bd].classList.remove("visible")}},{key:Kd,value:function(){this[Fd](),this[Gd](),this[Vh]()}}]),h}();return Ad([c({type:Boolean,attribute:"camera-controls"})],h.prototype,"cameraControls",void 0),Ad([c({type:String,attribute:"camera-orbit",hasChanged:function(){return!0}})],h.prototype,"cameraOrbit",void 0),Ad([c({type:Number,attribute:"interaction-prompt-threshold"})],h.prototype,"interactionPromptThreshold",void 0),h},function(e){return function(t){function n(){var e,t;_classCallCheck(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return(t=_possibleConstructorReturn(this,(e=_getPrototypeOf(n)).call.apply(e,[this].concat(i)))).shadowIntensity=af,t.stageLightIntensity=sf,t.environmentIntensity=cf,t.exposure=of,t[vf]=null,t}return _inherits(n,e),_createClass(n,null,[{key:"properties",get:function(){return Object.assign({},_get(_getPrototypeOf(n),"properties",this),{environmentImage:{type:String,attribute:"environment-image"},environmentIntensity:{type:Number,attribute:"environment-intensity"},backgroundImage:{type:String,attribute:"background-image"},backgroundColor:{type:String,attribute:"background-color"},experimentalPmrem:{type:Boolean,attribute:"experimental-pmrem"},shadowIntensity:{type:Number,attribute:"shadow-intensity"},stageLightIntensity:{type:Number,attribute:"stage-light-intensity"},exposure:{type:Number,attribute:"exposure"}})}}]),_createClass(n,[{key:"update",value:function(e){_get(_getPrototypeOf(n.prototype),"update",this).call(this,e),e.has("shadowIntensity")&&this[ff](),e.has("exposure")&&this[df](),(e.has("environmentIntensity")||e.has("stageLightIntensity"))&&this[pf](),(e.has("environmentImage")||e.has("backgroundImage")||e.has("backgroundColor")||e.has("experimentalPmrem"))&&this[mf]()}},{key:"firstUpdated",value:function(e){null==this[vf]&&this[mf]()}},{key:qh,value:function(e){_get(_getPrototypeOf(n.prototype),qh,this).call(this,e),this[lf]&&this[uf](this[lf])}},{key:mf,value:(r=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r,i,a,o,s,c,l,u,h,p,d=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.backgroundImage,n=this.environmentImage,r=this.experimentalPmrem,i=this.backgroundColor,null!=this[vf]&&(this[vf](),this[vf]=null),null!=(a=this[Yh].textureUtils)){e.next=6;break}return e.abrupt("return");case 6:return e.prev=6,e.next=9,new Promise(function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(i,o){var s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=a.generateEnvironmentMapAndSkybox(t,n,{pmrem:r,progressTracker:d[Zh]}),d[vf]=function(){return o(s)},e.t0=i,e.next=5,s;case 5:e.t1=e.sent,(0,e.t0)(e.t1);case 7:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}());case 9:o=e.sent,s=o.environmentMap,c=o.skybox,this[hf](),null!=c?this[jh].background=c:(i||(i="#ffffff"),l=new On(i),this[jh].background=l,this[Gh].style.backgroundColor=i),this[uf](s),e.next=29;break;case 17:if(e.prev=17,e.t0=e.catch(6),!_instanceof(e.t0,Error)){e.next=22;break}throw this[uf](null),e.t0;case 22:return e.next=24,e.t0;case 24:u=e.sent,h=u.environmentMap,p=u.skybox,null!=h&&h.dispose(),null!=p&&p.dispose();case 29:case"end":return e.stop()}},e,this,6,17)})),function(){return r.apply(this,arguments)})},{key:uf,value:function(e){this[lf]=e,this[jh].model.applyEnvironmentMap(this[lf]),this.dispatchEvent(new CustomEvent("environment-change")),this[pf](),this[Vh]()}},{key:ff,value:function(){this[jh].shadow.intensity=this.shadowIntensity,this[Vh]()}},{key:df,value:function(){this[jh].exposure=this.exposure,this[Vh]()}},{key:pf,value:function(){var e=this[jh],t=this.experimentalPmrem?_u:wu,n=this.experimentalPmrem?.65*this.environmentIntensity:this.environmentIntensity;e.configureStageLighting(this.stageLightIntensity,t),e.model.setEnvironmentMapIntensity(n)}},{key:hf,value:function(){var e=this[jh].background;e&&e.dispose&&e.dispose(),this[lf]&&(this[lf].dispose(),this[lf]=null)}}]),n;var r}()},function(e){var t=function(t){function n(){var e;return _classCallCheck(this,n),(e=_possibleConstructorReturn(this,_getPrototypeOf(n).apply(this,arguments))).autoRotate=!1,e.alignModel="center",e}return _inherits(n,e),_createClass(n,[{key:"updated",value:function(e){_get(_getPrototypeOf(n.prototype),"updated",this).call(this,e),e.has("alignModel")&&this[cm](),e.has("autoRotate")&&(this[jh].pivot.rotation.set(0,0,0),this[Vh]())}},{key:Wh,value:function(e,t){_get(_getPrototypeOf(n.prototype),Wh,this).call(this,e,t),this.autoRotate&&this.modelIsVisible&&(this[jh].pivot.rotation.y+=om*t*.001,this[Vh]())}},{key:cm,value:function(){var e,t=function(e){for(var t,n=e.split(sm),r=[],i=0;i<3;++i){var a=n[i];switch(null!=a&&null==t&&(t=a),a||t){default:case im:r.push(1);break;case am:r.push(0)}}return r}(this.alignModel);(e=this[jh]).setModelAlignmentMask.apply(e,_toConsumableArray(t))}},{key:"turntableRotation",get:function(){return this[jh].pivot.rotation.y}}]),n}();return rm([c({type:Boolean,attribute:"auto-rotate"})],t.prototype,"autoRotate",void 0),rm([c({type:String,attribute:"align-model"})],t.prototype,"alignModel",void 0),t},function(e){return function(t){function n(){var e;return _classCallCheck(this,n),(e=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this)))[tm]=null!=self.mlWorld,e[nm]=null,e}return _inherits(n,e),_createClass(n,null,[{key:"properties",get:function(){return Object.assign({},_get(_getPrototypeOf(n),"properties",this),{magicLeap:{type:Boolean,attribute:"magic-leap"}})}}]),_createClass(n,[{key:"update",value:function(e){if(_get(_getPrototypeOf(n.prototype),"update",this).call(this,e),this[tm]&&(e.has("magicLeap")||e.has("src"))){var t=this[jh];this.magicLeap?(!!customElements.get("ml-model")||console.warn("<ml-model> is not registered. Is prismatic.js loaded?"),t.pause(),this[Gh].setAttribute("style","display: none;"),this[$f](),e.has("src")&&this.src&&this.src!==this[nm].getAttribute("src")&&this[nm].setAttribute("src",this.src)):(this[em](),t.resume(),this[Gh].removeAttribute("style"))}}},{key:$f,value:function(){null==this[nm]&&(this[nm]=document.createElement("ml-model"),this[nm].setAttribute("style","display: block; top: 0; left: 0; width: 100%; height: 100%"),this[nm].setAttribute("model-scale","".concat(.65," ").concat(.65," ").concat(.65)),this[nm].setAttribute("scrollable","true"),this[nm].setAttribute("z-offset","500px"),this[nm].setAttribute("extractable","true"),this[nm].setAttribute("extracted-scale","1"),this[nm].setAttribute("environment-lighting","color-intensity: 2;"),null!=this.src&&this[nm].setAttribute("src",this.src)),this.shadowRoot.appendChild(this[nm])}},{key:em,value:function(){null!=this[nm]&&null!=this[nm].parentNode&&this[nm].parentNode.removeChild(this[nm])}}]),n}()}].reduce(function(e,t){return t(e)},Kh);customElements.define("model-viewer",lm)});