tencentcloud-webar 1.0.23-8 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- (self.webpackChunktencentcloud_webar=self.webpackChunktencentcloud_webar||[]).push([[888],{5940:(e,t,n)=>{function r(e){return r="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},r(e)}var i;function a(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=l(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=h(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},c.apply(this,arguments)}function h(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=g(e)););return e}function d(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=g(e);if(t){var i=g(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return v(this,n)}}function v(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */x=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),o=new E(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return A()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=M(o,n);if(s){if(s===h)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=c(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(e,n,o),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h={};function d(){}function p(){}function f(){}var v={};l(v,a,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(T([])));g&&g!==t&&n.call(g,a)&&(v=g);var y=f.prototype=d.prototype=Object.create(v);function _(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function i(a,o,s,l){var u=c(e[a],e,o);if("throw"!==u.type){var h=u.arg,d=h.value;return d&&"object"==r(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,s,l)}),(function(e){i("throw",e,s,l)})):t.resolve(d).then((function(e){h.value=e,s(h)}),(function(e){return i("throw",e,s,l)}))}l(u.arg)}var a;this._invoke=function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}}function M(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,M(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=c(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,h;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function w(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 S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function T(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:A}}function A(){return{value:void 0,done:!0}}return p.prototype=f,l(y,"constructor",f),l(f,"constructor",p),p.displayName=l(f,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,l(e,s,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},_(b.prototype),l(b.prototype,o,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new b(u(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},_(y),l(y,s,"Generator"),l(y,a,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),e.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}},e.values=T,E.prototype={constructor:E,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(S),!e)for(var t in this)"t"===t.charAt(0)&&n.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){if(this.done)throw e;var t=this;function r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(o)},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),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:T(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},e}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(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 M(e,t,n){return t&&b(e.prototype,t),n&&b(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}
1
+ (self.webpackChunktencentcloud_webar=self.webpackChunktencentcloud_webar||[]).push([[888],{5940:(t,e,n)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}var i;function a(t,e,n,r,i,a,o){try{var s=t[a](o),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function o(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=u(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return o=t.done,t},e:function(t){s=!0,a=t},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,a=[],o=!0,s=!1;try{for(n=n.call(t);!(o=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);o=!0);}catch(t){s=!0,i=t}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}(t,e)||u(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){if(t){if("string"==typeof t)return l(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function h(){return h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=c(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},h.apply(this,arguments)}function c(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function d(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}function p(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=y(t);if(e){var i=y(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return v(this,n)}}function v(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return m(t)}function m(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function g(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function x(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */x=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var i=e&&e.prototype instanceof d?e:d,a=Object.create(i.prototype),o=new E(r||[]);return a._invoke=function(t,e,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return k()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,n);if(s){if(s===c)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=h(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===c)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,o),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var c={};function d(){}function f(){}function p(){}var v={};u(v,a,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(T([])));y&&y!==e&&n.call(y,a)&&(v=y);var g=p.prototype=d.prototype=Object.create(v);function _(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function i(a,o,s,u){var l=h(t[a],t,o);if("throw"!==l.type){var c=l.arg,d=c.value;return d&&"object"==r(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,u)}),(function(t){i("throw",t,s,u)})):e.resolve(d).then((function(t){c.value=t,s(c)}),(function(t){return i("throw",t,s,u)}))}u(l.arg)}var a;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return a=a?a.then(r,r):r()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return c;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var r=h(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,c;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,c):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,c)}function M(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(M,this),this.reset(!0)}function T(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return f.prototype=p,u(g,"constructor",p),u(p,"constructor",f),f.displayName=u(p,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,s,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},_(b.prototype),u(b.prototype,o,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new b(l(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},_(g),u(g,s,"Generator"),u(g,a,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=T,E.prototype={constructor:E,reset:function(t){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(S),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return o.type="throw",o.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,c):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:T(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),c}},t}function _(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function b(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function w(t,e,n){return e&&b(t.prototype,e),n&&b(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2010-2022 Three.js Authors
5
5
  * SPDX-License-Identifier: MIT
6
- */n.d(t,{A5E:()=>pu,CJI:()=>ur,CP7:()=>wo,D1R:()=>U,EJi:()=>Zs,F5T:()=>Hn,FM8:()=>Ht,IEO:()=>Po,IOt:()=>De,Ilk:()=>tn,Kj0:()=>kr,M8C:()=>$e,Mig:()=>El,N$j:()=>Co,NMF:()=>Me,OdW:()=>No,OoA:()=>D,Ox3:()=>Sl,PMe:()=>bl,Pa4:()=>tt,QRU:()=>pl,SUY:()=>ou,Syv:()=>be,TUv:()=>Ro,TlE:()=>an,Tme:()=>Tn,TyD:()=>I,USm:()=>hn,UY4:()=>Ys,UZH:()=>w,UlW:()=>Le,Vkp:()=>St,VzW:()=>V,Wid:()=>Js,Wl3:()=>S,Xcj:()=>nu,YLQ:()=>N,ZAu:()=>mo,Zp0:()=>fl,ZzF:()=>it,_C8:()=>Tl,_Li:()=>E,_fP:()=>et,aH4:()=>O,aLr:()=>wt,aNw:()=>sl,anP:()=>li,blk:()=>Vo,cLu:()=>W,cPb:()=>Xr,dUE:()=>Ol,dj0:()=>Be,dpR:()=>dl,ehD:()=>T,hH6:()=>ul,iKG:()=>$r,iLg:()=>Nl,iUV:()=>Kl,jAl:()=>_e,jyz:()=>Wn,kB5:()=>iu,knz:()=>Pe,lLk:()=>al,m7l:()=>eu,nls:()=>Oo,qyh:()=>B,rBU:()=>Pr,rDY:()=>Vn,rnI:()=>Ce,rpg:()=>C,u9r:()=>On,uWy:()=>P,vBJ:()=>cr,vmT:()=>Ml,vpT:()=>au,wem:()=>z,wk1:()=>q,x12:()=>Go,xEZ:()=>Wr,xsS:()=>So,yC1:()=>Pl,yGw:()=>Pt,ywz:()=>H,yxD:()=>cl,z$h:()=>Re});for(var w="139",S=0,E=1,T=2,A=100,k=301,L=302,R=306,C=1e3,P=1001,D=1002,I=1003,N=1004,O=1005,z=1006,B=1007,U=1008,H=1009,F=1012,G=1014,V=1015,W=1016,j=1020,q=1023,X=1026,Y=1027,J=33776,Z=33777,K=33778,Q=33779,$=35840,ee=35841,te=35842,ne=35843,re=37492,ie=37496,ae=37808,oe=37809,se=37810,le=37811,ue=37812,ce=37813,he=37814,de=37815,pe=37816,fe=37817,ve=37818,me=37819,ge=37820,ye=37821,xe=36492,_e=2200,be=2300,Me=2301,we=2302,Se=2400,Ee=2401,Te=2402,Ae=2500,ke=2501,Le=1,Re=2,Ce=3e3,Pe=3001,De=0,Ie="srgb",Ne="srgb-linear",Oe=7680,ze=35044,Be=35048,Ue="300 es",He=1035,Fe=[],Ge=0;Ge<256;Ge++)Fe[Ge]=(Ge<16?"0":"")+Ge.toString(16);var Ve=1234567,We=Math.PI/180,je=180/Math.PI;function qe(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(Fe[255&e]+Fe[e>>8&255]+Fe[e>>16&255]+Fe[e>>24&255]+"-"+Fe[255&t]+Fe[t>>8&255]+"-"+Fe[t>>16&15|64]+Fe[t>>24&255]+"-"+Fe[63&n|128]+Fe[n>>8&255]+"-"+Fe[n>>16&255]+Fe[n>>24&255]+Fe[255&r]+Fe[r>>8&255]+Fe[r>>16&255]+Fe[r>>24&255]).toLowerCase()}function Xe(e,t,n){return Math.max(t,Math.min(n,e))}function Ye(e,t){return(e%t+t)%t}function Je(e,t,n){return(1-n)*e+n*t}function Ze(e){return 0==(e&e-1)&&0!==e}function Ke(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Qe(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var $e=Object.freeze({__proto__:null,DEG2RAD:We,RAD2DEG:je,generateUUID:qe,clamp:Xe,euclideanModulo:Ye,mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:Je,damp:function(e,t,n,r){return Je(e,t,1-Math.exp(-n*r))},pingpong:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(Ye(e,2*t)-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())},seededRandom:function(e){void 0!==e&&(Ve=e);var t=Ve+=1831565813;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*We},radToDeg:function(e){return e*je},isPowerOfTwo:Ze,ceilPowerOfTwo:Ke,floorPowerOfTwo:Qe,setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),u=a((t+r)/2),c=o((t+r)/2),h=a((t-r)/2),d=o((t-r)/2),p=a((r-t)/2),f=o((r-t)/2);switch(i){case"XYX":e.set(s*c,l*h,l*d,s*u);break;case"YZY":e.set(l*d,s*c,l*h,s*u);break;case"ZXZ":e.set(l*h,l*d,s*c,s*u);break;case"XZX":e.set(s*c,l*f,l*p,s*u);break;case"YXY":e.set(l*p,s*c,l*f,s*u);break;case"ZYZ":e.set(l*f,l*p,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:function(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}},denormalize:function(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}}),et=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;_(this,e),this._x=t,this._y=n,this._z=r,this._w=i}return M(e,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}},{key:"setFromEuler",value: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,l=o(n/2),u=o(r/2),c=o(i/2),h=s(n/2),d=s(r/2),p=s(i/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==t&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value: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}},{key:"setFromRotationMatrix",value:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],l=t[2],u=t[6],c=t[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-s)*d,this._y=(i-l)*d,this._z=(a-r)*d}else if(n>o&&n>c){var p=2*Math.sqrt(1+n-o-c);this._w=(u-s)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(i+l)/p}else if(o>c){var f=2*Math.sqrt(1+o-n-c);this._w=(i-l)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+u)/f}else{var v=2*Math.sqrt(1+c-n-o);this._w=(a-r)/v,this._x=(i+l)/v,this._y=(s+u)/v,this._z=.25*v}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(e,t){var n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(Xe(this.dot(e),-1,1)))}},{key:"rotateTowards",value: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}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value: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}},{key:"multiply",value: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)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,l=t._z,u=t._w;return this._x=n*u+a*o+r*l-i*s,this._y=r*u+a*s+i*o-n*l,this._z=i*u+a*l+n*s-r*o,this._w=a*u-n*o-r*s-i*l,this._onChangeCallback(),this}},{key:"slerp",value: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 l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*r+t*this._y,this._z=l*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var u=Math.sqrt(s),c=Math.atan2(u,o),h=Math.sin((1-t)*c)/u,d=Math.sin(t*c)/u;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(e,t,n){return this.copy(e).slerp(t,n)}},{key:"random",value:function(){var e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(t*Math.cos(r),n*Math.sin(i),n*Math.cos(i),t*Math.sin(r))}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}},{key:"fromBufferAttribute",value:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}}],[{key:"slerp",value:function(e,t,n,r){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(e,t,r)}},{key:"slerpFlat",value:function(e,t,n,r,i,a,o){var s=n[r+0],l=n[r+1],u=n[r+2],c=n[r+3],h=i[a+0],d=i[a+1],p=i[a+2],f=i[a+3];if(0===o)return e[t+0]=s,e[t+1]=l,e[t+2]=u,void(e[t+3]=c);if(1===o)return e[t+0]=h,e[t+1]=d,e[t+2]=p,void(e[t+3]=f);if(c!==f||s!==h||l!==d||u!==p){var v=1-o,m=s*h+l*d+u*p+c*f,g=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,m*g);v=Math.sin(v*_)/x,o=Math.sin(o*_)/x}var b=o*g;if(s=s*v+h*b,l=l*v+d*b,u=u*v+p*b,c=c*v+f*b,v===1-o){var M=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=M,l*=M,u*=M,c*=M}}e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],l=n[r+2],u=n[r+3],c=i[a],h=i[a+1],d=i[a+2],p=i[a+3];return e[t]=o*p+u*c+s*d-l*h,e[t+1]=s*p+u*h+l*c-o*d,e[t+2]=l*p+u*d+o*h-s*c,e[t+3]=u*p-o*c-s*h-l*d,e}}]),e}();et.prototype.isQuaternion=!0;var tt=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;_(this,t),this.x=e,this.y=n,this.z=r}return M(t,[{key:"set",value:function(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setComponent",value: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}},{key:"getComponent",value: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)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}},{key:"add",value: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)}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}},{key:"sub",value: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)}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}},{key:"multiply",value: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)}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this}},{key:"multiplyVectors",value:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}},{key:"applyEuler",value:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(rt.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(rt.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value: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}},{key:"applyNormalMatrix",value:function(e){return this.applyMatrix3(e).normalize()}},{key:"applyMatrix4",value: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}},{key:"applyQuaternion",value:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*r-o*n,u=s*n+o*t-i*r,c=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=l*s+h*-i+u*-o-c*-a,this.y=u*s+h*-a+c*-i-l*-o,this.z=c*s+h*-o+l*-a-u*-i,this}},{key:"project",value:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}},{key:"unproject",value:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}},{key:"transformDirection",value: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()}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"min",value: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}},{key:"max",value: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}},{key:"clamp",value: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}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value: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}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}},{key:"cross",value: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)}},{key:"crossVectors",value: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}},{key:"projectOnVector",value:function(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}},{key:"projectOnPlane",value:function(e){return nt.copy(this).projectOnVector(e),this.sub(nt)}},{key:"reflect",value:function(e){return this.sub(nt.copy(e).multiplyScalar(2*this.dot(e)))}},{key:"angleTo",value:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(Xe(n,-1,1))}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value: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}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}},{key:"setFromSpherical",value:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}},{key:"setFromSphericalCoords",value: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}},{key:"setFromCylindrical",value:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}},{key:"setFromCylindricalCoords",value:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}},{key:"setFromMatrixPosition",value:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}},{key:"setFromMatrixScale",value: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}},{key:"setFromMatrixColumn",value:function(e,t){return this.fromArray(e.elements,4*t)}},{key:"setFromMatrix3Column",value:function(e,t){return this.fromArray(e.elements,3*t)}},{key:"setFromEuler",value:function(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}},{key:"fromBufferAttribute",value: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}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"randomDirection",value:function(){var e=2*(Math.random()-.5),t=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(e,2));return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}},{key:Symbol.iterator,value:x().mark((function e(){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:case"end":return e.stop()}}),e,this)}))}]),t}();tt.prototype.isVector3=!0;var nt=new tt,rt=new et,it=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new tt(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new tt(-1/0,-1/0,-1/0);_(this,e),this.min=t,this.max=n}return M(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromArray",value:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;s<l;s+=3){var u=e[s],c=e[s+1],h=e[s+2];u<t&&(t=u),c<n&&(n=c),h<r&&(r=h),u>i&&(i=u),c>a&&(a=c),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this}},{key:"setFromBufferAttribute",value:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;s<l;s++){var u=e.getX(s),c=e.getY(s),h=e.getZ(s);u<t&&(t=u),c<n&&(n=c),h<r&&(r=h),u>i&&(i=u),c>a&&(a=c),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}},{key:"setFromCenterAndSize",value:function(e,t){var n=ot.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}},{key:"setFromObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value: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}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}},{key:"getCenter",value:function(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(e){return this.min.min(e),this.max.max(e),this}},{key:"expandByVector",value:function(e){return this.min.sub(e),this.max.add(e),this}},{key:"expandByScalar",value:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this}},{key:"expandByObject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);var n=e.geometry;if(void 0!==n)if(t&&null!=n.attributes&&void 0!==n.attributes.position)for(var r=n.attributes.position,i=0,a=r.count;i<a;i++)ot.fromBufferAttribute(r,i).applyMatrix4(e.matrixWorld),this.expandByPoint(ot);else null===n.boundingBox&&n.computeBoundingBox(),st.copy(n.boundingBox),st.applyMatrix4(e.matrixWorld),this.union(st);for(var o=e.children,s=0,l=o.length;s<l;s++)this.expandByObject(o[s],t);return this}},{key:"containsPoint",value: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)}},{key:"containsBox",value: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}},{key:"getParameter",value:function(e,t){return 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))}},{key:"intersectsBox",value: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)}},{key:"intersectsSphere",value:function(e){return this.clampPoint(e.center,ot),ot.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value: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}},{key:"intersectsTriangle",value:function(e){if(this.isEmpty())return!1;this.getCenter(ft),vt.subVectors(this.max,ft),lt.subVectors(e.a,ft),ut.subVectors(e.b,ft),ct.subVectors(e.c,ft),ht.subVectors(ut,lt),dt.subVectors(ct,ut),pt.subVectors(lt,ct);var t=[0,-ht.z,ht.y,0,-dt.z,dt.y,0,-pt.z,pt.y,ht.z,0,-ht.x,dt.z,0,-dt.x,pt.z,0,-pt.x,-ht.y,ht.x,0,-dt.y,dt.x,0,-pt.y,pt.x,0];return!!yt(t,lt,ut,ct,vt)&&(!!yt(t=[1,0,0,0,1,0,0,0,1],lt,ut,ct,vt)&&(mt.crossVectors(ht,dt),yt(t=[mt.x,mt.y,mt.z],lt,ut,ct,vt)))}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return ot.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"getBoundingSphere",value:function(e){return this.getCenter(e.center),e.radius=.5*this.getSize(ot).length(),e}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"applyMatrix4",value:function(e){return this.isEmpty()||(at[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),at[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),at[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),at[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),at[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),at[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),at[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),at[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(at)),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}();it.prototype.isBox3=!0;var at=[new tt,new tt,new tt,new tt,new tt,new tt,new tt,new tt],ot=new tt,st=new it,lt=new tt,ut=new tt,ct=new tt,ht=new tt,dt=new tt,pt=new tt,ft=new tt,vt=new tt,mt=new tt,gt=new tt;function yt(e,t,n,r,i){for(var a=0,o=e.length-3;a<=o;a+=3){gt.fromArray(e,a);var s=i.x*Math.abs(gt.x)+i.y*Math.abs(gt.y)+i.z*Math.abs(gt.z),l=t.dot(gt),u=n.dot(gt),c=r.dot(gt);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var xt=new it,_t=new tt,bt=new tt,Mt=new tt,wt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new tt,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;_(this,e),this.center=t,this.radius=n}return M(e,[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){var n=this.center;void 0!==t?n.copy(t):xt.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}},{key:"copy",value:function(e){return this.center.copy(e.center),this.radius=e.radius,this}},{key:"isEmpty",value:function(){return this.radius<0}},{key:"makeEmpty",value:function(){return this.center.set(0,0,0),this.radius=-1,this}},{key:"containsPoint",value:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}},{key:"distanceToPoint",value:function(e){return e.distanceTo(this.center)-this.radius}},{key:"intersectsSphere",value:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}},{key:"intersectsBox",value:function(e){return e.intersectsSphere(this)}},{key:"intersectsPlane",value:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}},{key:"clampPoint",value:function(e,t){var n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}},{key:"applyMatrix4",value:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}},{key:"translate",value:function(e){return this.center.add(e),this}},{key:"expandByPoint",value:function(e){Mt.subVectors(e,this.center);var t=Mt.lengthSq();if(t>this.radius*this.radius){var n=Math.sqrt(t),r=.5*(n-this.radius);this.center.add(Mt.multiplyScalar(r/n)),this.radius+=r}return this}},{key:"union",value:function(e){return!0===this.center.equals(e.center)?bt.set(0,0,1).multiplyScalar(e.radius):bt.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(_t.copy(e.center).add(bt)),this.expandByPoint(_t.copy(e.center).sub(bt)),this}},{key:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),St=function(){function e(){_(this,e),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.")}return M(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,l){var u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=i,u[5]=s,u[6]=n,u[7]=a,u[8]=l,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value: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}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value: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}},{key:"multiply",value:function(e){return this.multiplyMatrices(this,e)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=r[0],v=r[3],m=r[6],g=r[1],y=r[4],x=r[7],_=r[2],b=r[5],M=r[8];return i[0]=a*f+o*g+s*_,i[3]=a*v+o*y+s*b,i[6]=a*m+o*x+s*M,i[1]=l*f+u*g+c*_,i[4]=l*v+u*y+c*b,i[7]=l*m+u*x+c*M,i[2]=h*f+d*g+p*_,i[5]=h*v+d*y+p*b,i[8]=h*m+d*x+p*M,this}},{key:"multiplyScalar",value: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}},{key:"determinant",value: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],l=e[7],u=e[8];return t*a*u-t*o*l-n*i*u+n*o*s+r*i*l-r*a*s}},{key:"invert",value: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],l=e[7],u=e[8],c=u*a-o*l,h=o*s-u*i,d=l*i-a*s,p=t*c+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var f=1/p;return e[0]=c*f,e[1]=(r*l-u*n)*f,e[2]=(o*n-r*a)*f,e[3]=h*f,e[4]=(u*t-r*s)*f,e[5]=(r*i-o*t)*f,e[6]=d*f,e[7]=(n*s-l*t)*f,e[8]=(a*t-n*i)*f,this}},{key:"transpose",value: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}},{key:"getNormalMatrix",value:function(e){return this.setFromMatrix4(e).invert().transpose()}},{key:"transposeIntoArray",value: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}},{key:"setUvTransform",value:function(e,t,n,r,i,a,o){var s=Math.cos(i),l=Math.sin(i);return this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-r*l,r*s,-r*(-l*a+s*o)+o+t,0,0,1),this}},{key:"scale",value: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}},{key:"rotate",value: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],l=r[4],u=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*l,r[6]=t*o+n*u,r[1]=-n*i+t*s,r[4]=-n*a+t*l,r[7]=-n*o+t*u,this}},{key:"translate",value: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}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,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}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}]),e}();St.prototype.isMatrix3=!0;var Et=new tt,Tt=new tt,At=new St,kt=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new tt(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;_(this,e),this.normal=t,this.constant=n}return M(e,[{key:"set",value:function(e,t){return this.normal.copy(e),this.constant=t,this}},{key:"setComponents",value:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}},{key:"setFromNormalAndCoplanarPoint",value:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(e,t,n){var r=Et.subVectors(n,t).cross(Tt.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}},{key:"copy",value:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this}},{key:"normalize",value:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}},{key:"negate",value:function(){return this.constant*=-1,this.normal.negate(),this}},{key:"distanceToPoint",value:function(e){return this.normal.dot(e)+this.constant}},{key:"distanceToSphere",value:function(e){return this.distanceToPoint(e.center)-e.radius}},{key:"projectPoint",value:function(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}},{key:"intersectLine",value:function(e,t){var n=e.delta(Et),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var i=-(e.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:t.copy(n).multiplyScalar(i).add(e.start)}},{key:"intersectsLine",value:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}},{key:"intersectsBox",value:function(e){return e.intersectsPlane(this)}},{key:"intersectsSphere",value:function(e){return e.intersectsPlane(this)}},{key:"coplanarPoint",value:function(e){return e.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(e,t){var n=t||At.getNormalMatrix(e),r=this.coplanarPoint(Et).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}},{key:"translate",value:function(e){return this.constant-=e.dot(this.normal),this}},{key:"equals",value:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}();kt.prototype.isPlane=!0;var Lt=new wt,Rt=new tt,Ct=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new kt,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new kt,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new kt,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new kt,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new kt,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new kt;_(this,e),this.planes=[t,n,r,i,a,o]}return M(e,[{key:"set",value: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}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],l=n[5],u=n[6],c=n[7],h=n[8],d=n[9],p=n[10],f=n[11],v=n[12],m=n[13],g=n[14],y=n[15];return t[0].setComponents(o-r,c-s,f-h,y-v).normalize(),t[1].setComponents(o+r,c+s,f+h,y+v).normalize(),t[2].setComponents(o+i,c+l,f+d,y+m).normalize(),t[3].setComponents(o-i,c-l,f-d,y-m).normalize(),t[4].setComponents(o-a,c-u,f-p,y-g).normalize(),t[5].setComponents(o+a,c+u,f+p,y+g).normalize(),this}},{key:"intersectsObject",value:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Lt.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Lt)}},{key:"intersectsSprite",value:function(e){return Lt.center.set(0,0,0),Lt.radius=.7071067811865476,Lt.applyMatrix4(e.matrixWorld),this.intersectsSphere(Lt)}},{key:"intersectsSphere",value: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}},{key:"intersectsBox",value:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(Rt.x=r.normal.x>0?e.max.x:e.min.x,Rt.y=r.normal.y>0?e.max.y:e.min.y,Rt.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Rt)<0)return!1}return!0}},{key:"containsPoint",value:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),Pt=function(){function e(){_(this,e),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.")}return M(e,[{key:"set",value:function(e,t,n,r,i,a,o,s,l,u,c,h,d,p,f,v){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=r,m[1]=i,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=u,m[10]=c,m[14]=h,m[3]=d,m[7]=p,m[11]=f,m[15]=v,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new e).fromArray(this.elements)}},{key:"copy",value: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}},{key:"copyPosition",value:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}},{key:"setFromMatrix3",value:function(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}},{key:"extractBasis",value:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value: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}},{key:"extractRotation",value:function(e){var t=this.elements,n=e.elements,r=1/Dt.setFromMatrixColumn(e,0).length(),i=1/Dt.setFromMatrixColumn(e,1).length(),a=1/Dt.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}},{key:"makeRotationFromEuler",value: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),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===e.order){var h=a*u,d=a*c,p=o*u,f=o*c;t[0]=s*u,t[4]=-s*c,t[8]=l,t[1]=d+p*l,t[5]=h-f*l,t[9]=-o*s,t[2]=f-h*l,t[6]=p+d*l,t[10]=a*s}else if("YXZ"===e.order){var v=s*u,m=s*c,g=l*u,y=l*c;t[0]=v+y*o,t[4]=g*o-m,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-o,t[2]=m*o-g,t[6]=y+v*o,t[10]=a*s}else if("ZXY"===e.order){var x=s*u,_=s*c,b=l*u,M=l*c;t[0]=x-M*o,t[4]=-a*c,t[8]=b+_*o,t[1]=_+b*o,t[5]=a*u,t[9]=M-x*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var w=a*u,S=a*c,E=o*u,T=o*c;t[0]=s*u,t[4]=E*l-S,t[8]=w*l+T,t[1]=s*c,t[5]=T*l+w,t[9]=S*l-E,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var A=a*s,k=a*l,L=o*s,R=o*l;t[0]=s*u,t[4]=R-A*c,t[8]=L*c+k,t[1]=c,t[5]=a*u,t[9]=-o*u,t[2]=-l*u,t[6]=k*c+L,t[10]=A-R*c}else if("XZY"===e.order){var C=a*s,P=a*l,D=o*s,I=o*l;t[0]=s*u,t[4]=-c,t[8]=l*u,t[1]=C*c+I,t[5]=a*u,t[9]=P*c-D,t[2]=D*c-P,t[6]=o*u,t[10]=I*c+C}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(e){return this.compose(Nt,e,Ot)}},{key:"lookAt",value:function(e,t,n){var r=this.elements;return Ut.subVectors(e,t),0===Ut.lengthSq()&&(Ut.z=1),Ut.normalize(),zt.crossVectors(n,Ut),0===zt.lengthSq()&&(1===Math.abs(n.z)?Ut.x+=1e-4:Ut.z+=1e-4,Ut.normalize(),zt.crossVectors(n,Ut)),zt.normalize(),Bt.crossVectors(Ut,zt),r[0]=zt.x,r[4]=Bt.x,r[8]=Ut.x,r[1]=zt.y,r[5]=Bt.y,r[9]=Ut.y,r[2]=zt.z,r[6]=Bt.z,r[10]=Ut.z,this}},{key:"multiply",value: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)}},{key:"premultiply",value:function(e){return this.multiplyMatrices(e,this)}},{key:"multiplyMatrices",value:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],v=n[10],m=n[14],g=n[3],y=n[7],x=n[11],_=n[15],b=r[0],M=r[4],w=r[8],S=r[12],E=r[1],T=r[5],A=r[9],k=r[13],L=r[2],R=r[6],C=r[10],P=r[14],D=r[3],I=r[7],N=r[11],O=r[15];return i[0]=a*b+o*E+s*L+l*D,i[4]=a*M+o*T+s*R+l*I,i[8]=a*w+o*A+s*C+l*N,i[12]=a*S+o*k+s*P+l*O,i[1]=u*b+c*E+h*L+d*D,i[5]=u*M+c*T+h*R+d*I,i[9]=u*w+c*A+h*C+d*N,i[13]=u*S+c*k+h*P+d*O,i[2]=p*b+f*E+v*L+m*D,i[6]=p*M+f*T+v*R+m*I,i[10]=p*w+f*A+v*C+m*N,i[14]=p*S+f*k+v*P+m*O,i[3]=g*b+y*E+x*L+_*D,i[7]=g*M+y*T+x*R+_*I,i[11]=g*w+y*A+x*C+_*N,i[15]=g*S+y*k+x*P+_*O,this}},{key:"multiplyScalar",value: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}},{key:"determinant",value: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],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14];return e[3]*(+i*s*c-r*l*c-i*o*h+n*l*h+r*o*d-n*s*d)+e[7]*(+t*s*d-t*l*h+i*a*h-r*a*d+r*l*u-i*s*u)+e[11]*(+t*l*c-t*o*d-i*a*c+n*a*d+i*o*u-n*l*u)+e[15]*(-r*o*u-t*s*c+t*o*h+r*a*c-n*a*h+n*s*u)}},{key:"transpose",value: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}},{key:"setPosition",value:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}},{key:"invert",value: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],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],v=e[14],m=e[15],g=c*v*l-f*h*l+f*s*d-o*v*d-c*s*m+o*h*m,y=p*h*l-u*v*l-p*s*d+a*v*d+u*s*m-a*h*m,x=u*f*l-p*c*l+p*o*d-a*f*d-u*o*m+a*c*m,_=p*c*s-u*f*s-p*o*h+a*f*h+u*o*v-a*c*v,b=t*g+n*y+r*x+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var M=1/b;return e[0]=g*M,e[1]=(f*h*i-c*v*i-f*r*d+n*v*d+c*r*m-n*h*m)*M,e[2]=(o*v*i-f*s*i+f*r*l-n*v*l-o*r*m+n*s*m)*M,e[3]=(c*s*i-o*h*i-c*r*l+n*h*l+o*r*d-n*s*d)*M,e[4]=y*M,e[5]=(u*v*i-p*h*i+p*r*d-t*v*d-u*r*m+t*h*m)*M,e[6]=(p*s*i-a*v*i-p*r*l+t*v*l+a*r*m-t*s*m)*M,e[7]=(a*h*i-u*s*i+u*r*l-t*h*l-a*r*d+t*s*d)*M,e[8]=x*M,e[9]=(p*c*i-u*f*i-p*n*d+t*f*d+u*n*m-t*c*m)*M,e[10]=(a*f*i-p*o*i+p*n*l-t*f*l-a*n*m+t*o*m)*M,e[11]=(u*o*i-a*c*i-u*n*l+t*c*l+a*n*d-t*o*d)*M,e[12]=_*M,e[13]=(u*f*r-p*c*r+p*n*h-t*f*h-u*n*v+t*c*v)*M,e[14]=(p*o*r-a*f*r-p*n*s+t*f*s+a*n*v-t*o*v)*M,e[15]=(a*c*r-u*o*r+u*n*s-t*c*s-a*n*h+t*o*h)*M,this}},{key:"scale",value: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}},{key:"getMaxScaleOnAxis",value: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))}},{key:"makeTranslation",value:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}},{key:"makeRotationX",value: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}},{key:"makeRotationY",value: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}},{key:"makeRotationZ",value: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}},{key:"makeRotationAxis",value:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,l=i*a,u=i*o;return this.set(l*a+n,l*o-r*s,l*s+r*o,0,l*o+r*s,u*o+n,u*s-r*a,0,l*s-r*o,u*s+r*a,i*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}},{key:"compose",value:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,l=i+i,u=a+a,c=o+o,h=i*l,d=i*u,p=i*c,f=a*u,v=a*c,m=o*c,g=s*l,y=s*u,x=s*c,_=n.x,b=n.y,M=n.z;return r[0]=(1-(f+m))*_,r[1]=(d+x)*_,r[2]=(p-y)*_,r[3]=0,r[4]=(d-x)*b,r[5]=(1-(h+m))*b,r[6]=(v+g)*b,r[7]=0,r[8]=(p+y)*M,r[9]=(v-g)*M,r[10]=(1-(h+f))*M,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}},{key:"decompose",value:function(e,t,n){var r=this.elements,i=Dt.set(r[0],r[1],r[2]).length(),a=Dt.set(r[4],r[5],r[6]).length(),o=Dt.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],It.copy(this);var s=1/i,l=1/a,u=1/o;return It.elements[0]*=s,It.elements[1]*=s,It.elements[2]*=s,It.elements[4]*=l,It.elements[5]*=l,It.elements[6]*=l,It.elements[8]*=u,It.elements[9]*=u,It.elements[10]*=u,t.setFromRotationMatrix(It),n.x=i,n.y=a,n.z=o,this}},{key:"makePerspective",value: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),l=2*i/(n-r),u=(t+e)/(t-e),c=(n+r)/(n-r),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}},{key:"makeOrthographic",value:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),l=1/(n-r),u=1/(a-i),c=(t+e)*s,h=(n+r)*l,d=(a+i)*u;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}},{key:"equals",value:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,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}}]),e}();Pt.prototype.isMatrix4=!0;var Dt=new tt,It=new Pt,Nt=new tt(0,0,0),Ot=new tt(1,1,1),zt=new tt,Bt=new tt,Ut=new tt,Ht=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;_(this,t),this.x=e,this.y=n}return M(t,[{key:"width",get:function(){return this.x},set:function(e){this.x=e}},{key:"height",get:function(){return this.y},set:function(e){this.y=e}},{key:"set",value:function(e,t){return this.x=e,this.y=t,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setComponent",value: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}},{key:"getComponent",value:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(e){return this.x=e.x,this.y=e.y,this}},{key:"add",value: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)}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this}},{key:"addVectors",value:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}},{key:"addScaledVector",value:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}},{key:"sub",value: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)}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this}},{key:"subVectors",value:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this}},{key:"divide",value:function(e){return this.x/=e.x,this.y/=e.y,this}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"applyMatrix3",value: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}},{key:"min",value:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}},{key:"max",value:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}},{key:"clamp",value: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}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y}},{key:"cross",value:function(e){return this.x*e.y-this.y*e.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e}},{key:"distanceTo",value:function(e){return Math.sqrt(this.distanceToSquared(e))}},{key:"distanceToSquared",value:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n}},{key:"manhattanDistanceTo",value:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}},{key:"fromBufferAttribute",value: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}},{key:"rotateAround",value: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}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:Symbol.iterator,value:x().mark((function e(){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:case"end":return e.stop()}}),e,this)}))}]),t}();Ht.prototype.isVector2=!0;var Ft=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;_(this,t),this.x=e,this.y=n,this.z=r,this.w=i}return M(t,[{key:"width",get:function(){return this.z},set:function(e){this.z=e}},{key:"height",get:function(){return this.w},set:function(e){this.w=e}},{key:"set",value:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}},{key:"setScalar",value:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}},{key:"setX",value:function(e){return this.x=e,this}},{key:"setY",value:function(e){return this.y=e,this}},{key:"setZ",value:function(e){return this.z=e,this}},{key:"setW",value:function(e){return this.w=e,this}},{key:"setComponent",value: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}},{key:"getComponent",value: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)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value: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}},{key:"add",value: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)}},{key:"addScalar",value:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}},{key:"addVectors",value: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}},{key:"addScaledVector",value: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}},{key:"sub",value: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)}},{key:"subScalar",value:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}},{key:"subVectors",value: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}},{key:"multiply",value:function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}},{key:"applyMatrix4",value: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}},{key:"divideScalar",value:function(e){return this.multiplyScalar(1/e)}},{key:"setAxisAngleFromQuaternion",value: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}},{key:"setAxisAngleFromRotationMatrix",value:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,l=s[0],u=s[4],c=s[8],h=s[1],d=s[5],p=s[9],f=s[2],v=s[6],m=s[10];if(Math.abs(u-h)<a&&Math.abs(c-f)<a&&Math.abs(p-v)<a){if(Math.abs(u+h)<o&&Math.abs(c+f)<o&&Math.abs(p+v)<o&&Math.abs(l+d+m-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var g=(l+1)/2,y=(d+1)/2,x=(m+1)/2,_=(u+h)/4,b=(c+f)/4,M=(p+v)/4;return g>y&&g>x?g<a?(n=0,r=.707106781,i=.707106781):(r=_/(n=Math.sqrt(g)),i=b/n):y>x?y<a?(n=.707106781,r=0,i=.707106781):(n=_/(r=Math.sqrt(y)),i=M/r):x<a?(n=.707106781,r=.707106781,i=0):(n=b/(i=Math.sqrt(x)),r=M/i),this.set(n,r,i,t),this}var w=Math.sqrt((v-p)*(v-p)+(c-f)*(c-f)+(h-u)*(h-u));return Math.abs(w)<.001&&(w=1),this.x=(v-p)/w,this.y=(c-f)/w,this.z=(h-u)/w,this.w=Math.acos((l+d+m-1)/2),this}},{key:"min",value: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}},{key:"max",value: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}},{key:"clamp",value: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}},{key:"clampScalar",value:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}},{key:"clampLength",value:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}},{key:"floor",value: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}},{key:"ceil",value: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}},{key:"round",value: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}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(e){return this.normalize().multiplyScalar(e)}},{key:"lerp",value: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}},{key:"lerpVectors",value:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}},{key:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}},{key:"fromBufferAttribute",value: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}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:Symbol.iterator,value:x().mark((function e(){return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.x;case 2:return e.next=4,this.y;case 4:return e.next=6,this.z;case 6:return e.next=8,this.w;case 8:case"end":return e.stop()}}),e,this)}))}]),t}();function Gt(){var e=null,t=!1,n=null,r=null;function i(t,a){n(t,a),r=e.requestAnimationFrame(i)}return{start:function(){!0!==t&&null!==n&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function Vt(e,t){var n=t.isWebGL2,r=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),r.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=r.get(t);n&&(e.deleteBuffer(n.buffer),r.delete(t))},update:function(t,i){if(t.isGLBufferAttribute){var a=r.get(t);(!a||a.version<t.version)&&r.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version})}else{t.isInterleavedBufferAttribute&&(t=t.data);var o=r.get(t);void 0===o?r.set(t,function(t,r){var i,a=t.array,o=t.usage,s=e.createBuffer();if(e.bindBuffer(r,s),e.bufferData(r,a,o),t.onUploadCallback(),a instanceof Float32Array)i=5126;else if(a instanceof Uint16Array)if(t.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");i=5131}else i=5123;else if(a instanceof Int16Array)i=5122;else if(a instanceof Uint32Array)i=5125;else if(a instanceof Int32Array)i=5124;else if(a instanceof Int8Array)i=5120;else if(a instanceof Uint8Array)i=5121;else{if(!(a instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);i=5121}return{buffer:s,type:i,bytesPerElement:a.BYTES_PER_ELEMENT,version:t.version}}(t,i)):o.version<t.version&&(!function(t,r,i){var a=r.array,o=r.updateRange;e.bindBuffer(i,t),-1===o.count?e.bufferSubData(i,0,a):(n?e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(o.buffer,t,i),o.version=t.version)}}}}Ft.prototype.isVector4=!0;var Wt=function(){function e(){_(this,e)}return M(e,[{key:"addEventListener",value: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)}},{key:"hasEventListener",value:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)}},{key:"removeEventListener",value: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)}}}},{key:"dispatchEvent",value: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);e.target=null}}}}]),e}();function jt(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function qt(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var Xt=(y(i={},Ie,y({},Ne,jt)),y(i,Ne,y({},Ie,qt)),i),Yt={legacyMode:!0,get workingColorSpace(){return Ne},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,n){if(this.legacyMode||t===n||!t||!n)return e;if(Xt[t]&&void 0!==Xt[t][n]){var r=Xt[t][n];return e.r=r(e.r),e.g=r(e.g),e.b=r(e.b),e}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},Jt={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},Zt={r:0,g:0,b:0},Kt={h:0,s:0,l:0},Qt={h:0,s:0,l:0};function $t(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function en(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}var tn=function(){function e(t,n,r){return _(this,e),void 0===n&&void 0===r?this.set(t):this.setRGB(t,n,r)}return M(e,[{key:"set",value:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}},{key:"setScalar",value:function(e){return this.r=e,this.g=e,this.b=e,this}},{key:"setHex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ie;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Yt.toWorkingColorSpace(this,t),this}},{key:"setRGB",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ne;return this.r=e,this.g=t,this.b=n,Yt.toWorkingColorSpace(this,r),this}},{key:"setHSL",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ne;if(e=Ye(e,1),t=Xe(t,0,1),n=Xe(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,a=2*n-i;this.r=$t(a,i,e+1/3),this.g=$t(a,i,e),this.b=$t(a,i,e-1/3)}return Yt.toWorkingColorSpace(this,r),this}},{key:"setStyle",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ie;function r(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){var i,a=t[1],o=t[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,Yt.toWorkingColorSpace(this,n),r(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,Yt.toWorkingColorSpace(this,n),r(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){var s=parseFloat(i[1])/360,l=parseInt(i[2],10)/100,u=parseInt(i[3],10)/100;return r(i[4]),this.setHSL(s,l,u,n)}}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){var c=t[1],h=c.length;if(3===h)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,Yt.toWorkingColorSpace(this,n),this;if(6===h)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,Yt.toWorkingColorSpace(this,n),this}return e&&e.length>0?this.setColorName(e,n):this}},{key:"setColorName",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ie,n=Jt[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}},{key:"copySRGBToLinear",value:function(e){return this.r=jt(e.r),this.g=jt(e.g),this.b=jt(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=qt(e.r),this.g=qt(e.g),this.b=qt(e.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ie;return Yt.fromWorkingColorSpace(en(this,Zt),e),Xe(255*Zt.r,0,255)<<16^Xe(255*Zt.g,0,255)<<8^Xe(255*Zt.b,0,255)<<0}},{key:"getHexString",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ie;return("000000"+this.getHex(e).toString(16)).slice(-6)}},{key:"getHSL",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ne;Yt.fromWorkingColorSpace(en(this,Zt),t);var n,r,i=Zt.r,a=Zt.g,o=Zt.b,s=Math.max(i,a,o),l=Math.min(i,a,o),u=(l+s)/2;if(l===s)n=0,r=0;else{var c=s-l;switch(r=u<=.5?c/(s+l):c/(2-s-l),s){case i:n=(a-o)/c+(a<o?6:0);break;case a:n=(o-i)/c+2;break;case o:n=(i-a)/c+4}n/=6}return e.h=n,e.s=r,e.l=u,e}},{key:"getRGB",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ne;return Yt.fromWorkingColorSpace(en(this,Zt),t),e.r=Zt.r,e.g=Zt.g,e.b=Zt.b,e}},{key:"getStyle",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ie;return Yt.fromWorkingColorSpace(en(this,Zt),e),e!==Ie?"color(".concat(e," ").concat(Zt.r," ").concat(Zt.g," ").concat(Zt.b,")"):"rgb(".concat(255*Zt.r|0,",").concat(255*Zt.g|0,",").concat(255*Zt.b|0,")")}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(Kt),Kt.h+=e,Kt.s+=t,Kt.l+=n,this.setHSL(Kt.h,Kt.s,Kt.l),this}},{key:"add",value:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}},{key:"addColors",value:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}},{key:"addScalar",value:function(e){return this.r+=e,this.g+=e,this.b+=e,this}},{key:"sub",value: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}},{key:"multiply",value:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}},{key:"multiplyScalar",value:function(e){return this.r*=e,this.g*=e,this.b*=e,this}},{key:"lerp",value: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}},{key:"lerpColors",value:function(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}},{key:"lerpHSL",value:function(e,t){this.getHSL(Kt),e.getHSL(Qt);var n=Je(Kt.h,Qt.h,t),r=Je(Kt.s,Qt.s,t),i=Je(Kt.l,Qt.l,t);return this.setHSL(n,r,i),this}},{key:"equals",value:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}},{key:"fromArray",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},{key:"fromBufferAttribute",value:function(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),!0===e.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}},{key:"toJSON",value:function(){return this.getHex()}}]),e}();tn.NAMES=Jt,tn.prototype.isColor=!0,tn.prototype.r=1,tn.prototype.g=1,tn.prototype.b=1;var nn=new tt,rn=new Ht,an=function(){function e(t,n,r){if(_(this,e),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=!0===r,this.usage=ze,this.updateRange={offset:0,count:-1},this.version=0}return M(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}},{key:"copyAt",value: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}},{key:"copyArray",value:function(e){return this.array.set(e),this}},{key:"copyColorsArray",value: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 tn),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this}},{key:"copyVector2sArray",value: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 Ht),t[n++]=a.x,t[n++]=a.y}return this}},{key:"copyVector3sArray",value: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 tt),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this}},{key:"copyVector4sArray",value: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 Ft),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this}},{key:"applyMatrix3",value:function(e){if(2===this.itemSize)for(var t=0,n=this.count;t<n;t++)rn.fromBufferAttribute(this,t),rn.applyMatrix3(e),this.setXY(t,rn.x,rn.y);else if(3===this.itemSize)for(var r=0,i=this.count;r<i;r++)nn.fromBufferAttribute(this,r),nn.applyMatrix3(e),this.setXYZ(r,nn.x,nn.y,nn.z);return this}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.count;t<n;t++)nn.fromBufferAttribute(this,t),nn.applyMatrix4(e),this.setXYZ(t,nn.x,nn.y,nn.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)nn.fromBufferAttribute(this,t),nn.applyNormalMatrix(e),this.setXYZ(t,nn.x,nn.y,nn.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)nn.fromBufferAttribute(this,t),nn.transformDirection(e),this.setXYZ(t,nn.x,nn.y,nn.z);return this}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"getX",value:function(e){return this.array[e*this.itemSize]}},{key:"setX",value:function(e,t){return this.array[e*this.itemSize]=t,this}},{key:"getY",value:function(e){return this.array[e*this.itemSize+1]}},{key:"setY",value:function(e,t){return this.array[e*this.itemSize+1]=t,this}},{key:"getZ",value:function(e){return this.array[e*this.itemSize+2]}},{key:"setZ",value:function(e,t){return this.array[e*this.itemSize+2]=t,this}},{key:"getW",value:function(e){return this.array[e*this.itemSize+3]}},{key:"setW",value:function(e,t){return this.array[e*this.itemSize+3]=t,this}},{key:"setXY",value:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this}},{key:"setXYZ",value: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}},{key:"setXYZW",value: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}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==ze&&(e.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(e.updateRange=this.updateRange),e}}]),e}();an.prototype.isBufferAttribute=!0;var on=function(e){d(n,e);var t=f(n);function n(e,r,i){return _(this,n),t.call(this,new Uint16Array(e),r,i)}return M(n)}(an),sn=function(e){d(n,e);var t=f(n);function n(e,r,i){return _(this,n),t.call(this,new Uint32Array(e),r,i)}return M(n)}(an);(function(e){d(n,e);var t=f(n);function n(e,r,i){return _(this,n),t.call(this,new Uint16Array(e),r,i)}return M(n)})(an).prototype.isFloat16BufferAttribute=!0;var ln=function(e){d(n,e);var t=f(n);function n(e,r,i){return _(this,n),t.call(this,new Float32Array(e),r,i)}return M(n)}(an),un=new Pt,cn=new et,hn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.DefaultOrder;_(this,e),this._x=t,this._y=n,this._z=r,this._order=i}return M(e,[{key:"x",get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}},{key:"set",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],l=r[5],u=r[9],c=r[2],h=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(Xe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Xe(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,l)):(this._y=Math.atan2(-c,i),this._z=0);break;case"ZXY":this._x=Math.asin(Xe(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-Xe(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Xe(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,i)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Xe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(e,t,n){return un.makeRotationFromQuaternion(e),this.setFromRotationMatrix(un,t,n)}},{key:"setFromVector3",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}},{key:"reorder",value:function(e){return cn.setFromEuler(this),this.setFromQuaternion(cn,e)}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}},{key:"fromArray",value: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}},{key:"toArray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}}]),e}();hn.prototype.isEuler=!0,hn.DefaultOrder="XYZ",hn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var dn=function(){function e(){_(this,e),this.mask=1}return M(e,[{key:"set",value:function(e){this.mask=(1<<e|0)>>>0}},{key:"enable",value:function(e){this.mask|=1<<e|0}},{key:"enableAll",value:function(){this.mask=-1}},{key:"toggle",value:function(e){this.mask^=1<<e|0}},{key:"disable",value:function(e){this.mask&=~(1<<e|0)}},{key:"disableAll",value:function(){this.mask=0}},{key:"test",value:function(e){return 0!=(this.mask&e.mask)}},{key:"isEnabled",value:function(e){return 0!=(this.mask&(1<<e|0))}}]),e}(),pn=0,fn=new tt,vn=new et,mn=new Pt,gn=new tt,yn=new tt,xn=new tt,_n=new et,bn=new tt(1,0,0),Mn=new tt(0,1,0),wn=new tt(0,0,1),Sn={type:"added"},En={type:"removed"},Tn=function(e){d(n,e);var t=f(n);function n(){var e;_(this,n),e=t.call(this),Object.defineProperty(m(e),"id",{value:pn++}),e.uuid=qe(),e.name="",e.type="Object3D",e.parent=null,e.children=[],e.up=n.DefaultUp.clone();var r=new tt,i=new hn,a=new et,o=new tt(1,1,1);return i._onChange((function(){a.setFromEuler(i,!1)})),a._onChange((function(){i.setFromQuaternion(a,void 0,!1)})),Object.defineProperties(m(e),{position:{configurable:!0,enumerable:!0,value:r},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:a},scale:{configurable:!0,enumerable:!0,value:o},modelViewMatrix:{value:new Pt},normalMatrix:{value:new St}}),e.matrix=new Pt,e.matrixWorld=new Pt,e.matrixAutoUpdate=n.DefaultMatrixAutoUpdate,e.matrixWorldNeedsUpdate=!1,e.layers=new dn,e.visible=!0,e.castShadow=!1,e.receiveShadow=!1,e.frustumCulled=!0,e.renderOrder=0,e.animations=[],e.userData={},e}return M(n,[{key:"onBeforeRender",value:function(){}},{key:"onAfterRender",value:function(){}},{key:"applyMatrix4",value:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}},{key:"applyQuaternion",value:function(e){return this.quaternion.premultiply(e),this}},{key:"setRotationFromAxisAngle",value:function(e,t){this.quaternion.setFromAxisAngle(e,t)}},{key:"setRotationFromEuler",value:function(e){this.quaternion.setFromEuler(e,!0)}},{key:"setRotationFromMatrix",value:function(e){this.quaternion.setFromRotationMatrix(e)}},{key:"setRotationFromQuaternion",value:function(e){this.quaternion.copy(e)}},{key:"rotateOnAxis",value:function(e,t){return vn.setFromAxisAngle(e,t),this.quaternion.multiply(vn),this}},{key:"rotateOnWorldAxis",value:function(e,t){return vn.setFromAxisAngle(e,t),this.quaternion.premultiply(vn),this}},{key:"rotateX",value:function(e){return this.rotateOnAxis(bn,e)}},{key:"rotateY",value:function(e){return this.rotateOnAxis(Mn,e)}},{key:"rotateZ",value:function(e){return this.rotateOnAxis(wn,e)}},{key:"translateOnAxis",value:function(e,t){return fn.copy(e).applyQuaternion(this.quaternion),this.position.add(fn.multiplyScalar(t)),this}},{key:"translateX",value:function(e){return this.translateOnAxis(bn,e)}},{key:"translateY",value:function(e){return this.translateOnAxis(Mn,e)}},{key:"translateZ",value:function(e){return this.translateOnAxis(wn,e)}},{key:"localToWorld",value:function(e){return e.applyMatrix4(this.matrixWorld)}},{key:"worldToLocal",value:function(e){return e.applyMatrix4(mn.copy(this.matrixWorld).invert())}},{key:"lookAt",value:function(e,t,n){e.isVector3?gn.copy(e):gn.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),yn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?mn.lookAt(yn,gn,this.up):mn.lookAt(gn,yn,this.up),this.quaternion.setFromRotationMatrix(mn),r&&(mn.extractRotation(r.matrixWorld),vn.setFromRotationMatrix(mn),this.quaternion.premultiply(vn.invert()))}},{key:"add",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Sn)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}},{key:"remove",value:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(En)),this}},{key:"removeFromParent",value:function(){var e=this.parent;return null!==e&&e.remove(this),this}},{key:"clear",value:function(){for(var e=0;e<this.children.length;e++){var t=this.children[e];t.parent=null,t.dispatchEvent(En)}return this.children.length=0,this}},{key:"attach",value:function(e){return this.updateWorldMatrix(!0,!1),mn.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),mn.multiply(e.parent.matrixWorld)),e.applyMatrix4(mn),this.add(e),e.updateWorldMatrix(!1,!0),this}},{key:"getObjectById",value:function(e){return this.getObjectByProperty("id",e)}},{key:"getObjectByName",value:function(e){return this.getObjectByProperty("name",e)}},{key:"getObjectByProperty",value: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}}},{key:"getWorldPosition",value:function(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}},{key:"getWorldQuaternion",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yn,e,xn),e}},{key:"getWorldScale",value:function(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yn,_n,e),e}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}},{key:"raycast",value:function(){}},{key:"traverse",value:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)}},{key:"traverseVisible",value: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)}}},{key:"traverseAncestors",value:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}},{key:"updateMatrix",value:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}},{key:"updateMatrixWorld",value: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)}},{key:"updateWorldMatrix",value: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)}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},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.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(r.environment=this.environment.toJSON(e).uuid);else if(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,l=o.length;s<l;s++){var u=o[s];i(e.shapes,u)}else i(e.shapes,o)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var c=[],h=0,d=this.material.length;h<d;h++)c.push(i(e.materials,this.material[h]));r.material=c}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(var p=0;p<this.children.length;p++)r.children.push(this.children[p].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(var f=0;f<this.animations.length;f++){var v=this.animations[f];r.animations.push(i(e.animations,v))}}if(t){var m=S(e.geometries),g=S(e.materials),y=S(e.textures),x=S(e.images),_=S(e.shapes),b=S(e.skeletons),M=S(e.animations),w=S(e.nodes);m.length>0&&(n.geometries=m),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),x.length>0&&(n.images=x),_.length>0&&(n.shapes=_),b.length>0&&(n.skeletons=b),M.length>0&&(n.animations=M),w.length>0&&(n.nodes=w)}return n.object=r,n;function S(e){var t=[];for(var n in e){var r=e[n];delete r.metadata,t.push(r)}return t}}},{key:"clone",value:function(e){return(new this.constructor).copy(this,e)}},{key:"copy",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,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}}]),n}(Wt);function An(e){for(var t=e.length-1;t>=0;--t)if(e[t]>65535)return!0;return!1}function kn(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}Tn.DefaultUp=new tt(0,1,0),Tn.DefaultMatrixAutoUpdate=!0,Tn.prototype.isObject3D=!0;var Ln=0,Rn=new Pt,Cn=new Tn,Pn=new tt,Dn=new it,In=new it,Nn=new tt,On=function(e){d(n,e);var t=f(n);function n(){var e;return _(this,n),e=t.call(this),Object.defineProperty(m(e),"id",{value:Ln++}),e.uuid=qe(),e.name="",e.type="BufferGeometry",e.index=null,e.attributes={},e.morphAttributes={},e.morphTargetsRelative=!1,e.groups=[],e.boundingBox=null,e.boundingSphere=null,e.drawRange={start:0,count:1/0},e.userData={},e}return M(n,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(e){return Array.isArray(e)?this.index=new(An(e)?sn:on)(e,1):this.index=e,this}},{key:"getAttribute",value:function(e){return this.attributes[e]}},{key:"setAttribute",value:function(e,t){return this.attributes[e]=t,this}},{key:"deleteAttribute",value:function(e){return delete this.attributes[e],this}},{key:"hasAttribute",value:function(e){return void 0!==this.attributes[e]}},{key:"addGroup",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(e,t){this.drawRange.start=e,this.drawRange.count=t}},{key:"applyMatrix4",value:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new St).getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(e){return Rn.makeRotationFromQuaternion(e),this.applyMatrix4(Rn),this}},{key:"rotateX",value:function(e){return Rn.makeRotationX(e),this.applyMatrix4(Rn),this}},{key:"rotateY",value:function(e){return Rn.makeRotationY(e),this.applyMatrix4(Rn),this}},{key:"rotateZ",value:function(e){return Rn.makeRotationZ(e),this.applyMatrix4(Rn),this}},{key:"translate",value:function(e,t,n){return Rn.makeTranslation(e,t,n),this.applyMatrix4(Rn),this}},{key:"scale",value:function(e,t,n){return Rn.makeScale(e,t,n),this.applyMatrix4(Rn),this}},{key:"lookAt",value:function(e){return Cn.lookAt(e),Cn.updateMatrix(),this.applyMatrix4(Cn.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Pn).negate(),this.translate(Pn.x,Pn.y,Pn.z),this}},{key:"setFromPoints",value: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.setAttribute("position",new ln(t,3)),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new it);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new tt(-1/0,-1/0,-1/0),new tt(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];Dn.setFromBufferAttribute(i),this.morphTargetsRelative?(Nn.addVectors(this.boundingBox.min,Dn.min),this.boundingBox.expandByPoint(Nn),Nn.addVectors(this.boundingBox.max,Dn.max),this.boundingBox.expandByPoint(Nn)):(this.boundingBox.expandByPoint(Dn.min),this.boundingBox.expandByPoint(Dn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new wt);var e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new tt,1/0);if(e){var n=this.boundingSphere.center;if(Dn.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];In.setFromBufferAttribute(a),this.morphTargetsRelative?(Nn.addVectors(Dn.min,In.min),Dn.expandByPoint(Nn),Nn.addVectors(Dn.max,In.max),Dn.expandByPoint(Nn)):(Dn.expandByPoint(In.min),Dn.expandByPoint(In.max))}Dn.getCenter(n);for(var o=0,s=0,l=e.count;s<l;s++)Nn.fromBufferAttribute(e,s),o=Math.max(o,n.distanceToSquared(Nn));if(t)for(var u=0,c=t.length;u<c;u++)for(var h=t[u],d=this.morphTargetsRelative,p=0,f=h.count;p<f;p++)Nn.fromBufferAttribute(h,p),d&&(Pn.fromBufferAttribute(e,p),Nn.add(Pn)),o=Math.max(o,n.distanceToSquared(Nn));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}},{key:"computeTangents",value:function(){var e=this.index,t=this.attributes;if(null!==e&&void 0!==t.position&&void 0!==t.normal&&void 0!==t.uv){var n=e.array,r=t.position.array,i=t.normal.array,a=t.uv.array,o=r.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new an(new Float32Array(4*o),4));for(var s=this.getAttribute("tangent").array,l=[],u=[],c=0;c<o;c++)l[c]=new tt,u[c]=new tt;var h=new tt,d=new tt,p=new tt,f=new Ht,v=new Ht,m=new Ht,g=new tt,y=new tt,x=this.groups;0===x.length&&(x=[{start:0,count:n.length}]);for(var _=0,b=x.length;_<b;++_)for(var M=x[_],w=M.start,S=w,E=w+M.count;S<E;S+=3)O(n[S+0],n[S+1],n[S+2]);for(var T=new tt,A=new tt,k=new tt,L=new tt,R=0,C=x.length;R<C;++R)for(var P=x[R],D=P.start,I=D,N=D+P.count;I<N;I+=3)z(n[I+0]),z(n[I+1]),z(n[I+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function O(e,t,n){h.fromArray(r,3*e),d.fromArray(r,3*t),p.fromArray(r,3*n),f.fromArray(a,2*e),v.fromArray(a,2*t),m.fromArray(a,2*n),d.sub(h),p.sub(h),v.sub(f),m.sub(f);var i=1/(v.x*m.y-m.x*v.y);isFinite(i)&&(g.copy(d).multiplyScalar(m.y).addScaledVector(p,-v.y).multiplyScalar(i),y.copy(p).multiplyScalar(v.x).addScaledVector(d,-m.x).multiplyScalar(i),l[e].add(g),l[t].add(g),l[n].add(g),u[e].add(y),u[t].add(y),u[n].add(y))}function z(e){k.fromArray(i,3*e),L.copy(k);var t=l[e];T.copy(t),T.sub(k.multiplyScalar(k.dot(t))).normalize(),A.crossVectors(L,t);var n=A.dot(u[e])<0?-1:1;s[4*e]=T.x,s[4*e+1]=T.y,s[4*e+2]=T.z,s[4*e+3]=n}}},{key:"computeVertexNormals",value:function(){var e=this.index,t=this.getAttribute("position");if(void 0!==t){var n=this.getAttribute("normal");if(void 0===n)n=new an(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(var r=0,i=n.count;r<i;r++)n.setXYZ(r,0,0,0);var a=new tt,o=new tt,s=new tt,l=new tt,u=new tt,c=new tt,h=new tt,d=new tt;if(e)for(var p=0,f=e.count;p<f;p+=3){var v=e.getX(p+0),m=e.getX(p+1),g=e.getX(p+2);a.fromBufferAttribute(t,v),o.fromBufferAttribute(t,m),s.fromBufferAttribute(t,g),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),l.fromBufferAttribute(n,v),u.fromBufferAttribute(n,m),c.fromBufferAttribute(n,g),l.add(h),u.add(h),c.add(h),n.setXYZ(v,l.x,l.y,l.z),n.setXYZ(m,u.x,u.y,u.z),n.setXYZ(g,c.x,c.y,c.z)}else for(var y=0,x=t.count;y<x;y+=3)a.fromBufferAttribute(t,y+0),o.fromBufferAttribute(t,y+1),s.fromBufferAttribute(t,y+2),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),n.setXYZ(y+0,h.x,h.y,h.z),n.setXYZ(y+1,h.x,h.y,h.z),n.setXYZ(y+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}},{key:"merge",value: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=a.itemSize*t,l=Math.min(o.length,i.length-s),u=0,c=s;u<l;u++,c++)i[c]=o[u];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)}},{key:"normalizeNormals",value:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Nn.fromBufferAttribute(e,t),Nn.normalize(),e.setXYZ(t,Nn.x,Nn.y,Nn.z)}},{key:"toNonIndexed",value:function(){function e(e,t){for(var n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0,l=0,u=t.length;l<u;l++){o=e.isInterleavedBufferAttribute?t[l]*e.data.stride+e.offset:t[l]*r;for(var c=0;c<r;c++)a[s++]=n[o++]}return new an(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var t=new n,r=this.index.array,i=this.attributes;for(var a in i){var o=e(i[a],r);t.setAttribute(a,o)}var s=this.morphAttributes;for(var l in s){for(var u=[],c=s[l],h=0,d=c.length;h<d;h++){var p=e(c[h],r);u.push(p)}t.morphAttributes[l]=u}t.morphTargetsRelative=this.morphTargetsRelative;for(var f=this.groups,v=0,m=f.length;v<m;v++){var g=f[v];t.addGroup(g.start,g.count,g.materialIndex)}return t}},{key:"toJSON",value: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;null!==r&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var a in i){var o=i[a];e.data.attributes[a]=o.toJSON(e.data)}var s={},l=!1;for(var u in this.morphAttributes){for(var c=this.morphAttributes[u],h=[],d=0,p=c.length;d<p;d++){var f=c[d];h.push(f.toJSON(e.data))}h.length>0&&(s[u]=h,l=!0)}l&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var v=this.groups;v.length>0&&(e.data.groups=JSON.parse(JSON.stringify(v)));var m=this.boundingSphere;return null!==m&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone(t));var r=e.attributes;for(var i in r){var a=r[i];this.setAttribute(i,a.clone(t))}var o=e.morphAttributes;for(var s in o){for(var l=[],u=o[s],c=0,h=u.length;c<h;c++)l.push(u[c].clone(t));this.morphAttributes[s]=l}this.morphTargetsRelative=e.morphTargetsRelative;for(var d=e.groups,p=0,f=d.length;p<f;p++){var v=d[p];this.addGroup(v.start,v.count,v.materialIndex)}var m=e.boundingBox;null!==m&&(this.boundingBox=m.clone());var g=e.boundingSphere;return null!==g&&(this.boundingSphere=g.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,void 0!==e.parameters&&(this.parameters=Object.assign({},e.parameters)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(Wt);On.prototype.isBufferGeometry=!0;var zn=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;_(this,n),(e=t.call(this)).type="BoxGeometry",e.parameters={width:r,height:i,depth:a,widthSegments:o,heightSegments:s,depthSegments:l};var u=m(e);o=Math.floor(o),s=Math.floor(s),l=Math.floor(l);var c=[],h=[],d=[],p=[],f=0,v=0;function g(e,t,n,r,i,a,o,s,l,m,g){for(var y=a/l,x=o/m,_=a/2,b=o/2,M=s/2,w=l+1,S=m+1,E=0,T=0,A=new tt,k=0;k<S;k++)for(var L=k*x-b,R=0;R<w;R++){var C=R*y-_;A[e]=C*r,A[t]=L*i,A[n]=M,h.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=s>0?1:-1,d.push(A.x,A.y,A.z),p.push(R/l),p.push(1-k/m),E+=1}for(var P=0;P<m;P++)for(var D=0;D<l;D++){var I=f+D+w*P,N=f+D+w*(P+1),O=f+(D+1)+w*(P+1),z=f+(D+1)+w*P;c.push(I,N,z),c.push(N,O,z),T+=6}u.addGroup(v,T,g),v+=T,f+=E}return g("z","y","x",-1,-1,a,i,r,l,s,0),g("z","y","x",1,-1,a,i,-r,l,s,1),g("x","z","y",1,1,r,a,i,o,l,2),g("x","z","y",1,-1,r,a,-i,o,l,3),g("x","y","z",1,-1,r,i,a,o,s,4),g("x","y","z",-1,-1,r,i,-a,o,s,5),e.setIndex(c),e.setAttribute("position",new ln(h,3)),e.setAttribute("normal",new ln(d,3)),e.setAttribute("uv",new ln(p,2)),e}return M(n,null,[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}]),n}(On),Bn=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;_(this,n),(e=t.call(this)).type="PlaneGeometry",e.parameters={width:r,height:i,widthSegments:a,heightSegments:o};for(var s=r/2,l=i/2,u=Math.floor(a),c=Math.floor(o),h=u+1,d=c+1,p=r/u,f=i/c,v=[],m=[],g=[],y=[],x=0;x<d;x++)for(var b=x*f-l,M=0;M<h;M++){var w=M*p-s;m.push(w,-b,0),g.push(0,0,1),y.push(M/u),y.push(1-x/c)}for(var S=0;S<c;S++)for(var E=0;E<u;E++){var T=E+h*S,A=E+h*(S+1),k=E+1+h*(S+1),L=E+1+h*S;v.push(T,A,L),v.push(A,k,L)}return e.setIndex(v),e.setAttribute("position",new ln(m,3)),e.setAttribute("normal",new ln(g,3)),e.setAttribute("uv",new ln(y,2)),e}return M(n,null,[{key:"fromJSON",value:function(e){return new n(e.width,e.height,e.widthSegments,e.heightSegments)}}]),n}(On),Un=0,Hn=function(e){d(n,e);var t=f(n);function n(){var e;return _(this,n),e=t.call(this),Object.defineProperty(m(e),"id",{value:Un++}),e.uuid=qe(),e.name="",e.type="Material",e.fog=!0,e.blending=1,e.side=S,e.vertexColors=!1,e.opacity=1,e.transparent=!1,e.blendSrc=204,e.blendDst=205,e.blendEquation=A,e.blendSrcAlpha=null,e.blendDstAlpha=null,e.blendEquationAlpha=null,e.depthFunc=3,e.depthTest=!0,e.depthWrite=!0,e.stencilWriteMask=255,e.stencilFunc=519,e.stencilRef=0,e.stencilFuncMask=255,e.stencilFail=Oe,e.stencilZFail=Oe,e.stencilZPass=Oe,e.stencilWrite=!1,e.clippingPlanes=null,e.clipIntersection=!1,e.clipShadows=!1,e.shadowSide=null,e.colorWrite=!0,e.precision=null,e.polygonOffset=!1,e.polygonOffsetFactor=0,e.polygonOffsetUnits=0,e.dithering=!1,e.alphaToCoverage=!1,e.premultipliedAlpha=!1,e.visible=!0,e.toneMapped=!0,e.userData={},e.version=0,e._alphaTest=0,e}return M(n,[{key:"alphaTest",get:function(){return this._alphaTest},set:function(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}},{key:"onBuild",value:function(){}},{key:"onBeforeRender",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value: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.")}}},{key:"toJSON",value: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),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),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.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),this.side!==S&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!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.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!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}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}}]),n}(Wt);function Fn(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||i.isQuaternion)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}return t}function Gn(e){for(var t={},n=0;n<e.length;n++){var r=Fn(e[n]);for(var i in r)t[i]=r[i]}return t}Hn.prototype.isMaterial=!0,Hn.fromType=function(){return null};var Vn={clone:Fn,merge:Gn},Wn=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="ShaderMaterial",r.defines={},r.uniforms={},r.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",r.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",r.linewidth=1,r.wireframe=!1,r.wireframeLinewidth=1,r.fog=!1,r.lights=!1,r.clipping=!1,r.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},r.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},r.index0AttributeName=void 0,r.uniformsNeedUpdate=!1,r.glslVersion=null,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),r.setValues(e)),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Fn(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.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}},{key:"toJSON",value:function(e){var t=c(g(n.prototype),"toJSON",this).call(this,e);for(var r in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){var i=this.uniforms[r].value;i&&i.isTexture?t.uniforms[r]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[r]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[r]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[r]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[r]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[r]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[r]={type:"m4",value:i.toArray()}:t.uniforms[r]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t}}]),n}(Hn);Wn.prototype.isShaderMaterial=!0;var jn=new tt,qn=new tt,Xn=new tt,Yn=new tt,Jn=new tt,Zn=new tt,Kn=new tt,Qn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new tt,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new tt(0,0,-1);_(this,e),this.origin=t,this.direction=n}return M(e,[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"copy",value:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}},{key:"at",value:function(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}},{key:"lookAt",value:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this}},{key:"recast",value:function(e){return this.origin.copy(this.at(e,jn)),this}},{key:"closestPointToPoint",value:function(e,t){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)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=jn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(jn.copy(this.direction).multiplyScalar(t).add(this.origin),jn.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,r){qn.copy(e).add(t).multiplyScalar(.5),Xn.copy(t).sub(e).normalize(),Yn.copy(this.origin).sub(qn);var i,a,o,s,l=.5*e.distanceTo(t),u=-this.direction.dot(Xn),c=Yn.dot(this.direction),h=-Yn.dot(Xn),d=Yn.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(a=u*c-h,s=l*p,(i=u*h-c)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(i*=f)*(i+u*(a*=f)+2*c)+a*(u*i+a+2*h)+d}else a=l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;else a=-l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-u*l+c)))*i+(a=i>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(i=Math.max(0,-(u*l+c)))*i+(a=i>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=u>0?-l:l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(Xn).multiplyScalar(a).add(qn),o}},{key:"intersectSphere",value:function(e,t){jn.subVectors(e.center,this.origin);var n=jn.dot(this.direction),r=jn.dot(jn)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)}},{key:"intersectsSphere",value:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}},{key:"distanceToPlane",value: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}},{key:"intersectPlane",value:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}},{key:"intersectsPlane",value:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}},{key:"intersectBox",value:function(e,t){var n,r,i,a,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,r=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,r=(e.min.x-h.x)*l),u>=0?(i=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(i=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),c>=0?(o=(e.min.z-h.z)*c,s=(e.max.z-h.z)*c):(o=(e.max.z-h.z)*c,s=(e.min.z-h.z)*c),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)))}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,jn)}},{key:"intersectTriangle",value:function(e,t,n,r,i){Jn.subVectors(t,e),Zn.subVectors(n,e),Kn.crossVectors(Jn,Zn);var a,o=this.direction.dot(Kn);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Yn.subVectors(this.origin,e);var s=a*this.direction.dot(Zn.crossVectors(Yn,Zn));if(s<0)return null;var l=a*this.direction.dot(Jn.cross(Yn));if(l<0)return null;if(s+l>o)return null;var u=-a*Yn.dot(Kn);return u<0?null:this.at(u/o,i)}},{key:"applyMatrix4",value:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}},{key:"equals",value:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),$n=new tt,er=new tt,tr=new tt,nr=new tt,rr=new tt,ir=new tt,ar=new tt,or=new tt,sr=new tt,lr=new tt,ur=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new tt,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new tt,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new tt;_(this,e),this.a=t,this.b=n,this.c=r}return M(e,[{key:"set",value:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}},{key:"setFromPointsAndIndices",value:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}},{key:"setFromAttributeAndIndices",value:function(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}},{key:"getArea",value:function(){return $n.subVectors(this.c,this.b),er.subVectors(this.a,this.b),.5*$n.cross(er).length()}},{key:"getMidpoint",value:function(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}},{key:"getNormal",value:function(t){return e.getNormal(this.a,this.b,this.c,t)}},{key:"getPlane",value:function(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}},{key:"getBarycoord",value:function(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}},{key:"getUV",value:function(t,n,r,i,a){return e.getUV(t,this.a,this.b,this.c,n,r,i,a)}},{key:"containsPoint",value:function(t){return e.containsPoint(t,this.a,this.b,this.c)}},{key:"isFrontFacing",value:function(t){return e.isFrontFacing(this.a,this.b,this.c,t)}},{key:"intersectsBox",value:function(e){return e.intersectsTriangle(this)}},{key:"closestPointToPoint",value:function(e,t){var n,r,i=this.a,a=this.b,o=this.c;rr.subVectors(a,i),ir.subVectors(o,i),or.subVectors(e,i);var s=rr.dot(or),l=ir.dot(or);if(s<=0&&l<=0)return t.copy(i);sr.subVectors(e,a);var u=rr.dot(sr),c=ir.dot(sr);if(u>=0&&c<=u)return t.copy(a);var h=s*c-u*l;if(h<=0&&s>=0&&u<=0)return n=s/(s-u),t.copy(i).addScaledVector(rr,n);lr.subVectors(e,o);var d=rr.dot(lr),p=ir.dot(lr);if(p>=0&&d<=p)return t.copy(o);var f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),t.copy(i).addScaledVector(ir,r);var v=u*p-d*c;if(v<=0&&c-u>=0&&d-p>=0)return ar.subVectors(o,a),r=(c-u)/(c-u+(d-p)),t.copy(a).addScaledVector(ar,r);var m=1/(v+f+h);return n=f*m,r=h*m,t.copy(i).addScaledVector(rr,n).addScaledVector(ir,r)}},{key:"equals",value:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}],[{key:"getNormal",value:function(e,t,n,r){r.subVectors(n,t),$n.subVectors(e,t),r.cross($n);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,r,i){$n.subVectors(r,t),er.subVectors(n,t),tr.subVectors(e,t);var a=$n.dot($n),o=$n.dot(er),s=$n.dot(tr),l=er.dot(er),u=er.dot(tr),c=a*l-o*o;if(0===c)return i.set(-2,-1,-1);var h=1/c,d=(l*s-o*u)*h,p=(a*u-o*s)*h;return i.set(1-d-p,p,d)}},{key:"containsPoint",value:function(e,t,n,r){return this.getBarycoord(e,t,n,r,nr),nr.x>=0&&nr.y>=0&&nr.x+nr.y<=1}},{key:"getUV",value:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,nr),s.set(0,0),s.addScaledVector(i,nr.x),s.addScaledVector(a,nr.y),s.addScaledVector(o,nr.z),s}},{key:"isFrontFacing",value:function(e,t,n,r){return $n.subVectors(n,t),er.subVectors(e,t),$n.cross(er).dot(r)<0}}]),e}(),cr=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="MeshBasicMaterial",r.color=new tn(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=0,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).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}}]),n}(Hn);cr.prototype.isMeshBasicMaterial=!0;var hr=new Pt,dr=new Qn,pr=new wt,fr=new tt,vr=new tt,mr=new tt,gr=new tt,yr=new tt,xr=new tt,_r=new tt,br=new tt,Mr=new tt,wr=new Ht,Sr=new Ht,Er=new Ht,Tr=new tt,Ar=new tt,kr=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new On,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new cr;return _(this,n),(e=t.call(this)).type="Mesh",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}},{key:"updateMorphTargets",value:function(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(n.length>0){var r=t[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=e.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}},{key:"raycast",value:function(e,t){var n,r=this.geometry,i=this.material,a=this.matrixWorld;if(void 0!==i&&(null===r.boundingSphere&&r.computeBoundingSphere(),pr.copy(r.boundingSphere),pr.applyMatrix4(a),!1!==e.ray.intersectsSphere(pr)&&(hr.copy(a).invert(),dr.copy(e.ray).applyMatrix4(hr),null===r.boundingBox||!1!==dr.intersectsBox(r.boundingBox))))if(r.isBufferGeometry){var o=r.index,s=r.attributes.position,l=r.morphAttributes.position,u=r.morphTargetsRelative,c=r.attributes.uv,h=r.attributes.uv2,d=r.groups,p=r.drawRange;if(null!==o)if(Array.isArray(i))for(var f=0,v=d.length;f<v;f++)for(var m=d[f],g=i[m.materialIndex],y=Math.max(m.start,p.start),x=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));y<x;y+=3){var _=o.getX(y),b=o.getX(y+1),M=o.getX(y+2);(n=Lr(this,g,e,dr,s,l,u,c,h,_,b,M))&&(n.faceIndex=Math.floor(y/3),n.face.materialIndex=m.materialIndex,t.push(n))}else for(var w=Math.max(0,p.start),S=Math.min(o.count,p.start+p.count);w<S;w+=3){var E=o.getX(w),T=o.getX(w+1),A=o.getX(w+2);(n=Lr(this,i,e,dr,s,l,u,c,h,E,T,A))&&(n.faceIndex=Math.floor(w/3),t.push(n))}else if(void 0!==s)if(Array.isArray(i))for(var k=0,L=d.length;k<L;k++)for(var R=d[k],C=i[R.materialIndex],P=Math.max(R.start,p.start),D=Math.min(s.count,Math.min(R.start+R.count,p.start+p.count));P<D;P+=3){(n=Lr(this,C,e,dr,s,l,u,c,h,P,P+1,P+2))&&(n.faceIndex=Math.floor(P/3),n.face.materialIndex=R.materialIndex,t.push(n))}else for(var I=Math.max(0,p.start),N=Math.min(s.count,p.start+p.count);I<N;I+=3){(n=Lr(this,i,e,dr,s,l,u,c,h,I,I+1,I+2))&&(n.faceIndex=Math.floor(I/3),t.push(n))}}else r.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}]),n}(Tn);function Lr(e,t,n,r,i,a,o,s,l,u,c,h){fr.fromBufferAttribute(i,u),vr.fromBufferAttribute(i,c),mr.fromBufferAttribute(i,h);var d=e.morphTargetInfluences;if(a&&d){_r.set(0,0,0),br.set(0,0,0),Mr.set(0,0,0);for(var p=0,f=a.length;p<f;p++){var v=d[p],m=a[p];0!==v&&(gr.fromBufferAttribute(m,u),yr.fromBufferAttribute(m,c),xr.fromBufferAttribute(m,h),o?(_r.addScaledVector(gr,v),br.addScaledVector(yr,v),Mr.addScaledVector(xr,v)):(_r.addScaledVector(gr.sub(fr),v),br.addScaledVector(yr.sub(vr),v),Mr.addScaledVector(xr.sub(mr),v)))}fr.add(_r),vr.add(br),mr.add(Mr)}e.isSkinnedMesh&&(e.boneTransform(u,fr),e.boneTransform(c,vr),e.boneTransform(h,mr));var g=function(e,t,n,r,i,a,o,s){if(null===(t.side===E?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side!==T,s)))return null;Ar.copy(s),Ar.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(Ar);return l<n.near||l>n.far?null:{distance:l,point:Ar.clone(),object:e}}(e,t,n,r,fr,vr,mr,Tr);if(g){s&&(wr.fromBufferAttribute(s,u),Sr.fromBufferAttribute(s,c),Er.fromBufferAttribute(s,h),g.uv=ur.getUV(Tr,fr,vr,mr,wr,Sr,Er,new Ht)),l&&(wr.fromBufferAttribute(l,u),Sr.fromBufferAttribute(l,c),Er.fromBufferAttribute(l,h),g.uv2=ur.getUV(Tr,fr,vr,mr,wr,Sr,Er,new Ht));var y={a:u,b:c,c:h,normal:new tt,materialIndex:0};ur.getNormal(fr,vr,mr,y.normal),g.face=y}return g}kr.prototype.isMesh=!0;var Rr,Cr={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 USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\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_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",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, float faceDirection ) {\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 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\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:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.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}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#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 * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_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}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\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}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",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 <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",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}",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 <alphatest_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}",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}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",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\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_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 <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\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 <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\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 <morphcolor_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}",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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_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_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\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}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\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}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_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#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\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 <normal_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 <morphcolor_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 <normal_vertex>\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}",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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\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\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\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 <normal_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 <morphcolor_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 <normal_vertex>\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#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#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 <normal_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 <morphcolor_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 <normal_vertex>\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}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_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\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 <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\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}",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 <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_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\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\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 <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},Pr={common:{diffuse:{value:new tn(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new St},uv2Transform:{value:new St},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},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 Ht(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 tn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new tn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new St}},sprite:{diffuse:{value:new tn(16777215)},opacity:{value:1},center:{value:new Ht(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new St}}},Dr={basic:{uniforms:Gn([Pr.common,Pr.specularmap,Pr.envmap,Pr.aomap,Pr.lightmap,Pr.fog]),vertexShader:Cr.meshbasic_vert,fragmentShader:Cr.meshbasic_frag},lambert:{uniforms:Gn([Pr.common,Pr.specularmap,Pr.envmap,Pr.aomap,Pr.lightmap,Pr.emissivemap,Pr.fog,Pr.lights,{emissive:{value:new tn(0)}}]),vertexShader:Cr.meshlambert_vert,fragmentShader:Cr.meshlambert_frag},phong:{uniforms:Gn([Pr.common,Pr.specularmap,Pr.envmap,Pr.aomap,Pr.lightmap,Pr.emissivemap,Pr.bumpmap,Pr.normalmap,Pr.displacementmap,Pr.fog,Pr.lights,{emissive:{value:new tn(0)},specular:{value:new tn(1118481)},shininess:{value:30}}]),vertexShader:Cr.meshphong_vert,fragmentShader:Cr.meshphong_frag},standard:{uniforms:Gn([Pr.common,Pr.envmap,Pr.aomap,Pr.lightmap,Pr.emissivemap,Pr.bumpmap,Pr.normalmap,Pr.displacementmap,Pr.roughnessmap,Pr.metalnessmap,Pr.fog,Pr.lights,{emissive:{value:new tn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Cr.meshphysical_vert,fragmentShader:Cr.meshphysical_frag},toon:{uniforms:Gn([Pr.common,Pr.aomap,Pr.lightmap,Pr.emissivemap,Pr.bumpmap,Pr.normalmap,Pr.displacementmap,Pr.gradientmap,Pr.fog,Pr.lights,{emissive:{value:new tn(0)}}]),vertexShader:Cr.meshtoon_vert,fragmentShader:Cr.meshtoon_frag},matcap:{uniforms:Gn([Pr.common,Pr.bumpmap,Pr.normalmap,Pr.displacementmap,Pr.fog,{matcap:{value:null}}]),vertexShader:Cr.meshmatcap_vert,fragmentShader:Cr.meshmatcap_frag},points:{uniforms:Gn([Pr.points,Pr.fog]),vertexShader:Cr.points_vert,fragmentShader:Cr.points_frag},dashed:{uniforms:Gn([Pr.common,Pr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Cr.linedashed_vert,fragmentShader:Cr.linedashed_frag},depth:{uniforms:Gn([Pr.common,Pr.displacementmap]),vertexShader:Cr.depth_vert,fragmentShader:Cr.depth_frag},normal:{uniforms:Gn([Pr.common,Pr.bumpmap,Pr.normalmap,Pr.displacementmap,{opacity:{value:1}}]),vertexShader:Cr.meshnormal_vert,fragmentShader:Cr.meshnormal_frag},sprite:{uniforms:Gn([Pr.sprite,Pr.fog]),vertexShader:Cr.sprite_vert,fragmentShader:Cr.sprite_frag},background:{uniforms:{uvTransform:{value:new St},t2D:{value:null}},vertexShader:Cr.background_vert,fragmentShader:Cr.background_frag},cube:{uniforms:Gn([Pr.envmap,{opacity:{value:1}}]),vertexShader:Cr.cube_vert,fragmentShader:Cr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Cr.equirect_vert,fragmentShader:Cr.equirect_frag},distanceRGBA:{uniforms:Gn([Pr.common,Pr.displacementmap,{referencePosition:{value:new tt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Cr.distanceRGBA_vert,fragmentShader:Cr.distanceRGBA_frag},shadow:{uniforms:Gn([Pr.lights,Pr.fog,{color:{value:new tn(0)},opacity:{value:1}}]),vertexShader:Cr.shadow_vert,fragmentShader:Cr.shadow_frag}};function Ir(e,t,n,r,i,a){var o,s,l=new tn(0),u=!0===i?0:1,c=null,h=0,d=null;function p(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,a)}return{getClearColor:function(){return l},setClearColor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;l.set(e),p(l,u=t)},getClearAlpha:function(){return u},setClearAlpha:function(e){p(l,u=e)},render:function(n,i){var a=!1,f=!0===i.isScene?i.background:null;f&&f.isTexture&&(f=t.get(f));var v=e.xr,m=v.getSession&&v.getSession();m&&"additive"===m.environmentBlendMode&&(f=null),null===f?p(l,u):f&&f.isColor&&(p(f,1),a=!0),(e.autoClear||a)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||f.mapping===R)?(void 0===s&&((s=new kr(new zn(1,1,1),new Wn({name:"BackgroundCubeMaterial",uniforms:Fn(Dr.cube.uniforms),vertexShader:Dr.cube.vertexShader,fragmentShader:Dr.cube.fragmentShader,side:E,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(s)),s.material.uniforms.envMap.value=f,s.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,c===f&&h===f.version&&d===e.toneMapping||(s.material.needsUpdate=!0,c=f,h=f.version,d=e.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null)):f&&f.isTexture&&(void 0===o&&((o=new kr(new Bn(2,2),new Wn({name:"BackgroundMaterial",uniforms:Fn(Dr.background.uniforms),vertexShader:Dr.background.vertexShader,fragmentShader:Dr.background.fragmentShader,side:S,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),c===f&&h===f.version&&d===e.toneMapping||(o.material.needsUpdate=!0,c=f,h=f.version,d=e.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null))}}}function Nr(e,t,n,r){var i=e.getParameter(34921),a=r.isWebGL2?null:t.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,s={},l=p(null),u=l,c=!1;function h(t){return r.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function d(t){return r.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function p(e){for(var t=[],n=[],r=[],a=0;a<i;a++)t[a]=0,n[a]=0,r[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:r,object:e,attributes:{},index:null}}function f(){for(var e=u.newAttributes,t=0,n=e.length;t<n;t++)e[t]=0}function v(e){m(e,0)}function m(n,i){var a=u.newAttributes,o=u.enabledAttributes,s=u.attributeDivisors;(a[n]=1,0===o[n]&&(e.enableVertexAttribArray(n),o[n]=1),s[n]!==i)&&((r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i)}function g(){for(var t=u.newAttributes,n=u.enabledAttributes,r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function y(t,n,i,a,o,s){!0!==r.isWebGL2||5124!==i&&5125!==i?e.vertexAttribPointer(t,n,i,a,o,s):e.vertexAttribIPointer(t,n,i,o,s)}function x(){_(),c=!0,u!==l&&h((u=l).object)}function _(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(i,l,d,x,_){var b=!1;if(o){var M=function(t,n,i){var o=!0===i.wireframe,l=s[t.id];void 0===l&&(l={},s[t.id]=l);var u=l[n.id];void 0===u&&(u={},l[n.id]=u);var c=u[o];void 0===c&&(c=p(r.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),u[o]=c);return c}(x,d,l);u!==M&&h((u=M).object),b=function(e,t){var n=u.attributes,r=e.attributes,i=0;for(var a in r){var o=n[a],s=r[a];if(void 0===o)return!0;if(o.attribute!==s)return!0;if(o.data!==s.data)return!0;i++}return u.attributesNum!==i||u.index!==t}(x,_),b&&function(e,t){var n={},r=e.attributes,i=0;for(var a in r){var o=r[a],s={};s.attribute=o,o.data&&(s.data=o.data),n[a]=s,i++}u.attributes=n,u.attributesNum=i,u.index=t}(x,_)}else{var w=!0===l.wireframe;u.geometry===x.id&&u.program===d.id&&u.wireframe===w||(u.geometry=x.id,u.program=d.id,u.wireframe=w,b=!0)}!0===i.isInstancedMesh&&(b=!0),null!==_&&n.update(_,34963),(b||c)&&(c=!1,function(i,a,o,s){if(!1===r.isWebGL2&&(i.isInstancedMesh||s.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;f();var l=s.attributes,u=o.getAttributes(),c=a.defaultAttributeValues;for(var h in u){var d=u[h];if(d.location>=0){var p=l[h];if(void 0===p&&("instanceMatrix"===h&&i.instanceMatrix&&(p=i.instanceMatrix),"instanceColor"===h&&i.instanceColor&&(p=i.instanceColor)),void 0!==p){var x=p.normalized,_=p.itemSize,b=n.get(p);if(void 0===b)continue;var M=b.buffer,w=b.type,S=b.bytesPerElement;if(p.isInterleavedBufferAttribute){var E=p.data,T=E.stride,A=p.offset;if(E.isInstancedInterleavedBuffer){for(var k=0;k<d.locationSize;k++)m(d.location+k,E.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=E.meshPerAttribute*E.count)}else for(var L=0;L<d.locationSize;L++)v(d.location+L);e.bindBuffer(34962,M);for(var R=0;R<d.locationSize;R++)y(d.location+R,_/d.locationSize,w,x,T*S,(A+_/d.locationSize*R)*S)}else{if(p.isInstancedBufferAttribute){for(var C=0;C<d.locationSize;C++)m(d.location+C,p.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=p.meshPerAttribute*p.count)}else for(var P=0;P<d.locationSize;P++)v(d.location+P);e.bindBuffer(34962,M);for(var D=0;D<d.locationSize;D++)y(d.location+D,_/d.locationSize,w,x,_*S,_/d.locationSize*D*S)}}else if(void 0!==c){var I=c[h];if(void 0!==I)switch(I.length){case 2:e.vertexAttrib2fv(d.location,I);break;case 3:e.vertexAttrib3fv(d.location,I);break;case 4:e.vertexAttrib4fv(d.location,I);break;default:e.vertexAttrib1fv(d.location,I)}}}}g()}(i,l,d,x),null!==_&&e.bindBuffer(34963,n.get(_).buffer))},reset:x,resetDefaultState:_,dispose:function(){for(var e in x(),s){var t=s[e];for(var n in t){var r=t[n];for(var i in r)d(r[i].object),delete r[i];delete t[n]}delete s[e]}},releaseStatesOfGeometry:function(e){if(void 0!==s[e.id]){var t=s[e.id];for(var n in t){var r=t[n];for(var i in r)d(r[i].object),delete r[i];delete t[n]}delete s[e.id]}},releaseStatesOfProgram:function(e){for(var t in s){var n=s[t];if(void 0!==n[e.id]){var r=n[e.id];for(var i in r)d(r[i].object),delete r[i];delete n[e.id]}}},initAttributes:f,enableAttribute:v,disableUnusedAttributes:g}}function Or(e,t,n,r){var i,a=r.isWebGL2;this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=function(r,o,s){if(0!==s){var l,u;if(a)l=e,u="drawArraysInstanced";else if(u="drawArraysInstancedANGLE",null===(l=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](i,r,o,s),n.update(o,i,s)}}}function zr(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&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,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 l=a||t.has("WEBGL_draw_buffers"),u=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),f=e.getParameter(34921),v=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),y=h>0,x=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){var n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:v,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:a?e.getParameter(36183):0}}function Br(e){var t=this,n=null,r=0,i=!1,a=!1,o=new kt,s=new St,l={value:null,needsUpdate:!1};function u(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function c(e,n,r,i){var a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==i||null===u){var c=r+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===u||u.length<c)&&(u=new Float32Array(c));for(var d=0,p=r;d!==a;++d,p+=4)o.copy(e[d]).applyMatrix4(h,s),o.normal.toArray(u,p),u[p+3]=o.constant}l.value=u,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,u}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,a){var o=0!==e.length||t||0!==r||i;return i=t,n=c(e,a,0),r=e.length,o},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1,u()},this.setState=function(t,o,s){var h=t.clippingPlanes,d=t.clipIntersection,p=t.clipShadows,f=e.get(t);if(!i||null===h||0===h.length||a&&!p)a?c(null):u();else{var v=a?0:r,m=4*v,g=f.clippingState||null;l.value=g,g=c(h,o,m,s);for(var y=0;y!==m;++y)g[y]=n[y];f.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=v}}}Dr.physical={uniforms:Gn([Dr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ht(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new tn(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Ht},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new tn(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new tn(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Cr.meshphysical_vert,fragmentShader:Cr.meshphysical_frag};var Ur=function(){function e(){_(this,e)}return M(e,null,[{key:"getDataURL",value:function(e){if(/^data:/i.test(e.src))return e.src;if("undefined"==typeof HTMLCanvasElement)return e.src;var t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===Rr&&(Rr=kn("canvas")),Rr.width=e.width,Rr.height=e.height;var n=Rr.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Rr}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}},{key:"sRGBToLinear",value:function(e,t){if(e._encoding=t.encoding,wx){wx.window.wxTextureProxyCanvas||(wx.window.wxTextureProxyCanvas=wx.createOffscreenCanvas({type:"webgl"}));var n=wx.window.wxTextureProxyCanvas;n.width=e.width,n.height=e.height;var r=n.getContext("webgl"),i=new Hr(n,r),a=i.sRGBToLinear(e);return i.dispose(),{data:a.data,width:e.width,height:e.height}}if("undefined"==typeof wx&&("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)){var o;(o="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):kn("canvas")).width=e.width,o.height=e.height;var s=o.getContext("2d");s.drawImage(e,0,0,e.width,e.height);for(var l=s.getImageData(0,0,e.width,e.height),u=l.data,c=0;c<u.length;c++)u[c]=255*jt(u[c]/255);return s.putImageData(l,0,0),o}if(e.data){for(var h=e.data.slice(0),d=0;d<h.length;d++)h instanceof Uint8Array||h instanceof Uint8ClampedArray?h[d]=Math.floor(255*jt(h[d]/255)):h[d]=jt(h[d]);return{data:h,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}]),e}(),Hr=function(){function e(t,n){_(this,e),this.canvas=t,this.gl=n||t.getContext("webgl"),this.init(this.gl)}return M(e,[{key:"init",value:function(e){if(e){var t=this._createShader(e,35633,"\n\t\t\tattribute vec4 a_position;\n\t\t\tattribute vec2 a_texcoord;\n\t\t\tvarying vec2 v_texcoord;\n\t\t\tvoid main () {\n\t\t\t\tgl_Position = a_position;\n\t\t\t\tv_texcoord = a_texcoord;\n\t\t\t}\n\t\t\t"),n=this._createShader(e,35632,"\n\t\t\tprecision mediump float;\n\t\t\tvarying vec2 v_texcoord;\n\t\t\tuniform sampler2D u_texture;\n\t\t\tuniform int u_transform;\n\t\t\tvec4 sRGBToLinear( in vec4 value ) {\n\t\t\t\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\t\t\t}\n\t\t\tvoid main () {\n\t\t\t\tvec4 fragColor;\n\t\t\t\tif(u_transform == 0){\n\t\t\t\t\tfragColor = texture2D(u_texture, v_texcoord);\n\t\t\t\t}else{\n\t\t\t\t\tfragColor = sRGBToLinear(texture2D(u_texture, v_texcoord));\n\t\t\t\t}\n\t\t\t\tgl_FragColor = fragColor;\n\t\t\t}\n\t\t\t"),r=this.program=this._createProgram(e,t,n);e.useProgram(r),this.positionLocation=e.getAttribLocation(r,"a_position"),this.texcoordLocation=e.getAttribLocation(r,"a_texcoord"),this.textureLocation=e.getUniformLocation(r,"u_texture"),this.transformLocation=e.getUniformLocation(r,"u_transform"),this.positionBuffer=e.createBuffer(),e.bindBuffer(34962,this.positionBuffer);e.bufferData(34962,new Float32Array([-1,1,-1,-1,1,-1,1,-1,1,1,-1,1]),35044),this.texcoordBuffer=e.createBuffer(),e.bindBuffer(34962,this.texcoordBuffer);e.bufferData(34962,new Float32Array([0,1,0,0,1,0,1,0,1,1,0,1]),35044),e.bindBuffer(34962,this.positionBuffer),e.vertexAttribPointer(this.positionLocation,2,5126,!1,0,0),e.enableVertexAttribArray(this.positionLocation),e.bindBuffer(34962,this.texcoordBuffer),e.vertexAttribPointer(this.texcoordLocation,2,5126,!1,0,0),e.enableVertexAttribArray(this.texcoordLocation),e.viewport(0,0,e.canvas.width,e.canvas.height)}}},{key:"_createShader",value:function(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,35713))return r;e.deleteShader(r)}},{key:"_createProgram",value:function(e,t,n){var r=e.createProgram();if(e.attachShader(r,t),e.attachShader(r,n),e.linkProgram(r),e.getProgramParameter(r,35714))return r;e.deleteProgram(r)}},{key:"sRGBToLinear",value:function(e){var t=this.gl,n=this.tex=t.createTexture(),r=e.width,i=e.height;if(t.bindTexture(3553,n),t.texParameteri(3553,10242,33071),t.texParameteri(3553,10243,33071),t.texParameteri(3553,10241,9729),t.texParameteri(3553,10240,9729),e.data&&e.data.buffer){var a=e.data.buffer;t.texImage2D(3553,0,6408,r,i,0,6408,5121,new Uint8Array(a))}else t.texImage2D(3553,0,6408,6408,5121,e);3001===e._encoding?t.uniform1i(this.transformLocation,1):t.uniform1i(this.transformLocation,0),t.uniform1i(this.textureLocation,0),t.clear(16384),t.drawArrays(4,0,6);var o=new Uint8Array(r*i*4);return t.readPixels(0,0,r,i,6408,5121,o),{data:o,width:r,height:i}}},{key:"clear",value:function(){this.gl.clear(16384)}},{key:"dispose",value:function(){var e=this.gl,t=this.tex,n=this.positionBuffer,r=this.texcoordBuffer;e.deleteTexture(t),e.deleteBuffer(n),e.deleteBuffer(r)}}]),e}(),Fr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;_(this,e),this.uuid=qe(),this.data=t,this.version=0}return M(e,[{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"toJSON",value:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];var n={uuid:this.uuid,url:""},r=this.data;if(null!==r){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)r[a].isDataTexture?i.push(Gr(r[a].image)):i.push(Gr(r[a]))}else i=Gr(r);n.url=i}return t||(e.images[this.uuid]=n),n}}]),e}();function Gr(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?Ur.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}Fr.prototype.isSource=!0;var Vr=0,Wr=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.DEFAULT_IMAGE,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.DEFAULT_MAPPING,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:P,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:P,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:z,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:U,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:q,c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:H,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:1,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:Ce;return _(this,n),e=t.call(this),Object.defineProperty(m(e),"id",{value:Vr++}),e.uuid=qe(),e.name="",e.source=new Fr(r),e.mipmaps=[],e.mapping=i,e.wrapS=a,e.wrapT=o,e.magFilter=s,e.minFilter=l,e.anisotropy=h,e.format=u,e.internalFormat=null,e.type=c,e.offset=new Ht(0,0),e.repeat=new Ht(1,1),e.center=new Ht(0,0),e.rotation=0,e.matrixAutoUpdate=!0,e.matrix=new St,e.generateMipmaps=!0,e.premultiplyAlpha=!1,e.flipY=!0,e.unpackAlignment=4,e.encoding=d,e.userData={},e.version=0,e.onUpdate=null,e.isRenderTargetTexture=!1,e.needsPMREMUpdate=!1,e}return M(n,[{key:"image",get:function(){return this.source.data},set:function(e){this.source.data=e}},{key:"updateMatrix",value:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}},{key:"toJSON",value: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,image:this.source.toJSON(e).uuid,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};return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case C:e.x=e.x-Math.floor(e.x);break;case P:e.x=e.x<0?0:1;break;case D: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 C:e.y=e.y-Math.floor(e.y);break;case P:e.y=e.y<0?0:1;break;case D: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}},{key:"needsUpdate",set:function(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}}]),n}(Wt);Wr.DEFAULT_IMAGE=null,Wr.DEFAULT_MAPPING=300,Wr.prototype.isTexture=!0;var jr=function(e){d(n,e);var t=f(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_(this,n),(i=t.call(this)).width=e,i.height=r,i.depth=1,i.scissor=new Ft(0,0,e,r),i.scissorTest=!1,i.viewport=new Ft(0,0,e,r);var o={width:e,height:r,depth:1};return i.texture=new Wr(o,a.mapping,a.wrapS,a.wrapT,a.magFilter,a.minFilter,a.format,a.type,a.anisotropy,a.encoding),i.texture.isRenderTargetTexture=!0,i.texture.flipY=!1,i.texture.generateMipmaps=void 0!==a.generateMipmaps&&a.generateMipmaps,i.texture.internalFormat=void 0!==a.internalFormat?a.internalFormat:null,i.texture.minFilter=void 0!==a.minFilter?a.minFilter:z,i.depthBuffer=void 0===a.depthBuffer||a.depthBuffer,i.stencilBuffer=void 0!==a.stencilBuffer&&a.stencilBuffer,i.depthTexture=void 0!==a.depthTexture?a.depthTexture:null,i.samples=void 0!==a.samples?a.samples:0,i}return M(n,[{key:"setSize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.width===e&&this.height===t&&this.depth===n||(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0,this.texture.image=Object.assign({},e.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(Wt);jr.prototype.isWebGLRenderTarget=!0;var qr=function(e){d(n,e);var t=f(n);function n(){var e;return _(this,n),(e=t.call(this)).type="Camera",e.matrixWorldInverse=new Pt,e.projectionMatrix=new Pt,e.projectionMatrixInverse=new Pt,e}return M(n,[{key:"copy",value:function(e,t){return c(g(n.prototype),"copy",this).call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}},{key:"getWorldDirection",value:function(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}},{key:"updateMatrixWorld",value:function(e){c(g(n.prototype),"updateMatrixWorld",this).call(this,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(e,t){c(g(n.prototype),"updateWorldMatrix",this).call(this,e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(Tn);qr.prototype.isCamera=!0;var Xr=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;return _(this,n),(e=t.call(this)).type="PerspectiveCamera",e.fov=r,e.zoom=1,e.near=a,e.far=o,e.focus=10,e.aspect=i,e.view=null,e.filmGauge=35,e.filmOffset=0,e.updateProjectionMatrix(),e}return M(n,[{key:"copy",value:function(e,t){return c(g(n.prototype),"copy",this).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}},{key:"setFocalLength",value:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*je*Math.atan(t),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var e=Math.tan(.5*We*this.fov);return.5*this.getFilmHeight()/e}},{key:"getEffectiveFOV",value:function(){return 2*je*Math.atan(Math.tan(.5*We*this.fov)/this.zoom)}},{key:"getFilmWidth",value:function(){return this.filmGauge*Math.min(this.aspect,1)}},{key:"getFilmHeight",value:function(){return this.filmGauge/Math.max(this.aspect,1)}},{key:"setViewOffset",value: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()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var e=this.near,t=e*Math.tan(.5*We*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 l=this.filmOffset;0!==l&&(i+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=c(g(n.prototype),"toJSON",this).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}}]),n}(qr);Xr.prototype.isPerspectiveCamera=!0;var Yr=90,Jr=function(e){d(n,e);var t=f(n);function n(e,r,i){var a;if(_(this,n),(a=t.call(this)).type="CubeCamera",!0!==i.isWebGLCubeRenderTarget)return console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter."),v(a);a.renderTarget=i;var o=new Xr(Yr,1,e,r);o.layers=a.layers,o.up.set(0,-1,0),o.lookAt(new tt(1,0,0)),a.add(o);var s=new Xr(Yr,1,e,r);s.layers=a.layers,s.up.set(0,-1,0),s.lookAt(new tt(-1,0,0)),a.add(s);var l=new Xr(Yr,1,e,r);l.layers=a.layers,l.up.set(0,0,1),l.lookAt(new tt(0,1,0)),a.add(l);var u=new Xr(Yr,1,e,r);u.layers=a.layers,u.up.set(0,0,-1),u.lookAt(new tt(0,-1,0)),a.add(u);var c=new Xr(Yr,1,e,r);c.layers=a.layers,c.up.set(0,-1,0),c.lookAt(new tt(0,0,1)),a.add(c);var h=new Xr(Yr,1,e,r);return h.layers=a.layers,h.up.set(0,-1,0),h.lookAt(new tt(0,0,-1)),a.add(h),a}return M(n,[{key:"update",value:function(e,t){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=s(this.children,6),i=r[0],a=r[1],o=r[2],l=r[3],u=r[4],c=r[5],h=e.getRenderTarget(),d=e.outputEncoding,p=e.toneMapping,f=e.xr.enabled;e.outputEncoding=Ce,e.toneMapping=0,e.xr.enabled=!1;var v=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,a),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,l),e.setRenderTarget(n,4),e.render(t,u),n.texture.generateMipmaps=v,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(h),e.outputEncoding=d,e.toneMapping=p,e.xr.enabled=f,n.texture.needsPMREMUpdate=!0}}]),n}(Tn),Zr=function(e){d(n,e);var t=f(n);function n(e,r,i,a,o,s,l,u,c,h){var d;return _(this,n),e=void 0!==e?e:[],r=void 0!==r?r:k,(d=t.call(this,e,r,i,a,o,s,l,u,c,h)).flipY=!1,d}return M(n,[{key:"images",get:function(){return this.image},set:function(e){this.image=e}}]),n}(Wr);Zr.prototype.isCubeTexture=!0;var Kr=function(e){d(n,e);var t=f(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_(this,n);var a={width:e,height:e,depth:1},o=[a,a,a,a,a,a];return(r=t.call(this,e,e,i)).texture=new Zr(o,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),r.texture.isRenderTargetTexture=!0,r.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,r.texture.minFilter=void 0!==i.minFilter?i.minFilter:z,r}return M(n,[{key:"fromEquirectangularTexture",value:function(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var n={tEquirect:{value:null}},r="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",i="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new zn(5,5,5),o=new Wn({name:"CubemapFromEquirect",uniforms:Fn(n),vertexShader:r,fragmentShader:i,side:E,blending:0});o.uniforms.tEquirect.value=t;var s=new kr(a,o),l=t.minFilter;return t.minFilter===U&&(t.minFilter=z),new Jr(1,10,this).update(e,s),t.minFilter=l,s.geometry.dispose(),s.material.dispose(),this}},{key:"clear",value:function(e,t,n,r){for(var i=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(i)}}]),n}(jr);function Qr(e){var t=new WeakMap;function n(e,t){return 303===t?e.mapping=k:304===t&&(e.mapping=L),e}function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){var a=i.mapping;if(303===a||304===a){if(t.has(i))return n(t.get(i).texture,i.mapping);var o=i.image;if(o&&o.height>0){var s=new Kr(o.height/2);return s.fromEquirectangularTexture(e,i),t.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}return i},dispose:function(){t=new WeakMap}}}Kr.prototype.isWebGLCubeRenderTarget=!0;var $r=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;return _(this,n),(e=t.call(this)).type="OrthographicCamera",e.zoom=1,e.view=null,e.left=r,e.right=i,e.top=a,e.bottom=o,e.near=s,e.far=l,e.updateProjectionMatrix(),e}return M(n,[{key:"copy",value:function(e,t){return c(g(n.prototype),"copy",this).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}},{key:"setViewOffset",value: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()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value: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 l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(i+=l*this.view.offsetX)+l*this.view.width,s=(o-=u*this.view.offsetY)-u*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(e){var t=c(g(n.prototype),"toJSON",this).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}}]),n}(qr);$r.prototype.isOrthographicCamera=!0;var ei=[.125,.215,.35,.446,.526,.582],ti=20,ni=new $r,ri=new tn,ii=null,ai=(1+Math.sqrt(5))/2,oi=1/ai,si=[new tt(1,1,1),new tt(-1,1,1),new tt(1,1,-1),new tt(-1,1,-1),new tt(0,ai,oi),new tt(0,ai,-oi),new tt(oi,0,ai),new tt(-oi,0,ai),new tt(ai,oi,0),new tt(-ai,oi,0)],li=function(){function e(t){_(this,e),this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}return M(e,[{key:"fromScene",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;ii=this._renderer.getRenderTarget(),this._setSize(256);var i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i}},{key:"fromEquirectangular",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"fromCubemap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=di(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=hi(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}},{key:"_cleanup",value:function(e){this._renderer.setRenderTarget(ii),e.scissorTest=!1,ci(e,0,0,e.width,e.height)}},{key:"_fromTexture",value:function(e,t){e.mapping===k||e.mapping===L?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ii=this._renderer.getRenderTarget();var n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}},{key:"_allocateTargets",value:function(){var e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize-32,n={magFilter:z,minFilter:z,generateMipmaps:!1,type:W,format:q,encoding:Ce,depthBuffer:!1},r=ui(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=ui(e,t,n);var i=this._lodMax,a=function(e){for(var t=[],n=[],r=[],i=e,a=e-4+1+ei.length,o=0;o<a;o++){var s=Math.pow(2,i);n.push(s);var l=1/s;o>e-4?l=ei[o-e+4-1]:0===o&&(l=0),r.push(l);for(var u=1/(s-1),c=-u/2,h=1+u/2,d=[c,c,h,c,h,h,c,c,h,h,c,h],p=6,f=6,v=3,m=2,g=1,y=new Float32Array(v*f*p),x=new Float32Array(m*f*p),_=new Float32Array(g*f*p),b=0;b<p;b++){var M=b%3*2/3-1,w=b>2?0:-1,S=[M,w,0,M+2/3,w,0,M+2/3,w+1,0,M,w,0,M+2/3,w+1,0,M,w+1,0];y.set(S,v*f*b),x.set(d,m*f*b);var E=[b,b,b,b,b,b];_.set(E,g*f*b)}var T=new On;T.setAttribute("position",new an(y,v)),T.setAttribute("uv",new an(x,m)),T.setAttribute("faceIndex",new an(_,g)),t.push(T),i>4&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}(i);this._sizeLods=a.sizeLods,this._lodPlanes=a.lodPlanes,this._sigmas=a.sigmas,this._blurMaterial=function(e,t,n){var r=new Float32Array(ti),i=new tt(0,1,0);return new Wn({name:"SphericalGaussianBlur",defines:{n:ti,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,e,t)}return r}},{key:"_compileMaterial",value:function(e){var t=new kr(this._lodPlanes[0],e);this._renderer.compile(t,ni)}},{key:"_sceneToCubeUV",value:function(e,t,n,r){var i=new Xr(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,u=s.toneMapping;s.getClearColor(ri),s.toneMapping=0,s.autoClear=!1;var c=new cr({name:"PMREM.Background",side:E,depthWrite:!1,depthTest:!1}),h=new kr(new zn,c),d=!1,p=e.background;p?p.isColor&&(c.color.copy(p),e.background=null,d=!0):(c.color.copy(ri),d=!0);for(var f=0;f<6;f++){var v=f%3;0===v?(i.up.set(0,a[f],0),i.lookAt(o[f],0,0)):1===v?(i.up.set(0,0,a[f]),i.lookAt(0,o[f],0)):(i.up.set(0,a[f],0),i.lookAt(0,0,o[f]));var m=this._cubeSize;ci(r,v*m,f>2?m:0,m,m),s.setRenderTarget(r),d&&s.render(h,i),s.render(e,i)}h.geometry.dispose(),h.material.dispose(),s.toneMapping=u,s.autoClear=l,e.background=p}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer,r=e.mapping===k||e.mapping===L;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=di()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=hi());var i=r?this._cubemapMaterial:this._equirectMaterial,a=new kr(this._lodPlanes[0],i);i.uniforms.envMap.value=e;var o=this._cubeSize;ci(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(a,ni)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<this._lodPlanes.length;r++){var i=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=si[(r-1)%si.length];this._blur(e,r-1,r,i,a)}t.autoClear=n}},{key:"_blur",value:function(e,t,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",i),this._halfBlur(a,e,n,n,r,"longitudinal",i)}},{key:"_halfBlur",value:function(e,t,n,r,i,a,o){var s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var u=new kr(this._lodPlanes[r],l),c=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(i)?Math.PI/(2*h):2*Math.PI/39,p=i/d,f=isFinite(i)?1+Math.floor(3*p):ti;f>ti&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(f," samples when the maximum is set to ").concat(ti));for(var v=[],m=0,g=0;g<ti;++g){var y=g/p,x=Math.exp(-y*y/2);v.push(x),0===g?m+=x:g<f&&(m+=2*x)}for(var _=0;_<v.length;_++)v[_]=v[_]/m;c.envMap.value=e.texture,c.samples.value=f,c.weights.value=v,c.latitudinal.value="latitudinal"===a,o&&(c.poleAxis.value=o);var b=this._lodMax;c.dTheta.value=d,c.mipInt.value=b-n;var M=this._sizeLods[r];ci(t,3*M*(r>b-4?r-b+4:0),4*(this._cubeSize-M),3*M,2*M),s.setRenderTarget(t),s.render(u,ni)}}]),e}();function ui(e,t,n){var r=new jr(e,t,n);return r.texture.mapping=R,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function ci(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function hi(){return new Wn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function di(){return new Wn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function pi(e){var t=new WeakMap,n=null;function r(e){var n=e.target;n.removeEventListener("dispose",r);var i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){var a=i.mapping,o=303===a||304===a,s=a===k||a===L;if(o||s){if(i.isRenderTargetTexture&&!0===i.needsPMREMUpdate){i.needsPMREMUpdate=!1;var l=t.get(i);return null===n&&(n=new li(e)),l=o?n.fromEquirectangular(i,l):n.fromCubemap(i,l),t.set(i,l),l.texture}if(t.has(i))return t.get(i).texture;var u=i.image;if(o&&u&&u.height>0||s&&u&&function(e){for(var t=0,n=6,r=0;r<n;r++)void 0!==e[r]&&t++;return t===n}(u)){null===n&&(n=new li(e));var c=o?n.fromEquirectangular(i):n.fromCubemap(i);return t.set(i,c),i.addEventListener("dispose",r),c.texture}return null}}return i},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function fi(e){var t={};function n(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 t[n]=r,r}return{has:function(e){return null!==n(e)},init:function(e){e.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(e){var t=n(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function vi(e,t,n,r){var i={},a=new WeakMap;function o(e){var s=e.target;for(var l in null!==s.index&&t.remove(s.index),s.attributes)t.remove(s.attributes[l]);s.removeEventListener("dispose",o),delete i[s.id];var u=a.get(s);u&&(t.remove(u),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){var n=[],r=e.index,i=e.attributes.position,o=0;if(null!==r){var s=r.array;o=r.version;for(var l=0,u=s.length;l<u;l+=3){var c=s[l+0],h=s[l+1],d=s[l+2];n.push(c,h,h,d,d,c)}}else{var p=i.array;o=i.version;for(var f=0,v=p.length/3-1;f<v;f+=3){var m=f+0,g=f+1,y=f+2;n.push(m,g,g,y,y,m)}}var x=new(An(n)?sn:on)(n,1);x.version=o;var _=a.get(e);_&&t.remove(_),a.set(e,x)}return{get:function(e,t){return!0===i[t.id]||(t.addEventListener("dispose",o),i[t.id]=!0,n.memory.geometries++),t},update:function(e){var n=e.attributes;for(var r in n)t.update(n[r],34962);var i=e.morphAttributes;for(var a in i)for(var o=i[a],s=0,l=o.length;s<l;s++)t.update(o[s],34962)},getWireframeAttribute:function(e){var t=a.get(e);if(t){var n=e.index;null!==n&&t.version<n.version&&s(e)}else s(e);return a.get(e)}}}function mi(e,t,n,r){var i,a,o,s=r.isWebGL2;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,1)},this.renderInstances=function(r,l,u){if(0!==u){var c,h;if(s)c=e,h="drawElementsInstanced";else if(h="drawElementsInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[h](i,l,a,r*o,u),n.update(l,i,u)}}}function gi(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(t.calls++,n){case 4:t.triangles+=r*(e/3);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)}}}}var yi=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return _(this,n),(e=t.call(this,null)).image={data:r,width:i,height:a,depth:o},e.magFilter=I,e.minFilter=I,e.wrapR=P,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return M(n)}(Wr);function xi(e,t){return e[0]-t[0]}function _i(e,t){return Math.abs(t[1])-Math.abs(e[1])}function bi(e,t){var n=1,r=t.isInterleavedBufferAttribute?t.data.array:t.array;r instanceof Int8Array?n=127:r instanceof Int16Array?n=32767:r instanceof Int32Array?n=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",r),e.divideScalar(n)}function Mi(e,t,n){for(var r={},i=new Float32Array(8),a=new WeakMap,o=new Ft,s=[],l=0;l<8;l++)s[l]=[l,0];return{update:function(l,u,c,h){var d=l.morphTargetInfluences;if(!0===t.isWebGL2){var p=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,f=void 0!==p?p.length:0,v=a.get(u);if(void 0===v||v.count!==f){void 0!==v&&v.texture.dispose();var m=void 0!==u.morphAttributes.position,g=void 0!==u.morphAttributes.normal,y=void 0!==u.morphAttributes.color,x=u.morphAttributes.position||[],_=u.morphAttributes.normal||[],b=u.morphAttributes.color||[],M=0;!0===m&&(M=1),!0===g&&(M=2),!0===y&&(M=3);var w=u.attributes.position.count*M,S=1;w>t.maxTextureSize&&(S=Math.ceil(w/t.maxTextureSize),w=t.maxTextureSize);var E=new Float32Array(w*S*4*f),T=new yi(E,w,S,f);T.type=V,T.needsUpdate=!0;for(var A=4*M,k=0;k<f;k++)for(var L=x[k],R=_[k],C=b[k],P=w*S*4*k,D=0;D<L.count;D++){var I=D*A;!0===m&&(o.fromBufferAttribute(L,D),!0===L.normalized&&bi(o,L),E[P+I+0]=o.x,E[P+I+1]=o.y,E[P+I+2]=o.z,E[P+I+3]=0),!0===g&&(o.fromBufferAttribute(R,D),!0===R.normalized&&bi(o,R),E[P+I+4]=o.x,E[P+I+5]=o.y,E[P+I+6]=o.z,E[P+I+7]=0),!0===y&&(o.fromBufferAttribute(C,D),!0===C.normalized&&bi(o,C),E[P+I+8]=o.x,E[P+I+9]=o.y,E[P+I+10]=o.z,E[P+I+11]=4===C.itemSize?o.w:1)}v={count:f,texture:T,size:new Ht(w,S)},a.set(u,v),u.addEventListener("dispose",(function e(){T.dispose(),a.delete(u),u.removeEventListener("dispose",e)}))}for(var N=0,O=0;O<d.length;O++)N+=d[O];var z=u.morphTargetsRelative?1:1-N;h.getUniforms().setValue(e,"morphTargetBaseInfluence",z),h.getUniforms().setValue(e,"morphTargetInfluences",d),h.getUniforms().setValue(e,"morphTargetsTexture",v.texture,n),h.getUniforms().setValue(e,"morphTargetsTextureSize",v.size)}else{var B=void 0===d?0:d.length,U=r[u.id];if(void 0===U||U.length!==B){U=[];for(var H=0;H<B;H++)U[H]=[H,0];r[u.id]=U}for(var F=0;F<B;F++){var G=U[F];G[0]=F,G[1]=d[F]}U.sort(_i);for(var W=0;W<8;W++)W<B&&U[W][1]?(s[W][0]=U[W][0],s[W][1]=U[W][1]):(s[W][0]=Number.MAX_SAFE_INTEGER,s[W][1]=0);s.sort(xi);for(var j=u.morphAttributes.position,q=u.morphAttributes.normal,X=0,Y=0;Y<8;Y++){var J=s[Y],Z=J[0],K=J[1];Z!==Number.MAX_SAFE_INTEGER&&K?(j&&u.getAttribute("morphTarget"+Y)!==j[Z]&&u.setAttribute("morphTarget"+Y,j[Z]),q&&u.getAttribute("morphNormal"+Y)!==q[Z]&&u.setAttribute("morphNormal"+Y,q[Z]),i[Y]=K,X+=K):(j&&!0===u.hasAttribute("morphTarget"+Y)&&u.deleteAttribute("morphTarget"+Y),q&&!0===u.hasAttribute("morphNormal"+Y)&&u.deleteAttribute("morphNormal"+Y),i[Y]=0)}var Q=u.morphTargetsRelative?1:1-X;h.getUniforms().setValue(e,"morphTargetBaseInfluence",Q),h.getUniforms().setValue(e,"morphTargetInfluences",i)}}}}function wi(e,t,n,r){var i=new WeakMap;function a(e){var t=e.target;t.removeEventListener("dispose",a),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(e){var o=r.render.frame,s=e.geometry,l=t.get(e,s);return i.get(l)!==o&&(t.update(l),i.set(l,o)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",a)&&e.addEventListener("dispose",a),n.update(e.instanceMatrix,34962),null!==e.instanceColor&&n.update(e.instanceColor,34962)),l},dispose:function(){i=new WeakMap}}}yi.prototype.isDataArrayTexture=!0;var Si=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return _(this,n),(e=t.call(this,null)).image={data:r,width:i,height:a,depth:o},e.magFilter=I,e.minFilter=I,e.wrapR=P,e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return M(n)}(Wr);Si.prototype.isData3DTexture=!0;var Ei=new Wr,Ti=new yi,Ai=new Si,ki=new Zr,Li=[],Ri=[],Ci=new Float32Array(16),Pi=new Float32Array(9),Di=new Float32Array(4);function Ii(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=Li[i];if(void 0===a&&(a=new Float32Array(i),Li[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 Ni(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 Oi(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function zi(e,t){var n=Ri[t];void 0===n&&(n=new Int32Array(t),Ri[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function Bi(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ui(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(Ni(n,t))return;e.uniform2fv(this.addr,t),Oi(n,t)}}function Hi(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(Ni(n,t))return;e.uniform3fv(this.addr,t),Oi(n,t)}}function Fi(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(Ni(n,t))return;e.uniform4fv(this.addr,t),Oi(n,t)}}function Gi(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(Ni(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Oi(n,t)}else{if(Ni(n,r))return;Di.set(r),e.uniformMatrix2fv(this.addr,!1,Di),Oi(n,r)}}function Vi(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(Ni(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Oi(n,t)}else{if(Ni(n,r))return;Pi.set(r),e.uniformMatrix3fv(this.addr,!1,Pi),Oi(n,r)}}function Wi(e,t){var n=this.cache,r=t.elements;if(void 0===r){if(Ni(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Oi(n,t)}else{if(Ni(n,r))return;Ci.set(r),e.uniformMatrix4fv(this.addr,!1,Ci),Oi(n,r)}}function ji(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function qi(e,t){var n=this.cache;Ni(n,t)||(e.uniform2iv(this.addr,t),Oi(n,t))}function Xi(e,t){var n=this.cache;Ni(n,t)||(e.uniform3iv(this.addr,t),Oi(n,t))}function Yi(e,t){var n=this.cache;Ni(n,t)||(e.uniform4iv(this.addr,t),Oi(n,t))}function Ji(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Zi(e,t){var n=this.cache;Ni(n,t)||(e.uniform2uiv(this.addr,t),Oi(n,t))}function Ki(e,t){var n=this.cache;Ni(n,t)||(e.uniform3uiv(this.addr,t),Oi(n,t))}function Qi(e,t){var n=this.cache;Ni(n,t)||(e.uniform4uiv(this.addr,t),Oi(n,t))}function $i(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2D(t||Ei,i)}function ea(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||Ai,i)}function ta(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||ki,i)}function na(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||Ti,i)}function ra(e,t){e.uniform1fv(this.addr,t)}function ia(e,t){var n=Ii(t,this.size,2);e.uniform2fv(this.addr,n)}function aa(e,t){var n=Ii(t,this.size,3);e.uniform3fv(this.addr,n)}function oa(e,t){var n=Ii(t,this.size,4);e.uniform4fv(this.addr,n)}function sa(e,t){var n=Ii(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function la(e,t){var n=Ii(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function ua(e,t){var n=Ii(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function ca(e,t){e.uniform1iv(this.addr,t)}function ha(e,t){e.uniform2iv(this.addr,t)}function da(e,t){e.uniform3iv(this.addr,t)}function pa(e,t){e.uniform4iv(this.addr,t)}function fa(e,t){e.uniform1uiv(this.addr,t)}function va(e,t){e.uniform2uiv(this.addr,t)}function ma(e,t){e.uniform3uiv(this.addr,t)}function ga(e,t){e.uniform4uiv(this.addr,t)}function ya(e,t,n){var r=t.length,i=zi(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.setTexture2D(t[a]||Ei,i[a])}function xa(e,t,n){var r=t.length,i=zi(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.setTexture3D(t[a]||Ai,i[a])}function _a(e,t,n){var r=t.length,i=zi(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.setTextureCube(t[a]||ki,i[a])}function ba(e,t,n){var r=t.length,i=zi(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.setTexture2DArray(t[a]||Ti,i[a])}function Ma(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return Bi;case 35664:return Ui;case 35665:return Hi;case 35666:return Fi;case 35674:return Gi;case 35675:return Vi;case 35676:return Wi;case 5124:case 35670:return ji;case 35667:case 35671:return qi;case 35668:case 35672:return Xi;case 35669:case 35673:return Yi;case 5125:return Ji;case 36294:return Zi;case 36295:return Ki;case 36296:return Qi;case 35678:case 36198:case 36298:case 36306:case 35682:return $i;case 35679:case 36299:case 36307:return ea;case 35680:case 36300:case 36308:case 36293:return ta;case 36289:case 36303:case 36311:case 36292:return na}}(t.type)}function wa(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return ra;case 35664:return ia;case 35665:return aa;case 35666:return oa;case 35674:return sa;case 35675:return la;case 35676:return ua;case 5124:case 35670:return ca;case 35667:case 35671:return ha;case 35668:case 35672:return da;case 35669:case 35673:return pa;case 5125:return fa;case 36294:return va;case 36295:return ma;case 36296:return ga;case 35678:case 36198:case 36298:case 36306:case 35682:return ya;case 35679:case 36299:case 36307:return xa;case 35680:case 36300:case 36308:case 36293:return _a;case 36289:case 36303:case 36311:case 36292:return ba}}(t.type)}function Sa(e){this.id=e,this.seq=[],this.map={}}wa.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Oi(t,e)},Sa.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 Ea=/(\w+)(\])?(\[|\.)?/g;function Ta(e,t){e.seq.push(t),e.map[t.id]=t}function Aa(e,t,n){var r=e.name,i=r.length;for(Ea.lastIndex=0;;){var a=Ea.exec(r),o=Ea.lastIndex,s=a[1],l="]"===a[2],u=a[3];if(l&&(s|=0),void 0===u||"["===u&&o+2===i){Ta(n,void 0===u?new Ma(s,e,t):new wa(s,e,t));break}var c=n.map[s];void 0===c&&Ta(n,c=new Sa(s)),n=c}}function ka(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),r=0;r<n;++r){var i=e.getActiveUniform(t,r);Aa(i,e.getUniformLocation(t,i.name),this)}}function La(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}ka.prototype.setValue=function(e,t,n,r){var i=this.map[t];void 0!==i&&i.setValue(e,n,r)},ka.prototype.setOptional=function(e,t,n){var r=t[n];void 0!==r&&this.setValue(e,n,r)},ka.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)}},ka.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 Ra=0;function Ca(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&""===i)return"";var a=parseInt(/ERROR: 0:(\d+)/.exec(i)[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+function(e,t){for(var n=e.split("\n"),r=[],i=Math.max(t-6,0),a=Math.min(t+6,n.length),o=i;o<a;o++)r.push(o+1+": "+n[o]);return r.join("\n")}(e.getShaderSource(t),a)}function Pa(e,t){var n=function(e){switch(e){case Ce:return["Linear","( value )"];case Pe:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Da(e,t){var n;switch(t){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Ia(e){return""!==e}function Na(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Oa(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var za=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ba(e){return e.replace(za,Ua)}function Ua(e,t){var n=Cr[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Ba(n)}var Ha=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Fa=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Ga(e){return e.replace(Fa,Wa).replace(Ha,Va)}function Va(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Wa(e,t,n,r)}function Wa(e,t,n,r){for(var i="",a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function ja(e){var t="precision "+e.precision+" float;\nprecision "+e.precision+" int;";return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function qa(e,t,n,r){var i,a,o=e.getContext(),s=n.defines,l=n.vertexShader,u=n.fragmentShader,c=function(e){var t="SHADOWMAP_TYPE_BASIC";return 1===e.shadowMapType?t="SHADOWMAP_TYPE_PCF":2===e.shadowMapType?t="SHADOWMAP_TYPE_PCF_SOFT":3===e.shadowMapType&&(t="SHADOWMAP_TYPE_VSM"),t}(n),h=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case k:case L:t="ENVMAP_TYPE_CUBE";break;case R:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),d=function(e){var t="ENVMAP_MODE_REFLECTION";e.envMap&&e.envMapMode===L&&(t="ENVMAP_MODE_REFRACTION");return t}(n),p=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(n),f=function(e){var t=e.envMapCubeUVHeight;if(null===t)return null;var n=Math.log2(t/32+1)+3,r=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}(n),v=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ia).join("\n")}(n),m=function(e){var t=[];for(var n in e){var r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(s),g=o.createProgram(),y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((i=[m].filter(Ia).join("\n")).length>0&&(i+="\n"),(a=[v,m].filter(Ia).join("\n")).length>0&&(a+="\n")):(i=[ja(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Ia).join("\n"),a=[v,ja(n),"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+d:"",n.envMap?"#define "+p:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+c:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Cr.tonemapping_pars_fragment:"",0!==n.toneMapping?Da("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Cr.encodings_pars_fragment,Pa("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ia).join("\n")),l=Oa(l=Na(l=Ba(l),n),n),u=Oa(u=Na(u=Ba(u),n),n),l=Ga(l),u=Ga(u),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",i=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===Ue?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Ue?"":"#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"+a);var x,_,b=y+a+u,M=La(o,35633,y+i+l),w=La(o,35632,b);if(o.attachShader(g,M),o.attachShader(g,w),void 0!==n.index0AttributeName?o.bindAttribLocation(g,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(g,0,"position"),o.linkProgram(g),e.debug.checkShaderErrors){var S=o.getProgramInfoLog(g).trim(),E=o.getShaderInfoLog(M).trim(),T=o.getShaderInfoLog(w).trim(),A=!0,C=!0;if(!1===o.getProgramParameter(g,35714)){A=!1;var P=Ca(o,M,"vertex"),D=Ca(o,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(g,35715)+"\n\nProgram Info Log: "+S+"\n"+P+"\n"+D)}else""!==S?console.warn("THREE.WebGLProgram: Program Info Log:",S):""!==E&&""!==T||(C=!1);C&&(this.diagnostics={runnable:A,programLog:S,vertexShader:{log:E,prefix:i},fragmentShader:{log:T,prefix:a}})}return o.deleteShader(M),o.deleteShader(w),this.getUniforms=function(){return void 0===x&&(x=new ka(o,g)),x},this.getAttributes=function(){return void 0===_&&(_=function(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i),o=a.name,s=1;35674===a.type&&(s=2),35675===a.type&&(s=3),35676===a.type&&(s=4),n[o]={type:a.type,location:e.getAttribLocation(t,o),locationSize:s}}return n}(o,g)),_},this.destroy=function(){r.releaseStatesOfProgram(this),o.deleteProgram(g),this.program=void 0},this.name=n.shaderName,this.id=Ra++,this.cacheKey=t,this.usedTimes=1,this.program=g,this.vertexShader=M,this.fragmentShader=w,this}var Xa=0,Ya=function(){function e(){_(this,e),this.shaderCache=new Map,this.materialCache=new Map}return M(e,[{key:"update",value:function(e){var t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(i)&&(a.add(i),i.usedTimes++),this}},{key:"remove",value:function(e){var t,n=o(this.materialCache.get(e));try{for(n.s();!(t=n.n()).done;){var r=t.value;r.usedTimes--,0===r.usedTimes&&this.shaderCache.delete(r.code)}}catch(e){n.e(e)}finally{n.f()}return this.materialCache.delete(e),this}},{key:"getVertexShaderID",value:function(e){return this._getShaderStage(e.vertexShader).id}},{key:"getFragmentShaderID",value:function(e){return this._getShaderStage(e.fragmentShader).id}},{key:"dispose",value:function(){this.shaderCache.clear(),this.materialCache.clear()}},{key:"_getShaderCacheForMaterial",value:function(e){var t=this.materialCache;return!1===t.has(e)&&t.set(e,new Set),t.get(e)}},{key:"_getShaderStage",value:function(e){var t=this.shaderCache;if(!1===t.has(e)){var n=new Ja(e);t.set(e,n)}return t.get(e)}}]),e}(),Ja=M((function e(t){_(this,e),this.id=Xa++,this.code=t,this.usedTimes=0}));function Za(e,t,n,r,i,a,o){var s=new dn,l=new Ya,u=[],c=i.isWebGL2,h=i.logarithmicDepthBuffer,d=i.floatVertexTextures,p=i.maxVertexUniforms,f=i.vertexTextures,v=i.precision,m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};return{getParameters:function(a,s,u,g,y){var x=g.fog,_=y.geometry,b=a.isMeshStandardMaterial?g.environment:null,M=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),w=M&&M.mapping===R?M.image.height:null,S=m[a.type],A=y.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(d)return 1024;var n=p,r=Math.floor((n-20)/4),i=Math.min(r,t.length);return i<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+i+"."),0):i}(y):0;null!==a.precision&&(v=i.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",v,"instead.");var k,L,C,P,D=_.morphAttributes.position||_.morphAttributes.normal||_.morphAttributes.color,I=void 0!==D?D.length:0,N=0;if(void 0!==_.morphAttributes.position&&(N=1),void 0!==_.morphAttributes.normal&&(N=2),void 0!==_.morphAttributes.color&&(N=3),S){var O=Dr[S];k=O.vertexShader,L=O.fragmentShader}else k=a.vertexShader,L=a.fragmentShader,l.update(a),C=l.getVertexShaderID(a),P=l.getFragmentShaderID(a);var z=e.getRenderTarget(),B=a.alphaTest>0,U=a.clearcoat>0;return{isWebGL2:c,shaderID:S,shaderName:a.type,vertexShader:k,fragmentShader:L,defines:a.defines,customVertexShaderID:C,customFragmentShaderID:P,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:v,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:f,outputEncoding:null===z?e.outputEncoding:!0===z.isXRRenderTarget?z.texture.encoding:Ce,map:!!a.map,matcap:!!a.matcap,envMap:!!M,envMapMode:M&&M.mapping,envMapCubeUVHeight:w,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:1===a.normalMapType,tangentSpaceNormalMap:a.normalMapType===De,decodeVideoTexture:!!a.map&&!0===a.map.isVideoTexture&&a.map.encoding===Pe,clearcoat:U,clearcoatMap:U&&!!a.clearcoatMap,clearcoatRoughnessMap:U&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:U&&!!a.clearcoatNormalMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularColorMap:!!a.specularColorMap,opaque:!1===a.transparent&&1===a.blending,alphaMap:!!a.alphaMap,alphaTest:B,gradientMap:!!a.gradientMap,sheen:a.sheen>0,sheenColorMap:!!a.sheenColorMap,sheenRoughnessMap:!!a.sheenRoughnessMap,transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!_.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!_.attributes.color&&4===_.attributes.color.itemSize,vertexUvs:!!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatMap||a.clearcoatRoughnessMap||a.clearcoatNormalMap||a.displacementMap||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheenColorMap||a.sheenRoughnessMap),uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheen>0||a.sheenColorMap||a.sheenRoughnessMap||!a.displacementMap),fog:!!x,useFog:a.fog,fogExp2:x&&x.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===y.isSkinnedMesh&&A>0,maxBones:A,useVertexTexture:d,morphTargets:void 0!==_.morphAttributes.position,morphNormals:void 0!==_.morphAttributes.normal,morphColors:void 0!==_.morphAttributes.color,morphTargetsCount:I,morphTextureStride:N,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:a.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===T,flipSided:a.side===E,depthPacking:void 0!==a.depthPacking&&a.depthPacking,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputEncoding),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.combine),e.push(t.vertexUvs),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.maxBones),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection)}(n,t),function(e,t){s.disableAll(),t.isWebGL2&&s.enable(0);t.supportsVertexTextures&&s.enable(1);t.instancing&&s.enable(2);t.instancingColor&&s.enable(3);t.map&&s.enable(4);t.matcap&&s.enable(5);t.envMap&&s.enable(6);t.lightMap&&s.enable(7);t.aoMap&&s.enable(8);t.emissiveMap&&s.enable(9);t.bumpMap&&s.enable(10);t.normalMap&&s.enable(11);t.objectSpaceNormalMap&&s.enable(12);t.tangentSpaceNormalMap&&s.enable(13);t.clearcoat&&s.enable(14);t.clearcoatMap&&s.enable(15);t.clearcoatRoughnessMap&&s.enable(16);t.clearcoatNormalMap&&s.enable(17);t.displacementMap&&s.enable(18);t.specularMap&&s.enable(19);t.roughnessMap&&s.enable(20);t.metalnessMap&&s.enable(21);t.gradientMap&&s.enable(22);t.alphaMap&&s.enable(23);t.alphaTest&&s.enable(24);t.vertexColors&&s.enable(25);t.vertexAlphas&&s.enable(26);t.vertexUvs&&s.enable(27);t.vertexTangents&&s.enable(28);t.uvsVertexOnly&&s.enable(29);t.fog&&s.enable(30);e.push(s.mask),s.disableAll(),t.useFog&&s.enable(0);t.flatShading&&s.enable(1);t.logarithmicDepthBuffer&&s.enable(2);t.skinning&&s.enable(3);t.useVertexTexture&&s.enable(4);t.morphTargets&&s.enable(5);t.morphNormals&&s.enable(6);t.morphColors&&s.enable(7);t.premultipliedAlpha&&s.enable(8);t.shadowMapEnabled&&s.enable(9);t.physicallyCorrectLights&&s.enable(10);t.doubleSided&&s.enable(11);t.flipSided&&s.enable(12);t.depthPacking&&s.enable(13);t.dithering&&s.enable(14);t.specularIntensityMap&&s.enable(15);t.specularColorMap&&s.enable(16);t.transmission&&s.enable(17);t.transmissionMap&&s.enable(18);t.thicknessMap&&s.enable(19);t.sheen&&s.enable(20);t.sheenColorMap&&s.enable(21);t.sheenRoughnessMap&&s.enable(22);t.decodeVideoTexture&&s.enable(23);t.opaque&&s.enable(24);e.push(s.mask)}(n,t),n.push(e.outputEncoding)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t,n=m[e.type];if(n){var r=Dr[n];t=Vn.clone(r.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){for(var r,i=0,o=u.length;i<o;i++){var s=u[i];if(s.cacheKey===n){++(r=s).usedTimes;break}}return void 0===r&&(r=new qa(e,n,t,a),u.push(r)),r},releaseProgram:function(e){if(0==--e.usedTimes){var t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:u,dispose:function(){l.dispose()}}}function Ka(){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 Qa(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder: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 $a(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 eo(){var e=[],t=0,n=[],r=[],i=[];function a(n,r,i,a,o,s){var l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:r,material:i,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},e[t]=l):(l.id=n.id,l.object=n,l.geometry=r,l.material=i,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=o,l.group=s),t++,l}return{opaque:n,transmissive:r,transparent:i,init:function(){t=0,n.length=0,r.length=0,i.length=0},push:function(e,t,o,s,l,u){var c=a(e,t,o,s,l,u);o.transmission>0?r.push(c):!0===o.transparent?i.push(c):n.push(c)},unshift:function(e,t,o,s,l,u){var c=a(e,t,o,s,l,u);o.transmission>0?r.unshift(c):!0===o.transparent?i.unshift(c):n.unshift(c)},finish:function(){for(var n=t,r=e.length;n<r;n++){var i=e[n];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.group=null}},sort:function(e,t){n.length>1&&n.sort(e||Qa),r.length>1&&r.sort(t||$a),i.length>1&&i.sort(t||$a)}}}function to(){var e=new WeakMap;return{get:function(t,n){var r;return!1===e.has(t)?(r=new eo,e.set(t,[r])):n>=e.get(t).length?(r=new eo,e.get(t).push(r)):r=e.get(t)[n],r},dispose:function(){e=new WeakMap}}}function no(){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 tt,color:new tn};break;case"SpotLight":n={position:new tt,direction:new tt,color:new tn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new tt,color:new tn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new tt,skyColor:new tn,groundColor:new tn};break;case"RectAreaLight":n={color:new tn,position:new tt,halfWidth:new tt,halfHeight:new tt}}return e[t.id]=n,n}}}var ro=0;function io(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function ao(e,t){for(var n,r=new no,i=(n={},{get:function(e){if(void 0!==n[e.id])return n[e.id];var t;switch(e.type){case"DirectionalLight":case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ht};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ht,shadowCameraNear:1,shadowCameraFar:1e3}}return n[e.id]=t,t}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},o=0;o<9;o++)a.probe.push(new tt);var s=new tt,l=new Pt,u=new Pt;return{setup:function(n,o){for(var s=0,l=0,u=0,c=0;c<9;c++)a.probe[c].set(0,0,0);var h=0,d=0,p=0,f=0,v=0,m=0,g=0,y=0;n.sort(io);for(var x=!0!==o?Math.PI:1,_=0,b=n.length;_<b;_++){var M=n[_],w=M.color,S=M.intensity,E=M.distance,T=M.shadow&&M.shadow.map?M.shadow.map.texture:null;if(M.isAmbientLight)s+=w.r*S*x,l+=w.g*S*x,u+=w.b*S*x;else if(M.isLightProbe)for(var A=0;A<9;A++)a.probe[A].addScaledVector(M.sh.coefficients[A],S);else if(M.isDirectionalLight){var k=r.get(M);if(k.color.copy(M.color).multiplyScalar(M.intensity*x),M.castShadow){var L=M.shadow,R=i.get(M);R.shadowBias=L.bias,R.shadowNormalBias=L.normalBias,R.shadowRadius=L.radius,R.shadowMapSize=L.mapSize,a.directionalShadow[h]=R,a.directionalShadowMap[h]=T,a.directionalShadowMatrix[h]=M.shadow.matrix,m++}a.directional[h]=k,h++}else if(M.isSpotLight){var C=r.get(M);if(C.position.setFromMatrixPosition(M.matrixWorld),C.color.copy(w).multiplyScalar(S*x),C.distance=E,C.coneCos=Math.cos(M.angle),C.penumbraCos=Math.cos(M.angle*(1-M.penumbra)),C.decay=M.decay,M.castShadow){var P=M.shadow,D=i.get(M);D.shadowBias=P.bias,D.shadowNormalBias=P.normalBias,D.shadowRadius=P.radius,D.shadowMapSize=P.mapSize,a.spotShadow[p]=D,a.spotShadowMap[p]=T,a.spotShadowMatrix[p]=M.shadow.matrix,y++}a.spot[p]=C,p++}else if(M.isRectAreaLight){var I=r.get(M);I.color.copy(w).multiplyScalar(S),I.halfWidth.set(.5*M.width,0,0),I.halfHeight.set(0,.5*M.height,0),a.rectArea[f]=I,f++}else if(M.isPointLight){var N=r.get(M);if(N.color.copy(M.color).multiplyScalar(M.intensity*x),N.distance=M.distance,N.decay=M.decay,M.castShadow){var O=M.shadow,z=i.get(M);z.shadowBias=O.bias,z.shadowNormalBias=O.normalBias,z.shadowRadius=O.radius,z.shadowMapSize=O.mapSize,z.shadowCameraNear=O.camera.near,z.shadowCameraFar=O.camera.far,a.pointShadow[d]=z,a.pointShadowMap[d]=T,a.pointShadowMatrix[d]=M.shadow.matrix,g++}a.point[d]=N,d++}else if(M.isHemisphereLight){var B=r.get(M);B.skyColor.copy(M.color).multiplyScalar(S*x),B.groundColor.copy(M.groundColor).multiplyScalar(S*x),a.hemi[v]=B,v++}}f>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=Pr.LTC_FLOAT_1,a.rectAreaLTC2=Pr.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=Pr.LTC_HALF_1,a.rectAreaLTC2=Pr.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=s,a.ambient[1]=l,a.ambient[2]=u;var U=a.hash;U.directionalLength===h&&U.pointLength===d&&U.spotLength===p&&U.rectAreaLength===f&&U.hemiLength===v&&U.numDirectionalShadows===m&&U.numPointShadows===g&&U.numSpotShadows===y||(a.directional.length=h,a.spot.length=p,a.rectArea.length=f,a.point.length=d,a.hemi.length=v,a.directionalShadow.length=m,a.directionalShadowMap.length=m,a.pointShadow.length=g,a.pointShadowMap.length=g,a.spotShadow.length=y,a.spotShadowMap.length=y,a.directionalShadowMatrix.length=m,a.pointShadowMatrix.length=g,a.spotShadowMatrix.length=y,U.directionalLength=h,U.pointLength=d,U.spotLength=p,U.rectAreaLength=f,U.hemiLength=v,U.numDirectionalShadows=m,U.numPointShadows=g,U.numSpotShadows=y,a.version=ro++)},setupView:function(e,t){for(var n=0,r=0,i=0,o=0,c=0,h=t.matrixWorldInverse,d=0,p=e.length;d<p;d++){var f=e[d];if(f.isDirectionalLight){var v=a.directional[n];v.direction.setFromMatrixPosition(f.matrixWorld),s.setFromMatrixPosition(f.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(h),n++}else if(f.isSpotLight){var m=a.spot[i];m.position.setFromMatrixPosition(f.matrixWorld),m.position.applyMatrix4(h),m.direction.setFromMatrixPosition(f.matrixWorld),s.setFromMatrixPosition(f.target.matrixWorld),m.direction.sub(s),m.direction.transformDirection(h),i++}else if(f.isRectAreaLight){var g=a.rectArea[o];g.position.setFromMatrixPosition(f.matrixWorld),g.position.applyMatrix4(h),u.identity(),l.copy(f.matrixWorld),l.premultiply(h),u.extractRotation(l),g.halfWidth.set(.5*f.width,0,0),g.halfHeight.set(0,.5*f.height,0),g.halfWidth.applyMatrix4(u),g.halfHeight.applyMatrix4(u),o++}else if(f.isPointLight){var y=a.point[r];y.position.setFromMatrixPosition(f.matrixWorld),y.position.applyMatrix4(h),r++}else if(f.isHemisphereLight){var x=a.hemi[c];x.direction.setFromMatrixPosition(f.matrixWorld),x.direction.transformDirection(h),x.direction.normalize(),c++}}},state:a}}function oo(e,t){var n=new ao(e,t),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(e){n.setup(r,e)},setupLightsView:function(e){n.setupView(r,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){i.push(e)}}}function so(e,t){var n=new WeakMap;return{get:function(r){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!1===n.has(r)?(i=new oo(e,t),n.set(r,[i])):a>=n.get(r).length?(i=new oo(e,t),n.get(r).push(i)):i=n.get(r)[a],i},dispose:function(){n=new WeakMap}}}var lo=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="MeshDepthMaterial",r.depthPacking=3200,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.fog=!1,r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.depthPacking=e.depthPacking,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}}]),n}(Hn);lo.prototype.isMeshDepthMaterial=!0;var uo=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="MeshDistanceMaterial",r.referencePosition=new tt,r.nearDistance=1,r.farDistance=1e3,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.fog=!1,r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}]),n}(Hn);uo.prototype.isMeshDistanceMaterial=!0;function co(e,t,n){var r=new Ct,i=new Ht,a=new Ht,o=new Ft,s=new lo({depthPacking:3201}),l=new uo,u={},c=n.maxTextureSize,h={0:E,1:S,2:T},d=new Wn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ht},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;var f=new On;f.setAttribute("position",new an(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var v=new kr(f,d),m=this;function g(n,r){var i=t.update(v);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,d,v,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,p,v,null)}function y(t,n,r,i,a,o){var c=null,d=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(c=void 0!==d?d:!0===r.isPointLight?l:s,e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){var p=c.uuid,f=n.uuid,v=u[p];void 0===v&&(v={},u[p]=v);var m=v[f];void 0===m&&(m=c.clone(),v[f]=m),c=m}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=3===o?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],c.alphaMap=n.alphaMap,c.alphaTest=n.alphaTest,c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.displacementMap=n.displacementMap,c.displacementScale=n.displacementScale,c.displacementBias=n.displacementBias,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,!0===r.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(r.matrixWorld),c.nearDistance=i,c.farDistance=a),c}function x(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),u=n.material;if(Array.isArray(u))for(var c=l.groups,h=0,d=c.length;h<d;h++){var p=c[h],f=u[p.materialIndex];if(f&&f.visible){var v=y(n,f,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,v,n,p)}}else if(u.visible){var m=y(n,u,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,m,n,null)}}for(var g=n.children,_=0,b=g.length;_<b;_++)x(g[_],i,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,n,s){if(!1!==m.enabled&&(!1!==m.autoUpdate||!1!==m.needsUpdate)&&0!==t.length){var l=e.getRenderTarget(),u=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),d=e.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var p=0,f=t.length;p<f;p++){var v=t[p],y=v.shadow;if(void 0!==y){if(!1!==y.autoUpdate||!1!==y.needsUpdate){i.copy(y.mapSize);var _=y.getFrameExtents();if(i.multiply(_),a.copy(y.mapSize),(i.x>c||i.y>c)&&(i.x>c&&(a.x=Math.floor(c/_.x),i.x=a.x*_.x,y.mapSize.x=a.x),i.y>c&&(a.y=Math.floor(c/_.y),i.y=a.y*_.y,y.mapSize.y=a.y)),null!==y.map||y.isPointLightShadow||3!==this.type||(y.map=new jr(i.x,i.y),y.map.texture.name=v.name+".shadowMap",y.mapPass=new jr(i.x,i.y),y.camera.updateProjectionMatrix()),null===y.map){var b={minFilter:I,magFilter:I,format:q};y.map=new jr(i.x,i.y,b),y.map.texture.name=v.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var M=y.getViewportCount(),w=0;w<M;w++){var S=y.getViewport(w);o.set(a.x*S.x,a.y*S.y,a.x*S.z,a.y*S.w),d.viewport(o),y.updateMatrices(v,w),r=y.getFrustum(),x(n,s,y.camera,v,this.type)}y.isPointLightShadow||3!==this.type||g(y,s),y.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",v,"has no shadow.")}m.needsUpdate=!1,e.setRenderTarget(l,u,h)}}}function ho(e,t,n){var r,i,a=n.isWebGL2;var o=new function(){var t=!1,n=new Ft,r=null,i=new Ft(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)}}},s=new function(){var t=!1,n=null,r=null,i=null;return{setTest:function(e){e?W(2929):j(2929)},setMask:function(r){n===r||t||(e.depthMask(r),n=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:default:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517)}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}}},l=new function(){var t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,u=null;return{setTest:function(e){t||(e?W(2960):j(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&&l===r||(e.stencilOp(t,n,r),o=t,s=n,l=r)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,u=null}}},u={},c={},h=new WeakMap,d=[],p=null,f=!1,v=null,m=null,g=null,x=null,_=null,b=null,M=null,w=!1,S=null,k=null,L=null,R=null,C=null,P=e.getParameter(35661),D=!1,I=0,N=e.getParameter(7938);-1!==N.indexOf("WebGL")?(I=parseFloat(/^WebGL (\d)/.exec(N)[1]),D=I>=1):-1!==N.indexOf("OpenGL ES")&&(I=parseFloat(/^OpenGL ES (\d)/.exec(N)[1]),D=I>=2);var O=null,z={},B=e.getParameter(3088),U=e.getParameter(2978),H=(new Ft).fromArray(B),F=(new Ft).fromArray(U);function G(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 V={};function W(t){!0!==u[t]&&(e.enable(t),u[t]=!0)}function j(t){!1!==u[t]&&(e.disable(t),u[t]=!1)}V[3553]=G(3553,3553,1),V[34067]=G(34067,34069,6),o.setClear(0,0,0,1),s.setClear(1),l.setClear(0),W(2929),s.setFunc(3),Z(!1),K(1),W(2884),J(0);var q=(y(r={},A,32774),y(r,101,32778),y(r,102,32779),r);if(a)q[103]=32775,q[104]=32776;else{var X=t.get("EXT_blend_minmax");null!==X&&(q[103]=X.MIN_EXT,q[104]=X.MAX_EXT)}var Y=(y(i={},200,0),y(i,201,1),y(i,202,768),y(i,204,770),y(i,210,776),y(i,208,774),y(i,206,772),y(i,203,769),y(i,205,771),y(i,209,775),y(i,207,773),i);function J(t,n,r,i,a,o,s,l){if(0!==t){if(!1===f&&(W(3042),f=!0),5===t)a=a||n,o=o||r,s=s||i,n===m&&a===_||(e.blendEquationSeparate(q[n],q[a]),m=n,_=a),r===g&&i===x&&o===b&&s===M||(e.blendFuncSeparate(Y[r],Y[i],Y[o],Y[s]),g=r,x=i,b=o,M=s),v=t,w=null;else if(t!==v||l!==w){if(m===A&&_===A||(e.blendEquation(32774),m=A,_=A),l)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,769,0,1);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFuncSeparate(0,769,0,1);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}g=null,x=null,b=null,M=null,v=t,w=l}}else!0===f&&(j(3042),f=!1)}function Z(t){S!==t&&(t?e.frontFace(2304):e.frontFace(2305),S=t)}function K(t){0!==t?(W(2884),t!==k&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):j(2884),k=t}function Q(t,n,r){t?(W(32823),R===n&&C===r||(e.polygonOffset(n,r),R=n,C=r)):j(32823)}function $(t){void 0===t&&(t=33984+P-1),O!==t&&(e.activeTexture(t),O=t)}return{buffers:{color:o,depth:s,stencil:l},enable:W,disable:j,bindFramebuffer:function(t,n){return c[t]!==n&&(e.bindFramebuffer(t,n),c[t]=n,a&&(36009===t&&(c[36160]=n),36160===t&&(c[36009]=n)),!0)},drawBuffers:function(r,i){var a=d,o=!1;if(r)if(void 0===(a=h.get(i))&&(a=[],h.set(i,a)),r.isWebGLMultipleRenderTargets){var s=r.texture;if(a.length!==s.length||36064!==a[0]){for(var l=0,u=s.length;l<u;l++)a[l]=36064+l;a.length=s.length,o=!0}}else 36064!==a[0]&&(a[0]=36064,o=!0);else 1029!==a[0]&&(a[0]=1029,o=!0);o&&(n.isWebGL2?e.drawBuffers(a):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(t){return p!==t&&(e.useProgram(t),p=t,!0)},setBlending:J,setMaterial:function(e,t){e.side===T?j(2884):W(2884);var n=e.side===E;t&&(n=!n),Z(n),1===e.blending&&!1===e.transparent?J(0):J(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),s.setFunc(e.depthFunc),s.setTest(e.depthTest),s.setMask(e.depthWrite),o.setMask(e.colorWrite);var r=e.stencilWrite;l.setTest(r),r&&(l.setMask(e.stencilWriteMask),l.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),l.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Q(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?W(32926):j(32926)},setFlipSided:Z,setCullFace:K,setLineWidth:function(t){t!==L&&(D&&e.lineWidth(t),L=t)},setPolygonOffset:Q,setScissorTest:function(e){e?W(3089):j(3089)},activeTexture:$,bindTexture:function(t,n){null===O&&$();var r=z[O];void 0===r&&(r={type:void 0,texture:void 0},z[O]=r),r.type===t&&r.texture===n||(e.bindTexture(t,n||V[t]),r.type=t,r.texture=n)},unbindTexture:function(){var t=z[O];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===H.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),H.copy(t))},viewport:function(t){!1===F.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),F.copy(t))},reset:function(){e.disable(3042),e.disable(2884),e.disable(2929),e.disable(32823),e.disable(3089),e.disable(2960),e.disable(32926),e.blendEquation(32774),e.blendFunc(1,0),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(513),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(519,0,4294967295),e.stencilOp(7680,7680,7680),e.clearStencil(0),e.cullFace(1029),e.frontFace(2305),e.polygonOffset(0,0),e.activeTexture(33984),e.bindFramebuffer(36160,null),!0===a&&(e.bindFramebuffer(36009,null),e.bindFramebuffer(36008,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),u={},O=null,z={},c={},h=new WeakMap,d=[],p=null,f=!1,v=null,m=null,g=null,x=null,_=null,b=null,M=null,w=!1,S=null,k=null,L=null,R=null,C=null,H.set(0,0,e.canvas.width,e.canvas.height),F.set(0,0,e.canvas.width,e.canvas.height),o.reset(),s.reset(),l.reset()}}}function po(e,t,n,r,i,a,o){var s,l,u,c=i.isWebGL2,h=i.maxTextures,d=i.maxCubemapSize,p=i.maxTextureSize,f=i.maxSamples,v=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,m=new WeakMap,g=new WeakMap,x=!1;try{x="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function _(e,t){return x?new OffscreenCanvas(e,t):kn("canvas")}function b(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("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Qe:Math.floor,o=a(i*e.width),s=a(i*e.height);void 0===u&&(u=_(o,s));var l=n?_(o,s):u;return l.width=o,l.height=s,l.getContext("2d").drawImage(e,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+s+")."),l}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function M(e){return Ze(e.width)&&Ze(e.height)}function w(e,t){return e.generateMipmaps&&t&&e.minFilter!==I&&e.minFilter!==z}function S(t){e.generateMipmap(t)}function E(n,r,i,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!1===c)return r;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=r;return 6403===r&&(5126===i&&(s=33326),5131===i&&(s=33325),5121===i&&(s=33321)),33319===r&&(5126===i&&(s=33328),5131===i&&(s=33327),5121===i&&(s=33323)),6408===r&&(5126===i&&(s=34836),5131===i&&(s=34842),5121===i&&(s=a===Pe&&!1===o?35907:32856),32819===i&&(s=32854),32820===i&&(s=32855)),33325!==s&&33326!==s&&33327!==s&&33328!==s&&34842!==s&&34836!==s||t.get("EXT_color_buffer_float"),s}function T(e,t,n){return!0===w(e,n)||e.isFramebufferTexture&&e.minFilter!==I&&e.minFilter!==z?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function A(e){return e===I||e===N||e===O?9728:9729}function k(e){var t=e.target;t.removeEventListener("dispose",k),function(e){var t=r.get(e);if(void 0===t.__webglInit)return;var n=e.source,i=g.get(n);if(i){var a=i[t.__cacheKey];a.usedTimes--,0===a.usedTimes&&R(e),0===Object.keys(i).length&&g.delete(n)}r.remove(e)}(t),t.isVideoTexture&&m.delete(t)}function L(t){var n=t.target;n.removeEventListener("dispose",L),function(t){var n=t.texture,i=r.get(t),a=r.get(n);void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),o.memory.textures--);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLCubeRenderTarget)for(var s=0;s<6;s++)e.deleteFramebuffer(i.__webglFramebuffer[s]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[s]);else e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&e.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer);if(t.isWebGLMultipleRenderTargets)for(var l=0,u=n.length;l<u;l++){var c=r.get(n[l]);c.__webglTexture&&(e.deleteTexture(c.__webglTexture),o.memory.textures--),r.remove(n[l])}r.remove(n),r.remove(t)}(n)}function R(t){var n=r.get(t);e.deleteTexture(n.__webglTexture);var i=t.source;delete g.get(i)[n.__cacheKey],o.memory.textures--}var J=0;function Z(e,t){var i=r.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;m.get(e)!==t&&(m.set(e,t),e.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&i.__version!==e.version){var a=e.image;if(null===a)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==a.complete)return void te(i,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,i.__webglTexture)}var K=(y(s={},C,10497),y(s,P,33071),y(s,D,33648),s),Q=(y(l={},I,9728),y(l,N,9984),y(l,O,9986),y(l,z,9729),y(l,B,9985),y(l,U,9987),l);function $(n,a,o){if(o?(e.texParameteri(n,10242,K[a.wrapS]),e.texParameteri(n,10243,K[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,K[a.wrapR]),e.texParameteri(n,10240,Q[a.magFilter]),e.texParameteri(n,10241,Q[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),a.wrapS===P&&a.wrapT===P||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,A(a.magFilter)),e.texParameteri(n,10241,A(a.minFilter)),a.minFilter!==I&&a.minFilter!==z&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){var s=t.get("EXT_texture_filter_anisotropic");if(a.type===V&&!1===t.has("OES_texture_float_linear"))return;if(!1===c&&a.type===W&&!1===t.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function ee(t,n){var r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",k));var i=n.source,a=g.get(i);void 0===a&&(a={},g.set(i,a));var s=function(e){var t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.encoding),t.join()}(n);if(s!==t.__cacheKey){void 0===a[s]&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;var l=a[t.__cacheKey];void 0!==l&&(a[t.__cacheKey].usedTimes--,0===l.usedTimes&&R(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function te(t,r,i){var o=3553;r.isDataArrayTexture&&(o=35866),r.isData3DTexture&&(o=32879);var s=ee(t,r),l=r.source;if(n.activeTexture(33984+i),n.bindTexture(o,t.__webglTexture),l.version!==l.__currentVersion||!0===s){e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);var u,h=function(e){return!c&&(e.wrapS!==P||e.wrapT!==P||e.minFilter!==I&&e.minFilter!==z)}(r)&&!1===M(r.image),d=b(r.image,h,!1,p),f=M(d=se(r,d))||c,v=a.convert(r.format,r.encoding),m=a.convert(r.type),g=E(r.internalFormat,v,m,r.encoding,r.isVideoTexture);$(o,r,f);var y=r.mipmaps,x=c&&!0!==r.isVideoTexture,_=void 0===t.__version,A=T(r,d,f);if(r.isDepthTexture)g=6402,c?g=r.type===V?36012:r.type===G?33190:r.type===j?35056:33189:r.type===V&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===X&&6402===g&&r.type!==F&&r.type!==G&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=F,m=a.convert(r.type)),r.format===Y&&6402===g&&(g=34041,r.type!==j&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=j,m=a.convert(r.type))),x&&_?n.texStorage2D(3553,1,g,d.width,d.height):n.texImage2D(3553,0,g,d.width,d.height,0,v,m,null);else if(r.isDataTexture)if(y.length>0&&f){x&&_&&n.texStorage2D(3553,A,g,y[0].width,y[0].height);for(var k=0,L=y.length;k<L;k++)u=y[k],x?n.texSubImage2D(3553,k,0,0,u.width,u.height,v,m,u.data):n.texImage2D(3553,k,g,u.width,u.height,0,v,m,u.data);r.generateMipmaps=!1}else x?(_&&n.texStorage2D(3553,A,g,d.width,d.height),n.texSubImage2D(3553,0,0,0,d.width,d.height,v,m,d.data)):n.texImage2D(3553,0,g,d.width,d.height,0,v,m,d.data);else if(r.isCompressedTexture){x&&_&&n.texStorage2D(3553,A,g,y[0].width,y[0].height);for(var R=0,C=y.length;R<C;R++)u=y[R],r.format!==q?null!==v?x?n.compressedTexSubImage2D(3553,R,0,0,u.width,u.height,v,u.data):n.compressedTexImage2D(3553,R,g,u.width,u.height,0,u.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):x?n.texSubImage2D(3553,R,0,0,u.width,u.height,v,m,u.data):n.texImage2D(3553,R,g,u.width,u.height,0,v,m,u.data)}else if(r.isDataArrayTexture)x?(_&&n.texStorage3D(35866,A,g,d.width,d.height,d.depth),n.texSubImage3D(35866,0,0,0,0,d.width,d.height,d.depth,v,m,d.data)):n.texImage3D(35866,0,g,d.width,d.height,d.depth,0,v,m,d.data);else if(r.isData3DTexture)x?(_&&n.texStorage3D(32879,A,g,d.width,d.height,d.depth),n.texSubImage3D(32879,0,0,0,0,d.width,d.height,d.depth,v,m,d.data)):n.texImage3D(32879,0,g,d.width,d.height,d.depth,0,v,m,d.data);else if(r.isFramebufferTexture)x&&_?n.texStorage2D(3553,A,g,d.width,d.height):n.texImage2D(3553,0,g,d.width,d.height,0,v,m,null);else if(y.length>0&&f){x&&_&&n.texStorage2D(3553,A,g,y[0].width,y[0].height);for(var D=0,N=y.length;D<N;D++)u=y[D],x?n.texSubImage2D(3553,D,0,0,v,m,u):n.texImage2D(3553,D,g,v,m,u);r.generateMipmaps=!1}else x?(_&&n.texStorage2D(3553,A,g,d.width,d.height),n.texSubImage2D(3553,0,0,0,v,m,d)):n.texImage2D(3553,0,g,v,m,d);w(r,f)&&S(o),l.__currentVersion=l.version,r.onUpdate&&r.onUpdate(r)}t.__version=r.version}function ne(t,i,o,s,l){var u=a.convert(o.format,o.encoding),c=a.convert(o.type),h=E(o.internalFormat,u,c,o.encoding);r.get(i).__hasExternalTextures||(32879===l||35866===l?n.texImage3D(l,0,h,i.width,i.height,i.depth,0,u,c,null):n.texImage2D(l,0,h,i.width,i.height,0,u,c,null)),n.bindFramebuffer(36160,t),oe(i)?v.framebufferTexture2DMultisampleEXT(36160,s,l,r.get(o).__webglTexture,0,ae(i)):e.framebufferTexture2D(36160,s,l,r.get(o).__webglTexture,0),n.bindFramebuffer(36160,null)}function re(t,n,r){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var i=33189;if(r||oe(n)){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===V?i=36012:o.type===G&&(i=33190));var s=ae(n);oe(n)?v.renderbufferStorageMultisampleEXT(36161,s,i,n.width,n.height):e.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else e.renderbufferStorage(36161,i,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){var l=ae(n);r&&!1===oe(n)?e.renderbufferStorageMultisample(36161,l,35056,n.width,n.height):oe(n)?v.renderbufferStorageMultisampleEXT(36161,l,35056,n.width,n.height):e.renderbufferStorage(36161,34041,n.width,n.height),e.framebufferRenderbuffer(36160,33306,36161,t)}else{var u=!0===n.isWebGLMultipleRenderTargets?n.texture[0]:n.texture,c=a.convert(u.format,u.encoding),h=a.convert(u.type),d=E(u.internalFormat,c,h,u.encoding),p=ae(n);r&&!1===oe(n)?e.renderbufferStorageMultisample(36161,p,d,n.width,n.height):oe(n)?v.renderbufferStorageMultisampleEXT(36161,p,d,n.width,n.height):e.renderbufferStorage(36161,d,n.width,n.height)}e.bindRenderbuffer(36161,null)}function ie(t){var i=r.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,t),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),Z(i.depthTexture,0);var a=r.get(i.depthTexture).__webglTexture,o=ae(i);if(i.depthTexture.format===X)oe(i)?v.framebufferTexture2DMultisampleEXT(36160,36096,3553,a,0,o):e.framebufferTexture2D(36160,36096,3553,a,0);else{if(i.depthTexture.format!==Y)throw new Error("Unknown depthTexture format");oe(i)?v.framebufferTexture2DMultisampleEXT(36160,33306,3553,a,0,o):e.framebufferTexture2D(36160,33306,3553,a,0)}}(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)n.bindFramebuffer(36160,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=e.createRenderbuffer(),re(i.__webglDepthbuffer[o],t,!1)}else n.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),re(i.__webglDepthbuffer,t,!1);n.bindFramebuffer(36160,null)}function ae(e){return Math.min(f,e.samples)}function oe(e){var n=r.get(e);return c&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function se(e,n){var r=e.encoding,i=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||e.format===He||r!==Ce&&(r===Pe?!1===c?!0===t.has("EXT_sRGB")&&i===q?(e.format=He,e.minFilter=z,e.generateMipmaps=!1):n=Ur.sRGBToLinear(n,e):i===q&&a===H||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",r)),n}this.allocateTextureUnit=function(){var e=J;return e>=h&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+h),J+=1,e},this.resetTextureUnits=function(){J=0},this.setTexture2D=Z,this.setTexture2DArray=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?te(i,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(e,t){var i=r.get(e);e.version>0&&i.__version!==e.version?te(i,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=function(t,i){var o=r.get(t);t.version>0&&o.__version!==t.version?function(t,r,i){if(6!==r.image.length)return;var o=ee(t,r),s=r.source;if(n.activeTexture(33984+i),n.bindTexture(34067,t.__webglTexture),s.version!==s.__currentVersion||!0===o){e.pixelStorei(37440,r.flipY),e.pixelStorei(37441,r.premultiplyAlpha),e.pixelStorei(3317,r.unpackAlignment),e.pixelStorei(37443,0);for(var l=r.isCompressedTexture||r.image[0].isCompressedTexture,u=r.image[0]&&r.image[0].isDataTexture,h=[],p=0;p<6;p++)h[p]=l||u?u?r.image[p].image:r.image[p]:b(r.image[p],!1,!0,d),h[p]=se(r,h[p]);var f,v=h[0],m=M(v)||c,g=a.convert(r.format,r.encoding),y=a.convert(r.type),x=E(r.internalFormat,g,y,r.encoding),_=c&&!0!==r.isVideoTexture,A=void 0===t.__version,k=T(r,v,m);if($(34067,r,m),l){_&&A&&n.texStorage2D(34067,k,x,v.width,v.height);for(var L=0;L<6;L++){f=h[L].mipmaps;for(var R=0;R<f.length;R++){var C=f[R];r.format!==q?null!==g?_?n.compressedTexSubImage2D(34069+L,R,0,0,C.width,C.height,g,C.data):n.compressedTexImage2D(34069+L,R,x,C.width,C.height,0,C.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):_?n.texSubImage2D(34069+L,R,0,0,C.width,C.height,g,y,C.data):n.texImage2D(34069+L,R,x,C.width,C.height,0,g,y,C.data)}}}else{f=r.mipmaps,_&&A&&(f.length>0&&k++,n.texStorage2D(34067,k,x,h[0].width,h[0].height));for(var P=0;P<6;P++)if(u){_?n.texSubImage2D(34069+P,0,0,0,h[P].width,h[P].height,g,y,h[P].data):n.texImage2D(34069+P,0,x,h[P].width,h[P].height,0,g,y,h[P].data);for(var D=0;D<f.length;D++){var I=f[D].image[P].image;_?n.texSubImage2D(34069+P,D+1,0,0,I.width,I.height,g,y,I.data):n.texImage2D(34069+P,D+1,x,I.width,I.height,0,g,y,I.data)}}else{_?n.texSubImage2D(34069+P,0,0,0,g,y,h[P]):n.texImage2D(34069+P,0,x,g,y,h[P]);for(var N=0;N<f.length;N++){var O=f[N];_?n.texSubImage2D(34069+P,N+1,0,0,g,y,O.image[P]):n.texImage2D(34069+P,N+1,x,g,y,O.image[P])}}}w(r,m)&&S(34067),s.__currentVersion=s.version,r.onUpdate&&r.onUpdate(r)}t.__version=r.version}(o,t,i):(n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture))},this.rebindTextures=function(e,t,n){var i=r.get(e);void 0!==t&&ne(i.__webglFramebuffer,e,e.texture,36064,3553),void 0!==n&&ie(e)},this.setupRenderTarget=function(t){var s=t.texture,l=r.get(t),u=r.get(s);t.addEventListener("dispose",L),!0!==t.isWebGLMultipleRenderTargets&&(void 0===u.__webglTexture&&(u.__webglTexture=e.createTexture()),u.__version=s.version,o.memory.textures++);var h=!0===t.isWebGLCubeRenderTarget,d=!0===t.isWebGLMultipleRenderTargets,p=M(t)||c;if(h){l.__webglFramebuffer=[];for(var f=0;f<6;f++)l.__webglFramebuffer[f]=e.createFramebuffer()}else if(l.__webglFramebuffer=e.createFramebuffer(),d)if(i.drawBuffers)for(var v=t.texture,m=0,g=v.length;m<g;m++){var y=r.get(v[m]);void 0===y.__webglTexture&&(y.__webglTexture=e.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(c&&t.samples>0&&!1===oe(t)){l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,l.__webglColorRenderbuffer);var x=a.convert(s.format,s.encoding),_=a.convert(s.type),b=E(s.internalFormat,x,_,s.encoding),T=ae(t);e.renderbufferStorageMultisample(36161,T,b,t.width,t.height),n.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(l.__webglDepthRenderbuffer=e.createRenderbuffer(),re(l.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(36160,null)}if(h){n.bindTexture(34067,u.__webglTexture),$(34067,s,p);for(var A=0;A<6;A++)ne(l.__webglFramebuffer[A],t,s,36064,34069+A);w(s,p)&&S(34067),n.unbindTexture()}else if(d){for(var k=t.texture,R=0,C=k.length;R<C;R++){var P=k[R],D=r.get(P);n.bindTexture(3553,D.__webglTexture),$(3553,P,p),ne(l.__webglFramebuffer,t,P,36064+R,3553),w(P,p)&&S(3553)}n.unbindTexture()}else{var I=3553;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(c?I=t.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(I,u.__webglTexture),$(I,s,p),ne(l.__webglFramebuffer,t,s,36064,I),w(s,p)&&S(I),n.unbindTexture()}t.depthBuffer&&ie(t)},this.updateRenderTargetMipmap=function(e){for(var t=M(e)||c,i=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture],a=0,o=i.length;a<o;a++){var s=i[a];if(w(s,t)){var l=e.isWebGLCubeRenderTarget?34067:3553,u=r.get(s).__webglTexture;n.bindTexture(l,u),S(l),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(c&&t.samples>0&&!1===oe(t)){var i=t.width,a=t.height,o=16384,s=t.stencilBuffer?33306:36096;t.depthBuffer;var l=r.get(t),u=void 0!==l.__ignoreDepthValues&&l.__ignoreDepthValues;!1===u&&(t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024)),n.bindFramebuffer(36008,l.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,l.__webglFramebuffer),!0===u&&(e.invalidateFramebuffer(36008,[s]),e.invalidateFramebuffer(36009,[s])),e.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,l.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=ie,this.setupFrameBufferTexture=ne,this.useMultisampledRTT=oe}function fo(e,t,n){var r=n.isWebGL2;return{convert:function(n){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n===H)return 5121;if(1017===n)return 32819;if(1018===n)return 32820;if(1010===n)return 5120;if(1011===n)return 5122;if(n===F)return 5123;if(1013===n)return 5124;if(n===G)return 5125;if(n===V)return 5126;if(n===W)return r?5131:null!==(i=t.get("OES_texture_half_float"))?i.HALF_FLOAT_OES:null;if(1021===n)return 6406;if(n===q)return 6408;if(1024===n)return 6409;if(1025===n)return 6410;if(n===X)return 6402;if(n===Y)return 34041;if(1028===n)return 6403;if(1022===n)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(n===He)return null!==(i=t.get("EXT_sRGB"))?i.SRGB_ALPHA_EXT:null;if(1029===n)return 36244;if(1030===n)return 33319;if(1031===n)return 33320;if(1033===n)return 36249;if(n===J||n===Z||n===K||n===Q)if(a===Pe){if(null===(i=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===J)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Z)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===K)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Q)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(i=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===J)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Z)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===K)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Q)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===$||n===ee||n===te||n===ne){if(null===(i=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===$)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ee)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===te)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ne)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===n)return null!==(i=t.get("WEBGL_compressed_texture_etc1"))?i.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===re||n===ie){if(null===(i=t.get("WEBGL_compressed_texture_etc")))return null;if(n===re)return a===Pe?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===ie)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}if(n===ae||n===oe||n===se||n===le||n===ue||n===ce||n===he||n===de||n===pe||n===fe||n===ve||n===me||n===ge||n===ye){if(null===(i=t.get("WEBGL_compressed_texture_astc")))return null;if(n===ae)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===oe)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===se)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===le)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ue)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ce)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===he)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===de)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===pe)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===fe)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===ve)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===me)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===ge)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ye)return a===Pe?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===xe){if(null===(i=t.get("EXT_texture_compression_bptc")))return null;if(n===xe)return a===Pe?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===j?r?34042:null!==(i=t.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[n]?e[n]:null}}}var vo=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return _(this,n),(e=t.call(this)).cameras=r,e}return M(n)}(Xr);vo.prototype.isArrayCamera=!0;var mo=function(e){d(n,e);var t=f(n);function n(){var e;return _(this,n),(e=t.call(this)).type="Group",e}return M(n)}(Tn);mo.prototype.isGroup=!0;var go={type:"move"},yo=function(){function e(){_(this,e),this._targetRay=null,this._grip=null,this._hand=null}return M(e,[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new mo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}},{key:"getTargetRaySpace",value:function(){return null===this._targetRay&&(this._targetRay=new mo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new tt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new tt),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new mo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new tt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new tt),this._grip}},{key:"dispatchEvent",value:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}},{key:"disconnect",value:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}},{key:"update",value:function(e,t,n){var r=null,i=null,a=null,s=this._targetRay,l=this._grip,u=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState)if(null!==s&&null!==(r=t.getPose(e.targetRaySpace,n))&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(go)),u&&e.hand){a=!0;var c,h=o(e.hand.values());try{for(h.s();!(c=h.n()).done;){var d=c.value,p=t.getJointPose(d,n);if(void 0===u.joints[d.jointName]){var f=new mo;f.matrixAutoUpdate=!1,f.visible=!1,u.joints[d.jointName]=f,u.add(f)}var v=u.joints[d.jointName];null!==p&&(v.matrix.fromArray(p.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.jointRadius=p.radius),v.visible=null!==p}}catch(e){h.e(e)}finally{h.f()}var m=u.joints["index-finger-tip"],g=u.joints["thumb-tip"],y=m.position.distanceTo(g.position);u.inputState.pinching&&y>.025?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&y<=.015&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==l&&e.gripSpace&&null!==(i=t.getPose(e.gripSpace,n))&&(l.matrix.fromArray(i.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),i.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(i.linearVelocity)):l.hasLinearVelocity=!1,i.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(i.angularVelocity)):l.hasAngularVelocity=!1);return null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==i),null!==u&&(u.visible=null!==a),this}}]),e}(),xo=function(e){d(n,e);var t=f(n);function n(e,r,i,a,o,s,l,u,c,h){var d;if(_(this,n),(h=void 0!==h?h:X)!==X&&h!==Y)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===i&&h===X&&(i=F),void 0===i&&h===Y&&(i=j),(d=t.call(this,null,a,o,s,l,u,h,i,c)).image={width:e,height:r},d.magFilter=void 0!==l?l:I,d.minFilter=void 0!==u?u:I,d.flipY=!1,d.generateMipmaps=!1,d}return M(n)}(Wr);xo.prototype.isDepthTexture=!0;var _o=function(e){d(n,e);var t=f(n);function n(e,r){var i;_(this,n);var o=m(i=t.call(this)),s=null,l=1,u=null,c="local-floor",h=null,d=null,p=null,f=null,v=null,g=r.getContextAttributes(),y=null,b=null,M=[],w=new Map,S=new Xr;S.layers.enable(1),S.viewport=new Ft;var E=new Xr;E.layers.enable(2),E.viewport=new Ft;var T=[S,E],A=new vo;A.layers.enable(1),A.layers.enable(2);var k=null,L=null;function R(e){var t=w.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function C(){w.forEach((function(e,t){e.disconnect(t)})),w.clear(),k=null,L=null,e.setRenderTarget(y),f=null,p=null,d=null,s=null,b=null,z.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}function P(e){for(var t=s.inputSources,n=0;n<M.length;n++)w.set(t[n],M[n]);for(var r=0;r<e.removed.length;r++){var i=e.removed[r],a=w.get(i);a&&(a.dispatchEvent({type:"disconnected",data:i}),w.delete(i))}for(var o=0;o<e.added.length;o++){var l=e.added[o],u=w.get(l);u&&u.dispatchEvent({type:"connected",data:l})}}i.cameraAutoUpdate=!0,i.enabled=!1,i.isPresenting=!1,i.getController=function(e){var t=M[e];return void 0===t&&(t=new yo,M[e]=t),t.getTargetRaySpace()},i.getControllerGrip=function(e){var t=M[e];return void 0===t&&(t=new yo,M[e]=t),t.getGripSpace()},i.getHand=function(e){var t=M[e];return void 0===t&&(t=new yo,M[e]=t),t.getHandSpace()},i.setFramebufferScaleFactor=function(e){l=e,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},i.setReferenceSpaceType=function(e){c=e,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},i.getReferenceSpace=function(){return u},i.getBaseLayer=function(){return null!==p?p:f},i.getBinding=function(){return d},i.getFrame=function(){return v},i.getSession=function(){return s},i.setSession=function(){var t,n=(t=x().mark((function t(n){var i,a,h,v,m;return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(s=n)){t.next=24;break}if(y=e.getRenderTarget(),s.addEventListener("select",R),s.addEventListener("selectstart",R),s.addEventListener("selectend",R),s.addEventListener("squeeze",R),s.addEventListener("squeezestart",R),s.addEventListener("squeezeend",R),s.addEventListener("end",C),s.addEventListener("inputsourceschange",P),!0===g.xrCompatible){t.next=14;break}return t.next=14,r.makeXRCompatible();case 14:return void 0===s.renderState.layers||!1===e.capabilities.isWebGL2?(i={antialias:void 0!==s.renderState.layers||g.antialias,alpha:g.alpha,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:l},f=new XRWebGLLayer(s,r,i),s.updateRenderState({baseLayer:f}),b=new jr(f.framebufferWidth,f.framebufferHeight,{format:q,type:H,encoding:e.outputEncoding})):(a=null,h=null,v=null,g.depth&&(v=g.stencil?35056:33190,a=g.stencil?Y:X,h=g.stencil?j:F),m={colorFormat:e.outputEncoding===Pe?35907:32856,depthFormat:v,scaleFactor:l},d=new XRWebGLBinding(s,r),p=d.createProjectionLayer(m),s.updateRenderState({layers:[p]}),b=new jr(p.textureWidth,p.textureHeight,{format:q,type:H,depthTexture:new xo(p.textureWidth,p.textureHeight,h,void 0,void 0,void 0,void 0,void 0,void 0,a),stencilBuffer:g.stencil,encoding:e.outputEncoding,samples:g.antialias?4:0}),e.properties.get(b).__ignoreDepthValues=p.ignoreDepthValues),b.isXRRenderTarget=!0,this.setFoveation(1),t.next=19,s.requestReferenceSpace(c);case 19:u=t.sent,z.setContext(s),z.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"});case 24:case"end":return t.stop()}}),t,this)})),function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(e){a(o,r,i,s,l,"next",e)}function l(e){a(o,r,i,s,l,"throw",e)}s(void 0)}))});return function(e){return n.apply(this,arguments)}}();var D=new tt,I=new tt;function N(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}i.updateCamera=function(e){if(null!==s){A.near=E.near=S.near=e.near,A.far=E.far=S.far=e.far,k===A.near&&L===A.far||(s.updateRenderState({depthNear:A.near,depthFar:A.far}),k=A.near,L=A.far);var t=e.parent,n=A.cameras;N(A,t);for(var r=0;r<n.length;r++)N(n[r],t);A.matrixWorld.decompose(A.position,A.quaternion,A.scale),e.position.copy(A.position),e.quaternion.copy(A.quaternion),e.scale.copy(A.scale),e.matrix.copy(A.matrix),e.matrixWorld.copy(A.matrixWorld);for(var i=e.children,a=0,o=i.length;a<o;a++)i[a].updateMatrixWorld(!0);2===n.length?function(e,t,n){D.setFromMatrixPosition(t.matrixWorld),I.setFromMatrixPosition(n.matrixWorld);var r=D.distanceTo(I),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],u=(i[9]-1)/i[5],c=(i[8]-1)/i[0],h=(a[8]+1)/a[0],d=o*c,p=o*h,f=r/(-c+h),v=f*-c;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(v),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();var m=o+f,g=s+f,y=d-v,x=p+(r-v),_=l*s/g*m,b=u*s/g*m;e.projectionMatrix.makePerspective(y,x,_,b,m,g)}(A,S,E):A.projectionMatrix.copy(S.projectionMatrix)}},i.getCamera=function(){return A},i.getFoveation=function(){return null!==p?p.fixedFoveation:null!==f?f.fixedFoveation:void 0},i.setFoveation=function(e){null!==p&&(p.fixedFoveation=e),null!==f&&void 0!==f.fixedFoveation&&(f.fixedFoveation=e)};var O=null;var z=new Gt;return z.setAnimationLoop((function(t,n){if(h=n.getViewerPose(u),v=n,null!==h){var r=h.views;null!==f&&(e.setRenderTargetFramebuffer(b,f.framebuffer),e.setRenderTarget(b));var i=!1;r.length!==A.cameras.length&&(A.cameras.length=0,i=!0);for(var a=0;a<r.length;a++){var o=r[a],l=null;if(null!==f)l=f.getViewport(o);else{var c=d.getViewSubImage(p,o);l=c.viewport,0===a&&(e.setRenderTargetTextures(b,c.colorTexture,p.ignoreDepthValues?void 0:c.depthStencilTexture),e.setRenderTarget(b))}var m=T[a];m.matrix.fromArray(o.transform.matrix),m.projectionMatrix.fromArray(o.projectionMatrix),m.viewport.set(l.x,l.y,l.width,l.height),0===a&&A.matrix.copy(m.matrix),!0===i&&A.cameras.push(m)}}for(var g=s.inputSources,y=0;y<M.length;y++){var x=M[y],_=g[y];x.update(_,n,u)}O&&O(t,n),v=null})),i.setAnimationLoop=function(e){O=e},i.dispose=function(){},i}return M(n)}(Wt);function bo(e,t){function n(n,r){n.opacity.value=r.opacity,r.color&&n.diffuse.value.copy(r.color),r.emissive&&n.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(n.map.value=r.map),r.alphaMap&&(n.alphaMap.value=r.alphaMap),r.bumpMap&&(n.bumpMap.value=r.bumpMap,n.bumpScale.value=r.bumpScale,r.side===E&&(n.bumpScale.value*=-1)),r.displacementMap&&(n.displacementMap.value=r.displacementMap,n.displacementScale.value=r.displacementScale,n.displacementBias.value=r.displacementBias),r.emissiveMap&&(n.emissiveMap.value=r.emissiveMap),r.normalMap&&(n.normalMap.value=r.normalMap,n.normalScale.value.copy(r.normalScale),r.side===E&&n.normalScale.value.negate()),r.specularMap&&(n.specularMap.value=r.specularMap),r.alphaTest>0&&(n.alphaTest.value=r.alphaTest);var i,a,o=t.get(r).envMap;if(o&&(n.envMap.value=o,n.flipEnvMap.value=o.isCubeTexture&&!1===o.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;var s=!0!==e.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*s}r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity),r.map?i=r.map:r.specularMap?i=r.specularMap:r.displacementMap?i=r.displacementMap:r.normalMap?i=r.normalMap:r.bumpMap?i=r.bumpMap:r.roughnessMap?i=r.roughnessMap:r.metalnessMap?i=r.metalnessMap:r.alphaMap?i=r.alphaMap:r.emissiveMap?i=r.emissiveMap:r.clearcoatMap?i=r.clearcoatMap:r.clearcoatNormalMap?i=r.clearcoatNormalMap:r.clearcoatRoughnessMap?i=r.clearcoatRoughnessMap:r.specularIntensityMap?i=r.specularIntensityMap:r.specularColorMap?i=r.specularColorMap:r.transmissionMap?i=r.transmissionMap:r.thicknessMap?i=r.thicknessMap:r.sheenColorMap?i=r.sheenColorMap:r.sheenRoughnessMap&&(i=r.sheenRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),n.uvTransform.value.copy(i.matrix)),r.aoMap?a=r.aoMap:r.lightMap&&(a=r.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),n.uv2Transform.value.copy(a.matrix))}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,r,i,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?n(e,r):r.isMeshToonMaterial?(n(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(n(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(n(e,r),function(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap);n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap);t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,n){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===E&&e.clearcoatNormalScale.value.negate()));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=n.texture,e.transmissionSamplerSize.value.set(n.width,n.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap);t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap)}(e,r,o)):r.isMeshMatcapMaterial?(n(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?n(e,r):r.isMeshDistanceMaterial?(n(e,r),function(e,t){e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,r)):r.isMeshNormalMaterial?n(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,n,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*r,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);t.alphaTest>0&&(e.alphaTest.value=t.alphaTest);var i;t.map?i=t.map:t.alphaMap&&(i=t.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),e.uvTransform.value.copy(i.matrix))}(e,r,i,a):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);t.alphaTest>0&&(e.alphaTest.value=t.alphaTest);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Mo(){var e=kn("canvas");return e.style.display="block",e}function wo(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=void 0!==t.canvas?t.canvas:Mo(),r=void 0!==t.context?t.context:null,i=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,o=void 0!==t.antialias&&t.antialias,s=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,u=void 0!==t.powerPreference?t.powerPreference:"default",c=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;e=void 0!==t.context?r.getContextAttributes().alpha:void 0!==t.alpha&&t.alpha;var h=null,d=null,p=[],f=[];this.domElement=n,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Ce,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;var v=this,m=!1,g=0,y=0,x=null,_=-1,b=null,M=new Ft,A=new Ft,k=null,L=n.width,R=n.height,C=1,P=null,D=null,I=new Ft(0,0,L,R),N=new Ft(0,0,L,R),O=!1,z=new Ct,B=!1,F=!1,G=null,j=new Pt,X=new Ht,Y=new tt,J={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Z(){return null===x?C:1}var K,Q,$,ee,te,ne,re,ie,ae,oe,se,le,ue,ce,he,de,pe,fe,ve,me,ge,ye,xe,_e=r;function be(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=n.getContext(i,t);if(null!=a)return a}return null}try{var Me={alpha:!0,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:c};if("setAttribute"in n&&n.setAttribute("data-engine","three.js r".concat(w)),n.addEventListener("webglcontextlost",Te,!1),n.addEventListener("webglcontextrestored",Ae,!1),null===_e){var we=["webgl2","webgl","experimental-webgl"];if(!0===v.isWebGL1Renderer&&we.shift(),null===(_e=be(we,Me)))throw be(we)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===_e.getShaderPrecisionFormat&&(_e.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function Se(){K=new fi(_e),Q=new zr(_e,K,t),K.init(Q),ye=new fo(_e,K,Q),$=new ho(_e,K,Q),ee=new gi(_e),te=new Ka,ne=new po(_e,K,$,te,Q,ye,ee),re=new Qr(v),ie=new pi(v),ae=new Vt(_e,Q),xe=new Nr(_e,K,ae,Q),oe=new vi(_e,ae,ee,xe),se=new wi(_e,oe,ae,ee),ve=new Mi(_e,Q,ne),de=new Br(te),le=new Za(v,re,ie,K,Q,xe,de),ue=new bo(v,te),ce=new to,he=new so(K,Q),fe=new Ir(v,re,$,se,e,s),pe=new co(v,se,Q),me=new Or(_e,K,ee,Q),ge=new mi(_e,K,ee,Q),ee.programs=le.programs,v.capabilities=Q,v.extensions=K,v.properties=te,v.renderLists=ce,v.shadowMap=pe,v.state=$,v.info=ee}Se();var Ee=new _o(v,_e);function Te(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function Ae(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1;var e=ee.autoReset,t=pe.enabled,n=pe.autoUpdate,r=pe.needsUpdate,i=pe.type;Se(),ee.autoReset=e,pe.enabled=t,pe.autoUpdate=n,pe.needsUpdate=r,pe.type=i}function ke(e){var t=e.target;t.removeEventListener("dispose",ke),Le(t)}function Le(e){Re(e),te.remove(e)}function Re(e){var t=te.get(e).programs;void 0!==t&&(t.forEach((function(e){le.releaseProgram(e)})),e.isShaderMaterial&&le.releaseShaderCache(e))}this.xr=Ee,this.getContext=function(){return _e},this.getContextAttributes=function(){return _e.getContextAttributes()},this.forceContextLoss=function(){var e=K.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=K.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(e){void 0!==e&&(C=e,this.setSize(L,R,!1))},this.getSize=function(e){return e.set(L,R)},this.setSize=function(e,t,r){if(Ee.isPresenting)console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");else{try{L=e,R=t,n.width=Math.floor(e*C),n.height=Math.floor(t*C),!1!==r&&n.style&&(n.style.width=e+"px",n.style.height=t+"px")}catch(e){}this.setViewport(0,0,e,t)}},this.getDrawingBufferSize=function(e){return e.set(L*C,R*C).floor()},this.setDrawingBufferSize=function(e,t,r){L=e,R=t,C=r,n.width=Math.floor(e*r),n.height=Math.floor(t*r),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(M)},this.getViewport=function(e){return e.copy(I)},this.setViewport=function(e,t,n,r){e.isVector4?I.set(e.x,e.y,e.z,e.w):I.set(e,t,n,r),$.viewport(M.copy(I).multiplyScalar(C).floor())},this.getScissor=function(e){return e.copy(N)},this.setScissor=function(e,t,n,r){e.isVector4?N.set(e.x,e.y,e.z,e.w):N.set(e,t,n,r),$.scissor(A.copy(N).multiplyScalar(C).floor())},this.getScissorTest=function(){return O},this.setScissorTest=function(e){$.setScissorTest(O=e)},this.setOpaqueSort=function(e){P=e},this.setTransparentSort=function(e){D=e},this.getClearColor=function(e){return e.copy(fe.getClearColor())},this.setClearColor=function(){fe.setClearColor.apply(fe,arguments)},this.getClearAlpha=function(){return fe.getClearAlpha()},this.setClearAlpha=function(){fe.setClearAlpha.apply(fe,arguments)},this.clear=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=0;e&&(r|=16384),t&&(r|=256),n&&(r|=1024),_e.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(){n.removeEventListener("webglcontextlost",Te,!1),n.removeEventListener("webglcontextrestored",Ae,!1),ce.dispose(),he.dispose(),te.dispose(),re.dispose(),ie.dispose(),se.dispose(),xe.dispose(),le.dispose(),Ee.dispose(),Ee.removeEventListener("sessionstart",Ie),Ee.removeEventListener("sessionend",Ne),G&&(G.dispose(),G=null),Oe.stop()},this.renderBufferDirect=function(e,t,n,r,i,a){null===t&&(t=J);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=We(e,t,n,r,i);$.setMaterial(r,o);var l=n.index,u=n.attributes.position;if(null===l){if(void 0===u||0===u.count)return}else if(0===l.count)return;var c,h=1;!0===r.wireframe&&(l=oe.getWireframeAttribute(n),h=2),xe.setup(i,r,s,n,l);var d=me;null!==l&&(c=ae.get(l),(d=ge).setIndex(c));var p=null!==l?l.count:u.count,f=n.drawRange.start*h,v=n.drawRange.count*h,m=null!==a?a.start*h:0,g=null!==a?a.count*h:1/0,y=Math.max(f,m),x=Math.min(p,f+v,m+g)-1,_=Math.max(0,x-y+1);if(0!==_){if(i.isMesh)!0===r.wireframe?($.setLineWidth(r.wireframeLinewidth*Z()),d.setMode(1)):d.setMode(4);else if(i.isLine){var b=r.linewidth;void 0===b&&(b=1),$.setLineWidth(b*Z()),i.isLineSegments?d.setMode(1):i.isLineLoop?d.setMode(2):d.setMode(3)}else i.isPoints?d.setMode(0):i.isSprite&&d.setMode(4);if(i.isInstancedMesh)d.renderInstances(y,_,i.count);else if(n.isInstancedBufferGeometry){var M=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(y,_,M)}else d.render(y,_)}},this.compile=function(e,t){(d=he.get(e)).init(),f.push(d),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(d.pushLight(e),e.castShadow&&d.pushShadow(e))})),d.setupLights(v.physicallyCorrectLights),e.traverse((function(t){var n=t.material;if(n)if(Array.isArray(n))for(var r=0;r<n.length;r++){Ge(n[r],e,t)}else Ge(n,e,t)})),f.pop(),d=null};var Pe=null;function De(e){Pe&&Pe(e)}function Ie(){Oe.stop()}function Ne(){Oe.start()}var Oe=new Gt;function ze(e,t,n,r){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||z.intersectsSprite(e)){r&&Y.setFromMatrixPosition(e.matrixWorld).applyMatrix4(j);var i=se.update(e),a=e.material;a.visible&&h.push(e,i,a,n,Y.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==ee.render.frame&&(e.skeleton.update(),e.skeleton.frame=ee.render.frame),!e.frustumCulled||z.intersectsObject(e))){r&&Y.setFromMatrixPosition(e.matrixWorld).applyMatrix4(j);var o=se.update(e),s=e.material;if(Array.isArray(s))for(var l=o.groups,u=0,c=l.length;u<c;u++){var p=l[u],f=s[p.materialIndex];f&&f.visible&&h.push(e,o,f,n,Y.z,p)}else s.visible&&h.push(e,o,s,n,Y.z,null)}for(var v=e.children,m=0,g=v.length;m<g;m++)ze(v[m],t,n,r)}}function Be(e,t,n,r){var i=e.opaque,a=e.transmissive,o=e.transparent;d.setupLightsView(n),a.length>0&&Ue(i,t,n),r&&$.viewport(M.copy(r)),i.length>0&&He(i,t,n),a.length>0&&He(a,t,n),o.length>0&&He(o,t,n),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1)}function Ue(e,t,n){var r=Q.isWebGL2;null===G&&(G=new jr(1,1,{generateMipmaps:!0,type:null!==ye.convert(W)?W:H,minFilter:U,samples:r&&!0===o?4:0})),v.getDrawingBufferSize(X),r?G.setSize(X.x,X.y):G.setSize(Qe(X.x),Qe(X.y));var i=v.getRenderTarget();v.setRenderTarget(G),v.clear();var a=v.toneMapping;v.toneMapping=0,He(e,t,n),v.toneMapping=a,ne.updateMultisampleRenderTarget(G),ne.updateRenderTargetMipmap(G),v.setRenderTarget(i)}function He(e,t,n){for(var r=!0===t.isScene?t.overrideMaterial:null,i=0,a=e.length;i<a;i++){var o=e[i],s=o.object,l=o.geometry,u=null===r?o.material:r,c=o.group;s.layers.test(n.layers)&&Fe(s,t,n,l,u,c)}}function Fe(e,t,n,r,i,a){e.onBeforeRender(v,t,n,r,i,a),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),i.onBeforeRender(v,t,n,r,e,a),!0===i.transparent&&i.side===T?(i.side=E,i.needsUpdate=!0,v.renderBufferDirect(n,t,r,i,e,a),i.side=S,i.needsUpdate=!0,v.renderBufferDirect(n,t,r,i,e,a),i.side=T):v.renderBufferDirect(n,t,r,i,e,a),e.onAfterRender(v,t,n,r,i,a)}function Ge(e,t,n){!0!==t.isScene&&(t=J);var r=te.get(e),i=d.state.lights,a=d.state.shadowsArray,o=i.state.version,s=le.getParameters(e,i.state,a,t,n),l=le.getProgramCacheKey(s),u=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?ie:re).get(e.envMap||r.environment),void 0===u&&(e.addEventListener("dispose",ke),u=new Map,r.programs=u);var c=u.get(l);if(void 0!==c){if(r.currentProgram===c&&r.lightsStateVersion===o)return Ve(e,s),c}else s.uniforms=le.getUniforms(e),e.onBuild(n,s,v),e.onBeforeCompile(s,v),c=le.acquireProgram(s,l),u.set(l,c),r.uniforms=s.uniforms;var h=r.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(h.clippingPlanes=de.uniform),Ve(e,s),r.needsLights=qe(e),r.lightsStateVersion=o,r.needsLights&&(h.ambientLightColor.value=i.state.ambient,h.lightProbe.value=i.state.probe,h.directionalLights.value=i.state.directional,h.directionalLightShadows.value=i.state.directionalShadow,h.spotLights.value=i.state.spot,h.spotLightShadows.value=i.state.spotShadow,h.rectAreaLights.value=i.state.rectArea,h.ltc_1.value=i.state.rectAreaLTC1,h.ltc_2.value=i.state.rectAreaLTC2,h.pointLights.value=i.state.point,h.pointLightShadows.value=i.state.pointShadow,h.hemisphereLights.value=i.state.hemi,h.directionalShadowMap.value=i.state.directionalShadowMap,h.directionalShadowMatrix.value=i.state.directionalShadowMatrix,h.spotShadowMap.value=i.state.spotShadowMap,h.spotShadowMatrix.value=i.state.spotShadowMatrix,h.pointShadowMap.value=i.state.pointShadowMap,h.pointShadowMatrix.value=i.state.pointShadowMatrix);var p=c.getUniforms(),f=ka.seqWithValue(p.seq,h);return r.currentProgram=c,r.uniformsList=f,c}function Ve(e,t){var n=te.get(e);n.outputEncoding=t.outputEncoding,n.instancing=t.instancing,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function We(e,t,n,r,i){!0!==t.isScene&&(t=J),ne.resetTextureUnits();var a=t.fog,o=r.isMeshStandardMaterial?t.environment:null,s=null===x?v.outputEncoding:!0===x.isXRRenderTarget?x.texture.encoding:Ce,l=(r.isMeshStandardMaterial?ie:re).get(r.envMap||o),u=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!r.normalMap&&!!n.attributes.tangent,h=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,m=r.toneMapped?v.toneMapping:0,g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,y=void 0!==g?g.length:0,M=te.get(r),w=d.state.lights;if(!0===B&&(!0===F||e!==b)){var S=e===b&&r.id===_;de.setState(r,e,S)}var E=!1;r.version===M.__version?M.needsLights&&M.lightsStateVersion!==w.state.version||M.outputEncoding!==s||i.isInstancedMesh&&!1===M.instancing?E=!0:i.isInstancedMesh||!0!==M.instancing?i.isSkinnedMesh&&!1===M.skinning?E=!0:i.isSkinnedMesh||!0!==M.skinning?M.envMap!==l||r.fog&&M.fog!==a?E=!0:void 0===M.numClippingPlanes||M.numClippingPlanes===de.numPlanes&&M.numIntersection===de.numIntersection?(M.vertexAlphas!==u||M.vertexTangents!==c||M.morphTargets!==h||M.morphNormals!==p||M.morphColors!==f||M.toneMapping!==m||!0===Q.isWebGL2&&M.morphTargetsCount!==y)&&(E=!0):E=!0:E=!0:E=!0:(E=!0,M.__version=r.version);var T=M.currentProgram;!0===E&&(T=Ge(r,t,i));var A=!1,k=!1,L=!1,P=T.getUniforms(),D=M.uniforms;if($.useProgram(T.program)&&(A=!0,k=!0,L=!0),r.id!==_&&(_=r.id,k=!0),A||b!==e){if(P.setValue(_e,"projectionMatrix",e.projectionMatrix),Q.logarithmicDepthBuffer&&P.setValue(_e,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),b!==e&&(b=e,k=!0,L=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){var I=P.map.cameraPosition;void 0!==I&&I.setValue(_e,Y.setFromMatrixPosition(e.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&P.setValue(_e,"isOrthographic",!0===e.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&P.setValue(_e,"viewMatrix",e.matrixWorldInverse)}if(i.isSkinnedMesh){P.setOptional(_e,i,"bindMatrix"),P.setOptional(_e,i,"bindMatrixInverse");var N=i.skeleton;N&&(Q.floatVertexTextures?(null===N.boneTexture&&N.computeBoneTexture(),P.setValue(_e,"boneTexture",N.boneTexture,ne),P.setValue(_e,"boneTextureSize",N.boneTextureSize)):P.setOptional(_e,N,"boneMatrices"))}var O=n.morphAttributes;return(void 0!==O.position||void 0!==O.normal||void 0!==O.color&&!0===Q.isWebGL2)&&ve.update(i,n,r,T),(k||M.receiveShadow!==i.receiveShadow)&&(M.receiveShadow=i.receiveShadow,P.setValue(_e,"receiveShadow",i.receiveShadow)),k&&(P.setValue(_e,"toneMappingExposure",v.toneMappingExposure),M.needsLights&&je(D,L),a&&r.fog&&ue.refreshFogUniforms(D,a),ue.refreshMaterialUniforms(D,r,C,R,G),ka.upload(_e,M.uniformsList,D,ne)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(ka.upload(_e,M.uniformsList,D,ne),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&P.setValue(_e,"center",i.center),P.setValue(_e,"modelViewMatrix",i.modelViewMatrix),P.setValue(_e,"normalMatrix",i.normalMatrix),P.setValue(_e,"modelMatrix",i.matrixWorld),T}function je(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}function qe(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}Oe.setAnimationLoop(De),"undefined"!=typeof self&&Oe.setContext(self),this.setAnimationLoop=function(e){Pe=e,Ee.setAnimationLoop(e),null===e?Oe.stop():Oe.start()},Ee.addEventListener("sessionstart",Ie),Ee.addEventListener("sessionend",Ne),this.render=function(e,t){if(void 0===t||!0===t.isCamera){if(!0!==m){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),!0===Ee.enabled&&!0===Ee.isPresenting&&(!0===Ee.cameraAutoUpdate&&Ee.updateCamera(t),t=Ee.getCamera()),!0===e.isScene&&e.onBeforeRender(v,e,t,x),(d=he.get(e,f.length)).init(),f.push(d),j.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),z.setFromProjectionMatrix(j),F=this.localClippingEnabled,B=de.init(this.clippingPlanes,F,t),(h=ce.get(e,p.length)).init(),p.push(h),ze(e,t,0,v.sortObjects),h.finish(),!0===v.sortObjects&&h.sort(P,D),!0===B&&de.beginShadows();var n=d.state.shadowsArray;if(pe.render(n,e,t),!0===B&&de.endShadows(),!0===this.info.autoReset&&this.info.reset(),fe.render(h,e),d.setupLights(v.physicallyCorrectLights),t.isArrayCamera)for(var r=t.cameras,i=0,a=r.length;i<a;i++){var o=r[i];Be(h,e,o,o.viewport)}else Be(h,e,t);null!==x&&(ne.updateMultisampleRenderTarget(x),ne.updateRenderTargetMipmap(x)),!0===e.isScene&&e.onAfterRender(v,e,t),xe.resetDefaultState(),_=-1,b=null,f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),h=p.length>0?p[p.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return g},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return x},this.setRenderTargetTextures=function(e,t,n){te.get(e.texture).__webglTexture=t,te.get(e.depthTexture).__webglTexture=n;var r=te.get(e);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0===K.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){var n=te.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;x=e,g=t,y=n;var r=!0;if(e){var i=te.get(e);void 0!==i.__useDefaultFramebuffer?($.bindFramebuffer(36160,null),r=!1):void 0===i.__webglFramebuffer?ne.setupRenderTarget(e):i.__hasExternalTextures&&ne.rebindTextures(e,te.get(e.texture).__webglTexture,te.get(e.depthTexture).__webglTexture)}var a=null,o=!1,s=!1;if(e){var l=e.texture;(l.isData3DTexture||l.isDataArrayTexture)&&(s=!0);var u=te.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=u[t],o=!0):a=Q.isWebGL2&&e.samples>0&&!1===ne.useMultisampledRTT(e)?te.get(e).__webglMultisampledFramebuffer:u,M.copy(e.viewport),A.copy(e.scissor),k=e.scissorTest}else M.copy(I).multiplyScalar(C).floor(),A.copy(N).multiplyScalar(C).floor(),k=O;var c=$.bindFramebuffer(36160,a);if(c&&Q.drawBuffers&&r&&$.drawBuffers(e,a),$.viewport(M),$.scissor(A),$.setScissorTest(k),o){var h=te.get(e.texture);_e.framebufferTexture2D(36160,36064,34069+t,h.__webglTexture,n)}else if(s){var d=te.get(e.texture),p=t||0;_e.framebufferTextureLayer(36160,36064,d.__webglTexture,n||0,p)}_=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o){if(e&&e.isWebGLRenderTarget){var s=te.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){$.bindFramebuffer(36160,s);try{var l=e.texture,u=l.format,c=l.type;if(u!==q&&ye.convert(u)!==_e.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===W&&(K.has("EXT_color_buffer_half_float")||Q.isWebGL2&&K.has("EXT_color_buffer_float"));if(!(c===H||ye.convert(c)===_e.getParameter(35738)||c===V&&(Q.isWebGL2||K.has("OES_texture_float")||K.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&_e.readPixels(t,n,r,i,ye.convert(u),ye.convert(c),a)}finally{var d=null!==x?te.get(x).__webglFramebuffer:null;$.bindFramebuffer(36160,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!0===t.isFramebufferTexture){var r=Math.pow(2,-n),i=Math.floor(t.image.width*r),a=Math.floor(t.image.height*r);ne.setTexture2D(t,0),_e.copyTexSubImage2D(3553,n,0,0,e.x,e.y,i,a),$.unbindTexture()}else console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.")},this.copyTextureToTexture=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=t.image.width,a=t.image.height,o=ye.convert(n.format),s=ye.convert(n.type);ne.setTexture2D(n,0),_e.pixelStorei(37440,n.flipY),_e.pixelStorei(37441,n.premultiplyAlpha),_e.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?_e.texSubImage2D(3553,r,e.x,e.y,i,a,o,s,t.image.data):t.isCompressedTexture?_e.compressedTexSubImage2D(3553,r,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):_e.texSubImage2D(3553,r,e.x,e.y,o,s,t.image),0===r&&n.generateMipmaps&&_e.generateMipmap(3553),$.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(v.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,l=e.max.z-e.min.z+1,u=ye.convert(r.format),c=ye.convert(r.type);if(r.isData3DTexture)ne.setTexture3D(r,0),a=32879;else{if(!r.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");ne.setTexture2DArray(r,0),a=35866}_e.pixelStorei(37440,r.flipY),_e.pixelStorei(37441,r.premultiplyAlpha),_e.pixelStorei(3317,r.unpackAlignment);var h=_e.getParameter(3314),d=_e.getParameter(32878),p=_e.getParameter(3316),f=_e.getParameter(3315),m=_e.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;_e.pixelStorei(3314,g.width),_e.pixelStorei(32878,g.height),_e.pixelStorei(3316,e.min.x),_e.pixelStorei(3315,e.min.y),_e.pixelStorei(32877,e.min.z),n.isDataTexture||n.isData3DTexture?_e.texSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,c,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),_e.compressedTexSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,g.data)):_e.texSubImage3D(a,i,t.x,t.y,t.z,o,s,l,u,c,g),_e.pixelStorei(3314,h),_e.pixelStorei(32878,d),_e.pixelStorei(3316,p),_e.pixelStorei(3315,f),_e.pixelStorei(32877,m),0===i&&r.generateMipmaps&&_e.generateMipmap(a),$.unbindTexture()}},this.initTexture=function(e){ne.setTexture2D(e,0),$.unbindTexture()},this.resetState=function(){g=0,y=0,x=null,$.reset(),xe.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}wo.prototype.isWebGLRenderer=!0;var So=function(e){d(n,e);var t=f(n);function n(){var e;return _(this,n),(e=t.call(this)).type="Scene",e.background=null,e.environment=null,e.fog=null,e.overrideMaterial=null,e.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:m(e)})),e}return M(n,[{key:"copy",value:function(e,t){return c(g(n.prototype),"copy",this).call(this,e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}},{key:"toJSON",value:function(e){var t=c(g(n.prototype),"toJSON",this).call(this,e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}]),n}(Tn);So.prototype.isScene=!0;var Eo=new tt,To=new Ft,Ao=new Ft,ko=new tt,Lo=new Pt,Ro=function(e){d(n,e);var t=f(n);function n(e,r){var i;return _(this,n),(i=t.call(this,e,r)).type="SkinnedMesh",i.bindMode="attached",i.bindMatrix=new Pt,i.bindMatrixInverse=new Pt,i}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}},{key:"bind",value:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}},{key:"pose",value:function(){this.skeleton.pose()}},{key:"normalizeSkinWeights",value:function(){for(var e=new Ft,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,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)}}},{key:"updateMatrixWorld",value:function(e){c(g(n.prototype),"updateMatrixWorld",this).call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}},{key:"boneTransform",value:function(e,t){var n=this.skeleton,r=this.geometry;To.fromBufferAttribute(r.attributes.skinIndex,e),Ao.fromBufferAttribute(r.attributes.skinWeight,e),Eo.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var i=0;i<4;i++){var a=Ao.getComponent(i);if(0!==a){var o=To.getComponent(i);Lo.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(ko.copy(Eo).applyMatrix4(Lo),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}]),n}(kr);Ro.prototype.isSkinnedMesh=!0;var Co=function(e){d(n,e);var t=f(n);function n(){var e;return _(this,n),(e=t.call(this)).type="Bone",e}return M(n)}(Tn);Co.prototype.isBone=!0;var Po=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,l=arguments.length>5?arguments[5]:void 0,u=arguments.length>6?arguments[6]:void 0,c=arguments.length>7?arguments[7]:void 0,h=arguments.length>8&&void 0!==arguments[8]?arguments[8]:I,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:I,p=arguments.length>10?arguments[10]:void 0,f=arguments.length>11?arguments[11]:void 0;return _(this,n),(e=t.call(this,null,l,u,c,h,d,o,s,p,f)).image={data:r,width:i,height:a},e.generateMipmaps=!1,e.flipY=!1,e.unpackAlignment=1,e}return M(n)}(Wr);Po.prototype.isDataTexture=!0;var Do=new Pt,Io=new Pt,No=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];_(this,e),this.uuid=qe(),this.bones=t.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}return M(e,[{key:"init",value:function(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new Pt)}}},{key:"calculateInverses",value:function(){this.boneInverses.length=0;for(var e=0,t=this.bones.length;e<t;e++){var n=new Pt;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}},{key:"pose",value:function(){for(var e=0,t=this.bones.length;e<t;e++){var n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(var r=0,i=this.bones.length;r<i;r++){var a=this.bones[r];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}}},{key:"update",value: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:Io;Do.multiplyMatrices(o,t[i]),Do.toArray(n,16*i)}null!==r&&(r.needsUpdate=!0)}},{key:"clone",value:function(){return new e(this.bones,this.boneInverses)}},{key:"computeBoneTexture",value:function(){var e=Math.sqrt(4*this.bones.length);e=Ke(e),e=Math.max(e,4);var t=new Float32Array(e*e*4);t.set(this.boneMatrices);var n=new Po(t,e,e,q,V);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this.boneTextureSize=e,this}},{key:"getBoneByName",value:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}}},{key:"dispose",value:function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}},{key:"fromJSON",value:function(e,t){this.uuid=e.uuid;for(var n=0,r=e.bones.length;n<r;n++){var i=e.bones[n],a=t[i];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),a=new Co),this.bones.push(a),this.boneInverses.push((new Pt).fromArray(e.boneInverses[n]))}return this.init(),this}},{key:"toJSON",value:function(){var e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;for(var t=this.bones,n=this.boneInverses,r=0,i=t.length;r<i;r++){var a=t[r];e.bones.push(a.uuid);var o=n[r];e.boneInverses.push(o.toArray())}return e}}]),e}(),Oo=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="LineBasicMaterial",r.color=new tn(16777215),r.linewidth=1,r.linecap="round",r.linejoin="round",r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}}]),n}(Hn);Oo.prototype.isLineBasicMaterial=!0;var zo=new tt,Bo=new tt,Uo=new Pt,Ho=new Qn,Fo=new wt,Go=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new On,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Oo;return _(this,n),(e=t.call(this)).type="Line",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.material=e.material,this.geometry=e.geometry,this}},{key:"computeLineDistances",value: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++)zo.fromBufferAttribute(t,r-1),Bo.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=zo.distanceTo(Bo);e.setAttribute("lineDistance",new ln(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Fo.copy(n.boundingSphere),Fo.applyMatrix4(r),Fo.radius+=i,!1!==e.ray.intersectsSphere(Fo)){Uo.copy(r).invert(),Ho.copy(e.ray).applyMatrix4(Uo);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,l=new tt,u=new tt,c=new tt,h=new tt,d=this.isLineSegments?2:1;if(n.isBufferGeometry){var p=n.index,f=n.attributes.position;if(null!==p)for(var v=Math.max(0,a.start),m=Math.min(p.count,a.start+a.count)-1;v<m;v+=d){var g=p.getX(v),y=p.getX(v+1);if(l.fromBufferAttribute(f,g),u.fromBufferAttribute(f,y),!(Ho.distanceSqToSegment(l,u,h,c)>s)){h.applyMatrix4(this.matrixWorld);var x=e.ray.origin.distanceTo(h);x<e.near||x>e.far||t.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else for(var _=Math.max(0,a.start),b=Math.min(f.count,a.start+a.count)-1;_<b;_+=d){if(l.fromBufferAttribute(f,_),u.fromBufferAttribute(f,_+1),!(Ho.distanceSqToSegment(l,u,h,c)>s)){h.applyMatrix4(this.matrixWorld);var M=e.ray.origin.distanceTo(h);M<e.near||M>e.far||t.push({distance:M,point:c.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}},{key:"updateMorphTargets",value:function(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(n.length>0){var r=t[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=e.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}]),n}(Tn);Go.prototype.isLine=!0;var Vo=function(e){d(n,e);var t=f(n);function n(e,r){var i;return _(this,n),(i=t.call(this,e,r)).type="LineLoop",i}return M(n)}(Go);Vo.prototype.isLineLoop=!0,function(e){d(n,e);var t=f(n);function n(e,r,i,a,o,s,l,u,c){var h;return _(this,n),(h=t.call(this,e,r,i,a,o,s,l,u,c)).needsUpdate=!0,h}return M(n)}(Wr).prototype.isCanvasTexture=!0;var Wo=function(){function e(){_(this,e),this.type="Curve",this.arcLengthDivisions=200}return M(e,[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)}},{key:"getPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}},{key:"getLength",value:function(){var e=this.getLengths();return e[e.length-1]}},{key:"getLengths",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n=[],r=this.getPoint(0),i=0;n.push(0);for(var a=1;a<=e;a++)i+=(t=this.getPoint(a/e)).distanceTo(r),n.push(i),r=t;return this.cacheArcLengths=n,n}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.getLengths()}},{key:"getUtoTmapping",value:function(e,t){var n,r=this.getLengths(),i=0,a=r.length;n=t||e*r[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=r[i=Math.floor(s+(l-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(r[i=l]===n)return i/(a-1);var u=r[i];return(i+(n-u)/(r[i+1]-u))/(a-1)}},{key:"getTangent",value:function(e,t){var n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new Ht:new tt);return s.copy(o).sub(a).normalize(),s}},{key:"getTangentAt",value:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)}},{key:"computeFrenetFrames",value:function(e,t){for(var n=new tt,r=[],i=[],a=[],o=new tt,s=new Pt,l=0;l<=e;l++){var u=l/e;r[l]=this.getTangentAt(u,new tt)}i[0]=new tt,a[0]=new tt;var c=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),p<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(var f=1;f<=e;f++){if(i[f]=i[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(r[f-1],r[f]),o.length()>Number.EPSILON){o.normalize();var v=Math.acos(Xe(r[f-1].dot(r[f]),-1,1));i[f].applyMatrix4(s.makeRotationAxis(o,v))}a[f].crossVectors(r[f],i[f])}if(!0===t){var m=Math.acos(Xe(i[0].dot(i[e]),-1,1));m/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(m=-m);for(var g=1;g<=e;g++)i[g].applyMatrix4(s.makeRotationAxis(r[g],m*g)),a[g].crossVectors(r[g],i[g])}return{tangents:r,normals:i,binormals:a}}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},{key:"toJSON",value:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}},{key:"fromJSON",value:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}]),e}(),jo=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI,u=arguments.length>6&&void 0!==arguments[6]&&arguments[6],c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;return _(this,n),(e=t.call(this)).type="EllipseCurve",e.aX=r,e.aY=i,e.xRadius=a,e.yRadius=o,e.aStartAngle=s,e.aEndAngle=l,e.aClockwise=u,e.aRotation=c,e}return M(n,[{key:"getPoint",value:function(e,t){for(var n=t||new Ht,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),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var u=Math.cos(this.aRotation),c=Math.sin(this.aRotation),h=s-this.aX,d=l-this.aY;s=h*u-d*c+this.aX,l=h*c+d*u+this.aY}return n.set(s,l)}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).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}},{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).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}},{key:"fromJSON",value:function(e){return c(g(n.prototype),"fromJSON",this).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}}]),n}(Wo);jo.prototype.isEllipseCurve=!0;var qo=function(e){d(n,e);var t=f(n);function n(e,r,i,a,o,s){var l;return _(this,n),(l=t.call(this,e,r,i,i,a,o,s)).type="ArcCurve",l}return M(n)}(jo);function Xo(){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 l=(t-e)/a-(n-e)/(a+o)+(n-t)/o,u=(n-t)/o-(r-t)/(o+s)+(r-n)/s;i(t,n,l*=o,u*=o)},calc:function(i){var a=i*i;return e+t*i+n*a+r*(a*i)}}}qo.prototype.isArcCurve=!0;var Yo=new tt,Jo=new Xo,Zo=new Xo,Ko=new Xo,Qo=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"centripetal",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;return _(this,n),(e=t.call(this)).type="CatmullRomCurve3",e.points=r,e.closed=i,e.curveType=a,e.tension=o,e}return M(n,[{key:"getPoint",value:function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new tt,i=r,a=this.points,o=a.length,s=(o-(this.closed?0:1))*e,l=Math.floor(s),u=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:0===u&&l===o-1&&(l=o-2,u=1),this.closed||l>0?t=a[(l-1)%o]:(Yo.subVectors(a[0],a[1]).add(a[0]),t=Yo);var c=a[l%o],h=a[(l+1)%o];if(this.closed||l+2<o?n=a[(l+2)%o]:(Yo.subVectors(a[o-1],a[o-2]).add(a[o-1]),n=Yo),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(t.distanceToSquared(c),d),f=Math.pow(c.distanceToSquared(h),d),v=Math.pow(h.distanceToSquared(n),d);f<1e-4&&(f=1),p<1e-4&&(p=f),v<1e-4&&(v=f),Jo.initNonuniformCatmullRom(t.x,c.x,h.x,n.x,p,f,v),Zo.initNonuniformCatmullRom(t.y,c.y,h.y,n.y,p,f,v),Ko.initNonuniformCatmullRom(t.z,c.z,h.z,n.z,p,f,v)}else"catmullrom"===this.curveType&&(Jo.initCatmullRom(t.x,c.x,h.x,n.x,this.tension),Zo.initCatmullRom(t.y,c.y,h.y,n.y,this.tension),Ko.initCatmullRom(t.z,c.z,h.z,n.z,this.tension));return i.set(Jo.calc(u),Zo.calc(u),Ko.calc(u)),i}},{key:"copy",value:function(e){c(g(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}},{key:"fromJSON",value:function(e){c(g(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push((new tt).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}]),n}(Wo);function $o(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 es(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 ts(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)}Qo.prototype.isCatmullRomCurve3=!0;var ns=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ht,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ht,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Ht,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Ht;return _(this,n),(e=t.call(this)).type="CubicBezierCurve",e.v0=r,e.v1=i,e.v2=a,e.v3=o,e}return M(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ht,n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ts(e,r.x,i.x,a.x,o.x),ts(e,r.y,i.y,a.y,o.y)),n}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return c(g(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(Wo);ns.prototype.isCubicBezierCurve=!0;var rs=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new tt,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new tt,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new tt,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new tt;return _(this,n),(e=t.call(this)).type="CubicBezierCurve3",e.v0=r,e.v1=i,e.v2=a,e.v3=o,e}return M(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new tt,n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ts(e,r.x,i.x,a.x,o.x),ts(e,r.y,i.y,a.y,o.y),ts(e,r.z,i.z,a.z,o.z)),n}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}},{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}},{key:"fromJSON",value:function(e){return c(g(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}]),n}(Wo);rs.prototype.isCubicBezierCurve3=!0;var is=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ht,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ht;return _(this,n),(e=t.call(this)).type="LineCurve",e.v1=r,e.v2=i,e}return M(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ht,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"getTangent",value:function(e,t){var n=t||new Ht;return n.copy(this.v2).sub(this.v1).normalize(),n}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return c(g(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Wo);is.prototype.isLineCurve=!0;var as=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new tt,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new tt;return _(this,n),(e=t.call(this)).type="LineCurve3",e.isLineCurve3=!0,e.v1=r,e.v2=i,e}return M(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new tt,n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}},{key:"getPointAt",value:function(e,t){return this.getPoint(e,t)}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return c(g(n.prototype),"fromJSON",this).call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Wo),os=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ht,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ht,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Ht;return _(this,n),(e=t.call(this)).type="QuadraticBezierCurve",e.v0=r,e.v1=i,e.v2=a,e}return M(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ht,n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(es(e,r.x,i.x,a.x),es(e,r.y,i.y,a.y)),n}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return c(g(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Wo);os.prototype.isQuadraticBezierCurve=!0;var ss=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new tt,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new tt,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new tt;return _(this,n),(e=t.call(this)).type="QuadraticBezierCurve3",e.v0=r,e.v1=i,e.v2=a,e}return M(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new tt,n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(es(e,r.x,i.x,a.x),es(e,r.y,i.y,a.y),es(e,r.z,i.z,a.z)),n}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}},{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}},{key:"fromJSON",value:function(e){return c(g(n.prototype),"fromJSON",this).call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}]),n}(Wo);ss.prototype.isQuadraticBezierCurve3=!0;var ls=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return _(this,n),(e=t.call(this)).type="SplineCurve",e.points=r,e}return M(n,[{key:"getPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ht,n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],l=r[a],u=r[a>r.length-2?r.length-1:a+1],c=r[a>r.length-3?r.length-1:a+2];return n.set($o(o,s.x,l.x,u.x,c.x),$o(o,s.y,l.y,u.y,c.y)),n}},{key:"copy",value:function(e){c(g(n.prototype),"copy",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push(i.clone())}return this}},{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);e.points=[];for(var t=0,r=this.points.length;t<r;t++){var i=this.points[t];e.points.push(i.toArray())}return e}},{key:"fromJSON",value:function(e){c(g(n.prototype),"fromJSON",this).call(this,e),this.points=[];for(var t=0,r=e.points.length;t<r;t++){var i=e.points[t];this.points.push((new Ht).fromArray(i))}return this}}]),n}(Wo);ls.prototype.isSplineCurve=!0;var us=Object.freeze({__proto__:null,ArcCurve:qo,CatmullRomCurve3:Qo,CubicBezierCurve:ns,CubicBezierCurve3:rs,EllipseCurve:jo,LineCurve:is,LineCurve3:as,QuadraticBezierCurve:os,QuadraticBezierCurve3:ss,SplineCurve:ls}),cs=function(e){d(n,e);var t=f(n);function n(){var e;return _(this,n),(e=t.call(this)).type="CurvePath",e.curves=[],e.autoClose=!1,e}return M(n,[{key:"add",value:function(e){this.curves.push(e)}},{key:"closePath",value:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new is(t,e))}},{key:"getPoint",value:function(e,t){for(var n=e*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=n){var a=r[i]-n,o=this.curves[i],s=o.getLength(),l=0===s?0:1-a/s;return o.getPointAt(l,t)}i++}return null}},{key:"getLength",value:function(){var e=this.getCurveLengths();return e[e.length-1]}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}},{key:"getCurveLengths",value: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}},{key:"getSpacedPoints",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}},{key:"getPoints",value:function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a.isEllipseCurve?2*t:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),l=0;l<s.length;l++){var u=s[l];e&&e.equals(u)||(n.push(u),e=u)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}},{key:"copy",value:function(e){c(g(n.prototype),"copy",this).call(this,e),this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}},{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,r=this.curves.length;t<r;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e}},{key:"fromJSON",value:function(e){c(g(n.prototype),"fromJSON",this).call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,r=e.curves.length;t<r;t++){var i=e.curves[t];this.curves.push((new us[i.type]).fromJSON(i))}return this}}]),n}(Wo),hs=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="Path",r.currentPoint=new Ht,e&&r.setFromPoints(e),r}return M(n,[{key:"setFromPoints",value:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}},{key:"moveTo",value:function(e,t){return this.currentPoint.set(e,t),this}},{key:"lineTo",value:function(e,t){var n=new is(this.currentPoint.clone(),new Ht(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}},{key:"quadraticCurveTo",value:function(e,t,n,r){var i=new os(this.currentPoint.clone(),new Ht(e,t),new Ht(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}},{key:"bezierCurveTo",value:function(e,t,n,r,i,a){var o=new ns(this.currentPoint.clone(),new Ht(e,t),new Ht(n,r),new Ht(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}},{key:"splineThru",value:function(e){var t=[this.currentPoint.clone()].concat(e),n=new ls(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}},{key:"arc",value:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}},{key:"absarc",value:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}},{key:"ellipse",value:function(e,t,n,r,i,a,o,s){var l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,n,r,i,a,o,s),this}},{key:"absellipse",value:function(e,t,n,r,i,a,o,s){var l=new jo(e,t,n,r,i,a,o,s);if(this.curves.length>0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);return this.currentPoint.copy(c),this}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.currentPoint.copy(e.currentPoint),this}},{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);return e.currentPoint=this.currentPoint.toArray(),e}},{key:"fromJSON",value:function(e){return c(g(n.prototype),"fromJSON",this).call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}]),n}(cs),ds=(new tt,new tt,new tt,new ur,function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this,e)).uuid=qe(),r.type="Shape",r.holes=[],r}return M(n,[{key:"getPointsHoles",value:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}},{key:"extractPoints",value:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}},{key:"copy",value:function(e){c(g(n.prototype),"copy",this).call(this,e),this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var i=e.holes[t];this.holes.push(i.clone())}return this}},{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,r=this.holes.length;t<r;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e}},{key:"fromJSON",value:function(e){c(g(n.prototype),"fromJSON",this).call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,r=e.holes.length;t<r;t++){var i=e.holes[t];this.holes.push((new hs).fromJSON(i))}return this}}]),n}(hs)),ps=function(e,t){var n,r,i,a,o,s,l,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,h=c?t[0]*u:e.length,d=fs(e,0,h,u,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=bs(e,t,d,u)),e.length>80*u){n=i=e[0],r=a=e[1];for(var f=u;f<h;f+=u)(o=e[f])<n&&(n=o),(s=e[f+1])<r&&(r=s),o>i&&(i=o),s>a&&(a=s);l=0!==(l=Math.max(i-n,a-r))?1/l:0}return ms(d,p,u,n,r,l),p};function fs(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=Os(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Os(a,e[a],e[a+1],o);return o&&Rs(o,o.next)&&(zs(o),o=o.next),o}function vs(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!Rs(r,r.next)&&0!==Ls(r.prev,r,r.next))r=r.next;else{if(zs(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function ms(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=Es(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,l,u=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<u&&(s++,r=r.nextZ);t++);for(l=u;s>0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,u*=2}while(o>1)}(i)}(e,r,i,a);for(var s,l,u=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?ys(e,r,i,a):gs(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),zs(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?ms(e=xs(vs(e),t,n),t,n,r,i,a,2):2===o&&_s(e,t,n,r,i,a):ms(vs(e),t,n,r,i,a,1);break}}}function gs(e){var t=e.prev,n=e,r=e.next;if(Ls(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(As(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Ls(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function ys(e,t,n,r){var i=e.prev,a=e,o=e.next;if(Ls(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,l=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,u=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,h=Es(s,l,t,n,r),d=Es(u,c,t,n,r),p=e.prevZ,f=e.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&As(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Ls(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&As(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Ls(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&As(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Ls(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&As(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Ls(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function xs(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Rs(i,a)&&Cs(i,r,r.next,a)&&Is(i,a)&&Is(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),zs(r),zs(r.next),r=e=a),r=r.next}while(r!==e);return vs(r)}function _s(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&ks(o,s)){var l=Ns(o,s);return o=vs(o,o.next),l=vs(l,l.next),ms(o,t,n,r,i,a),void ms(l,t,n,r,i,a)}s=s.next}o=o.next}while(o!==e)}function bs(e,t,n,r){var i,a,o,s=[];for(i=0,a=t.length;i<a;i++)(o=fs(e,t[i]*r,i<a-1?t[i+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(Ts(o));for(s.sort(Ms),i=0;i<s.length;i++)ws(s[i],n),n=vs(n,n.next);return n}function Ms(e,t){return e.x-t.x}function ws(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;var l,u=n,c=n.x,h=n.y,d=1/0;r=n;do{i>=r.x&&r.x>=c&&i!==r.x&&As(a<h?i:o,a,c,h,a<h?o:i,a,r.x,r.y)&&(l=Math.abs(a-r.y)/(i-r.x),Is(r,e)&&(l<d||l===d&&(r.x>n.x||r.x===n.x&&Ss(n,r)))&&(n=r,d=l)),r=r.next}while(r!==u);return n}(e,t),t){var n=Ns(t,e);vs(t,t.next),vs(n,n.next)}}function Ss(e,t){return Ls(e.prev,e,t.prev)<0&&Ls(t.next,e,e.next)<0}function Es(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 Ts(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function As(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 ks(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&&Cs(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Is(e,t)&&Is(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)&&(Ls(e.prev,e,t.prev)||Ls(e,t.prev,t))||Rs(e,t)&&Ls(e.prev,e,e.next)>0&&Ls(t.prev,t,t.next)>0)}function Ls(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Rs(e,t){return e.x===t.x&&e.y===t.y}function Cs(e,t,n,r){var i=Ds(Ls(e,t,n)),a=Ds(Ls(e,t,r)),o=Ds(Ls(n,r,e)),s=Ds(Ls(n,r,t));return i!==a&&o!==s||(!(0!==i||!Ps(e,n,t))||(!(0!==a||!Ps(e,r,t))||(!(0!==o||!Ps(n,e,r))||!(0!==s||!Ps(n,t,r)))))}function Ps(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Ds(e){return e>0?1:e<0?-1:0}function Is(e,t){return Ls(e.prev,e,e.next)<0?Ls(e,t,e.next)>=0&&Ls(e,e.prev,t)>=0:Ls(e,t,e.prev)<0||Ls(e,e.next,t)<0}function Ns(e,t){var n=new Bs(e.i,e.x,e.y),r=new Bs(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 Os(e,t,n,r){var i=new Bs(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 zs(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 Bs(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 Us=function(){function e(){_(this,e)}return M(e,null,[{key:"area",value: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}},{key:"isClockWise",value:function(t){return e.area(t)<0}},{key:"triangulateShape",value:function(e,t){var n=[],r=[],i=[];Hs(e),Fs(n,e);var a=e.length;t.forEach(Hs);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Fs(n,t[o]);for(var s=ps(n,r),l=0;l<s.length;l+=3)i.push(s.slice(l,l+3));return i}}]),e}();function Hs(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Fs(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var Gs=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ds([new Ht(.5,.5),new Ht(-.5,.5),new Ht(-.5,-.5),new Ht(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_(this,n),(e=t.call(this)).type="ExtrudeGeometry",e.parameters={shapes:r,options:i},r=Array.isArray(r)?r:[r];for(var a=m(e),o=[],s=[],l=0,u=r.length;l<u;l++){var c=r[l];h(c)}function h(e){var t=[],n=void 0!==i.curveSegments?i.curveSegments:12,r=void 0!==i.steps?i.steps:1,l=void 0!==i.depth?i.depth:1,u=void 0===i.bevelEnabled||i.bevelEnabled,c=void 0!==i.bevelThickness?i.bevelThickness:.2,h=void 0!==i.bevelSize?i.bevelSize:c-.1,d=void 0!==i.bevelOffset?i.bevelOffset:0,p=void 0!==i.bevelSegments?i.bevelSegments:3,f=i.extrudePath,v=void 0!==i.UVGenerator?i.UVGenerator:Vs;void 0!==i.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=i.amount);var m,g,y,x,_,b=!1;f&&(m=f.getSpacedPoints(r),b=!0,u=!1,g=f.computeFrenetFrames(r,!1),y=new tt,x=new tt,_=new tt),u||(p=0,c=0,h=0,d=0);var M=e.extractPoints(n),w=M.shape,S=M.holes;if(!Us.isClockWise(w)){w=w.reverse();for(var E=0,T=S.length;E<T;E++){var A=S[E];Us.isClockWise(A)&&(S[E]=A.reverse())}}for(var k=Us.triangulateShape(w,S),L=w,R=0,C=S.length;R<C;R++){var P=S[R];w=w.concat(P)}function D(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var I=w.length,N=k.length;function O(e,t,n){var r,i,a,o=e.x-t.x,s=e.y-t.y,l=n.x-e.x,u=n.y-e.y,c=o*o+s*s,h=o*u-s*l;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(c),p=Math.sqrt(l*l+u*u),f=t.x-s/d,v=t.y+o/d,m=((n.x-u/p-f)*u-(n.y+l/p-v)*l)/(o*u-s*l),g=(r=f+o*m-e.x)*r+(i=v+s*m-e.y)*i;if(g<=2)return new Ht(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(u)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(c)):(r=o,i=s,a=Math.sqrt(c/2))}return new Ht(r/a,i/a)}for(var z=[],B=0,U=L.length,H=U-1,F=B+1;B<U;B++,H++,F++)H===U&&(H=0),F===U&&(F=0),z[B]=O(L[B],L[H],L[F]);for(var G,V=[],W=z.concat(),j=0,q=S.length;j<q;j++){var X=S[j];G=[];for(var Y=0,J=X.length,Z=J-1,K=Y+1;Y<J;Y++,Z++,K++)Z===J&&(Z=0),K===J&&(K=0),G[Y]=O(X[Y],X[Z],X[K]);V.push(G),W=W.concat(G)}for(var Q=0;Q<p;Q++){for(var $=Q/p,ee=c*Math.cos($*Math.PI/2),te=h*Math.sin($*Math.PI/2)+d,ne=0,re=L.length;ne<re;ne++){var ie=D(L[ne],z[ne],te);Ce(ie.x,ie.y,-ee)}for(var ae=0,oe=S.length;ae<oe;ae++){var se=S[ae];G=V[ae];for(var le=0,ue=se.length;le<ue;le++){var ce=D(se[le],G[le],te);Ce(ce.x,ce.y,-ee)}}}for(var he=h+d,de=0;de<I;de++){var pe=u?D(w[de],W[de],he):w[de];b?(x.copy(g.normals[0]).multiplyScalar(pe.x),y.copy(g.binormals[0]).multiplyScalar(pe.y),_.copy(m[0]).add(x).add(y),Ce(_.x,_.y,_.z)):Ce(pe.x,pe.y,0)}for(var fe=1;fe<=r;fe++)for(var ve=0;ve<I;ve++){var me=u?D(w[ve],W[ve],he):w[ve];b?(x.copy(g.normals[fe]).multiplyScalar(me.x),y.copy(g.binormals[fe]).multiplyScalar(me.y),_.copy(m[fe]).add(x).add(y),Ce(_.x,_.y,_.z)):Ce(me.x,me.y,l/r*fe)}for(var ge=p-1;ge>=0;ge--){for(var ye=ge/p,xe=c*Math.cos(ye*Math.PI/2),_e=h*Math.sin(ye*Math.PI/2)+d,be=0,Me=L.length;be<Me;be++){var we=D(L[be],z[be],_e);Ce(we.x,we.y,l+xe)}for(var Se=0,Ee=S.length;Se<Ee;Se++){var Te=S[Se];G=V[Se];for(var Ae=0,ke=Te.length;Ae<ke;Ae++){var Le=D(Te[Ae],G[Ae],_e);b?Ce(Le.x,Le.y+m[r-1].y,m[r-1].x+xe):Ce(Le.x,Le.y,l+xe)}}}function Re(e,t){for(var n=e.length;--n>=0;){var i=n,a=n-1;a<0&&(a=e.length-1);for(var o=0,s=r+2*p;o<s;o++){var l=I*o,u=I*(o+1);De(t+i+l,t+a+l,t+a+u,t+i+u)}}}function Ce(e,n,r){t.push(e),t.push(n),t.push(r)}function Pe(e,t,n){Ie(e),Ie(t),Ie(n);var r=o.length/3,i=v.generateTopUV(a,o,r-3,r-2,r-1);Ne(i[0]),Ne(i[1]),Ne(i[2])}function De(e,t,n,r){Ie(e),Ie(t),Ie(r),Ie(t),Ie(n),Ie(r);var i=o.length/3,s=v.generateSideWallUV(a,o,i-6,i-3,i-2,i-1);Ne(s[0]),Ne(s[1]),Ne(s[3]),Ne(s[1]),Ne(s[2]),Ne(s[3])}function Ie(e){o.push(t[3*e+0]),o.push(t[3*e+1]),o.push(t[3*e+2])}function Ne(e){s.push(e.x),s.push(e.y)}!function(){var e=o.length/3;if(u){for(var t=0,n=I*t,i=0;i<N;i++){var s=k[i];Pe(s[2]+n,s[1]+n,s[0]+n)}n=I*(t=r+2*p);for(var l=0;l<N;l++){var c=k[l];Pe(c[0]+n,c[1]+n,c[2]+n)}}else{for(var h=0;h<N;h++){var d=k[h];Pe(d[2],d[1],d[0])}for(var f=0;f<N;f++){var v=k[f];Pe(v[0]+I*r,v[1]+I*r,v[2]+I*r)}}a.addGroup(e,o.length/3-e,0)}(),function(){var e=o.length/3,t=0;Re(L,t),t+=L.length;for(var n=0,r=S.length;n<r;n++){var i=S[n];Re(i,t),t+=i.length}a.addGroup(e,o.length/3-e,1)}()}return e.setAttribute("position",new ln(o,3)),e.setAttribute("uv",new ln(s,2)),e.computeVertexNormals(),e}return M(n,[{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);return function(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);void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,e)}}],[{key:"fromJSON",value:function(e,t){for(var r=[],i=0,a=e.shapes.length;i<a;i++){var o=t[e.shapes[i]];r.push(o)}var s=e.options.extrudePath;return void 0!==s&&(e.options.extrudePath=(new us[s.type]).fromJSON(s)),new n(r,e.options)}}]),n}(On),Vs={generateTopUV:function(e,t,n,r,i){var a=t[3*n],o=t[3*n+1],s=t[3*r],l=t[3*r+1],u=t[3*i],c=t[3*i+1];return[new Ht(a,o),new Ht(s,l),new Ht(u,c)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[3*n],s=t[3*n+1],l=t[3*n+2],u=t[3*r],c=t[3*r+1],h=t[3*r+2],d=t[3*i],p=t[3*i+1],f=t[3*i+2],v=t[3*a],m=t[3*a+1],g=t[3*a+2];return Math.abs(s-c)<Math.abs(o-u)?[new Ht(o,1-l),new Ht(u,1-h),new Ht(d,1-f),new Ht(v,1-g)]:[new Ht(s,1-l),new Ht(c,1-h),new Ht(p,1-f),new Ht(m,1-g)]}};var Ws=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ds([new Ht(0,.5),new Ht(-.5,-.5),new Ht(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;_(this,n),(e=t.call(this)).type="ShapeGeometry",e.parameters={shapes:r,curveSegments:i};var a=[],o=[],s=[],l=[],u=0,c=0;if(!1===Array.isArray(r))d(r);else for(var h=0;h<r.length;h++)d(r[h]),e.addGroup(u,c,h),u+=c,c=0;function d(e){var t=o.length/3,n=e.extractPoints(i),r=n.shape,u=n.holes;!1===Us.isClockWise(r)&&(r=r.reverse());for(var h=0,d=u.length;h<d;h++){var p=u[h];!0===Us.isClockWise(p)&&(u[h]=p.reverse())}for(var f=Us.triangulateShape(r,u),v=0,m=u.length;v<m;v++){var g=u[v];r=r.concat(g)}for(var y=0,x=r.length;y<x;y++){var _=r[y];o.push(_.x,_.y,0),s.push(0,0,1),l.push(_.x,_.y)}for(var b=0,M=f.length;b<M;b++){var w=f[b],S=w[0]+t,E=w[1]+t,T=w[2]+t;a.push(S,E,T),c+=3}}return e.setIndex(a),e.setAttribute("position",new ln(o,3)),e.setAttribute("normal",new ln(s,3)),e.setAttribute("uv",new ln(l,2)),e}return M(n,[{key:"toJSON",value:function(){var e=c(g(n.prototype),"toJSON",this).call(this);return function(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}(this.parameters.shapes,e)}}],[{key:"fromJSON",value:function(e,t){for(var r=[],i=0,a=e.shapes.length;i<a;i++){var o=t[e.shapes[i]];r.push(o)}return new n(r,e.curveSegments)}}]),n}(On);var js=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="ShadowMaterial",r.color=new tn(0),r.transparent=!0,r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this}}]),n}(Hn);js.prototype.isShadowMaterial=!0;var qs=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="SpriteMaterial",r.color=new tn(16777215),r.map=null,r.alphaMap=null,r.rotation=0,r.sizeAttenuation=!0,r.transparent=!0,r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}}]),n}(Hn);qs.prototype.isSpriteMaterial=!0;var Xs=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this,e)).type="RawShaderMaterial",r}return M(n)}(Wn);Xs.prototype.isRawShaderMaterial=!0;var Ys=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="PointsMaterial",r.color=new tn(16777215),r.map=null,r.alphaMap=null,r.size=1,r.sizeAttenuation=!0,r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this}}]),n}(Hn);Ys.prototype.isPointsMaterial=!0;var Js=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).defines={STANDARD:""},r.type="MeshStandardMaterial",r.color=new tn(16777215),r.roughness=1,r.metalness=0,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new tn(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=De,r.normalScale=new Ht(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.roughnessMap=null,r.metalnessMap=null,r.alphaMap=null,r.envMap=null,r.envMapIntensity=1,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}}]),n}(Hn);Js.prototype.isMeshStandardMaterial=!0;var Zs=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).defines={STANDARD:"",PHYSICAL:""},r.type="MeshPhysicalMaterial",r.clearcoatMap=null,r.clearcoatRoughness=0,r.clearcoatRoughnessMap=null,r.clearcoatNormalScale=new Ht(1,1),r.clearcoatNormalMap=null,r.ior=1.5,Object.defineProperty(m(r),"reflectivity",{get:function(){return Xe(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),r.sheenColor=new tn(0),r.sheenColorMap=null,r.sheenRoughness=1,r.sheenRoughnessMap=null,r.transmissionMap=null,r.thickness=0,r.thicknessMap=null,r.attenuationDistance=0,r.attenuationColor=new tn(1,1,1),r.specularIntensity=1,r.specularIntensityMap=null,r.specularColor=new tn(1,1,1),r.specularColorMap=null,r._sheen=0,r._clearcoat=0,r._transmission=0,r.setValues(e),r}return M(n,[{key:"sheen",get:function(){return this._sheen},set:function(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}},{key:"clearcoat",get:function(){return this._clearcoat},set:function(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}},{key:"transmission",get:function(){return this._transmission},set:function(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}]),n}(Js);Zs.prototype.isMeshPhysicalMaterial=!0;var Ks=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="MeshPhongMaterial",r.color=new tn(16777215),r.specular=new tn(1118481),r.shininess=30,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new tn(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=De,r.normalScale=new Ht(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=0,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).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.flatShading=e.flatShading,this}}]),n}(Hn);Ks.prototype.isMeshPhongMaterial=!0;var Qs=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).defines={TOON:""},r.type="MeshToonMaterial",r.color=new tn(16777215),r.map=null,r.gradientMap=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new tn(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=De,r.normalScale=new Ht(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}}]),n}(Hn);Qs.prototype.isMeshToonMaterial=!0;var $s=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="MeshNormalMaterial",r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=De,r.normalScale=new Ht(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.fog=!1,r.flatShading=!1,r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).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.flatShading=e.flatShading,this}}]),n}(Hn);$s.prototype.isMeshNormalMaterial=!0;var el=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="MeshLambertMaterial",r.color=new tn(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new tn(0),r.emissiveIntensity=1,r.emissiveMap=null,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=0,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).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}}]),n}(Hn);el.prototype.isMeshLambertMaterial=!0;var tl=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).defines={MATCAP:""},r.type="MeshMatcapMaterial",r.color=new tn(16777215),r.matcap=null,r.map=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=De,r.normalScale=new Ht(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.flatShading=!1,r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).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.flatShading=e.flatShading,this}}]),n}(Hn);tl.prototype.isMeshMatcapMaterial=!0;var nl=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this)).type="LineDashedMaterial",r.scale=1,r.dashSize=3,r.gapSize=1,r.setValues(e),r}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}]),n}(Oo);nl.prototype.isLineDashedMaterial=!0;var rl={ShadowMaterial:js,SpriteMaterial:qs,RawShaderMaterial:Xs,ShaderMaterial:Wn,PointsMaterial:Ys,MeshPhysicalMaterial:Zs,MeshStandardMaterial:Js,MeshPhongMaterial:Ks,MeshToonMaterial:Qs,MeshNormalMaterial:$s,MeshLambertMaterial:el,MeshDepthMaterial:lo,MeshDistanceMaterial:uo,MeshBasicMaterial:cr,MeshMatcapMaterial:tl,LineDashedMaterial:nl,LineBasicMaterial:Oo,Material:Hn};Hn.fromType=function(e){return new rl[e]};var il={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={}}},al=M((function e(t,n,r){_(this,e);var i=this,a=!1,o=0,s=0,l=void 0,u=[];this.onStart=void 0,this.onLoad=t,this.onProgress=n,this.onError=r,this.itemStart=function(e){s++,!1===a&&void 0!==i.onStart&&i.onStart(e,o,s),a=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,s),o===s&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return u.push(e,t),this},this.removeHandler=function(e){var t=u.indexOf(e);return-1!==t&&u.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=u.length;t<n;t+=2){var r=u[t],i=u[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}})),ol=new al,sl=function(){function e(t){_(this,e),this.manager=void 0!==t?t:ol,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return M(e,[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}]),e}(),ll={},ul=function(e){d(n,e);var t=f(n);function n(e,r){var i;return _(this,n),i=t.call(this,e),r&&(i.customLoader=r.customLoader,i.baseUrl=r.baseUrl),i}return M(n,[{key:"setCustomParam",value:function(e){e&&(this.customLoader=e.customLoader,this.baseUrl=e.baseUrl)}},{key:"load",value:function(e,t,n,r){var i=this;void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var a=this.baseUrl||e,o=il.get(a);if(void 0!==o)return this.manager.itemStart(a),setTimeout((function(){t&&t(o),i.manager.itemEnd(a)}),0),o;if(void 0===ll[a]){if(ll[a]=[],ll[a].push({onLoad:t,onProgress:n,onError:r}),this.customLoader)this.customLoader.preload(this.baseUrl).then((function(){i.customLoader.load(e).then((function(e){il.add(a,e);var t=ll[a];delete ll[a];for(var n=0,r=t.length;n<r;n++){var i=t[n];i.onLoad&&i.onLoad(e)}})).catch((function(e){var t=ll[a];if(void 0===t)throw i.manager.itemError(a),e;delete ll[a];for(var n=0,r=t.length;n<r;n++){var o=t[n];o.onError&&o.onError(e)}i.manager.itemError(a)})).finally((function(){i.manager.itemEnd(a)}))}));else{var s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),l=this.mimeType,u=this.responseType;fetch(s).then((function(t){if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;var n=ll[e],r=t.body.getReader(),i=t.headers.get("Content-Length"),a=i?parseInt(i):0,o=0!==a,s=0,l=new ReadableStream({start:function(e){!function t(){r.read().then((function(r){var i=r.done,l=r.value;if(i)e.close();else{s+=l.byteLength;for(var u=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a}),c=0,h=n.length;c<h;c++){var d=n[c];d.onProgress&&d.onProgress(u)}e.enqueue(l),t()}}))}()}});return new Response(l)}throw Error('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText))})).then((function(e){switch(u){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((function(e){return(new DOMParser).parseFromString(e,l)}));case"json":return e.json();default:if(void 0===l)return e.text();var t=/charset="?([^;"\s]*)"?/i.exec(l),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then((function(e){return r.decode(e)}))}})).then((function(t){il.add(e,t);var n=ll[e];delete ll[e];for(var r=0,i=n.length;r<i;r++){var a=n[r];a.onLoad&&a.onLoad(t)}})).catch((function(t){var n=ll[e];if(void 0===n)throw i.manager.itemError(e),t;delete ll[e];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(t)}i.manager.itemError(e)})).finally((function(){i.manager.itemEnd(e)}))}this.manager.itemStart(a)}else ll[a].push({onLoad:t,onProgress:n,onError:r})}},{key:"setResponseType",value:function(e){return this.responseType=e,this}},{key:"setMimeType",value:function(e){return this.mimeType=e,this}}]),n}(sl),cl=function(e){d(n,e);var t=f(n);function n(e){return _(this,n),t.call(this,e)}return M(n,[{key:"load",value:function(e,t,n,r){var i=this,a=new Po,o=new ul(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,(function(e){var n=i.parse(e);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:P,a.wrapT=void 0!==n.wrapT?n.wrapT:P,a.magFilter=void 0!==n.magFilter?n.magFilter:z,a.minFilter=void 0!==n.minFilter?n.minFilter:z,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(a.encoding=n.encoding),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=U),1===n.mipmapCount&&(a.minFilter=z),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n))}),n,r),a}}]),n}(sl),hl=function(e){d(n,e);var t=f(n);function n(e){return _(this,n),t.call(this,e)}return M(n,[{key:"load",value:function(e,t,n,r){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=il.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o=kn("img");function s(){u(),il.add(e,this),t&&t(this),i.manager.itemEnd(e)}function l(t){u(),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}function u(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}}]),n}(sl),dl=function(e){d(n,e);var t=f(n);function n(e){return _(this,n),t.call(this,e)}return M(n,[{key:"load",value:function(e,t,n,r){var i=new Wr,a=new hl(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(e){i.image=e,i.needsUpdate=!0,void 0!==t&&t(i)}),n,r),i}}]),n}(sl),pl=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),r=t.call(this,e),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),r.options={premultiplyAlpha:"none"},r}return M(n,[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value: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=il.get(e);if(void 0!==a)return i.manager.itemStart(e),setTimeout((function(){t&&t(a),i.manager.itemEnd(e)}),0),a;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:"none"}))})).then((function(n){il.add(e,n),t&&t(n),i.manager.itemEnd(e)})).catch((function(t){r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.manager.itemStart(e)}}]),n}(sl);pl.prototype.isImageBitmapLoader=!0;var fl=function(){function e(){_(this,e)}return M(e,null,[{key:"decodeText",value: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]);try{return decodeURIComponent(escape(t))}catch(e){return t}}},{key:"extractUrlBase",value:function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}},{key:"resolveURL",value:function(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}]),e}(),vl=function(e){d(n,e);var t=f(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return _(this,n),(r=t.call(this)).type="Light",r.color=new tn(e),r.intensity=i,r}return M(n,[{key:"dispose",value:function(){}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this}},{key:"toJSON",value:function(e){var t=c(g(n.prototype),"toJSON",this).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}}]),n}(Tn);vl.prototype.isLight=!0;var ml=new Pt,gl=new tt,yl=new tt,xl=function(){function e(t){_(this,e),this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ht(512,512),this.map=null,this.mapPass=null,this.matrix=new Pt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ct,this._frameExtents=new Ht(1,1),this._viewportCount=1,this._viewports=[new Ft(0,0,1,1)]}return M(e,[{key:"getViewportCount",value:function(){return this._viewportCount}},{key:"getFrustum",value:function(){return this._frustum}},{key:"updateMatrices",value:function(e){var t=this.camera,n=this.matrix;gl.setFromMatrixPosition(e.matrixWorld),t.position.copy(gl),yl.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(yl),t.updateMatrixWorld(),ml.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ml),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)}},{key:"getViewport",value:function(e){return this._viewports[e]}},{key:"getFrameExtents",value:function(){return this._frameExtents}},{key:"dispose",value:function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}},{key:"copy",value:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),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}}]),e}(),_l=function(e){d(n,e);var t=f(n);function n(){var e;return _(this,n),(e=t.call(this,new Xr(50,1,.5,500))).focus=1,e}return M(n,[{key:"updateMatrices",value:function(e){var t=this.camera,r=2*je*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,a=e.distance||t.far;r===t.fov&&i===t.aspect&&a===t.far||(t.fov=r,t.aspect=i,t.far=a,t.updateProjectionMatrix()),c(g(n.prototype),"updateMatrices",this).call(this,e)}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.focus=e.focus,this}}]),n}(xl);_l.prototype.isSpotLightShadow=!0;var bl=function(e){d(n,e);var t=f(n);function n(e,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;return _(this,n),(i=t.call(this,e,r)).type="SpotLight",i.position.copy(Tn.DefaultUp),i.updateMatrix(),i.target=new Tn,i.distance=a,i.angle=o,i.penumbra=s,i.decay=l,i.shadow=new _l,i}return M(n,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).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}}]),n}(vl);bl.prototype.isSpotLight=!0;var Ml=function(e){d(n,e);var t=f(n);function n(e,r,i){var a;return _(this,n),(a=t.call(this,e,i)).type="HemisphereLight",a.position.copy(Tn.DefaultUp),a.updateMatrix(),a.groundColor=new tn(r),a}return M(n,[{key:"copy",value:function(e){return vl.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}]),n}(vl);Ml.prototype.isHemisphereLight=!0;var wl=function(e){d(n,e);var t=f(n);function n(){return _(this,n),t.call(this,new $r(-5,5,5,-5,.5,500))}return M(n)}(xl);wl.prototype.isDirectionalLightShadow=!0;var Sl=function(e){d(n,e);var t=f(n);function n(e,r){var i;return _(this,n),(i=t.call(this,e,r)).type="DirectionalLight",i.position.copy(Tn.DefaultUp),i.updateMatrix(),i.target=new Tn,i.shadow=new wl,i}return M(n,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}]),n}(vl);Sl.prototype.isDirectionalLight=!0;var El=function(e){d(n,e);var t=f(n);function n(e,r){var i;return _(this,n),(i=t.call(this,e,r)).type="AmbientLight",i}return M(n)}(vl);El.prototype.isAmbientLight=!0;var Tl=function(){function e(t,n,r,i){_(this,e),this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new n.constructor(r),this.sampleValues=n,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}return M(e,[{key:"evaluate",value: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(var l=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===l)break;if(r=i,e>=(i=t[--n-1]))break t}a=n,n=0}for(;n<a;){var u=n+a>>>1;e<t[u]?a=u:n=u+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)}},{key:"getSettings_",value:function(){return this.settings||this.DefaultSettings_}},{key:"copySampleValue_",value: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}},{key:"interpolate_",value:function(){throw new Error("call to abstract method")}},{key:"intervalChanged_",value:function(){}}]),e}();Tl.prototype.beforeStart_=Tl.prototype.copySampleValue_,Tl.prototype.afterEnd_=Tl.prototype.copySampleValue_;var Al=function(e){d(n,e);var t=f(n);function n(e,r,i,a){var o;return _(this,n),(o=t.call(this,e,r,i,a))._weightPrev=-0,o._offsetPrev=-0,o._weightNext=-0,o._offsetNext=-0,o.DefaultSettings_={endingStart:Se,endingEnd:Se},o}return M(n,[{key:"intervalChanged_",value: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 Ee:i=e,o=2*t-n;break;case Te: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 Ee:a=e,s=2*n-t;break;case Te:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}var l=.5*(n-t),u=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=i*u,this._offsetNext=a*u}},{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,u=this._offsetPrev,c=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(r-t),f=p*p,v=f*p,m=-h*v+2*h*f-h*p,g=(1+h)*v+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*v+(1.5+d)*f+.5*p,x=d*v-d*f,_=0;_!==o;++_)i[_]=m*a[u+_]+g*a[l+_]+y*a[s+_]+x*a[c+_];return i}}]),n}(Tl),kl=function(e){d(n,e);var t=f(n);function n(e,r,i,a){return _(this,n),t.call(this,e,r,i,a)}return M(n,[{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,u=(n-t)/(r-t),c=1-u,h=0;h!==o;++h)i[h]=a[l+h]*c+a[s+h]*u;return i}}]),n}(Tl),Ll=function(e){d(n,e);var t=f(n);function n(e,r,i,a){return _(this,n),t.call(this,e,r,i,a)}return M(n,[{key:"interpolate_",value:function(e){return this.copySampleValue_(e-1)}}]),n}(Tl),Rl={arraySlice:function(e,t,n){return Rl.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),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,l=0;l!==t;++l)i[o++]=e[s+l];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)}},subclip:function(e,t,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var l=a.tracks[s],u=l.getValueSize(),c=[],h=[],d=0;d<l.times.length;++d){var p=l.times[d]*i;if(!(p<n||p>=r)){c.push(l.times[d]);for(var f=0;f<u;++f)h.push(l.values[d*u+f])}}0!==c.length&&(l.times=Rl.convertArray(c,l.times.constructor),l.values=Rl.convertArray(h,l.values.constructor),o.push(l))}a.tracks=o;for(var v=1/0,m=0;m<a.tracks.length;++m)v>a.tracks[m].times[0]&&(v=a.tracks[m].times[0]);for(var g=0;g<a.tracks.length;++g)a.tracks[g].shift(-1*v);return a.resetDuration(),a},makeClipAdditive:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;r<=0&&(r=30);for(var i=n.tracks.length,a=t/r,o=function(t){var r=n.tracks[t],i=r.ValueTypeName;if("bool"===i||"string"===i)return"continue";var o=e.tracks.find((function(e){return e.name===r.name&&e.ValueTypeName===i}));if(void 0===o)return"continue";var s=0,l=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);var u=0,c=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=c/3);var h=r.times.length-1,d=void 0;if(a<=r.times[0]){var p=s,f=l-s;d=Rl.arraySlice(r.values,p,f)}else if(a>=r.times[h]){var v=h*l+s,m=v+l-s;d=Rl.arraySlice(r.values,v,m)}else{var g=r.createInterpolant(),y=s,x=l-s;g.evaluate(a),d=Rl.arraySlice(g.resultBuffer,y,x)}"quaternion"===i&&(new et).fromArray(d).normalize().conjugate().toArray(d);for(var _=o.times.length,b=0;b<_;++b){var M=b*c+u;if("quaternion"===i)et.multiplyQuaternionsFlat(o.values,M,d,0,o.values,M);else for(var w=c-2*u,S=0;S<w;++S)o.values[M+S]-=d[S]}},s=0;s<i;++s)o(s);return e.blendMode=ke,e}},Cl=function(){function e(t,n,r,i){if(_(this,e),void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===n||0===n.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Rl.convertArray(n,this.TimeBufferType),this.values=Rl.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}return M(e,[{key:"InterpolantFactoryMethodDiscrete",value:function(e){return new Ll(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodLinear",value:function(e){return new kl(this.times,this.values,this.getValueSize(),e)}},{key:"InterpolantFactoryMethodSmooth",value:function(e){return new Al(this.times,this.values,this.getValueSize(),e)}},{key:"setInterpolation",value:function(e){var t;switch(e){case be:t=this.InterpolantFactoryMethodDiscrete;break;case Me:t=this.InterpolantFactoryMethodLinear;break;case we: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}},{key:"getInterpolation",value:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return be;case this.InterpolantFactoryMethodLinear:return Me;case this.InterpolantFactoryMethodSmooth:return we}}},{key:"getValueSize",value:function(){return this.values.length/this.times.length}},{key:"shift",value:function(e){if(0!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this}},{key:"scale",value:function(e){if(1!==e)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this}},{key:"trim",value: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=Rl.arraySlice(n,i,a),this.values=Rl.arraySlice(this.values,i*o,a*o)}return this}},{key:"validate",value: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&&Rl.isTypedArray(r))for(var l=0,u=r.length;l!==u;++l){var c=r[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),e=!1;break}}return e}},{key:"optimize",value:function(){for(var e=Rl.arraySlice(this.times),t=Rl.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===we,i=e.length-1,a=1,o=1;o<i;++o){var s=!1,l=e[o];if(l!==e[o+1]&&(1!==o||l!==e[0]))if(r)s=!0;else for(var u=o*n,c=u-n,h=u+n,d=0;d!==n;++d){var p=t[u+d];if(p!==t[c+d]||p!==t[h+d]){s=!0;break}}if(s){if(o!==a){e[a]=e[o];for(var f=o*n,v=a*n,m=0;m!==n;++m)t[v+m]=t[f+m]}++a}}if(i>0){e[a]=e[i];for(var g=i*n,y=a*n,x=0;x!==n;++x)t[y+x]=t[g+x];++a}return a!==e.length?(this.times=Rl.arraySlice(e,0,a),this.values=Rl.arraySlice(t,0,a*n)):(this.times=e,this.values=t),this}},{key:"clone",value:function(){var e=Rl.arraySlice(this.times,0),t=Rl.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}],[{key:"toJSON",value:function(e){var t,n=e.constructor;if(n.toJSON!==this.toJSON)t=n.toJSON(e);else{t={name:e.name,times:Rl.convertArray(e.times,Array),values:Rl.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}}]),e}();Cl.prototype.TimeBufferType=Float32Array,Cl.prototype.ValueBufferType=Float32Array,Cl.prototype.DefaultInterpolation=Me;var Pl=function(e){d(n,e);var t=f(n);function n(){return _(this,n),t.apply(this,arguments)}return M(n)}(Cl);Pl.prototype.ValueTypeName="vector";var Dl=function(e){d(n,e);var t=f(n);function n(){return _(this,n),t.apply(this,arguments)}return M(n)}(Cl);Dl.prototype.ValueTypeName="string",Dl.prototype.ValueBufferType=Array,Dl.prototype.DefaultInterpolation=be,Dl.prototype.InterpolantFactoryMethodLinear=void 0,Dl.prototype.InterpolantFactoryMethodSmooth=void 0;var Il=function(e){d(n,e);var t=f(n);function n(e,r,i,a){return _(this,n),t.call(this,e,r,i,a)}return M(n,[{key:"interpolate_",value:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),l=e*o,u=l+o;l!==u;l+=4)et.slerpFlat(i,0,a,l-o,a,l,s);return i}}]),n}(Tl),Nl=function(e){d(n,e);var t=f(n);function n(){return _(this,n),t.apply(this,arguments)}return M(n,[{key:"InterpolantFactoryMethodLinear",value:function(e){return new Il(this.times,this.values,this.getValueSize(),e)}}]),n}(Cl);Nl.prototype.ValueTypeName="quaternion",Nl.prototype.DefaultInterpolation=Me,Nl.prototype.InterpolantFactoryMethodSmooth=void 0;var Ol=function(e){d(n,e);var t=f(n);function n(){return _(this,n),t.apply(this,arguments)}return M(n)}(Cl);Ol.prototype.ValueTypeName="number";var zl=function(e){d(n,e);var t=f(n);function n(){return _(this,n),t.apply(this,arguments)}return M(n)}(Cl);zl.prototype.ValueTypeName="color";var Bl=function(e){d(n,e);var t=f(n);function n(){return _(this,n),t.apply(this,arguments)}return M(n)}(Cl);Bl.prototype.ValueTypeName="bool",Bl.prototype.ValueBufferType=Array,Bl.prototype.DefaultInterpolation=be,Bl.prototype.InterpolantFactoryMethodLinear=void 0,Bl.prototype.InterpolantFactoryMethodSmooth=void 0;var Ul=function(){function e(t,n,r){var i,a,o;switch(_(this,e),this.binding=t,this.valueSize=r,n){case"quaternion":i=this._slerp,a=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*r),this._workIndex=5;break;case"string":case"bool":i=this._select,a=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*r);break;default:i=this._lerp,a=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=a,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}return M(e,[{key:"accumulate",value: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}},{key:"accumulateAdditive",value:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}},{key:"apply",value:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var l=t,u=t+t;l!==u;++l)if(n[l]!==n[l+t]){o.setValue(n,r);break}}},{key:"saveOriginalState",value:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}},{key:"restoreOriginalState",value:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)}},{key:"_setAdditiveIdentityNumeric",value:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0}},{key:"_setAdditiveIdentityQuaternion",value:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}},{key:"_setAdditiveIdentityOther",value:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}},{key:"_select",value:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]}},{key:"_slerp",value:function(e,t,n,r){et.slerpFlat(e,t,e,t,e,n,r)}},{key:"_slerpAdditive",value:function(e,t,n,r,i){var a=this._workIndex*i;et.multiplyQuaternionsFlat(e,a,e,t,e,n),et.slerpFlat(e,t,e,t,e,a,r)}},{key:"_lerp",value: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}}},{key:"_lerpAdditive",value:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}}]),e}(),Hl="\\[\\]\\.:\\/",Fl=new RegExp("[\\[\\]\\.:\\/]","g"),Gl="[^\\[\\]\\.:\\/]",Vl="[^"+Hl.replace("\\.","")+"]",Wl=/((?:WC+[\/:])*)/.source.replace("WC",Gl),jl=/(WCOD+)?/.source.replace("WCOD",Vl),ql=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Gl),Xl=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Gl),Yl=new RegExp("^"+Wl+jl+ql+Xl+"$"),Jl=["material","materials","bones"],Zl=function(){function e(t,n,r){_(this,e);var i=r||Kl.parseTrackName(n);this._targetGroup=t,this._bindings=t.subscribe_(n,i)}return M(e,[{key:"getValue",value:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(e,t)}},{key:"setValue",value:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}},{key:"bind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}},{key:"unbind",value:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}]),e}(),Kl=function(){function e(t,n,r){_(this,e),this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}return M(e,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(e,t){e[t]=this.targetObject[this.propertyName]}},{key:"_getValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)e[t++]=n[r]}},{key:"_getValue_arrayElement",value:function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}},{key:"_getValue_toArray",value:function(e,t){this.resolvedProperty.toArray(e,t)}},{key:"_setValue_direct",value:function(e,t){this.targetObject[this.propertyName]=e[t]}},{key:"_setValue_direct_setNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_direct_setMatrixWorldNeedsUpdate",value:function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_array",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++]}},{key:"_setValue_array_setNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}},{key:"_setValue_array_setMatrixWorldNeedsUpdate",value:function(e,t){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_arrayElement",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}},{key:"_setValue_arrayElement_setNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}},{key:"_setValue_arrayElement_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_fromArray",value:function(e,t){this.resolvedProperty.fromArray(e,t)}},{key:"_setValue_fromArray_setNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}},{key:"_setValue_fromArray_setMatrixWorldNeedsUpdate",value:function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_getValue_unbound",value:function(e,t){this.bind(),this.getValue(e,t)}},{key:"_setValue_unbound",value:function(e,t){this.bind(),this.setValue(e,t)}},{key:"bind",value:function(){var t=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(t||(t=e.findNode(this.rootNode,n.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,t){if(r){var o=n.objectIndex;switch(r){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(var s=0;s<t.length;s++)if(t[s].name===o){o=s;break}break;default:if(void 0===t[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[r]}if(void 0!==o){if(void 0===t[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[o]}}var l=t[i];if(void 0!==l){var u=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?u=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(u=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==a){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[a]&&(a=t.morphTargetDictionary[a])}c=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=a}else void 0!==l.fromArray&&void 0!==l.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(c=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][u]}else{var h=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",t)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")}},{key:"unbind",value:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}],[{key:"create",value:function(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}},{key:"sanitizeNodeName",value:function(e){return e.replace(/\s/g,"_").replace(Fl,"")}},{key:"parseTrackName",value:function(e){var t=Yl.exec(e);if(null===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!==Jl.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}},{key:"findNode",value:function(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var 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}}]),e}();Kl.Composite=Zl,Kl.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Kl.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Kl.prototype.GetterByBindingType=[Kl.prototype._getValue_direct,Kl.prototype._getValue_array,Kl.prototype._getValue_arrayElement,Kl.prototype._getValue_toArray],Kl.prototype.SetterByBindingTypeAndVersioning=[[Kl.prototype._setValue_direct,Kl.prototype._setValue_direct_setNeedsUpdate,Kl.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Kl.prototype._setValue_array,Kl.prototype._setValue_array_setNeedsUpdate,Kl.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Kl.prototype._setValue_arrayElement,Kl.prototype._setValue_arrayElement_setNeedsUpdate,Kl.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Kl.prototype._setValue_fromArray,Kl.prototype._setValue_fromArray_setNeedsUpdate,Kl.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Ql=function(){function e(){_(this,e),this.uuid=qe(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var t={};this._indicesByUUID=t;for(var n=0,r=arguments.length;n!==r;++n)t[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}return M(e,[{key:"add",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,a=i.length,o=void 0,s=e.length,l=this.nCachedObjects_,u=0,c=arguments.length;u!==c;++u){var h=arguments[u],d=h.uuid,p=t[d];if(void 0===p){p=s++,t[d]=p,e.push(h);for(var f=0,v=a;f!==v;++f)i[f].push(new Kl(h,n[f],r[f]))}else if(p<l){o=e[p];var m=--l,g=e[m];t[g.uuid]=p,e[p]=g,t[d]=m,e[m]=h;for(var y=0,x=a;y!==x;++y){var _=i[y],b=_[m],M=_[p];_[p]=b,void 0===M&&(M=new Kl(h,n[y],r[y])),_[m]=M}}else e[p]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}},{key:"remove",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,u=t[l];if(void 0!==u&&u>=i){var c=i++,h=e[c];t[h.uuid]=u,e[u]=h,t[l]=c,e[c]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],v=f[c],m=f[u];f[u]=v,f[c]=m}}}this.nCachedObjects_=i}},{key:"uncache",value:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=e.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],u=l.uuid,c=t[u];if(void 0!==c)if(delete t[u],c<i){var h=--i,d=e[h],p=--a,f=e[p];t[d.uuid]=c,e[c]=d,t[f.uuid]=h,e[h]=f,e.pop();for(var v=0,m=r;v!==m;++v){var g=n[v],y=g[h],x=g[p];g[c]=y,g[h]=x,g.pop()}}else{var _=--a,b=e[_];_>0&&(t[b.uuid]=c),e[c]=b,e.pop();for(var M=0,w=r;M!==w;++M){var S=n[M];S[c]=S[_],S.pop()}}}this.nCachedObjects_=i}},{key:"subscribe_",value: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,l=s.length,u=this.nCachedObjects_,c=new Array(l);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(c);for(var h=u,d=s.length;h!==d;++h){var p=s[h];c[h]=new Kl(p,e,t)}return c}},{key:"unsubscribe_",value: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()}}}]),e}();Ql.prototype.isAnimationObjectGroup=!0;var $l=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.blendMode;_(this,e),this._mixer=t,this._clip=n,this._localRoot=r,this.blendMode=i;for(var a=n.tracks,o=a.length,s=new Array(o),l={endingStart:Se,endingEnd:Se},u=0;u!==o;++u){var c=a[u].createInterpolant(null);s[u]=c,c.settings=l}this._interpolantSettings=l,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}return M(e,[{key:"play",value:function(){return this._mixer._activateAction(this),this}},{key:"stop",value:function(){return this._mixer._deactivateAction(this),this.reset()}},{key:"reset",value:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}},{key:"isRunning",value:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}},{key:"isScheduled",value:function(){return this._mixer._isActiveAction(this)}},{key:"startAt",value:function(e){return this._startTime=e,this}},{key:"setLoop",value:function(e,t){return this.loop=e,this.repetitions=t,this}},{key:"setEffectiveWeight",value:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}},{key:"getEffectiveWeight",value:function(){return this._effectiveWeight}},{key:"fadeIn",value:function(e){return this._scheduleFading(e,0,1)}},{key:"fadeOut",value:function(e){return this._scheduleFading(e,1,0)}},{key:"crossFadeFrom",value: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}},{key:"crossFadeTo",value:function(e,t,n){return e.crossFadeFrom(this,t,n)}},{key:"stopFading",value:function(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"setEffectiveTimeScale",value:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}},{key:"getEffectiveTimeScale",value:function(){return this._effectiveTimeScale}},{key:"setDuration",value:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}},{key:"syncWith",value:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}},{key:"halt",value:function(e){return this.warp(this._effectiveTimeScale,0,e)}},{key:"warp",value:function(e,t,n){var r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,l=o.sampleValues;return s[0]=i,s[1]=i+n,l[0]=e/a,l[1]=t/a,this}},{key:"stopWarping",value:function(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}},{key:"getMixer",value:function(){return this._mixer}},{key:"getClip",value:function(){return this._clip}},{key:"getRoot",value:function(){return this._localRoot||this._mixer._root}},{key:"_update",value: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){var l=this._interpolants,u=this._propertyBindings;if(this.blendMode===ke)for(var c=0,h=l.length;c!==h;++c)l[c].evaluate(o),u[c].accumulateAdditive(s);else for(var d=0,p=l.length;d!==p;++d)l[d].evaluate(o),u[d].accumulate(r,s)}}else this._updateWeight(e)}},{key:"_updateWeight",value: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}},{key:"_updateTimeScale",value: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}},{key:"_updateTime",value:function(e){var t=this._clip.duration,n=this.loop,r=this.time+e,i=this._loopCount,a=2202===n;if(0===e)return-1===i?r:a&&1==(1&i)?t-r:r;if(n===_e){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,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)),r>=t||r<0){var o=Math.floor(r/t);r-=t*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&1==(1&i))return t-r}return r}},{key:"_setEndings",value:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=Ee,r.endingEnd=Ee):(r.endingStart=e?this.zeroSlopeAtStart?Ee:Se:Te,r.endingEnd=t?this.zeroSlopeAtEnd?Ee:Se:Te)}},{key:"_scheduleFading",value: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}}]),e}(),eu=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ae;_(this,e),this.name=t,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=qe(),this.duration<0&&this.resetDuration()}return M(e,[{key:"resetDuration",value: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}},{key:"trim",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}},{key:"validate",value:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}},{key:"optimize",value:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}},{key:"clone",value:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}},{key:"toJSON",value:function(){return this.constructor.toJSON(this)}}],[{key:"parse",value:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(tu(n[i]).scale(r));var o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o}},{key:"toJSON",value:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(Cl.toJSON(n[i]));return r}},{key:"CreateFromMorphTargetSequence",value:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],l=[];s.push((o+i-1)%i,o,(o+1)%i),l.push(0,1,0);var u=Rl.getKeyframeOrder(s);s=Rl.sortedArray(s,1,u),l=Rl.sortedArray(l,1,u),r||0!==s[0]||(s.push(i),l.push(l[0])),a.push(new Ol(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/n))}return new this(e,-1,a)}},{key:"findByName",value: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}},{key:"CreateClipsFromMorphTargetSequences",value:function(e,t,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],l=s.name.match(i);if(l&&l.length>1){var u=l[1],c=r[u];c||(r[u]=c=[]),c.push(s)}}var h=[];for(var d in r)h.push(this.CreateFromMorphTargetSequence(d,r[d],t,n));return h}},{key:"parseAnimation",value: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=[];Rl.flattenJSON(n,a,o,r),0!==a.length&&i.push(new e(t,a,o))}},r=[],i=e.name||"default",a=e.fps||30,o=e.blendMode,s=e.length||-1,l=e.hierarchy||[],u=0;u<l.length;u++){var c=l[u].keys;if(c&&0!==c.length)if(c[0].morphTargets){var h={},d=void 0;for(d=0;d<c.length;d++)if(c[d].morphTargets)for(var p=0;p<c[d].morphTargets.length;p++)h[c[d].morphTargets[p]]=-1;for(var f in h){for(var v=[],m=[],g=0;g!==c[d].morphTargets.length;++g){var y=c[d];v.push(y.time),m.push(y.morphTarget===f?1:0)}r.push(new Ol(".morphTargetInfluence["+f+"]",v,m))}s=h.length*a}else{var x=".bones["+t[u].name+"]";n(Pl,x+".position",c,"pos",r),n(Nl,x+".quaternion",c,"rot",r),n(Pl,x+".scale",c,"scl",r)}}return 0===r.length?null:new this(i,s,r,o)}}]),e}();function tu(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 Ol;case"vector":case"vector2":case"vector3":case"vector4":return Pl;case"color":return zl;case"quaternion":return Nl;case"bool":case"boolean":return Bl;case"string":return Dl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],r=[];Rl.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)}var nu=function(e){d(n,e);var t=f(n);function n(e){var r;return _(this,n),(r=t.call(this))._root=e,r._initMemoryManager(),r._accuIndex=0,r.time=0,r.timeScale=1,r}return M(n,[{key:"_bindAction",value: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,l=this._bindingsByRootAndName,u=l[s];void 0===u&&(u={},l[s]=u);for(var c=0;c!==i;++c){var h=r[c],d=h.name,p=u[d];if(void 0!==p)++p.referenceCount,a[c]=p;else{if(void 0!==(p=a[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[c].binding.parsedPath;++(p=new Ul(Kl.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[c]=p}o[c].resultBuffer=p.buffer}}},{key:"_activateAction",value: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)}}},{key:"_deactivateAction",value: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)}}},{key:"_initMemoryManager",value: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}}}}},{key:"_isActiveAction",value:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions}},{key:"_addInactiveAction",value: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}},{key:"_removeInactiveAction",value: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,l=s[s.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,s[u]=l,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(e)}},{key:"_removeInactiveBindingsForAction",value: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)}}},{key:"_lendAction",value: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}},{key:"_takeBackAction",value: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}},{key:"_addInactiveBinding",value:function(e,t,n){var r=this._bindingsByRootAndName,i=this._bindings,a=r[t];void 0===a&&(a={},r[t]=a),a[n]=e,e._cacheIndex=i.length,i.push(e)}},{key:"_removeInactiveBinding",value: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],l=e._cacheIndex;s._cacheIndex=l,t[l]=s,t.pop(),delete o[i],0===Object.keys(o).length&&delete a[r]}},{key:"_lendBinding",value: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}},{key:"_takeBackBinding",value: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}},{key:"_lendControlInterpolant",value:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new kl(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=n),n}},{key:"_takeBackControlInterpolant",value: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}},{key:"clipAction",value:function(e,t,n){var r=t||this._root,i=r.uuid,a="string"==typeof e?eu.findByName(r,e):e,o=null!==a?a.uuid:e,s=this._actionsByClip[o],l=null;if(void 0===n&&(n=null!==a?a.blendMode:Ae),void 0!==s){var u=s.actionByRoot[i];if(void 0!==u&&u.blendMode===n)return u;l=s.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;var c=new $l(this,a,t,n);return this._bindAction(c,l),this._addInactiveAction(c,o,i),c}},{key:"existingAction",value:function(e,t){var n=t||this._root,r=n.uuid,i="string"==typeof e?eu.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null}},{key:"stopAllAction",value:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}},{key:"update",value: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)}for(var s=this._bindings,l=this._nActiveBindings,u=0;u!==l;++u)s[u].apply(a);return this}},{key:"setTime",value:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}},{key:"getRoot",value:function(){return this._root}},{key:"uncacheClip",value: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 l=a[o];this._deactivateAction(l);var u=l._cacheIndex,c=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,c._cacheIndex=u,t[u]=c,t.pop(),this._removeInactiveBindingsForAction(l)}delete r[n]}}},{key:"uncacheRoot",value: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)}}},{key:"uncacheAction",value:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}]),n}(Wt);nu.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var ru=new tt,iu=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];_(this,e),this.name="",this.data=t,this.itemSize=n,this.offset=r,this.normalized=!0===i}return M(e,[{key:"count",get:function(){return this.data.count}},{key:"array",get:function(){return this.data.array}},{key:"needsUpdate",set:function(e){this.data.needsUpdate=e}},{key:"applyMatrix4",value:function(e){for(var t=0,n=this.data.count;t<n;t++)ru.fromBufferAttribute(this,t),ru.applyMatrix4(e),this.setXYZ(t,ru.x,ru.y,ru.z);return this}},{key:"applyNormalMatrix",value:function(e){for(var t=0,n=this.count;t<n;t++)ru.fromBufferAttribute(this,t),ru.applyNormalMatrix(e),this.setXYZ(t,ru.x,ru.y,ru.z);return this}},{key:"transformDirection",value:function(e){for(var t=0,n=this.count;t<n;t++)ru.fromBufferAttribute(this,t),ru.transformDirection(e),this.setXYZ(t,ru.x,ru.y,ru.z);return this}},{key:"setX",value:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}},{key:"setY",value:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}},{key:"setZ",value:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}},{key:"setW",value:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}},{key:"getX",value:function(e){return this.data.array[e*this.data.stride+this.offset]}},{key:"getY",value:function(e){return this.data.array[e*this.data.stride+this.offset+1]}},{key:"getZ",value:function(e){return this.data.array[e*this.data.stride+this.offset+2]}},{key:"getW",value:function(e){return this.data.array[e*this.data.stride+this.offset+3]}},{key:"setXY",value: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}},{key:"setXYZ",value: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}},{key:"setXYZW",value: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}},{key:"clone",value:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var n=[],r=0;r<this.count;r++)for(var i=r*this.data.stride+this.offset,a=0;a<this.itemSize;a++)n.push(this.data.array[i+a]);return new an(new this.array.constructor(n),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}},{key:"toJSON",value:function(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var t=[],n=0;n<this.count;n++)for(var r=n*this.data.stride+this.offset,i=0;i<this.itemSize;i++)t.push(this.data.array[r+i]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}]),e}();iu.prototype.isInterleavedBufferAttribute=!0;var au=function(){function e(t,n){_(this,e),this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=ze,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=qe()}return M(e,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(e){!0===e&&this.version++}},{key:"setUsage",value:function(e){return this.usage=e,this}},{key:"copy",value:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}},{key:"copyAt",value: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}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}},{key:"clone",value:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=qe()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}},{key:"onUpload",value:function(e){return this.onUploadCallback=e,this}},{key:"toJSON",value:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=qe()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}]),e}();au.prototype.isInterleavedBuffer=!0;var ou=function(){function e(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];_(this,e),this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}return M(e,[{key:"start",value:function(){this.startTime=su(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}},{key:"stop",value:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}},{key:"getElapsedTime",value:function(){return this.getDelta(),this.elapsedTime}},{key:"getDelta",value:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=su();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}]),e}();function su(){return("undefined"==typeof performance?Date:performance).now()}var lu=new Ht,uu=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ht(1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ht(-1/0,-1/0);_(this,e),this.min=t,this.max=n}return M(e,[{key:"set",value:function(e,t){return this.min.copy(e),this.max.copy(t),this}},{key:"setFromPoints",value:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}},{key:"setFromCenterAndSize",value:function(e,t){var n=lu.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.min.copy(e.min),this.max.copy(e.max),this}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y}},{key:"getCenter",value:function(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(e){return this.min.min(e),this.max.max(e),this}},{key:"expandByVector",value:function(e){return this.min.sub(e),this.max.add(e),this}},{key:"expandByScalar",value:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this}},{key:"containsPoint",value:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}},{key:"containsBox",value: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}},{key:"getParameter",value:function(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}},{key:"intersectsBox",value: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)}},{key:"clampPoint",value:function(e,t){return t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return lu.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),e}();uu.prototype.isBox2=!0;for(var cu=new tt,hu=new tt,du=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new tt,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new tt;_(this,e),this.start=t,this.end=n}return M(e,[{key:"set",value:function(e,t){return this.start.copy(e),this.end.copy(t),this}},{key:"copy",value:function(e){return this.start.copy(e.start),this.end.copy(e.end),this}},{key:"getCenter",value:function(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(e){return e.subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){cu.subVectors(e,this.start),hu.subVectors(this.end,this.start);var n=hu.dot(hu),r=hu.dot(cu)/n;return t&&(r=Xe(r,0,1)),r}},{key:"closestPointToPoint",value:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}},{key:"applyMatrix4",value:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}},{key:"equals",value:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),e}(),pu=function(){function e(){_(this,e)}return M(e,null,[{key:"toHalfFloat",value:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Xe(e,-65504,65504),vu[0]=e;var t=mu[0],n=t>>23&511;return gu[n]+((8388607&t)>>yu[n])}},{key:"fromHalfFloat",value:function(e){var t=e>>10;return mu[0]=bu[wu[t]+(1023&e)]+Mu[t],vu[0]}}]),e}(),fu=new ArrayBuffer(4),vu=new Float32Array(fu),mu=new Uint32Array(fu),gu=new Uint32Array(512),yu=new Uint32Array(512),xu=0;xu<256;++xu){var _u=xu-127;_u<-27?(gu[xu]=0,gu[256|xu]=32768,yu[xu]=24,yu[256|xu]=24):_u<-14?(gu[xu]=1024>>-_u-14,gu[256|xu]=1024>>-_u-14|32768,yu[xu]=-_u-1,yu[256|xu]=-_u-1):_u<=15?(gu[xu]=_u+15<<10,gu[256|xu]=_u+15<<10|32768,yu[xu]=13,yu[256|xu]=13):_u<128?(gu[xu]=31744,gu[256|xu]=64512,yu[xu]=24,yu[256|xu]=24):(gu[xu]=31744,gu[256|xu]=64512,yu[xu]=13,yu[256|xu]=13)}for(var bu=new Uint32Array(2048),Mu=new Uint32Array(64),wu=new Uint32Array(64),Su=1;Su<1024;++Su){for(var Eu=Su<<13,Tu=0;0==(8388608&Eu);)Eu<<=1,Tu-=8388608;Eu&=-8388609,Tu+=947912704,bu[Su]=Eu|Tu}for(var Au=1024;Au<2048;++Au)bu[Au]=939524096+(Au-1024<<13);for(var ku=1;ku<31;++ku)Mu[ku]=ku<<23;Mu[31]=1199570944,Mu[32]=2147483648;for(var Lu=33;Lu<63;++Lu)Mu[Lu]=2147483648+(Lu-32<<23);Mu[63]=3347054592;for(var Ru=1;Ru<64;++Ru)32!==Ru&&(wu[Ru]=1024);var Cu=new tt,Pu=new tt,Du=function(e){d(n,e);var t=f(n);function n(e,r){var i;return _(this,n),(i=t.call(this,e,r)).type="LineSegments",i}return M(n,[{key:"computeLineDistances",value:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)Cu.fromBufferAttribute(t,r),Pu.fromBufferAttribute(t,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Cu.distanceTo(Pu);e.setAttribute("lineDistance",new ln(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}]),n}(Go);Du.prototype.isLineSegments=!0;var Iu=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4473924,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8947848;_(this,n),a=new tn(a),o=new tn(o);for(var s=i/2,l=r/i,u=r/2,c=[],h=[],d=0,p=0,f=-u;d<=i;d++,f+=l){c.push(-u,0,f,u,0,f),c.push(f,0,-u,f,0,u);var v=d===s?a:o;v.toArray(h,p),p+=3,v.toArray(h,p),p+=3,v.toArray(h,p),p+=3,v.toArray(h,p),p+=3}var m=new On;m.setAttribute("position",new ln(c,3)),m.setAttribute("color",new ln(h,3));var g=new Oo({vertexColors:!0,toneMapped:!1});return(e=t.call(this,m,g)).type="GridHelper",e}return M(n)}(Du),Nu=new tt,Ou=new Pt,zu=new Pt,Bu=function(e){d(n,e);var t=f(n);function n(e){var r;_(this,n);for(var i=Uu(e),a=new On,o=[],s=[],l=new tn(0,0,1),u=new tn(0,1,0),c=0;c<i.length;c++){var h=i[c];h.parent&&h.parent.isBone&&(o.push(0,0,0),o.push(0,0,0),s.push(l.r,l.g,l.b),s.push(u.r,u.g,u.b))}a.setAttribute("position",new ln(o,3)),a.setAttribute("color",new ln(s,3));var d=new Oo({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});return(r=t.call(this,a,d)).type="SkeletonHelper",r.isSkeletonHelper=!0,r.root=e,r.bones=i,r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r}return M(n,[{key:"updateMatrixWorld",value:function(e){var t=this.bones,r=this.geometry,i=r.getAttribute("position");zu.copy(this.root.matrixWorld).invert();for(var a=0,o=0;a<t.length;a++){var s=t[a];s.parent&&s.parent.isBone&&(Ou.multiplyMatrices(zu,s.matrixWorld),Nu.setFromMatrixPosition(Ou),i.setXYZ(o,Nu.x,Nu.y,Nu.z),Ou.multiplyMatrices(zu,s.parent.matrixWorld),Nu.setFromMatrixPosition(Ou),i.setXYZ(o+1,Nu.x,Nu.y,Nu.z),o+=2)}r.getAttribute("position").needsUpdate=!0,c(g(n.prototype),"updateMatrixWorld",this).call(this,e)}}]),n}(Du);function Uu(e){var t=[];!0===e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,Uu(e.children[n]));return t}var Hu,Fu=function(e){d(n,e);var t=f(n);function n(e){return _(this,n),t.call(this,e)}return M(n,[{key:"load",value:function(e,t,n,r){var i=new Zr,a=new hl(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 l=0;l<e.length;++l)s(l);return i}}]),n}(sl),Gu=new Pt,Vu=new Qn,Wu=new wt,ju=new tt,qu=function(e){d(n,e);var t=f(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new On,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ys;return _(this,n),(e=t.call(this)).type="Points",e.geometry=r,e.material=i,e.updateMorphTargets(),e}return M(n,[{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),this.material=e.material,this.geometry=e.geometry,this}},{key:"raycast",value:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Wu.copy(n.boundingSphere),Wu.applyMatrix4(r),Wu.radius+=i,!1!==e.ray.intersectsSphere(Wu)){Gu.copy(r).invert(),Vu.copy(e.ray).applyMatrix4(Gu);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o;if(n.isBufferGeometry){var l=n.index,u=n.attributes.position;if(null!==l)for(var c=Math.max(0,a.start),h=Math.min(l.count,a.start+a.count);c<h;c++){var d=l.getX(c);ju.fromBufferAttribute(u,d),Xu(ju,d,s,r,e,t,this)}else for(var p=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);p<f;p++)ju.fromBufferAttribute(u,p),Xu(ju,p,s,r,e,t,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}},{key:"updateMorphTargets",value:function(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(n.length>0){var r=t[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=e.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}]),n}(Tn);function Xu(e,t,n,r,i,a,o){var s=Vu.distanceSqToPoint(e);if(s<n){var l=new tt;Vu.closestPointToPoint(e,l),l.applyMatrix4(r);var u=i.ray.origin.distanceTo(l);if(u<i.near||u>i.far)return;a.push({distance:u,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}qu.prototype.isPoints=!0;var Yu=new tt,Ju=new tt,Zu=new tt,Ku=new Ht,Qu=new Ht,$u=new Pt,ec=new tt,tc=new tt,nc=new tt,rc=new Ht,ic=new Ht,ac=new Ht,oc=function(e){d(n,e);var t=f(n);function n(e){var r;if(_(this,n),(r=t.call(this)).type="Sprite",void 0===Hu){Hu=new On;var i=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),a=new au(i,5);Hu.setIndex([0,1,2,0,2,3]),Hu.setAttribute("position",new iu(a,3,0,!1)),Hu.setAttribute("uv",new iu(a,2,3,!1))}return r.geometry=Hu,r.material=void 0!==e?e:new qs,r.center=new Ht(.5,.5),r}return M(n,[{key:"raycast",value:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ju.setFromMatrixScale(this.matrixWorld),$u.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Zu.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Ju.multiplyScalar(-Zu.z);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;sc(ec.set(-.5,-.5,0),Zu,a,Ju,n,r),sc(tc.set(.5,-.5,0),Zu,a,Ju,n,r),sc(nc.set(.5,.5,0),Zu,a,Ju,n,r),rc.set(0,0),ic.set(1,0),ac.set(1,1);var o=e.ray.intersectTriangle(ec,tc,nc,!1,Yu);if(null!==o||(sc(tc.set(-.5,.5,0),Zu,a,Ju,n,r),ic.set(0,1),null!==(o=e.ray.intersectTriangle(ec,nc,tc,!1,Yu)))){var s=e.ray.origin.distanceTo(Yu);s<e.near||s>e.far||t.push({distance:s,point:Yu.clone(),uv:ur.getUV(Yu,ec,tc,nc,rc,ic,ac,new Ht),face:null,object:this})}}},{key:"copy",value:function(e){return c(g(n.prototype),"copy",this).call(this,e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}]),n}(Tn);function sc(e,t,n,r,i,a){Ku.subVectors(e,n).addScalar(.5).multiply(r),void 0!==i?(Qu.x=a*Ku.x-i*Ku.y,Qu.y=i*Ku.x+a*Ku.y):Qu.copy(Ku),e.copy(t),e.x+=Qu.x,e.y+=Qu.y,e.applyMatrix4($u)}oc.prototype.isSprite=!0;Wo.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Wo.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},hs.prototype.fromPoints=function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)};Iu.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Bu.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};sl.prototype.extractUrlBase=function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),fl.extractUrlBase(e)},sl.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};uu.prototype.center=function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},uu.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},uu.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},uu.prototype.size=function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)},it.prototype.center=function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},it.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},it.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},it.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},it.prototype.size=function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)},hn.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")},wt.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Ct.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},du.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},St.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},St.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},St.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},St.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},St.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},St.prototype.getInverse=function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Pt.prototype.extractPosition=function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},Pt.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Pt.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new tt).setFromMatrixColumn(this,3)},Pt.prototype.setRotationFromQuaternion=function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},Pt.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Pt.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Pt.prototype.multiplyVector4=function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Pt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Pt.prototype.rotateAxis=function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},Pt.prototype.crossVector=function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Pt.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Pt.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Pt.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Pt.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Pt.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Pt.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Pt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Pt.prototype.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)},Pt.prototype.getInverse=function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},kt.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},et.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},et.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Qn.prototype.isIntersectionBox=function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Qn.prototype.isIntersectionPlane=function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},Qn.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},ur.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},ur.prototype.barycoordFromPoint=function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},ur.prototype.midpoint=function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},ur.prototypenormal=function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},ur.prototype.plane=function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)},ur.barycoordFromPoint=function(e,t,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),ur.getBarycoord(e,t,n,r,i)},ur.normal=function(e,t,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),ur.getNormal(e,t,n,r)},ds.prototype.extractAllPoints=function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},ds.prototype.extrude=function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Gs(this,e)},ds.prototype.makeGeometry=function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Ws(this,e)},Ht.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Ht.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},Ht.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},tt.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},tt.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},tt.prototype.getPositionFromMatrix=function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},tt.prototype.getScaleFromMatrix=function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},tt.prototype.getColumnFromMatrix=function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},tt.prototype.applyProjection=function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},tt.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},tt.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},tt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Ft.prototype.fromAttribute=function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},Ft.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Tn.prototype.getChildByName=function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},Tn.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Tn.prototype.translate=function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},Tn.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Tn.prototype.applyMatrix=function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(Tn.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.")}}}),kr.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(kr.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Ro.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Xr.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(vl.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(an.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Be},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Be)}}}),an.prototype.setDynamic=function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Be:ze),this},an.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},an.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},On.prototype.addIndex=function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},On.prototype.addAttribute=function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new an(arguments[1],arguments[2])))},On.prototype.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)},On.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},On.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},On.prototype.removeAttribute=function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},On.prototype.applyMatrix=function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(On.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}}}),au.prototype.setDynamic=function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Be:ze),this},au.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Gs.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Gs.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Gs.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},So.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(Hn.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 tn}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(Wn.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}}}),wo.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)},wo.prototype.animate=function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},wo.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},wo.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},wo.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},wo.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},wo.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},wo.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},wo.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},wo.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},wo.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},wo.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},wo.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},wo.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},wo.prototype.enableScissorTest=function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},wo.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},wo.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},wo.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},wo.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},wo.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},wo.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},wo.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},wo.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},wo.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},wo.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(wo.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?Pe:Ce}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(co.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(jr.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}}}),Jr.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},Jr.prototype.clear=function(e,t,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,n,r)},Ur.crossOrigin=void 0,Ur.loadTexture=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new dl;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},Ur.loadTextureCube=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Fu;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a},Ur.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Ur.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:w}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=w)},7617:(e,t,n)=>{n.d(t,{uZ:()=>a});for(var r=[],i=0;i<256;i++)r[i]=(i<16?"0":"")+i.toString(16);Math.PI,Math.PI;function a(e,t,n){return Math.max(t,Math.min(n,e))}}}]);
6
+ */n.d(e,{A5E:()=>pl,CJI:()=>lr,CP7:()=>Mo,D1R:()=>U,EJi:()=>Qs,F5T:()=>Fn,FM8:()=>Fe,IEO:()=>Po,IOt:()=>zt,Ilk:()=>en,JOQ:()=>Ae,Kj0:()=>Ar,M8C:()=>$t,Mig:()=>Tu,N$j:()=>Co,NMF:()=>wt,OdW:()=>Oo,OoA:()=>z,Ox3:()=>Eu,PMe:()=>wu,Pa4:()=>ee,QRU:()=>pu,SUY:()=>sl,Syv:()=>bt,TUv:()=>Lo,TlE:()=>an,Tme:()=>Tn,TyD:()=>D,USm:()=>cn,UY4:()=>Zs,UZH:()=>M,UlW:()=>Rt,Vkp:()=>Se,VzW:()=>G,Wid:()=>Js,Wl3:()=>S,Xcj:()=>rl,YLQ:()=>O,ZAu:()=>mo,Zp0:()=>vu,ZzF:()=>ie,_C8:()=>ku,_Li:()=>E,_fP:()=>te,aH4:()=>I,aLr:()=>Me,aNw:()=>uu,anP:()=>ui,blk:()=>Go,cLu:()=>W,cPb:()=>Xr,dUE:()=>Nu,dj0:()=>Bt,dpR:()=>fu,ehD:()=>T,hH6:()=>hu,iKG:()=>$r,iLg:()=>Iu,iUV:()=>Ku,jAl:()=>_t,jyz:()=>Wn,kB5:()=>al,knz:()=>Pt,lLk:()=>ou,m7l:()=>el,nls:()=>Io,qyh:()=>B,rBU:()=>Pr,rDY:()=>Gn,rnI:()=>Ct,rpg:()=>C,u9r:()=>In,uWy:()=>P,vBJ:()=>hr,vmT:()=>Mu,vpT:()=>ol,wem:()=>N,wk1:()=>q,x12:()=>Vo,xEZ:()=>Wr,xo$:()=>js,xsS:()=>So,yC1:()=>zu,yGw:()=>Pe,ywz:()=>F,yxD:()=>cu,z$h:()=>Lt});for(var M="139",S=0,E=1,T=2,k=100,A=301,R=302,L=306,C=1e3,P=1001,z=1002,D=1003,O=1004,I=1005,N=1006,B=1007,U=1008,F=1009,H=1012,V=1014,G=1015,W=1016,j=1020,q=1023,X=1026,Y=1027,Z=33776,J=33777,Q=33778,K=33779,$=35840,tt=35841,et=35842,nt=35843,rt=37492,it=37496,at=37808,ot=37809,st=37810,ut=37811,lt=37812,ht=37813,ct=37814,dt=37815,ft=37816,pt=37817,vt=37818,mt=37819,yt=37820,gt=37821,xt=36492,_t=2200,bt=2300,wt=2301,Mt=2302,St=2400,Et=2401,Tt=2402,kt=2500,At=2501,Rt=1,Lt=2,Ct=3e3,Pt=3001,zt=0,Dt="srgb",Ot="srgb-linear",It=7680,Nt=35044,Bt=35048,Ut="300 es",Ft=1035,Ht=[],Vt=0;Vt<256;Vt++)Ht[Vt]=(Vt<16?"0":"")+Vt.toString(16);var Gt=1234567,Wt=Math.PI/180,jt=180/Math.PI;function qt(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(Ht[255&t]+Ht[t>>8&255]+Ht[t>>16&255]+Ht[t>>24&255]+"-"+Ht[255&e]+Ht[e>>8&255]+"-"+Ht[e>>16&15|64]+Ht[e>>24&255]+"-"+Ht[63&n|128]+Ht[n>>8&255]+"-"+Ht[n>>16&255]+Ht[n>>24&255]+Ht[255&r]+Ht[r>>8&255]+Ht[r>>16&255]+Ht[r>>24&255]).toLowerCase()}function Xt(t,e,n){return Math.max(e,Math.min(n,t))}function Yt(t,e){return(t%e+e)%e}function Zt(t,e,n){return(1-n)*t+n*e}function Jt(t){return 0==(t&t-1)&&0!==t}function Qt(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Kt(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var $t=Object.freeze({__proto__:null,DEG2RAD:Wt,RAD2DEG:jt,generateUUID:qt,clamp:Xt,euclideanModulo:Yt,mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:Zt,damp:function(t,e,n,r){return Zt(t,e,1-Math.exp(-n*r))},pingpong:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e-Math.abs(Yt(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(Gt=t);var e=Gt+=1831565813;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*Wt},radToDeg:function(t){return t*jt},isPowerOfTwo:Jt,ceilPowerOfTwo:Qt,floorPowerOfTwo:Kt,setQuaternionFromProperEuler:function(t,e,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),u=o(n/2),l=a((e+r)/2),h=o((e+r)/2),c=a((e-r)/2),d=o((e-r)/2),f=a((r-e)/2),p=o((r-e)/2);switch(i){case"XYX":t.set(s*h,u*c,u*d,s*l);break;case"YZY":t.set(u*d,s*h,u*c,s*l);break;case"ZXZ":t.set(u*c,u*d,s*h,s*l);break;case"XZX":t.set(s*h,u*p,u*f,s*l);break;case"YXY":t.set(u*f,s*h,u*p,s*l);break;case"ZYZ":t.set(u*p,u*f,s*h,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}},normalize:function(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}},denormalize:function(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}}),te=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;_(this,t),this._x=e,this._y=n,this._z=r,this._w=i}return w(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}},{key:"set",value:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}},{key:"setFromEuler",value:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,r=t._y,i=t._z,a=t._order,o=Math.cos,s=Math.sin,u=o(n/2),l=o(r/2),h=o(i/2),c=s(n/2),d=s(r/2),f=s(i/2);switch(a){case"XYZ":this._x=c*l*h+u*d*f,this._y=u*d*h-c*l*f,this._z=u*l*f+c*d*h,this._w=u*l*h-c*d*f;break;case"YXZ":this._x=c*l*h+u*d*f,this._y=u*d*h-c*l*f,this._z=u*l*f-c*d*h,this._w=u*l*h+c*d*f;break;case"ZXY":this._x=c*l*h-u*d*f,this._y=u*d*h+c*l*f,this._z=u*l*f+c*d*h,this._w=u*l*h-c*d*f;break;case"ZYX":this._x=c*l*h-u*d*f,this._y=u*d*h+c*l*f,this._z=u*l*f-c*d*h,this._w=u*l*h+c*d*f;break;case"YZX":this._x=c*l*h+u*d*f,this._y=u*d*h+c*l*f,this._z=u*l*f-c*d*h,this._w=u*l*h-c*d*f;break;case"XZY":this._x=c*l*h-u*d*f,this._y=u*d*h-c*l*f,this._z=u*l*f+c*d*h,this._w=u*l*h+c*d*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(t){var e=t.elements,n=e[0],r=e[4],i=e[8],a=e[1],o=e[5],s=e[9],u=e[2],l=e[6],h=e[10],c=n+o+h;if(c>0){var d=.5/Math.sqrt(c+1);this._w=.25/d,this._x=(l-s)*d,this._y=(i-u)*d,this._z=(a-r)*d}else if(n>o&&n>h){var f=2*Math.sqrt(1+n-o-h);this._w=(l-s)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(i+u)/f}else if(o>h){var p=2*Math.sqrt(1+o-n-h);this._w=(i-u)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(s+l)/p}else{var v=2*Math.sqrt(1+h-n-o);this._w=(a-r)/v,this._x=(i+u)/v,this._y=(s+l)/v,this._z=.25*v}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(t,e){var n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}},{key:"angleTo",value:function(t){return 2*Math.acos(Math.abs(Xt(this.dot(t),-1,1)))}},{key:"rotateTowards",value:function(t,e){var n=this.angleTo(t);if(0===n)return this;var r=Math.min(1,e/n);return this.slerp(t,r),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}},{key:"multiply",value:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}},{key:"premultiply",value:function(t){return this.multiplyQuaternions(t,this)}},{key:"multiplyQuaternions",value:function(t,e){var n=t._x,r=t._y,i=t._z,a=t._w,o=e._x,s=e._y,u=e._z,l=e._w;return this._x=n*l+a*o+r*u-i*s,this._y=r*l+a*s+i*o-n*u,this._z=i*l+a*u+n*s-r*o,this._w=a*l-n*o-r*s-i*u,this._onChangeCallback(),this}},{key:"slerp",value:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),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 u=1-e;return this._w=u*a+e*this._w,this._x=u*n+e*this._x,this._y=u*r+e*this._y,this._z=u*i+e*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),h=Math.atan2(l,o),c=Math.sin((1-e)*h)/l,d=Math.sin(e*h)/l;return this._w=a*c+this._w*d,this._x=n*c+this._x*d,this._y=r*c+this._y*d,this._z=i*c+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(t,e,n){return this.copy(t).slerp(e,n)}},{key:"random",value:function(){var t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(e*Math.cos(r),n*Math.sin(i),n*Math.cos(i),e*Math.sin(r))}},{key:"equals",value:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}},{key:"fromArray",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}},{key:"fromBufferAttribute",value:function(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}},{key:"_onChange",value:function(t){return this._onChangeCallback=t,this}},{key:"_onChangeCallback",value:function(){}}],[{key:"slerp",value:function(t,e,n,r){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(t,e,r)}},{key:"slerpFlat",value:function(t,e,n,r,i,a,o){var s=n[r+0],u=n[r+1],l=n[r+2],h=n[r+3],c=i[a+0],d=i[a+1],f=i[a+2],p=i[a+3];if(0===o)return t[e+0]=s,t[e+1]=u,t[e+2]=l,void(t[e+3]=h);if(1===o)return t[e+0]=c,t[e+1]=d,t[e+2]=f,void(t[e+3]=p);if(h!==p||s!==c||u!==d||l!==f){var v=1-o,m=s*c+u*d+l*f+h*p,y=m>=0?1:-1,g=1-m*m;if(g>Number.EPSILON){var x=Math.sqrt(g),_=Math.atan2(x,m*y);v=Math.sin(v*_)/x,o=Math.sin(o*_)/x}var b=o*y;if(s=s*v+c*b,u=u*v+d*b,l=l*v+f*b,h=h*v+p*b,v===1-o){var w=1/Math.sqrt(s*s+u*u+l*l+h*h);s*=w,u*=w,l*=w,h*=w}}t[e]=s,t[e+1]=u,t[e+2]=l,t[e+3]=h}},{key:"multiplyQuaternionsFlat",value:function(t,e,n,r,i,a){var o=n[r],s=n[r+1],u=n[r+2],l=n[r+3],h=i[a],c=i[a+1],d=i[a+2],f=i[a+3];return t[e]=o*f+l*h+s*d-u*c,t[e+1]=s*f+l*c+u*h-o*d,t[e+2]=u*f+l*d+o*c-s*h,t[e+3]=l*f-o*h-s*c-u*d,t}}]),t}();te.prototype.isQuaternion=!0;var ee=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;_(this,e),this.x=t,this.y=n,this.z=r}return w(e,[{key:"set",value:function(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}},{key:"setScalar",value:function(t){return this.x=t,this.y=t,this.z=t,this}},{key:"setX",value:function(t){return this.x=t,this}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setZ",value:function(t){return this.z=t,this}},{key:"setComponent",value:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}},{key:"getComponent",value:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}},{key:"add",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}},{key:"addScalar",value:function(t){return this.x+=t,this.y+=t,this.z+=t,this}},{key:"addVectors",value:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}},{key:"addScaledVector",value:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}},{key:"sub",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}},{key:"subScalar",value:function(t){return this.x-=t,this.y-=t,this.z-=t,this}},{key:"subVectors",value:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}},{key:"multiply",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}},{key:"multiplyScalar",value:function(t){return this.x*=t,this.y*=t,this.z*=t,this}},{key:"multiplyVectors",value:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}},{key:"applyEuler",value:function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(re.setFromEuler(t))}},{key:"applyAxisAngle",value:function(t,e){return this.applyQuaternion(re.setFromAxisAngle(t,e))}},{key:"applyMatrix3",value:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}},{key:"applyNormalMatrix",value:function(t){return this.applyMatrix3(t).normalize()}},{key:"applyMatrix4",value:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,a=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*a,this}},{key:"applyQuaternion",value:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,a=t.y,o=t.z,s=t.w,u=s*e+a*r-o*n,l=s*n+o*e-i*r,h=s*r+i*n-a*e,c=-i*e-a*n-o*r;return this.x=u*s+c*-i+l*-o-h*-a,this.y=l*s+c*-a+h*-i-u*-o,this.z=h*s+c*-o+u*-a-l*-i,this}},{key:"project",value:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}},{key:"unproject",value:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}},{key:"transformDirection",value:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()}},{key:"divide",value:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}},{key:"divideScalar",value:function(t){return this.multiplyScalar(1/t)}},{key:"min",value:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}},{key:"max",value:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}},{key:"clamp",value:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}},{key:"clampScalar",value:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}},{key:"clampLength",value:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(t){return this.x*t.x+this.y*t.y+this.z*t.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(t){return this.normalize().multiplyScalar(t)}},{key:"lerp",value:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}},{key:"lerpVectors",value:function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}},{key:"cross",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}},{key:"crossVectors",value:function(t,e){var n=t.x,r=t.y,i=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}},{key:"projectOnVector",value:function(t){var e=t.lengthSq();if(0===e)return this.set(0,0,0);var n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}},{key:"projectOnPlane",value:function(t){return ne.copy(this).projectOnVector(t),this.sub(ne)}},{key:"reflect",value:function(t){return this.sub(ne.copy(t).multiplyScalar(2*this.dot(t)))}},{key:"angleTo",value:function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;var n=this.dot(t)/e;return Math.acos(Xt(n,-1,1))}},{key:"distanceTo",value:function(t){return Math.sqrt(this.distanceToSquared(t))}},{key:"distanceToSquared",value:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}},{key:"manhattanDistanceTo",value:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}},{key:"setFromSpherical",value:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}},{key:"setFromSphericalCoords",value:function(t,e,n){var r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}},{key:"setFromCylindrical",value:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}},{key:"setFromCylindricalCoords",value:function(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}},{key:"setFromMatrixPosition",value:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}},{key:"setFromMatrixScale",value:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}},{key:"setFromMatrixColumn",value:function(t,e){return this.fromArray(t.elements,4*e)}},{key:"setFromMatrix3Column",value:function(t,e){return this.fromArray(t.elements,3*e)}},{key:"setFromEuler",value:function(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}},{key:"equals",value:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}},{key:"fromArray",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}},{key:"fromBufferAttribute",value:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"randomDirection",value:function(){var t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(t,2));return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}},{key:Symbol.iterator,value:x().mark((function t(){return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.x;case 2:return t.next=4,this.y;case 4:return t.next=6,this.z;case 6:case"end":return t.stop()}}),t,this)}))}]),e}();ee.prototype.isVector3=!0;var ne=new ee,re=new te,ie=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ee(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ee(-1/0,-1/0,-1/0);_(this,t),this.min=e,this.max=n}return w(t,[{key:"set",value:function(t,e){return this.min.copy(t),this.max.copy(e),this}},{key:"setFromArray",value:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,u=t.length;s<u;s+=3){var l=t[s],h=t[s+1],c=t[s+2];l<e&&(e=l),h<n&&(n=h),c<r&&(r=c),l>i&&(i=l),h>a&&(a=h),c>o&&(o=c)}return this.min.set(e,n,r),this.max.set(i,a,o),this}},{key:"setFromBufferAttribute",value:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,u=t.count;s<u;s++){var l=t.getX(s),h=t.getY(s),c=t.getZ(s);l<e&&(e=l),h<n&&(n=h),c<r&&(r=c),l>i&&(i=l),h>a&&(a=h),c>o&&(o=c)}return this.min.set(e,n,r),this.max.set(i,a,o),this}},{key:"setFromPoints",value:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}},{key:"setFromCenterAndSize",value:function(t,e){var n=oe.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}},{key:"setFromObject",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(t,e)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(t){return this.min.copy(t.min),this.max.copy(t.max),this}},{key:"makeEmpty",value: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}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}},{key:"getCenter",value:function(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(t){return this.min.min(t),this.max.max(t),this}},{key:"expandByVector",value:function(t){return this.min.sub(t),this.max.add(t),this}},{key:"expandByScalar",value:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this}},{key:"expandByObject",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t.updateWorldMatrix(!1,!1);var n=t.geometry;if(void 0!==n)if(e&&null!=n.attributes&&void 0!==n.attributes.position)for(var r=n.attributes.position,i=0,a=r.count;i<a;i++)oe.fromBufferAttribute(r,i).applyMatrix4(t.matrixWorld),this.expandByPoint(oe);else null===n.boundingBox&&n.computeBoundingBox(),se.copy(n.boundingBox),se.applyMatrix4(t.matrixWorld),this.union(se);for(var o=t.children,s=0,u=o.length;s<u;s++)this.expandByObject(o[s],e);return this}},{key:"containsPoint",value:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}},{key:"containsBox",value:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}},{key:"getParameter",value:function(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}},{key:"intersectsBox",value:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}},{key:"intersectsSphere",value:function(t){return this.clampPoint(t.center,oe),oe.distanceToSquared(t.center)<=t.radius*t.radius}},{key:"intersectsPlane",value:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}},{key:"intersectsTriangle",value:function(t){if(this.isEmpty())return!1;this.getCenter(pe),ve.subVectors(this.max,pe),ue.subVectors(t.a,pe),le.subVectors(t.b,pe),he.subVectors(t.c,pe),ce.subVectors(le,ue),de.subVectors(he,le),fe.subVectors(ue,he);var e=[0,-ce.z,ce.y,0,-de.z,de.y,0,-fe.z,fe.y,ce.z,0,-ce.x,de.z,0,-de.x,fe.z,0,-fe.x,-ce.y,ce.x,0,-de.y,de.x,0,-fe.y,fe.x,0];return!!ge(e,ue,le,he,ve)&&(!!ge(e=[1,0,0,0,1,0,0,0,1],ue,le,he,ve)&&(me.crossVectors(ce,de),ge(e=[me.x,me.y,me.z],ue,le,he,ve)))}},{key:"clampPoint",value:function(t,e){return e.copy(t).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(t){return oe.copy(t).clamp(this.min,this.max).sub(t).length()}},{key:"getBoundingSphere",value:function(t){return this.getCenter(t.center),t.radius=.5*this.getSize(oe).length(),t}},{key:"intersect",value:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(t){return this.min.min(t.min),this.max.max(t.max),this}},{key:"applyMatrix4",value:function(t){return this.isEmpty()||(ae[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ae[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ae[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ae[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ae[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ae[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ae[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ae[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ae)),this}},{key:"translate",value:function(t){return this.min.add(t),this.max.add(t),this}},{key:"equals",value:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}]),t}();ie.prototype.isBox3=!0;var ae=[new ee,new ee,new ee,new ee,new ee,new ee,new ee,new ee],oe=new ee,se=new ie,ue=new ee,le=new ee,he=new ee,ce=new ee,de=new ee,fe=new ee,pe=new ee,ve=new ee,me=new ee,ye=new ee;function ge(t,e,n,r,i){for(var a=0,o=t.length-3;a<=o;a+=3){ye.fromArray(t,a);var s=i.x*Math.abs(ye.x)+i.y*Math.abs(ye.y)+i.z*Math.abs(ye.z),u=e.dot(ye),l=n.dot(ye),h=r.dot(ye);if(Math.max(-Math.max(u,l,h),Math.min(u,l,h))>s)return!1}return!0}var xe=new ie,_e=new ee,be=new ee,we=new ee,Me=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ee,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;_(this,t),this.center=e,this.radius=n}return w(t,[{key:"set",value:function(t,e){return this.center.copy(t),this.radius=e,this}},{key:"setFromPoints",value:function(t,e){var n=this.center;void 0!==e?n.copy(e):xe.setFromPoints(t).getCenter(n);for(var r=0,i=0,a=t.length;i<a;i++)r=Math.max(r,n.distanceToSquared(t[i]));return this.radius=Math.sqrt(r),this}},{key:"copy",value:function(t){return this.center.copy(t.center),this.radius=t.radius,this}},{key:"isEmpty",value:function(){return this.radius<0}},{key:"makeEmpty",value:function(){return this.center.set(0,0,0),this.radius=-1,this}},{key:"containsPoint",value:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}},{key:"distanceToPoint",value:function(t){return t.distanceTo(this.center)-this.radius}},{key:"intersectsSphere",value:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}},{key:"intersectsBox",value:function(t){return t.intersectsSphere(this)}},{key:"intersectsPlane",value:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}},{key:"clampPoint",value:function(t,e){var n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}},{key:"getBoundingBox",value:function(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}},{key:"applyMatrix4",value:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}},{key:"translate",value:function(t){return this.center.add(t),this}},{key:"expandByPoint",value:function(t){we.subVectors(t,this.center);var e=we.lengthSq();if(e>this.radius*this.radius){var n=Math.sqrt(e),r=.5*(n-this.radius);this.center.add(we.multiplyScalar(r/n)),this.radius+=r}return this}},{key:"union",value:function(t){return!0===this.center.equals(t.center)?be.set(0,0,1).multiplyScalar(t.radius):be.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(_e.copy(t.center).add(be)),this.expandByPoint(_e.copy(t.center).sub(be)),this}},{key:"equals",value:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),t}(),Se=function(){function t(){_(this,t),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.")}return w(t,[{key:"set",value:function(t,e,n,r,i,a,o,s,u){var l=this.elements;return l[0]=t,l[1]=r,l[2]=o,l[3]=e,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=u,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}},{key:"extractBasis",value:function(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}},{key:"multiply",value:function(t){return this.multiplyMatrices(this,t)}},{key:"premultiply",value:function(t){return this.multiplyMatrices(t,this)}},{key:"multiplyMatrices",value:function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[3],s=n[6],u=n[1],l=n[4],h=n[7],c=n[2],d=n[5],f=n[8],p=r[0],v=r[3],m=r[6],y=r[1],g=r[4],x=r[7],_=r[2],b=r[5],w=r[8];return i[0]=a*p+o*y+s*_,i[3]=a*v+o*g+s*b,i[6]=a*m+o*x+s*w,i[1]=u*p+l*y+h*_,i[4]=u*v+l*g+h*b,i[7]=u*m+l*x+h*w,i[2]=c*p+d*y+f*_,i[5]=c*v+d*g+f*b,i[8]=c*m+d*x+f*w,this}},{key:"multiplyScalar",value:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}},{key:"determinant",value:function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],u=t[7],l=t[8];return e*a*l-e*o*u-n*i*l+n*o*s+r*i*u-r*a*s}},{key:"invert",value:function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],u=t[7],l=t[8],h=l*a-o*u,c=o*s-l*i,d=u*i-a*s,f=e*h+n*c+r*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);var p=1/f;return t[0]=h*p,t[1]=(r*u-l*n)*p,t[2]=(o*n-r*a)*p,t[3]=c*p,t[4]=(l*e-r*s)*p,t[5]=(r*i-o*e)*p,t[6]=d*p,t[7]=(n*s-u*e)*p,t[8]=(a*e-n*i)*p,this}},{key:"transpose",value:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}},{key:"getNormalMatrix",value:function(t){return this.setFromMatrix4(t).invert().transpose()}},{key:"transposeIntoArray",value:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}},{key:"setUvTransform",value:function(t,e,n,r,i,a,o){var s=Math.cos(i),u=Math.sin(i);return this.set(n*s,n*u,-n*(s*a+u*o)+a+t,-r*u,r*s,-r*(-u*a+s*o)+o+e,0,0,1),this}},{key:"scale",value:function(t,e){var n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}},{key:"rotate",value:function(t){var e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],u=r[4],l=r[7];return r[0]=e*i+n*s,r[3]=e*a+n*u,r[6]=e*o+n*l,r[1]=-n*i+e*s,r[4]=-n*a+e*u,r[7]=-n*o+e*l,this}},{key:"translate",value:function(t,e){var n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}},{key:"equals",value:function(t){for(var e=this.elements,n=t.elements,r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=t[n+e];return this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}]),t}();Se.prototype.isMatrix3=!0;var Ee=new ee,Te=new ee,ke=new Se,Ae=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ee(1,0,0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;_(this,t),this.normal=e,this.constant=n}return w(t,[{key:"set",value:function(t,e){return this.normal.copy(t),this.constant=e,this}},{key:"setComponents",value:function(t,e,n,r){return this.normal.set(t,e,n),this.constant=r,this}},{key:"setFromNormalAndCoplanarPoint",value:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}},{key:"setFromCoplanarPoints",value:function(t,e,n){var r=Ee.subVectors(n,e).cross(Te.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(r,t),this}},{key:"copy",value:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this}},{key:"normalize",value:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}},{key:"negate",value:function(){return this.constant*=-1,this.normal.negate(),this}},{key:"distanceToPoint",value:function(t){return this.normal.dot(t)+this.constant}},{key:"distanceToSphere",value:function(t){return this.distanceToPoint(t.center)-t.radius}},{key:"projectPoint",value:function(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}},{key:"intersectLine",value:function(t,e){var n=t.delta(Ee),r=this.normal.dot(n);if(0===r)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;var i=-(t.start.dot(this.normal)+this.constant)/r;return i<0||i>1?null:e.copy(n).multiplyScalar(i).add(t.start)}},{key:"intersectsLine",value:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}},{key:"intersectsBox",value:function(t){return t.intersectsPlane(this)}},{key:"intersectsSphere",value:function(t){return t.intersectsPlane(this)}},{key:"coplanarPoint",value:function(t){return t.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(t,e){var n=e||ke.getNormalMatrix(t),r=this.coplanarPoint(Ee).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}},{key:"translate",value:function(t){return this.constant-=t.dot(this.normal),this}},{key:"equals",value:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),t}();Ae.prototype.isPlane=!0;var Re=new Me,Le=new ee,Ce=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ae,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ae,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Ae,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Ae,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Ae,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new Ae;_(this,t),this.planes=[e,n,r,i,a,o]}return w(t,[{key:"set",value:function(t,e,n,r,i,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}},{key:"copy",value:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],u=n[5],l=n[6],h=n[7],c=n[8],d=n[9],f=n[10],p=n[11],v=n[12],m=n[13],y=n[14],g=n[15];return e[0].setComponents(o-r,h-s,p-c,g-v).normalize(),e[1].setComponents(o+r,h+s,p+c,g+v).normalize(),e[2].setComponents(o+i,h+u,p+d,g+m).normalize(),e[3].setComponents(o-i,h-u,p-d,g-m).normalize(),e[4].setComponents(o-a,h-l,p-f,g-y).normalize(),e[5].setComponents(o+a,h+l,p+f,g+y).normalize(),this}},{key:"intersectsObject",value:function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Re.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Re)}},{key:"intersectsSprite",value:function(t){return Re.center.set(0,0,0),Re.radius=.7071067811865476,Re.applyMatrix4(t.matrixWorld),this.intersectsSphere(Re)}},{key:"intersectsSphere",value:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n)<r)return!1}return!0}},{key:"intersectsBox",value:function(t){for(var e=this.planes,n=0;n<6;n++){var r=e[n];if(Le.x=r.normal.x>0?t.max.x:t.min.x,Le.y=r.normal.y>0?t.max.y:t.min.y,Le.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(Le)<0)return!1}return!0}},{key:"containsPoint",value:function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),t}(),Pe=function(){function t(){_(this,t),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.")}return w(t,[{key:"set",value:function(t,e,n,r,i,a,o,s,u,l,h,c,d,f,p,v){var m=this.elements;return m[0]=t,m[4]=e,m[8]=n,m[12]=r,m[1]=i,m[5]=a,m[9]=o,m[13]=s,m[2]=u,m[6]=l,m[10]=h,m[14]=c,m[3]=d,m[7]=f,m[11]=p,m[15]=v,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new t).fromArray(this.elements)}},{key:"copy",value:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}},{key:"copyPosition",value:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}},{key:"setFromMatrix3",value:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}},{key:"extractBasis",value:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(t){var e=this.elements,n=t.elements,r=1/ze.setFromMatrixColumn(t,0).length(),i=1/ze.setFromMatrixColumn(t,1).length(),a=1/ze.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}},{key:"makeRotationFromEuler",value:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),u=Math.sin(r),l=Math.cos(i),h=Math.sin(i);if("XYZ"===t.order){var c=a*l,d=a*h,f=o*l,p=o*h;e[0]=s*l,e[4]=-s*h,e[8]=u,e[1]=d+f*u,e[5]=c-p*u,e[9]=-o*s,e[2]=p-c*u,e[6]=f+d*u,e[10]=a*s}else if("YXZ"===t.order){var v=s*l,m=s*h,y=u*l,g=u*h;e[0]=v+g*o,e[4]=y*o-m,e[8]=a*u,e[1]=a*h,e[5]=a*l,e[9]=-o,e[2]=m*o-y,e[6]=g+v*o,e[10]=a*s}else if("ZXY"===t.order){var x=s*l,_=s*h,b=u*l,w=u*h;e[0]=x-w*o,e[4]=-a*h,e[8]=b+_*o,e[1]=_+b*o,e[5]=a*l,e[9]=w-x*o,e[2]=-a*u,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var M=a*l,S=a*h,E=o*l,T=o*h;e[0]=s*l,e[4]=E*u-S,e[8]=M*u+T,e[1]=s*h,e[5]=T*u+M,e[9]=S*u-E,e[2]=-u,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var k=a*s,A=a*u,R=o*s,L=o*u;e[0]=s*l,e[4]=L-k*h,e[8]=R*h+A,e[1]=h,e[5]=a*l,e[9]=-o*l,e[2]=-u*l,e[6]=A*h+R,e[10]=k-L*h}else if("XZY"===t.order){var C=a*s,P=a*u,z=o*s,D=o*u;e[0]=s*l,e[4]=-h,e[8]=u*l,e[1]=C*h+D,e[5]=a*l,e[9]=P*h-z,e[2]=z*h-P,e[6]=o*l,e[10]=D*h+C}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(t){return this.compose(Oe,t,Ie)}},{key:"lookAt",value:function(t,e,n){var r=this.elements;return Ue.subVectors(t,e),0===Ue.lengthSq()&&(Ue.z=1),Ue.normalize(),Ne.crossVectors(n,Ue),0===Ne.lengthSq()&&(1===Math.abs(n.z)?Ue.x+=1e-4:Ue.z+=1e-4,Ue.normalize(),Ne.crossVectors(n,Ue)),Ne.normalize(),Be.crossVectors(Ue,Ne),r[0]=Ne.x,r[4]=Be.x,r[8]=Ue.x,r[1]=Ne.y,r[5]=Be.y,r[9]=Ue.y,r[2]=Ne.z,r[6]=Be.z,r[10]=Ue.z,this}},{key:"multiply",value:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}},{key:"premultiply",value:function(t){return this.multiplyMatrices(t,this)}},{key:"multiplyMatrices",value:function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[4],s=n[8],u=n[12],l=n[1],h=n[5],c=n[9],d=n[13],f=n[2],p=n[6],v=n[10],m=n[14],y=n[3],g=n[7],x=n[11],_=n[15],b=r[0],w=r[4],M=r[8],S=r[12],E=r[1],T=r[5],k=r[9],A=r[13],R=r[2],L=r[6],C=r[10],P=r[14],z=r[3],D=r[7],O=r[11],I=r[15];return i[0]=a*b+o*E+s*R+u*z,i[4]=a*w+o*T+s*L+u*D,i[8]=a*M+o*k+s*C+u*O,i[12]=a*S+o*A+s*P+u*I,i[1]=l*b+h*E+c*R+d*z,i[5]=l*w+h*T+c*L+d*D,i[9]=l*M+h*k+c*C+d*O,i[13]=l*S+h*A+c*P+d*I,i[2]=f*b+p*E+v*R+m*z,i[6]=f*w+p*T+v*L+m*D,i[10]=f*M+p*k+v*C+m*O,i[14]=f*S+p*A+v*P+m*I,i[3]=y*b+g*E+x*R+_*z,i[7]=y*w+g*T+x*L+_*D,i[11]=y*M+g*k+x*C+_*O,i[15]=y*S+g*A+x*P+_*I,this}},{key:"multiplyScalar",value:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}},{key:"determinant",value:function(){var t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],a=t[1],o=t[5],s=t[9],u=t[13],l=t[2],h=t[6],c=t[10],d=t[14];return t[3]*(+i*s*h-r*u*h-i*o*c+n*u*c+r*o*d-n*s*d)+t[7]*(+e*s*d-e*u*c+i*a*c-r*a*d+r*u*l-i*s*l)+t[11]*(+e*u*h-e*o*d-i*a*h+n*a*d+i*o*l-n*u*l)+t[15]*(-r*o*l-e*s*h+e*o*c+r*a*h-n*a*c+n*s*l)}},{key:"transpose",value:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}},{key:"setPosition",value:function(t,e,n){var r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}},{key:"invert",value:function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],u=t[7],l=t[8],h=t[9],c=t[10],d=t[11],f=t[12],p=t[13],v=t[14],m=t[15],y=h*v*u-p*c*u+p*s*d-o*v*d-h*s*m+o*c*m,g=f*c*u-l*v*u-f*s*d+a*v*d+l*s*m-a*c*m,x=l*p*u-f*h*u+f*o*d-a*p*d-l*o*m+a*h*m,_=f*h*s-l*p*s-f*o*c+a*p*c+l*o*v-a*h*v,b=e*y+n*g+r*x+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var w=1/b;return t[0]=y*w,t[1]=(p*c*i-h*v*i-p*r*d+n*v*d+h*r*m-n*c*m)*w,t[2]=(o*v*i-p*s*i+p*r*u-n*v*u-o*r*m+n*s*m)*w,t[3]=(h*s*i-o*c*i-h*r*u+n*c*u+o*r*d-n*s*d)*w,t[4]=g*w,t[5]=(l*v*i-f*c*i+f*r*d-e*v*d-l*r*m+e*c*m)*w,t[6]=(f*s*i-a*v*i-f*r*u+e*v*u+a*r*m-e*s*m)*w,t[7]=(a*c*i-l*s*i+l*r*u-e*c*u-a*r*d+e*s*d)*w,t[8]=x*w,t[9]=(f*h*i-l*p*i-f*n*d+e*p*d+l*n*m-e*h*m)*w,t[10]=(a*p*i-f*o*i+f*n*u-e*p*u-a*n*m+e*o*m)*w,t[11]=(l*o*i-a*h*i-l*n*u+e*h*u+a*n*d-e*o*d)*w,t[12]=_*w,t[13]=(l*p*r-f*h*r+f*n*c-e*p*c-l*n*v+e*h*v)*w,t[14]=(f*o*r-a*p*r-f*n*s+e*p*s+a*n*v-e*o*v)*w,t[15]=(a*h*r-l*o*r+l*n*s-e*h*s-a*n*c+e*o*c)*w,this}},{key:"scale",value:function(t){var e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this}},{key:"getMaxScaleOnAxis",value:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}},{key:"makeTranslation",value:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}},{key:"makeRotationX",value:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}},{key:"makeRotationY",value:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,a=t.x,o=t.y,s=t.z,u=i*a,l=i*o;return this.set(u*a+n,u*o-r*s,u*s+r*o,0,u*o+r*s,l*o+n,l*s-r*a,0,u*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(t,e,n,r,i,a){return this.set(1,n,i,0,t,1,a,0,e,r,1,0,0,0,0,1),this}},{key:"compose",value:function(t,e,n){var r=this.elements,i=e._x,a=e._y,o=e._z,s=e._w,u=i+i,l=a+a,h=o+o,c=i*u,d=i*l,f=i*h,p=a*l,v=a*h,m=o*h,y=s*u,g=s*l,x=s*h,_=n.x,b=n.y,w=n.z;return r[0]=(1-(p+m))*_,r[1]=(d+x)*_,r[2]=(f-g)*_,r[3]=0,r[4]=(d-x)*b,r[5]=(1-(c+m))*b,r[6]=(v+y)*b,r[7]=0,r[8]=(f+g)*w,r[9]=(v-y)*w,r[10]=(1-(c+p))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}},{key:"decompose",value:function(t,e,n){var r=this.elements,i=ze.set(r[0],r[1],r[2]).length(),a=ze.set(r[4],r[5],r[6]).length(),o=ze.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],De.copy(this);var s=1/i,u=1/a,l=1/o;return De.elements[0]*=s,De.elements[1]*=s,De.elements[2]*=s,De.elements[4]*=u,De.elements[5]*=u,De.elements[6]*=u,De.elements[8]*=l,De.elements[9]*=l,De.elements[10]*=l,e.setFromRotationMatrix(De),n.x=i,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(t,e,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/(e-t),u=2*i/(n-r),l=(e+t)/(e-t),h=(n+r)/(n-r),c=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=u,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=c,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}},{key:"makeOrthographic",value:function(t,e,n,r,i,a){var o=this.elements,s=1/(e-t),u=1/(n-r),l=1/(a-i),h=(e+t)*s,c=(n+r)*u,d=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*u,o[9]=0,o[13]=-c,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}},{key:"equals",value:function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=t[n+e];return this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}]),t}();Pe.prototype.isMatrix4=!0;var ze=new ee,De=new Pe,Oe=new ee(0,0,0),Ie=new ee(1,1,1),Ne=new ee,Be=new ee,Ue=new ee,Fe=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;_(this,e),this.x=t,this.y=n}return w(e,[{key:"width",get:function(){return this.x},set:function(t){this.x=t}},{key:"height",get:function(){return this.y},set:function(t){this.y=t}},{key:"set",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setScalar",value:function(t){return this.x=t,this.y=t,this}},{key:"setX",value:function(t){return this.x=t,this}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setComponent",value:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}},{key:"getComponent",value:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(t){return this.x=t.x,this.y=t.y,this}},{key:"add",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}},{key:"addScalar",value:function(t){return this.x+=t,this.y+=t,this}},{key:"addVectors",value:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}},{key:"addScaledVector",value:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}},{key:"sub",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}},{key:"subScalar",value:function(t){return this.x-=t,this.y-=t,this}},{key:"subVectors",value:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}},{key:"multiply",value:function(t){return this.x*=t.x,this.y*=t.y,this}},{key:"multiplyScalar",value:function(t){return this.x*=t,this.y*=t,this}},{key:"divide",value:function(t){return this.x/=t.x,this.y/=t.y,this}},{key:"divideScalar",value:function(t){return this.multiplyScalar(1/t)}},{key:"applyMatrix3",value:function(t){var e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}},{key:"min",value:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}},{key:"max",value:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}},{key:"clamp",value:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}},{key:"clampScalar",value:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}},{key:"clampLength",value:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(t){return this.x*t.x+this.y*t.y}},{key:"cross",value:function(t){return this.x*t.y-this.y*t.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){var t=Math.atan2(-this.y,-this.x)+Math.PI;return t}},{key:"distanceTo",value:function(t){return Math.sqrt(this.distanceToSquared(t))}},{key:"distanceToSquared",value:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n}},{key:"manhattanDistanceTo",value:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}},{key:"setLength",value:function(t){return this.normalize().multiplyScalar(t)}},{key:"lerp",value:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}},{key:"lerpVectors",value:function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}},{key:"equals",value:function(t){return t.x===this.x&&t.y===this.y}},{key:"fromArray",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[e],this.y=t[e+1],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.x,t[e+1]=this.y,t}},{key:"fromBufferAttribute",value:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}},{key:"rotateAround",value:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*n-a*r+t.x,this.y=i*r+a*n+t.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:Symbol.iterator,value:x().mark((function t(){return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.x;case 2:return t.next=4,this.y;case 4:case"end":return t.stop()}}),t,this)}))}]),e}();Fe.prototype.isVector2=!0;var He=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;_(this,e),this.x=t,this.y=n,this.z=r,this.w=i}return w(e,[{key:"width",get:function(){return this.z},set:function(t){this.z=t}},{key:"height",get:function(){return this.w},set:function(t){this.w=t}},{key:"set",value:function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}},{key:"setScalar",value:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}},{key:"setX",value:function(t){return this.x=t,this}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setZ",value:function(t){return this.z=t,this}},{key:"setW",value:function(t){return this.w=t,this}},{key:"setComponent",value:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}},{key:"getComponent",value:function(t){switch(t){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: "+t)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}},{key:"add",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}},{key:"addScalar",value:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}},{key:"addVectors",value:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}},{key:"addScaledVector",value:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}},{key:"sub",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}},{key:"subScalar",value:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}},{key:"subVectors",value:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}},{key:"multiply",value:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}},{key:"multiplyScalar",value:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}},{key:"applyMatrix4",value:function(t){var e=this.x,n=this.y,r=this.z,i=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*i,this}},{key:"divideScalar",value:function(t){return this.multiplyScalar(1/t)}},{key:"setAxisAngleFromQuaternion",value:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}},{key:"setAxisAngleFromRotationMatrix",value:function(t){var e,n,r,i,a=.01,o=.1,s=t.elements,u=s[0],l=s[4],h=s[8],c=s[1],d=s[5],f=s[9],p=s[2],v=s[6],m=s[10];if(Math.abs(l-c)<a&&Math.abs(h-p)<a&&Math.abs(f-v)<a){if(Math.abs(l+c)<o&&Math.abs(h+p)<o&&Math.abs(f+v)<o&&Math.abs(u+d+m-3)<o)return this.set(1,0,0,0),this;e=Math.PI;var y=(u+1)/2,g=(d+1)/2,x=(m+1)/2,_=(l+c)/4,b=(h+p)/4,w=(f+v)/4;return y>g&&y>x?y<a?(n=0,r=.707106781,i=.707106781):(r=_/(n=Math.sqrt(y)),i=b/n):g>x?g<a?(n=.707106781,r=0,i=.707106781):(n=_/(r=Math.sqrt(g)),i=w/r):x<a?(n=.707106781,r=.707106781,i=0):(n=b/(i=Math.sqrt(x)),r=w/i),this.set(n,r,i,e),this}var M=Math.sqrt((v-f)*(v-f)+(h-p)*(h-p)+(c-l)*(c-l));return Math.abs(M)<.001&&(M=1),this.x=(v-f)/M,this.y=(h-p)/M,this.z=(c-l)/M,this.w=Math.acos((u+d+m-1)/2),this}},{key:"min",value:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}},{key:"max",value:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}},{key:"clamp",value:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}},{key:"clampScalar",value:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}},{key:"clampLength",value:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}},{key:"floor",value: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}},{key:"ceil",value: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}},{key:"round",value: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}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(t){return this.normalize().multiplyScalar(t)}},{key:"lerp",value:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}},{key:"lerpVectors",value:function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}},{key:"equals",value:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}},{key:"fromArray",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}},{key:"fromBufferAttribute",value:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:Symbol.iterator,value:x().mark((function t(){return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.x;case 2:return t.next=4,this.y;case 4:return t.next=6,this.z;case 6:return t.next=8,this.w;case 8:case"end":return t.stop()}}),t,this)}))}]),e}();function Ve(){var t=null,e=!1,n=null,r=null;function i(e,a){n(e,a),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function Ge(t,e){var n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){var a=r.get(e);(!a||a.version<e.version)&&r.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version})}else{e.isInterleavedBufferAttribute&&(e=e.data);var o=r.get(e);void 0===o?r.set(e,function(e,r){var i,a=e.array,o=e.usage,s=t.createBuffer();if(t.bindBuffer(r,s),t.bufferData(r,a,o),e.onUploadCallback(),a instanceof Float32Array)i=5126;else if(a instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");i=5131}else i=5123;else if(a instanceof Int16Array)i=5122;else if(a instanceof Uint32Array)i=5125;else if(a instanceof Int32Array)i=5124;else if(a instanceof Int8Array)i=5120;else if(a instanceof Uint8Array)i=5121;else{if(!(a instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);i=5121}return{buffer:s,type:i,bytesPerElement:a.BYTES_PER_ELEMENT,version:e.version}}(e,i)):o.version<e.version&&(!function(e,r,i){var a=r.array,o=r.updateRange;t.bindBuffer(i,e),-1===o.count?t.bufferSubData(i,0,a):(n?t.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):t.bufferSubData(i,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(o.buffer,e,i),o.version=e.version)}}}}He.prototype.isVector4=!0;var We=function(){function t(){_(this,t)}return w(t,[{key:"addEventListener",value:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}},{key:"hasEventListener",value:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}},{key:"removeEventListener",value:function(t,e){if(void 0!==this._listeners){var n=this._listeners[t];if(void 0!==n){var r=n.indexOf(e);-1!==r&&n.splice(r,1)}}}},{key:"dispatchEvent",value:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var n=e.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,t);t.target=null}}}}]),t}();function je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}var Xe=(g(i={},Dt,g({},Ot,je)),g(i,Ot,g({},Dt,qe)),i),Ye={legacyMode:!0,get workingColorSpace(){return Ot},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(this.legacyMode||e===n||!e||!n)return t;if(Xe[e]&&void 0!==Xe[e][n]){var r=Xe[e][n];return t.r=r(t.r),t.g=r(t.g),t.b=r(t.b),t}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}},Ze={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Je={r:0,g:0,b:0},Qe={h:0,s:0,l:0},Ke={h:0,s:0,l:0};function $e(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function tn(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}var en=function(){function t(e,n,r){return _(this,t),void 0===n&&void 0===r?this.set(e):this.setRGB(e,n,r)}return w(t,[{key:"set",value:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}},{key:"setScalar",value:function(t){return this.r=t,this.g=t,this.b=t,this}},{key:"setHex",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Dt;return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Ye.toWorkingColorSpace(this,e),this}},{key:"setRGB",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ot;return this.r=t,this.g=e,this.b=n,Ye.toWorkingColorSpace(this,r),this}},{key:"setHSL",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ot;if(t=Yt(t,1),e=Xt(e,0,1),n=Xt(n,0,1),0===e)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+e):n+e-n*e,a=2*n-i;this.r=$e(a,i,t+1/3),this.g=$e(a,i,t),this.b=$e(a,i,t-1/3)}return Ye.toWorkingColorSpace(this,r),this}},{key:"setStyle",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Dt;function r(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}if(e=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){var i,a=e[1],o=e[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,Ye.toWorkingColorSpace(this,n),r(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,Ye.toWorkingColorSpace(this,n),r(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){var s=parseFloat(i[1])/360,u=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return r(i[4]),this.setHSL(s,u,l,n)}}}else if(e=/^\#([A-Fa-f\d]+)$/.exec(t)){var h=e[1],c=h.length;if(3===c)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,Ye.toWorkingColorSpace(this,n),this;if(6===c)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,Ye.toWorkingColorSpace(this,n),this}return t&&t.length>0?this.setColorName(t,n):this}},{key:"setColorName",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Dt,n=Ze[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}},{key:"copySRGBToLinear",value:function(t){return this.r=je(t.r),this.g=je(t.g),this.b=je(t.b),this}},{key:"copyLinearToSRGB",value:function(t){return this.r=qe(t.r),this.g=qe(t.g),this.b=qe(t.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Dt;return Ye.fromWorkingColorSpace(tn(this,Je),t),Xt(255*Je.r,0,255)<<16^Xt(255*Je.g,0,255)<<8^Xt(255*Je.b,0,255)<<0}},{key:"getHexString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Dt;return("000000"+this.getHex(t).toString(16)).slice(-6)}},{key:"getHSL",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ot;Ye.fromWorkingColorSpace(tn(this,Je),e);var n,r,i=Je.r,a=Je.g,o=Je.b,s=Math.max(i,a,o),u=Math.min(i,a,o),l=(u+s)/2;if(u===s)n=0,r=0;else{var h=s-u;switch(r=l<=.5?h/(s+u):h/(2-s-u),s){case i:n=(a-o)/h+(a<o?6:0);break;case a:n=(o-i)/h+2;break;case o:n=(i-a)/h+4}n/=6}return t.h=n,t.s=r,t.l=l,t}},{key:"getRGB",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ot;return Ye.fromWorkingColorSpace(tn(this,Je),e),t.r=Je.r,t.g=Je.g,t.b=Je.b,t}},{key:"getStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Dt;return Ye.fromWorkingColorSpace(tn(this,Je),t),t!==Dt?"color(".concat(t," ").concat(Je.r," ").concat(Je.g," ").concat(Je.b,")"):"rgb(".concat(255*Je.r|0,",").concat(255*Je.g|0,",").concat(255*Je.b|0,")")}},{key:"offsetHSL",value:function(t,e,n){return this.getHSL(Qe),Qe.h+=t,Qe.s+=e,Qe.l+=n,this.setHSL(Qe.h,Qe.s,Qe.l),this}},{key:"add",value:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}},{key:"addColors",value:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}},{key:"addScalar",value:function(t){return this.r+=t,this.g+=t,this.b+=t,this}},{key:"sub",value:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}},{key:"multiply",value:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}},{key:"multiplyScalar",value:function(t){return this.r*=t,this.g*=t,this.b*=t,this}},{key:"lerp",value:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}},{key:"lerpColors",value:function(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}},{key:"lerpHSL",value:function(t,e){this.getHSL(Qe),t.getHSL(Ke);var n=Zt(Qe.h,Ke.h,e),r=Zt(Qe.s,Ke.s,e),i=Zt(Qe.l,Ke.l,e);return this.setHSL(n,r,i),this}},{key:"equals",value:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}},{key:"fromArray",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}},{key:"fromBufferAttribute",value:function(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}},{key:"toJSON",value:function(){return this.getHex()}}]),t}();en.NAMES=Ze,en.prototype.isColor=!0,en.prototype.r=1,en.prototype.g=1,en.prototype.b=1;var nn=new ee,rn=new Fe,an=function(){function t(e,n,r){if(_(this,t),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=n,this.count=void 0!==e?e.length/n:0,this.normalized=!0===r,this.usage=Nt,this.updateRange={offset:0,count:-1},this.version=0}return w(t,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(t){!0===t&&this.version++}},{key:"setUsage",value:function(t){return this.usage=t,this}},{key:"copy",value:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}},{key:"copyAt",value:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this}},{key:"copyArray",value:function(t){return this.array.set(t),this}},{key:"copyColorsArray",value:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new en),e[n++]=a.r,e[n++]=a.g,e[n++]=a.b}return this}},{key:"copyVector2sArray",value:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new Fe),e[n++]=a.x,e[n++]=a.y}return this}},{key:"copyVector3sArray",value:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new ee),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z}return this}},{key:"copyVector4sArray",value:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new He),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z,e[n++]=a.w}return this}},{key:"applyMatrix3",value:function(t){if(2===this.itemSize)for(var e=0,n=this.count;e<n;e++)rn.fromBufferAttribute(this,e),rn.applyMatrix3(t),this.setXY(e,rn.x,rn.y);else if(3===this.itemSize)for(var r=0,i=this.count;r<i;r++)nn.fromBufferAttribute(this,r),nn.applyMatrix3(t),this.setXYZ(r,nn.x,nn.y,nn.z);return this}},{key:"applyMatrix4",value:function(t){for(var e=0,n=this.count;e<n;e++)nn.fromBufferAttribute(this,e),nn.applyMatrix4(t),this.setXYZ(e,nn.x,nn.y,nn.z);return this}},{key:"applyNormalMatrix",value:function(t){for(var e=0,n=this.count;e<n;e++)nn.fromBufferAttribute(this,e),nn.applyNormalMatrix(t),this.setXYZ(e,nn.x,nn.y,nn.z);return this}},{key:"transformDirection",value:function(t){for(var e=0,n=this.count;e<n;e++)nn.fromBufferAttribute(this,e),nn.transformDirection(t),this.setXYZ(e,nn.x,nn.y,nn.z);return this}},{key:"set",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(t,e),this}},{key:"getX",value:function(t){return this.array[t*this.itemSize]}},{key:"setX",value:function(t,e){return this.array[t*this.itemSize]=e,this}},{key:"getY",value:function(t){return this.array[t*this.itemSize+1]}},{key:"setY",value:function(t,e){return this.array[t*this.itemSize+1]=e,this}},{key:"getZ",value:function(t){return this.array[t*this.itemSize+2]}},{key:"setZ",value:function(t,e){return this.array[t*this.itemSize+2]=e,this}},{key:"getW",value:function(t){return this.array[t*this.itemSize+3]}},{key:"setW",value:function(t,e){return this.array[t*this.itemSize+3]=e,this}},{key:"setXY",value:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this}},{key:"setXYZ",value:function(t,e,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this}},{key:"setXYZW",value:function(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,this}},{key:"onUpload",value:function(t){return this.onUploadCallback=t,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==Nt&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}]),t}();an.prototype.isBufferAttribute=!0;var on=function(t){d(n,t);var e=p(n);function n(t,r,i){return _(this,n),e.call(this,new Uint16Array(t),r,i)}return w(n)}(an),sn=function(t){d(n,t);var e=p(n);function n(t,r,i){return _(this,n),e.call(this,new Uint32Array(t),r,i)}return w(n)}(an);(function(t){d(n,t);var e=p(n);function n(t,r,i){return _(this,n),e.call(this,new Uint16Array(t),r,i)}return w(n)})(an).prototype.isFloat16BufferAttribute=!0;var un=function(t){d(n,t);var e=p(n);function n(t,r,i){return _(this,n),e.call(this,new Float32Array(t),r,i)}return w(n)}(an),ln=new Pe,hn=new te,cn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.DefaultOrder;_(this,t),this._x=e,this._y=n,this._z=r,this._order=i}return w(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}},{key:"set",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=t,this._y=e,this._z=n,this._order=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=t.elements,i=r[0],a=r[4],o=r[8],s=r[1],u=r[5],l=r[9],h=r[2],c=r[6],d=r[10];switch(e){case"XYZ":this._y=Math.asin(Xt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(c,u),this._z=0);break;case"YXZ":this._x=Math.asin(-Xt(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(s,u)):(this._y=Math.atan2(-h,i),this._z=0);break;case"ZXY":this._x=Math.asin(Xt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(s,i));break;case"ZYX":this._y=Math.asin(-Xt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(c,d),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,u));break;case"YZX":this._z=Math.asin(Xt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,u),this._y=Math.atan2(-h,i)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Xt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(c,u),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(t,e,n){return ln.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ln,e,n)}},{key:"setFromVector3",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(t.x,t.y,t.z,e)}},{key:"reorder",value:function(t){return hn.setFromEuler(this),this.setFromQuaternion(hn,t)}},{key:"equals",value:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}},{key:"fromArray",value:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}},{key:"_onChange",value:function(t){return this._onChangeCallback=t,this}},{key:"_onChangeCallback",value:function(){}}]),t}();cn.prototype.isEuler=!0,cn.DefaultOrder="XYZ",cn.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var dn=function(){function t(){_(this,t),this.mask=1}return w(t,[{key:"set",value:function(t){this.mask=(1<<t|0)>>>0}},{key:"enable",value:function(t){this.mask|=1<<t|0}},{key:"enableAll",value:function(){this.mask=-1}},{key:"toggle",value:function(t){this.mask^=1<<t|0}},{key:"disable",value:function(t){this.mask&=~(1<<t|0)}},{key:"disableAll",value:function(){this.mask=0}},{key:"test",value:function(t){return 0!=(this.mask&t.mask)}},{key:"isEnabled",value:function(t){return 0!=(this.mask&(1<<t|0))}}]),t}(),fn=0,pn=new ee,vn=new te,mn=new Pe,yn=new ee,gn=new ee,xn=new ee,_n=new te,bn=new ee(1,0,0),wn=new ee(0,1,0),Mn=new ee(0,0,1),Sn={type:"added"},En={type:"removed"},Tn=function(t){d(n,t);var e=p(n);function n(){var t;_(this,n),t=e.call(this),Object.defineProperty(m(t),"id",{value:fn++}),t.uuid=qt(),t.name="",t.type="Object3D",t.parent=null,t.children=[],t.up=n.DefaultUp.clone();var r=new ee,i=new cn,a=new te,o=new ee(1,1,1);return i._onChange((function(){a.setFromEuler(i,!1)})),a._onChange((function(){i.setFromQuaternion(a,void 0,!1)})),Object.defineProperties(m(t),{position:{configurable:!0,enumerable:!0,value:r},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:a},scale:{configurable:!0,enumerable:!0,value:o},modelViewMatrix:{value:new Pe},normalMatrix:{value:new Se}}),t.matrix=new Pe,t.matrixWorld=new Pe,t.matrixAutoUpdate=n.DefaultMatrixAutoUpdate,t.matrixWorldNeedsUpdate=!1,t.layers=new dn,t.visible=!0,t.castShadow=!1,t.receiveShadow=!1,t.frustumCulled=!0,t.renderOrder=0,t.animations=[],t.userData={},t}return w(n,[{key:"onBeforeRender",value:function(){}},{key:"onAfterRender",value:function(){}},{key:"applyMatrix4",value:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}},{key:"applyQuaternion",value:function(t){return this.quaternion.premultiply(t),this}},{key:"setRotationFromAxisAngle",value:function(t,e){this.quaternion.setFromAxisAngle(t,e)}},{key:"setRotationFromEuler",value:function(t){this.quaternion.setFromEuler(t,!0)}},{key:"setRotationFromMatrix",value:function(t){this.quaternion.setFromRotationMatrix(t)}},{key:"setRotationFromQuaternion",value:function(t){this.quaternion.copy(t)}},{key:"rotateOnAxis",value:function(t,e){return vn.setFromAxisAngle(t,e),this.quaternion.multiply(vn),this}},{key:"rotateOnWorldAxis",value:function(t,e){return vn.setFromAxisAngle(t,e),this.quaternion.premultiply(vn),this}},{key:"rotateX",value:function(t){return this.rotateOnAxis(bn,t)}},{key:"rotateY",value:function(t){return this.rotateOnAxis(wn,t)}},{key:"rotateZ",value:function(t){return this.rotateOnAxis(Mn,t)}},{key:"translateOnAxis",value:function(t,e){return pn.copy(t).applyQuaternion(this.quaternion),this.position.add(pn.multiplyScalar(e)),this}},{key:"translateX",value:function(t){return this.translateOnAxis(bn,t)}},{key:"translateY",value:function(t){return this.translateOnAxis(wn,t)}},{key:"translateZ",value:function(t){return this.translateOnAxis(Mn,t)}},{key:"localToWorld",value:function(t){return t.applyMatrix4(this.matrixWorld)}},{key:"worldToLocal",value:function(t){return t.applyMatrix4(mn.copy(this.matrixWorld).invert())}},{key:"lookAt",value:function(t,e,n){t.isVector3?yn.copy(t):yn.set(t,e,n);var r=this.parent;this.updateWorldMatrix(!0,!1),gn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?mn.lookAt(gn,yn,this.up):mn.lookAt(yn,gn,this.up),this.quaternion.setFromRotationMatrix(mn),r&&(mn.extractRotation(r.matrixWorld),vn.setFromRotationMatrix(mn),this.quaternion.premultiply(vn.invert()))}},{key:"add",value:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Sn)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}},{key:"remove",value:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}var n=this.children.indexOf(t);return-1!==n&&(t.parent=null,this.children.splice(n,1),t.dispatchEvent(En)),this}},{key:"removeFromParent",value:function(){var t=this.parent;return null!==t&&t.remove(this),this}},{key:"clear",value:function(){for(var t=0;t<this.children.length;t++){var e=this.children[t];e.parent=null,e.dispatchEvent(En)}return this.children.length=0,this}},{key:"attach",value:function(t){return this.updateWorldMatrix(!0,!1),mn.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),mn.multiply(t.parent.matrixWorld)),t.applyMatrix4(mn),this.add(t),t.updateWorldMatrix(!1,!0),this}},{key:"getObjectById",value:function(t){return this.getObjectByProperty("id",t)}},{key:"getObjectByName",value:function(t){return this.getObjectByProperty("name",t)}},{key:"getObjectByProperty",value:function(t,e){if(this[t]===e)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}},{key:"getWorldPosition",value:function(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}},{key:"getWorldQuaternion",value:function(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gn,t,xn),t}},{key:"getWorldScale",value:function(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(gn,_n,t),t}},{key:"getWorldDirection",value:function(t){this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}},{key:"raycast",value:function(){}},{key:"traverse",value:function(t){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverse(t)}},{key:"traverseVisible",value:function(t){if(!1!==this.visible){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)}}},{key:"traverseAncestors",value:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}},{key:"updateMatrix",value:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}},{key:"updateMatrixWorld",value:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].updateMatrixWorld(t)}},{key:"updateWorldMatrix",value:function(t,e){var n=this.parent;if(!0===t&&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===e)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)}},{key:"toJSON",value:function(t){var e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};function i(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),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.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(t.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,u=o.length;s<u;s++){var l=o[s];i(t.shapes,l)}else i(t.shapes,o)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var h=[],c=0,d=this.material.length;c<d;c++)h.push(i(t.materials,this.material[c]));r.material=h}else r.material=i(t.materials,this.material);if(this.children.length>0){r.children=[];for(var f=0;f<this.children.length;f++)r.children.push(this.children[f].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(var p=0;p<this.animations.length;p++){var v=this.animations[p];r.animations.push(i(t.animations,v))}}if(e){var m=S(t.geometries),y=S(t.materials),g=S(t.textures),x=S(t.images),_=S(t.shapes),b=S(t.skeletons),w=S(t.animations),M=S(t.nodes);m.length>0&&(n.geometries=m),y.length>0&&(n.materials=y),g.length>0&&(n.textures=g),x.length>0&&(n.images=x),_.length>0&&(n.shapes=_),b.length>0&&(n.skeletons=b),w.length>0&&(n.animations=w),M.length>0&&(n.nodes=M)}return n.object=r,n;function S(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}}},{key:"clone",value:function(t){return(new this.constructor).copy(this,t)}},{key:"copy",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n<t.children.length;n++){var r=t.children[n];this.add(r.clone())}return this}}]),n}(We);function kn(t){for(var e=t.length-1;e>=0;--e)if(t[e]>65535)return!0;return!1}function An(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}Tn.DefaultUp=new ee(0,1,0),Tn.DefaultMatrixAutoUpdate=!0,Tn.prototype.isObject3D=!0;var Rn=0,Ln=new Pe,Cn=new Tn,Pn=new ee,zn=new ie,Dn=new ie,On=new ee,In=function(t){d(n,t);var e=p(n);function n(){var t;return _(this,n),t=e.call(this),Object.defineProperty(m(t),"id",{value:Rn++}),t.uuid=qt(),t.name="",t.type="BufferGeometry",t.index=null,t.attributes={},t.morphAttributes={},t.morphTargetsRelative=!1,t.groups=[],t.boundingBox=null,t.boundingSphere=null,t.drawRange={start:0,count:1/0},t.userData={},t}return w(n,[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(t){return Array.isArray(t)?this.index=new(kn(t)?sn:on)(t,1):this.index=t,this}},{key:"getAttribute",value:function(t){return this.attributes[t]}},{key:"setAttribute",value:function(t,e){return this.attributes[t]=e,this}},{key:"deleteAttribute",value:function(t){return delete this.attributes[t],this}},{key:"hasAttribute",value:function(t){return void 0!==this.attributes[t]}},{key:"addGroup",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:t,count:e,materialIndex:n})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(t,e){this.drawRange.start=t,this.drawRange.count=e}},{key:"applyMatrix4",value:function(t){var e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new Se).getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(t){return Ln.makeRotationFromQuaternion(t),this.applyMatrix4(Ln),this}},{key:"rotateX",value:function(t){return Ln.makeRotationX(t),this.applyMatrix4(Ln),this}},{key:"rotateY",value:function(t){return Ln.makeRotationY(t),this.applyMatrix4(Ln),this}},{key:"rotateZ",value:function(t){return Ln.makeRotationZ(t),this.applyMatrix4(Ln),this}},{key:"translate",value:function(t,e,n){return Ln.makeTranslation(t,e,n),this.applyMatrix4(Ln),this}},{key:"scale",value:function(t,e,n){return Ln.makeScale(t,e,n),this.applyMatrix4(Ln),this}},{key:"lookAt",value:function(t){return Cn.lookAt(t),Cn.updateMatrix(),this.applyMatrix4(Cn.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Pn).negate(),this.translate(Pn.x,Pn.y,Pn.z),this}},{key:"setFromPoints",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new un(e,3)),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new ie);var t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new ee(-1/0,-1/0,-1/0),new ee(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(var n=0,r=e.length;n<r;n++){var i=e[n];zn.setFromBufferAttribute(i),this.morphTargetsRelative?(On.addVectors(this.boundingBox.min,zn.min),this.boundingBox.expandByPoint(On),On.addVectors(this.boundingBox.max,zn.max),this.boundingBox.expandByPoint(On)):(this.boundingBox.expandByPoint(zn.min),this.boundingBox.expandByPoint(zn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new Me);var t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new ee,1/0);if(t){var n=this.boundingSphere.center;if(zn.setFromBufferAttribute(t),e)for(var r=0,i=e.length;r<i;r++){var a=e[r];Dn.setFromBufferAttribute(a),this.morphTargetsRelative?(On.addVectors(zn.min,Dn.min),zn.expandByPoint(On),On.addVectors(zn.max,Dn.max),zn.expandByPoint(On)):(zn.expandByPoint(Dn.min),zn.expandByPoint(Dn.max))}zn.getCenter(n);for(var o=0,s=0,u=t.count;s<u;s++)On.fromBufferAttribute(t,s),o=Math.max(o,n.distanceToSquared(On));if(e)for(var l=0,h=e.length;l<h;l++)for(var c=e[l],d=this.morphTargetsRelative,f=0,p=c.count;f<p;f++)On.fromBufferAttribute(c,f),d&&(Pn.fromBufferAttribute(t,f),On.add(Pn)),o=Math.max(o,n.distanceToSquared(On));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}},{key:"computeTangents",value:function(){var t=this.index,e=this.attributes;if(null!==t&&void 0!==e.position&&void 0!==e.normal&&void 0!==e.uv){var n=t.array,r=e.position.array,i=e.normal.array,a=e.uv.array,o=r.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new an(new Float32Array(4*o),4));for(var s=this.getAttribute("tangent").array,u=[],l=[],h=0;h<o;h++)u[h]=new ee,l[h]=new ee;var c=new ee,d=new ee,f=new ee,p=new Fe,v=new Fe,m=new Fe,y=new ee,g=new ee,x=this.groups;0===x.length&&(x=[{start:0,count:n.length}]);for(var _=0,b=x.length;_<b;++_)for(var w=x[_],M=w.start,S=M,E=M+w.count;S<E;S+=3)I(n[S+0],n[S+1],n[S+2]);for(var T=new ee,k=new ee,A=new ee,R=new ee,L=0,C=x.length;L<C;++L)for(var P=x[L],z=P.start,D=z,O=z+P.count;D<O;D+=3)N(n[D+0]),N(n[D+1]),N(n[D+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function I(t,e,n){c.fromArray(r,3*t),d.fromArray(r,3*e),f.fromArray(r,3*n),p.fromArray(a,2*t),v.fromArray(a,2*e),m.fromArray(a,2*n),d.sub(c),f.sub(c),v.sub(p),m.sub(p);var i=1/(v.x*m.y-m.x*v.y);isFinite(i)&&(y.copy(d).multiplyScalar(m.y).addScaledVector(f,-v.y).multiplyScalar(i),g.copy(f).multiplyScalar(v.x).addScaledVector(d,-m.x).multiplyScalar(i),u[t].add(y),u[e].add(y),u[n].add(y),l[t].add(g),l[e].add(g),l[n].add(g))}function N(t){A.fromArray(i,3*t),R.copy(A);var e=u[t];T.copy(e),T.sub(A.multiplyScalar(A.dot(e))).normalize(),k.crossVectors(R,e);var n=k.dot(l[t])<0?-1:1;s[4*t]=T.x,s[4*t+1]=T.y,s[4*t+2]=T.z,s[4*t+3]=n}}},{key:"computeVertexNormals",value:function(){var t=this.index,e=this.getAttribute("position");if(void 0!==e){var n=this.getAttribute("normal");if(void 0===n)n=new an(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(var r=0,i=n.count;r<i;r++)n.setXYZ(r,0,0,0);var a=new ee,o=new ee,s=new ee,u=new ee,l=new ee,h=new ee,c=new ee,d=new ee;if(t)for(var f=0,p=t.count;f<p;f+=3){var v=t.getX(f+0),m=t.getX(f+1),y=t.getX(f+2);a.fromBufferAttribute(e,v),o.fromBufferAttribute(e,m),s.fromBufferAttribute(e,y),c.subVectors(s,o),d.subVectors(a,o),c.cross(d),u.fromBufferAttribute(n,v),l.fromBufferAttribute(n,m),h.fromBufferAttribute(n,y),u.add(c),l.add(c),h.add(c),n.setXYZ(v,u.x,u.y,u.z),n.setXYZ(m,l.x,l.y,l.z),n.setXYZ(y,h.x,h.y,h.z)}else for(var g=0,x=e.count;g<x;g+=3)a.fromBufferAttribute(e,g+0),o.fromBufferAttribute(e,g+1),s.fromBufferAttribute(e,g+2),c.subVectors(s,o),d.subVectors(a,o),c.cross(d),n.setXYZ(g+0,c.x,c.y,c.z),n.setXYZ(g+1,c.x,c.y,c.z),n.setXYZ(g+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}},{key:"merge",value:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=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!==t.attributes[r])for(var i=n[r].array,a=t.attributes[r],o=a.array,s=a.itemSize*e,u=Math.min(o.length,i.length-s),l=0,h=s;l<u;l++,h++)i[h]=o[l];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)}},{key:"normalizeNormals",value:function(){for(var t=this.attributes.normal,e=0,n=t.count;e<n;e++)On.fromBufferAttribute(t,e),On.normalize(),t.setXYZ(e,On.x,On.y,On.z)}},{key:"toNonIndexed",value:function(){function t(t,e){for(var n=t.array,r=t.itemSize,i=t.normalized,a=new n.constructor(e.length*r),o=0,s=0,u=0,l=e.length;u<l;u++){o=t.isInterleavedBufferAttribute?e[u]*t.data.stride+t.offset:e[u]*r;for(var h=0;h<r;h++)a[s++]=n[o++]}return new an(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var e=new n,r=this.index.array,i=this.attributes;for(var a in i){var o=t(i[a],r);e.setAttribute(a,o)}var s=this.morphAttributes;for(var u in s){for(var l=[],h=s[u],c=0,d=h.length;c<d;c++){var f=t(h[c],r);l.push(f)}e.morphAttributes[u]=l}e.morphTargetsRelative=this.morphTargetsRelative;for(var p=this.groups,v=0,m=p.length;v<m;v++){var y=p[v];e.addGroup(y.start,y.count,y.materialIndex)}return e}},{key:"toJSON",value:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var r=this.index;null!==r&&(t.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var a in i){var o=i[a];t.data.attributes[a]=o.toJSON(t.data)}var s={},u=!1;for(var l in this.morphAttributes){for(var h=this.morphAttributes[l],c=[],d=0,f=h.length;d<f;d++){var p=h[d];c.push(p.toJSON(t.data))}c.length>0&&(s[l]=c,u=!0)}u&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);var v=this.groups;v.length>0&&(t.data.groups=JSON.parse(JSON.stringify(v)));var m=this.boundingSphere;return null!==m&&(t.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),t}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var e={};this.name=t.name;var n=t.index;null!==n&&this.setIndex(n.clone(e));var r=t.attributes;for(var i in r){var a=r[i];this.setAttribute(i,a.clone(e))}var o=t.morphAttributes;for(var s in o){for(var u=[],l=o[s],h=0,c=l.length;h<c;h++)u.push(l[h].clone(e));this.morphAttributes[s]=u}this.morphTargetsRelative=t.morphTargetsRelative;for(var d=t.groups,f=0,p=d.length;f<p;f++){var v=d[f];this.addGroup(v.start,v.count,v.materialIndex)}var m=t.boundingBox;null!==m&&(this.boundingBox=m.clone());var y=t.boundingSphere;return null!==y&&(this.boundingSphere=y.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,void 0!==t.parameters&&(this.parameters=Object.assign({},t.parameters)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(We);In.prototype.isBufferGeometry=!0;var Nn=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;_(this,n),(t=e.call(this)).type="BoxGeometry",t.parameters={width:r,height:i,depth:a,widthSegments:o,heightSegments:s,depthSegments:u};var l=m(t);o=Math.floor(o),s=Math.floor(s),u=Math.floor(u);var h=[],c=[],d=[],f=[],p=0,v=0;function y(t,e,n,r,i,a,o,s,u,m,y){for(var g=a/u,x=o/m,_=a/2,b=o/2,w=s/2,M=u+1,S=m+1,E=0,T=0,k=new ee,A=0;A<S;A++)for(var R=A*x-b,L=0;L<M;L++){var C=L*g-_;k[t]=C*r,k[e]=R*i,k[n]=w,c.push(k.x,k.y,k.z),k[t]=0,k[e]=0,k[n]=s>0?1:-1,d.push(k.x,k.y,k.z),f.push(L/u),f.push(1-A/m),E+=1}for(var P=0;P<m;P++)for(var z=0;z<u;z++){var D=p+z+M*P,O=p+z+M*(P+1),I=p+(z+1)+M*(P+1),N=p+(z+1)+M*P;h.push(D,O,N),h.push(O,I,N),T+=6}l.addGroup(v,T,y),v+=T,p+=E}return y("z","y","x",-1,-1,a,i,r,u,s,0),y("z","y","x",1,-1,a,i,-r,u,s,1),y("x","z","y",1,1,r,a,i,o,u,2),y("x","z","y",1,-1,r,a,-i,o,u,3),y("x","y","z",1,-1,r,i,a,o,s,4),y("x","y","z",-1,-1,r,i,-a,o,s,5),t.setIndex(h),t.setAttribute("position",new un(c,3)),t.setAttribute("normal",new un(d,3)),t.setAttribute("uv",new un(f,2)),t}return w(n,null,[{key:"fromJSON",value:function(t){return new n(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}]),n}(In),Bn=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;_(this,n),(t=e.call(this)).type="PlaneGeometry",t.parameters={width:r,height:i,widthSegments:a,heightSegments:o};for(var s=r/2,u=i/2,l=Math.floor(a),h=Math.floor(o),c=l+1,d=h+1,f=r/l,p=i/h,v=[],m=[],y=[],g=[],x=0;x<d;x++)for(var b=x*p-u,w=0;w<c;w++){var M=w*f-s;m.push(M,-b,0),y.push(0,0,1),g.push(w/l),g.push(1-x/h)}for(var S=0;S<h;S++)for(var E=0;E<l;E++){var T=E+c*S,k=E+c*(S+1),A=E+1+c*(S+1),R=E+1+c*S;v.push(T,k,R),v.push(k,A,R)}return t.setIndex(v),t.setAttribute("position",new un(m,3)),t.setAttribute("normal",new un(y,3)),t.setAttribute("uv",new un(g,2)),t}return w(n,null,[{key:"fromJSON",value:function(t){return new n(t.width,t.height,t.widthSegments,t.heightSegments)}}]),n}(In),Un=0,Fn=function(t){d(n,t);var e=p(n);function n(){var t;return _(this,n),t=e.call(this),Object.defineProperty(m(t),"id",{value:Un++}),t.uuid=qt(),t.name="",t.type="Material",t.fog=!0,t.blending=1,t.side=S,t.vertexColors=!1,t.opacity=1,t.transparent=!1,t.blendSrc=204,t.blendDst=205,t.blendEquation=k,t.blendSrcAlpha=null,t.blendDstAlpha=null,t.blendEquationAlpha=null,t.depthFunc=3,t.depthTest=!0,t.depthWrite=!0,t.stencilWriteMask=255,t.stencilFunc=519,t.stencilRef=0,t.stencilFuncMask=255,t.stencilFail=It,t.stencilZFail=It,t.stencilZPass=It,t.stencilWrite=!1,t.clippingPlanes=null,t.clipIntersection=!1,t.clipShadows=!1,t.shadowSide=null,t.colorWrite=!0,t.precision=null,t.polygonOffset=!1,t.polygonOffsetFactor=0,t.polygonOffsetUnits=0,t.dithering=!1,t.alphaToCoverage=!1,t.premultipliedAlpha=!1,t.visible=!0,t.toneMapped=!0,t.userData={},t.version=0,t._alphaTest=0,t}return w(n,[{key:"alphaTest",get:function(){return this._alphaTest},set:function(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}},{key:"onBuild",value:function(){}},{key:"onBeforeRender",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n)if("shading"!==e){var r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' 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: '"+e+"' parameter is undefined.")}}},{key:"toJSON",value:function(t){var e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}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),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),this.side!==S&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!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.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){var i=r(t.textures),a=r(t.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"needsUpdate",set:function(t){!0===t&&this.version++}}]),n}(We);function Hn(t){var e={};for(var n in t)for(var r in e[n]={},t[n]){var i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}return e}function Vn(t){for(var e={},n=0;n<t.length;n++){var r=Hn(t[n]);for(var i in r)e[i]=r[i]}return e}Fn.prototype.isMaterial=!0,Fn.fromType=function(){return null};var Gn={clone:Hn,merge:Vn},Wn=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="ShaderMaterial",r.defines={},r.uniforms={},r.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",r.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",r.linewidth=1,r.wireframe=!1,r.wireframeLinewidth=1,r.fog=!1,r.lights=!1,r.clipping=!1,r.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},r.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},r.index0AttributeName=void 0,r.uniformsNeedUpdate=!1,r.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),r.setValues(t)),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Hn(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}},{key:"toJSON",value:function(t){var e=h(y(n.prototype),"toJSON",this).call(this,t);for(var r in e.glslVersion=this.glslVersion,e.uniforms={},this.uniforms){var i=this.uniforms[r].value;i&&i.isTexture?e.uniforms[r]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[r]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[r]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[r]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[r]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[r]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[r]={type:"m4",value:i.toArray()}:e.uniforms[r]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;var a={};for(var o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(e.extensions=a),e}}]),n}(Fn);Wn.prototype.isShaderMaterial=!0;var jn=new ee,qn=new ee,Xn=new ee,Yn=new ee,Zn=new ee,Jn=new ee,Qn=new ee,Kn=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ee,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ee(0,0,-1);_(this,t),this.origin=e,this.direction=n}return w(t,[{key:"set",value:function(t,e){return this.origin.copy(t),this.direction.copy(e),this}},{key:"copy",value:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}},{key:"at",value:function(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}},{key:"lookAt",value:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this}},{key:"recast",value:function(t){return this.origin.copy(this.at(t,jn)),this}},{key:"closestPointToPoint",value:function(t,e){e.subVectors(t,this.origin);var n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}},{key:"distanceToPoint",value:function(t){return Math.sqrt(this.distanceSqToPoint(t))}},{key:"distanceSqToPoint",value:function(t){var e=jn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(jn.copy(this.direction).multiplyScalar(e).add(this.origin),jn.distanceToSquared(t))}},{key:"distanceSqToSegment",value:function(t,e,n,r){qn.copy(t).add(e).multiplyScalar(.5),Xn.copy(e).sub(t).normalize(),Yn.copy(this.origin).sub(qn);var i,a,o,s,u=.5*t.distanceTo(e),l=-this.direction.dot(Xn),h=Yn.dot(this.direction),c=-Yn.dot(Xn),d=Yn.lengthSq(),f=Math.abs(1-l*l);if(f>0)if(a=l*h-c,s=u*f,(i=l*c-h)>=0)if(a>=-s)if(a<=s){var p=1/f;o=(i*=p)*(i+l*(a*=p)+2*h)+a*(l*i+a+2*c)+d}else a=u,o=-(i=Math.max(0,-(l*a+h)))*i+a*(a+2*c)+d;else a=-u,o=-(i=Math.max(0,-(l*a+h)))*i+a*(a+2*c)+d;else a<=-s?o=-(i=Math.max(0,-(-l*u+h)))*i+(a=i>0?-u:Math.min(Math.max(-u,-c),u))*(a+2*c)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-u,-c),u))*(a+2*c)+d):o=-(i=Math.max(0,-(l*u+h)))*i+(a=i>0?u:Math.min(Math.max(-u,-c),u))*(a+2*c)+d;else a=l>0?-u:u,o=-(i=Math.max(0,-(l*a+h)))*i+a*(a+2*c)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(Xn).multiplyScalar(a).add(qn),o}},{key:"intersectSphere",value:function(t,e){jn.subVectors(t.center,this.origin);var n=jn.dot(this.direction),r=jn.dot(jn)-n*n,i=t.radius*t.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,e)}},{key:"intersectsSphere",value:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}},{key:"distanceToPlane",value:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}},{key:"intersectPlane",value:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}},{key:"intersectsPlane",value:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}},{key:"intersectBox",value:function(t,e){var n,r,i,a,o,s,u=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,c=this.origin;return u>=0?(n=(t.min.x-c.x)*u,r=(t.max.x-c.x)*u):(n=(t.max.x-c.x)*u,r=(t.min.x-c.x)*u),l>=0?(i=(t.min.y-c.y)*l,a=(t.max.y-c.y)*l):(i=(t.max.y-c.y)*l,a=(t.min.y-c.y)*l),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),h>=0?(o=(t.min.z-c.z)*h,s=(t.max.z-c.z)*h):(o=(t.max.z-c.z)*h,s=(t.min.z-c.z)*h),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,e)))}},{key:"intersectsBox",value:function(t){return null!==this.intersectBox(t,jn)}},{key:"intersectTriangle",value:function(t,e,n,r,i){Zn.subVectors(e,t),Jn.subVectors(n,t),Qn.crossVectors(Zn,Jn);var a,o=this.direction.dot(Qn);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Yn.subVectors(this.origin,t);var s=a*this.direction.dot(Jn.crossVectors(Yn,Jn));if(s<0)return null;var u=a*this.direction.dot(Zn.cross(Yn));if(u<0)return null;if(s+u>o)return null;var l=-a*Yn.dot(Qn);return l<0?null:this.at(l/o,i)}},{key:"applyMatrix4",value:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}},{key:"equals",value:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),t}(),$n=new ee,tr=new ee,er=new ee,nr=new ee,rr=new ee,ir=new ee,ar=new ee,or=new ee,sr=new ee,ur=new ee,lr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ee,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ee,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new ee;_(this,t),this.a=e,this.b=n,this.c=r}return w(t,[{key:"set",value:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}},{key:"setFromPointsAndIndices",value:function(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this}},{key:"setFromAttributeAndIndices",value:function(t,e,n,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,r),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}},{key:"getArea",value:function(){return $n.subVectors(this.c,this.b),tr.subVectors(this.a,this.b),.5*$n.cross(tr).length()}},{key:"getMidpoint",value:function(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}},{key:"getNormal",value:function(e){return t.getNormal(this.a,this.b,this.c,e)}},{key:"getPlane",value:function(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}},{key:"getBarycoord",value:function(e,n){return t.getBarycoord(e,this.a,this.b,this.c,n)}},{key:"getUV",value:function(e,n,r,i,a){return t.getUV(e,this.a,this.b,this.c,n,r,i,a)}},{key:"containsPoint",value:function(e){return t.containsPoint(e,this.a,this.b,this.c)}},{key:"isFrontFacing",value:function(e){return t.isFrontFacing(this.a,this.b,this.c,e)}},{key:"intersectsBox",value:function(t){return t.intersectsTriangle(this)}},{key:"closestPointToPoint",value:function(t,e){var n,r,i=this.a,a=this.b,o=this.c;rr.subVectors(a,i),ir.subVectors(o,i),or.subVectors(t,i);var s=rr.dot(or),u=ir.dot(or);if(s<=0&&u<=0)return e.copy(i);sr.subVectors(t,a);var l=rr.dot(sr),h=ir.dot(sr);if(l>=0&&h<=l)return e.copy(a);var c=s*h-l*u;if(c<=0&&s>=0&&l<=0)return n=s/(s-l),e.copy(i).addScaledVector(rr,n);ur.subVectors(t,o);var d=rr.dot(ur),f=ir.dot(ur);if(f>=0&&d<=f)return e.copy(o);var p=d*u-s*f;if(p<=0&&u>=0&&f<=0)return r=u/(u-f),e.copy(i).addScaledVector(ir,r);var v=l*f-d*h;if(v<=0&&h-l>=0&&d-f>=0)return ar.subVectors(o,a),r=(h-l)/(h-l+(d-f)),e.copy(a).addScaledVector(ar,r);var m=1/(v+p+c);return n=p*m,r=c*m,e.copy(i).addScaledVector(rr,n).addScaledVector(ir,r)}},{key:"equals",value:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}],[{key:"getNormal",value:function(t,e,n,r){r.subVectors(n,e),$n.subVectors(t,e),r.cross($n);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}},{key:"getBarycoord",value:function(t,e,n,r,i){$n.subVectors(r,e),tr.subVectors(n,e),er.subVectors(t,e);var a=$n.dot($n),o=$n.dot(tr),s=$n.dot(er),u=tr.dot(tr),l=tr.dot(er),h=a*u-o*o;if(0===h)return i.set(-2,-1,-1);var c=1/h,d=(u*s-o*l)*c,f=(a*l-o*s)*c;return i.set(1-d-f,f,d)}},{key:"containsPoint",value:function(t,e,n,r){return this.getBarycoord(t,e,n,r,nr),nr.x>=0&&nr.y>=0&&nr.x+nr.y<=1}},{key:"getUV",value:function(t,e,n,r,i,a,o,s){return this.getBarycoord(t,e,n,r,nr),s.set(0,0),s.addScaledVector(i,nr.x),s.addScaledVector(a,nr.y),s.addScaledVector(o,nr.z),s}},{key:"isFrontFacing",value:function(t,e,n,r){return $n.subVectors(n,e),tr.subVectors(t,e),$n.cross(tr).dot(r)<0}}]),t}(),hr=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="MeshBasicMaterial",r.color=new en(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=0,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}]),n}(Fn);hr.prototype.isMeshBasicMaterial=!0;var cr=new Pe,dr=new Kn,fr=new Me,pr=new ee,vr=new ee,mr=new ee,yr=new ee,gr=new ee,xr=new ee,_r=new ee,br=new ee,wr=new ee,Mr=new Fe,Sr=new Fe,Er=new Fe,Tr=new ee,kr=new ee,Ar=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new In,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new hr;return _(this,n),(t=e.call(this)).type="Mesh",t.geometry=r,t.material=i,t.updateMorphTargets(),t}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}},{key:"updateMorphTargets",value:function(){var t=this.geometry;if(t.isBufferGeometry){var e=t.morphAttributes,n=Object.keys(e);if(n.length>0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=t.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}},{key:"raycast",value:function(t,e){var n,r=this.geometry,i=this.material,a=this.matrixWorld;if(void 0!==i&&(null===r.boundingSphere&&r.computeBoundingSphere(),fr.copy(r.boundingSphere),fr.applyMatrix4(a),!1!==t.ray.intersectsSphere(fr)&&(cr.copy(a).invert(),dr.copy(t.ray).applyMatrix4(cr),null===r.boundingBox||!1!==dr.intersectsBox(r.boundingBox))))if(r.isBufferGeometry){var o=r.index,s=r.attributes.position,u=r.morphAttributes.position,l=r.morphTargetsRelative,h=r.attributes.uv,c=r.attributes.uv2,d=r.groups,f=r.drawRange;if(null!==o)if(Array.isArray(i))for(var p=0,v=d.length;p<v;p++)for(var m=d[p],y=i[m.materialIndex],g=Math.max(m.start,f.start),x=Math.min(o.count,Math.min(m.start+m.count,f.start+f.count));g<x;g+=3){var _=o.getX(g),b=o.getX(g+1),w=o.getX(g+2);(n=Rr(this,y,t,dr,s,u,l,h,c,_,b,w))&&(n.faceIndex=Math.floor(g/3),n.face.materialIndex=m.materialIndex,e.push(n))}else for(var M=Math.max(0,f.start),S=Math.min(o.count,f.start+f.count);M<S;M+=3){var E=o.getX(M),T=o.getX(M+1),k=o.getX(M+2);(n=Rr(this,i,t,dr,s,u,l,h,c,E,T,k))&&(n.faceIndex=Math.floor(M/3),e.push(n))}else if(void 0!==s)if(Array.isArray(i))for(var A=0,R=d.length;A<R;A++)for(var L=d[A],C=i[L.materialIndex],P=Math.max(L.start,f.start),z=Math.min(s.count,Math.min(L.start+L.count,f.start+f.count));P<z;P+=3){(n=Rr(this,C,t,dr,s,u,l,h,c,P,P+1,P+2))&&(n.faceIndex=Math.floor(P/3),n.face.materialIndex=L.materialIndex,e.push(n))}else for(var D=Math.max(0,f.start),O=Math.min(s.count,f.start+f.count);D<O;D+=3){(n=Rr(this,i,t,dr,s,u,l,h,c,D,D+1,D+2))&&(n.faceIndex=Math.floor(D/3),e.push(n))}}else r.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}]),n}(Tn);function Rr(t,e,n,r,i,a,o,s,u,l,h,c){pr.fromBufferAttribute(i,l),vr.fromBufferAttribute(i,h),mr.fromBufferAttribute(i,c);var d=t.morphTargetInfluences;if(a&&d){_r.set(0,0,0),br.set(0,0,0),wr.set(0,0,0);for(var f=0,p=a.length;f<p;f++){var v=d[f],m=a[f];0!==v&&(yr.fromBufferAttribute(m,l),gr.fromBufferAttribute(m,h),xr.fromBufferAttribute(m,c),o?(_r.addScaledVector(yr,v),br.addScaledVector(gr,v),wr.addScaledVector(xr,v)):(_r.addScaledVector(yr.sub(pr),v),br.addScaledVector(gr.sub(vr),v),wr.addScaledVector(xr.sub(mr),v)))}pr.add(_r),vr.add(br),mr.add(wr)}t.isSkinnedMesh&&(t.boneTransform(l,pr),t.boneTransform(h,vr),t.boneTransform(c,mr));var y=function(t,e,n,r,i,a,o,s){if(null===(e.side===E?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,e.side!==T,s)))return null;kr.copy(s),kr.applyMatrix4(t.matrixWorld);var u=n.ray.origin.distanceTo(kr);return u<n.near||u>n.far?null:{distance:u,point:kr.clone(),object:t}}(t,e,n,r,pr,vr,mr,Tr);if(y){s&&(Mr.fromBufferAttribute(s,l),Sr.fromBufferAttribute(s,h),Er.fromBufferAttribute(s,c),y.uv=lr.getUV(Tr,pr,vr,mr,Mr,Sr,Er,new Fe)),u&&(Mr.fromBufferAttribute(u,l),Sr.fromBufferAttribute(u,h),Er.fromBufferAttribute(u,c),y.uv2=lr.getUV(Tr,pr,vr,mr,Mr,Sr,Er,new Fe));var g={a:l,b:h,c,normal:new ee,materialIndex:0};lr.getNormal(pr,vr,mr,g.normal),y.face=g}return y}Ar.prototype.isMesh=!0;var Lr,Cr={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 USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\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_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",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, float faceDirection ) {\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 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\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:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.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}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#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 * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_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}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\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}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",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 <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",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}",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 <alphatest_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}",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}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",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\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_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 <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\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 <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\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 <morphcolor_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}",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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_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_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_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 <normal_vertex>\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}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\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}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_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#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\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 <normal_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 <morphcolor_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 <normal_vertex>\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}",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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\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\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\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 <normal_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 <morphcolor_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 <normal_vertex>\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#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#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 <normal_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 <morphcolor_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 <normal_vertex>\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}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\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 <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_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\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 <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\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}",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 <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_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\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\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 <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},Pr={common:{diffuse:{value:new en(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Se},uv2Transform:{value:new Se},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},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 Fe(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 en(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new en(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Se}},sprite:{diffuse:{value:new en(16777215)},opacity:{value:1},center:{value:new Fe(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Se}}},zr={basic:{uniforms:Vn([Pr.common,Pr.specularmap,Pr.envmap,Pr.aomap,Pr.lightmap,Pr.fog]),vertexShader:Cr.meshbasic_vert,fragmentShader:Cr.meshbasic_frag},lambert:{uniforms:Vn([Pr.common,Pr.specularmap,Pr.envmap,Pr.aomap,Pr.lightmap,Pr.emissivemap,Pr.fog,Pr.lights,{emissive:{value:new en(0)}}]),vertexShader:Cr.meshlambert_vert,fragmentShader:Cr.meshlambert_frag},phong:{uniforms:Vn([Pr.common,Pr.specularmap,Pr.envmap,Pr.aomap,Pr.lightmap,Pr.emissivemap,Pr.bumpmap,Pr.normalmap,Pr.displacementmap,Pr.fog,Pr.lights,{emissive:{value:new en(0)},specular:{value:new en(1118481)},shininess:{value:30}}]),vertexShader:Cr.meshphong_vert,fragmentShader:Cr.meshphong_frag},standard:{uniforms:Vn([Pr.common,Pr.envmap,Pr.aomap,Pr.lightmap,Pr.emissivemap,Pr.bumpmap,Pr.normalmap,Pr.displacementmap,Pr.roughnessmap,Pr.metalnessmap,Pr.fog,Pr.lights,{emissive:{value:new en(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Cr.meshphysical_vert,fragmentShader:Cr.meshphysical_frag},toon:{uniforms:Vn([Pr.common,Pr.aomap,Pr.lightmap,Pr.emissivemap,Pr.bumpmap,Pr.normalmap,Pr.displacementmap,Pr.gradientmap,Pr.fog,Pr.lights,{emissive:{value:new en(0)}}]),vertexShader:Cr.meshtoon_vert,fragmentShader:Cr.meshtoon_frag},matcap:{uniforms:Vn([Pr.common,Pr.bumpmap,Pr.normalmap,Pr.displacementmap,Pr.fog,{matcap:{value:null}}]),vertexShader:Cr.meshmatcap_vert,fragmentShader:Cr.meshmatcap_frag},points:{uniforms:Vn([Pr.points,Pr.fog]),vertexShader:Cr.points_vert,fragmentShader:Cr.points_frag},dashed:{uniforms:Vn([Pr.common,Pr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Cr.linedashed_vert,fragmentShader:Cr.linedashed_frag},depth:{uniforms:Vn([Pr.common,Pr.displacementmap]),vertexShader:Cr.depth_vert,fragmentShader:Cr.depth_frag},normal:{uniforms:Vn([Pr.common,Pr.bumpmap,Pr.normalmap,Pr.displacementmap,{opacity:{value:1}}]),vertexShader:Cr.meshnormal_vert,fragmentShader:Cr.meshnormal_frag},sprite:{uniforms:Vn([Pr.sprite,Pr.fog]),vertexShader:Cr.sprite_vert,fragmentShader:Cr.sprite_frag},background:{uniforms:{uvTransform:{value:new Se},t2D:{value:null}},vertexShader:Cr.background_vert,fragmentShader:Cr.background_frag},cube:{uniforms:Vn([Pr.envmap,{opacity:{value:1}}]),vertexShader:Cr.cube_vert,fragmentShader:Cr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Cr.equirect_vert,fragmentShader:Cr.equirect_frag},distanceRGBA:{uniforms:Vn([Pr.common,Pr.displacementmap,{referencePosition:{value:new ee},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Cr.distanceRGBA_vert,fragmentShader:Cr.distanceRGBA_frag},shadow:{uniforms:Vn([Pr.lights,Pr.fog,{color:{value:new en(0)},opacity:{value:1}}]),vertexShader:Cr.shadow_vert,fragmentShader:Cr.shadow_frag}};function Dr(t,e,n,r,i,a){var o,s,u=new en(0),l=!0===i?0:1,h=null,c=0,d=null;function f(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,a)}return{getClearColor:function(){return u},setClearColor:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;u.set(t),f(u,l=e)},getClearAlpha:function(){return l},setClearAlpha:function(t){f(u,l=t)},render:function(n,i){var a=!1,p=!0===i.isScene?i.background:null;p&&p.isTexture&&(p=e.get(p));var v=t.xr,m=v.getSession&&v.getSession();m&&"additive"===m.environmentBlendMode&&(p=null),null===p?f(u,l):p&&p.isColor&&(f(p,1),a=!0),(t.autoClear||a)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),p&&(p.isCubeTexture||p.mapping===L)?(void 0===s&&((s=new Ar(new Nn(1,1,1),new Wn({name:"BackgroundCubeMaterial",uniforms:Hn(zr.cube.uniforms),vertexShader:zr.cube.vertexShader,fragmentShader:zr.cube.fragmentShader,side:E,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(s)),s.material.uniforms.envMap.value=p,s.material.uniforms.flipEnvMap.value=p.isCubeTexture&&!1===p.isRenderTargetTexture?-1:1,h===p&&c===p.version&&d===t.toneMapping||(s.material.needsUpdate=!0,h=p,c=p.version,d=t.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null)):p&&p.isTexture&&(void 0===o&&((o=new Ar(new Bn(2,2),new Wn({name:"BackgroundMaterial",uniforms:Hn(zr.background.uniforms),vertexShader:zr.background.vertexShader,fragmentShader:zr.background.fragmentShader,side:S,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=p,!0===p.matrixAutoUpdate&&p.updateMatrix(),o.material.uniforms.uvTransform.value.copy(p.matrix),h===p&&c===p.version&&d===t.toneMapping||(o.material.needsUpdate=!0,h=p,c=p.version,d=t.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null))}}}function Or(t,e,n,r){var i=t.getParameter(34921),a=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,s={},u=f(null),l=u,h=!1;function c(e){return r.isWebGL2?t.bindVertexArray(e):a.bindVertexArrayOES(e)}function d(e){return r.isWebGL2?t.deleteVertexArray(e):a.deleteVertexArrayOES(e)}function f(t){for(var e=[],n=[],r=[],a=0;a<i;a++)e[a]=0,n[a]=0,r[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:r,object:t,attributes:{},index:null}}function p(){for(var t=l.newAttributes,e=0,n=t.length;e<n;e++)t[e]=0}function v(t){m(t,0)}function m(n,i){var a=l.newAttributes,o=l.enabledAttributes,s=l.attributeDivisors;(a[n]=1,0===o[n]&&(t.enableVertexAttribArray(n),o[n]=1),s[n]!==i)&&((r.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,i),s[n]=i)}function y(){for(var e=l.newAttributes,n=l.enabledAttributes,r=0,i=n.length;r<i;r++)n[r]!==e[r]&&(t.disableVertexAttribArray(r),n[r]=0)}function g(e,n,i,a,o,s){!0!==r.isWebGL2||5124!==i&&5125!==i?t.vertexAttribPointer(e,n,i,a,o,s):t.vertexAttribIPointer(e,n,i,o,s)}function x(){_(),h=!0,l!==u&&c((l=u).object)}function _(){u.geometry=null,u.program=null,u.wireframe=!1}return{setup:function(i,u,d,x,_){var b=!1;if(o){var w=function(e,n,i){var o=!0===i.wireframe,u=s[e.id];void 0===u&&(u={},s[e.id]=u);var l=u[n.id];void 0===l&&(l={},u[n.id]=l);var h=l[o];void 0===h&&(h=f(r.isWebGL2?t.createVertexArray():a.createVertexArrayOES()),l[o]=h);return h}(x,d,u);l!==w&&c((l=w).object),b=function(t,e){var n=l.attributes,r=t.attributes,i=0;for(var a in r){var o=n[a],s=r[a];if(void 0===o)return!0;if(o.attribute!==s)return!0;if(o.data!==s.data)return!0;i++}return l.attributesNum!==i||l.index!==e}(x,_),b&&function(t,e){var n={},r=t.attributes,i=0;for(var a in r){var o=r[a],s={};s.attribute=o,o.data&&(s.data=o.data),n[a]=s,i++}l.attributes=n,l.attributesNum=i,l.index=e}(x,_)}else{var M=!0===u.wireframe;l.geometry===x.id&&l.program===d.id&&l.wireframe===M||(l.geometry=x.id,l.program=d.id,l.wireframe=M,b=!0)}!0===i.isInstancedMesh&&(b=!0),null!==_&&n.update(_,34963),(b||h)&&(h=!1,function(i,a,o,s){if(!1===r.isWebGL2&&(i.isInstancedMesh||s.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();var u=s.attributes,l=o.getAttributes(),h=a.defaultAttributeValues;for(var c in l){var d=l[c];if(d.location>=0){var f=u[c];if(void 0===f&&("instanceMatrix"===c&&i.instanceMatrix&&(f=i.instanceMatrix),"instanceColor"===c&&i.instanceColor&&(f=i.instanceColor)),void 0!==f){var x=f.normalized,_=f.itemSize,b=n.get(f);if(void 0===b)continue;var w=b.buffer,M=b.type,S=b.bytesPerElement;if(f.isInterleavedBufferAttribute){var E=f.data,T=E.stride,k=f.offset;if(E.isInstancedInterleavedBuffer){for(var A=0;A<d.locationSize;A++)m(d.location+A,E.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=E.meshPerAttribute*E.count)}else for(var R=0;R<d.locationSize;R++)v(d.location+R);t.bindBuffer(34962,w);for(var L=0;L<d.locationSize;L++)g(d.location+L,_/d.locationSize,M,x,T*S,(k+_/d.locationSize*L)*S)}else{if(f.isInstancedBufferAttribute){for(var C=0;C<d.locationSize;C++)m(d.location+C,f.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=f.meshPerAttribute*f.count)}else for(var P=0;P<d.locationSize;P++)v(d.location+P);t.bindBuffer(34962,w);for(var z=0;z<d.locationSize;z++)g(d.location+z,_/d.locationSize,M,x,_*S,_/d.locationSize*z*S)}}else if(void 0!==h){var D=h[c];if(void 0!==D)switch(D.length){case 2:t.vertexAttrib2fv(d.location,D);break;case 3:t.vertexAttrib3fv(d.location,D);break;case 4:t.vertexAttrib4fv(d.location,D);break;default:t.vertexAttrib1fv(d.location,D)}}}}y()}(i,u,d,x),null!==_&&t.bindBuffer(34963,n.get(_).buffer))},reset:x,resetDefaultState:_,dispose:function(){for(var t in x(),s){var e=s[t];for(var n in e){var r=e[n];for(var i in r)d(r[i].object),delete r[i];delete e[n]}delete s[t]}},releaseStatesOfGeometry:function(t){if(void 0!==s[t.id]){var e=s[t.id];for(var n in e){var r=e[n];for(var i in r)d(r[i].object),delete r[i];delete e[n]}delete s[t.id]}},releaseStatesOfProgram:function(t){for(var e in s){var n=s[e];if(void 0!==n[t.id]){var r=n[t.id];for(var i in r)d(r[i].object),delete r[i];delete n[t.id]}}},initAttributes:p,enableAttribute:v,disableUnusedAttributes:y}}function Ir(t,e,n,r){var i,a=r.isWebGL2;this.setMode=function(t){i=t},this.render=function(e,r){t.drawArrays(i,e,r),n.update(r,i,1)},this.renderInstances=function(r,o,s){if(0!==s){var u,l;if(a)u=t,l="drawArraysInstanced";else if(l="drawArraysInstancedANGLE",null===(u=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[l](i,r,o,s),n.update(o,i,s)}}}function Nr(t,e,n){var r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext,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 u=a||e.has("WEBGL_draw_buffers"),l=!0===n.logarithmicDepthBuffer,h=t.getParameter(34930),c=t.getParameter(35660),d=t.getParameter(3379),f=t.getParameter(34076),p=t.getParameter(34921),v=t.getParameter(36347),m=t.getParameter(36348),y=t.getParameter(36349),g=c>0,x=a||e.has("OES_texture_float");return{isWebGL2:a,drawBuffers:u,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){var n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:h,maxVertexTextures:c,maxTextureSize:d,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:v,maxVaryings:m,maxFragmentUniforms:y,vertexTextures:g,floatFragmentTextures:x,floatVertexTextures:g&&x,maxSamples:a?t.getParameter(36183):0}}function Br(t){var e=this,n=null,r=0,i=!1,a=!1,o=new Ae,s=new Se,u={value:null,needsUpdate:!1};function l(){u.value!==n&&(u.value=n,u.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function h(t,n,r,i){var a=null!==t?t.length:0,l=null;if(0!==a){if(l=u.value,!0!==i||null===l){var h=r+4*a,c=n.matrixWorldInverse;s.getNormalMatrix(c),(null===l||l.length<h)&&(l=new Float32Array(h));for(var d=0,f=r;d!==a;++d,f+=4)o.copy(t[d]).applyMatrix4(c,s),o.normal.toArray(l,f),l[f+3]=o.constant}u.value=l,u.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,l}this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,a){var o=0!==t.length||e||0!==r||i;return i=e,n=h(t,a,0),r=t.length,o},this.beginShadows=function(){a=!0,h(null)},this.endShadows=function(){a=!1,l()},this.setState=function(e,o,s){var c=e.clippingPlanes,d=e.clipIntersection,f=e.clipShadows,p=t.get(e);if(!i||null===c||0===c.length||a&&!f)a?h(null):l();else{var v=a?0:r,m=4*v,y=p.clippingState||null;u.value=y,y=h(c,o,m,s);for(var g=0;g!==m;++g)y[g]=n[g];p.clippingState=y,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=v}}}zr.physical={uniforms:Vn([zr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Fe(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new en(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Fe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new en(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new en(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Cr.meshphysical_vert,fragmentShader:Cr.meshphysical_frag};var Ur=function(){function t(){_(this,t)}return w(t,null,[{key:"getDataURL",value:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;var e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Lr&&(Lr=An("canvas")),Lr.width=t.width,Lr.height=t.height;var n=Lr.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Lr}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}},{key:"sRGBToLinear",value:function(t,e){if(t._encoding=e.encoding,wx){wx.window.wxTextureProxyCanvas||(wx.window.wxTextureProxyCanvas=wx.createOffscreenCanvas({type:"webgl"}));var n=wx.window.wxTextureProxyCanvas;n.width=t.width,n.height=t.height;var r=n.getContext("webgl"),i=new Fr(n,r),a=i.sRGBToLinear(t);return i.dispose(),{data:a.data,width:t.width,height:t.height}}if("undefined"==typeof wx&&("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap)){var o;(o="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):An("canvas")).width=t.width,o.height=t.height;var s=o.getContext("2d");s.drawImage(t,0,0,t.width,t.height);for(var u=s.getImageData(0,0,t.width,t.height),l=u.data,h=0;h<l.length;h++)l[h]=255*je(l[h]/255);return s.putImageData(u,0,0),o}if(t.data){for(var c=t.data.slice(0),d=0;d<c.length;d++)c instanceof Uint8Array||c instanceof Uint8ClampedArray?c[d]=Math.floor(255*je(c[d]/255)):c[d]=je(c[d]);return{data:c,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}]),t}(),Fr=function(){function t(e,n){_(this,t),this.canvas=e,this.gl=n||e.getContext("webgl"),this.init(this.gl)}return w(t,[{key:"init",value:function(t){if(t){var e=this._createShader(t,35633,"\n\t\t\tattribute vec4 a_position;\n\t\t\tattribute vec2 a_texcoord;\n\t\t\tvarying vec2 v_texcoord;\n\t\t\tvoid main () {\n\t\t\t\tgl_Position = a_position;\n\t\t\t\tv_texcoord = a_texcoord;\n\t\t\t}\n\t\t\t"),n=this._createShader(t,35632,"\n\t\t\tprecision mediump float;\n\t\t\tvarying vec2 v_texcoord;\n\t\t\tuniform sampler2D u_texture;\n\t\t\tuniform int u_transform;\n\t\t\tvec4 sRGBToLinear( in vec4 value ) {\n\t\t\t\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\t\t\t}\n\t\t\tvoid main () {\n\t\t\t\tvec4 fragColor;\n\t\t\t\tif(u_transform == 0){\n\t\t\t\t\tfragColor = texture2D(u_texture, v_texcoord);\n\t\t\t\t}else{\n\t\t\t\t\tfragColor = sRGBToLinear(texture2D(u_texture, v_texcoord));\n\t\t\t\t}\n\t\t\t\tgl_FragColor = fragColor;\n\t\t\t}\n\t\t\t"),r=this.program=this._createProgram(t,e,n);t.useProgram(r),this.positionLocation=t.getAttribLocation(r,"a_position"),this.texcoordLocation=t.getAttribLocation(r,"a_texcoord"),this.textureLocation=t.getUniformLocation(r,"u_texture"),this.transformLocation=t.getUniformLocation(r,"u_transform"),this.positionBuffer=t.createBuffer(),t.bindBuffer(34962,this.positionBuffer);t.bufferData(34962,new Float32Array([-1,1,-1,-1,1,-1,1,-1,1,1,-1,1]),35044),this.texcoordBuffer=t.createBuffer(),t.bindBuffer(34962,this.texcoordBuffer);t.bufferData(34962,new Float32Array([0,1,0,0,1,0,1,0,1,1,0,1]),35044),t.bindBuffer(34962,this.positionBuffer),t.vertexAttribPointer(this.positionLocation,2,5126,!1,0,0),t.enableVertexAttribArray(this.positionLocation),t.bindBuffer(34962,this.texcoordBuffer),t.vertexAttribPointer(this.texcoordLocation,2,5126,!1,0,0),t.enableVertexAttribArray(this.texcoordLocation),t.viewport(0,0,t.canvas.width,t.canvas.height)}}},{key:"_createShader",value:function(t,e,n){var r=t.createShader(e);if(t.shaderSource(r,n),t.compileShader(r),t.getShaderParameter(r,35713))return r;t.deleteShader(r)}},{key:"_createProgram",value:function(t,e,n){var r=t.createProgram();if(t.attachShader(r,e),t.attachShader(r,n),t.linkProgram(r),t.getProgramParameter(r,35714))return r;t.deleteProgram(r)}},{key:"sRGBToLinear",value:function(t){var e=this.gl,n=this.tex=e.createTexture(),r=t.width,i=t.height;if(e.bindTexture(3553,n),e.texParameteri(3553,10242,33071),e.texParameteri(3553,10243,33071),e.texParameteri(3553,10241,9729),e.texParameteri(3553,10240,9729),t.data&&t.data.buffer){var a=t.data.buffer;e.texImage2D(3553,0,6408,r,i,0,6408,5121,new Uint8Array(a))}else e.texImage2D(3553,0,6408,6408,5121,t);3001===t._encoding?e.uniform1i(this.transformLocation,1):e.uniform1i(this.transformLocation,0),e.uniform1i(this.textureLocation,0),e.clear(16384),e.drawArrays(4,0,6);var o=new Uint8Array(r*i*4);return e.readPixels(0,0,r,i,6408,5121,o),{data:o,width:r,height:i}}},{key:"clear",value:function(){this.gl.clear(16384)}},{key:"dispose",value:function(){var t=this.gl,e=this.tex,n=this.positionBuffer,r=this.texcoordBuffer;t.deleteTexture(e),t.deleteBuffer(n),t.deleteBuffer(r)}}]),t}(),Hr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;_(this,t),this.uuid=qt(),this.data=e,this.version=0}return w(t,[{key:"needsUpdate",set:function(t){!0===t&&this.version++}},{key:"toJSON",value:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];var n={uuid:this.uuid,url:""},r=this.data;if(null!==r){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)r[a].isDataTexture?i.push(Vr(r[a].image)):i.push(Vr(r[a]))}else i=Vr(r);n.url=i}return e||(t.images[this.uuid]=n),n}}]),t}();function Vr(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Ur.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}Hr.prototype.isSource=!0;var Gr=0,Wr=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.DEFAULT_IMAGE,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.DEFAULT_MAPPING,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:P,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:P,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:N,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:U,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:q,h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:F,c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:1,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:Ct;return _(this,n),t=e.call(this),Object.defineProperty(m(t),"id",{value:Gr++}),t.uuid=qt(),t.name="",t.source=new Hr(r),t.mipmaps=[],t.mapping=i,t.wrapS=a,t.wrapT=o,t.magFilter=s,t.minFilter=u,t.anisotropy=c,t.format=l,t.internalFormat=null,t.type=h,t.offset=new Fe(0,0),t.repeat=new Fe(1,1),t.center=new Fe(0,0),t.rotation=0,t.matrixAutoUpdate=!0,t.matrix=new Se,t.generateMipmaps=!0,t.premultiplyAlpha=!1,t.flipY=!0,t.unpackAlignment=4,t.encoding=d,t.userData={},t.version=0,t.onUpdate=null,t.isRenderTargetTexture=!1,t.needsPMREMUpdate=!1,t}return w(n,[{key:"image",get:function(){return this.source.data},set:function(t){this.source.data=t}},{key:"updateMatrix",value:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}},{key:"toJSON",value:function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,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};return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"transformUv",value:function(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case C:t.x=t.x-Math.floor(t.x);break;case P:t.x=t.x<0?0:1;break;case z:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case C:t.y=t.y-Math.floor(t.y);break;case P:t.y=t.y<0?0:1;break;case z:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}},{key:"needsUpdate",set:function(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}}]),n}(We);Wr.DEFAULT_IMAGE=null,Wr.DEFAULT_MAPPING=300,Wr.prototype.isTexture=!0;var jr=function(t){d(n,t);var e=p(n);function n(t,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};_(this,n),(i=e.call(this)).width=t,i.height=r,i.depth=1,i.scissor=new He(0,0,t,r),i.scissorTest=!1,i.viewport=new He(0,0,t,r);var o={width:t,height:r,depth:1};return i.texture=new Wr(o,a.mapping,a.wrapS,a.wrapT,a.magFilter,a.minFilter,a.format,a.type,a.anisotropy,a.encoding),i.texture.isRenderTargetTexture=!0,i.texture.flipY=!1,i.texture.generateMipmaps=void 0!==a.generateMipmaps&&a.generateMipmaps,i.texture.internalFormat=void 0!==a.internalFormat?a.internalFormat:null,i.texture.minFilter=void 0!==a.minFilter?a.minFilter:N,i.depthBuffer=void 0===a.depthBuffer||a.depthBuffer,i.stencilBuffer=void 0!==a.stencilBuffer&&a.stencilBuffer,i.depthTexture=void 0!==a.depthTexture?a.depthTexture:null,i.samples=void 0!==a.samples?a.samples:0,i}return w(n,[{key:"setSize",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0,this.texture.image=Object.assign({},t.texture.image),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}]),n}(We);jr.prototype.isWebGLRenderTarget=!0;var qr=function(t){d(n,t);var e=p(n);function n(){var t;return _(this,n),(t=e.call(this)).type="Camera",t.matrixWorldInverse=new Pe,t.projectionMatrix=new Pe,t.projectionMatrixInverse=new Pe,t}return w(n,[{key:"copy",value:function(t,e){return h(y(n.prototype),"copy",this).call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}},{key:"getWorldDirection",value:function(t){this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}},{key:"updateMatrixWorld",value:function(t){h(y(n.prototype),"updateMatrixWorld",this).call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"updateWorldMatrix",value:function(t,e){h(y(n.prototype),"updateWorldMatrix",this).call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),n}(Tn);qr.prototype.isCamera=!0;var Xr=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;return _(this,n),(t=e.call(this)).type="PerspectiveCamera",t.fov=r,t.zoom=1,t.near=a,t.far=o,t.focus=10,t.aspect=i,t.view=null,t.filmGauge=35,t.filmOffset=0,t.updateProjectionMatrix(),t}return w(n,[{key:"copy",value:function(t,e){return h(y(n.prototype),"copy",this).call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}},{key:"setFocalLength",value:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*jt*Math.atan(e),this.updateProjectionMatrix()}},{key:"getFocalLength",value:function(){var t=Math.tan(.5*Wt*this.fov);return.5*this.getFilmHeight()/t}},{key:"getEffectiveFOV",value:function(){return 2*jt*Math.atan(Math.tan(.5*Wt*this.fov)/this.zoom)}},{key:"getFilmWidth",value:function(){return this.filmGauge*Math.min(this.aspect,1)}},{key:"getFilmHeight",value:function(){return this.filmGauge/Math.max(this.aspect,1)}},{key:"setViewOffset",value:function(t,e,n,r,i,a){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var t=this.near,e=t*Math.tan(.5*Wt*this.fov)/this.zoom,n=2*e,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,e-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var u=this.filmOffset;0!==u&&(i+=t*u/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(t){var e=h(y(n.prototype),"toJSON",this).call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}]),n}(qr);Xr.prototype.isPerspectiveCamera=!0;var Yr=90,Zr=function(t){d(n,t);var e=p(n);function n(t,r,i){var a;if(_(this,n),(a=e.call(this)).type="CubeCamera",!0!==i.isWebGLCubeRenderTarget)return console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter."),v(a);a.renderTarget=i;var o=new Xr(Yr,1,t,r);o.layers=a.layers,o.up.set(0,-1,0),o.lookAt(new ee(1,0,0)),a.add(o);var s=new Xr(Yr,1,t,r);s.layers=a.layers,s.up.set(0,-1,0),s.lookAt(new ee(-1,0,0)),a.add(s);var u=new Xr(Yr,1,t,r);u.layers=a.layers,u.up.set(0,0,1),u.lookAt(new ee(0,1,0)),a.add(u);var l=new Xr(Yr,1,t,r);l.layers=a.layers,l.up.set(0,0,-1),l.lookAt(new ee(0,-1,0)),a.add(l);var h=new Xr(Yr,1,t,r);h.layers=a.layers,h.up.set(0,-1,0),h.lookAt(new ee(0,0,1)),a.add(h);var c=new Xr(Yr,1,t,r);return c.layers=a.layers,c.up.set(0,-1,0),c.lookAt(new ee(0,0,-1)),a.add(c),a}return w(n,[{key:"update",value:function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=s(this.children,6),i=r[0],a=r[1],o=r[2],u=r[3],l=r[4],h=r[5],c=t.getRenderTarget(),d=t.outputEncoding,f=t.toneMapping,p=t.xr.enabled;t.outputEncoding=Ct,t.toneMapping=0,t.xr.enabled=!1;var v=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,a),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,u),t.setRenderTarget(n,4),t.render(e,l),n.texture.generateMipmaps=v,t.setRenderTarget(n,5),t.render(e,h),t.setRenderTarget(c),t.outputEncoding=d,t.toneMapping=f,t.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}]),n}(Tn),Jr=function(t){d(n,t);var e=p(n);function n(t,r,i,a,o,s,u,l,h,c){var d;return _(this,n),t=void 0!==t?t:[],r=void 0!==r?r:A,(d=e.call(this,t,r,i,a,o,s,u,l,h,c)).flipY=!1,d}return w(n,[{key:"images",get:function(){return this.image},set:function(t){this.image=t}}]),n}(Wr);Jr.prototype.isCubeTexture=!0;var Qr=function(t){d(n,t);var e=p(n);function n(t){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_(this,n);var a={width:t,height:t,depth:1},o=[a,a,a,a,a,a];return(r=e.call(this,t,t,i)).texture=new Jr(o,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),r.texture.isRenderTargetTexture=!0,r.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,r.texture.minFilter=void 0!==i.minFilter?i.minFilter:N,r}return w(n,[{key:"fromEquirectangularTexture",value:function(t,e){this.texture.type=e.type,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;var n={tEquirect:{value:null}},r="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",i="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new Nn(5,5,5),o=new Wn({name:"CubemapFromEquirect",uniforms:Hn(n),vertexShader:r,fragmentShader:i,side:E,blending:0});o.uniforms.tEquirect.value=e;var s=new Ar(a,o),u=e.minFilter;return e.minFilter===U&&(e.minFilter=N),new Zr(1,10,this).update(t,s),e.minFilter=u,s.geometry.dispose(),s.material.dispose(),this}},{key:"clear",value:function(t,e,n,r){for(var i=t.getRenderTarget(),a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,r);t.setRenderTarget(i)}}]),n}(jr);function Kr(t){var e=new WeakMap;function n(t,e){return 303===e?t.mapping=A:304===e&&(t.mapping=R),t}function r(t){var n=t.target;n.removeEventListener("dispose",r);var i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture&&!1===i.isRenderTargetTexture){var a=i.mapping;if(303===a||304===a){if(e.has(i))return n(e.get(i).texture,i.mapping);var o=i.image;if(o&&o.height>0){var s=new Qr(o.height/2);return s.fromEquirectangularTexture(t,i),e.set(i,s),i.addEventListener("dispose",r),n(s.texture,i.mapping)}return null}}return i},dispose:function(){e=new WeakMap}}}Qr.prototype.isWebGLCubeRenderTarget=!0;var $r=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;return _(this,n),(t=e.call(this)).type="OrthographicCamera",t.zoom=1,t.view=null,t.left=r,t.right=i,t.top=a,t.bottom=o,t.near=s,t.far=u,t.updateProjectionMatrix(),t}return w(n,[{key:"copy",value:function(t,e){return h(y(n.prototype),"copy",this).call(this,t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}},{key:"setViewOffset",value:function(t,e,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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}},{key:"clearViewOffset",value:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}},{key:"updateProjectionMatrix",value:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-t,a=n+t,o=r+e,s=r-e;if(null!==this.view&&this.view.enabled){var u=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(i+=u*this.view.offsetX)+u*this.view.width,s=(o-=l*this.view.offsetY)-l*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}},{key:"toJSON",value:function(t){var e=h(y(n.prototype),"toJSON",this).call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}]),n}(qr);$r.prototype.isOrthographicCamera=!0;var ti=[.125,.215,.35,.446,.526,.582],ei=20,ni=new $r,ri=new en,ii=null,ai=(1+Math.sqrt(5))/2,oi=1/ai,si=[new ee(1,1,1),new ee(-1,1,1),new ee(1,1,-1),new ee(-1,1,-1),new ee(0,ai,oi),new ee(0,ai,-oi),new ee(oi,0,ai),new ee(-oi,0,ai),new ee(ai,oi,0),new ee(-ai,oi,0)],ui=function(){function t(e){_(this,t),this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}return w(t,[{key:"fromScene",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;ii=this._renderer.getRenderTarget(),this._setSize(256);var i=this._allocateTargets();return i.depthBuffer=!0,this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i}},{key:"fromEquirectangular",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(t,e)}},{key:"fromCubemap",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(t,e)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=di(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=ci(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}},{key:"_cleanup",value:function(t){this._renderer.setRenderTarget(ii),t.scissorTest=!1,hi(t,0,0,t.width,t.height)}},{key:"_fromTexture",value:function(t,e){t.mapping===A||t.mapping===R?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),ii=this._renderer.getRenderTarget();var n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}},{key:"_allocateTargets",value:function(){var t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize-32,n={magFilter:N,minFilter:N,generateMipmaps:!1,type:W,format:q,encoding:Ct,depthBuffer:!1},r=li(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=li(t,e,n);var i=this._lodMax,a=function(t){for(var e=[],n=[],r=[],i=t,a=t-4+1+ti.length,o=0;o<a;o++){var s=Math.pow(2,i);n.push(s);var u=1/s;o>t-4?u=ti[o-t+4-1]:0===o&&(u=0),r.push(u);for(var l=1/(s-1),h=-l/2,c=1+l/2,d=[h,h,c,h,c,c,h,h,c,c,h,c],f=6,p=6,v=3,m=2,y=1,g=new Float32Array(v*p*f),x=new Float32Array(m*p*f),_=new Float32Array(y*p*f),b=0;b<f;b++){var w=b%3*2/3-1,M=b>2?0:-1,S=[w,M,0,w+2/3,M,0,w+2/3,M+1,0,w,M,0,w+2/3,M+1,0,w,M+1,0];g.set(S,v*p*b),x.set(d,m*p*b);var E=[b,b,b,b,b,b];_.set(E,y*p*b)}var T=new In;T.setAttribute("position",new an(g,v)),T.setAttribute("uv",new an(x,m)),T.setAttribute("faceIndex",new an(_,y)),e.push(T),i>4&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}(i);this._sizeLods=a.sizeLods,this._lodPlanes=a.lodPlanes,this._sigmas=a.sigmas,this._blurMaterial=function(t,e,n){var r=new Float32Array(ei),i=new ee(0,1,0);return new Wn({name:"SphericalGaussianBlur",defines:{n:ei,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(t,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,t,e)}return r}},{key:"_compileMaterial",value:function(t){var e=new Ar(this._lodPlanes[0],t);this._renderer.compile(e,ni)}},{key:"_sceneToCubeUV",value:function(t,e,n,r){var i=new Xr(90,1,e,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,u=s.autoClear,l=s.toneMapping;s.getClearColor(ri),s.toneMapping=0,s.autoClear=!1;var h=new hr({name:"PMREM.Background",side:E,depthWrite:!1,depthTest:!1}),c=new Ar(new Nn,h),d=!1,f=t.background;f?f.isColor&&(h.color.copy(f),t.background=null,d=!0):(h.color.copy(ri),d=!0);for(var p=0;p<6;p++){var v=p%3;0===v?(i.up.set(0,a[p],0),i.lookAt(o[p],0,0)):1===v?(i.up.set(0,0,a[p]),i.lookAt(0,o[p],0)):(i.up.set(0,a[p],0),i.lookAt(0,0,o[p]));var m=this._cubeSize;hi(r,v*m,p>2?m:0,m,m),s.setRenderTarget(r),d&&s.render(c,i),s.render(t,i)}c.geometry.dispose(),c.material.dispose(),s.toneMapping=l,s.autoClear=u,t.background=f}},{key:"_textureToCubeUV",value:function(t,e){var n=this._renderer,r=t.mapping===A||t.mapping===R;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=di()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=ci());var i=r?this._cubemapMaterial:this._equirectMaterial,a=new Ar(this._lodPlanes[0],i);i.uniforms.envMap.value=t;var o=this._cubeSize;hi(e,0,0,3*o,2*o),n.setRenderTarget(e),n.render(a,ni)}},{key:"_applyPMREM",value:function(t){var e=this._renderer,n=e.autoClear;e.autoClear=!1;for(var r=1;r<this._lodPlanes.length;r++){var i=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=si[(r-1)%si.length];this._blur(t,r-1,r,i,a)}e.autoClear=n}},{key:"_blur",value:function(t,e,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,r,"latitudinal",i),this._halfBlur(a,t,n,n,r,"longitudinal",i)}},{key:"_halfBlur",value:function(t,e,n,r,i,a,o){var s=this._renderer,u=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var l=new Ar(this._lodPlanes[r],u),h=u.uniforms,c=this._sizeLods[n]-1,d=isFinite(i)?Math.PI/(2*c):2*Math.PI/39,f=i/d,p=isFinite(i)?1+Math.floor(3*f):ei;p>ei&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(p," samples when the maximum is set to ").concat(ei));for(var v=[],m=0,y=0;y<ei;++y){var g=y/f,x=Math.exp(-g*g/2);v.push(x),0===y?m+=x:y<p&&(m+=2*x)}for(var _=0;_<v.length;_++)v[_]=v[_]/m;h.envMap.value=t.texture,h.samples.value=p,h.weights.value=v,h.latitudinal.value="latitudinal"===a,o&&(h.poleAxis.value=o);var b=this._lodMax;h.dTheta.value=d,h.mipInt.value=b-n;var w=this._sizeLods[r];hi(e,3*w*(r>b-4?r-b+4:0),4*(this._cubeSize-w),3*w,2*w),s.setRenderTarget(e),s.render(l,ni)}}]),t}();function li(t,e,n){var r=new jr(t,e,n);return r.texture.mapping=L,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function hi(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function ci(){return new Wn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function di(){return new Wn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function fi(t){var e=new WeakMap,n=null;function r(t){var n=t.target;n.removeEventListener("dispose",r);var i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}return{get:function(i){if(i&&i.isTexture){var a=i.mapping,o=303===a||304===a,s=a===A||a===R;if(o||s){if(i.isRenderTargetTexture&&!0===i.needsPMREMUpdate){i.needsPMREMUpdate=!1;var u=e.get(i);return null===n&&(n=new ui(t)),u=o?n.fromEquirectangular(i,u):n.fromCubemap(i,u),e.set(i,u),u.texture}if(e.has(i))return e.get(i).texture;var l=i.image;if(o&&l&&l.height>0||s&&l&&function(t){for(var e=0,n=6,r=0;r<n;r++)void 0!==t[r]&&e++;return e===n}(l)){null===n&&(n=new ui(t));var h=o?n.fromEquirectangular(i):n.fromCubemap(i);return e.set(i,h),i.addEventListener("dispose",r),h.texture}return null}}return i},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function pi(t){var e={};function n(n){if(void 0!==e[n])return e[n];var r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(t){var e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function vi(t,e,n,r){var i={},a=new WeakMap;function o(t){var s=t.target;for(var u in null!==s.index&&e.remove(s.index),s.attributes)e.remove(s.attributes[u]);s.removeEventListener("dispose",o),delete i[s.id];var l=a.get(s);l&&(e.remove(l),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(t){var n=[],r=t.index,i=t.attributes.position,o=0;if(null!==r){var s=r.array;o=r.version;for(var u=0,l=s.length;u<l;u+=3){var h=s[u+0],c=s[u+1],d=s[u+2];n.push(h,c,c,d,d,h)}}else{var f=i.array;o=i.version;for(var p=0,v=f.length/3-1;p<v;p+=3){var m=p+0,y=p+1,g=p+2;n.push(m,y,y,g,g,m)}}var x=new(kn(n)?sn:on)(n,1);x.version=o;var _=a.get(t);_&&e.remove(_),a.set(t,x)}return{get:function(t,e){return!0===i[e.id]||(e.addEventListener("dispose",o),i[e.id]=!0,n.memory.geometries++),e},update:function(t){var n=t.attributes;for(var r in n)e.update(n[r],34962);var i=t.morphAttributes;for(var a in i)for(var o=i[a],s=0,u=o.length;s<u;s++)e.update(o[s],34962)},getWireframeAttribute:function(t){var e=a.get(t);if(e){var n=t.index;null!==n&&e.version<n.version&&s(t)}else s(t);return a.get(t)}}}function mi(t,e,n,r){var i,a,o,s=r.isWebGL2;this.setMode=function(t){i=t},this.setIndex=function(t){a=t.type,o=t.bytesPerElement},this.render=function(e,r){t.drawElements(i,r,a,e*o),n.update(r,i,1)},this.renderInstances=function(r,u,l){if(0!==l){var h,c;if(s)h=t,c="drawElementsInstanced";else if(c="drawElementsInstancedANGLE",null===(h=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[c](i,u,a,r*o,l),n.update(u,i,l)}}}function yi(t){var e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,n,r){switch(e.calls++,n){case 4:e.triangles+=r*(t/3);break;case 1:e.lines+=r*(t/2);break;case 3:e.lines+=r*(t-1);break;case 2:e.lines+=r*t;break;case 0:e.points+=r*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}var gi=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return _(this,n),(t=e.call(this,null)).image={data:r,width:i,height:a,depth:o},t.magFilter=D,t.minFilter=D,t.wrapR=P,t.generateMipmaps=!1,t.flipY=!1,t.unpackAlignment=1,t}return w(n)}(Wr);function xi(t,e){return t[0]-e[0]}function _i(t,e){return Math.abs(e[1])-Math.abs(t[1])}function bi(t,e){var n=1,r=e.isInterleavedBufferAttribute?e.data.array:e.array;r instanceof Int8Array?n=127:r instanceof Int16Array?n=32767:r instanceof Int32Array?n=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",r),t.divideScalar(n)}function wi(t,e,n){for(var r={},i=new Float32Array(8),a=new WeakMap,o=new He,s=[],u=0;u<8;u++)s[u]=[u,0];return{update:function(u,l,h,c){var d=u.morphTargetInfluences;if(!0===e.isWebGL2){var f=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,p=void 0!==f?f.length:0,v=a.get(l);if(void 0===v||v.count!==p){void 0!==v&&v.texture.dispose();var m=void 0!==l.morphAttributes.position,y=void 0!==l.morphAttributes.normal,g=void 0!==l.morphAttributes.color,x=l.morphAttributes.position||[],_=l.morphAttributes.normal||[],b=l.morphAttributes.color||[],w=0;!0===m&&(w=1),!0===y&&(w=2),!0===g&&(w=3);var M=l.attributes.position.count*w,S=1;M>e.maxTextureSize&&(S=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);var E=new Float32Array(M*S*4*p),T=new gi(E,M,S,p);T.type=G,T.needsUpdate=!0;for(var k=4*w,A=0;A<p;A++)for(var R=x[A],L=_[A],C=b[A],P=M*S*4*A,z=0;z<R.count;z++){var D=z*k;!0===m&&(o.fromBufferAttribute(R,z),!0===R.normalized&&bi(o,R),E[P+D+0]=o.x,E[P+D+1]=o.y,E[P+D+2]=o.z,E[P+D+3]=0),!0===y&&(o.fromBufferAttribute(L,z),!0===L.normalized&&bi(o,L),E[P+D+4]=o.x,E[P+D+5]=o.y,E[P+D+6]=o.z,E[P+D+7]=0),!0===g&&(o.fromBufferAttribute(C,z),!0===C.normalized&&bi(o,C),E[P+D+8]=o.x,E[P+D+9]=o.y,E[P+D+10]=o.z,E[P+D+11]=4===C.itemSize?o.w:1)}v={count:p,texture:T,size:new Fe(M,S)},a.set(l,v),l.addEventListener("dispose",(function t(){T.dispose(),a.delete(l),l.removeEventListener("dispose",t)}))}for(var O=0,I=0;I<d.length;I++)O+=d[I];var N=l.morphTargetsRelative?1:1-O;c.getUniforms().setValue(t,"morphTargetBaseInfluence",N),c.getUniforms().setValue(t,"morphTargetInfluences",d),c.getUniforms().setValue(t,"morphTargetsTexture",v.texture,n),c.getUniforms().setValue(t,"morphTargetsTextureSize",v.size)}else{var B=void 0===d?0:d.length,U=r[l.id];if(void 0===U||U.length!==B){U=[];for(var F=0;F<B;F++)U[F]=[F,0];r[l.id]=U}for(var H=0;H<B;H++){var V=U[H];V[0]=H,V[1]=d[H]}U.sort(_i);for(var W=0;W<8;W++)W<B&&U[W][1]?(s[W][0]=U[W][0],s[W][1]=U[W][1]):(s[W][0]=Number.MAX_SAFE_INTEGER,s[W][1]=0);s.sort(xi);for(var j=l.morphAttributes.position,q=l.morphAttributes.normal,X=0,Y=0;Y<8;Y++){var Z=s[Y],J=Z[0],Q=Z[1];J!==Number.MAX_SAFE_INTEGER&&Q?(j&&l.getAttribute("morphTarget"+Y)!==j[J]&&l.setAttribute("morphTarget"+Y,j[J]),q&&l.getAttribute("morphNormal"+Y)!==q[J]&&l.setAttribute("morphNormal"+Y,q[J]),i[Y]=Q,X+=Q):(j&&!0===l.hasAttribute("morphTarget"+Y)&&l.deleteAttribute("morphTarget"+Y),q&&!0===l.hasAttribute("morphNormal"+Y)&&l.deleteAttribute("morphNormal"+Y),i[Y]=0)}var K=l.morphTargetsRelative?1:1-X;c.getUniforms().setValue(t,"morphTargetBaseInfluence",K),c.getUniforms().setValue(t,"morphTargetInfluences",i)}}}}function Mi(t,e,n,r){var i=new WeakMap;function a(t){var e=t.target;e.removeEventListener("dispose",a),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(t){var o=r.render.frame,s=t.geometry,u=e.get(t,s);return i.get(u)!==o&&(e.update(u),i.set(u,o)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",a)&&t.addEventListener("dispose",a),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),u},dispose:function(){i=new WeakMap}}}gi.prototype.isDataArrayTexture=!0;var Si=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;return _(this,n),(t=e.call(this,null)).image={data:r,width:i,height:a,depth:o},t.magFilter=D,t.minFilter=D,t.wrapR=P,t.generateMipmaps=!1,t.flipY=!1,t.unpackAlignment=1,t}return w(n)}(Wr);Si.prototype.isData3DTexture=!0;var Ei=new Wr,Ti=new gi,ki=new Si,Ai=new Jr,Ri=[],Li=[],Ci=new Float32Array(16),Pi=new Float32Array(9),zi=new Float32Array(4);function Di(t,e,n){var r=t[0];if(r<=0||r>0)return t;var i=e*n,a=Ri[i];if(void 0===a&&(a=new Float32Array(i),Ri[i]=a),0!==e){r.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=n,t[o].toArray(a,s)}return a}function Oi(t,e){if(t.length!==e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function Ii(t,e){for(var n=0,r=e.length;n<r;n++)t[n]=e[n]}function Ni(t,e){var n=Li[e];void 0===n&&(n=new Int32Array(e),Li[e]=n);for(var r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function Bi(t,e){var n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Ui(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Oi(n,e))return;t.uniform2fv(this.addr,e),Ii(n,e)}}function Fi(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(Oi(n,e))return;t.uniform3fv(this.addr,e),Ii(n,e)}}function Hi(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Oi(n,e))return;t.uniform4fv(this.addr,e),Ii(n,e)}}function Vi(t,e){var n=this.cache,r=e.elements;if(void 0===r){if(Oi(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Ii(n,e)}else{if(Oi(n,r))return;zi.set(r),t.uniformMatrix2fv(this.addr,!1,zi),Ii(n,r)}}function Gi(t,e){var n=this.cache,r=e.elements;if(void 0===r){if(Oi(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Ii(n,e)}else{if(Oi(n,r))return;Pi.set(r),t.uniformMatrix3fv(this.addr,!1,Pi),Ii(n,r)}}function Wi(t,e){var n=this.cache,r=e.elements;if(void 0===r){if(Oi(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Ii(n,e)}else{if(Oi(n,r))return;Ci.set(r),t.uniformMatrix4fv(this.addr,!1,Ci),Ii(n,r)}}function ji(t,e){var n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function qi(t,e){var n=this.cache;Oi(n,e)||(t.uniform2iv(this.addr,e),Ii(n,e))}function Xi(t,e){var n=this.cache;Oi(n,e)||(t.uniform3iv(this.addr,e),Ii(n,e))}function Yi(t,e){var n=this.cache;Oi(n,e)||(t.uniform4iv(this.addr,e),Ii(n,e))}function Zi(t,e){var n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function Ji(t,e){var n=this.cache;Oi(n,e)||(t.uniform2uiv(this.addr,e),Ii(n,e))}function Qi(t,e){var n=this.cache;Oi(n,e)||(t.uniform3uiv(this.addr,e),Ii(n,e))}function Ki(t,e){var n=this.cache;Oi(n,e)||(t.uniform4uiv(this.addr,e),Ii(n,e))}function $i(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2D(e||Ei,i)}function ta(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||ki,i)}function ea(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||Ai,i)}function na(t,e,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||Ti,i)}function ra(t,e){t.uniform1fv(this.addr,e)}function ia(t,e){var n=Di(e,this.size,2);t.uniform2fv(this.addr,n)}function aa(t,e){var n=Di(e,this.size,3);t.uniform3fv(this.addr,n)}function oa(t,e){var n=Di(e,this.size,4);t.uniform4fv(this.addr,n)}function sa(t,e){var n=Di(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function ua(t,e){var n=Di(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function la(t,e){var n=Di(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function ha(t,e){t.uniform1iv(this.addr,e)}function ca(t,e){t.uniform2iv(this.addr,e)}function da(t,e){t.uniform3iv(this.addr,e)}function fa(t,e){t.uniform4iv(this.addr,e)}function pa(t,e){t.uniform1uiv(this.addr,e)}function va(t,e){t.uniform2uiv(this.addr,e)}function ma(t,e){t.uniform3uiv(this.addr,e)}function ya(t,e){t.uniform4uiv(this.addr,e)}function ga(t,e,n){var r=e.length,i=Ni(n,r);t.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.setTexture2D(e[a]||Ei,i[a])}function xa(t,e,n){var r=e.length,i=Ni(n,r);t.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.setTexture3D(e[a]||ki,i[a])}function _a(t,e,n){var r=e.length,i=Ni(n,r);t.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.setTextureCube(e[a]||Ai,i[a])}function ba(t,e,n){var r=e.length,i=Ni(n,r);t.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.setTexture2DArray(e[a]||Ti,i[a])}function wa(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Bi;case 35664:return Ui;case 35665:return Fi;case 35666:return Hi;case 35674:return Vi;case 35675:return Gi;case 35676:return Wi;case 5124:case 35670:return ji;case 35667:case 35671:return qi;case 35668:case 35672:return Xi;case 35669:case 35673:return Yi;case 5125:return Zi;case 36294:return Ji;case 36295:return Qi;case 36296:return Ki;case 35678:case 36198:case 36298:case 36306:case 35682:return $i;case 35679:case 36299:case 36307:return ta;case 35680:case 36300:case 36308:case 36293:return ea;case 36289:case 36303:case 36311:case 36292:return na}}(e.type)}function Ma(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return ra;case 35664:return ia;case 35665:return aa;case 35666:return oa;case 35674:return sa;case 35675:return ua;case 35676:return la;case 5124:case 35670:return ha;case 35667:case 35671:return ca;case 35668:case 35672:return da;case 35669:case 35673:return fa;case 5125:return pa;case 36294:return va;case 36295:return ma;case 36296:return ya;case 35678:case 36198:case 36298:case 36306:case 35682:return ga;case 35679:case 36299:case 36307:return xa;case 35680:case 36300:case 36308:case 36293:return _a;case 36289:case 36303:case 36311:case 36292:return ba}}(e.type)}function Sa(t){this.id=t,this.seq=[],this.map={}}Ma.prototype.updateCache=function(t){var e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Ii(e,t)},Sa.prototype.setValue=function(t,e,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(t,e[o.id],n)}};var Ea=/(\w+)(\])?(\[|\.)?/g;function Ta(t,e){t.seq.push(e),t.map[e.id]=e}function ka(t,e,n){var r=t.name,i=r.length;for(Ea.lastIndex=0;;){var a=Ea.exec(r),o=Ea.lastIndex,s=a[1],u="]"===a[2],l=a[3];if(u&&(s|=0),void 0===l||"["===l&&o+2===i){Ta(n,void 0===l?new wa(s,t,e):new Ma(s,t,e));break}var h=n.map[s];void 0===h&&Ta(n,h=new Sa(s)),n=h}}function Aa(t,e){this.seq=[],this.map={};for(var n=t.getProgramParameter(e,35718),r=0;r<n;++r){var i=t.getActiveUniform(e,r);ka(i,t.getUniformLocation(e,i.name),this)}}function Ra(t,e,n){var r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}Aa.prototype.setValue=function(t,e,n,r){var i=this.map[e];void 0!==i&&i.setValue(t,n,r)},Aa.prototype.setOptional=function(t,e,n){var r=e[n];void 0!==r&&this.setValue(t,n,r)},Aa.upload=function(t,e,n,r){for(var i=0,a=e.length;i!==a;++i){var o=e[i],s=n[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,r)}},Aa.seqWithValue=function(t,e){for(var n=[],r=0,i=t.length;r!==i;++r){var a=t[r];a.id in e&&n.push(a)}return n};var La=0;function Ca(t,e,n){var r=t.getShaderParameter(e,35713),i=t.getShaderInfoLog(e).trim();if(r&&""===i)return"";var a=parseInt(/ERROR: 0:(\d+)/.exec(i)[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+function(t,e){for(var n=t.split("\n"),r=[],i=Math.max(e-6,0),a=Math.min(e+6,n.length),o=i;o<a;o++)r.push(o+1+": "+n[o]);return r.join("\n")}(t.getShaderSource(e),a)}function Pa(t,e){var n=function(t){switch(t){case Ct:return["Linear","( value )"];case Pt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function za(t,e){var n;switch(e){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Da(t){return""!==t}function Oa(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ia(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Na=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ba(t){return t.replace(Na,Ua)}function Ua(t,e){var n=Cr[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Ba(n)}var Fa=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ha=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Va(t){return t.replace(Ha,Wa).replace(Fa,Ga)}function Ga(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Wa(t,e,n,r)}function Wa(t,e,n,r){for(var i="",a=parseInt(e);a<parseInt(n);a++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function ja(t){var e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function qa(t,e,n,r){var i,a,o=t.getContext(),s=n.defines,u=n.vertexShader,l=n.fragmentShader,h=function(t){var e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(n),c=function(t){var e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case A:case R:e="ENVMAP_TYPE_CUBE";break;case L:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),d=function(t){var e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===R&&(e="ENVMAP_MODE_REFRACTION");return e}(n),f=function(t){var e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(n),p=function(t){var e=t.envMapCubeUVHeight;if(null===e)return null;var n=Math.log2(e/32+1)+3,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}(n),v=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Da).join("\n")}(n),m=function(t){var e=[];for(var n in t){var r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}(s),y=o.createProgram(),g=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((i=[m].filter(Da).join("\n")).length>0&&(i+="\n"),(a=[v,m].filter(Da).join("\n")).length>0&&(a+="\n")):(i=[ja(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Da).join("\n"),a=[v,ja(n),"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+h:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Cr.tonemapping_pars_fragment:"",0!==n.toneMapping?za("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Cr.encodings_pars_fragment,Pa("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Da).join("\n")),u=Ia(u=Oa(u=Ba(u),n),n),l=Ia(l=Oa(l=Ba(l),n),n),u=Va(u),l=Va(l),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(g="#version 300 es\n",i=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,a=["#define varying in",n.glslVersion===Ut?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Ut?"":"#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"+a);var x,_,b=g+a+l,w=Ra(o,35633,g+i+u),M=Ra(o,35632,b);if(o.attachShader(y,w),o.attachShader(y,M),void 0!==n.index0AttributeName?o.bindAttribLocation(y,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(y,0,"position"),o.linkProgram(y),t.debug.checkShaderErrors){var S=o.getProgramInfoLog(y).trim(),E=o.getShaderInfoLog(w).trim(),T=o.getShaderInfoLog(M).trim(),k=!0,C=!0;if(!1===o.getProgramParameter(y,35714)){k=!1;var P=Ca(o,w,"vertex"),z=Ca(o,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(y,35715)+"\n\nProgram Info Log: "+S+"\n"+P+"\n"+z)}else""!==S?console.warn("THREE.WebGLProgram: Program Info Log:",S):""!==E&&""!==T||(C=!1);C&&(this.diagnostics={runnable:k,programLog:S,vertexShader:{log:E,prefix:i},fragmentShader:{log:T,prefix:a}})}return o.deleteShader(w),o.deleteShader(M),this.getUniforms=function(){return void 0===x&&(x=new Aa(o,y)),x},this.getAttributes=function(){return void 0===_&&(_=function(t,e){for(var n={},r=t.getProgramParameter(e,35721),i=0;i<r;i++){var a=t.getActiveAttrib(e,i),o=a.name,s=1;35674===a.type&&(s=2),35675===a.type&&(s=3),35676===a.type&&(s=4),n[o]={type:a.type,location:t.getAttribLocation(e,o),locationSize:s}}return n}(o,y)),_},this.destroy=function(){r.releaseStatesOfProgram(this),o.deleteProgram(y),this.program=void 0},this.name=n.shaderName,this.id=La++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=w,this.fragmentShader=M,this}var Xa=0,Ya=function(){function t(){_(this,t),this.shaderCache=new Map,this.materialCache=new Map}return w(t,[{key:"update",value:function(t){var e=t.vertexShader,n=t.fragmentShader,r=this._getShaderStage(e),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return!1===a.has(r)&&(a.add(r),r.usedTimes++),!1===a.has(i)&&(a.add(i),i.usedTimes++),this}},{key:"remove",value:function(t){var e,n=o(this.materialCache.get(t));try{for(n.s();!(e=n.n()).done;){var r=e.value;r.usedTimes--,0===r.usedTimes&&this.shaderCache.delete(r.code)}}catch(t){n.e(t)}finally{n.f()}return this.materialCache.delete(t),this}},{key:"getVertexShaderID",value:function(t){return this._getShaderStage(t.vertexShader).id}},{key:"getFragmentShaderID",value:function(t){return this._getShaderStage(t.fragmentShader).id}},{key:"dispose",value:function(){this.shaderCache.clear(),this.materialCache.clear()}},{key:"_getShaderCacheForMaterial",value:function(t){var e=this.materialCache;return!1===e.has(t)&&e.set(t,new Set),e.get(t)}},{key:"_getShaderStage",value:function(t){var e=this.shaderCache;if(!1===e.has(t)){var n=new Za(t);e.set(t,n)}return e.get(t)}}]),t}(),Za=w((function t(e){_(this,t),this.id=Xa++,this.code=e,this.usedTimes=0}));function Ja(t,e,n,r,i,a,o){var s=new dn,u=new Ya,l=[],h=i.isWebGL2,c=i.logarithmicDepthBuffer,d=i.floatVertexTextures,f=i.maxVertexUniforms,p=i.vertexTextures,v=i.precision,m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};return{getParameters:function(a,s,l,y,g){var x=y.fog,_=g.geometry,b=a.isMeshStandardMaterial?y.environment:null,w=(a.isMeshStandardMaterial?n:e).get(a.envMap||b),M=w&&w.mapping===L?w.image.height:null,S=m[a.type],k=g.isSkinnedMesh?function(t){var e=t.skeleton.bones;if(d)return 1024;var n=f,r=Math.floor((n-20)/4),i=Math.min(r,e.length);return i<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+i+"."),0):i}(g):0;null!==a.precision&&(v=i.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",v,"instead.");var A,R,C,P,z=_.morphAttributes.position||_.morphAttributes.normal||_.morphAttributes.color,D=void 0!==z?z.length:0,O=0;if(void 0!==_.morphAttributes.position&&(O=1),void 0!==_.morphAttributes.normal&&(O=2),void 0!==_.morphAttributes.color&&(O=3),S){var I=zr[S];A=I.vertexShader,R=I.fragmentShader}else A=a.vertexShader,R=a.fragmentShader,u.update(a),C=u.getVertexShaderID(a),P=u.getFragmentShaderID(a);var N=t.getRenderTarget(),B=a.alphaTest>0,U=a.clearcoat>0;return{isWebGL2:h,shaderID:S,shaderName:a.type,vertexShader:A,fragmentShader:R,defines:a.defines,customVertexShaderID:C,customFragmentShaderID:P,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:v,instancing:!0===g.isInstancedMesh,instancingColor:!0===g.isInstancedMesh&&null!==g.instanceColor,supportsVertexTextures:p,outputEncoding:null===N?t.outputEncoding:!0===N.isXRRenderTarget?N.texture.encoding:Ct,map:!!a.map,matcap:!!a.matcap,envMap:!!w,envMapMode:w&&w.mapping,envMapCubeUVHeight:M,lightMap:!!a.lightMap,aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:1===a.normalMapType,tangentSpaceNormalMap:a.normalMapType===zt,decodeVideoTexture:!!a.map&&!0===a.map.isVideoTexture&&a.map.encoding===Pt,clearcoat:U,clearcoatMap:U&&!!a.clearcoatMap,clearcoatRoughnessMap:U&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:U&&!!a.clearcoatNormalMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularColorMap:!!a.specularColorMap,opaque:!1===a.transparent&&1===a.blending,alphaMap:!!a.alphaMap,alphaTest:B,gradientMap:!!a.gradientMap,sheen:a.sheen>0,sheenColorMap:!!a.sheenColorMap,sheenRoughnessMap:!!a.sheenRoughnessMap,transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!_.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!_.attributes.color&&4===_.attributes.color.itemSize,vertexUvs:!!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatMap||a.clearcoatRoughnessMap||a.clearcoatNormalMap||a.displacementMap||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheenColorMap||a.sheenRoughnessMap),uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularColorMap||a.sheen>0||a.sheenColorMap||a.sheenRoughnessMap||!a.displacementMap),fog:!!x,useFog:a.fog,fogExp2:x&&x.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:c,skinning:!0===g.isSkinnedMesh&&k>0,maxBones:k,useVertexTexture:d,morphTargets:void 0!==_.morphAttributes.position,morphNormals:void 0!==_.morphAttributes.normal,morphColors:void 0!==_.morphAttributes.color,morphTargetsCount:D,morphTextureStride:O,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&l.length>0,shadowMapType:t.shadowMap.type,toneMapping:a.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===T,flipSided:a.side===E,depthPacking:void 0!==a.depthPacking&&a.depthPacking,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:h||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||r.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(var r in e.defines)n.push(r),n.push(e.defines[r]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.maxBones),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection)}(n,e),function(t,e){s.disableAll(),e.isWebGL2&&s.enable(0);e.supportsVertexTextures&&s.enable(1);e.instancing&&s.enable(2);e.instancingColor&&s.enable(3);e.map&&s.enable(4);e.matcap&&s.enable(5);e.envMap&&s.enable(6);e.lightMap&&s.enable(7);e.aoMap&&s.enable(8);e.emissiveMap&&s.enable(9);e.bumpMap&&s.enable(10);e.normalMap&&s.enable(11);e.objectSpaceNormalMap&&s.enable(12);e.tangentSpaceNormalMap&&s.enable(13);e.clearcoat&&s.enable(14);e.clearcoatMap&&s.enable(15);e.clearcoatRoughnessMap&&s.enable(16);e.clearcoatNormalMap&&s.enable(17);e.displacementMap&&s.enable(18);e.specularMap&&s.enable(19);e.roughnessMap&&s.enable(20);e.metalnessMap&&s.enable(21);e.gradientMap&&s.enable(22);e.alphaMap&&s.enable(23);e.alphaTest&&s.enable(24);e.vertexColors&&s.enable(25);e.vertexAlphas&&s.enable(26);e.vertexUvs&&s.enable(27);e.vertexTangents&&s.enable(28);e.uvsVertexOnly&&s.enable(29);e.fog&&s.enable(30);t.push(s.mask),s.disableAll(),e.useFog&&s.enable(0);e.flatShading&&s.enable(1);e.logarithmicDepthBuffer&&s.enable(2);e.skinning&&s.enable(3);e.useVertexTexture&&s.enable(4);e.morphTargets&&s.enable(5);e.morphNormals&&s.enable(6);e.morphColors&&s.enable(7);e.premultipliedAlpha&&s.enable(8);e.shadowMapEnabled&&s.enable(9);e.physicallyCorrectLights&&s.enable(10);e.doubleSided&&s.enable(11);e.flipSided&&s.enable(12);e.depthPacking&&s.enable(13);e.dithering&&s.enable(14);e.specularIntensityMap&&s.enable(15);e.specularColorMap&&s.enable(16);e.transmission&&s.enable(17);e.transmissionMap&&s.enable(18);e.thicknessMap&&s.enable(19);e.sheen&&s.enable(20);e.sheenColorMap&&s.enable(21);e.sheenRoughnessMap&&s.enable(22);e.decodeVideoTexture&&s.enable(23);e.opaque&&s.enable(24);t.push(s.mask)}(n,e),n.push(t.outputEncoding)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){var e,n=m[t.type];if(n){var r=zr[n];e=Gn.clone(r.uniforms)}else e=t.uniforms;return e},acquireProgram:function(e,n){for(var r,i=0,o=l.length;i<o;i++){var s=l[i];if(s.cacheKey===n){++(r=s).usedTimes;break}}return void 0===r&&(r=new qa(t,n,e,a),l.push(r)),r},releaseProgram:function(t){if(0==--t.usedTimes){var e=l.indexOf(t);l[e]=l[l.length-1],l.pop(),t.destroy()}},releaseShaderCache:function(t){u.remove(t)},programs:l,dispose:function(){u.dispose()}}}function Qa(){var t=new WeakMap;return{get:function(e){var n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,r){t.get(e)[n]=r},dispose:function(){t=new WeakMap}}}function Ka(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function $a(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function to(){var t=[],e=0,n=[],r=[],i=[];function a(n,r,i,a,o,s){var u=t[e];return void 0===u?(u={id:n.id,object:n,geometry:r,material:i,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},t[e]=u):(u.id=n.id,u.object=n,u.geometry=r,u.material=i,u.groupOrder=a,u.renderOrder=n.renderOrder,u.z=o,u.group=s),e++,u}return{opaque:n,transmissive:r,transparent:i,init:function(){e=0,n.length=0,r.length=0,i.length=0},push:function(t,e,o,s,u,l){var h=a(t,e,o,s,u,l);o.transmission>0?r.push(h):!0===o.transparent?i.push(h):n.push(h)},unshift:function(t,e,o,s,u,l){var h=a(t,e,o,s,u,l);o.transmission>0?r.unshift(h):!0===o.transparent?i.unshift(h):n.unshift(h)},finish:function(){for(var n=e,r=t.length;n<r;n++){var i=t[n];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.group=null}},sort:function(t,e){n.length>1&&n.sort(t||Ka),r.length>1&&r.sort(e||$a),i.length>1&&i.sort(e||$a)}}}function eo(){var t=new WeakMap;return{get:function(e,n){var r;return!1===t.has(e)?(r=new to,t.set(e,[r])):n>=t.get(e).length?(r=new to,t.get(e).push(r)):r=t.get(e)[n],r},dispose:function(){t=new WeakMap}}}function no(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new ee,color:new en};break;case"SpotLight":n={position:new ee,direction:new ee,color:new en,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new ee,color:new en,distance:0,decay:0};break;case"HemisphereLight":n={direction:new ee,skyColor:new en,groundColor:new en};break;case"RectAreaLight":n={color:new en,position:new ee,halfWidth:new ee,halfHeight:new ee}}return t[e.id]=n,n}}}var ro=0;function io(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function ao(t,e){for(var n,r=new no,i=(n={},{get:function(t){if(void 0!==n[t.id])return n[t.id];var e;switch(t.type){case"DirectionalLight":case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fe};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Fe,shadowCameraNear:1,shadowCameraFar:1e3}}return n[t.id]=e,e}}),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},o=0;o<9;o++)a.probe.push(new ee);var s=new ee,u=new Pe,l=new Pe;return{setup:function(n,o){for(var s=0,u=0,l=0,h=0;h<9;h++)a.probe[h].set(0,0,0);var c=0,d=0,f=0,p=0,v=0,m=0,y=0,g=0;n.sort(io);for(var x=!0!==o?Math.PI:1,_=0,b=n.length;_<b;_++){var w=n[_],M=w.color,S=w.intensity,E=w.distance,T=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)s+=M.r*S*x,u+=M.g*S*x,l+=M.b*S*x;else if(w.isLightProbe)for(var k=0;k<9;k++)a.probe[k].addScaledVector(w.sh.coefficients[k],S);else if(w.isDirectionalLight){var A=r.get(w);if(A.color.copy(w.color).multiplyScalar(w.intensity*x),w.castShadow){var R=w.shadow,L=i.get(w);L.shadowBias=R.bias,L.shadowNormalBias=R.normalBias,L.shadowRadius=R.radius,L.shadowMapSize=R.mapSize,a.directionalShadow[c]=L,a.directionalShadowMap[c]=T,a.directionalShadowMatrix[c]=w.shadow.matrix,m++}a.directional[c]=A,c++}else if(w.isSpotLight){var C=r.get(w);if(C.position.setFromMatrixPosition(w.matrixWorld),C.color.copy(M).multiplyScalar(S*x),C.distance=E,C.coneCos=Math.cos(w.angle),C.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),C.decay=w.decay,w.castShadow){var P=w.shadow,z=i.get(w);z.shadowBias=P.bias,z.shadowNormalBias=P.normalBias,z.shadowRadius=P.radius,z.shadowMapSize=P.mapSize,a.spotShadow[f]=z,a.spotShadowMap[f]=T,a.spotShadowMatrix[f]=w.shadow.matrix,g++}a.spot[f]=C,f++}else if(w.isRectAreaLight){var D=r.get(w);D.color.copy(M).multiplyScalar(S),D.halfWidth.set(.5*w.width,0,0),D.halfHeight.set(0,.5*w.height,0),a.rectArea[p]=D,p++}else if(w.isPointLight){var O=r.get(w);if(O.color.copy(w.color).multiplyScalar(w.intensity*x),O.distance=w.distance,O.decay=w.decay,w.castShadow){var I=w.shadow,N=i.get(w);N.shadowBias=I.bias,N.shadowNormalBias=I.normalBias,N.shadowRadius=I.radius,N.shadowMapSize=I.mapSize,N.shadowCameraNear=I.camera.near,N.shadowCameraFar=I.camera.far,a.pointShadow[d]=N,a.pointShadowMap[d]=T,a.pointShadowMatrix[d]=w.shadow.matrix,y++}a.point[d]=O,d++}else if(w.isHemisphereLight){var B=r.get(w);B.skyColor.copy(w.color).multiplyScalar(S*x),B.groundColor.copy(w.groundColor).multiplyScalar(S*x),a.hemi[v]=B,v++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(a.rectAreaLTC1=Pr.LTC_FLOAT_1,a.rectAreaLTC2=Pr.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=Pr.LTC_HALF_1,a.rectAreaLTC2=Pr.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=s,a.ambient[1]=u,a.ambient[2]=l;var U=a.hash;U.directionalLength===c&&U.pointLength===d&&U.spotLength===f&&U.rectAreaLength===p&&U.hemiLength===v&&U.numDirectionalShadows===m&&U.numPointShadows===y&&U.numSpotShadows===g||(a.directional.length=c,a.spot.length=f,a.rectArea.length=p,a.point.length=d,a.hemi.length=v,a.directionalShadow.length=m,a.directionalShadowMap.length=m,a.pointShadow.length=y,a.pointShadowMap.length=y,a.spotShadow.length=g,a.spotShadowMap.length=g,a.directionalShadowMatrix.length=m,a.pointShadowMatrix.length=y,a.spotShadowMatrix.length=g,U.directionalLength=c,U.pointLength=d,U.spotLength=f,U.rectAreaLength=p,U.hemiLength=v,U.numDirectionalShadows=m,U.numPointShadows=y,U.numSpotShadows=g,a.version=ro++)},setupView:function(t,e){for(var n=0,r=0,i=0,o=0,h=0,c=e.matrixWorldInverse,d=0,f=t.length;d<f;d++){var p=t[d];if(p.isDirectionalLight){var v=a.directional[n];v.direction.setFromMatrixPosition(p.matrixWorld),s.setFromMatrixPosition(p.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(c),n++}else if(p.isSpotLight){var m=a.spot[i];m.position.setFromMatrixPosition(p.matrixWorld),m.position.applyMatrix4(c),m.direction.setFromMatrixPosition(p.matrixWorld),s.setFromMatrixPosition(p.target.matrixWorld),m.direction.sub(s),m.direction.transformDirection(c),i++}else if(p.isRectAreaLight){var y=a.rectArea[o];y.position.setFromMatrixPosition(p.matrixWorld),y.position.applyMatrix4(c),l.identity(),u.copy(p.matrixWorld),u.premultiply(c),l.extractRotation(u),y.halfWidth.set(.5*p.width,0,0),y.halfHeight.set(0,.5*p.height,0),y.halfWidth.applyMatrix4(l),y.halfHeight.applyMatrix4(l),o++}else if(p.isPointLight){var g=a.point[r];g.position.setFromMatrixPosition(p.matrixWorld),g.position.applyMatrix4(c),r++}else if(p.isHemisphereLight){var x=a.hemi[h];x.direction.setFromMatrixPosition(p.matrixWorld),x.direction.transformDirection(c),x.direction.normalize(),h++}}},state:a}}function oo(t,e){var n=new ao(t,e),r=[],i=[];return{init:function(){r.length=0,i.length=0},state:{lightsArray:r,shadowsArray:i,lights:n},setupLights:function(t){n.setup(r,t)},setupLightsView:function(t){n.setupView(r,t)},pushLight:function(t){r.push(t)},pushShadow:function(t){i.push(t)}}}function so(t,e){var n=new WeakMap;return{get:function(r){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!1===n.has(r)?(i=new oo(t,e),n.set(r,[i])):a>=n.get(r).length?(i=new oo(t,e),n.get(r).push(i)):i=n.get(r)[a],i},dispose:function(){n=new WeakMap}}}var uo=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="MeshDepthMaterial",r.depthPacking=3200,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.fog=!1,r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}]),n}(Fn);uo.prototype.isMeshDepthMaterial=!0;var lo=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="MeshDistanceMaterial",r.referencePosition=new ee,r.nearDistance=1,r.farDistance=1e3,r.map=null,r.alphaMap=null,r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.fog=!1,r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}]),n}(Fn);lo.prototype.isMeshDistanceMaterial=!0;function ho(t,e,n){var r=new Ce,i=new Fe,a=new Fe,o=new He,s=new uo({depthPacking:3201}),u=new lo,l={},h=n.maxTextureSize,c={0:E,1:S,2:T},d=new Wn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Fe},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),f=d.clone();f.defines.HORIZONTAL_PASS=1;var p=new In;p.setAttribute("position",new an(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var v=new Ar(p,d),m=this;function y(n,r){var i=e.update(v);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,f.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,d,v,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,f,v,null)}function g(e,n,r,i,a,o){var h=null,d=!0===r.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(h=void 0!==d?d:!0===r.isPointLight?u:s,t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){var f=h.uuid,p=n.uuid,v=l[f];void 0===v&&(v={},l[f]=v);var m=v[p];void 0===m&&(m=h.clone(),v[p]=m),h=m}return h.visible=n.visible,h.wireframe=n.wireframe,h.side=3===o?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:c[n.side],h.alphaMap=n.alphaMap,h.alphaTest=n.alphaTest,h.clipShadows=n.clipShadows,h.clippingPlanes=n.clippingPlanes,h.clipIntersection=n.clipIntersection,h.displacementMap=n.displacementMap,h.displacementScale=n.displacementScale,h.displacementBias=n.displacementBias,h.wireframeLinewidth=n.wireframeLinewidth,h.linewidth=n.linewidth,!0===r.isPointLight&&!0===h.isMeshDistanceMaterial&&(h.referencePosition.setFromMatrixPosition(r.matrixWorld),h.nearDistance=i,h.farDistance=a),h}function x(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var u=e.update(n),l=n.material;if(Array.isArray(l))for(var h=u.groups,c=0,d=h.length;c<d;c++){var f=h[c],p=l[f.materialIndex];if(p&&p.visible){var v=g(n,p,o,a.near,a.far,s);t.renderBufferDirect(a,null,u,v,n,f)}}else if(l.visible){var m=g(n,l,o,a.near,a.far,s);t.renderBufferDirect(a,null,u,m,n,null)}}for(var y=n.children,_=0,b=y.length;_<b;_++)x(y[_],i,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,n,s){if(!1!==m.enabled&&(!1!==m.autoUpdate||!1!==m.needsUpdate)&&0!==e.length){var u=t.getRenderTarget(),l=t.getActiveCubeFace(),c=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var f=0,p=e.length;f<p;f++){var v=e[f],g=v.shadow;if(void 0!==g){if(!1!==g.autoUpdate||!1!==g.needsUpdate){i.copy(g.mapSize);var _=g.getFrameExtents();if(i.multiply(_),a.copy(g.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(a.x=Math.floor(h/_.x),i.x=a.x*_.x,g.mapSize.x=a.x),i.y>h&&(a.y=Math.floor(h/_.y),i.y=a.y*_.y,g.mapSize.y=a.y)),null!==g.map||g.isPointLightShadow||3!==this.type||(g.map=new jr(i.x,i.y),g.map.texture.name=v.name+".shadowMap",g.mapPass=new jr(i.x,i.y),g.camera.updateProjectionMatrix()),null===g.map){var b={minFilter:D,magFilter:D,format:q};g.map=new jr(i.x,i.y,b),g.map.texture.name=v.name+".shadowMap",g.camera.updateProjectionMatrix()}t.setRenderTarget(g.map),t.clear();for(var w=g.getViewportCount(),M=0;M<w;M++){var S=g.getViewport(M);o.set(a.x*S.x,a.y*S.y,a.x*S.z,a.y*S.w),d.viewport(o),g.updateMatrices(v,M),r=g.getFrustum(),x(n,s,g.camera,v,this.type)}g.isPointLightShadow||3!==this.type||y(g,s),g.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",v,"has no shadow.")}m.needsUpdate=!1,t.setRenderTarget(u,l,c)}}}function co(t,e,n){var r,i,a=n.isWebGL2;var o=new function(){var e=!1,n=new He,r=null,i=new He(0,0,0,0);return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,a,o,s){!0===s&&(e*=o,r*=o,a*=o),n.set(e,r,a,o),!1===i.equals(n)&&(t.clearColor(e,r,a,o),i.copy(n))},reset:function(){e=!1,r=null,i.set(-1,0,0,0)}}},s=new function(){var e=!1,n=null,r=null,i=null;return{setTest:function(t){t?W(2929):j(2929)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:default:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517)}else t.depthFunc(515);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}},u=new function(){var e=!1,n=null,r=null,i=null,a=null,o=null,s=null,u=null,l=null;return{setTest:function(t){e||(t?W(2960):j(2960))},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,o){r===e&&i===n&&a===o||(t.stencilFunc(e,n,o),r=e,i=n,a=o)},setOp:function(e,n,r){o===e&&s===n&&u===r||(t.stencilOp(e,n,r),o=e,s=n,u=r)},setLocked:function(t){e=t},setClear:function(e){l!==e&&(t.clearStencil(e),l=e)},reset:function(){e=!1,n=null,r=null,i=null,a=null,o=null,s=null,u=null,l=null}}},l={},h={},c=new WeakMap,d=[],f=null,p=!1,v=null,m=null,y=null,x=null,_=null,b=null,w=null,M=!1,S=null,A=null,R=null,L=null,C=null,P=t.getParameter(35661),z=!1,D=0,O=t.getParameter(7938);-1!==O.indexOf("WebGL")?(D=parseFloat(/^WebGL (\d)/.exec(O)[1]),z=D>=1):-1!==O.indexOf("OpenGL ES")&&(D=parseFloat(/^OpenGL ES (\d)/.exec(O)[1]),z=D>=2);var I=null,N={},B=t.getParameter(3088),U=t.getParameter(2978),F=(new He).fromArray(B),H=(new He).fromArray(U);function V(e,n,r){var i=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(var o=0;o<r;o++)t.texImage2D(n+o,0,6408,1,1,0,6408,5121,i);return a}var G={};function W(e){!0!==l[e]&&(t.enable(e),l[e]=!0)}function j(e){!1!==l[e]&&(t.disable(e),l[e]=!1)}G[3553]=V(3553,3553,1),G[34067]=V(34067,34069,6),o.setClear(0,0,0,1),s.setClear(1),u.setClear(0),W(2929),s.setFunc(3),J(!1),Q(1),W(2884),Z(0);var q=(g(r={},k,32774),g(r,101,32778),g(r,102,32779),r);if(a)q[103]=32775,q[104]=32776;else{var X=e.get("EXT_blend_minmax");null!==X&&(q[103]=X.MIN_EXT,q[104]=X.MAX_EXT)}var Y=(g(i={},200,0),g(i,201,1),g(i,202,768),g(i,204,770),g(i,210,776),g(i,208,774),g(i,206,772),g(i,203,769),g(i,205,771),g(i,209,775),g(i,207,773),i);function Z(e,n,r,i,a,o,s,u){if(0!==e){if(!1===p&&(W(3042),p=!0),5===e)a=a||n,o=o||r,s=s||i,n===m&&a===_||(t.blendEquationSeparate(q[n],q[a]),m=n,_=a),r===y&&i===x&&o===b&&s===w||(t.blendFuncSeparate(Y[r],Y[i],Y[o],Y[s]),y=r,x=i,b=o,w=s),v=e,M=null;else if(e!==v||u!==M){if(m===k&&_===k||(t.blendEquation(32774),m=k,_=k),u)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}y=null,x=null,b=null,w=null,v=e,M=u}}else!0===p&&(j(3042),p=!1)}function J(e){S!==e&&(e?t.frontFace(2304):t.frontFace(2305),S=e)}function Q(e){0!==e?(W(2884),e!==A&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):j(2884),A=e}function K(e,n,r){e?(W(32823),L===n&&C===r||(t.polygonOffset(n,r),L=n,C=r)):j(32823)}function $(e){void 0===e&&(e=33984+P-1),I!==e&&(t.activeTexture(e),I=e)}return{buffers:{color:o,depth:s,stencil:u},enable:W,disable:j,bindFramebuffer:function(e,n){return h[e]!==n&&(t.bindFramebuffer(e,n),h[e]=n,a&&(36009===e&&(h[36160]=n),36160===e&&(h[36009]=n)),!0)},drawBuffers:function(r,i){var a=d,o=!1;if(r)if(void 0===(a=c.get(i))&&(a=[],c.set(i,a)),r.isWebGLMultipleRenderTargets){var s=r.texture;if(a.length!==s.length||36064!==a[0]){for(var u=0,l=s.length;u<l;u++)a[u]=36064+u;a.length=s.length,o=!0}}else 36064!==a[0]&&(a[0]=36064,o=!0);else 1029!==a[0]&&(a[0]=1029,o=!0);o&&(n.isWebGL2?t.drawBuffers(a):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(a))},useProgram:function(e){return f!==e&&(t.useProgram(e),f=e,!0)},setBlending:Z,setMaterial:function(t,e){t.side===T?j(2884):W(2884);var n=t.side===E;e&&(n=!n),J(n),1===t.blending&&!1===t.transparent?Z(0):Z(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),s.setFunc(t.depthFunc),s.setTest(t.depthTest),s.setMask(t.depthWrite),o.setMask(t.colorWrite);var r=t.stencilWrite;u.setTest(r),r&&(u.setMask(t.stencilWriteMask),u.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),u.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),K(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?W(32926):j(32926)},setFlipSided:J,setCullFace:Q,setLineWidth:function(e){e!==R&&(z&&t.lineWidth(e),R=e)},setPolygonOffset:K,setScissorTest:function(t){t?W(3089):j(3089)},activeTexture:$,bindTexture:function(e,n){null===I&&$();var r=N[I];void 0===r&&(r={type:void 0,texture:void 0},N[I]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||G[e]),r.type=e,r.texture=n)},unbindTexture:function(){var e=N[I];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===F.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),F.copy(e))},viewport:function(e){!1===H.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),H.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===a&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),l={},I=null,N={},h={},c=new WeakMap,d=[],f=null,p=!1,v=null,m=null,y=null,x=null,_=null,b=null,w=null,M=!1,S=null,A=null,R=null,L=null,C=null,F.set(0,0,t.canvas.width,t.canvas.height),H.set(0,0,t.canvas.width,t.canvas.height),o.reset(),s.reset(),u.reset()}}}function fo(t,e,n,r,i,a,o){var s,u,l,h=i.isWebGL2,c=i.maxTextures,d=i.maxCubemapSize,f=i.maxTextureSize,p=i.maxSamples,v=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,m=new WeakMap,y=new WeakMap,x=!1;try{x="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function _(t,e){return x?new OffscreenCanvas(t,e):An("canvas")}function b(t,e,n,r){var i=1;if((t.width>r||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){var a=e?Kt:Math.floor,o=a(i*t.width),s=a(i*t.height);void 0===l&&(l=_(o,s));var u=n?_(o,s):l;return u.width=o,u.height=s,u.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),u}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function w(t){return Jt(t.width)&&Jt(t.height)}function M(t,e){return t.generateMipmaps&&e&&t.minFilter!==D&&t.minFilter!==N}function S(e){t.generateMipmap(e)}function E(n,r,i,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!1===h)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=r;return 6403===r&&(5126===i&&(s=33326),5131===i&&(s=33325),5121===i&&(s=33321)),33319===r&&(5126===i&&(s=33328),5131===i&&(s=33327),5121===i&&(s=33323)),6408===r&&(5126===i&&(s=34836),5131===i&&(s=34842),5121===i&&(s=a===Pt&&!1===o?35907:32856),32819===i&&(s=32854),32820===i&&(s=32855)),33325!==s&&33326!==s&&33327!==s&&33328!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function T(t,e,n){return!0===M(t,n)||t.isFramebufferTexture&&t.minFilter!==D&&t.minFilter!==N?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function k(t){return t===D||t===O||t===I?9728:9729}function A(t){var e=t.target;e.removeEventListener("dispose",A),function(t){var e=r.get(t);if(void 0===e.__webglInit)return;var n=t.source,i=y.get(n);if(i){var a=i[e.__cacheKey];a.usedTimes--,0===a.usedTimes&&L(t),0===Object.keys(i).length&&y.delete(n)}r.remove(t)}(e),e.isVideoTexture&&m.delete(e)}function R(e){var n=e.target;n.removeEventListener("dispose",R),function(e){var n=e.texture,i=r.get(e),a=r.get(n);void 0!==a.__webglTexture&&(t.deleteTexture(a.__webglTexture),o.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(var s=0;s<6;s++)t.deleteFramebuffer(i.__webglFramebuffer[s]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[s]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(var u=0,l=n.length;u<l;u++){var h=r.get(n[u]);h.__webglTexture&&(t.deleteTexture(h.__webglTexture),o.memory.textures--),r.remove(n[u])}r.remove(n),r.remove(e)}(n)}function L(e){var n=r.get(e);t.deleteTexture(n.__webglTexture);var i=e.source;delete y.get(i)[n.__cacheKey],o.memory.textures--}var Z=0;function J(t,e){var i=r.get(t);if(t.isVideoTexture&&function(t){var e=o.render.frame;m.get(t)!==e&&(m.set(t,e),t.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&i.__version!==t.version){var a=t.image;if(null===a)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==a.complete)return void et(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}var Q=(g(s={},C,10497),g(s,P,33071),g(s,z,33648),s),K=(g(u={},D,9728),g(u,O,9984),g(u,I,9986),g(u,N,9729),g(u,B,9985),g(u,U,9987),u);function $(n,a,o){if(o?(t.texParameteri(n,10242,Q[a.wrapS]),t.texParameteri(n,10243,Q[a.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,Q[a.wrapR]),t.texParameteri(n,10240,K[a.magFilter]),t.texParameteri(n,10241,K[a.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),a.wrapS===P&&a.wrapT===P||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,k(a.magFilter)),t.texParameteri(n,10241,k(a.minFilter)),a.minFilter!==D&&a.minFilter!==N&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){var s=e.get("EXT_texture_filter_anisotropic");if(a.type===G&&!1===e.has("OES_texture_float_linear"))return;if(!1===h&&a.type===W&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function tt(e,n){var r=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",A));var i=n.source,a=y.get(i);void 0===a&&(a={},y.set(i,a));var s=function(t){var e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}(n);if(s!==e.__cacheKey){void 0===a[s]&&(a[s]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;var u=a[e.__cacheKey];void 0!==u&&(a[e.__cacheKey].usedTimes--,0===u.usedTimes&&L(n)),e.__cacheKey=s,e.__webglTexture=a[s].texture}return r}function et(e,r,i){var o=3553;r.isDataArrayTexture&&(o=35866),r.isData3DTexture&&(o=32879);var s=tt(e,r),u=r.source;if(n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),u.version!==u.__currentVersion||!0===s){t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);var l,c=function(t){return!h&&(t.wrapS!==P||t.wrapT!==P||t.minFilter!==D&&t.minFilter!==N)}(r)&&!1===w(r.image),d=b(r.image,c,!1,f),p=w(d=st(r,d))||h,v=a.convert(r.format,r.encoding),m=a.convert(r.type),y=E(r.internalFormat,v,m,r.encoding,r.isVideoTexture);$(o,r,p);var g=r.mipmaps,x=h&&!0!==r.isVideoTexture,_=void 0===e.__version,k=T(r,d,p);if(r.isDepthTexture)y=6402,h?y=r.type===G?36012:r.type===V?33190:r.type===j?35056:33189:r.type===G&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===X&&6402===y&&r.type!==H&&r.type!==V&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=H,m=a.convert(r.type)),r.format===Y&&6402===y&&(y=34041,r.type!==j&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=j,m=a.convert(r.type))),x&&_?n.texStorage2D(3553,1,y,d.width,d.height):n.texImage2D(3553,0,y,d.width,d.height,0,v,m,null);else if(r.isDataTexture)if(g.length>0&&p){x&&_&&n.texStorage2D(3553,k,y,g[0].width,g[0].height);for(var A=0,R=g.length;A<R;A++)l=g[A],x?n.texSubImage2D(3553,A,0,0,l.width,l.height,v,m,l.data):n.texImage2D(3553,A,y,l.width,l.height,0,v,m,l.data);r.generateMipmaps=!1}else x?(_&&n.texStorage2D(3553,k,y,d.width,d.height),n.texSubImage2D(3553,0,0,0,d.width,d.height,v,m,d.data)):n.texImage2D(3553,0,y,d.width,d.height,0,v,m,d.data);else if(r.isCompressedTexture){x&&_&&n.texStorage2D(3553,k,y,g[0].width,g[0].height);for(var L=0,C=g.length;L<C;L++)l=g[L],r.format!==q?null!==v?x?n.compressedTexSubImage2D(3553,L,0,0,l.width,l.height,v,l.data):n.compressedTexImage2D(3553,L,y,l.width,l.height,0,l.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):x?n.texSubImage2D(3553,L,0,0,l.width,l.height,v,m,l.data):n.texImage2D(3553,L,y,l.width,l.height,0,v,m,l.data)}else if(r.isDataArrayTexture)x?(_&&n.texStorage3D(35866,k,y,d.width,d.height,d.depth),n.texSubImage3D(35866,0,0,0,0,d.width,d.height,d.depth,v,m,d.data)):n.texImage3D(35866,0,y,d.width,d.height,d.depth,0,v,m,d.data);else if(r.isData3DTexture)x?(_&&n.texStorage3D(32879,k,y,d.width,d.height,d.depth),n.texSubImage3D(32879,0,0,0,0,d.width,d.height,d.depth,v,m,d.data)):n.texImage3D(32879,0,y,d.width,d.height,d.depth,0,v,m,d.data);else if(r.isFramebufferTexture)x&&_?n.texStorage2D(3553,k,y,d.width,d.height):n.texImage2D(3553,0,y,d.width,d.height,0,v,m,null);else if(g.length>0&&p){x&&_&&n.texStorage2D(3553,k,y,g[0].width,g[0].height);for(var z=0,O=g.length;z<O;z++)l=g[z],x?n.texSubImage2D(3553,z,0,0,v,m,l):n.texImage2D(3553,z,y,v,m,l);r.generateMipmaps=!1}else x?(_&&n.texStorage2D(3553,k,y,d.width,d.height),n.texSubImage2D(3553,0,0,0,v,m,d)):n.texImage2D(3553,0,y,v,m,d);M(r,p)&&S(o),u.__currentVersion=u.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}function nt(e,i,o,s,u){var l=a.convert(o.format,o.encoding),h=a.convert(o.type),c=E(o.internalFormat,l,h,o.encoding);r.get(i).__hasExternalTextures||(32879===u||35866===u?n.texImage3D(u,0,c,i.width,i.height,i.depth,0,l,h,null):n.texImage2D(u,0,c,i.width,i.height,0,l,h,null)),n.bindFramebuffer(36160,e),ot(i)?v.framebufferTexture2DMultisampleEXT(36160,s,u,r.get(o).__webglTexture,0,at(i)):t.framebufferTexture2D(36160,s,u,r.get(o).__webglTexture,0),n.bindFramebuffer(36160,null)}function rt(e,n,r){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){var i=33189;if(r||ot(n)){var o=n.depthTexture;o&&o.isDepthTexture&&(o.type===G?i=36012:o.type===V&&(i=33190));var s=at(n);ot(n)?v.renderbufferStorageMultisampleEXT(36161,s,i,n.width,n.height):t.renderbufferStorageMultisample(36161,s,i,n.width,n.height)}else t.renderbufferStorage(36161,i,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){var u=at(n);r&&!1===ot(n)?t.renderbufferStorageMultisample(36161,u,35056,n.width,n.height):ot(n)?v.renderbufferStorageMultisampleEXT(36161,u,35056,n.width,n.height):t.renderbufferStorage(36161,34041,n.width,n.height),t.framebufferRenderbuffer(36160,33306,36161,e)}else{var l=!0===n.isWebGLMultipleRenderTargets?n.texture[0]:n.texture,h=a.convert(l.format,l.encoding),c=a.convert(l.type),d=E(l.internalFormat,h,c,l.encoding),f=at(n);r&&!1===ot(n)?t.renderbufferStorageMultisample(36161,f,d,n.width,n.height):ot(n)?v.renderbufferStorageMultisampleEXT(36161,f,d,n.width,n.height):t.renderbufferStorage(36161,d,n.width,n.height)}t.bindRenderbuffer(36161,null)}function it(e){var i=r.get(e),a=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,i){if(i&&i.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,e),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),J(i.depthTexture,0);var a=r.get(i.depthTexture).__webglTexture,o=at(i);if(i.depthTexture.format===X)ot(i)?v.framebufferTexture2DMultisampleEXT(36160,36096,3553,a,0,o):t.framebufferTexture2D(36160,36096,3553,a,0);else{if(i.depthTexture.format!==Y)throw new Error("Unknown depthTexture format");ot(i)?v.framebufferTexture2DMultisampleEXT(36160,33306,3553,a,0,o):t.framebufferTexture2D(36160,33306,3553,a,0)}}(i.__webglFramebuffer,e)}else if(a){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)n.bindFramebuffer(36160,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=t.createRenderbuffer(),rt(i.__webglDepthbuffer[o],e,!1)}else n.bindFramebuffer(36160,i.__webglFramebuffer),i.__webglDepthbuffer=t.createRenderbuffer(),rt(i.__webglDepthbuffer,e,!1);n.bindFramebuffer(36160,null)}function at(t){return Math.min(p,t.samples)}function ot(t){var n=r.get(t);return h&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function st(t,n){var r=t.encoding,i=t.format,a=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===Ft||r!==Ct&&(r===Pt?!1===h?!0===e.has("EXT_sRGB")&&i===q?(t.format=Ft,t.minFilter=N,t.generateMipmaps=!1):n=Ur.sRGBToLinear(n,t):i===q&&a===F||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",r)),n}this.allocateTextureUnit=function(){var t=Z;return t>=c&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+c),Z+=1,t},this.resetTextureUnits=function(){Z=0},this.setTexture2D=J,this.setTexture2DArray=function(t,e){var i=r.get(t);t.version>0&&i.__version!==t.version?et(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){var i=r.get(t);t.version>0&&i.__version!==t.version?et(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=function(e,i){var o=r.get(e);e.version>0&&o.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;var o=tt(e,r),s=r.source;if(n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),s.version!==s.__currentVersion||!0===o){t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);for(var u=r.isCompressedTexture||r.image[0].isCompressedTexture,l=r.image[0]&&r.image[0].isDataTexture,c=[],f=0;f<6;f++)c[f]=u||l?l?r.image[f].image:r.image[f]:b(r.image[f],!1,!0,d),c[f]=st(r,c[f]);var p,v=c[0],m=w(v)||h,y=a.convert(r.format,r.encoding),g=a.convert(r.type),x=E(r.internalFormat,y,g,r.encoding),_=h&&!0!==r.isVideoTexture,k=void 0===e.__version,A=T(r,v,m);if($(34067,r,m),u){_&&k&&n.texStorage2D(34067,A,x,v.width,v.height);for(var R=0;R<6;R++){p=c[R].mipmaps;for(var L=0;L<p.length;L++){var C=p[L];r.format!==q?null!==y?_?n.compressedTexSubImage2D(34069+R,L,0,0,C.width,C.height,y,C.data):n.compressedTexImage2D(34069+R,L,x,C.width,C.height,0,C.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):_?n.texSubImage2D(34069+R,L,0,0,C.width,C.height,y,g,C.data):n.texImage2D(34069+R,L,x,C.width,C.height,0,y,g,C.data)}}}else{p=r.mipmaps,_&&k&&(p.length>0&&A++,n.texStorage2D(34067,A,x,c[0].width,c[0].height));for(var P=0;P<6;P++)if(l){_?n.texSubImage2D(34069+P,0,0,0,c[P].width,c[P].height,y,g,c[P].data):n.texImage2D(34069+P,0,x,c[P].width,c[P].height,0,y,g,c[P].data);for(var z=0;z<p.length;z++){var D=p[z].image[P].image;_?n.texSubImage2D(34069+P,z+1,0,0,D.width,D.height,y,g,D.data):n.texImage2D(34069+P,z+1,x,D.width,D.height,0,y,g,D.data)}}else{_?n.texSubImage2D(34069+P,0,0,0,y,g,c[P]):n.texImage2D(34069+P,0,x,y,g,c[P]);for(var O=0;O<p.length;O++){var I=p[O];_?n.texSubImage2D(34069+P,O+1,0,0,y,g,I.image[P]):n.texImage2D(34069+P,O+1,x,y,g,I.image[P])}}}M(r,m)&&S(34067),s.__currentVersion=s.version,r.onUpdate&&r.onUpdate(r)}e.__version=r.version}(o,e,i):(n.activeTexture(33984+i),n.bindTexture(34067,o.__webglTexture))},this.rebindTextures=function(t,e,n){var i=r.get(t);void 0!==e&&nt(i.__webglFramebuffer,t,t.texture,36064,3553),void 0!==n&&it(t)},this.setupRenderTarget=function(e){var s=e.texture,u=r.get(e),l=r.get(s);e.addEventListener("dispose",R),!0!==e.isWebGLMultipleRenderTargets&&(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=s.version,o.memory.textures++);var c=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,f=w(e)||h;if(c){u.__webglFramebuffer=[];for(var p=0;p<6;p++)u.__webglFramebuffer[p]=t.createFramebuffer()}else if(u.__webglFramebuffer=t.createFramebuffer(),d)if(i.drawBuffers)for(var v=e.texture,m=0,y=v.length;m<y;m++){var g=r.get(v[m]);void 0===g.__webglTexture&&(g.__webglTexture=t.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(h&&e.samples>0&&!1===ot(e)){u.__webglMultisampledFramebuffer=t.createFramebuffer(),u.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,u.__webglColorRenderbuffer);var x=a.convert(s.format,s.encoding),_=a.convert(s.type),b=E(s.internalFormat,x,_,s.encoding),T=at(e);t.renderbufferStorageMultisample(36161,T,b,e.width,e.height),n.bindFramebuffer(36160,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,u.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(u.__webglDepthRenderbuffer=t.createRenderbuffer(),rt(u.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}if(c){n.bindTexture(34067,l.__webglTexture),$(34067,s,f);for(var k=0;k<6;k++)nt(u.__webglFramebuffer[k],e,s,36064,34069+k);M(s,f)&&S(34067),n.unbindTexture()}else if(d){for(var A=e.texture,L=0,C=A.length;L<C;L++){var P=A[L],z=r.get(P);n.bindTexture(3553,z.__webglTexture),$(3553,P,f),nt(u.__webglFramebuffer,e,P,36064+L,3553),M(P,f)&&S(3553)}n.unbindTexture()}else{var D=3553;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(h?D=e.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(D,l.__webglTexture),$(D,s,f),nt(u.__webglFramebuffer,e,s,36064,D),M(s,f)&&S(D),n.unbindTexture()}e.depthBuffer&&it(e)},this.updateRenderTargetMipmap=function(t){for(var e=w(t)||h,i=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture],a=0,o=i.length;a<o;a++){var s=i[a];if(M(s,e)){var u=t.isWebGLCubeRenderTarget?34067:3553,l=r.get(s).__webglTexture;n.bindTexture(u,l),S(u),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(h&&e.samples>0&&!1===ot(e)){var i=e.width,a=e.height,o=16384,s=e.stencilBuffer?33306:36096;e.depthBuffer;var u=r.get(e),l=void 0!==u.__ignoreDepthValues&&u.__ignoreDepthValues;!1===l&&(e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024)),n.bindFramebuffer(36008,u.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,u.__webglFramebuffer),!0===l&&(t.invalidateFramebuffer(36008,[s]),t.invalidateFramebuffer(36009,[s])),t.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,u.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=it,this.setupFrameBufferTexture=nt,this.useMultisampledRTT=ot}function po(t,e,n){var r=n.isWebGL2;return{convert:function(n){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(n===F)return 5121;if(1017===n)return 32819;if(1018===n)return 32820;if(1010===n)return 5120;if(1011===n)return 5122;if(n===H)return 5123;if(1013===n)return 5124;if(n===V)return 5125;if(n===G)return 5126;if(n===W)return r?5131:null!==(i=e.get("OES_texture_half_float"))?i.HALF_FLOAT_OES:null;if(1021===n)return 6406;if(n===q)return 6408;if(1024===n)return 6409;if(1025===n)return 6410;if(n===X)return 6402;if(n===Y)return 34041;if(1028===n)return 6403;if(1022===n)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(n===Ft)return null!==(i=e.get("EXT_sRGB"))?i.SRGB_ALPHA_EXT:null;if(1029===n)return 36244;if(1030===n)return 33319;if(1031===n)return 33320;if(1033===n)return 36249;if(n===Z||n===J||n===Q||n===K)if(a===Pt){if(null===(i=e.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===Z)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===J)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Q)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===K)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(i=e.get("WEBGL_compressed_texture_s3tc")))return null;if(n===Z)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===J)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Q)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===K)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===$||n===tt||n===et||n===nt){if(null===(i=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===$)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===tt)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===et)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===nt)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===n)return null!==(i=e.get("WEBGL_compressed_texture_etc1"))?i.COMPRESSED_RGB_ETC1_WEBGL:null;if(n===rt||n===it){if(null===(i=e.get("WEBGL_compressed_texture_etc")))return null;if(n===rt)return a===Pt?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===it)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}if(n===at||n===ot||n===st||n===ut||n===lt||n===ht||n===ct||n===dt||n===ft||n===pt||n===vt||n===mt||n===yt||n===gt){if(null===(i=e.get("WEBGL_compressed_texture_astc")))return null;if(n===at)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ot)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===st)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ut)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===lt)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===ht)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===ct)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===dt)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===ft)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===pt)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===vt)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===mt)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===yt)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===gt)return a===Pt?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===xt){if(null===(i=e.get("EXT_texture_compression_bptc")))return null;if(n===xt)return a===Pt?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT}return n===j?r?34042:null!==(i=e.get("WEBGL_depth_texture"))?i.UNSIGNED_INT_24_8_WEBGL:null:void 0!==t[n]?t[n]:null}}}var vo=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return _(this,n),(t=e.call(this)).cameras=r,t}return w(n)}(Xr);vo.prototype.isArrayCamera=!0;var mo=function(t){d(n,t);var e=p(n);function n(){var t;return _(this,n),(t=e.call(this)).type="Group",t}return w(n)}(Tn);mo.prototype.isGroup=!0;var yo={type:"move"},go=function(){function t(){_(this,t),this._targetRay=null,this._grip=null,this._hand=null}return w(t,[{key:"getHandSpace",value:function(){return null===this._hand&&(this._hand=new mo,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}},{key:"getTargetRaySpace",value:function(){return null===this._targetRay&&(this._targetRay=new mo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ee,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ee),this._targetRay}},{key:"getGripSpace",value:function(){return null===this._grip&&(this._grip=new mo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ee,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ee),this._grip}},{key:"dispatchEvent",value:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}},{key:"disconnect",value:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}},{key:"update",value:function(t,e,n){var r=null,i=null,a=null,s=this._targetRay,u=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==s&&null!==(r=e.getPose(t.targetRaySpace,n))&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(yo)),l&&t.hand){a=!0;var h,c=o(t.hand.values());try{for(c.s();!(h=c.n()).done;){var d=h.value,f=e.getJointPose(d,n);if(void 0===l.joints[d.jointName]){var p=new mo;p.matrixAutoUpdate=!1,p.visible=!1,l.joints[d.jointName]=p,l.add(p)}var v=l.joints[d.jointName];null!==f&&(v.matrix.fromArray(f.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.jointRadius=f.radius),v.visible=null!==f}}catch(t){c.e(t)}finally{c.f()}var m=l.joints["index-finger-tip"],y=l.joints["thumb-tip"],g=m.position.distanceTo(y.position);l.inputState.pinching&&g>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&g<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==u&&t.gripSpace&&null!==(i=e.getPose(t.gripSpace,n))&&(u.matrix.fromArray(i.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),i.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(i.linearVelocity)):u.hasLinearVelocity=!1,i.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(i.angularVelocity)):u.hasAngularVelocity=!1);return null!==s&&(s.visible=null!==r),null!==u&&(u.visible=null!==i),null!==l&&(l.visible=null!==a),this}}]),t}(),xo=function(t){d(n,t);var e=p(n);function n(t,r,i,a,o,s,u,l,h,c){var d;if(_(this,n),(c=void 0!==c?c:X)!==X&&c!==Y)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===i&&c===X&&(i=H),void 0===i&&c===Y&&(i=j),(d=e.call(this,null,a,o,s,u,l,c,i,h)).image={width:t,height:r},d.magFilter=void 0!==u?u:D,d.minFilter=void 0!==l?l:D,d.flipY=!1,d.generateMipmaps=!1,d}return w(n)}(Wr);xo.prototype.isDepthTexture=!0;var _o=function(t){d(n,t);var e=p(n);function n(t,r){var i;_(this,n);var o=m(i=e.call(this)),s=null,u=1,l=null,h="local-floor",c=null,d=null,f=null,p=null,v=null,y=r.getContextAttributes(),g=null,b=null,w=[],M=new Map,S=new Xr;S.layers.enable(1),S.viewport=new He;var E=new Xr;E.layers.enable(2),E.viewport=new He;var T=[S,E],k=new vo;k.layers.enable(1),k.layers.enable(2);var A=null,R=null;function L(t){var e=M.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function C(){M.forEach((function(t,e){t.disconnect(e)})),M.clear(),A=null,R=null,t.setRenderTarget(g),p=null,f=null,d=null,s=null,b=null,N.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}function P(t){for(var e=s.inputSources,n=0;n<w.length;n++)M.set(e[n],w[n]);for(var r=0;r<t.removed.length;r++){var i=t.removed[r],a=M.get(i);a&&(a.dispatchEvent({type:"disconnected",data:i}),M.delete(i))}for(var o=0;o<t.added.length;o++){var u=t.added[o],l=M.get(u);l&&l.dispatchEvent({type:"connected",data:u})}}i.cameraAutoUpdate=!0,i.enabled=!1,i.isPresenting=!1,i.getController=function(t){var e=w[t];return void 0===e&&(e=new go,w[t]=e),e.getTargetRaySpace()},i.getControllerGrip=function(t){var e=w[t];return void 0===e&&(e=new go,w[t]=e),e.getGripSpace()},i.getHand=function(t){var e=w[t];return void 0===e&&(e=new go,w[t]=e),e.getHandSpace()},i.setFramebufferScaleFactor=function(t){u=t,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},i.setReferenceSpaceType=function(t){h=t,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},i.getReferenceSpace=function(){return l},i.getBaseLayer=function(){return null!==f?f:p},i.getBinding=function(){return d},i.getFrame=function(){return v},i.getSession=function(){return s},i.setSession=function(){var e,n=(e=x().mark((function e(n){var i,a,c,v,m;return x().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(s=n)){e.next=24;break}if(g=t.getRenderTarget(),s.addEventListener("select",L),s.addEventListener("selectstart",L),s.addEventListener("selectend",L),s.addEventListener("squeeze",L),s.addEventListener("squeezestart",L),s.addEventListener("squeezeend",L),s.addEventListener("end",C),s.addEventListener("inputsourceschange",P),!0===y.xrCompatible){e.next=14;break}return e.next=14,r.makeXRCompatible();case 14:return void 0===s.renderState.layers||!1===t.capabilities.isWebGL2?(i={antialias:void 0!==s.renderState.layers||y.antialias,alpha:y.alpha,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:u},p=new XRWebGLLayer(s,r,i),s.updateRenderState({baseLayer:p}),b=new jr(p.framebufferWidth,p.framebufferHeight,{format:q,type:F,encoding:t.outputEncoding})):(a=null,c=null,v=null,y.depth&&(v=y.stencil?35056:33190,a=y.stencil?Y:X,c=y.stencil?j:H),m={colorFormat:t.outputEncoding===Pt?35907:32856,depthFormat:v,scaleFactor:u},d=new XRWebGLBinding(s,r),f=d.createProjectionLayer(m),s.updateRenderState({layers:[f]}),b=new jr(f.textureWidth,f.textureHeight,{format:q,type:F,depthTexture:new xo(f.textureWidth,f.textureHeight,c,void 0,void 0,void 0,void 0,void 0,void 0,a),stencilBuffer:y.stencil,encoding:t.outputEncoding,samples:y.antialias?4:0}),t.properties.get(b).__ignoreDepthValues=f.ignoreDepthValues),b.isXRRenderTarget=!0,this.setFoveation(1),e.next=19,s.requestReferenceSpace(h);case 19:l=e.sent,N.setContext(s),N.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"});case 24:case"end":return e.stop()}}),e,this)})),function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function s(t){a(o,r,i,s,u,"next",t)}function u(t){a(o,r,i,s,u,"throw",t)}s(void 0)}))});return function(t){return n.apply(this,arguments)}}();var z=new ee,D=new ee;function O(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}i.updateCamera=function(t){if(null!==s){k.near=E.near=S.near=t.near,k.far=E.far=S.far=t.far,A===k.near&&R===k.far||(s.updateRenderState({depthNear:k.near,depthFar:k.far}),A=k.near,R=k.far);var e=t.parent,n=k.cameras;O(k,e);for(var r=0;r<n.length;r++)O(n[r],e);k.matrixWorld.decompose(k.position,k.quaternion,k.scale),t.position.copy(k.position),t.quaternion.copy(k.quaternion),t.scale.copy(k.scale),t.matrix.copy(k.matrix),t.matrixWorld.copy(k.matrixWorld);for(var i=t.children,a=0,o=i.length;a<o;a++)i[a].updateMatrixWorld(!0);2===n.length?function(t,e,n){z.setFromMatrixPosition(e.matrixWorld),D.setFromMatrixPosition(n.matrixWorld);var r=z.distanceTo(D),i=e.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),u=(i[9]+1)/i[5],l=(i[9]-1)/i[5],h=(i[8]-1)/i[0],c=(a[8]+1)/a[0],d=o*h,f=o*c,p=r/(-h+c),v=p*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(v),t.translateZ(p),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();var m=o+p,y=s+p,g=d-v,x=f+(r-v),_=u*s/y*m,b=l*s/y*m;t.projectionMatrix.makePerspective(g,x,_,b,m,y)}(k,S,E):k.projectionMatrix.copy(S.projectionMatrix)}},i.getCamera=function(){return k},i.getFoveation=function(){return null!==f?f.fixedFoveation:null!==p?p.fixedFoveation:void 0},i.setFoveation=function(t){null!==f&&(f.fixedFoveation=t),null!==p&&void 0!==p.fixedFoveation&&(p.fixedFoveation=t)};var I=null;var N=new Ve;return N.setAnimationLoop((function(e,n){if(c=n.getViewerPose(l),v=n,null!==c){var r=c.views;null!==p&&(t.setRenderTargetFramebuffer(b,p.framebuffer),t.setRenderTarget(b));var i=!1;r.length!==k.cameras.length&&(k.cameras.length=0,i=!0);for(var a=0;a<r.length;a++){var o=r[a],u=null;if(null!==p)u=p.getViewport(o);else{var h=d.getViewSubImage(f,o);u=h.viewport,0===a&&(t.setRenderTargetTextures(b,h.colorTexture,f.ignoreDepthValues?void 0:h.depthStencilTexture),t.setRenderTarget(b))}var m=T[a];m.matrix.fromArray(o.transform.matrix),m.projectionMatrix.fromArray(o.projectionMatrix),m.viewport.set(u.x,u.y,u.width,u.height),0===a&&k.matrix.copy(m.matrix),!0===i&&k.cameras.push(m)}}for(var y=s.inputSources,g=0;g<w.length;g++){var x=w[g],_=y[g];x.update(_,n,l)}I&&I(e,n),v=null})),i.setAnimationLoop=function(t){I=t},i.dispose=function(){},i}return w(n)}(We);function bo(t,e){function n(n,r){n.opacity.value=r.opacity,r.color&&n.diffuse.value.copy(r.color),r.emissive&&n.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(n.map.value=r.map),r.alphaMap&&(n.alphaMap.value=r.alphaMap),r.bumpMap&&(n.bumpMap.value=r.bumpMap,n.bumpScale.value=r.bumpScale,r.side===E&&(n.bumpScale.value*=-1)),r.displacementMap&&(n.displacementMap.value=r.displacementMap,n.displacementScale.value=r.displacementScale,n.displacementBias.value=r.displacementBias),r.emissiveMap&&(n.emissiveMap.value=r.emissiveMap),r.normalMap&&(n.normalMap.value=r.normalMap,n.normalScale.value.copy(r.normalScale),r.side===E&&n.normalScale.value.negate()),r.specularMap&&(n.specularMap.value=r.specularMap),r.alphaTest>0&&(n.alphaTest.value=r.alphaTest);var i,a,o=e.get(r).envMap;if(o&&(n.envMap.value=o,n.flipEnvMap.value=o.isCubeTexture&&!1===o.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;var s=!0!==t.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*s}r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity),r.map?i=r.map:r.specularMap?i=r.specularMap:r.displacementMap?i=r.displacementMap:r.normalMap?i=r.normalMap:r.bumpMap?i=r.bumpMap:r.roughnessMap?i=r.roughnessMap:r.metalnessMap?i=r.metalnessMap:r.alphaMap?i=r.alphaMap:r.emissiveMap?i=r.emissiveMap:r.clearcoatMap?i=r.clearcoatMap:r.clearcoatNormalMap?i=r.clearcoatNormalMap:r.clearcoatRoughnessMap?i=r.clearcoatRoughnessMap:r.specularIntensityMap?i=r.specularIntensityMap:r.specularColorMap?i=r.specularColorMap:r.transmissionMap?i=r.transmissionMap:r.thicknessMap?i=r.thicknessMap:r.sheenColorMap?i=r.sheenColorMap:r.sheenRoughnessMap&&(i=r.sheenRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),n.uvTransform.value.copy(i.matrix)),r.aoMap?a=r.aoMap:r.lightMap&&(a=r.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),n.uv2Transform.value.copy(a.matrix))}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,r,i,a,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?n(t,r):r.isMeshToonMaterial?(n(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(n(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(n(t,r),function(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap);n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap);e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,n){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,e.side===E&&t.clearcoatNormalScale.value.negate()));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap);e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}(t,r,o)):r.isMeshMatcapMaterial?(n(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?n(t,r):r.isMeshDistanceMaterial?(n(t,r),function(t,e){t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,r)):r.isMeshNormalMaterial?n(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,n,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);var i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,r,i,a):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);var n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function wo(){var t=An("canvas");return t.style.display="block",t}function Mo(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=void 0!==e.canvas?e.canvas:wo(),r=void 0!==e.context?e.context:null,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,u=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,l=void 0!==e.powerPreference?e.powerPreference:"default",h=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat;t=void 0!==e.context?r.getContextAttributes().alpha:void 0!==e.alpha&&e.alpha;var c=null,d=null,f=[],p=[];this.domElement=n,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Ct,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;var v=this,m=!1,y=0,g=0,x=null,_=-1,b=null,w=new He,k=new He,A=null,R=n.width,L=n.height,C=1,P=null,z=null,D=new He(0,0,R,L),O=new He(0,0,R,L),I=!1,N=new Ce,B=!1,H=!1,V=null,j=new Pe,X=new Fe,Y=new ee,Z={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function J(){return null===x?C:1}var Q,K,$,tt,et,nt,rt,it,at,ot,st,ut,lt,ht,ct,dt,ft,pt,vt,mt,yt,gt,xt,_t=r;function bt(t,e){for(var r=0;r<t.length;r++){var i=t[r],a=n.getContext(i,e);if(null!=a)return a}return null}try{var wt={alpha:!0,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:u,powerPreference:l,failIfMajorPerformanceCaveat:h};if("setAttribute"in n&&n.setAttribute("data-engine","three.js r".concat(M)),n.addEventListener("webglcontextlost",Tt,!1),n.addEventListener("webglcontextrestored",kt,!1),null===_t){var Mt=["webgl2","webgl","experimental-webgl"];if(!0===v.isWebGL1Renderer&&Mt.shift(),null===(_t=bt(Mt,wt)))throw bt(Mt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===_t.getShaderPrecisionFormat&&(_t.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function St(){Q=new pi(_t),K=new Nr(_t,Q,e),Q.init(K),gt=new po(_t,Q,K),$=new co(_t,Q,K),tt=new yi(_t),et=new Qa,nt=new fo(_t,Q,$,et,K,gt,tt),rt=new Kr(v),it=new fi(v),at=new Ge(_t,K),xt=new Or(_t,Q,at,K),ot=new vi(_t,at,tt,xt),st=new Mi(_t,ot,at,tt),vt=new wi(_t,K,nt),dt=new Br(et),ut=new Ja(v,rt,it,Q,K,xt,dt),lt=new bo(v,et),ht=new eo,ct=new so(Q,K),pt=new Dr(v,rt,$,st,t,s),ft=new ho(v,st,K),mt=new Ir(_t,Q,tt,K),yt=new mi(_t,Q,tt,K),tt.programs=ut.programs,v.capabilities=K,v.extensions=Q,v.properties=et,v.renderLists=ht,v.shadowMap=ft,v.state=$,v.info=tt}St();var Et=new _o(v,_t);function Tt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function kt(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1;var t=tt.autoReset,e=ft.enabled,n=ft.autoUpdate,r=ft.needsUpdate,i=ft.type;St(),tt.autoReset=t,ft.enabled=e,ft.autoUpdate=n,ft.needsUpdate=r,ft.type=i}function At(t){var e=t.target;e.removeEventListener("dispose",At),Rt(e)}function Rt(t){Lt(t),et.remove(t)}function Lt(t){var e=et.get(t).programs;void 0!==e&&(e.forEach((function(t){ut.releaseProgram(t)})),t.isShaderMaterial&&ut.releaseShaderCache(t))}this.xr=Et,this.getContext=function(){return _t},this.getContextAttributes=function(){return _t.getContextAttributes()},this.forceContextLoss=function(){var t=Q.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=Q.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(t){void 0!==t&&(C=t,this.setSize(R,L,!1))},this.getSize=function(t){return t.set(R,L)},this.setSize=function(t,e,r){if(Et.isPresenting)console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");else{try{R=t,L=e,n.width=Math.floor(t*C),n.height=Math.floor(e*C),!1!==r&&n.style&&(n.style.width=t+"px",n.style.height=e+"px")}catch(t){}this.setViewport(0,0,t,e)}},this.getDrawingBufferSize=function(t){return t.set(R*C,L*C).floor()},this.setDrawingBufferSize=function(t,e,r){R=t,L=e,C=r,n.width=Math.floor(t*r),n.height=Math.floor(e*r),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return t.copy(w)},this.getViewport=function(t){return t.copy(D)},this.setViewport=function(t,e,n,r){t.isVector4?D.set(t.x,t.y,t.z,t.w):D.set(t,e,n,r),$.viewport(w.copy(D).multiplyScalar(C).floor())},this.getScissor=function(t){return t.copy(O)},this.setScissor=function(t,e,n,r){t.isVector4?O.set(t.x,t.y,t.z,t.w):O.set(t,e,n,r),$.scissor(k.copy(O).multiplyScalar(C).floor())},this.getScissorTest=function(){return I},this.setScissorTest=function(t){$.setScissorTest(I=t)},this.setOpaqueSort=function(t){P=t},this.setTransparentSort=function(t){z=t},this.getClearColor=function(t){return t.copy(pt.getClearColor())},this.setClearColor=function(){pt.setClearColor.apply(pt,arguments)},this.getClearAlpha=function(){return pt.getClearAlpha()},this.setClearAlpha=function(){pt.setClearAlpha.apply(pt,arguments)},this.clear=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=0;t&&(r|=16384),e&&(r|=256),n&&(r|=1024),_t.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(){n.removeEventListener("webglcontextlost",Tt,!1),n.removeEventListener("webglcontextrestored",kt,!1),ht.dispose(),ct.dispose(),et.dispose(),rt.dispose(),it.dispose(),st.dispose(),xt.dispose(),ut.dispose(),Et.dispose(),Et.removeEventListener("sessionstart",Dt),Et.removeEventListener("sessionend",Ot),V&&(V.dispose(),V=null),It.stop()},this.renderBufferDirect=function(t,e,n,r,i,a){null===e&&(e=Z);var o=i.isMesh&&i.matrixWorld.determinant()<0,s=Wt(t,e,n,r,i);$.setMaterial(r,o);var u=n.index,l=n.attributes.position;if(null===u){if(void 0===l||0===l.count)return}else if(0===u.count)return;var h,c=1;!0===r.wireframe&&(u=ot.getWireframeAttribute(n),c=2),xt.setup(i,r,s,n,u);var d=mt;null!==u&&(h=at.get(u),(d=yt).setIndex(h));var f=null!==u?u.count:l.count,p=n.drawRange.start*c,v=n.drawRange.count*c,m=null!==a?a.start*c:0,y=null!==a?a.count*c:1/0,g=Math.max(p,m),x=Math.min(f,p+v,m+y)-1,_=Math.max(0,x-g+1);if(0!==_){if(i.isMesh)!0===r.wireframe?($.setLineWidth(r.wireframeLinewidth*J()),d.setMode(1)):d.setMode(4);else if(i.isLine){var b=r.linewidth;void 0===b&&(b=1),$.setLineWidth(b*J()),i.isLineSegments?d.setMode(1):i.isLineLoop?d.setMode(2):d.setMode(3)}else i.isPoints?d.setMode(0):i.isSprite&&d.setMode(4);if(i.isInstancedMesh)d.renderInstances(g,_,i.count);else if(n.isInstancedBufferGeometry){var w=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(g,_,w)}else d.render(g,_)}},this.compile=function(t,e){(d=ct.get(t)).init(),p.push(d),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(v.physicallyCorrectLights),t.traverse((function(e){var n=e.material;if(n)if(Array.isArray(n))for(var r=0;r<n.length;r++){Vt(n[r],t,e)}else Vt(n,t,e)})),p.pop(),d=null};var Pt=null;function zt(t){Pt&&Pt(t)}function Dt(){It.stop()}function Ot(){It.start()}var It=new Ve;function Nt(t,e,n,r){if(!1!==t.visible){if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)d.pushLight(t),t.castShadow&&d.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||N.intersectsSprite(t)){r&&Y.setFromMatrixPosition(t.matrixWorld).applyMatrix4(j);var i=st.update(t),a=t.material;a.visible&&c.push(t,i,a,n,Y.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==tt.render.frame&&(t.skeleton.update(),t.skeleton.frame=tt.render.frame),!t.frustumCulled||N.intersectsObject(t))){r&&Y.setFromMatrixPosition(t.matrixWorld).applyMatrix4(j);var o=st.update(t),s=t.material;if(Array.isArray(s))for(var u=o.groups,l=0,h=u.length;l<h;l++){var f=u[l],p=s[f.materialIndex];p&&p.visible&&c.push(t,o,p,n,Y.z,f)}else s.visible&&c.push(t,o,s,n,Y.z,null)}for(var v=t.children,m=0,y=v.length;m<y;m++)Nt(v[m],e,n,r)}}function Bt(t,e,n,r){var i=t.opaque,a=t.transmissive,o=t.transparent;d.setupLightsView(n),a.length>0&&Ut(i,e,n),r&&$.viewport(w.copy(r)),i.length>0&&Ft(i,e,n),a.length>0&&Ft(a,e,n),o.length>0&&Ft(o,e,n),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1)}function Ut(t,e,n){var r=K.isWebGL2;null===V&&(V=new jr(1,1,{generateMipmaps:!0,type:null!==gt.convert(W)?W:F,minFilter:U,samples:r&&!0===o?4:0})),v.getDrawingBufferSize(X),r?V.setSize(X.x,X.y):V.setSize(Kt(X.x),Kt(X.y));var i=v.getRenderTarget();v.setRenderTarget(V),v.clear();var a=v.toneMapping;v.toneMapping=0,Ft(t,e,n),v.toneMapping=a,nt.updateMultisampleRenderTarget(V),nt.updateRenderTargetMipmap(V),v.setRenderTarget(i)}function Ft(t,e,n){for(var r=!0===e.isScene?e.overrideMaterial:null,i=0,a=t.length;i<a;i++){var o=t[i],s=o.object,u=o.geometry,l=null===r?o.material:r,h=o.group;s.layers.test(n.layers)&&Ht(s,e,n,u,l,h)}}function Ht(t,e,n,r,i,a){t.onBeforeRender(v,e,n,r,i,a),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),i.onBeforeRender(v,e,n,r,t,a),!0===i.transparent&&i.side===T?(i.side=E,i.needsUpdate=!0,v.renderBufferDirect(n,e,r,i,t,a),i.side=S,i.needsUpdate=!0,v.renderBufferDirect(n,e,r,i,t,a),i.side=T):v.renderBufferDirect(n,e,r,i,t,a),t.onAfterRender(v,e,n,r,i,a)}function Vt(t,e,n){!0!==e.isScene&&(e=Z);var r=et.get(t),i=d.state.lights,a=d.state.shadowsArray,o=i.state.version,s=ut.getParameters(t,i.state,a,e,n),u=ut.getProgramCacheKey(s),l=r.programs;r.environment=t.isMeshStandardMaterial?e.environment:null,r.fog=e.fog,r.envMap=(t.isMeshStandardMaterial?it:rt).get(t.envMap||r.environment),void 0===l&&(t.addEventListener("dispose",At),l=new Map,r.programs=l);var h=l.get(u);if(void 0!==h){if(r.currentProgram===h&&r.lightsStateVersion===o)return Gt(t,s),h}else s.uniforms=ut.getUniforms(t),t.onBuild(n,s,v),t.onBeforeCompile(s,v),h=ut.acquireProgram(s,u),l.set(u,h),r.uniforms=s.uniforms;var c=r.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(c.clippingPlanes=dt.uniform),Gt(t,s),r.needsLights=qt(t),r.lightsStateVersion=o,r.needsLights&&(c.ambientLightColor.value=i.state.ambient,c.lightProbe.value=i.state.probe,c.directionalLights.value=i.state.directional,c.directionalLightShadows.value=i.state.directionalShadow,c.spotLights.value=i.state.spot,c.spotLightShadows.value=i.state.spotShadow,c.rectAreaLights.value=i.state.rectArea,c.ltc_1.value=i.state.rectAreaLTC1,c.ltc_2.value=i.state.rectAreaLTC2,c.pointLights.value=i.state.point,c.pointLightShadows.value=i.state.pointShadow,c.hemisphereLights.value=i.state.hemi,c.directionalShadowMap.value=i.state.directionalShadowMap,c.directionalShadowMatrix.value=i.state.directionalShadowMatrix,c.spotShadowMap.value=i.state.spotShadowMap,c.spotShadowMatrix.value=i.state.spotShadowMatrix,c.pointShadowMap.value=i.state.pointShadowMap,c.pointShadowMatrix.value=i.state.pointShadowMatrix);var f=h.getUniforms(),p=Aa.seqWithValue(f.seq,c);return r.currentProgram=h,r.uniformsList=p,h}function Gt(t,e){var n=et.get(t);n.outputEncoding=e.outputEncoding,n.instancing=e.instancing,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping}function Wt(t,e,n,r,i){!0!==e.isScene&&(e=Z),nt.resetTextureUnits();var a=e.fog,o=r.isMeshStandardMaterial?e.environment:null,s=null===x?v.outputEncoding:!0===x.isXRRenderTarget?x.texture.encoding:Ct,u=(r.isMeshStandardMaterial?it:rt).get(r.envMap||o),l=!0===r.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!r.normalMap&&!!n.attributes.tangent,c=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,p=!!n.morphAttributes.color,m=r.toneMapped?v.toneMapping:0,y=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,g=void 0!==y?y.length:0,w=et.get(r),M=d.state.lights;if(!0===B&&(!0===H||t!==b)){var S=t===b&&r.id===_;dt.setState(r,t,S)}var E=!1;r.version===w.__version?w.needsLights&&w.lightsStateVersion!==M.state.version||w.outputEncoding!==s||i.isInstancedMesh&&!1===w.instancing?E=!0:i.isInstancedMesh||!0!==w.instancing?i.isSkinnedMesh&&!1===w.skinning?E=!0:i.isSkinnedMesh||!0!==w.skinning?w.envMap!==u||r.fog&&w.fog!==a?E=!0:void 0===w.numClippingPlanes||w.numClippingPlanes===dt.numPlanes&&w.numIntersection===dt.numIntersection?(w.vertexAlphas!==l||w.vertexTangents!==h||w.morphTargets!==c||w.morphNormals!==f||w.morphColors!==p||w.toneMapping!==m||!0===K.isWebGL2&&w.morphTargetsCount!==g)&&(E=!0):E=!0:E=!0:E=!0:(E=!0,w.__version=r.version);var T=w.currentProgram;!0===E&&(T=Vt(r,e,i));var k=!1,A=!1,R=!1,P=T.getUniforms(),z=w.uniforms;if($.useProgram(T.program)&&(k=!0,A=!0,R=!0),r.id!==_&&(_=r.id,A=!0),k||b!==t){if(P.setValue(_t,"projectionMatrix",t.projectionMatrix),K.logarithmicDepthBuffer&&P.setValue(_t,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),b!==t&&(b=t,A=!0,R=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){var D=P.map.cameraPosition;void 0!==D&&D.setValue(_t,Y.setFromMatrixPosition(t.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&P.setValue(_t,"isOrthographic",!0===t.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&P.setValue(_t,"viewMatrix",t.matrixWorldInverse)}if(i.isSkinnedMesh){P.setOptional(_t,i,"bindMatrix"),P.setOptional(_t,i,"bindMatrixInverse");var O=i.skeleton;O&&(K.floatVertexTextures?(null===O.boneTexture&&O.computeBoneTexture(),P.setValue(_t,"boneTexture",O.boneTexture,nt),P.setValue(_t,"boneTextureSize",O.boneTextureSize)):P.setOptional(_t,O,"boneMatrices"))}var I=n.morphAttributes;return(void 0!==I.position||void 0!==I.normal||void 0!==I.color&&!0===K.isWebGL2)&&vt.update(i,n,r,T),(A||w.receiveShadow!==i.receiveShadow)&&(w.receiveShadow=i.receiveShadow,P.setValue(_t,"receiveShadow",i.receiveShadow)),A&&(P.setValue(_t,"toneMappingExposure",v.toneMappingExposure),w.needsLights&&jt(z,R),a&&r.fog&&lt.refreshFogUniforms(z,a),lt.refreshMaterialUniforms(z,r,C,L,V),Aa.upload(_t,w.uniformsList,z,nt)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(Aa.upload(_t,w.uniformsList,z,nt),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&P.setValue(_t,"center",i.center),P.setValue(_t,"modelViewMatrix",i.modelViewMatrix),P.setValue(_t,"normalMatrix",i.normalMatrix),P.setValue(_t,"modelMatrix",i.matrixWorld),T}function jt(t,e){t.ambientLightColor.needsUpdate=e,t.lightProbe.needsUpdate=e,t.directionalLights.needsUpdate=e,t.directionalLightShadows.needsUpdate=e,t.pointLights.needsUpdate=e,t.pointLightShadows.needsUpdate=e,t.spotLights.needsUpdate=e,t.spotLightShadows.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function qt(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}It.setAnimationLoop(zt),"undefined"!=typeof self&&It.setContext(self),this.setAnimationLoop=function(t){Pt=t,Et.setAnimationLoop(t),null===t?It.stop():It.start()},Et.addEventListener("sessionstart",Dt),Et.addEventListener("sessionend",Ot),this.render=function(t,e){if(void 0===e||!0===e.isCamera){if(!0!==m){!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===Et.enabled&&!0===Et.isPresenting&&(!0===Et.cameraAutoUpdate&&Et.updateCamera(e),e=Et.getCamera()),!0===t.isScene&&t.onBeforeRender(v,t,e,x),(d=ct.get(t,p.length)).init(),p.push(d),j.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),N.setFromProjectionMatrix(j),H=this.localClippingEnabled,B=dt.init(this.clippingPlanes,H,e),(c=ht.get(t,f.length)).init(),f.push(c),Nt(t,e,0,v.sortObjects),c.finish(),!0===v.sortObjects&&c.sort(P,z),!0===B&&dt.beginShadows();var n=d.state.shadowsArray;if(ft.render(n,t,e),!0===B&&dt.endShadows(),!0===this.info.autoReset&&this.info.reset(),pt.render(c,t),d.setupLights(v.physicallyCorrectLights),e.isArrayCamera)for(var r=e.cameras,i=0,a=r.length;i<a;i++){var o=r[i];Bt(c,t,o,o.viewport)}else Bt(c,t,e);null!==x&&(nt.updateMultisampleRenderTarget(x),nt.updateRenderTargetMipmap(x)),!0===t.isScene&&t.onAfterRender(v,t,e),xt.resetDefaultState(),_=-1,b=null,p.pop(),d=p.length>0?p[p.length-1]:null,f.pop(),c=f.length>0?f[f.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return g},this.getRenderTarget=function(){return x},this.setRenderTargetTextures=function(t,e,n){et.get(t.texture).__webglTexture=e,et.get(t.depthTexture).__webglTexture=n;var r=et.get(t);r.__hasExternalTextures=!0,r.__hasExternalTextures&&(r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0===Q.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){var n=et.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;x=t,y=e,g=n;var r=!0;if(t){var i=et.get(t);void 0!==i.__useDefaultFramebuffer?($.bindFramebuffer(36160,null),r=!1):void 0===i.__webglFramebuffer?nt.setupRenderTarget(t):i.__hasExternalTextures&&nt.rebindTextures(t,et.get(t.texture).__webglTexture,et.get(t.depthTexture).__webglTexture)}var a=null,o=!1,s=!1;if(t){var u=t.texture;(u.isData3DTexture||u.isDataArrayTexture)&&(s=!0);var l=et.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(a=l[e],o=!0):a=K.isWebGL2&&t.samples>0&&!1===nt.useMultisampledRTT(t)?et.get(t).__webglMultisampledFramebuffer:l,w.copy(t.viewport),k.copy(t.scissor),A=t.scissorTest}else w.copy(D).multiplyScalar(C).floor(),k.copy(O).multiplyScalar(C).floor(),A=I;var h=$.bindFramebuffer(36160,a);if(h&&K.drawBuffers&&r&&$.drawBuffers(t,a),$.viewport(w),$.scissor(k),$.setScissorTest(A),o){var c=et.get(t.texture);_t.framebufferTexture2D(36160,36064,34069+e,c.__webglTexture,n)}else if(s){var d=et.get(t.texture),f=e||0;_t.framebufferTextureLayer(36160,36064,d.__webglTexture,n||0,f)}_=-1},this.readRenderTargetPixels=function(t,e,n,r,i,a,o){if(t&&t.isWebGLRenderTarget){var s=et.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){$.bindFramebuffer(36160,s);try{var u=t.texture,l=u.format,h=u.type;if(l!==q&&gt.convert(l)!==_t.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var c=h===W&&(Q.has("EXT_color_buffer_half_float")||K.isWebGL2&&Q.has("EXT_color_buffer_float"));if(!(h===F||gt.convert(h)===_t.getParameter(35738)||h===G&&(K.isWebGL2||Q.has("OES_texture_float")||Q.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&_t.readPixels(e,n,r,i,gt.convert(l),gt.convert(h),a)}finally{var d=null!==x?et.get(x).__webglFramebuffer:null;$.bindFramebuffer(36160,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!0===e.isFramebufferTexture){var r=Math.pow(2,-n),i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r);nt.setTexture2D(e,0),_t.copyTexSubImage2D(3553,n,0,0,t.x,t.y,i,a),$.unbindTexture()}else console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.")},this.copyTextureToTexture=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=e.image.width,a=e.image.height,o=gt.convert(n.format),s=gt.convert(n.type);nt.setTexture2D(n,0),_t.pixelStorei(37440,n.flipY),_t.pixelStorei(37441,n.premultiplyAlpha),_t.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?_t.texSubImage2D(3553,r,t.x,t.y,i,a,o,s,e.image.data):e.isCompressedTexture?_t.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):_t.texSubImage2D(3553,r,t.x,t.y,o,s,e.image),0===r&&n.generateMipmaps&&_t.generateMipmap(3553),$.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(v.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,u=t.max.z-t.min.z+1,l=gt.convert(r.format),h=gt.convert(r.type);if(r.isData3DTexture)nt.setTexture3D(r,0),a=32879;else{if(!r.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");nt.setTexture2DArray(r,0),a=35866}_t.pixelStorei(37440,r.flipY),_t.pixelStorei(37441,r.premultiplyAlpha),_t.pixelStorei(3317,r.unpackAlignment);var c=_t.getParameter(3314),d=_t.getParameter(32878),f=_t.getParameter(3316),p=_t.getParameter(3315),m=_t.getParameter(32877),y=n.isCompressedTexture?n.mipmaps[0]:n.image;_t.pixelStorei(3314,y.width),_t.pixelStorei(32878,y.height),_t.pixelStorei(3316,t.min.x),_t.pixelStorei(3315,t.min.y),_t.pixelStorei(32877,t.min.z),n.isDataTexture||n.isData3DTexture?_t.texSubImage3D(a,i,e.x,e.y,e.z,o,s,u,l,h,y.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),_t.compressedTexSubImage3D(a,i,e.x,e.y,e.z,o,s,u,l,y.data)):_t.texSubImage3D(a,i,e.x,e.y,e.z,o,s,u,l,h,y),_t.pixelStorei(3314,c),_t.pixelStorei(32878,d),_t.pixelStorei(3316,f),_t.pixelStorei(3315,p),_t.pixelStorei(32877,m),0===i&&r.generateMipmaps&&_t.generateMipmap(a),$.unbindTexture()}},this.initTexture=function(t){nt.setTexture2D(t,0),$.unbindTexture()},this.resetState=function(){y=0,g=0,x=null,$.reset(),xt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Mo.prototype.isWebGLRenderer=!0;var So=function(t){d(n,t);var e=p(n);function n(){var t;return _(this,n),(t=e.call(this)).type="Scene",t.background=null,t.environment=null,t.fog=null,t.overrideMaterial=null,t.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:m(t)})),t}return w(n,[{key:"copy",value:function(t,e){return h(y(n.prototype),"copy",this).call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}},{key:"toJSON",value:function(t){var e=h(y(n.prototype),"toJSON",this).call(this,t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}]),n}(Tn);So.prototype.isScene=!0;var Eo=new ee,To=new He,ko=new He,Ao=new ee,Ro=new Pe,Lo=function(t){d(n,t);var e=p(n);function n(t,r){var i;return _(this,n),(i=e.call(this,t,r)).type="SkinnedMesh",i.bindMode="attached",i.bindMatrix=new Pe,i.bindMatrixInverse=new Pe,i}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}},{key:"bind",value:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}},{key:"pose",value:function(){this.skeleton.pose()}},{key:"normalizeSkinWeights",value:function(){for(var t=new He,e=this.geometry.attributes.skinWeight,n=0,r=e.count;n<r;n++){t.fromBufferAttribute(e,n);var i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}},{key:"updateMatrixWorld",value:function(t){h(y(n.prototype),"updateMatrixWorld",this).call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}},{key:"boneTransform",value:function(t,e){var n=this.skeleton,r=this.geometry;To.fromBufferAttribute(r.attributes.skinIndex,t),ko.fromBufferAttribute(r.attributes.skinWeight,t),Eo.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(var i=0;i<4;i++){var a=ko.getComponent(i);if(0!==a){var o=To.getComponent(i);Ro.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),e.addScaledVector(Ao.copy(Eo).applyMatrix4(Ro),a)}}return e.applyMatrix4(this.bindMatrixInverse)}}]),n}(Ar);Lo.prototype.isSkinnedMesh=!0;var Co=function(t){d(n,t);var e=p(n);function n(){var t;return _(this,n),(t=e.call(this)).type="Bone",t}return w(n)}(Tn);Co.prototype.isBone=!0;var Po=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0,u=arguments.length>5?arguments[5]:void 0,l=arguments.length>6?arguments[6]:void 0,h=arguments.length>7?arguments[7]:void 0,c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:D,d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:D,f=arguments.length>10?arguments[10]:void 0,p=arguments.length>11?arguments[11]:void 0;return _(this,n),(t=e.call(this,null,u,l,h,c,d,o,s,f,p)).image={data:r,width:i,height:a},t.generateMipmaps=!1,t.flipY=!1,t.unpackAlignment=1,t}return w(n)}(Wr);Po.prototype.isDataTexture=!0;var zo=new Pe,Do=new Pe,Oo=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];_(this,t),this.uuid=qt(),this.bones=e.slice(0),this.boneInverses=n,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}return w(t,[{key:"init",value:function(){var t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new Pe)}}},{key:"calculateInverses",value:function(){this.boneInverses.length=0;for(var t=0,e=this.bones.length;t<e;t++){var n=new Pe;this.bones[t]&&n.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(n)}}},{key:"pose",value:function(){for(var t=0,e=this.bones.length;t<e;t++){var n=this.bones[t];n&&n.matrixWorld.copy(this.boneInverses[t]).invert()}for(var r=0,i=this.bones.length;r<i;r++){var a=this.bones[r];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}}},{key:"update",value:function(){for(var t=this.bones,e=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=t.length;i<a;i++){var o=t[i]?t[i].matrixWorld:Do;zo.multiplyMatrices(o,e[i]),zo.toArray(n,16*i)}null!==r&&(r.needsUpdate=!0)}},{key:"clone",value:function(){return new t(this.bones,this.boneInverses)}},{key:"computeBoneTexture",value:function(){var t=Math.sqrt(4*this.bones.length);t=Qt(t),t=Math.max(t,4);var e=new Float32Array(t*t*4);e.set(this.boneMatrices);var n=new Po(e,t,t,q,G);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this.boneTextureSize=t,this}},{key:"getBoneByName",value:function(t){for(var e=0,n=this.bones.length;e<n;e++){var r=this.bones[e];if(r.name===t)return r}}},{key:"dispose",value:function(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}},{key:"fromJSON",value:function(t,e){this.uuid=t.uuid;for(var n=0,r=t.bones.length;n<r;n++){var i=t.bones[n],a=e[i];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),a=new Co),this.bones.push(a),this.boneInverses.push((new Pe).fromArray(t.boneInverses[n]))}return this.init(),this}},{key:"toJSON",value:function(){var t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;for(var e=this.bones,n=this.boneInverses,r=0,i=e.length;r<i;r++){var a=e[r];t.bones.push(a.uuid);var o=n[r];t.boneInverses.push(o.toArray())}return t}}]),t}(),Io=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="LineBasicMaterial",r.color=new en(16777215),r.linewidth=1,r.linecap="round",r.linejoin="round",r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this}}]),n}(Fn);Io.prototype.isLineBasicMaterial=!0;var No=new ee,Bo=new ee,Uo=new Pe,Fo=new Kn,Ho=new Me,Vo=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new In,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Io;return _(this,n),(t=e.call(this)).type="Line",t.geometry=r,t.material=i,t.updateMorphTargets(),t}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.material=t.material,this.geometry=t.geometry,this}},{key:"computeLineDistances",value:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[0],r=1,i=e.count;r<i;r++)No.fromBufferAttribute(e,r-1),Bo.fromBufferAttribute(e,r),n[r]=n[r-1],n[r]+=No.distanceTo(Bo);t.setAttribute("lineDistance",new un(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}},{key:"raycast",value:function(t,e){var n=this.geometry,r=this.matrixWorld,i=t.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ho.copy(n.boundingSphere),Ho.applyMatrix4(r),Ho.radius+=i,!1!==t.ray.intersectsSphere(Ho)){Uo.copy(r).invert(),Fo.copy(t.ray).applyMatrix4(Uo);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,u=new ee,l=new ee,h=new ee,c=new ee,d=this.isLineSegments?2:1;if(n.isBufferGeometry){var f=n.index,p=n.attributes.position;if(null!==f)for(var v=Math.max(0,a.start),m=Math.min(f.count,a.start+a.count)-1;v<m;v+=d){var y=f.getX(v),g=f.getX(v+1);if(u.fromBufferAttribute(p,y),l.fromBufferAttribute(p,g),!(Fo.distanceSqToSegment(u,l,c,h)>s)){c.applyMatrix4(this.matrixWorld);var x=t.ray.origin.distanceTo(c);x<t.near||x>t.far||e.push({distance:x,point:h.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else for(var _=Math.max(0,a.start),b=Math.min(p.count,a.start+a.count)-1;_<b;_+=d){if(u.fromBufferAttribute(p,_),l.fromBufferAttribute(p,_+1),!(Fo.distanceSqToSegment(u,l,c,h)>s)){c.applyMatrix4(this.matrixWorld);var w=t.ray.origin.distanceTo(c);w<t.near||w>t.far||e.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}},{key:"updateMorphTargets",value:function(){var t=this.geometry;if(t.isBufferGeometry){var e=t.morphAttributes,n=Object.keys(e);if(n.length>0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=t.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}]),n}(Tn);Vo.prototype.isLine=!0;var Go=function(t){d(n,t);var e=p(n);function n(t,r){var i;return _(this,n),(i=e.call(this,t,r)).type="LineLoop",i}return w(n)}(Vo);Go.prototype.isLineLoop=!0,function(t){d(n,t);var e=p(n);function n(t,r,i,a,o,s,u,l,h){var c;return _(this,n),(c=e.call(this,t,r,i,a,o,s,u,l,h)).needsUpdate=!0,c}return w(n)}(Wr).prototype.isCanvasTexture=!0;var Wo=function(){function t(){_(this,t),this.type="Curve",this.arcLengthDivisions=200}return w(t,[{key:"getPoint",value:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}},{key:"getPointAt",value:function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)}},{key:"getPoints",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}},{key:"getSpacedPoints",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}},{key:"getLength",value:function(){var t=this.getLengths();return t[t.length-1]}},{key:"getLengths",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n=[],r=this.getPoint(0),i=0;n.push(0);for(var a=1;a<=t;a++)i+=(e=this.getPoint(a/t)).distanceTo(r),n.push(i),r=e;return this.cacheArcLengths=n,n}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.getLengths()}},{key:"getUtoTmapping",value:function(t,e){var n,r=this.getLengths(),i=0,a=r.length;n=e||t*r[a-1];for(var o,s=0,u=a-1;s<=u;)if((o=r[i=Math.floor(s+(u-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){u=i;break}u=i-1}if(r[i=u]===n)return i/(a-1);var l=r[i];return(i+(n-l)/(r[i+1]-l))/(a-1)}},{key:"getTangent",value:function(t,e){var n=1e-4,r=t-n,i=t+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=e||(a.isVector2?new Fe:new ee);return s.copy(o).sub(a).normalize(),s}},{key:"getTangentAt",value:function(t,e){var n=this.getUtoTmapping(t);return this.getTangent(n,e)}},{key:"computeFrenetFrames",value:function(t,e){for(var n=new ee,r=[],i=[],a=[],o=new ee,s=new Pe,u=0;u<=t;u++){var l=u/t;r[u]=this.getTangentAt(l,new ee)}i[0]=new ee,a[0]=new ee;var h=Number.MAX_VALUE,c=Math.abs(r[0].x),d=Math.abs(r[0].y),f=Math.abs(r[0].z);c<=h&&(h=c,n.set(1,0,0)),d<=h&&(h=d,n.set(0,1,0)),f<=h&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(var p=1;p<=t;p++){if(i[p]=i[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();var v=Math.acos(Xt(r[p-1].dot(r[p]),-1,1));i[p].applyMatrix4(s.makeRotationAxis(o,v))}a[p].crossVectors(r[p],i[p])}if(!0===e){var m=Math.acos(Xt(i[0].dot(i[t]),-1,1));m/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(m=-m);for(var y=1;y<=t;y++)i[y].applyMatrix4(s.makeRotationAxis(r[y],m*y)),a[y].crossVectors(r[y],i[y])}return{tangents:r,normals:i,binormals:a}}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}},{key:"toJSON",value:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}},{key:"fromJSON",value:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}]),t}(),jo=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI,l=arguments.length>6&&void 0!==arguments[6]&&arguments[6],h=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;return _(this,n),(t=e.call(this)).type="EllipseCurve",t.aX=r,t.aY=i,t.xRadius=a,t.yRadius=o,t.aStartAngle=s,t.aEndAngle=u,t.aClockwise=l,t.aRotation=h,t}return w(n,[{key:"getPoint",value:function(t,e){for(var n=e||new Fe,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+t*i,s=this.aX+this.xRadius*Math.cos(o),u=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var l=Math.cos(this.aRotation),h=Math.sin(this.aRotation),c=s-this.aX,d=u-this.aY;s=c*l-d*h+this.aX,u=c*h+d*l+this.aY}return n.set(s,u)}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}},{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}},{key:"fromJSON",value:function(t){return h(y(n.prototype),"fromJSON",this).call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}]),n}(Wo);jo.prototype.isEllipseCurve=!0;var qo=function(t){d(n,t);var e=p(n);function n(t,r,i,a,o,s){var u;return _(this,n),(u=e.call(this,t,r,i,i,a,o,s)).type="ArcCurve",u}return w(n)}(jo);function Xo(){var t=0,e=0,n=0,r=0;function i(i,a,o,s){t=i,e=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(t,e,n,r,a){i(e,n,a*(n-t),a*(r-e))},initNonuniformCatmullRom:function(t,e,n,r,a,o,s){var u=(e-t)/a-(n-t)/(a+o)+(n-e)/o,l=(n-e)/o-(r-e)/(o+s)+(r-n)/s;i(e,n,u*=o,l*=o)},calc:function(i){var a=i*i;return t+e*i+n*a+r*(a*i)}}}qo.prototype.isArcCurve=!0;var Yo=new ee,Zo=new Xo,Jo=new Xo,Qo=new Xo,Ko=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"centripetal",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;return _(this,n),(t=e.call(this)).type="CatmullRomCurve3",t.points=r,t.closed=i,t.curveType=a,t.tension=o,t}return w(n,[{key:"getPoint",value:function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ee,i=r,a=this.points,o=a.length,s=(o-(this.closed?0:1))*t,u=Math.floor(s),l=s-u;this.closed?u+=u>0?0:(Math.floor(Math.abs(u)/o)+1)*o:0===l&&u===o-1&&(u=o-2,l=1),this.closed||u>0?e=a[(u-1)%o]:(Yo.subVectors(a[0],a[1]).add(a[0]),e=Yo);var h=a[u%o],c=a[(u+1)%o];if(this.closed||u+2<o?n=a[(u+2)%o]:(Yo.subVectors(a[o-1],a[o-2]).add(a[o-1]),n=Yo),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,f=Math.pow(e.distanceToSquared(h),d),p=Math.pow(h.distanceToSquared(c),d),v=Math.pow(c.distanceToSquared(n),d);p<1e-4&&(p=1),f<1e-4&&(f=p),v<1e-4&&(v=p),Zo.initNonuniformCatmullRom(e.x,h.x,c.x,n.x,f,p,v),Jo.initNonuniformCatmullRom(e.y,h.y,c.y,n.y,f,p,v),Qo.initNonuniformCatmullRom(e.z,h.z,c.z,n.z,f,p,v)}else"catmullrom"===this.curveType&&(Zo.initCatmullRom(e.x,h.x,c.x,n.x,this.tension),Jo.initCatmullRom(e.y,h.y,c.y,n.y,this.tension),Qo.initCatmullRom(e.z,h.z,c.z,n.z,this.tension));return i.set(Zo.calc(l),Jo.calc(l),Qo.calc(l)),i}},{key:"copy",value:function(t){h(y(n.prototype),"copy",this).call(this,t),this.points=[];for(var e=0,r=t.points.length;e<r;e++){var i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);t.points=[];for(var e=0,r=this.points.length;e<r;e++){var i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}},{key:"fromJSON",value:function(t){h(y(n.prototype),"fromJSON",this).call(this,t),this.points=[];for(var e=0,r=t.points.length;e<r;e++){var i=t.points[e];this.points.push((new ee).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}]),n}(Wo);function $o(t,e,n,r,i){var a=.5*(r-e),o=.5*(i-n),s=t*t;return(2*n-2*r+a+o)*(t*s)+(-3*n+3*r-2*a-o)*s+a*t+n}function ts(t,e,n,r){return function(t,e){var n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,r)}function es(t,e,n,r,i){return function(t,e){var n=1-t;return n*n*n*e}(t,e)+function(t,e){var n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,r)+function(t,e){return t*t*t*e}(t,i)}Ko.prototype.isCatmullRomCurve3=!0;var ns=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Fe,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Fe,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Fe,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Fe;return _(this,n),(t=e.call(this)).type="CubicBezierCurve",t.v0=r,t.v1=i,t.v2=a,t.v3=o,t}return w(n,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Fe,n=e,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(es(t,r.x,i.x,a.x,o.x),es(t,r.y,i.y,a.y,o.y)),n}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}},{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}},{key:"fromJSON",value:function(t){return h(y(n.prototype),"fromJSON",this).call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}]),n}(Wo);ns.prototype.isCubicBezierCurve=!0;var rs=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ee,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ee,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new ee,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new ee;return _(this,n),(t=e.call(this)).type="CubicBezierCurve3",t.v0=r,t.v1=i,t.v2=a,t.v3=o,t}return w(n,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ee,n=e,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(es(t,r.x,i.x,a.x,o.x),es(t,r.y,i.y,a.y,o.y),es(t,r.z,i.z,a.z,o.z)),n}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}},{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}},{key:"fromJSON",value:function(t){return h(y(n.prototype),"fromJSON",this).call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}]),n}(Wo);rs.prototype.isCubicBezierCurve3=!0;var is=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Fe,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Fe;return _(this,n),(t=e.call(this)).type="LineCurve",t.v1=r,t.v2=i,t}return w(n,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Fe,n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}},{key:"getPointAt",value:function(t,e){return this.getPoint(t,e)}},{key:"getTangent",value:function(t,e){var n=e||new Fe;return n.copy(this.v2).sub(this.v1).normalize(),n}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}},{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}},{key:"fromJSON",value:function(t){return h(y(n.prototype),"fromJSON",this).call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}]),n}(Wo);is.prototype.isLineCurve=!0;var as=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ee,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ee;return _(this,n),(t=e.call(this)).type="LineCurve3",t.isLineCurve3=!0,t.v1=r,t.v2=i,t}return w(n,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ee,n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}},{key:"getPointAt",value:function(t,e){return this.getPoint(t,e)}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}},{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}},{key:"fromJSON",value:function(t){return h(y(n.prototype),"fromJSON",this).call(this,t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}]),n}(Wo),os=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Fe,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Fe,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Fe;return _(this,n),(t=e.call(this)).type="QuadraticBezierCurve",t.v0=r,t.v1=i,t.v2=a,t}return w(n,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Fe,n=e,r=this.v0,i=this.v1,a=this.v2;return n.set(ts(t,r.x,i.x,a.x),ts(t,r.y,i.y,a.y)),n}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}},{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}},{key:"fromJSON",value:function(t){return h(y(n.prototype),"fromJSON",this).call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}]),n}(Wo);os.prototype.isQuadraticBezierCurve=!0;var ss=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ee,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ee,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new ee;return _(this,n),(t=e.call(this)).type="QuadraticBezierCurve3",t.v0=r,t.v1=i,t.v2=a,t}return w(n,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ee,n=e,r=this.v0,i=this.v1,a=this.v2;return n.set(ts(t,r.x,i.x,a.x),ts(t,r.y,i.y,a.y),ts(t,r.z,i.z,a.z)),n}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}},{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}},{key:"fromJSON",value:function(t){return h(y(n.prototype),"fromJSON",this).call(this,t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}]),n}(Wo);ss.prototype.isQuadraticBezierCurve3=!0;var us=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return _(this,n),(t=e.call(this)).type="SplineCurve",t.points=r,t}return w(n,[{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Fe,n=e,r=this.points,i=(r.length-1)*t,a=Math.floor(i),o=i-a,s=r[0===a?a:a-1],u=r[a],l=r[a>r.length-2?r.length-1:a+1],h=r[a>r.length-3?r.length-1:a+2];return n.set($o(o,s.x,u.x,l.x,h.x),$o(o,s.y,u.y,l.y,h.y)),n}},{key:"copy",value:function(t){h(y(n.prototype),"copy",this).call(this,t),this.points=[];for(var e=0,r=t.points.length;e<r;e++){var i=t.points[e];this.points.push(i.clone())}return this}},{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);t.points=[];for(var e=0,r=this.points.length;e<r;e++){var i=this.points[e];t.points.push(i.toArray())}return t}},{key:"fromJSON",value:function(t){h(y(n.prototype),"fromJSON",this).call(this,t),this.points=[];for(var e=0,r=t.points.length;e<r;e++){var i=t.points[e];this.points.push((new Fe).fromArray(i))}return this}}]),n}(Wo);us.prototype.isSplineCurve=!0;var ls=Object.freeze({__proto__:null,ArcCurve:qo,CatmullRomCurve3:Ko,CubicBezierCurve:ns,CubicBezierCurve3:rs,EllipseCurve:jo,LineCurve:is,LineCurve3:as,QuadraticBezierCurve:os,QuadraticBezierCurve3:ss,SplineCurve:us}),hs=function(t){d(n,t);var e=p(n);function n(){var t;return _(this,n),(t=e.call(this)).type="CurvePath",t.curves=[],t.autoClose=!1,t}return w(n,[{key:"add",value:function(t){this.curves.push(t)}},{key:"closePath",value:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new is(e,t))}},{key:"getPoint",value:function(t,e){for(var n=t*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=n){var a=r[i]-n,o=this.curves[i],s=o.getLength(),u=0===s?0:1-a/s;return o.getPointAt(u,e)}i++}return null}},{key:"getLength",value:function(){var t=this.getCurveLengths();return t[t.length-1]}},{key:"updateArcLengths",value:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}},{key:"getCurveLengths",value:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,r=this.curves.length;n<r;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}},{key:"getSpacedPoints",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:40,e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}},{key:"getPoints",value:function(){for(var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12,n=[],r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a.isEllipseCurve?2*e:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),u=0;u<s.length;u++){var l=s[u];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}},{key:"copy",value:function(t){h(y(n.prototype),"copy",this).call(this,t),this.curves=[];for(var e=0,r=t.curves.length;e<r;e++){var i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}},{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);t.autoClose=this.autoClose,t.curves=[];for(var e=0,r=this.curves.length;e<r;e++){var i=this.curves[e];t.curves.push(i.toJSON())}return t}},{key:"fromJSON",value:function(t){h(y(n.prototype),"fromJSON",this).call(this,t),this.autoClose=t.autoClose,this.curves=[];for(var e=0,r=t.curves.length;e<r;e++){var i=t.curves[e];this.curves.push((new ls[i.type]).fromJSON(i))}return this}}]),n}(Wo),cs=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="Path",r.currentPoint=new Fe,t&&r.setFromPoints(t),r}return w(n,[{key:"setFromPoints",value:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}},{key:"moveTo",value:function(t,e){return this.currentPoint.set(t,e),this}},{key:"lineTo",value:function(t,e){var n=new is(this.currentPoint.clone(),new Fe(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}},{key:"quadraticCurveTo",value:function(t,e,n,r){var i=new os(this.currentPoint.clone(),new Fe(t,e),new Fe(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}},{key:"bezierCurveTo",value:function(t,e,n,r,i,a){var o=new ns(this.currentPoint.clone(),new Fe(t,e),new Fe(n,r),new Fe(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}},{key:"splineThru",value:function(t){var e=[this.currentPoint.clone()].concat(t),n=new us(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}},{key:"arc",value:function(t,e,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+o,e+s,n,r,i,a),this}},{key:"absarc",value:function(t,e,n,r,i,a){return this.absellipse(t,e,n,n,r,i,a),this}},{key:"ellipse",value:function(t,e,n,r,i,a,o,s){var u=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+u,e+l,n,r,i,a,o,s),this}},{key:"absellipse",value:function(t,e,n,r,i,a,o,s){var u=new jo(t,e,n,r,i,a,o,s);if(this.curves.length>0){var l=u.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(u);var h=u.getPoint(1);return this.currentPoint.copy(h),this}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.currentPoint.copy(t.currentPoint),this}},{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);return t.currentPoint=this.currentPoint.toArray(),t}},{key:"fromJSON",value:function(t){return h(y(n.prototype),"fromJSON",this).call(this,t),this.currentPoint.fromArray(t.currentPoint),this}}]),n}(hs),ds=(new ee,new ee,new ee,new lr,function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this,t)).uuid=qt(),r.type="Shape",r.holes=[],r}return w(n,[{key:"getPointsHoles",value:function(t){for(var e=[],n=0,r=this.holes.length;n<r;n++)e[n]=this.holes[n].getPoints(t);return e}},{key:"extractPoints",value:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}},{key:"copy",value:function(t){h(y(n.prototype),"copy",this).call(this,t),this.holes=[];for(var e=0,r=t.holes.length;e<r;e++){var i=t.holes[e];this.holes.push(i.clone())}return this}},{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);t.uuid=this.uuid,t.holes=[];for(var e=0,r=this.holes.length;e<r;e++){var i=this.holes[e];t.holes.push(i.toJSON())}return t}},{key:"fromJSON",value:function(t){h(y(n.prototype),"fromJSON",this).call(this,t),this.uuid=t.uuid,this.holes=[];for(var e=0,r=t.holes.length;e<r;e++){var i=t.holes[e];this.holes.push((new cs).fromJSON(i))}return this}}]),n}(cs)),fs=function(t,e){var n,r,i,a,o,s,u,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,h=e&&e.length,c=h?e[0]*l:t.length,d=ps(t,0,c,l,!0),f=[];if(!d||d.next===d.prev)return f;if(h&&(d=bs(t,e,d,l)),t.length>80*l){n=i=t[0],r=a=t[1];for(var p=l;p<c;p+=l)(o=t[p])<n&&(n=o),(s=t[p+1])<r&&(r=s),o>i&&(i=o),s>a&&(a=s);u=0!==(u=Math.max(i-n,a-r))?1/u:0}return ms(d,f,l,n,r,u),f};function ps(t,e,n,r,i){var a,o;if(i===function(t,e,n,r){for(var i=0,a=e,o=n-r;a<n;a+=r)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}(t,e,n,r)>0)for(a=e;a<n;a+=r)o=Is(a,t[a],t[a+1],o);else for(a=n-r;a>=e;a-=r)o=Is(a,t[a],t[a+1],o);return o&&Ls(o,o.next)&&(Ns(o),o=o.next),o}function vs(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Ls(r,r.next)&&0!==Rs(r.prev,r,r.next))r=r.next;else{if(Ns(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function ms(t,e,n,r,i,a,o){if(t){!o&&a&&function(t,e,n,r){var i=t;do{null===i.z&&(i.z=Es(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,a,o,s,u,l=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,s=0,e=0;e<l&&(s++,r=r.nextZ);e++);for(u=l;s>0||u>0&&r;)0!==s&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,u--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1)}(i)}(t,r,i,a);for(var s,u,l=t;t.prev!==t.next;)if(s=t.prev,u=t.next,a?gs(t,r,i,a):ys(t))e.push(s.i/n),e.push(t.i/n),e.push(u.i/n),Ns(t),t=u.next,l=u.next;else if((t=u)===l){o?1===o?ms(t=xs(vs(t),e,n),e,n,r,i,a,2):2===o&&_s(t,e,n,r,i,a):ms(vs(t),e,n,r,i,a,1);break}}}function ys(t){var e=t.prev,n=t,r=t.next;if(Rs(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(ks(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Rs(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function gs(t,e,n,r){var i=t.prev,a=t,o=t.next;if(Rs(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,u=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,h=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,c=Es(s,u,e,n,r),d=Es(l,h,e,n,r),f=t.prevZ,p=t.nextZ;f&&f.z>=c&&p&&p.z<=d;){if(f!==t.prev&&f!==t.next&&ks(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Rs(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,p!==t.prev&&p!==t.next&&ks(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Rs(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&ks(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Rs(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;p&&p.z<=d;){if(p!==t.prev&&p!==t.next&&ks(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Rs(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function xs(t,e,n){var r=t;do{var i=r.prev,a=r.next.next;!Ls(i,a)&&Cs(i,r,r.next,a)&&Ds(i,a)&&Ds(a,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(a.i/n),Ns(r),Ns(r.next),r=t=a),r=r.next}while(r!==t);return vs(r)}function _s(t,e,n,r,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&As(o,s)){var u=Os(o,s);return o=vs(o,o.next),u=vs(u,u.next),ms(o,e,n,r,i,a),void ms(u,e,n,r,i,a)}s=s.next}o=o.next}while(o!==t)}function bs(t,e,n,r){var i,a,o,s=[];for(i=0,a=e.length;i<a;i++)(o=ps(t,e[i]*r,i<a-1?e[i+1]*r:t.length,r,!1))===o.next&&(o.steiner=!0),s.push(Ts(o));for(s.sort(ws),i=0;i<s.length;i++)Ms(s[i],n),n=vs(n,n.next);return n}function ws(t,e){return t.x-e.x}function Ms(t,e){if(e=function(t,e){var n,r=e,i=t.x,a=t.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!==e);if(!n)return null;if(i===o)return n;var u,l=n,h=n.x,c=n.y,d=1/0;r=n;do{i>=r.x&&r.x>=h&&i!==r.x&&ks(a<c?i:o,a,h,c,a<c?o:i,a,r.x,r.y)&&(u=Math.abs(a-r.y)/(i-r.x),Ds(r,t)&&(u<d||u===d&&(r.x>n.x||r.x===n.x&&Ss(n,r)))&&(n=r,d=u)),r=r.next}while(r!==l);return n}(t,e),e){var n=Os(e,t);vs(e,e.next),vs(n,n.next)}}function Ss(t,e){return Rs(t.prev,t,e.prev)<0&&Rs(e.next,t,t.next)<0}function Es(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ts(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function ks(t,e,n,r,i,a,o,s){return(i-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(n-o)*(e-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function As(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Cs(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Ds(t,e)&&Ds(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,a=(t.y+e.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!==t);return r}(t,e)&&(Rs(t.prev,t,e.prev)||Rs(t,e.prev,e))||Ls(t,e)&&Rs(t.prev,t,t.next)>0&&Rs(e.prev,e,e.next)>0)}function Rs(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Ls(t,e){return t.x===e.x&&t.y===e.y}function Cs(t,e,n,r){var i=zs(Rs(t,e,n)),a=zs(Rs(t,e,r)),o=zs(Rs(n,r,t)),s=zs(Rs(n,r,e));return i!==a&&o!==s||(!(0!==i||!Ps(t,n,e))||(!(0!==a||!Ps(t,r,e))||(!(0!==o||!Ps(n,t,r))||!(0!==s||!Ps(n,e,r)))))}function Ps(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function zs(t){return t>0?1:t<0?-1:0}function Ds(t,e){return Rs(t.prev,t,t.next)<0?Rs(t,e,t.next)>=0&&Rs(t,t.prev,e)>=0:Rs(t,e,t.prev)<0||Rs(t,t.next,e)<0}function Os(t,e){var n=new Bs(t.i,t.x,t.y),r=new Bs(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Is(t,e,n,r){var i=new Bs(t,e,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 Ns(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Bs(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Us=function(){function t(){_(this,t)}return w(t,null,[{key:"area",value:function(t){for(var e=t.length,n=0,r=e-1,i=0;i<e;r=i++)n+=t[r].x*t[i].y-t[i].x*t[r].y;return.5*n}},{key:"isClockWise",value:function(e){return t.area(e)<0}},{key:"triangulateShape",value:function(t,e){var n=[],r=[],i=[];Fs(t),Hs(n,t);var a=t.length;e.forEach(Fs);for(var o=0;o<e.length;o++)r.push(a),a+=e[o].length,Hs(n,e[o]);for(var s=fs(n,r),u=0;u<s.length;u+=3)i.push(s.slice(u,u+3));return i}}]),t}();function Fs(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Hs(t,e){for(var n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}var Vs=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ds([new Fe(.5,.5),new Fe(-.5,.5),new Fe(-.5,-.5),new Fe(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_(this,n),(t=e.call(this)).type="ExtrudeGeometry",t.parameters={shapes:r,options:i},r=Array.isArray(r)?r:[r];for(var a=m(t),o=[],s=[],u=0,l=r.length;u<l;u++){var h=r[u];c(h)}function c(t){var e=[],n=void 0!==i.curveSegments?i.curveSegments:12,r=void 0!==i.steps?i.steps:1,u=void 0!==i.depth?i.depth:1,l=void 0===i.bevelEnabled||i.bevelEnabled,h=void 0!==i.bevelThickness?i.bevelThickness:.2,c=void 0!==i.bevelSize?i.bevelSize:h-.1,d=void 0!==i.bevelOffset?i.bevelOffset:0,f=void 0!==i.bevelSegments?i.bevelSegments:3,p=i.extrudePath,v=void 0!==i.UVGenerator?i.UVGenerator:Gs;void 0!==i.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),u=i.amount);var m,y,g,x,_,b=!1;p&&(m=p.getSpacedPoints(r),b=!0,l=!1,y=p.computeFrenetFrames(r,!1),g=new ee,x=new ee,_=new ee),l||(f=0,h=0,c=0,d=0);var w=t.extractPoints(n),M=w.shape,S=w.holes;if(!Us.isClockWise(M)){M=M.reverse();for(var E=0,T=S.length;E<T;E++){var k=S[E];Us.isClockWise(k)&&(S[E]=k.reverse())}}for(var A=Us.triangulateShape(M,S),R=M,L=0,C=S.length;L<C;L++){var P=S[L];M=M.concat(P)}function z(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}var D=M.length,O=A.length;function I(t,e,n){var r,i,a,o=t.x-e.x,s=t.y-e.y,u=n.x-t.x,l=n.y-t.y,h=o*o+s*s,c=o*l-s*u;if(Math.abs(c)>Number.EPSILON){var d=Math.sqrt(h),f=Math.sqrt(u*u+l*l),p=e.x-s/d,v=e.y+o/d,m=((n.x-l/f-p)*l-(n.y+u/f-v)*u)/(o*l-s*u),y=(r=p+o*m-t.x)*r+(i=v+s*m-t.y)*i;if(y<=2)return new Fe(r,i);a=Math.sqrt(y/2)}else{var g=!1;o>Number.EPSILON?u>Number.EPSILON&&(g=!0):o<-Number.EPSILON?u<-Number.EPSILON&&(g=!0):Math.sign(s)===Math.sign(l)&&(g=!0),g?(r=-s,i=o,a=Math.sqrt(h)):(r=o,i=s,a=Math.sqrt(h/2))}return new Fe(r/a,i/a)}for(var N=[],B=0,U=R.length,F=U-1,H=B+1;B<U;B++,F++,H++)F===U&&(F=0),H===U&&(H=0),N[B]=I(R[B],R[F],R[H]);for(var V,G=[],W=N.concat(),j=0,q=S.length;j<q;j++){var X=S[j];V=[];for(var Y=0,Z=X.length,J=Z-1,Q=Y+1;Y<Z;Y++,J++,Q++)J===Z&&(J=0),Q===Z&&(Q=0),V[Y]=I(X[Y],X[J],X[Q]);G.push(V),W=W.concat(V)}for(var K=0;K<f;K++){for(var $=K/f,tt=h*Math.cos($*Math.PI/2),et=c*Math.sin($*Math.PI/2)+d,nt=0,rt=R.length;nt<rt;nt++){var it=z(R[nt],N[nt],et);Ct(it.x,it.y,-tt)}for(var at=0,ot=S.length;at<ot;at++){var st=S[at];V=G[at];for(var ut=0,lt=st.length;ut<lt;ut++){var ht=z(st[ut],V[ut],et);Ct(ht.x,ht.y,-tt)}}}for(var ct=c+d,dt=0;dt<D;dt++){var ft=l?z(M[dt],W[dt],ct):M[dt];b?(x.copy(y.normals[0]).multiplyScalar(ft.x),g.copy(y.binormals[0]).multiplyScalar(ft.y),_.copy(m[0]).add(x).add(g),Ct(_.x,_.y,_.z)):Ct(ft.x,ft.y,0)}for(var pt=1;pt<=r;pt++)for(var vt=0;vt<D;vt++){var mt=l?z(M[vt],W[vt],ct):M[vt];b?(x.copy(y.normals[pt]).multiplyScalar(mt.x),g.copy(y.binormals[pt]).multiplyScalar(mt.y),_.copy(m[pt]).add(x).add(g),Ct(_.x,_.y,_.z)):Ct(mt.x,mt.y,u/r*pt)}for(var yt=f-1;yt>=0;yt--){for(var gt=yt/f,xt=h*Math.cos(gt*Math.PI/2),_t=c*Math.sin(gt*Math.PI/2)+d,bt=0,wt=R.length;bt<wt;bt++){var Mt=z(R[bt],N[bt],_t);Ct(Mt.x,Mt.y,u+xt)}for(var St=0,Et=S.length;St<Et;St++){var Tt=S[St];V=G[St];for(var kt=0,At=Tt.length;kt<At;kt++){var Rt=z(Tt[kt],V[kt],_t);b?Ct(Rt.x,Rt.y+m[r-1].y,m[r-1].x+xt):Ct(Rt.x,Rt.y,u+xt)}}}function Lt(t,e){for(var n=t.length;--n>=0;){var i=n,a=n-1;a<0&&(a=t.length-1);for(var o=0,s=r+2*f;o<s;o++){var u=D*o,l=D*(o+1);zt(e+i+u,e+a+u,e+a+l,e+i+l)}}}function Ct(t,n,r){e.push(t),e.push(n),e.push(r)}function Pt(t,e,n){Dt(t),Dt(e),Dt(n);var r=o.length/3,i=v.generateTopUV(a,o,r-3,r-2,r-1);Ot(i[0]),Ot(i[1]),Ot(i[2])}function zt(t,e,n,r){Dt(t),Dt(e),Dt(r),Dt(e),Dt(n),Dt(r);var i=o.length/3,s=v.generateSideWallUV(a,o,i-6,i-3,i-2,i-1);Ot(s[0]),Ot(s[1]),Ot(s[3]),Ot(s[1]),Ot(s[2]),Ot(s[3])}function Dt(t){o.push(e[3*t+0]),o.push(e[3*t+1]),o.push(e[3*t+2])}function Ot(t){s.push(t.x),s.push(t.y)}!function(){var t=o.length/3;if(l){for(var e=0,n=D*e,i=0;i<O;i++){var s=A[i];Pt(s[2]+n,s[1]+n,s[0]+n)}n=D*(e=r+2*f);for(var u=0;u<O;u++){var h=A[u];Pt(h[0]+n,h[1]+n,h[2]+n)}}else{for(var c=0;c<O;c++){var d=A[c];Pt(d[2],d[1],d[0])}for(var p=0;p<O;p++){var v=A[p];Pt(v[0]+D*r,v[1]+D*r,v[2]+D*r)}}a.addGroup(t,o.length/3-t,0)}(),function(){var t=o.length/3,e=0;Lt(R,e),e+=R.length;for(var n=0,r=S.length;n<r;n++){var i=S[n];Lt(i,e),e+=i.length}a.addGroup(t,o.length/3-t,1)}()}return t.setAttribute("position",new un(o,3)),t.setAttribute("uv",new un(s,2)),t.computeVertexNormals(),t}return w(n,[{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(var r=0,i=t.length;r<i;r++){var a=t[r];n.shapes.push(a.uuid)}else n.shapes.push(t.uuid);void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,t)}}],[{key:"fromJSON",value:function(t,e){for(var r=[],i=0,a=t.shapes.length;i<a;i++){var o=e[t.shapes[i]];r.push(o)}var s=t.options.extrudePath;return void 0!==s&&(t.options.extrudePath=(new ls[s.type]).fromJSON(s)),new n(r,t.options)}}]),n}(In),Gs={generateTopUV:function(t,e,n,r,i){var a=e[3*n],o=e[3*n+1],s=e[3*r],u=e[3*r+1],l=e[3*i],h=e[3*i+1];return[new Fe(a,o),new Fe(s,u),new Fe(l,h)]},generateSideWallUV:function(t,e,n,r,i,a){var o=e[3*n],s=e[3*n+1],u=e[3*n+2],l=e[3*r],h=e[3*r+1],c=e[3*r+2],d=e[3*i],f=e[3*i+1],p=e[3*i+2],v=e[3*a],m=e[3*a+1],y=e[3*a+2];return Math.abs(s-h)<Math.abs(o-l)?[new Fe(o,1-u),new Fe(l,1-c),new Fe(d,1-p),new Fe(v,1-y)]:[new Fe(s,1-u),new Fe(h,1-c),new Fe(f,1-p),new Fe(m,1-y)]}};var Ws=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ds([new Fe(0,.5),new Fe(-.5,-.5),new Fe(.5,-.5)]),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;_(this,n),(t=e.call(this)).type="ShapeGeometry",t.parameters={shapes:r,curveSegments:i};var a=[],o=[],s=[],u=[],l=0,h=0;if(!1===Array.isArray(r))d(r);else for(var c=0;c<r.length;c++)d(r[c]),t.addGroup(l,h,c),l+=h,h=0;function d(t){var e=o.length/3,n=t.extractPoints(i),r=n.shape,l=n.holes;!1===Us.isClockWise(r)&&(r=r.reverse());for(var c=0,d=l.length;c<d;c++){var f=l[c];!0===Us.isClockWise(f)&&(l[c]=f.reverse())}for(var p=Us.triangulateShape(r,l),v=0,m=l.length;v<m;v++){var y=l[v];r=r.concat(y)}for(var g=0,x=r.length;g<x;g++){var _=r[g];o.push(_.x,_.y,0),s.push(0,0,1),u.push(_.x,_.y)}for(var b=0,w=p.length;b<w;b++){var M=p[b],S=M[0]+e,E=M[1]+e,T=M[2]+e;a.push(S,E,T),h+=3}}return t.setIndex(a),t.setAttribute("position",new un(o,3)),t.setAttribute("normal",new un(s,3)),t.setAttribute("uv",new un(u,2)),t}return w(n,[{key:"toJSON",value:function(){var t=h(y(n.prototype),"toJSON",this).call(this);return function(t,e){if(e.shapes=[],Array.isArray(t))for(var n=0,r=t.length;n<r;n++){var i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}}],[{key:"fromJSON",value:function(t,e){for(var r=[],i=0,a=t.shapes.length;i<a;i++){var o=e[t.shapes[i]];r.push(o)}return new n(r,t.curveSegments)}}]),n}(In);var js=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;_(this,n),(t=e.call(this)).type="SphereGeometry",t.parameters={radius:r,widthSegments:i,heightSegments:a,phiStart:o,phiLength:s,thetaStart:u,thetaLength:l},i=Math.max(3,Math.floor(i)),a=Math.max(2,Math.floor(a));for(var h=Math.min(u+l,Math.PI),c=0,d=[],f=new ee,p=new ee,v=[],m=[],y=[],g=[],x=0;x<=a;x++){var b=[],w=x/a,M=0;0==x&&0==u?M=.5/i:x==a&&h==Math.PI&&(M=-.5/i);for(var S=0;S<=i;S++){var E=S/i;f.x=-r*Math.cos(o+E*s)*Math.sin(u+w*l),f.y=r*Math.cos(u+w*l),f.z=r*Math.sin(o+E*s)*Math.sin(u+w*l),m.push(f.x,f.y,f.z),p.copy(f).normalize(),y.push(p.x,p.y,p.z),g.push(E+M,1-w),b.push(c++)}d.push(b)}for(var T=0;T<a;T++)for(var k=0;k<i;k++){var A=d[T][k+1],R=d[T][k],L=d[T+1][k],C=d[T+1][k+1];(0!==T||u>0)&&v.push(A,R,C),(T!==a-1||h<Math.PI)&&v.push(R,L,C)}return t.setIndex(v),t.setAttribute("position",new un(m,3)),t.setAttribute("normal",new un(y,3)),t.setAttribute("uv",new un(g,2)),t}return w(n,null,[{key:"fromJSON",value:function(t){return new n(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}]),n}(In);var qs=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="ShadowMaterial",r.color=new en(0),r.transparent=!0,r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.color.copy(t.color),this}}]),n}(Fn);qs.prototype.isShadowMaterial=!0;var Xs=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="SpriteMaterial",r.color=new en(16777215),r.map=null,r.alphaMap=null,r.rotation=0,r.sizeAttenuation=!0,r.transparent=!0,r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}]),n}(Fn);Xs.prototype.isSpriteMaterial=!0;var Ys=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this,t)).type="RawShaderMaterial",r}return w(n)}(Wn);Ys.prototype.isRawShaderMaterial=!0;var Zs=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="PointsMaterial",r.color=new en(16777215),r.map=null,r.alphaMap=null,r.size=1,r.sizeAttenuation=!0,r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this}}]),n}(Fn);Zs.prototype.isPointsMaterial=!0;var Js=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).defines={STANDARD:""},r.type="MeshStandardMaterial",r.color=new en(16777215),r.roughness=1,r.metalness=0,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new en(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=zt,r.normalScale=new Fe(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.roughnessMap=null,r.metalnessMap=null,r.alphaMap=null,r.envMap=null,r.envMapIntensity=1,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}]),n}(Fn);Js.prototype.isMeshStandardMaterial=!0;var Qs=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).defines={STANDARD:"",PHYSICAL:""},r.type="MeshPhysicalMaterial",r.clearcoatMap=null,r.clearcoatRoughness=0,r.clearcoatRoughnessMap=null,r.clearcoatNormalScale=new Fe(1,1),r.clearcoatNormalMap=null,r.ior=1.5,Object.defineProperty(m(r),"reflectivity",{get:function(){return Xt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),r.sheenColor=new en(0),r.sheenColorMap=null,r.sheenRoughness=1,r.sheenRoughnessMap=null,r.transmissionMap=null,r.thickness=0,r.thicknessMap=null,r.attenuationDistance=0,r.attenuationColor=new en(1,1,1),r.specularIntensity=1,r.specularIntensityMap=null,r.specularColor=new en(1,1,1),r.specularColorMap=null,r._sheen=0,r._clearcoat=0,r._transmission=0,r.setValues(t),r}return w(n,[{key:"sheen",get:function(){return this._sheen},set:function(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}},{key:"clearcoat",get:function(){return this._clearcoat},set:function(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}},{key:"transmission",get:function(){return this._transmission},set:function(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}]),n}(Js);Qs.prototype.isMeshPhysicalMaterial=!0;var Ks=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="MeshPhongMaterial",r.color=new en(16777215),r.specular=new en(1118481),r.shininess=30,r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new en(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=zt,r.normalScale=new Fe(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=0,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.flatShading=!1,r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}]),n}(Fn);Ks.prototype.isMeshPhongMaterial=!0;var $s=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).defines={TOON:""},r.type="MeshToonMaterial",r.color=new en(16777215),r.map=null,r.gradientMap=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new en(0),r.emissiveIntensity=1,r.emissiveMap=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=zt,r.normalScale=new Fe(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}]),n}(Fn);$s.prototype.isMeshToonMaterial=!0;var tu=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="MeshNormalMaterial",r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=zt,r.normalScale=new Fe(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.wireframe=!1,r.wireframeLinewidth=1,r.fog=!1,r.flatShading=!1,r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}]),n}(Fn);tu.prototype.isMeshNormalMaterial=!0;var eu=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="MeshLambertMaterial",r.color=new en(16777215),r.map=null,r.lightMap=null,r.lightMapIntensity=1,r.aoMap=null,r.aoMapIntensity=1,r.emissive=new en(0),r.emissiveIntensity=1,r.emissiveMap=null,r.specularMap=null,r.alphaMap=null,r.envMap=null,r.combine=0,r.reflectivity=1,r.refractionRatio=.98,r.wireframe=!1,r.wireframeLinewidth=1,r.wireframeLinecap="round",r.wireframeLinejoin="round",r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}]),n}(Fn);eu.prototype.isMeshLambertMaterial=!0;var nu=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).defines={MATCAP:""},r.type="MeshMatcapMaterial",r.color=new en(16777215),r.matcap=null,r.map=null,r.bumpMap=null,r.bumpScale=1,r.normalMap=null,r.normalMapType=zt,r.normalScale=new Fe(1,1),r.displacementMap=null,r.displacementScale=1,r.displacementBias=0,r.alphaMap=null,r.flatShading=!1,r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this}}]),n}(Fn);nu.prototype.isMeshMatcapMaterial=!0;var ru=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this)).type="LineDashedMaterial",r.scale=1,r.dashSize=3,r.gapSize=1,r.setValues(t),r}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}]),n}(Io);ru.prototype.isLineDashedMaterial=!0;var iu={ShadowMaterial:qs,SpriteMaterial:Xs,RawShaderMaterial:Ys,ShaderMaterial:Wn,PointsMaterial:Zs,MeshPhysicalMaterial:Qs,MeshStandardMaterial:Js,MeshPhongMaterial:Ks,MeshToonMaterial:$s,MeshNormalMaterial:tu,MeshLambertMaterial:eu,MeshDepthMaterial:uo,MeshDistanceMaterial:lo,MeshBasicMaterial:hr,MeshMatcapMaterial:nu,LineDashedMaterial:ru,LineBasicMaterial:Io,Material:Fn};Fn.fromType=function(t){return new iu[t]};var au={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},ou=w((function t(e,n,r){_(this,t);var i=this,a=!1,o=0,s=0,u=void 0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=r,this.itemStart=function(t){s++,!1===a&&void 0!==i.onStart&&i.onStart(t,o,s),a=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,s),o===s&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return u?u(t):t},this.setURLModifier=function(t){return u=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){var e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(var e=0,n=l.length;e<n;e+=2){var r=l[e],i=l[e+1];if(r.global&&(r.lastIndex=0),r.test(t))return i}return null}})),su=new ou,uu=function(){function t(e){_(this,t),this.manager=void 0!==e?e:su,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}return w(t,[{key:"load",value:function(){}},{key:"loadAsync",value:function(t,e){var n=this;return new Promise((function(r,i){n.load(t,r,e,i)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(t){return this.crossOrigin=t,this}},{key:"setWithCredentials",value:function(t){return this.withCredentials=t,this}},{key:"setPath",value:function(t){return this.path=t,this}},{key:"setResourcePath",value:function(t){return this.resourcePath=t,this}},{key:"setRequestHeader",value:function(t){return this.requestHeader=t,this}}]),t}(),lu={},hu=function(t){d(n,t);var e=p(n);function n(t,r){var i;return _(this,n),i=e.call(this,t),r&&(i.customLoader=r.customLoader,i.baseUrl=r.baseUrl),i}return w(n,[{key:"setCustomParam",value:function(t){t&&(this.customLoader=t.customLoader,this.baseUrl=t.baseUrl)}},{key:"load",value:function(t,e,n,r){var i=this;void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var a=this.baseUrl||t,o=au.get(a);if(void 0!==o)return this.manager.itemStart(a),setTimeout((function(){e&&e(o),i.manager.itemEnd(a)}),0),o;if(void 0===lu[a]){if(lu[a]=[],lu[a].push({onLoad:e,onProgress:n,onError:r}),this.customLoader)this.customLoader.preload(this.baseUrl).then((function(){i.customLoader.load(t).then((function(t){au.add(a,t);var e=lu[a];delete lu[a];for(var n=0,r=e.length;n<r;n++){var i=e[n];i.onLoad&&i.onLoad(t)}})).catch((function(t){var e=lu[a];if(void 0===e)throw i.manager.itemError(a),t;delete lu[a];for(var n=0,r=e.length;n<r;n++){var o=e[n];o.onError&&o.onError(t)}i.manager.itemError(a)})).finally((function(){i.manager.itemEnd(a)}))}));else{var s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),u=this.mimeType,l=this.responseType;fetch(s).then((function(e){if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;var n=lu[t],r=e.body.getReader(),i=e.headers.get("Content-Length"),a=i?parseInt(i):0,o=0!==a,s=0,u=new ReadableStream({start:function(t){!function e(){r.read().then((function(r){var i=r.done,u=r.value;if(i)t.close();else{s+=u.byteLength;for(var l=new ProgressEvent("progress",{lengthComputable:o,loaded:s,total:a}),h=0,c=n.length;h<c;h++){var d=n[h];d.onProgress&&d.onProgress(l)}t.enqueue(u),e()}}))}()}});return new Response(u)}throw Error('fetch for "'.concat(e.url,'" responded with ').concat(e.status,": ").concat(e.statusText))})).then((function(t){switch(l){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((function(t){return(new DOMParser).parseFromString(t,u)}));case"json":return t.json();default:if(void 0===u)return t.text();var e=/charset="?([^;"\s]*)"?/i.exec(u),n=e&&e[1]?e[1].toLowerCase():void 0,r=new TextDecoder(n);return t.arrayBuffer().then((function(t){return r.decode(t)}))}})).then((function(e){au.add(t,e);var n=lu[t];delete lu[t];for(var r=0,i=n.length;r<i;r++){var a=n[r];a.onLoad&&a.onLoad(e)}})).catch((function(e){var n=lu[t];if(void 0===n)throw i.manager.itemError(t),e;delete lu[t];for(var r=0,a=n.length;r<a;r++){var o=n[r];o.onError&&o.onError(e)}i.manager.itemError(t)})).finally((function(){i.manager.itemEnd(t)}))}this.manager.itemStart(a)}else lu[a].push({onLoad:e,onProgress:n,onError:r})}},{key:"setResponseType",value:function(t){return this.responseType=t,this}},{key:"setMimeType",value:function(t){return this.mimeType=t,this}}]),n}(uu),cu=function(t){d(n,t);var e=p(n);function n(t){return _(this,n),e.call(this,t)}return w(n,[{key:"load",value:function(t,e,n,r){var i=this,a=new Po,o=new hu(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(t,(function(t){var n=i.parse(t);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:P,a.wrapT=void 0!==n.wrapT?n.wrapT:P,a.magFilter=void 0!==n.magFilter?n.magFilter:N,a.minFilter=void 0!==n.minFilter?n.minFilter:N,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(a.encoding=n.encoding),void 0!==n.flipY&&(a.flipY=n.flipY),void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=U),1===n.mipmapCount&&(a.minFilter=N),void 0!==n.generateMipmaps&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,e&&e(a,n))}),n,r),a}}]),n}(uu),du=function(t){d(n,t);var e=p(n);function n(t){return _(this,n),e.call(this,t)}return w(n,[{key:"load",value:function(t,e,n,r){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=au.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout((function(){e&&e(a),i.manager.itemEnd(t)}),0),a;var o=An("img");function s(){l(),au.add(t,this),e&&e(this),i.manager.itemEnd(t)}function u(e){l(),r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)}function l(){o.removeEventListener("load",s,!1),o.removeEventListener("error",u,!1)}return o.addEventListener("load",s,!1),o.addEventListener("error",u,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(t),o.src=t,o}}]),n}(uu),fu=function(t){d(n,t);var e=p(n);function n(t){return _(this,n),e.call(this,t)}return w(n,[{key:"load",value:function(t,e,n,r){var i=new Wr,a=new du(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(t){i.image=t,i.needsUpdate=!0,void 0!==e&&e(i)}),n,r),i}}]),n}(uu),pu=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),r=e.call(this,t),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),r.options={premultiplyAlpha:"none"},r}return w(n,[{key:"setOptions",value:function(t){return this.options=t,this}},{key:"load",value:function(t,e,n,r){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);var i=this,a=au.get(t);if(void 0!==a)return i.manager.itemStart(t),setTimeout((function(){e&&e(a),i.manager.itemEnd(t)}),0),a;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(t,o).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(i.options,{colorSpaceConversion:"none"}))})).then((function(n){au.add(t,n),e&&e(n),i.manager.itemEnd(t)})).catch((function(e){r&&r(e),i.manager.itemError(t),i.manager.itemEnd(t)})),i.manager.itemStart(t)}}]),n}(uu);pu.prototype.isImageBitmapLoader=!0;var vu=function(){function t(){_(this,t)}return w(t,null,[{key:"decodeText",value:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",n=0,r=t.length;n<r;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}}},{key:"extractUrlBase",value:function(t){var e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}},{key:"resolveURL",value:function(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}]),t}(),mu=function(t){d(n,t);var e=p(n);function n(t){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return _(this,n),(r=e.call(this)).type="Light",r.color=new en(t),r.intensity=i,r}return w(n,[{key:"dispose",value:function(){}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this}},{key:"toJSON",value:function(t){var e=h(y(n.prototype),"toJSON",this).call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}]),n}(Tn);mu.prototype.isLight=!0;var yu=new Pe,gu=new ee,xu=new ee,_u=function(){function t(e){_(this,t),this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Fe(512,512),this.map=null,this.mapPass=null,this.matrix=new Pe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ce,this._frameExtents=new Fe(1,1),this._viewportCount=1,this._viewports=[new He(0,0,1,1)]}return w(t,[{key:"getViewportCount",value:function(){return this._viewportCount}},{key:"getFrustum",value:function(){return this._frustum}},{key:"updateMatrices",value:function(t){var e=this.camera,n=this.matrix;gu.setFromMatrixPosition(t.matrixWorld),e.position.copy(gu),xu.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(xu),e.updateMatrixWorld(),yu.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(yu),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)}},{key:"getViewport",value:function(t){return this._viewports[t]}},{key:"getFrameExtents",value:function(){return this._frameExtents}},{key:"dispose",value:function(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}},{key:"copy",value:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"toJSON",value:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}]),t}(),bu=function(t){d(n,t);var e=p(n);function n(){var t;return _(this,n),(t=e.call(this,new Xr(50,1,.5,500))).focus=1,t}return w(n,[{key:"updateMatrices",value:function(t){var e=this.camera,r=2*jt*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,a=t.distance||e.far;r===e.fov&&i===e.aspect&&a===e.far||(e.fov=r,e.aspect=i,e.far=a,e.updateProjectionMatrix()),h(y(n.prototype),"updateMatrices",this).call(this,t)}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.focus=t.focus,this}}]),n}(_u);bu.prototype.isSpotLightShadow=!0;var wu=function(t){d(n,t);var e=p(n);function n(t,r){var i,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;return _(this,n),(i=e.call(this,t,r)).type="SpotLight",i.position.copy(Tn.DefaultUp),i.updateMatrix(),i.target=new Tn,i.distance=a,i.angle=o,i.penumbra=s,i.decay=u,i.shadow=new bu,i}return w(n,[{key:"power",get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}},{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}]),n}(mu);wu.prototype.isSpotLight=!0;var Mu=function(t){d(n,t);var e=p(n);function n(t,r,i){var a;return _(this,n),(a=e.call(this,t,i)).type="HemisphereLight",a.position.copy(Tn.DefaultUp),a.updateMatrix(),a.groundColor=new en(r),a}return w(n,[{key:"copy",value:function(t){return mu.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}]),n}(mu);Mu.prototype.isHemisphereLight=!0;var Su=function(t){d(n,t);var e=p(n);function n(){return _(this,n),e.call(this,new $r(-5,5,5,-5,.5,500))}return w(n)}(_u);Su.prototype.isDirectionalLightShadow=!0;var Eu=function(t){d(n,t);var e=p(n);function n(t,r){var i;return _(this,n),(i=e.call(this,t,r)).type="DirectionalLight",i.position.copy(Tn.DefaultUp),i.updateMatrix(),i.target=new Tn,i.shadow=new Su,i}return w(n,[{key:"dispose",value:function(){this.shadow.dispose()}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}]),n}(mu);Eu.prototype.isDirectionalLight=!0;var Tu=function(t){d(n,t);var e=p(n);function n(t,r){var i;return _(this,n),(i=e.call(this,t,r)).type="AmbientLight",i}return w(n)}(mu);Tu.prototype.isAmbientLight=!0;var ku=function(){function t(e,n,r,i){_(this,t),this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new n.constructor(r),this.sampleValues=n,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}return w(t,[{key:"evaluate",value:function(t){var e=this.parameterPositions,n=this._cachedIndex,r=e[n],i=e[n-1];t:{e:{var a;n:{r:if(!(t<r)){for(var o=n+2;;){if(void 0===r){if(t<i)break r;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,i)}if(n===o)break;if(i=r,t<(r=e[++n]))break e}a=e.length;break n}if(t>=i)break t;var s=e[1];t<s&&(n=2,i=s);for(var u=n-2;;){if(void 0===i)return this._cachedIndex=0,this.beforeStart_(0,t,r);if(n===u)break;if(r=i,t>=(i=e[--n-1]))break e}a=n,n=0}for(;n<a;){var l=n+a>>>1;t<e[l]?a=l:n=l+1}if(r=e[n],void 0===(i=e[n-1]))return this._cachedIndex=0,this.beforeStart_(0,t,r);if(void 0===r)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,i,t)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,t,r)}},{key:"getSettings_",value:function(){return this.settings||this.DefaultSettings_}},{key:"copySampleValue_",value:function(t){for(var e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r,a=0;a!==r;++a)e[a]=n[i+a];return e}},{key:"interpolate_",value:function(){throw new Error("call to abstract method")}},{key:"intervalChanged_",value:function(){}}]),t}();ku.prototype.beforeStart_=ku.prototype.copySampleValue_,ku.prototype.afterEnd_=ku.prototype.copySampleValue_;var Au=function(t){d(n,t);var e=p(n);function n(t,r,i,a){var o;return _(this,n),(o=e.call(this,t,r,i,a))._weightPrev=-0,o._offsetPrev=-0,o._weightNext=-0,o._offsetNext=-0,o.DefaultSettings_={endingStart:St,endingEnd:St},o}return w(n,[{key:"intervalChanged_",value:function(t,e,n){var r=this.parameterPositions,i=t-2,a=t+1,o=r[i],s=r[a];if(void 0===o)switch(this.getSettings_().endingStart){case Et:i=t,o=2*e-n;break;case Tt:o=e+r[i=r.length-2]-r[i+1];break;default:i=t,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case Et:a=t,s=2*n-e;break;case Tt:a=1,s=n+r[1]-r[0];break;default:a=t-1,s=e}var u=.5*(n-e),l=this.valueSize;this._weightPrev=u/(e-o),this._weightNext=u/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l}},{key:"interpolate_",value:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,u=s-o,l=this._offsetPrev,h=this._offsetNext,c=this._weightPrev,d=this._weightNext,f=(n-e)/(r-e),p=f*f,v=p*f,m=-c*v+2*c*p-c*f,y=(1+c)*v+(-1.5-2*c)*p+(-.5+c)*f+1,g=(-1-d)*v+(1.5+d)*p+.5*f,x=d*v-d*p,_=0;_!==o;++_)i[_]=m*a[l+_]+y*a[u+_]+g*a[s+_]+x*a[h+_];return i}}]),n}(ku),Ru=function(t){d(n,t);var e=p(n);function n(t,r,i,a){return _(this,n),e.call(this,t,r,i,a)}return w(n,[{key:"interpolate_",value:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=t*o,u=s-o,l=(n-e)/(r-e),h=1-l,c=0;c!==o;++c)i[c]=a[u+c]*h+a[s+c]*l;return i}}]),n}(ku),Lu=function(t){d(n,t);var e=p(n);function n(t,r,i,a){return _(this,n),e.call(this,t,r,i,a)}return w(n,[{key:"interpolate_",value:function(t){return this.copySampleValue_(t-1)}}]),n}(ku),Cu={arraySlice:function(t,e,n){return Cu.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){for(var e=t.length,n=new Array(e),r=0;r!==e;++r)n[r]=r;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){for(var r=t.length,i=new t.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*e,u=0;u!==e;++u)i[o++]=t[s+u];return i},flattenJSON:function(t,e,n,r){for(var i=1,a=t[0];void 0!==a&&void 0===a[r];)a=t[i++];if(void 0!==a){var o=a[r];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[r])&&(e.push(a.time),n.push.apply(n,o)),a=t[i++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[r])&&(e.push(a.time),o.toArray(n,n.length)),a=t[i++]}while(void 0!==a);else do{void 0!==(o=a[r])&&(e.push(a.time),n.push(o)),a=t[i++]}while(void 0!==a)}},subclip:function(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30,a=t.clone();a.name=e;for(var o=[],s=0;s<a.tracks.length;++s){for(var u=a.tracks[s],l=u.getValueSize(),h=[],c=[],d=0;d<u.times.length;++d){var f=u.times[d]*i;if(!(f<n||f>=r)){h.push(u.times[d]);for(var p=0;p<l;++p)c.push(u.values[d*l+p])}}0!==h.length&&(u.times=Cu.convertArray(h,u.times.constructor),u.values=Cu.convertArray(c,u.values.constructor),o.push(u))}a.tracks=o;for(var v=1/0,m=0;m<a.tracks.length;++m)v>a.tracks[m].times[0]&&(v=a.tracks[m].times[0]);for(var y=0;y<a.tracks.length;++y)a.tracks[y].shift(-1*v);return a.resetDuration(),a},makeClipAdditive:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;r<=0&&(r=30);for(var i=n.tracks.length,a=e/r,o=function(e){var r=n.tracks[e],i=r.ValueTypeName;if("bool"===i||"string"===i)return"continue";var o=t.tracks.find((function(t){return t.name===r.name&&t.ValueTypeName===i}));if(void 0===o)return"continue";var s=0,u=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=u/3);var l=0,h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=h/3);var c=r.times.length-1,d=void 0;if(a<=r.times[0]){var f=s,p=u-s;d=Cu.arraySlice(r.values,f,p)}else if(a>=r.times[c]){var v=c*u+s,m=v+u-s;d=Cu.arraySlice(r.values,v,m)}else{var y=r.createInterpolant(),g=s,x=u-s;y.evaluate(a),d=Cu.arraySlice(y.resultBuffer,g,x)}"quaternion"===i&&(new te).fromArray(d).normalize().conjugate().toArray(d);for(var _=o.times.length,b=0;b<_;++b){var w=b*h+l;if("quaternion"===i)te.multiplyQuaternionsFlat(o.values,w,d,0,o.values,w);else for(var M=h-2*l,S=0;S<M;++S)o.values[w+S]-=d[S]}},s=0;s<i;++s)o(s);return t.blendMode=At,t}},Pu=function(){function t(e,n,r,i){if(_(this,t),void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===n||0===n.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Cu.convertArray(n,this.TimeBufferType),this.values=Cu.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}return w(t,[{key:"InterpolantFactoryMethodDiscrete",value:function(t){return new Lu(this.times,this.values,this.getValueSize(),t)}},{key:"InterpolantFactoryMethodLinear",value:function(t){return new Ru(this.times,this.values,this.getValueSize(),t)}},{key:"InterpolantFactoryMethodSmooth",value:function(t){return new Au(this.times,this.values,this.getValueSize(),t)}},{key:"setInterpolation",value:function(t){var e;switch(t){case bt:e=this.InterpolantFactoryMethodDiscrete;break;case wt:e=this.InterpolantFactoryMethodLinear;break;case Mt:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=e,this}},{key:"getInterpolation",value:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return bt;case this.InterpolantFactoryMethodLinear:return wt;case this.InterpolantFactoryMethodSmooth:return Mt}}},{key:"getValueSize",value:function(){return this.values.length/this.times.length}},{key:"shift",value:function(t){if(0!==t)for(var e=this.times,n=0,r=e.length;n!==r;++n)e[n]+=t;return this}},{key:"scale",value:function(t){if(1!==t)for(var e=this.times,n=0,r=e.length;n!==r;++n)e[n]*=t;return this}},{key:"trim",value:function(t,e){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<t;)++i;for(;-1!==a&&n[a]>e;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Cu.arraySlice(n,i,a),this.values=Cu.arraySlice(this.values,i*o,a*o)}return this}},{key:"validate",value:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!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),t=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),t=!1;break}a=s}if(void 0!==r&&Cu.isTypedArray(r))for(var u=0,l=r.length;u!==l;++u){var h=r[u];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,u,h),t=!1;break}}return t}},{key:"optimize",value:function(){for(var t=Cu.arraySlice(this.times),e=Cu.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===Mt,i=t.length-1,a=1,o=1;o<i;++o){var s=!1,u=t[o];if(u!==t[o+1]&&(1!==o||u!==t[0]))if(r)s=!0;else for(var l=o*n,h=l-n,c=l+n,d=0;d!==n;++d){var f=e[l+d];if(f!==e[h+d]||f!==e[c+d]){s=!0;break}}if(s){if(o!==a){t[a]=t[o];for(var p=o*n,v=a*n,m=0;m!==n;++m)e[v+m]=e[p+m]}++a}}if(i>0){t[a]=t[i];for(var y=i*n,g=a*n,x=0;x!==n;++x)e[g+x]=e[y+x];++a}return a!==t.length?(this.times=Cu.arraySlice(t,0,a),this.values=Cu.arraySlice(e,0,a*n)):(this.times=t,this.values=e),this}},{key:"clone",value:function(){var t=Cu.arraySlice(this.times,0),e=Cu.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}],[{key:"toJSON",value:function(t){var e,n=t.constructor;if(n.toJSON!==this.toJSON)e=n.toJSON(t);else{e={name:t.name,times:Cu.convertArray(t.times,Array),values:Cu.convertArray(t.values,Array)};var r=t.getInterpolation();r!==t.DefaultInterpolation&&(e.interpolation=r)}return e.type=t.ValueTypeName,e}}]),t}();Pu.prototype.TimeBufferType=Float32Array,Pu.prototype.ValueBufferType=Float32Array,Pu.prototype.DefaultInterpolation=wt;var zu=function(t){d(n,t);var e=p(n);function n(){return _(this,n),e.apply(this,arguments)}return w(n)}(Pu);zu.prototype.ValueTypeName="vector";var Du=function(t){d(n,t);var e=p(n);function n(){return _(this,n),e.apply(this,arguments)}return w(n)}(Pu);Du.prototype.ValueTypeName="string",Du.prototype.ValueBufferType=Array,Du.prototype.DefaultInterpolation=bt,Du.prototype.InterpolantFactoryMethodLinear=void 0,Du.prototype.InterpolantFactoryMethodSmooth=void 0;var Ou=function(t){d(n,t);var e=p(n);function n(t,r,i,a){return _(this,n),e.call(this,t,r,i,a)}return w(n,[{key:"interpolate_",value:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-e)/(r-e),u=t*o,l=u+o;u!==l;u+=4)te.slerpFlat(i,0,a,u-o,a,u,s);return i}}]),n}(ku),Iu=function(t){d(n,t);var e=p(n);function n(){return _(this,n),e.apply(this,arguments)}return w(n,[{key:"InterpolantFactoryMethodLinear",value:function(t){return new Ou(this.times,this.values,this.getValueSize(),t)}}]),n}(Pu);Iu.prototype.ValueTypeName="quaternion",Iu.prototype.DefaultInterpolation=wt,Iu.prototype.InterpolantFactoryMethodSmooth=void 0;var Nu=function(t){d(n,t);var e=p(n);function n(){return _(this,n),e.apply(this,arguments)}return w(n)}(Pu);Nu.prototype.ValueTypeName="number";var Bu=function(t){d(n,t);var e=p(n);function n(){return _(this,n),e.apply(this,arguments)}return w(n)}(Pu);Bu.prototype.ValueTypeName="color";var Uu=function(t){d(n,t);var e=p(n);function n(){return _(this,n),e.apply(this,arguments)}return w(n)}(Pu);Uu.prototype.ValueTypeName="bool",Uu.prototype.ValueBufferType=Array,Uu.prototype.DefaultInterpolation=bt,Uu.prototype.InterpolantFactoryMethodLinear=void 0,Uu.prototype.InterpolantFactoryMethodSmooth=void 0;var Fu=function(){function t(e,n,r){var i,a,o;switch(_(this,t),this.binding=e,this.valueSize=r,n){case"quaternion":i=this._slerp,a=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*r),this._workIndex=5;break;case"string":case"bool":i=this._select,a=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(5*r);break;default:i=this._lerp,a=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=a,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}return w(t,[{key:"accumulate",value:function(t,e){var n=this.buffer,r=this.valueSize,i=t*r+r,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==r;++o)n[i+o]=n[o];a=e}else{var s=e/(a+=e);this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a}},{key:"accumulateAdditive",value:function(t){var e=this.buffer,n=this.valueSize,r=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,r,0,t,n),this.cumulativeWeightAdditive+=t}},{key:"apply",value:function(t){var e=this.valueSize,n=this.buffer,r=t*e+e,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=e*this._origIndex;this._mixBufferRegion(n,r,s,1-i,e)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(var u=e,l=e+e;u!==l;++u)if(n[u]!==n[u+e]){o.setValue(n,r);break}}},{key:"saveOriginalState",value:function(){var t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(var i=n,a=r;i!==a;++i)e[i]=e[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}},{key:"restoreOriginalState",value:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)}},{key:"_setAdditiveIdentityNumeric",value:function(){for(var t=this._addIndex*this.valueSize,e=t+this.valueSize,n=t;n<e;n++)this.buffer[n]=0}},{key:"_setAdditiveIdentityQuaternion",value:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}},{key:"_setAdditiveIdentityOther",value:function(){for(var t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}},{key:"_select",value:function(t,e,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)t[e+a]=t[n+a]}},{key:"_slerp",value:function(t,e,n,r){te.slerpFlat(t,e,t,e,t,n,r)}},{key:"_slerpAdditive",value:function(t,e,n,r,i){var a=this._workIndex*i;te.multiplyQuaternionsFlat(t,a,t,e,t,n),te.slerpFlat(t,e,t,e,t,a,r)}},{key:"_lerp",value:function(t,e,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=e+o;t[s]=t[s]*a+t[n+o]*r}}},{key:"_lerpAdditive",value:function(t,e,n,r,i){for(var a=0;a!==i;++a){var o=e+a;t[o]=t[o]+t[n+a]*r}}}]),t}(),Hu="\\[\\]\\.:\\/",Vu=new RegExp("[\\[\\]\\.:\\/]","g"),Gu="[^\\[\\]\\.:\\/]",Wu="[^"+Hu.replace("\\.","")+"]",ju=/((?:WC+[\/:])*)/.source.replace("WC",Gu),qu=/(WCOD+)?/.source.replace("WCOD",Wu),Xu=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Gu),Yu=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Gu),Zu=new RegExp("^"+ju+qu+Xu+Yu+"$"),Ju=["material","materials","bones"],Qu=function(){function t(e,n,r){_(this,t);var i=r||Ku.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,i)}return w(t,[{key:"getValue",value:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)}},{key:"setValue",value:function(t,e){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)}},{key:"bind",value:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}},{key:"unbind",value:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}]),t}(),Ku=function(){function t(e,n,r){_(this,t),this.path=n,this.parsedPath=r||t.parseTrackName(n),this.node=t.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}return w(t,[{key:"_getValue_unavailable",value:function(){}},{key:"_setValue_unavailable",value:function(){}},{key:"_getValue_direct",value:function(t,e){t[e]=this.targetObject[this.propertyName]}},{key:"_getValue_array",value:function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)t[e++]=n[r]}},{key:"_getValue_arrayElement",value:function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}},{key:"_getValue_toArray",value:function(t,e){this.resolvedProperty.toArray(t,e)}},{key:"_setValue_direct",value:function(t,e){this.targetObject[this.propertyName]=t[e]}},{key:"_setValue_direct_setNeedsUpdate",value:function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}},{key:"_setValue_direct_setMatrixWorldNeedsUpdate",value:function(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_array",value:function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++]}},{key:"_setValue_array_setNeedsUpdate",value:function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.needsUpdate=!0}},{key:"_setValue_array_setMatrixWorldNeedsUpdate",value:function(t,e){for(var n=this.resolvedProperty,r=0,i=n.length;r!==i;++r)n[r]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_arrayElement",value:function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}},{key:"_setValue_arrayElement_setNeedsUpdate",value:function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}},{key:"_setValue_arrayElement_setMatrixWorldNeedsUpdate",value:function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_setValue_fromArray",value:function(t,e){this.resolvedProperty.fromArray(t,e)}},{key:"_setValue_fromArray_setNeedsUpdate",value:function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}},{key:"_setValue_fromArray_setMatrixWorldNeedsUpdate",value:function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}},{key:"_getValue_unbound",value:function(t,e){this.bind(),this.getValue(t,e)}},{key:"_setValue_unbound",value:function(t,e){this.bind(),this.setValue(t,e)}},{key:"bind",value:function(){var e=this.node,n=this.parsedPath,r=n.objectName,i=n.propertyName,a=n.propertyIndex;if(e||(e=t.findNode(this.rootNode,n.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(r){var o=n.objectIndex;switch(r){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 s=0;s<e.length;s++)if(e[s].name===o){o=s;break}break;default:if(void 0===e[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[r]}if(void 0!==o){if(void 0===e[o])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[o]}}var u=e[i];if(void 0!==u){var l=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var h=this.BindingType.Direct;if(void 0!==a){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[a]&&(a=e.morphTargetDictionary[a])}h=this.BindingType.ArrayElement,this.resolvedProperty=u,this.propertyIndex=a}else void 0!==u.fromArray&&void 0!==u.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=u):Array.isArray(u)?(h=this.BindingType.EntireArray,this.resolvedProperty=u):this.propertyName=i;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][l]}else{var c=n.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")}},{key:"unbind",value:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}],[{key:"create",value:function(e,n,r){return e&&e.isAnimationObjectGroup?new t.Composite(e,n,r):new t(e,n,r)}},{key:"sanitizeNodeName",value:function(t){return t.replace(/\s/g,"_").replace(Vu,"")}},{key:"parseTrackName",value:function(t){var e=Zu.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==Ju.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: "+t);return n}},{key:"findNode",value:function(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){var r=function t(n){for(var r=0;r<n.length;r++){var i=n[r];if(i.name===e||i.uuid===e)return i;var a=t(i.children);if(a)return a}return null}(t.children);if(r)return r}return null}}]),t}();Ku.Composite=Qu,Ku.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ku.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ku.prototype.GetterByBindingType=[Ku.prototype._getValue_direct,Ku.prototype._getValue_array,Ku.prototype._getValue_arrayElement,Ku.prototype._getValue_toArray],Ku.prototype.SetterByBindingTypeAndVersioning=[[Ku.prototype._setValue_direct,Ku.prototype._setValue_direct_setNeedsUpdate,Ku.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ku.prototype._setValue_array,Ku.prototype._setValue_array_setNeedsUpdate,Ku.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ku.prototype._setValue_arrayElement,Ku.prototype._setValue_arrayElement_setNeedsUpdate,Ku.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ku.prototype._setValue_fromArray,Ku.prototype._setValue_fromArray_setNeedsUpdate,Ku.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var $u=function(){function t(){_(this,t),this.uuid=qt(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var n=0,r=arguments.length;n!==r;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}return w(t,[{key:"add",value:function(){for(var t=this._objects,e=this._indicesByUUID,n=this._paths,r=this._parsedPaths,i=this._bindings,a=i.length,o=void 0,s=t.length,u=this.nCachedObjects_,l=0,h=arguments.length;l!==h;++l){var c=arguments[l],d=c.uuid,f=e[d];if(void 0===f){f=s++,e[d]=f,t.push(c);for(var p=0,v=a;p!==v;++p)i[p].push(new Ku(c,n[p],r[p]))}else if(f<u){o=t[f];var m=--u,y=t[m];e[y.uuid]=f,t[f]=y,e[d]=m,t[m]=c;for(var g=0,x=a;g!==x;++g){var _=i[g],b=_[m],w=_[f];_[f]=b,void 0===w&&(w=new Ku(c,n[g],r[g])),_[m]=w}}else t[f]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=u}},{key:"remove",value:function(){for(var t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],u=s.uuid,l=e[u];if(void 0!==l&&l>=i){var h=i++,c=t[h];e[c.uuid]=l,t[l]=c,e[u]=h,t[h]=s;for(var d=0,f=r;d!==f;++d){var p=n[d],v=p[h],m=p[l];p[l]=v,p[h]=m}}}this.nCachedObjects_=i}},{key:"uncache",value:function(){for(var t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=t.length,o=0,s=arguments.length;o!==s;++o){var u=arguments[o],l=u.uuid,h=e[l];if(void 0!==h)if(delete e[l],h<i){var c=--i,d=t[c],f=--a,p=t[f];e[d.uuid]=h,t[h]=d,e[p.uuid]=c,t[c]=p,t.pop();for(var v=0,m=r;v!==m;++v){var y=n[v],g=y[c],x=y[f];y[h]=g,y[c]=x,y.pop()}}else{var _=--a,b=t[_];_>0&&(e[b.uuid]=h),t[h]=b,t.pop();for(var w=0,M=r;w!==M;++w){var S=n[w];S[h]=S[_],S.pop()}}}this.nCachedObjects_=i}},{key:"subscribe_",value:function(t,e){var n=this._bindingsIndicesByPath,r=n[t],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,u=s.length,l=this.nCachedObjects_,h=new Array(u);r=i.length,n[t]=r,a.push(t),o.push(e),i.push(h);for(var c=l,d=s.length;c!==d;++c){var f=s[c];h[c]=new Ku(f,t,e)}return h}},{key:"unsubscribe_",value:function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];e[t[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}}]),t}();$u.prototype.isAnimationObjectGroup=!0;var tl=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.blendMode;_(this,t),this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;for(var a=n.tracks,o=a.length,s=new Array(o),u={endingStart:St,endingEnd:St},l=0;l!==o;++l){var h=a[l].createInterpolant(null);s[l]=h,h.settings=u}this._interpolantSettings=u,this._interpolants=s,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}return w(t,[{key:"play",value:function(){return this._mixer._activateAction(this),this}},{key:"stop",value:function(){return this._mixer._deactivateAction(this),this.reset()}},{key:"reset",value:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}},{key:"isRunning",value:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}},{key:"isScheduled",value:function(){return this._mixer._isActiveAction(this)}},{key:"startAt",value:function(t){return this._startTime=t,this}},{key:"setLoop",value:function(t,e){return this.loop=t,this.repetitions=e,this}},{key:"setEffectiveWeight",value:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}},{key:"getEffectiveWeight",value:function(){return this._effectiveWeight}},{key:"fadeIn",value:function(t){return this._scheduleFading(t,0,1)}},{key:"fadeOut",value:function(t){return this._scheduleFading(t,1,0)}},{key:"crossFadeFrom",value:function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){var r=this._clip.duration,i=t._clip.duration,a=i/r,o=r/i;t.warp(1,a,e),this.warp(o,1,e)}return this}},{key:"crossFadeTo",value:function(t,e,n){return t.crossFadeFrom(this,e,n)}},{key:"stopFading",value:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}},{key:"setEffectiveTimeScale",value:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}},{key:"getEffectiveTimeScale",value:function(){return this._effectiveTimeScale}},{key:"setDuration",value:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}},{key:"syncWith",value:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}},{key:"halt",value:function(t){return this.warp(this._effectiveTimeScale,0,t)}},{key:"warp",value:function(t,e,n){var r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,u=o.sampleValues;return s[0]=i,s[1]=i+n,u[0]=t/a,u[1]=e/a,this}},{key:"stopWarping",value:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}},{key:"getMixer",value:function(){return this._mixer}},{key:"getClip",value:function(){return this._clip}},{key:"getRoot",value:function(){return this._localRoot||this._mixer._root}},{key:"_update",value:function(t,e,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(t-i)*n;if(a<0||0===n)return;this._startTime=null,e=n*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0){var u=this._interpolants,l=this._propertyBindings;if(this.blendMode===At)for(var h=0,c=u.length;h!==c;++h)u[h].evaluate(o),l[h].accumulateAdditive(s);else for(var d=0,f=u.length;d!==f;++d)u[d].evaluate(o),l[d].accumulate(r,s)}}else this._updateWeight(t)}},{key:"_updateWeight",value:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e}},{key:"_updateTimeScale",value:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n)e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}return this._effectiveTimeScale=e,e}},{key:"_updateTime",value:function(t){var e=this._clip.duration,n=this.loop,r=this.time+t,i=this._loopCount,a=2202===n;if(0===t)return-1===i?r:a&&1==(1&i)?e-r:r;if(n===_t){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=e||r<0){var o=Math.floor(r/e);r-=e*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var u=t<0;this._setEndings(u,!u,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&1==(1&i))return e-r}return r}},{key:"_setEndings",value:function(t,e,n){var r=this._interpolantSettings;n?(r.endingStart=Et,r.endingEnd=Et):(r.endingStart=t?this.zeroSlopeAtStart?Et:St:Tt,r.endingEnd=e?this.zeroSlopeAtEnd?Et:St:Tt)}},{key:"_scheduleFading",value:function(t,e,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]=e,o[1]=i+t,s[1]=n,this}}]),t}(),el=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:kt;_(this,t),this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=qt(),this.duration<0&&this.resetDuration()}return w(t,[{key:"resetDuration",value:function(){for(var t=0,e=0,n=this.tracks.length;e!==n;++e){var r=this.tracks[e];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}},{key:"trim",value:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}},{key:"validate",value:function(){for(var t=!0,e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}},{key:"optimize",value:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}},{key:"clone",value:function(){for(var t=[],e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}},{key:"toJSON",value:function(){return this.constructor.toJSON(this)}}],[{key:"parse",value:function(t){for(var e=[],n=t.tracks,r=1/(t.fps||1),i=0,a=n.length;i!==a;++i)e.push(nl(n[i]).scale(r));var o=new this(t.name,t.duration,e,t.blendMode);return o.uuid=t.uuid,o}},{key:"toJSON",value:function(t){for(var e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode},i=0,a=n.length;i!==a;++i)e.push(Pu.toJSON(n[i]));return r}},{key:"CreateFromMorphTargetSequence",value:function(t,e,n,r){for(var i=e.length,a=[],o=0;o<i;o++){var s=[],u=[];s.push((o+i-1)%i,o,(o+1)%i),u.push(0,1,0);var l=Cu.getKeyframeOrder(s);s=Cu.sortedArray(s,1,l),u=Cu.sortedArray(u,1,l),r||0!==s[0]||(s.push(i),u.push(u[0])),a.push(new Nu(".morphTargetInfluences["+e[o].name+"]",s,u).scale(1/n))}return new this(t,-1,a)}},{key:"findByName",value:function(t,e){var n=t;if(!Array.isArray(t)){var r=t;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===e)return n[i];return null}},{key:"CreateClipsFromMorphTargetSequences",value:function(t,e,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=t.length;a<o;a++){var s=t[a],u=s.name.match(i);if(u&&u.length>1){var l=u[1],h=r[l];h||(r[l]=h=[]),h.push(s)}}var c=[];for(var d in r)c.push(this.CreateFromMorphTargetSequence(d,r[d],e,n));return c}},{key:"parseAnimation",value:function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(t,e,n,r,i){if(0!==n.length){var a=[],o=[];Cu.flattenJSON(n,a,o,r),0!==a.length&&i.push(new t(e,a,o))}},r=[],i=t.name||"default",a=t.fps||30,o=t.blendMode,s=t.length||-1,u=t.hierarchy||[],l=0;l<u.length;l++){var h=u[l].keys;if(h&&0!==h.length)if(h[0].morphTargets){var c={},d=void 0;for(d=0;d<h.length;d++)if(h[d].morphTargets)for(var f=0;f<h[d].morphTargets.length;f++)c[h[d].morphTargets[f]]=-1;for(var p in c){for(var v=[],m=[],y=0;y!==h[d].morphTargets.length;++y){var g=h[d];v.push(g.time),m.push(g.morphTarget===p?1:0)}r.push(new Nu(".morphTargetInfluence["+p+"]",v,m))}s=c.length*a}else{var x=".bones["+e[l].name+"]";n(zu,x+".position",h,"pos",r),n(Iu,x+".quaternion",h,"rot",r),n(zu,x+".scale",h,"scl",r)}}return 0===r.length?null:new this(i,s,r,o)}}]),t}();function nl(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Nu;case"vector":case"vector2":case"vector3":case"vector4":return zu;case"color":return Bu;case"quaternion":return Iu;case"bool":case"boolean":return Uu;case"string":return Du}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){var n=[],r=[];Cu.flattenJSON(t.keys,n,r,"value"),t.times=n,t.values=r}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}var rl=function(t){d(n,t);var e=p(n);function n(t){var r;return _(this,n),(r=e.call(this))._root=t,r._initMemoryManager(),r._accuIndex=0,r.time=0,r.timeScale=1,r}return w(n,[{key:"_bindAction",value:function(t,e){var n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,a=t._propertyBindings,o=t._interpolants,s=n.uuid,u=this._bindingsByRootAndName,l=u[s];void 0===l&&(l={},u[s]=l);for(var h=0;h!==i;++h){var c=r[h],d=c.name,f=l[d];if(void 0!==f)++f.referenceCount,a[h]=f;else{if(void 0!==(f=a[h])){null===f._cacheIndex&&(++f.referenceCount,this._addInactiveBinding(f,s,d));continue}var p=e&&e._propertyBindings[h].binding.parsedPath;++(f=new Fu(Ku.create(n,d,p),c.ValueTypeName,c.getValueSize())).referenceCount,this._addInactiveBinding(f,s,d),a[h]=f}o[h].resultBuffer=f.buffer}}},{key:"_activateAction",value:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}for(var i=t._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}}},{key:"_deactivateAction",value:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}},{key:"_initMemoryManager",value:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}},{key:"_isActiveAction",value:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions}},{key:"_addInactiveAction",value:function(t,e,n){var r=this._actions,i=this._actionsByClip,a=i[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,i[e]=a;else{var o=a.knownActions;t._byClipCacheIndex=o.length,o.push(t)}t._cacheIndex=r.length,r.push(t),a.actionByRoot[n]=t}},{key:"_removeInactiveAction",value:function(t){var e=this._actions,n=e[e.length-1],r=t._cacheIndex;n._cacheIndex=r,e[r]=n,e.pop(),t._cacheIndex=null;var i=t._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,u=s[s.length-1],l=t._byClipCacheIndex;u._byClipCacheIndex=l,s[l]=u,s.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete a[i],this._removeInactiveBindingsForAction(t)}},{key:"_removeInactiveBindingsForAction",value:function(t){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.referenceCount&&this._removeInactiveBinding(i)}}},{key:"_lendAction",value:function(t){var e=this._actions,n=t._cacheIndex,r=this._nActiveActions++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}},{key:"_takeBackAction",value:function(t){var e=this._actions,n=t._cacheIndex,r=--this._nActiveActions,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}},{key:"_addInactiveBinding",value:function(t,e,n){var r=this._bindingsByRootAndName,i=this._bindings,a=r[e];void 0===a&&(a={},r[e]=a),a[n]=t,t._cacheIndex=i.length,i.push(t)}},{key:"_removeInactiveBinding",value:function(t){var e=this._bindings,n=t.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=e[e.length-1],u=t._cacheIndex;s._cacheIndex=u,e[u]=s,e.pop(),delete o[i],0===Object.keys(o).length&&delete a[r]}},{key:"_lendBinding",value:function(t){var e=this._bindings,n=t._cacheIndex,r=this._nActiveBindings++,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}},{key:"_takeBackBinding",value:function(t){var e=this._bindings,n=t._cacheIndex,r=--this._nActiveBindings,i=e[r];t._cacheIndex=r,e[r]=t,i._cacheIndex=n,e[n]=i}},{key:"_lendControlInterpolant",value:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return void 0===n&&((n=new Ru(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=e,t[e]=n),n}},{key:"_takeBackControlInterpolant",value:function(t){var e=this._controlInterpolants,n=t.__cacheIndex,r=--this._nActiveControlInterpolants,i=e[r];t.__cacheIndex=r,e[r]=t,i.__cacheIndex=n,e[n]=i}},{key:"clipAction",value:function(t,e,n){var r=e||this._root,i=r.uuid,a="string"==typeof t?el.findByName(r,t):t,o=null!==a?a.uuid:t,s=this._actionsByClip[o],u=null;if(void 0===n&&(n=null!==a?a.blendMode:kt),void 0!==s){var l=s.actionByRoot[i];if(void 0!==l&&l.blendMode===n)return l;u=s.knownActions[0],null===a&&(a=u._clip)}if(null===a)return null;var h=new tl(this,a,e,n);return this._bindAction(h,u),this._addInactiveAction(h,o,i),h}},{key:"existingAction",value:function(t,e){var n=e||this._root,r=n.uuid,i="string"==typeof t?el.findByName(n,t):t,a=i?i.uuid:t,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[r]||null}},{key:"stopAllAction",value:function(){for(var t=this._actions,e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}},{key:"update",value:function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),a=this._accuIndex^=1,o=0;o!==n;++o){e[o]._update(r,t,i,a)}for(var s=this._bindings,u=this._nActiveBindings,l=0;l!==u;++l)s[l].apply(a);return this}},{key:"setTime",value:function(t){this.time=0;for(var e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(t)}},{key:"getRoot",value:function(){return this._root}},{key:"uncacheClip",value:function(t){var e=this._actions,n=t.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 u=a[o];this._deactivateAction(u);var l=u._cacheIndex,h=e[e.length-1];u._cacheIndex=null,u._byClipCacheIndex=null,h._cacheIndex=l,e[l]=h,e.pop(),this._removeInactiveBindingsForAction(u)}delete r[n]}}},{key:"uncacheRoot",value:function(t){var e=t.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}var a=this._bindingsByRootAndName[e];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}}},{key:"uncacheAction",value:function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}]),n}(We);rl.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var il=new ee,al=function(){function t(e,n,r){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];_(this,t),this.name="",this.data=e,this.itemSize=n,this.offset=r,this.normalized=!0===i}return w(t,[{key:"count",get:function(){return this.data.count}},{key:"array",get:function(){return this.data.array}},{key:"needsUpdate",set:function(t){this.data.needsUpdate=t}},{key:"applyMatrix4",value:function(t){for(var e=0,n=this.data.count;e<n;e++)il.fromBufferAttribute(this,e),il.applyMatrix4(t),this.setXYZ(e,il.x,il.y,il.z);return this}},{key:"applyNormalMatrix",value:function(t){for(var e=0,n=this.count;e<n;e++)il.fromBufferAttribute(this,e),il.applyNormalMatrix(t),this.setXYZ(e,il.x,il.y,il.z);return this}},{key:"transformDirection",value:function(t){for(var e=0,n=this.count;e<n;e++)il.fromBufferAttribute(this,e),il.transformDirection(t),this.setXYZ(e,il.x,il.y,il.z);return this}},{key:"setX",value:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}},{key:"setY",value:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}},{key:"setZ",value:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}},{key:"setW",value:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}},{key:"getX",value:function(t){return this.data.array[t*this.data.stride+this.offset]}},{key:"getY",value:function(t){return this.data.array[t*this.data.stride+this.offset+1]}},{key:"getZ",value:function(t){return this.data.array[t*this.data.stride+this.offset+2]}},{key:"getW",value:function(t){return this.data.array[t*this.data.stride+this.offset+3]}},{key:"setXY",value:function(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this}},{key:"setXYZ",value:function(t,e,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this}},{key:"setXYZW",value:function(t,e,n,r,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=r,this.data.array[t+3]=i,this}},{key:"clone",value:function(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var n=[],r=0;r<this.count;r++)for(var i=r*this.data.stride+this.offset,a=0;a<this.itemSize;a++)n.push(this.data.array[i+a]);return new an(new this.array.constructor(n),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new t(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}},{key:"toJSON",value:function(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],n=0;n<this.count;n++)for(var r=n*this.data.stride+this.offset,i=0;i<this.itemSize;i++)e.push(this.data.array[r+i]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}]),t}();al.prototype.isInterleavedBufferAttribute=!0;var ol=function(){function t(e,n){_(this,t),this.array=e,this.stride=n,this.count=void 0!==e?e.length/n:0,this.usage=Nt,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=qt()}return w(t,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(t){!0===t&&this.version++}},{key:"setUsage",value:function(t){return this.usage=t,this}},{key:"copy",value:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}},{key:"copyAt",value:function(t,e,n){t*=this.stride,n*=e.stride;for(var r=0,i=this.stride;r<i;r++)this.array[t+r]=e.array[n+r];return this}},{key:"set",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(t,e),this}},{key:"clone",value:function(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=qt()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}},{key:"onUpload",value:function(t){return this.onUploadCallback=t,this}},{key:"toJSON",value:function(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=qt()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}]),t}();ol.prototype.isInterleavedBuffer=!0;var sl=function(){function t(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];_(this,t),this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}return w(t,[{key:"start",value:function(){this.startTime=ul(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}},{key:"stop",value:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}},{key:"getElapsedTime",value:function(){return this.getDelta(),this.elapsedTime}},{key:"getDelta",value:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=ul();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}]),t}();function ul(){return("undefined"==typeof performance?Date:performance).now()}var ll=new Fe,hl=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Fe(1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Fe(-1/0,-1/0);_(this,t),this.min=e,this.max=n}return w(t,[{key:"set",value:function(t,e){return this.min.copy(t),this.max.copy(e),this}},{key:"setFromPoints",value:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}},{key:"setFromCenterAndSize",value:function(t,e){var n=ll.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(t){return this.min.copy(t.min),this.max.copy(t.max),this}},{key:"makeEmpty",value:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y}},{key:"getCenter",value:function(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(t){return this.min.min(t),this.max.max(t),this}},{key:"expandByVector",value:function(t){return this.min.sub(t),this.max.add(t),this}},{key:"expandByScalar",value:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this}},{key:"containsPoint",value:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}},{key:"containsBox",value:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}},{key:"getParameter",value:function(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}},{key:"intersectsBox",value:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}},{key:"clampPoint",value:function(t,e){return e.copy(t).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(t){return ll.copy(t).clamp(this.min,this.max).sub(t).length()}},{key:"intersect",value:function(t){return this.min.max(t.min),this.max.min(t.max),this}},{key:"union",value:function(t){return this.min.min(t.min),this.max.max(t.max),this}},{key:"translate",value:function(t){return this.min.add(t),this.max.add(t),this}},{key:"equals",value:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}]),t}();hl.prototype.isBox2=!0;for(var cl=new ee,dl=new ee,fl=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new ee,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ee;_(this,t),this.start=e,this.end=n}return w(t,[{key:"set",value:function(t,e){return this.start.copy(t),this.end.copy(e),this}},{key:"copy",value:function(t){return this.start.copy(t.start),this.end.copy(t.end),this}},{key:"getCenter",value:function(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(t){return t.subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}},{key:"closestPointToPointParameter",value:function(t,e){cl.subVectors(t,this.start),dl.subVectors(this.end,this.start);var n=dl.dot(dl),r=dl.dot(cl)/n;return e&&(r=Xt(r,0,1)),r}},{key:"closestPointToPoint",value:function(t,e,n){var r=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(r).add(this.start)}},{key:"applyMatrix4",value:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}},{key:"equals",value:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}]),t}(),pl=function(){function t(){_(this,t)}return w(t,null,[{key:"toHalfFloat",value:function(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Xt(t,-65504,65504),ml[0]=t;var e=yl[0],n=e>>23&511;return gl[n]+((8388607&e)>>xl[n])}},{key:"fromHalfFloat",value:function(t){var e=t>>10;return yl[0]=wl[Sl[e]+(1023&t)]+Ml[e],ml[0]}}]),t}(),vl=new ArrayBuffer(4),ml=new Float32Array(vl),yl=new Uint32Array(vl),gl=new Uint32Array(512),xl=new Uint32Array(512),_l=0;_l<256;++_l){var bl=_l-127;bl<-27?(gl[_l]=0,gl[256|_l]=32768,xl[_l]=24,xl[256|_l]=24):bl<-14?(gl[_l]=1024>>-bl-14,gl[256|_l]=1024>>-bl-14|32768,xl[_l]=-bl-1,xl[256|_l]=-bl-1):bl<=15?(gl[_l]=bl+15<<10,gl[256|_l]=bl+15<<10|32768,xl[_l]=13,xl[256|_l]=13):bl<128?(gl[_l]=31744,gl[256|_l]=64512,xl[_l]=24,xl[256|_l]=24):(gl[_l]=31744,gl[256|_l]=64512,xl[_l]=13,xl[256|_l]=13)}for(var wl=new Uint32Array(2048),Ml=new Uint32Array(64),Sl=new Uint32Array(64),El=1;El<1024;++El){for(var Tl=El<<13,kl=0;0==(8388608&Tl);)Tl<<=1,kl-=8388608;Tl&=-8388609,kl+=947912704,wl[El]=Tl|kl}for(var Al=1024;Al<2048;++Al)wl[Al]=939524096+(Al-1024<<13);for(var Rl=1;Rl<31;++Rl)Ml[Rl]=Rl<<23;Ml[31]=1199570944,Ml[32]=2147483648;for(var Ll=33;Ll<63;++Ll)Ml[Ll]=2147483648+(Ll-32<<23);Ml[63]=3347054592;for(var Cl=1;Cl<64;++Cl)32!==Cl&&(Sl[Cl]=1024);var Pl=new ee,zl=new ee,Dl=function(t){d(n,t);var e=p(n);function n(t,r){var i;return _(this,n),(i=e.call(this,t,r)).type="LineSegments",i}return w(n,[{key:"computeLineDistances",value:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[],r=0,i=e.count;r<i;r+=2)Pl.fromBufferAttribute(e,r),zl.fromBufferAttribute(e,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Pl.distanceTo(zl);t.setAttribute("lineDistance",new un(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}]),n}(Vo);Dl.prototype.isLineSegments=!0;var Ol=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4473924,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8947848;_(this,n),a=new en(a),o=new en(o);for(var s=i/2,u=r/i,l=r/2,h=[],c=[],d=0,f=0,p=-l;d<=i;d++,p+=u){h.push(-l,0,p,l,0,p),h.push(p,0,-l,p,0,l);var v=d===s?a:o;v.toArray(c,f),f+=3,v.toArray(c,f),f+=3,v.toArray(c,f),f+=3,v.toArray(c,f),f+=3}var m=new In;m.setAttribute("position",new un(h,3)),m.setAttribute("color",new un(c,3));var y=new Io({vertexColors:!0,toneMapped:!1});return(t=e.call(this,m,y)).type="GridHelper",t}return w(n)}(Dl),Il=new ee,Nl=new Pe,Bl=new Pe,Ul=function(t){d(n,t);var e=p(n);function n(t){var r;_(this,n);for(var i=Fl(t),a=new In,o=[],s=[],u=new en(0,0,1),l=new en(0,1,0),h=0;h<i.length;h++){var c=i[h];c.parent&&c.parent.isBone&&(o.push(0,0,0),o.push(0,0,0),s.push(u.r,u.g,u.b),s.push(l.r,l.g,l.b))}a.setAttribute("position",new un(o,3)),a.setAttribute("color",new un(s,3));var d=new Io({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});return(r=e.call(this,a,d)).type="SkeletonHelper",r.isSkeletonHelper=!0,r.root=t,r.bones=i,r.matrix=t.matrixWorld,r.matrixAutoUpdate=!1,r}return w(n,[{key:"updateMatrixWorld",value:function(t){var e=this.bones,r=this.geometry,i=r.getAttribute("position");Bl.copy(this.root.matrixWorld).invert();for(var a=0,o=0;a<e.length;a++){var s=e[a];s.parent&&s.parent.isBone&&(Nl.multiplyMatrices(Bl,s.matrixWorld),Il.setFromMatrixPosition(Nl),i.setXYZ(o,Il.x,Il.y,Il.z),Nl.multiplyMatrices(Bl,s.parent.matrixWorld),Il.setFromMatrixPosition(Nl),i.setXYZ(o+1,Il.x,Il.y,Il.z),o+=2)}r.getAttribute("position").needsUpdate=!0,h(y(n.prototype),"updateMatrixWorld",this).call(this,t)}}]),n}(Dl);function Fl(t){var e=[];!0===t.isBone&&e.push(t);for(var n=0;n<t.children.length;n++)e.push.apply(e,Fl(t.children[n]));return e}var Hl,Vl=function(t){d(n,t);var e=p(n);function n(t){return _(this,n),e.call(this,t)}return w(n,[{key:"load",value:function(t,e,n,r){var i=new Jr,a=new du(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(t[n],(function(t){i.images[n]=t,6===++o&&(i.needsUpdate=!0,e&&e(i))}),void 0,r)}for(var u=0;u<t.length;++u)s(u);return i}}]),n}(uu),Gl=new Pe,Wl=new Kn,jl=new Me,ql=new ee,Xl=function(t){d(n,t);var e=p(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new In,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Zs;return _(this,n),(t=e.call(this)).type="Points",t.geometry=r,t.material=i,t.updateMorphTargets(),t}return w(n,[{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),this.material=t.material,this.geometry=t.geometry,this}},{key:"raycast",value:function(t,e){var n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),jl.copy(n.boundingSphere),jl.applyMatrix4(r),jl.radius+=i,!1!==t.ray.intersectsSphere(jl)){Gl.copy(r).invert(),Wl.copy(t.ray).applyMatrix4(Gl);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o;if(n.isBufferGeometry){var u=n.index,l=n.attributes.position;if(null!==u)for(var h=Math.max(0,a.start),c=Math.min(u.count,a.start+a.count);h<c;h++){var d=u.getX(h);ql.fromBufferAttribute(l,d),Yl(ql,d,s,r,t,e,this)}else for(var f=Math.max(0,a.start),p=Math.min(l.count,a.start+a.count);f<p;f++)ql.fromBufferAttribute(l,f),Yl(ql,f,s,r,t,e,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}},{key:"updateMorphTargets",value:function(){var t=this.geometry;if(t.isBufferGeometry){var e=t.morphAttributes,n=Object.keys(e);if(n.length>0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=t.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}]),n}(Tn);function Yl(t,e,n,r,i,a,o){var s=Wl.distanceSqToPoint(t);if(s<n){var u=new ee;Wl.closestPointToPoint(t,u),u.applyMatrix4(r);var l=i.ray.origin.distanceTo(u);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:u,index:e,face:null,object:o})}}Xl.prototype.isPoints=!0;var Zl=new ee,Jl=new ee,Ql=new ee,Kl=new Fe,$l=new Fe,th=new Pe,eh=new ee,nh=new ee,rh=new ee,ih=new Fe,ah=new Fe,oh=new Fe,sh=function(t){d(n,t);var e=p(n);function n(t){var r;if(_(this,n),(r=e.call(this)).type="Sprite",void 0===Hl){Hl=new In;var i=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),a=new ol(i,5);Hl.setIndex([0,1,2,0,2,3]),Hl.setAttribute("position",new al(a,3,0,!1)),Hl.setAttribute("uv",new al(a,2,3,!1))}return r.geometry=Hl,r.material=void 0!==t?t:new Xs,r.center=new Fe(.5,.5),r}return w(n,[{key:"raycast",value:function(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Jl.setFromMatrixScale(this.matrixWorld),th.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Ql.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Jl.multiplyScalar(-Ql.z);var n,r,i=this.material.rotation;0!==i&&(r=Math.cos(i),n=Math.sin(i));var a=this.center;uh(eh.set(-.5,-.5,0),Ql,a,Jl,n,r),uh(nh.set(.5,-.5,0),Ql,a,Jl,n,r),uh(rh.set(.5,.5,0),Ql,a,Jl,n,r),ih.set(0,0),ah.set(1,0),oh.set(1,1);var o=t.ray.intersectTriangle(eh,nh,rh,!1,Zl);if(null!==o||(uh(nh.set(-.5,.5,0),Ql,a,Jl,n,r),ah.set(0,1),null!==(o=t.ray.intersectTriangle(eh,rh,nh,!1,Zl)))){var s=t.ray.origin.distanceTo(Zl);s<t.near||s>t.far||e.push({distance:s,point:Zl.clone(),uv:lr.getUV(Zl,eh,nh,rh,ih,ah,oh,new Fe),face:null,object:this})}}},{key:"copy",value:function(t){return h(y(n.prototype),"copy",this).call(this,t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}]),n}(Tn);function uh(t,e,n,r,i,a){Kl.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?($l.x=a*Kl.x-i*Kl.y,$l.y=i*Kl.x+a*Kl.y):$l.copy(Kl),t.copy(e),t.x+=$l.x,t.y+=$l.y,t.applyMatrix4(th)}sh.prototype.isSprite=!0;Wo.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Wo.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},cs.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)};Ol.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Ul.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};uu.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),vu.extractUrlBase(t)},uu.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};hl.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},hl.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},hl.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},hl.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},ie.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},ie.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ie.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},ie.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},ie.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},cn.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")},Me.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Ce.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},fl.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Se.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Se.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},Se.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},Se.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},Se.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},Se.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Pe.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},Pe.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Pe.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new ee).setFromMatrixColumn(this,3)},Pe.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},Pe.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Pe.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Pe.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Pe.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Pe.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},Pe.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Pe.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Pe.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Pe.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Pe.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Pe.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Pe.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Pe.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Pe.prototype.makeFrustum=function(t,e,n,r,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,a)},Pe.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Ae.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},te.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},te.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Kn.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Kn.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},Kn.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},lr.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},lr.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},lr.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},lr.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},lr.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},lr.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),lr.getBarycoord(t,e,n,r,i)},lr.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),lr.getNormal(t,e,n,r)},ds.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},ds.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Vs(this,t)},ds.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Ws(this,t)},Fe.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Fe.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Fe.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ee.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},ee.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},ee.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},ee.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},ee.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},ee.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},ee.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},ee.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},ee.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},He.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},He.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Tn.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Tn.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Tn.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Tn.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Tn.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Tn.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},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.")}}}),Ar.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Ar.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Lo.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Xr.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(mu.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(an.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Bt},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Bt)}}}),an.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Bt:Nt),this},an.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},an.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},In.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},In.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new an(arguments[1],arguments[2])))},In.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},In.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},In.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},In.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},In.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(In.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}}}),ol.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?Bt:Nt),this},ol.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Vs.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Vs.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Vs.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},So.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(Fn.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 en}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(Wn.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Mo.prototype.clearTarget=function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},Mo.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},Mo.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Mo.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Mo.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Mo.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Mo.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Mo.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Mo.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Mo.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Mo.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Mo.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Mo.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Mo.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Mo.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},Mo.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Mo.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Mo.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Mo.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Mo.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Mo.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Mo.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Mo.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Mo.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Mo.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Mo.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Pt:Ct}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(ho.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(jr.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Zr.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},Zr.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},Ur.crossOrigin=void 0,Ur.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new fu;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,n,void 0,r);return e&&(a.mapping=e),a},Ur.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Vl;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,n,void 0,r);return e&&(a.mapping=e),a},Ur.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Ur.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:M}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=M)},5794:(t,e,n)=>{n.d(e,{_:()=>Fn});var r=n(7617);function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;i(this,t),this._x=e,this._y=n,this._z=r,this._w=a}var e,n,o;return e=t,n=[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}},{key:"set",value:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._w)}},{key:"copy",value:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}},{key:"setFromEuler",value:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,r=t._y,i=t._z,a=t._order,o=Math.cos,s=Math.sin,u=o(n/2),l=o(r/2),h=o(i/2),c=s(n/2),d=s(r/2),f=s(i/2);switch(a){case"XYZ":this._x=c*l*h+u*d*f,this._y=u*d*h-c*l*f,this._z=u*l*f+c*d*h,this._w=u*l*h-c*d*f;break;case"YXZ":this._x=c*l*h+u*d*f,this._y=u*d*h-c*l*f,this._z=u*l*f-c*d*h,this._w=u*l*h+c*d*f;break;case"ZXY":this._x=c*l*h-u*d*f,this._y=u*d*h+c*l*f,this._z=u*l*f+c*d*h,this._w=u*l*h-c*d*f;break;case"ZYX":this._x=c*l*h-u*d*f,this._y=u*d*h+c*l*f,this._z=u*l*f-c*d*h,this._w=u*l*h+c*d*f;break;case"YZX":this._x=c*l*h+u*d*f,this._y=u*d*h+c*l*f,this._z=u*l*f-c*d*h,this._w=u*l*h-c*d*f;break;case"XZY":this._x=c*l*h-u*d*f,this._y=u*d*h-c*l*f,this._z=u*l*f+c*d*h,this._w=u*l*h+c*d*f;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this}},{key:"setFromAxisAngle",value:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(t){var e=t.elements,n=e[0],r=e[4],i=e[8],a=e[1],o=e[5],s=e[9],u=e[2],l=e[6],h=e[10],c=n+o+h;if(c>0){var d=.5/Math.sqrt(c+1);this._w=.25/d,this._x=(l-s)*d,this._y=(i-u)*d,this._z=(a-r)*d}else if(n>o&&n>h){var f=2*Math.sqrt(1+n-o-h);this._w=(l-s)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(i+u)/f}else if(o>h){var p=2*Math.sqrt(1+o-n-h);this._w=(i-u)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(s+l)/p}else{var v=2*Math.sqrt(1+h-n-o);this._w=(a-r)/v,this._x=(i+u)/v,this._y=(s+l)/v,this._z=.25*v}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(t,e){var n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}},{key:"angleTo",value:function(t){return 2*Math.acos(Math.abs(r.uZ(this.dot(t),-1,1)))}},{key:"rotateTowards",value:function(t,e){var n=this.angleTo(t);if(0===n)return this;var r=Math.min(1,e/n);return this.slerp(t,r),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}},{key:"multiply",value:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}},{key:"premultiply",value:function(t){return this.multiplyQuaternions(t,this)}},{key:"multiplyQuaternions",value:function(t,e){var n=t._x,r=t._y,i=t._z,a=t._w,o=e._x,s=e._y,u=e._z,l=e._w;return this._x=n*l+a*o+r*u-i*s,this._y=r*l+a*s+i*o-n*u,this._z=i*l+a*u+n*s-r*o,this._w=a*l-n*o-r*s-i*u,this._onChangeCallback(),this}},{key:"slerp",value:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),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 u=1-e;return this._w=u*a+e*this._w,this._x=u*n+e*this._x,this._y=u*r+e*this._y,this._z=u*i+e*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),h=Math.atan2(l,o),c=Math.sin((1-e)*h)/l,d=Math.sin(e*h)/l;return this._w=a*c+this._w*d,this._x=n*c+this._x*d,this._y=r*c+this._y*d,this._z=i*c+this._z*d,this._onChangeCallback(),this}},{key:"slerpQuaternions",value:function(t,e,n){return this.copy(t).slerp(e,n)}},{key:"random",value:function(){var t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),r=2*Math.PI*Math.random(),i=2*Math.PI*Math.random();return this.set(e*Math.cos(r),n*Math.sin(i),n*Math.cos(i),e*Math.sin(r))}},{key:"equals",value:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}},{key:"fromArray",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}},{key:"fromBufferAttribute",value:function(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}},{key:"_onChange",value:function(t){return this._onChangeCallback=t,this}},{key:"_onChangeCallback",value:function(){}}],o=[{key:"slerp",value:function(t,e,n,r){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(t,e,r)}},{key:"slerpFlat",value:function(t,e,n,r,i,a,o){var s=n[r+0],u=n[r+1],l=n[r+2],h=n[r+3],c=i[a+0],d=i[a+1],f=i[a+2],p=i[a+3];if(0===o)return t[e+0]=s,t[e+1]=u,t[e+2]=l,void(t[e+3]=h);if(1===o)return t[e+0]=c,t[e+1]=d,t[e+2]=f,void(t[e+3]=p);if(h!==p||s!==c||u!==d||l!==f){var v=1-o,m=s*c+u*d+l*f+h*p,y=m>=0?1:-1,g=1-m*m;if(g>Number.EPSILON){var x=Math.sqrt(g),_=Math.atan2(x,m*y);v=Math.sin(v*_)/x,o=Math.sin(o*_)/x}var b=o*y;if(s=s*v+c*b,u=u*v+d*b,l=l*v+f*b,h=h*v+p*b,v===1-o){var w=1/Math.sqrt(s*s+u*u+l*l+h*h);s*=w,u*=w,l*=w,h*=w}}t[e]=s,t[e+1]=u,t[e+2]=l,t[e+3]=h}},{key:"multiplyQuaternionsFlat",value:function(t,e,n,r,i,a){var o=n[r],s=n[r+1],u=n[r+2],l=n[r+3],h=i[a],c=i[a+1],d=i[a+2],f=i[a+3];return t[e]=o*f+l*h+s*d-u*c,t[e+1]=s*f+l*c+u*h-o*d,t[e+2]=u*f+l*d+o*c-s*h,t[e+3]=l*f-o*h-s*c-u*d,t}}],n&&a(e.prototype,n),o&&a(e,o),Object.defineProperty(e,"prototype",{writable:!1}),t}();function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function u(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */u=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof f?e:f,a=Object.create(i.prototype),o=new E(r||[]);return a._invoke=function(t,e,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return k()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=c(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,o),a}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var d={};function f(){}function p(){}function v(){}var m={};l(m,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(T([])));g&&g!==e&&n.call(g,i)&&(m=g);var x=v.prototype=f.prototype=Object.create(m);function _(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(i,a,o,u){var l=c(t[i],t,a);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==s(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){r("next",t,o,u)}),(function(t){r("throw",t,o,u)})):e.resolve(d).then((function(t){h.value=t,o(h)}),(function(t){return r("throw",t,o,u)}))}u(l.arg)}var i;this._invoke=function(t,n){function a(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(a,a):a()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=c(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,d;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function M(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(M,this),this.reset(!0)}function T(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return a.next=a}}return{next:k}}function k(){return{value:void 0,done:!0}}return p.prototype=v,l(x,"constructor",v),l(v,"constructor",p),p.displayName=l(v,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,l(t,o,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},_(b.prototype),l(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new b(h(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},_(x),l(x,o,"Generator"),l(x,i,(function(){return this})),l(x,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=T,E.prototype={constructor:E,reset:function(t){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(S),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return o.type="throw",o.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),S(n),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:T(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},t}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}o.prototype.isQuaternion=!0;var c=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;l(this,e),this.x=t,this.y=n,this.z=r}var n,i,a;return n=e,i=[{key:"set",value:function(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}},{key:"setScalar",value:function(t){return this.x=t,this.y=t,this.z=t,this}},{key:"setX",value:function(t){return this.x=t,this}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setZ",value:function(t){return this.z=t,this}},{key:"setComponent",value:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}},{key:"getComponent",value:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z)}},{key:"copy",value:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}},{key:"add",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}},{key:"addScalar",value:function(t){return this.x+=t,this.y+=t,this.z+=t,this}},{key:"addVectors",value:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}},{key:"addScaledVector",value:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}},{key:"sub",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}},{key:"subScalar",value:function(t){return this.x-=t,this.y-=t,this.z-=t,this}},{key:"subVectors",value:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}},{key:"multiply",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}},{key:"multiplyScalar",value:function(t){return this.x*=t,this.y*=t,this.z*=t,this}},{key:"multiplyVectors",value:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}},{key:"applyEuler",value:function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(f.setFromEuler(t))}},{key:"applyAxisAngle",value:function(t,e){return this.applyQuaternion(f.setFromAxisAngle(t,e))}},{key:"applyMatrix3",value:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this}},{key:"applyNormalMatrix",value:function(t){return this.applyMatrix3(t).normalize()}},{key:"applyMatrix4",value:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,a=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*a,this}},{key:"applyQuaternion",value:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,a=t.y,o=t.z,s=t.w,u=s*e+a*r-o*n,l=s*n+o*e-i*r,h=s*r+i*n-a*e,c=-i*e-a*n-o*r;return this.x=u*s+c*-i+l*-o-h*-a,this.y=l*s+c*-a+h*-i-u*-o,this.z=h*s+c*-o+u*-a-l*-i,this}},{key:"project",value:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}},{key:"unproject",value:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}},{key:"transformDirection",value:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()}},{key:"divide",value:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}},{key:"divideScalar",value:function(t){return this.multiplyScalar(1/t)}},{key:"min",value:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}},{key:"max",value:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}},{key:"clamp",value:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}},{key:"clampScalar",value:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}},{key:"clampLength",value:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}},{key:"dot",value:function(t){return this.x*t.x+this.y*t.y+this.z*t.z}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(t){return this.normalize().multiplyScalar(t)}},{key:"lerp",value:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}},{key:"lerpVectors",value:function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}},{key:"cross",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}},{key:"crossVectors",value:function(t,e){var n=t.x,r=t.y,i=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}},{key:"projectOnVector",value:function(t){var e=t.lengthSq();if(0===e)return this.set(0,0,0);var n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}},{key:"projectOnPlane",value:function(t){return d.copy(this).projectOnVector(t),this.sub(d)}},{key:"reflect",value:function(t){return this.sub(d.copy(t).multiplyScalar(2*this.dot(t)))}},{key:"angleTo",value:function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;var n=this.dot(t)/e;return Math.acos(r.uZ(n,-1,1))}},{key:"distanceTo",value:function(t){return Math.sqrt(this.distanceToSquared(t))}},{key:"distanceToSquared",value:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r}},{key:"manhattanDistanceTo",value:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}},{key:"setFromSpherical",value:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}},{key:"setFromSphericalCoords",value:function(t,e,n){var r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this}},{key:"setFromCylindrical",value:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}},{key:"setFromCylindricalCoords",value:function(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}},{key:"setFromMatrixPosition",value:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}},{key:"setFromMatrixScale",value:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this}},{key:"setFromMatrixColumn",value:function(t,e){return this.fromArray(t.elements,4*e)}},{key:"setFromMatrix3Column",value:function(t,e){return this.fromArray(t.elements,3*e)}},{key:"setFromEuler",value:function(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}},{key:"equals",value:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}},{key:"fromArray",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}},{key:"fromBufferAttribute",value:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}},{key:"randomDirection",value:function(){var t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-Math.pow(t,2));return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}},{key:t,value:u().mark((function t(){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.x;case 2:return t.next=4,this.y;case 4:return t.next=6,this.z;case 6:case"end":return t.stop()}}),t,this)}))}],i&&h(n.prototype,i),a&&h(n,a),Object.defineProperty(n,"prototype",{writable:!1}),e}(Symbol.iterator);c.prototype.isVector3=!0;var d=new c,f=new o;function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var m=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new c(1/0,1/0,1/0),n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new c(-1/0,-1/0,-1/0);p(this,t),this.min=e,this.max=n}var e,n,r;return e=t,n=[{key:"set",value:function(t,e){return this.min.copy(t),this.max.copy(e),this}},{key:"setFromArray",value:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,u=t.length;s<u;s+=3){var l=t[s],h=t[s+1],c=t[s+2];l<e&&(e=l),h<n&&(n=h),c<r&&(r=c),l>i&&(i=l),h>a&&(a=h),c>o&&(o=c)}return this.min.set(e,n,r),this.max.set(i,a,o),this}},{key:"setFromBufferAttribute",value:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,u=t.count;s<u;s++){var l=t.getX(s),h=t.getY(s),c=t.getZ(s);l<e&&(e=l),h<n&&(n=h),c<r&&(r=c),l>i&&(i=l),h>a&&(a=h),c>o&&(o=c)}return this.min.set(e,n,r),this.max.set(i,a,o),this}},{key:"setFromPoints",value:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}},{key:"setFromCenterAndSize",value:function(t,e){var n=g.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}},{key:"setFromObject",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(t,e)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(t){return this.min.copy(t.min),this.max.copy(t.max),this}},{key:"makeEmpty",value: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}},{key:"isEmpty",value:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}},{key:"getCenter",value:function(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}},{key:"expandByPoint",value:function(t){return this.min.min(t),this.max.max(t),this}},{key:"expandByVector",value:function(t){return this.min.sub(t),this.max.add(t),this}},{key:"expandByScalar",value:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this}},{key:"expandByObject",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t.updateWorldMatrix(!1,!1);var n=t.geometry;if(void 0!==n)if(e&&null!=n.attributes&&void 0!==n.attributes.position)for(var r=n.attributes.position,i=0,a=r.count;i<a;i++)g.fromBufferAttribute(r,i).applyMatrix4(t.matrixWorld),this.expandByPoint(g);else null===n.boundingBox&&n.computeBoundingBox(),x.copy(n.boundingBox),x.applyMatrix4(t.matrixWorld),this.union(x);for(var o=t.children,s=0,u=o.length;s<u;s++)this.expandByObject(o[s],e);return this}},{key:"containsPoint",value:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}},{key:"containsBox",value:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}},{key:"getParameter",value:function(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}},{key:"intersectsBox",value:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}},{key:"intersectsSphere",value:function(t){return this.clampPoint(t.center,g),g.distanceToSquared(t.center)<=t.radius*t.radius}},{key:"intersectsPlane",value:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}},{key:"intersectsTriangle",value:function(t){if(this.isEmpty())return!1;this.getCenter(T),k.subVectors(this.max,T),_.subVectors(t.a,T),b.subVectors(t.b,T),w.subVectors(t.c,T),M.subVectors(b,_),S.subVectors(w,b),E.subVectors(_,w);var e=[0,-M.z,M.y,0,-S.z,S.y,0,-E.z,E.y,M.z,0,-M.x,S.z,0,-S.x,E.z,0,-E.x,-M.y,M.x,0,-S.y,S.x,0,-E.y,E.x,0];return!!L(e,_,b,w,k)&&!!L(e=[1,0,0,0,1,0,0,0,1],_,b,w,k)&&(A.crossVectors(M,S),L(e=[A.x,A.y,A.z],_,b,w,k))}},{key:"clampPoint",value:function(t,e){return e.copy(t).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(t){return g.copy(t).clamp(this.min,this.max).sub(t).length()}},{key:"getBoundingSphere",value:function(t){return this.getCenter(t.center),t.radius=.5*this.getSize(g).length(),t}},{key:"intersect",value:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(t){return this.min.min(t.min),this.max.max(t.max),this}},{key:"applyMatrix4",value:function(t){return this.isEmpty()||(y[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),y[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),y[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),y[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),y[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),y[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),y[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),y[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(y)),this}},{key:"translate",value:function(t){return this.min.add(t),this.max.add(t),this}},{key:"equals",value:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}],n&&v(e.prototype,n),r&&v(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();m.prototype.isBox3=!0;var y=[new c,new c,new c,new c,new c,new c,new c,new c],g=new c,x=new m,_=new c,b=new c,w=new c,M=new c,S=new c,E=new c,T=new c,k=new c,A=new c,R=new c;function L(t,e,n,r,i){for(var a=0,o=t.length-3;a<=o;a+=3){R.fromArray(t,a);var s=i.x*Math.abs(R.x)+i.y*Math.abs(R.y)+i.z*Math.abs(R.z),u=e.dot(R),l=n.dot(R),h=r.dot(R);if(Math.max(-Math.max(u,l,h),Math.min(u,l,h))>s)return!1}return!0}function C(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function P(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var z=new m,D=new c,O=new c,I=new c,N=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new c,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;C(this,t),this.center=e,this.radius=n}var e,n,r;return e=t,(n=[{key:"set",value:function(t,e){return this.center.copy(t),this.radius=e,this}},{key:"setFromPoints",value:function(t,e){var n=this.center;void 0!==e?n.copy(e):z.setFromPoints(t).getCenter(n);for(var r=0,i=0,a=t.length;i<a;i++)r=Math.max(r,n.distanceToSquared(t[i]));return this.radius=Math.sqrt(r),this}},{key:"copy",value:function(t){return this.center.copy(t.center),this.radius=t.radius,this}},{key:"isEmpty",value:function(){return this.radius<0}},{key:"makeEmpty",value:function(){return this.center.set(0,0,0),this.radius=-1,this}},{key:"containsPoint",value:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}},{key:"distanceToPoint",value:function(t){return t.distanceTo(this.center)-this.radius}},{key:"intersectsSphere",value:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}},{key:"intersectsBox",value:function(t){return t.intersectsSphere(this)}},{key:"intersectsPlane",value:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}},{key:"clampPoint",value:function(t,e){var n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}},{key:"getBoundingBox",value:function(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}},{key:"applyMatrix4",value:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}},{key:"translate",value:function(t){return this.center.add(t),this}},{key:"expandByPoint",value:function(t){I.subVectors(t,this.center);var e=I.lengthSq();if(e>this.radius*this.radius){var n=Math.sqrt(e),r=.5*(n-this.radius);this.center.add(I.multiplyScalar(r/n)),this.radius+=r}return this}},{key:"union",value:function(t){return!0===this.center.equals(t.center)?O.set(0,0,1).multiplyScalar(t.radius):O.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(D.copy(t.center).add(O)),this.expandByPoint(D.copy(t.center).sub(O)),this}},{key:"equals",value:function(t){return t.center.equals(this.center)&&t.radius===this.radius}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])&&P(e.prototype,n),r&&P(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function B(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function U(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var F=new c,H=new c,V=new c,G=new c,W=new c,j=new c,q=new c,X=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new c,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new c(0,0,-1);B(this,t),this.origin=e,this.direction=n}var e,n,r;return e=t,(n=[{key:"set",value:function(t,e){return this.origin.copy(t),this.direction.copy(e),this}},{key:"copy",value:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}},{key:"at",value:function(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}},{key:"lookAt",value:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this}},{key:"recast",value:function(t){return this.origin.copy(this.at(t,F)),this}},{key:"closestPointToPoint",value:function(t,e){e.subVectors(t,this.origin);var n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}},{key:"distanceToPoint",value:function(t){return Math.sqrt(this.distanceSqToPoint(t))}},{key:"distanceSqToPoint",value:function(t){var e=F.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(F.copy(this.direction).multiplyScalar(e).add(this.origin),F.distanceToSquared(t))}},{key:"distanceSqToSegment",value:function(t,e,n,r){H.copy(t).add(e).multiplyScalar(.5),V.copy(e).sub(t).normalize(),G.copy(this.origin).sub(H);var i,a,o,s,u=.5*t.distanceTo(e),l=-this.direction.dot(V),h=G.dot(this.direction),c=-G.dot(V),d=G.lengthSq(),f=Math.abs(1-l*l);if(f>0)if(a=l*h-c,s=u*f,(i=l*c-h)>=0)if(a>=-s)if(a<=s){var p=1/f;o=(i*=p)*(i+l*(a*=p)+2*h)+a*(l*i+a+2*c)+d}else a=u,o=-(i=Math.max(0,-(l*a+h)))*i+a*(a+2*c)+d;else a=-u,o=-(i=Math.max(0,-(l*a+h)))*i+a*(a+2*c)+d;else a<=-s?o=-(i=Math.max(0,-(-l*u+h)))*i+(a=i>0?-u:Math.min(Math.max(-u,-c),u))*(a+2*c)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-u,-c),u))*(a+2*c)+d):o=-(i=Math.max(0,-(l*u+h)))*i+(a=i>0?u:Math.min(Math.max(-u,-c),u))*(a+2*c)+d;else a=l>0?-u:u,o=-(i=Math.max(0,-(l*a+h)))*i+a*(a+2*c)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(V).multiplyScalar(a).add(H),o}},{key:"intersectSphere",value:function(t,e){F.subVectors(t.center,this.origin);var n=F.dot(this.direction),r=F.dot(F)-n*n,i=t.radius*t.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,e)}},{key:"intersectsSphere",value:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}},{key:"distanceToPlane",value:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}},{key:"intersectPlane",value:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}},{key:"intersectsPlane",value:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0}},{key:"intersectBox",value:function(t,e){var n,r,i,a,o,s,u=1/this.direction.x,l=1/this.direction.y,h=1/this.direction.z,c=this.origin;return u>=0?(n=(t.min.x-c.x)*u,r=(t.max.x-c.x)*u):(n=(t.max.x-c.x)*u,r=(t.min.x-c.x)*u),l>=0?(i=(t.min.y-c.y)*l,a=(t.max.y-c.y)*l):(i=(t.max.y-c.y)*l,a=(t.min.y-c.y)*l),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a<r||r!=r)&&(r=a),h>=0?(o=(t.min.z-c.z)*h,s=(t.max.z-c.z)*h):(o=(t.max.z-c.z)*h,s=(t.min.z-c.z)*h),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,e)))}},{key:"intersectsBox",value:function(t){return null!==this.intersectBox(t,F)}},{key:"intersectTriangle",value:function(t,e,n,r,i){W.subVectors(e,t),j.subVectors(n,t),q.crossVectors(W,j);var a,o=this.direction.dot(q);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}G.subVectors(this.origin,t);var s=a*this.direction.dot(j.crossVectors(G,j));if(s<0)return null;var u=a*this.direction.dot(W.cross(G));if(u<0)return null;if(s+u>o)return null;var l=-a*G.dot(q);return l<0?null:this.at(l/o,i)}},{key:"applyMatrix4",value:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}},{key:"equals",value:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}}])&&U(e.prototype,n),r&&U(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Z(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var J=function(){function t(){Y(this,t),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.")}var e,n,r;return e=t,n=[{key:"set",value:function(t,e,n,r,i,a,o,s,u,l,h,c,d,f,p,v){var m=this.elements;return m[0]=t,m[4]=e,m[8]=n,m[12]=r,m[1]=i,m[5]=a,m[9]=o,m[13]=s,m[2]=u,m[6]=l,m[10]=h,m[14]=c,m[3]=d,m[7]=f,m[11]=p,m[15]=v,this}},{key:"identity",value:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}},{key:"clone",value:function(){return(new t).fromArray(this.elements)}},{key:"copy",value:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}},{key:"copyPosition",value:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}},{key:"setFromMatrix3",value:function(t){var e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}},{key:"extractBasis",value:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}},{key:"makeBasis",value:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}},{key:"extractRotation",value:function(t){var e=this.elements,n=t.elements,r=1/Q.setFromMatrixColumn(t,0).length(),i=1/Q.setFromMatrixColumn(t,1).length(),a=1/Q.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}},{key:"makeRotationFromEuler",value:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),u=Math.sin(r),l=Math.cos(i),h=Math.sin(i);if("XYZ"===t.order){var c=a*l,d=a*h,f=o*l,p=o*h;e[0]=s*l,e[4]=-s*h,e[8]=u,e[1]=d+f*u,e[5]=c-p*u,e[9]=-o*s,e[2]=p-c*u,e[6]=f+d*u,e[10]=a*s}else if("YXZ"===t.order){var v=s*l,m=s*h,y=u*l,g=u*h;e[0]=v+g*o,e[4]=y*o-m,e[8]=a*u,e[1]=a*h,e[5]=a*l,e[9]=-o,e[2]=m*o-y,e[6]=g+v*o,e[10]=a*s}else if("ZXY"===t.order){var x=s*l,_=s*h,b=u*l,w=u*h;e[0]=x-w*o,e[4]=-a*h,e[8]=b+_*o,e[1]=_+b*o,e[5]=a*l,e[9]=w-x*o,e[2]=-a*u,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var M=a*l,S=a*h,E=o*l,T=o*h;e[0]=s*l,e[4]=E*u-S,e[8]=M*u+T,e[1]=s*h,e[5]=T*u+M,e[9]=S*u-E,e[2]=-u,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var k=a*s,A=a*u,R=o*s,L=o*u;e[0]=s*l,e[4]=L-k*h,e[8]=R*h+A,e[1]=h,e[5]=a*l,e[9]=-o*l,e[2]=-u*l,e[6]=A*h+R,e[10]=k-L*h}else if("XZY"===t.order){var C=a*s,P=a*u,z=o*s,D=o*u;e[0]=s*l,e[4]=-h,e[8]=u*l,e[1]=C*h+D,e[5]=a*l,e[9]=P*h-z,e[2]=z*h-P,e[6]=o*l,e[10]=D*h+C}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}},{key:"makeRotationFromQuaternion",value:function(t){return this.compose($,t,tt)}},{key:"lookAt",value:function(t,e,n){var r=this.elements;return rt.subVectors(t,e),0===rt.lengthSq()&&(rt.z=1),rt.normalize(),et.crossVectors(n,rt),0===et.lengthSq()&&(1===Math.abs(n.z)?rt.x+=1e-4:rt.z+=1e-4,rt.normalize(),et.crossVectors(n,rt)),et.normalize(),nt.crossVectors(rt,et),r[0]=et.x,r[4]=nt.x,r[8]=rt.x,r[1]=et.y,r[5]=nt.y,r[9]=rt.y,r[2]=et.z,r[6]=nt.z,r[10]=rt.z,this}},{key:"multiply",value:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}},{key:"premultiply",value:function(t){return this.multiplyMatrices(t,this)}},{key:"multiplyMatrices",value:function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[4],s=n[8],u=n[12],l=n[1],h=n[5],c=n[9],d=n[13],f=n[2],p=n[6],v=n[10],m=n[14],y=n[3],g=n[7],x=n[11],_=n[15],b=r[0],w=r[4],M=r[8],S=r[12],E=r[1],T=r[5],k=r[9],A=r[13],R=r[2],L=r[6],C=r[10],P=r[14],z=r[3],D=r[7],O=r[11],I=r[15];return i[0]=a*b+o*E+s*R+u*z,i[4]=a*w+o*T+s*L+u*D,i[8]=a*M+o*k+s*C+u*O,i[12]=a*S+o*A+s*P+u*I,i[1]=l*b+h*E+c*R+d*z,i[5]=l*w+h*T+c*L+d*D,i[9]=l*M+h*k+c*C+d*O,i[13]=l*S+h*A+c*P+d*I,i[2]=f*b+p*E+v*R+m*z,i[6]=f*w+p*T+v*L+m*D,i[10]=f*M+p*k+v*C+m*O,i[14]=f*S+p*A+v*P+m*I,i[3]=y*b+g*E+x*R+_*z,i[7]=y*w+g*T+x*L+_*D,i[11]=y*M+g*k+x*C+_*O,i[15]=y*S+g*A+x*P+_*I,this}},{key:"multiplyScalar",value:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}},{key:"determinant",value:function(){var t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],a=t[1],o=t[5],s=t[9],u=t[13],l=t[2],h=t[6],c=t[10],d=t[14];return t[3]*(+i*s*h-r*u*h-i*o*c+n*u*c+r*o*d-n*s*d)+t[7]*(+e*s*d-e*u*c+i*a*c-r*a*d+r*u*l-i*s*l)+t[11]*(+e*u*h-e*o*d-i*a*h+n*a*d+i*o*l-n*u*l)+t[15]*(-r*o*l-e*s*h+e*o*c+r*a*h-n*a*c+n*s*l)}},{key:"transpose",value:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}},{key:"setPosition",value:function(t,e,n){var r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this}},{key:"invert",value:function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],u=t[7],l=t[8],h=t[9],c=t[10],d=t[11],f=t[12],p=t[13],v=t[14],m=t[15],y=h*v*u-p*c*u+p*s*d-o*v*d-h*s*m+o*c*m,g=f*c*u-l*v*u-f*s*d+a*v*d+l*s*m-a*c*m,x=l*p*u-f*h*u+f*o*d-a*p*d-l*o*m+a*h*m,_=f*h*s-l*p*s-f*o*c+a*p*c+l*o*v-a*h*v,b=e*y+n*g+r*x+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var w=1/b;return t[0]=y*w,t[1]=(p*c*i-h*v*i-p*r*d+n*v*d+h*r*m-n*c*m)*w,t[2]=(o*v*i-p*s*i+p*r*u-n*v*u-o*r*m+n*s*m)*w,t[3]=(h*s*i-o*c*i-h*r*u+n*c*u+o*r*d-n*s*d)*w,t[4]=g*w,t[5]=(l*v*i-f*c*i+f*r*d-e*v*d-l*r*m+e*c*m)*w,t[6]=(f*s*i-a*v*i-f*r*u+e*v*u+a*r*m-e*s*m)*w,t[7]=(a*c*i-l*s*i+l*r*u-e*c*u-a*r*d+e*s*d)*w,t[8]=x*w,t[9]=(f*h*i-l*p*i-f*n*d+e*p*d+l*n*m-e*h*m)*w,t[10]=(a*p*i-f*o*i+f*n*u-e*p*u-a*n*m+e*o*m)*w,t[11]=(l*o*i-a*h*i-l*n*u+e*h*u+a*n*d-e*o*d)*w,t[12]=_*w,t[13]=(l*p*r-f*h*r+f*n*c-e*p*c-l*n*v+e*h*v)*w,t[14]=(f*o*r-a*p*r-f*n*s+e*p*s+a*n*v-e*o*v)*w,t[15]=(a*h*r-l*o*r+l*n*s-e*h*s-a*n*c+e*o*c)*w,this}},{key:"scale",value:function(t){var e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this}},{key:"getMaxScaleOnAxis",value:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))}},{key:"makeTranslation",value:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}},{key:"makeRotationX",value:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}},{key:"makeRotationY",value:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}},{key:"makeRotationZ",value:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}},{key:"makeRotationAxis",value:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,a=t.x,o=t.y,s=t.z,u=i*a,l=i*o;return this.set(u*a+n,u*o-r*s,u*s+r*o,0,u*o+r*s,l*o+n,l*s-r*a,0,u*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}},{key:"makeScale",value:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}},{key:"makeShear",value:function(t,e,n,r,i,a){return this.set(1,n,i,0,t,1,a,0,e,r,1,0,0,0,0,1),this}},{key:"compose",value:function(t,e,n){var r=this.elements,i=e._x,a=e._y,o=e._z,s=e._w,u=i+i,l=a+a,h=o+o,c=i*u,d=i*l,f=i*h,p=a*l,v=a*h,m=o*h,y=s*u,g=s*l,x=s*h,_=n.x,b=n.y,w=n.z;return r[0]=(1-(p+m))*_,r[1]=(d+x)*_,r[2]=(f-g)*_,r[3]=0,r[4]=(d-x)*b,r[5]=(1-(c+m))*b,r[6]=(v+y)*b,r[7]=0,r[8]=(f+g)*w,r[9]=(v-y)*w,r[10]=(1-(c+p))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}},{key:"decompose",value:function(t,e,n){var r=this.elements,i=Q.set(r[0],r[1],r[2]).length(),a=Q.set(r[4],r[5],r[6]).length(),o=Q.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],K.copy(this);var s=1/i,u=1/a,l=1/o;return K.elements[0]*=s,K.elements[1]*=s,K.elements[2]*=s,K.elements[4]*=u,K.elements[5]*=u,K.elements[6]*=u,K.elements[8]*=l,K.elements[9]*=l,K.elements[10]*=l,e.setFromRotationMatrix(K),n.x=i,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(t,e,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/(e-t),u=2*i/(n-r),l=(e+t)/(e-t),h=(n+r)/(n-r),c=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=u,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=c,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}},{key:"makeOrthographic",value:function(t,e,n,r,i,a){var o=this.elements,s=1/(e-t),u=1/(n-r),l=1/(a-i),h=(e+t)*s,c=(n+r)*u,d=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*u,o[9]=0,o[13]=-c,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}},{key:"equals",value:function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<16;n++)this.elements[n]=t[n+e];return this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}],n&&Z(e.prototype,n),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();J.prototype.isMatrix4=!0;var Q=new c,K=new J,$=new c(0,0,0),tt=new c(1,1,1),et=new c,nt=new c,rt=new c;function it(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var at=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,r;return e=t,(n=[{key:"addEventListener",value:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}},{key:"hasEventListener",value:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}},{key:"removeEventListener",value:function(t,e){if(void 0!==this._listeners){var n=this._listeners[t];if(void 0!==n){var r=n.indexOf(e);-1!==r&&n.splice(r,1)}}}},{key:"dispatchEvent",value:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var n=e.slice(0),r=0,i=n.length;r<i;r++)n[r].call(this,t);t.target=null}}}}])&&it(e.prototype,n),r&&it(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ot(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function st(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var ut=new J,lt=new o,ht=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.DefaultOrder;ot(this,t),this._x=e,this._y=n,this._z=r,this._order=i}var e,n,i;return e=t,n=[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}},{key:"set",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=t,this._y=e,this._z=n,this._order=r,this._onChangeCallback(),this}},{key:"clone",value:function(){return new this.constructor(this._x,this._y,this._z,this._order)}},{key:"copy",value:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.elements,a=i[0],o=i[4],s=i[8],u=i[1],l=i[5],h=i[9],c=i[2],d=i[6],f=i[10];switch(e){case"XYZ":this._y=Math.asin((0,r.uZ)(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-(0,r.uZ)(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(s,f),this._z=Math.atan2(u,l)):(this._y=Math.atan2(-c,a),this._z=0);break;case"ZXY":this._x=Math.asin((0,r.uZ)(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-c,f),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(u,a));break;case"ZYX":this._y=Math.asin(-(0,r.uZ)(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(u,a)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin((0,r.uZ)(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,a)):(this._x=0,this._y=Math.atan2(s,f));break;case"XZY":this._z=Math.asin(-(0,r.uZ)(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-h,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(t,e,n){return ut.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ut,e,n)}},{key:"setFromVector3",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(t.x,t.y,t.z,e)}},{key:"reorder",value:function(t){return lt.setFromEuler(this),this.setFromQuaternion(lt,t)}},{key:"equals",value:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}},{key:"fromArray",value:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}},{key:"_onChange",value:function(t){return this._onChangeCallback=t,this}},{key:"_onChangeCallback",value:function(){}}],n&&st(e.prototype,n),i&&st(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ct(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}ht.prototype.isEuler=!0,ht.DefaultOrder="XYZ",ht.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var dt=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.mask=1}var e,n,r;return e=t,(n=[{key:"set",value:function(t){this.mask=(1<<t|0)>>>0}},{key:"enable",value:function(t){this.mask|=1<<t|0}},{key:"enableAll",value:function(){this.mask=-1}},{key:"toggle",value:function(t){this.mask^=1<<t|0}},{key:"disable",value:function(t){this.mask&=~(1<<t|0)}},{key:"disableAll",value:function(){this.mask=0}},{key:"test",value:function(t){return 0!=(this.mask&t.mask)}},{key:"isEnabled",value:function(t){return 0!=(this.mask&(1<<t|0))}}])&&ct(e.prototype,n),r&&ct(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function ft(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var vt=function(){function t(){ft(this,t),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.")}var e,n,r;return e=t,n=[{key:"set",value:function(t,e,n,r,i,a,o,s,u){var l=this.elements;return l[0]=t,l[1]=r,l[2]=o,l[3]=e,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=u,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"copy",value:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}},{key:"extractBasis",value:function(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}},{key:"setFromMatrix4",value:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}},{key:"multiply",value:function(t){return this.multiplyMatrices(this,t)}},{key:"premultiply",value:function(t){return this.multiplyMatrices(t,this)}},{key:"multiplyMatrices",value:function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[3],s=n[6],u=n[1],l=n[4],h=n[7],c=n[2],d=n[5],f=n[8],p=r[0],v=r[3],m=r[6],y=r[1],g=r[4],x=r[7],_=r[2],b=r[5],w=r[8];return i[0]=a*p+o*y+s*_,i[3]=a*v+o*g+s*b,i[6]=a*m+o*x+s*w,i[1]=u*p+l*y+h*_,i[4]=u*v+l*g+h*b,i[7]=u*m+l*x+h*w,i[2]=c*p+d*y+f*_,i[5]=c*v+d*g+f*b,i[8]=c*m+d*x+f*w,this}},{key:"multiplyScalar",value:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}},{key:"determinant",value:function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],u=t[7],l=t[8];return e*a*l-e*o*u-n*i*l+n*o*s+r*i*u-r*a*s}},{key:"invert",value:function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],u=t[7],l=t[8],h=l*a-o*u,c=o*s-l*i,d=u*i-a*s,f=e*h+n*c+r*d;if(0===f)return this.set(0,0,0,0,0,0,0,0,0);var p=1/f;return t[0]=h*p,t[1]=(r*u-l*n)*p,t[2]=(o*n-r*a)*p,t[3]=c*p,t[4]=(l*e-r*s)*p,t[5]=(r*i-o*e)*p,t[6]=d*p,t[7]=(n*s-u*e)*p,t[8]=(a*e-n*i)*p,this}},{key:"transpose",value:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}},{key:"getNormalMatrix",value:function(t){return this.setFromMatrix4(t).invert().transpose()}},{key:"transposeIntoArray",value:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}},{key:"setUvTransform",value:function(t,e,n,r,i,a,o){var s=Math.cos(i),u=Math.sin(i);return this.set(n*s,n*u,-n*(s*a+u*o)+a+t,-r*u,r*s,-r*(-u*a+s*o)+o+e,0,0,1),this}},{key:"scale",value:function(t,e){var n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}},{key:"rotate",value:function(t){var e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],u=r[4],l=r[7];return r[0]=e*i+n*s,r[3]=e*a+n*u,r[6]=e*o+n*l,r[1]=-n*i+e*s,r[4]=-n*a+e*u,r[7]=-n*o+e*l,this}},{key:"translate",value:function(t,e){var n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}},{key:"equals",value:function(t){for(var e=this.elements,n=t.elements,r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0}},{key:"fromArray",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=0;n<9;n++)this.elements[n]=t[n+e];return this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}},{key:"clone",value:function(){return(new this.constructor).fromArray(this.elements)}}],n&&pt(e.prototype,n),r&&pt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function yt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function gt(t,e){return gt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},gt(t,e)}function xt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=wt(t);if(e){var i=wt(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return _t(this,n)}}function _t(t,e){if(e&&("object"===mt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return bt(t)}function bt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function wt(t){return wt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wt(t)}vt.prototype.isMatrix3=!0;var Mt=0,St=new c,Et=new o,Tt=new J,kt=new c,At=new c,Rt=new c,Lt=new o,Ct=new c(1,0,0),Pt=new c(0,1,0),zt=new c(0,0,1),Dt={type:"added"},Ot={type:"removed"},It=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&gt(t,e)}(s,t);var e,n,i,a=xt(s);function s(){var t;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),t=a.call(this),Object.defineProperty(bt(t),"id",{value:Mt++}),t.uuid=r.DO(),t.name="",t.type="Object3D",t.parent=null,t.children=[],t.up=s.DefaultUp.clone();var e=new c,n=new ht,i=new o,u=new c(1,1,1);return n._onChange((function(){i.setFromEuler(n,!1)})),i._onChange((function(){n.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(bt(t),{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:u},modelViewMatrix:{value:new J},normalMatrix:{value:new vt}}),t.matrix=new J,t.matrixWorld=new J,t.matrixAutoUpdate=s.DefaultMatrixAutoUpdate,t.matrixWorldNeedsUpdate=!1,t.layers=new dt,t.visible=!0,t.castShadow=!1,t.receiveShadow=!1,t.frustumCulled=!0,t.renderOrder=0,t.animations=[],t.userData={},t}return e=s,n=[{key:"onBeforeRender",value:function(){}},{key:"onAfterRender",value:function(){}},{key:"applyMatrix4",value:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}},{key:"applyQuaternion",value:function(t){return this.quaternion.premultiply(t),this}},{key:"setRotationFromAxisAngle",value:function(t,e){this.quaternion.setFromAxisAngle(t,e)}},{key:"setRotationFromEuler",value:function(t){this.quaternion.setFromEuler(t,!0)}},{key:"setRotationFromMatrix",value:function(t){this.quaternion.setFromRotationMatrix(t)}},{key:"setRotationFromQuaternion",value:function(t){this.quaternion.copy(t)}},{key:"rotateOnAxis",value:function(t,e){return Et.setFromAxisAngle(t,e),this.quaternion.multiply(Et),this}},{key:"rotateOnWorldAxis",value:function(t,e){return Et.setFromAxisAngle(t,e),this.quaternion.premultiply(Et),this}},{key:"rotateX",value:function(t){return this.rotateOnAxis(Ct,t)}},{key:"rotateY",value:function(t){return this.rotateOnAxis(Pt,t)}},{key:"rotateZ",value:function(t){return this.rotateOnAxis(zt,t)}},{key:"translateOnAxis",value:function(t,e){return St.copy(t).applyQuaternion(this.quaternion),this.position.add(St.multiplyScalar(e)),this}},{key:"translateX",value:function(t){return this.translateOnAxis(Ct,t)}},{key:"translateY",value:function(t){return this.translateOnAxis(Pt,t)}},{key:"translateZ",value:function(t){return this.translateOnAxis(zt,t)}},{key:"localToWorld",value:function(t){return t.applyMatrix4(this.matrixWorld)}},{key:"worldToLocal",value:function(t){return t.applyMatrix4(Tt.copy(this.matrixWorld).invert())}},{key:"lookAt",value:function(t,e,n){t.isVector3?kt.copy(t):kt.set(t,e,n);var r=this.parent;this.updateWorldMatrix(!0,!1),At.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Tt.lookAt(At,kt,this.up):Tt.lookAt(kt,At,this.up),this.quaternion.setFromRotationMatrix(Tt),r&&(Tt.extractRotation(r.matrixWorld),Et.setFromRotationMatrix(Tt),this.quaternion.premultiply(Et.invert()))}},{key:"add",value:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Dt)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}},{key:"remove",value:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}var n=this.children.indexOf(t);return-1!==n&&(t.parent=null,this.children.splice(n,1),t.dispatchEvent(Ot)),this}},{key:"removeFromParent",value:function(){var t=this.parent;return null!==t&&t.remove(this),this}},{key:"clear",value:function(){for(var t=0;t<this.children.length;t++){var e=this.children[t];e.parent=null,e.dispatchEvent(Ot)}return this.children.length=0,this}},{key:"attach",value:function(t){return this.updateWorldMatrix(!0,!1),Tt.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Tt.multiply(t.parent.matrixWorld)),t.applyMatrix4(Tt),this.add(t),t.updateWorldMatrix(!1,!0),this}},{key:"getObjectById",value:function(t){return this.getObjectByProperty("id",t)}},{key:"getObjectByName",value:function(t){return this.getObjectByProperty("name",t)}},{key:"getObjectByProperty",value:function(t,e){if(this[t]===e)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}},{key:"getWorldPosition",value:function(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}},{key:"getWorldQuaternion",value:function(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(At,t,Rt),t}},{key:"getWorldScale",value:function(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(At,Lt,t),t}},{key:"getWorldDirection",value:function(t){this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}},{key:"raycast",value:function(){}},{key:"traverse",value:function(t){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverse(t)}},{key:"traverseVisible",value:function(t){if(!1!==this.visible){t(this);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].traverseVisible(t)}}},{key:"traverseAncestors",value:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}},{key:"updateMatrix",value:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}},{key:"updateMatrixWorld",value:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,n=0,r=e.length;n<r;n++)e[n].updateMatrixWorld(t)}},{key:"updateWorldMatrix",value:function(t,e){var n=this.parent;if(!0===t&&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===e)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)}},{key:"toJSON",value:function(t){var e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};function i(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),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.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(t.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,u=o.length;s<u;s++){var l=o[s];i(t.shapes,l)}else i(t.shapes,o)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(i(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var h=[],c=0,d=this.material.length;c<d;c++)h.push(i(t.materials,this.material[c]));r.material=h}else r.material=i(t.materials,this.material);if(this.children.length>0){r.children=[];for(var f=0;f<this.children.length;f++)r.children.push(this.children[f].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(var p=0;p<this.animations.length;p++){var v=this.animations[p];r.animations.push(i(t.animations,v))}}if(e){var m=S(t.geometries),y=S(t.materials),g=S(t.textures),x=S(t.images),_=S(t.shapes),b=S(t.skeletons),w=S(t.animations),M=S(t.nodes);m.length>0&&(n.geometries=m),y.length>0&&(n.materials=y),g.length>0&&(n.textures=g),x.length>0&&(n.images=x),_.length>0&&(n.shapes=_),b.length>0&&(n.skeletons=b),w.length>0&&(n.animations=w),M.length>0&&(n.nodes=M)}return n.object=r,n;function S(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}}},{key:"clone",value:function(t){return(new this.constructor).copy(this,t)}},{key:"copy",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n<t.children.length;n++){var r=t.children[n];this.add(r.clone())}return this}}],n&&yt(e.prototype,n),i&&yt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),s}(at);It.DefaultUp=new c(0,1,0),It.DefaultMatrixAutoUpdate=!0,It.prototype.isObject3D=!0;var Nt="srgb",Bt="srgb-linear",Ut=7680;function Ft(t){return Ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ft(t)}function Ht(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Vt(t,e){return Vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Vt(t,e)}function Gt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=qt(t);if(e){var i=qt(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Wt(this,n)}}function Wt(t,e){if(e&&("object"===Ft(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return jt(t)}function jt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function qt(t){return qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qt(t)}var Xt,Yt=0,Zt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Vt(t,e)}(o,t);var e,n,i,a=Gt(o);function o(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),t=a.call(this),Object.defineProperty(jt(t),"id",{value:Yt++}),t.uuid=r.DO(),t.name="",t.type="Material",t.fog=!0,t.blending=1,t.side=0,t.vertexColors=!1,t.opacity=1,t.transparent=!1,t.blendSrc=204,t.blendDst=205,t.blendEquation=100,t.blendSrcAlpha=null,t.blendDstAlpha=null,t.blendEquationAlpha=null,t.depthFunc=3,t.depthTest=!0,t.depthWrite=!0,t.stencilWriteMask=255,t.stencilFunc=519,t.stencilRef=0,t.stencilFuncMask=255,t.stencilFail=Ut,t.stencilZFail=Ut,t.stencilZPass=Ut,t.stencilWrite=!1,t.clippingPlanes=null,t.clipIntersection=!1,t.clipShadows=!1,t.shadowSide=null,t.colorWrite=!0,t.precision=null,t.polygonOffset=!1,t.polygonOffsetFactor=0,t.polygonOffsetUnits=0,t.dithering=!1,t.alphaToCoverage=!1,t.premultipliedAlpha=!1,t.visible=!0,t.toneMapped=!0,t.userData={},t.version=0,t._alphaTest=0,t}return e=o,(n=[{key:"alphaTest",get:function(){return this._alphaTest},set:function(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}},{key:"onBuild",value:function(){}},{key:"onBeforeRender",value:function(){}},{key:"onBeforeCompile",value:function(){}},{key:"customProgramCacheKey",value:function(){return this.onBeforeCompile.toString()}},{key:"setValues",value:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n)if("shading"!==e){var r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' 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: '"+e+"' parameter is undefined.")}}},{key:"toJSON",value:function(t){var e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}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),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!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.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){var i=r(t.textures),a=r(t.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}},{key:"needsUpdate",set:function(t){!0===t&&this.version++}}])&&Ht(e.prototype,n),i&&Ht(e,i),Object.defineProperty(e,"prototype",{writable:!1}),o}(at);function Jt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Qt(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Kt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}Zt.prototype.isMaterial=!0,Zt.fromType=function(){return null};var $t=(Jt(Xt={},Nt,Jt({},Bt,Qt)),Jt(Xt,Bt,Jt({},Nt,Kt)),Xt),te={legacyMode:!0,get workingColorSpace(){return Bt},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(this.legacyMode||e===n||!e||!n)return t;if($t[e]&&void 0!==$t[e][n]){var r=$t[e][n];return t.r=r(t.r),t.g=r(t.g),t.b=r(t.b),t}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}};function ee(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var ne={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},re={r:0,g:0,b:0},ie={h:0,s:0,l:0},ae={h:0,s:0,l:0};function oe(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function se(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}var ue=function(){function t(e,n,r){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),void 0===n&&void 0===r?this.set(e):this.setRGB(e,n,r)}var e,n,i;return e=t,n=[{key:"set",value:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}},{key:"setScalar",value:function(t){return this.r=t,this.g=t,this.b=t,this}},{key:"setHex",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nt;return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,te.toWorkingColorSpace(this,e),this}},{key:"setRGB",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Bt;return this.r=t,this.g=e,this.b=n,te.toWorkingColorSpace(this,r),this}},{key:"setHSL",value:function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Bt;if(t=(0,r.kz)(t,1),e=(0,r.uZ)(e,0,1),n=(0,r.uZ)(n,0,1),0===e)this.r=this.g=this.b=n;else{var a=n<=.5?n*(1+e):n+e-n*e,o=2*n-a;this.r=oe(o,a,t+1/3),this.g=oe(o,a,t),this.b=oe(o,a,t-1/3)}return te.toWorkingColorSpace(this,i),this}},{key:"setStyle",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nt;function r(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}if(e=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){var i,a=e[1],o=e[2];switch(a){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,te.toWorkingColorSpace(this,n),r(i[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,te.toWorkingColorSpace(this,n),r(i[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){var s=parseFloat(i[1])/360,u=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return r(i[4]),this.setHSL(s,u,l,n)}}}else if(e=/^\#([A-Fa-f\d]+)$/.exec(t)){var h=e[1],c=h.length;if(3===c)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,te.toWorkingColorSpace(this,n),this;if(6===c)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,te.toWorkingColorSpace(this,n),this}return t&&t.length>0?this.setColorName(t,n):this}},{key:"setColorName",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Nt,n=ne[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}},{key:"clone",value:function(){return new this.constructor(this.r,this.g,this.b)}},{key:"copy",value:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}},{key:"copySRGBToLinear",value:function(t){return this.r=Qt(t.r),this.g=Qt(t.g),this.b=Qt(t.b),this}},{key:"copyLinearToSRGB",value:function(t){return this.r=Kt(t.r),this.g=Kt(t.g),this.b=Kt(t.b),this}},{key:"convertSRGBToLinear",value:function(){return this.copySRGBToLinear(this),this}},{key:"convertLinearToSRGB",value:function(){return this.copyLinearToSRGB(this),this}},{key:"getHex",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Nt;return te.fromWorkingColorSpace(se(this,re),t),(0,r.uZ)(255*re.r,0,255)<<16^(0,r.uZ)(255*re.g,0,255)<<8^(0,r.uZ)(255*re.b,0,255)<<0}},{key:"getHexString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Nt;return("000000"+this.getHex(t).toString(16)).slice(-6)}},{key:"getHSL",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Bt;te.fromWorkingColorSpace(se(this,re),e);var n,r,i=re.r,a=re.g,o=re.b,s=Math.max(i,a,o),u=Math.min(i,a,o),l=(u+s)/2;if(u===s)n=0,r=0;else{var h=s-u;switch(r=l<=.5?h/(s+u):h/(2-s-u),s){case i:n=(a-o)/h+(a<o?6:0);break;case a:n=(o-i)/h+2;break;case o:n=(i-a)/h+4}n/=6}return t.h=n,t.s=r,t.l=l,t}},{key:"getRGB",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Bt;return te.fromWorkingColorSpace(se(this,re),e),t.r=re.r,t.g=re.g,t.b=re.b,t}},{key:"getStyle",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Nt;return te.fromWorkingColorSpace(se(this,re),t),t!==Nt?"color(".concat(t," ").concat(re.r," ").concat(re.g," ").concat(re.b,")"):"rgb(".concat(255*re.r|0,",").concat(255*re.g|0,",").concat(255*re.b|0,")")}},{key:"offsetHSL",value:function(t,e,n){return this.getHSL(ie),ie.h+=t,ie.s+=e,ie.l+=n,this.setHSL(ie.h,ie.s,ie.l),this}},{key:"add",value:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}},{key:"addColors",value:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}},{key:"addScalar",value:function(t){return this.r+=t,this.g+=t,this.b+=t,this}},{key:"sub",value:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}},{key:"multiply",value:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}},{key:"multiplyScalar",value:function(t){return this.r*=t,this.g*=t,this.b*=t,this}},{key:"lerp",value:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}},{key:"lerpColors",value:function(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}},{key:"lerpHSL",value:function(t,e){this.getHSL(ie),t.getHSL(ae);var n=(0,r.t7)(ie.h,ae.h,e),i=(0,r.t7)(ie.s,ae.s,e),a=(0,r.t7)(ie.l,ae.l,e);return this.setHSL(n,i,a),this}},{key:"equals",value:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}},{key:"fromArray",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}},{key:"fromBufferAttribute",value:function(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}},{key:"toJSON",value:function(){return this.getHex()}}],n&&ee(e.prototype,n),i&&ee(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();function le(t){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(t)}function he(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ce(){return ce="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=de(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},ce.apply(this,arguments)}function de(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=me(t)););return t}function fe(t,e){return fe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},fe(t,e)}function pe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=me(t);if(e){var i=me(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ve(this,n)}}function ve(t,e){if(e&&("object"===le(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function me(t){return me=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},me(t)}ue.NAMES=ne,ue.prototype.isColor=!0,ue.prototype.r=1,ue.prototype.g=1,ue.prototype.b=1;var ye=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&fe(t,e)}(a,t);var e,n,r,i=pe(a);function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(e=i.call(this)).type="LineBasicMaterial",e.color=new ue(16777215),e.linewidth=1,e.linecap="round",e.linejoin="round",e.setValues(t),e}return e=a,(n=[{key:"copy",value:function(t){return ce(me(a.prototype),"copy",this).call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this}}])&&he(e.prototype,n),r&&he(e,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(Zt);function ge(t){return ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ge(t)}function xe(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */xe=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var i=e&&e.prototype instanceof c?e:c,a=Object.create(i.prototype),o=new M(r||[]);return a._invoke=function(t,e,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return E()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=_(o,n);if(s){if(s===h)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,o),a}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function c(){}function d(){}function f(){}var p={};s(p,i,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(S([])));m&&m!==e&&n.call(m,i)&&(p=m);var y=f.prototype=c.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(i,a,o,s){var u=l(t[i],t,a);if("throw"!==u.type){var h=u.arg,c=h.value;return c&&"object"==ge(c)&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){r("next",t,o,s)}),(function(t){r("throw",t,o,s)})):e.resolve(c).then((function(t){h.value=t,o(h)}),(function(t){return r("throw",t,o,s)}))}s(u.arg)}var i;this._invoke=function(t,n){function a(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(a,a):a()}}function _(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,h;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function S(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return a.next=a}}return{next:E}}function E(){return{value:void 0,done:!0}}return d.prototype=f,s(y,"constructor",f),s(f,"constructor",d),d.displayName=s(f,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,s(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},g(x.prototype),s(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new x(u(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},g(y),s(y,o,"Generator"),s(y,i,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=S,M.prototype={constructor:M,reset:function(t){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(w),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return o.type="throw",o.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),w(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;w(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function _e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function be(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}ye.prototype.isLineBasicMaterial=!0;var we=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;_e(this,e),this.x=t,this.y=n}var n,r,i;return n=e,r=[{key:"width",get:function(){return this.x},set:function(t){this.x=t}},{key:"height",get:function(){return this.y},set:function(t){this.y=t}},{key:"set",value:function(t,e){return this.x=t,this.y=e,this}},{key:"setScalar",value:function(t){return this.x=t,this.y=t,this}},{key:"setX",value:function(t){return this.x=t,this}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setComponent",value:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}},{key:"getComponent",value:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y)}},{key:"copy",value:function(t){return this.x=t.x,this.y=t.y,this}},{key:"add",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}},{key:"addScalar",value:function(t){return this.x+=t,this.y+=t,this}},{key:"addVectors",value:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}},{key:"addScaledVector",value:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}},{key:"sub",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}},{key:"subScalar",value:function(t){return this.x-=t,this.y-=t,this}},{key:"subVectors",value:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}},{key:"multiply",value:function(t){return this.x*=t.x,this.y*=t.y,this}},{key:"multiplyScalar",value:function(t){return this.x*=t,this.y*=t,this}},{key:"divide",value:function(t){return this.x/=t.x,this.y/=t.y,this}},{key:"divideScalar",value:function(t){return this.multiplyScalar(1/t)}},{key:"applyMatrix3",value:function(t){var e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this}},{key:"min",value:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}},{key:"max",value:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}},{key:"clamp",value:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}},{key:"clampScalar",value:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}},{key:"clampLength",value:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}},{key:"floor",value:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}},{key:"ceil",value:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}},{key:"round",value:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"dot",value:function(t){return this.x*t.x+this.y*t.y}},{key:"cross",value:function(t){return this.x*t.y-this.y*t.x}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"angle",value:function(){var t=Math.atan2(-this.y,-this.x)+Math.PI;return t}},{key:"distanceTo",value:function(t){return Math.sqrt(this.distanceToSquared(t))}},{key:"distanceToSquared",value:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n}},{key:"manhattanDistanceTo",value:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}},{key:"setLength",value:function(t){return this.normalize().multiplyScalar(t)}},{key:"lerp",value:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}},{key:"lerpVectors",value:function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}},{key:"equals",value:function(t){return t.x===this.x&&t.y===this.y}},{key:"fromArray",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[e],this.y=t[e+1],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.x,t[e+1]=this.y,t}},{key:"fromBufferAttribute",value:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}},{key:"rotateAround",value:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*n-a*r+t.x,this.y=i*r+a*n+t.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{key:t,value:xe().mark((function t(){return xe().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.x;case 2:return t.next=4,this.y;case 4:case"end":return t.stop()}}),t,this)}))}],r&&be(n.prototype,r),i&&be(n,i),Object.defineProperty(n,"prototype",{writable:!1}),e}(Symbol.iterator);function Me(t){return Me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Me(t)}function Se(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Se=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var i=e&&e.prototype instanceof c?e:c,a=Object.create(i.prototype),o=new M(r||[]);return a._invoke=function(t,e,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return E()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=_(o,n);if(s){if(s===h)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=l(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,o),a}function l(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function c(){}function d(){}function f(){}var p={};s(p,i,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(S([])));m&&m!==e&&n.call(m,i)&&(p=m);var y=f.prototype=c.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(i,a,o,s){var u=l(t[i],t,a);if("throw"!==u.type){var h=u.arg,c=h.value;return c&&"object"==Me(c)&&n.call(c,"__await")?e.resolve(c.__await).then((function(t){r("next",t,o,s)}),(function(t){r("throw",t,o,s)})):e.resolve(c).then((function(t){h.value=t,o(h)}),(function(t){return r("throw",t,o,s)}))}s(u.arg)}var i;this._invoke=function(t,n){function a(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(a,a):a()}}function _(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var r=l(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,h;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function b(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function w(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function M(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(b,this),this.reset(!0)}function S(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,a=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return a.next=a}}return{next:E}}function E(){return{value:void 0,done:!0}}return d.prototype=f,s(y,"constructor",f),s(f,"constructor",d),d.displayName=s(f,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,s(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},g(x.prototype),s(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var o=new x(u(e,n,r,i),a);return t.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},g(y),s(y,o,"Generator"),s(y,i,(function(){return this})),s(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=S,M.prototype={constructor:M,reset:function(t){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(w),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return o.type="throw",o.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),w(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;w(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function Ee(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Te(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}we.prototype.isVector2=!0;var ke=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;Ee(this,e),this.x=t,this.y=n,this.z=r,this.w=i}var n,r,i;return n=e,r=[{key:"width",get:function(){return this.z},set:function(t){this.z=t}},{key:"height",get:function(){return this.w},set:function(t){this.w=t}},{key:"set",value:function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this}},{key:"setScalar",value:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}},{key:"setX",value:function(t){return this.x=t,this}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setZ",value:function(t){return this.z=t,this}},{key:"setW",value:function(t){return this.w=t,this}},{key:"setComponent",value:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}},{key:"getComponent",value:function(t){switch(t){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: "+t)}}},{key:"clone",value:function(){return new this.constructor(this.x,this.y,this.z,this.w)}},{key:"copy",value:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}},{key:"add",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}},{key:"addScalar",value:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}},{key:"addVectors",value:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}},{key:"addScaledVector",value:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}},{key:"sub",value:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}},{key:"subScalar",value:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}},{key:"subVectors",value:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}},{key:"multiply",value:function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}},{key:"multiplyScalar",value:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}},{key:"applyMatrix4",value:function(t){var e=this.x,n=this.y,r=this.z,i=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*i,this}},{key:"divideScalar",value:function(t){return this.multiplyScalar(1/t)}},{key:"setAxisAngleFromQuaternion",value:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}},{key:"setAxisAngleFromRotationMatrix",value:function(t){var e,n,r,i,a=.01,o=.1,s=t.elements,u=s[0],l=s[4],h=s[8],c=s[1],d=s[5],f=s[9],p=s[2],v=s[6],m=s[10];if(Math.abs(l-c)<a&&Math.abs(h-p)<a&&Math.abs(f-v)<a){if(Math.abs(l+c)<o&&Math.abs(h+p)<o&&Math.abs(f+v)<o&&Math.abs(u+d+m-3)<o)return this.set(1,0,0,0),this;e=Math.PI;var y=(u+1)/2,g=(d+1)/2,x=(m+1)/2,_=(l+c)/4,b=(h+p)/4,w=(f+v)/4;return y>g&&y>x?y<a?(n=0,r=.707106781,i=.707106781):(r=_/(n=Math.sqrt(y)),i=b/n):g>x?g<a?(n=.707106781,r=0,i=.707106781):(n=_/(r=Math.sqrt(g)),i=w/r):x<a?(n=.707106781,r=.707106781,i=0):(n=b/(i=Math.sqrt(x)),r=w/i),this.set(n,r,i,e),this}var M=Math.sqrt((v-f)*(v-f)+(h-p)*(h-p)+(c-l)*(c-l));return Math.abs(M)<.001&&(M=1),this.x=(v-f)/M,this.y=(h-p)/M,this.z=(c-l)/M,this.w=Math.acos((u+d+m-1)/2),this}},{key:"min",value:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}},{key:"max",value:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}},{key:"clamp",value:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}},{key:"clampScalar",value:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}},{key:"clampLength",value:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}},{key:"floor",value: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}},{key:"ceil",value: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}},{key:"round",value: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}},{key:"roundToZero",value: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}},{key:"negate",value:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}},{key:"dot",value:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}},{key:"lengthSq",value:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}},{key:"length",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}},{key:"manhattanLength",value:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}},{key:"normalize",value:function(){return this.divideScalar(this.length()||1)}},{key:"setLength",value:function(t){return this.normalize().multiplyScalar(t)}},{key:"lerp",value:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}},{key:"lerpVectors",value:function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}},{key:"equals",value:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}},{key:"fromArray",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}},{key:"toArray",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}},{key:"fromBufferAttribute",value:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}},{key:t,value:Se().mark((function t(){return Se().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.x;case 2:return t.next=4,this.y;case 4:return t.next=6,this.z;case 6:return t.next=8,this.w;case 8:case"end":return t.stop()}}),t,this)}))}],r&&Te(n.prototype,r),i&&Te(n,i),Object.defineProperty(n,"prototype",{writable:!1}),e}(Symbol.iterator);function Ae(t){return Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae(t)}function Re(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Le(t,e)}function Le(t,e){return Le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Le(t,e)}function Ce(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ze(t);if(e){var i=ze(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Pe(this,n)}}function Pe(t,e){if(e&&("object"===Ae(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function ze(t){return ze=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ze(t)}function De(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Oe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Ie(t,e,n){return e&&Oe(t.prototype,e),n&&Oe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}ke.prototype.isVector4=!0;var Ne=new c,Be=new we,Ue=function(){function t(e,n,r){if(De(this,t),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=n,this.count=void 0!==e?e.length/n:0,this.normalized=!0===r,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}return Ie(t,[{key:"onUploadCallback",value:function(){}},{key:"needsUpdate",set:function(t){!0===t&&this.version++}},{key:"setUsage",value:function(t){return this.usage=t,this}},{key:"copy",value:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}},{key:"copyAt",value:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[t+r]=e.array[n+r];return this}},{key:"copyArray",value:function(t){return this.array.set(t),this}},{key:"copyColorsArray",value:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new ue),e[n++]=a.r,e[n++]=a.g,e[n++]=a.b}return this}},{key:"copyVector2sArray",value:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new we),e[n++]=a.x,e[n++]=a.y}return this}},{key:"copyVector3sArray",value:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new c),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z}return this}},{key:"copyVector4sArray",value:function(t){for(var e=this.array,n=0,r=0,i=t.length;r<i;r++){var a=t[r];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new ke),e[n++]=a.x,e[n++]=a.y,e[n++]=a.z,e[n++]=a.w}return this}},{key:"applyMatrix3",value:function(t){if(2===this.itemSize)for(var e=0,n=this.count;e<n;e++)Be.fromBufferAttribute(this,e),Be.applyMatrix3(t),this.setXY(e,Be.x,Be.y);else if(3===this.itemSize)for(var r=0,i=this.count;r<i;r++)Ne.fromBufferAttribute(this,r),Ne.applyMatrix3(t),this.setXYZ(r,Ne.x,Ne.y,Ne.z);return this}},{key:"applyMatrix4",value:function(t){for(var e=0,n=this.count;e<n;e++)Ne.fromBufferAttribute(this,e),Ne.applyMatrix4(t),this.setXYZ(e,Ne.x,Ne.y,Ne.z);return this}},{key:"applyNormalMatrix",value:function(t){for(var e=0,n=this.count;e<n;e++)Ne.fromBufferAttribute(this,e),Ne.applyNormalMatrix(t),this.setXYZ(e,Ne.x,Ne.y,Ne.z);return this}},{key:"transformDirection",value:function(t){for(var e=0,n=this.count;e<n;e++)Ne.fromBufferAttribute(this,e),Ne.transformDirection(t),this.setXYZ(e,Ne.x,Ne.y,Ne.z);return this}},{key:"set",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(t,e),this}},{key:"getX",value:function(t){return this.array[t*this.itemSize]}},{key:"setX",value:function(t,e){return this.array[t*this.itemSize]=e,this}},{key:"getY",value:function(t){return this.array[t*this.itemSize+1]}},{key:"setY",value:function(t,e){return this.array[t*this.itemSize+1]=e,this}},{key:"getZ",value:function(t){return this.array[t*this.itemSize+2]}},{key:"setZ",value:function(t,e){return this.array[t*this.itemSize+2]=e,this}},{key:"getW",value:function(t){return this.array[t*this.itemSize+3]}},{key:"setW",value:function(t,e){return this.array[t*this.itemSize+3]=e,this}},{key:"setXY",value:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this}},{key:"setXYZ",value:function(t,e,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this}},{key:"setXYZW",value:function(t,e,n,r,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=r,this.array[t+3]=i,this}},{key:"onUpload",value:function(t){return this.onUploadCallback=t,this}},{key:"clone",value:function(){return new this.constructor(this.array,this.itemSize).copy(this)}},{key:"toJSON",value:function(){var t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}]),t}();Ue.prototype.isBufferAttribute=!0;var Fe=function(t){Re(n,t);var e=Ce(n);function n(t,r,i){return De(this,n),e.call(this,new Uint16Array(t),r,i)}return Ie(n)}(Ue),He=function(t){Re(n,t);var e=Ce(n);function n(t,r,i){return De(this,n),e.call(this,new Uint32Array(t),r,i)}return Ie(n)}(Ue);(function(t){Re(n,t);var e=Ce(n);function n(t,r,i){return De(this,n),e.call(this,new Uint16Array(t),r,i)}return Ie(n)})(Ue).prototype.isFloat16BufferAttribute=!0;var Ve=function(t){Re(n,t);var e=Ce(n);function n(t,r,i){return De(this,n),e.call(this,new Float32Array(t),r,i)}return Ie(n)}(Ue);Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function Ge(t){return Ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ge(t)}function We(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function je(t,e){return je=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},je(t,e)}function qe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Ze(t);if(e){var i=Ze(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Xe(this,n)}}function Xe(t,e){if(e&&("object"===Ge(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Ye(t)}function Ye(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ze(t){return Ze=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ze(t)}var Je=0,Qe=new J,Ke=new It,$e=new c,tn=new m,en=new m,nn=new c,rn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&je(t,e)}(o,t);var e,n,i,a=qe(o);function o(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),t=a.call(this),Object.defineProperty(Ye(t),"id",{value:Je++}),t.uuid=r.DO(),t.name="",t.type="BufferGeometry",t.index=null,t.attributes={},t.morphAttributes={},t.morphTargetsRelative=!1,t.groups=[],t.boundingBox=null,t.boundingSphere=null,t.drawRange={start:0,count:1/0},t.userData={},t}return e=o,n=[{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(t){return Array.isArray(t)?this.index=new(function(t){for(var e=t.length-1;e>=0;--e)if(t[e]>65535)return!0;return!1}(t)?He:Fe)(t,1):this.index=t,this}},{key:"getAttribute",value:function(t){return this.attributes[t]}},{key:"setAttribute",value:function(t,e){return this.attributes[t]=e,this}},{key:"deleteAttribute",value:function(t){return delete this.attributes[t],this}},{key:"hasAttribute",value:function(t){return void 0!==this.attributes[t]}},{key:"addGroup",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:t,count:e,materialIndex:n})}},{key:"clearGroups",value:function(){this.groups=[]}},{key:"setDrawRange",value:function(t,e){this.drawRange.start=t,this.drawRange.count=e}},{key:"applyMatrix4",value:function(t){var e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new vt).getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"applyQuaternion",value:function(t){return Qe.makeRotationFromQuaternion(t),this.applyMatrix4(Qe),this}},{key:"rotateX",value:function(t){return Qe.makeRotationX(t),this.applyMatrix4(Qe),this}},{key:"rotateY",value:function(t){return Qe.makeRotationY(t),this.applyMatrix4(Qe),this}},{key:"rotateZ",value:function(t){return Qe.makeRotationZ(t),this.applyMatrix4(Qe),this}},{key:"translate",value:function(t,e,n){return Qe.makeTranslation(t,e,n),this.applyMatrix4(Qe),this}},{key:"scale",value:function(t,e,n){return Qe.makeScale(t,e,n),this.applyMatrix4(Qe),this}},{key:"lookAt",value:function(t){return Ke.lookAt(t),Ke.updateMatrix(),this.applyMatrix4(Ke.matrix),this}},{key:"center",value:function(){return this.computeBoundingBox(),this.boundingBox.getCenter($e).negate(),this.translate($e.x,$e.y,$e.z),this}},{key:"setFromPoints",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new Ve(e,3)),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new m);var t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new c(-1/0,-1/0,-1/0),new c(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(var n=0,r=e.length;n<r;n++){var i=e[n];tn.setFromBufferAttribute(i),this.morphTargetsRelative?(nn.addVectors(this.boundingBox.min,tn.min),this.boundingBox.expandByPoint(nn),nn.addVectors(this.boundingBox.max,tn.max),this.boundingBox.expandByPoint(nn)):(this.boundingBox.expandByPoint(tn.min),this.boundingBox.expandByPoint(tn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new N);var t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new c,1/0);if(t){var n=this.boundingSphere.center;if(tn.setFromBufferAttribute(t),e)for(var r=0,i=e.length;r<i;r++){var a=e[r];en.setFromBufferAttribute(a),this.morphTargetsRelative?(nn.addVectors(tn.min,en.min),tn.expandByPoint(nn),nn.addVectors(tn.max,en.max),tn.expandByPoint(nn)):(tn.expandByPoint(en.min),tn.expandByPoint(en.max))}tn.getCenter(n);for(var o=0,s=0,u=t.count;s<u;s++)nn.fromBufferAttribute(t,s),o=Math.max(o,n.distanceToSquared(nn));if(e)for(var l=0,h=e.length;l<h;l++)for(var d=e[l],f=this.morphTargetsRelative,p=0,v=d.count;p<v;p++)nn.fromBufferAttribute(d,p),f&&($e.fromBufferAttribute(t,p),nn.add($e)),o=Math.max(o,n.distanceToSquared(nn));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}},{key:"computeTangents",value:function(){var t=this.index,e=this.attributes;if(null!==t&&void 0!==e.position&&void 0!==e.normal&&void 0!==e.uv){var n=t.array,r=e.position.array,i=e.normal.array,a=e.uv.array,o=r.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Ue(new Float32Array(4*o),4));for(var s=this.getAttribute("tangent").array,u=[],l=[],h=0;h<o;h++)u[h]=new c,l[h]=new c;var d=new c,f=new c,p=new c,v=new we,m=new we,y=new we,g=new c,x=new c,_=this.groups;0===_.length&&(_=[{start:0,count:n.length}]);for(var b=0,w=_.length;b<w;++b)for(var M=_[b],S=M.start,E=S,T=S+M.count;E<T;E+=3)N(n[E+0],n[E+1],n[E+2]);for(var k=new c,A=new c,R=new c,L=new c,C=0,P=_.length;C<P;++C)for(var z=_[C],D=z.start,O=D,I=D+z.count;O<I;O+=3)B(n[O+0]),B(n[O+1]),B(n[O+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");function N(t,e,n){d.fromArray(r,3*t),f.fromArray(r,3*e),p.fromArray(r,3*n),v.fromArray(a,2*t),m.fromArray(a,2*e),y.fromArray(a,2*n),f.sub(d),p.sub(d),m.sub(v),y.sub(v);var i=1/(m.x*y.y-y.x*m.y);isFinite(i)&&(g.copy(f).multiplyScalar(y.y).addScaledVector(p,-m.y).multiplyScalar(i),x.copy(p).multiplyScalar(m.x).addScaledVector(f,-y.x).multiplyScalar(i),u[t].add(g),u[e].add(g),u[n].add(g),l[t].add(x),l[e].add(x),l[n].add(x))}function B(t){R.fromArray(i,3*t),L.copy(R);var e=u[t];k.copy(e),k.sub(R.multiplyScalar(R.dot(e))).normalize(),A.crossVectors(L,e);var n=A.dot(l[t])<0?-1:1;s[4*t]=k.x,s[4*t+1]=k.y,s[4*t+2]=k.z,s[4*t+3]=n}}},{key:"computeVertexNormals",value:function(){var t=this.index,e=this.getAttribute("position");if(void 0!==e){var n=this.getAttribute("normal");if(void 0===n)n=new Ue(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(var r=0,i=n.count;r<i;r++)n.setXYZ(r,0,0,0);var a=new c,o=new c,s=new c,u=new c,l=new c,h=new c,d=new c,f=new c;if(t)for(var p=0,v=t.count;p<v;p+=3){var m=t.getX(p+0),y=t.getX(p+1),g=t.getX(p+2);a.fromBufferAttribute(e,m),o.fromBufferAttribute(e,y),s.fromBufferAttribute(e,g),d.subVectors(s,o),f.subVectors(a,o),d.cross(f),u.fromBufferAttribute(n,m),l.fromBufferAttribute(n,y),h.fromBufferAttribute(n,g),u.add(d),l.add(d),h.add(d),n.setXYZ(m,u.x,u.y,u.z),n.setXYZ(y,l.x,l.y,l.z),n.setXYZ(g,h.x,h.y,h.z)}else for(var x=0,_=e.count;x<_;x+=3)a.fromBufferAttribute(e,x+0),o.fromBufferAttribute(e,x+1),s.fromBufferAttribute(e,x+2),d.subVectors(s,o),f.subVectors(a,o),d.cross(f),n.setXYZ(x+0,d.x,d.y,d.z),n.setXYZ(x+1,d.x,d.y,d.z),n.setXYZ(x+2,d.x,d.y,d.z);this.normalizeNormals(),n.needsUpdate=!0}}},{key:"merge",value:function(t,e){if(t&&t.isBufferGeometry){void 0===e&&(e=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!==t.attributes[r])for(var i=n[r].array,a=t.attributes[r],o=a.array,s=a.itemSize*e,u=Math.min(o.length,i.length-s),l=0,h=s;l<u;l++,h++)i[h]=o[l];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t)}},{key:"normalizeNormals",value:function(){for(var t=this.attributes.normal,e=0,n=t.count;e<n;e++)nn.fromBufferAttribute(t,e),nn.normalize(),t.setXYZ(e,nn.x,nn.y,nn.z)}},{key:"toNonIndexed",value:function(){function t(t,e){for(var n=t.array,r=t.itemSize,i=t.normalized,a=new n.constructor(e.length*r),o=0,s=0,u=0,l=e.length;u<l;u++){o=t.isInterleavedBufferAttribute?e[u]*t.data.stride+t.offset:e[u]*r;for(var h=0;h<r;h++)a[s++]=n[o++]}return new Ue(a,r,i)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var e=new o,n=this.index.array,r=this.attributes;for(var i in r){var a=t(r[i],n);e.setAttribute(i,a)}var s=this.morphAttributes;for(var u in s){for(var l=[],h=s[u],c=0,d=h.length;c<d;c++){var f=t(h[c],n);l.push(f)}e.morphAttributes[u]=l}e.morphTargetsRelative=this.morphTargetsRelative;for(var p=this.groups,v=0,m=p.length;v<m;v++){var y=p[v];e.addGroup(y.start,y.count,y.materialIndex)}return e}},{key:"toJSON",value:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var r=this.index;null!==r&&(t.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var a in i){var o=i[a];t.data.attributes[a]=o.toJSON(t.data)}var s={},u=!1;for(var l in this.morphAttributes){for(var h=this.morphAttributes[l],c=[],d=0,f=h.length;d<f;d++){var p=h[d];c.push(p.toJSON(t.data))}c.length>0&&(s[l]=c,u=!0)}u&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);var v=this.groups;v.length>0&&(t.data.groups=JSON.parse(JSON.stringify(v)));var m=this.boundingSphere;return null!==m&&(t.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),t}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var e={};this.name=t.name;var n=t.index;null!==n&&this.setIndex(n.clone(e));var r=t.attributes;for(var i in r){var a=r[i];this.setAttribute(i,a.clone(e))}var o=t.morphAttributes;for(var s in o){for(var u=[],l=o[s],h=0,c=l.length;h<c;h++)u.push(l[h].clone(e));this.morphAttributes[s]=u}this.morphTargetsRelative=t.morphTargetsRelative;for(var d=t.groups,f=0,p=d.length;f<p;f++){var v=d[f];this.addGroup(v.start,v.count,v.materialIndex)}var m=t.boundingBox;null!==m&&(this.boundingBox=m.clone());var y=t.boundingSphere;return null!==y&&(this.boundingSphere=y.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,void 0!==t.parameters&&(this.parameters=Object.assign({},t.parameters)),this}},{key:"dispose",value:function(){this.dispatchEvent({type:"dispose"})}}],n&&We(e.prototype,n),i&&We(e,i),Object.defineProperty(e,"prototype",{writable:!1}),o}(at);function an(t){return an="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},an(t)}function on(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function sn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function un(){return un="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=ln(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},un.apply(this,arguments)}function ln(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=fn(t)););return t}function hn(t,e){return hn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},hn(t,e)}function cn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=fn(t);if(e){var i=fn(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return dn(this,n)}}function dn(t,e){if(e&&("object"===an(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function fn(t){return fn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fn(t)}rn.prototype.isBufferGeometry=!0;var pn=new c,vn=new c,mn=new J,yn=new X,gn=new N,xn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&hn(t,e)}(a,t);var e,n,r,i=cn(a);function a(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new rn,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new ye;return on(this,a),(t=i.call(this)).type="Line",t.geometry=e,t.material=n,t.updateMorphTargets(),t}return e=a,(n=[{key:"copy",value:function(t){return un(fn(a.prototype),"copy",this).call(this,t),this.material=t.material,this.geometry=t.geometry,this}},{key:"computeLineDistances",value:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[0],r=1,i=e.count;r<i;r++)pn.fromBufferAttribute(e,r-1),vn.fromBufferAttribute(e,r),n[r]=n[r-1],n[r]+=pn.distanceTo(vn);t.setAttribute("lineDistance",new Ve(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}},{key:"raycast",value:function(t,e){var n=this.geometry,r=this.matrixWorld,i=t.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),gn.copy(n.boundingSphere),gn.applyMatrix4(r),gn.radius+=i,!1!==t.ray.intersectsSphere(gn)){mn.copy(r).invert(),yn.copy(t.ray).applyMatrix4(mn);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,u=new c,l=new c,h=new c,d=new c,f=this.isLineSegments?2:1;if(n.isBufferGeometry){var p=n.index,v=n.attributes.position;if(null!==p)for(var m=Math.max(0,a.start),y=Math.min(p.count,a.start+a.count)-1;m<y;m+=f){var g=p.getX(m),x=p.getX(m+1);if(u.fromBufferAttribute(v,g),l.fromBufferAttribute(v,x),!(yn.distanceSqToSegment(u,l,d,h)>s)){d.applyMatrix4(this.matrixWorld);var _=t.ray.origin.distanceTo(d);_<t.near||_>t.far||e.push({distance:_,point:h.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else for(var b=Math.max(0,a.start),w=Math.min(v.count,a.start+a.count)-1;b<w;b+=f)if(u.fromBufferAttribute(v,b),l.fromBufferAttribute(v,b+1),!(yn.distanceSqToSegment(u,l,d,h)>s)){d.applyMatrix4(this.matrixWorld);var M=t.ray.origin.distanceTo(d);M<t.near||M>t.far||e.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}},{key:"updateMorphTargets",value:function(){var t=this.geometry;if(t.isBufferGeometry){var e=t.morphAttributes,n=Object.keys(e);if(n.length>0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i<a;i++){var o=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=i}}}}else{var s=t.morphTargets;void 0!==s&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}])&&sn(e.prototype,n),r&&sn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(It);function _n(t){return _n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_n(t)}function bn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function wn(t,e){return wn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},wn(t,e)}function Mn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=En(t);if(e){var i=En(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Sn(this,n)}}function Sn(t,e){if(e&&("object"===_n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function En(t){return En=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},En(t)}xn.prototype.isLine=!0;var Tn=new c,kn=new c,An=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wn(t,e)}(a,t);var e,n,r,i=Mn(a);function a(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(n=i.call(this,t,e)).type="LineSegments",n}return e=a,(n=[{key:"computeLineDistances",value:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[],r=0,i=e.count;r<i;r+=2)Tn.fromBufferAttribute(e,r),kn.fromBufferAttribute(e,r+1),n[r]=0===r?0:n[r-1],n[r+1]=n[r]+Tn.distanceTo(kn);t.setAttribute("lineDistance",new Ve(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}])&&bn(e.prototype,n),r&&bn(e,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(xn);function Rn(t){return Rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rn(t)}function Ln(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Cn(){return Cn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=Pn(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Cn.apply(this,arguments)}function Pn(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=In(t)););return t}function zn(t,e){return zn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zn(t,e)}function Dn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=In(t);if(e){var i=In(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return On(this,n)}}function On(t,e){if(e&&("object"===Rn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function In(t){return In=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},In(t)}An.prototype.isLineSegments=!0;var Nn=new c,Bn=new J,Un=new J,Fn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&zn(t,e)}(a,t);var e,n,r,i=Dn(a);function a(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a);var n=Hn(t);console.log("bone list",n);for(var r=new rn,o=[],s=[],u=new ue(0,0,1),l=new ue(0,1,0),h=0;h<n.length;h++){var c=n[h];c.parent&&c.parent.isBone&&(o.push(0,0,0),o.push(0,0,0),s.push(u.r,u.g,u.b),s.push(l.r,l.g,l.b))}r.setAttribute("position",new Ve(o,3)),r.setAttribute("color",new Ve(s,3));var d=new ye({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});return(e=i.call(this,r,d)).type="SkeletonHelper",e.isSkeletonHelper=!0,e.root=t,e.bones=n,e.matrix=t.matrixWorld,e.matrixAutoUpdate=!1,e}return e=a,(n=[{key:"updateMatrixWorld",value:function(t){var e=this.bones,n=this.geometry,r=n.getAttribute("position");Un.copy(this.root.matrixWorld).invert();for(var i=0,o=0;i<e.length;i++){var s=e[i];s.parent&&s.parent.isBone&&(Bn.multiplyMatrices(Un,s.matrixWorld),Nn.setFromMatrixPosition(Bn),r.setXYZ(o,Nn.x,Nn.y,Nn.z),Bn.multiplyMatrices(Un,s.parent.matrixWorld),Nn.setFromMatrixPosition(Bn),r.setXYZ(o+1,Nn.x,Nn.y,Nn.z),o+=2)}n.getAttribute("position").needsUpdate=!0,Cn(In(a.prototype),"updateMatrixWorld",this).call(this,t)}}])&&Ln(e.prototype,n),r&&Ln(e,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(An);function Hn(t){var e=[];!0===t.isBone&&e.push(t);for(var n=0;n<t.children.length;n++)e.push.apply(e,Hn(t.children[n]));return e}},7617:(t,e,n)=>{n.d(e,{DO:()=>a,kz:()=>s,t7:()=>u,uZ:()=>o});for(var r=[],i=0;i<256;i++)r[i]=(i<16?"0":"")+i.toString(16);Math.PI,Math.PI;function a(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(r[255&t]+r[t>>8&255]+r[t>>16&255]+r[t>>24&255]+"-"+r[255&e]+r[e>>8&255]+"-"+r[e>>16&15|64]+r[e>>24&255]+"-"+r[63&n|128]+r[n>>8&255]+"-"+r[n>>16&255]+r[n>>24&255]+r[255&i]+r[i>>8&255]+r[i>>16&255]+r[i>>24&255]).toLowerCase()}function o(t,e,n){return Math.max(e,Math.min(n,t))}function s(t,e){return(t%e+e)%e}function u(t,e,n){return(1-n)*t+n*e}}}]);