text: (window.webpackJsonp=window.webpackJsonp||[]).push([[3],{PzGh:function(e,t,n){"use strict";n.r(t),n.d(t,"ModelViewerElement",(function(){return yb}));n("bHtr"),n("Z2Ku"),n("L9s1"),n("DNiP");var i=n("rePB"),r=n("ODXe"),a=(n("T39b"),n("hhXQ"),n("pp/T"),n("2Spj"),n("Oyvg"),n("mGWK"),n("OG14"),n("SRfc"),n("dRSK"),n("Ji/l"),n("DW2E"),n("CyHz"),n("ReuC")),o=(n("0l/t"),n("pIFo"),n("KKXr"),n("Tze0"),n("h/M4"),n("Vd3H"),n("EK0E"),n("fN96"),n("JX7q")),s=(n("RW0V"),n("Tdpu"),n("Y9lz"),n("nCnK"),n("tuSo"),n("r1bV"),n("Faw5"),n("aqI/"),n("NO8f"),n("sFw1"),n("bWfx"),n("AphP"),n("WLL4"),n("Zz4T"),n("Ljet"),n("hHhE"),n("FLlr"),n("V+eJ"),n("91GP"),n("LK8F"),n("HEwt"),n("f3/d"),n("a1Th"),n("h7Nl"),n("I5cv"),n("KQm4")),l=(n("HAE/"),n("rE2o"),n("ioFf"),n("o0o1")),c=n.n(l),u=(n("ls82"),n("HaE+")),h=(n("8+KV"),n("rGqo"),n("yt8O"),n("XfO3"),n("9AAn"),n("VRzm"),n("Btvt"),n("1OyB")),d=n("vuIU"),p=n("Ji7U"),f=n("md7G"),m=n("foSv"),v=n("kHIg");n("xfY5");function g(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}(e))){var t=0,n=function(){};return{s:n,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:n}}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 i,r,a=!0,o=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var e=i.next();return a=e.done,e},e:function(e){o=!0,r=e},f:function(){try{a||null==i.return||i.return()}finally{if(o)throw r}}}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function b(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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(x){return!1}}();return function(){var n,i=Object(m.a)(e);if(t){var r=Object(m.a)(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return Object(f.a)(this,n)}}String(Math.random()).slice(2),window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:function(e){return e}});(function(){try{var e={get capture(){return!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(t){}})(),"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.3.0"),void 0===window.ShadyCSS||void 0===window.ShadyCSS.prepareTemplateDom&&console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),window.JSCompiler_renameProperty=function(e,t){return e};var x={toAttribute:function(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute:function(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},w=function(e,t){return t!==e&&(t==t||e==e)},_={attribute:!0,type:String,converter:x,reflect:!1,hasChanged:w},M=function(e){Object(p.a)(i,e);var t,n=b(i);function i(){var e;return Object(h.a)(this,i),(e=n.call(this)).initialize(),e}return Object(d.a)(i,[{key:"initialize",value:function(){var e=this;this._updateState=0,this._updatePromise=new Promise((function(t){return e._enableUpdatingResolver=t})),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}},{key:"_saveInstanceProperties",value:function(){var e=this;this.constructor._classProperties.forEach((function(t,n){if(e.hasOwnProperty(n)){var i=e[n];delete e[n],e._instanceProperties||(e._instanceProperties=new Map),e._instanceProperties.set(n,i)}}))}},{key:"_applyInstanceProperties",value:function(){var e=this;this._instanceProperties.forEach((function(t,n){return e[n]=t})),this._instanceProperties=void 0}},{key:"connectedCallback",value:function(){this.enableUpdating()}},{key:"enableUpdating",value:function(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}},{key:"disconnectedCallback",value:function(){}},{key:"attributeChangedCallback",value:function(e,t,n){t!==n&&this._attributeToProperty(e,n)}},{key:"_propertyToAttribute",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_,i=this.constructor,r=i._attributeNameForProperty(e,n);if(void 0!==r){var a=i._propertyValueToAttribute(t,n);if(void 0===a)return;this._updateState=8|this._updateState,null==a?this.removeAttribute(r):this.setAttribute(r,a),this._updateState=-9&this._updateState}}},{key:"_attributeToProperty",value:function(e,t){if(!(8&this._updateState)){var n=this.constructor,i=n._attributeToPropertyMap.get(e);if(void 0!==i){var r=n.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=n._propertyValueFromAttribute(t,r),this._updateState=-17&this._updateState}}}},{key:"requestUpdateInternal",value:function(e,t,n){var i=!0;if(void 0!==e){var r=this.constructor;n=n||r.getPropertyOptions(e),r._valueHasChanged(this[e],t,n.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==n.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,n))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}},{key:"requestUpdate",value:function(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}},{key:"_enqueueUpdate",value:(t=Object(u.a)(c.a.mark((function e(){var t;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._updateState=4|this._updateState,e.prev=1,e.next=4,this._updatePromise;case 4:e.next=8;break;case 6:e.prev=6,e.t0=e.catch(1);case 8:if(t=this.performUpdate(),e.t1=null!=t,!e.t1){e.next=13;break}return e.next=13,t;case 13:return e.abrupt("return",!this._hasRequestedUpdate);case 14:case"end":return e.stop()}}),e,this,[[1,6]])}))),function(){return t.apply(this,arguments)})},{key:"performUpdate",value:function(){if(this._hasRequestedUpdate){this._instanceProperties&&this._applyInstanceProperties();var e=!1,t=this._changedProperties;try{(e=this.shouldUpdate(t))?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}}},{key:"_markUpdated",value:function(){this._changedProperties=new Map,this._updateState=-5&this._updateState}},{key:"_getUpdateComplete",value:function(){return this._updatePromise}},{key:"shouldUpdate",value:function(e){return!0}},{key:"update",value:function(e){var t=this;void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((function(e,n){return t._propertyToAttribute(n,t[n],e)})),this._reflectingProperties=void 0),this._markUpdated()}},{key:"updated",value:function(e){}},{key:"firstUpdated",value:function(e){}},{key:"_hasRequestedUpdate",get:function(){return 4&this._updateState}},{key:"hasUpdated",get:function(){return 1&this._updateState}},{key:"updateComplete",get:function(){return this._getUpdateComplete()}}],[{key:"_ensureClassProperties",value:function(){var e=this;if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;var t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach((function(t,n){return e._classProperties.set(n,t)}))}}},{key:"createProperty",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_;if(this._ensureClassProperties(),this._classProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){var n="symbol"==typeof e?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}}},{key:"getPropertyDescriptor",value:function(e,t,n){return{get:function(){return this[t]},set:function(i){var r=this[e];this[t]=i,this.requestUpdateInternal(e,r,n)},configurable:!0,enumerable:!0}}},{key:"getPropertyOptions",value:function(e){return this._classProperties&&this._classProperties.get(e)||_}},{key:"finalize",value:function(){var e=Object.getPrototypeOf(this);if(e.hasOwnProperty("finalized")||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){var t,n=this.properties,i=g([].concat(Object(s.a)(Object.getOwnPropertyNames(n)),Object(s.a)("function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(n):[])));try{for(i.s();!(t=i.n()).done;){var r=t.value;this.createProperty(r,n[r])}}catch(a){i.e(a)}finally{i.f()}}}},{key:"_attributeNameForProperty",value:function(e,t){var n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}},{key:"_valueHasChanged",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:w;return n(e,t)}},{key:"_propertyValueFromAttribute",value:function(e,t){var n=t.type,i=t.converter||x,r="function"==typeof i?i:i.fromAttribute;return r?r(e,n):e}},{key:"_propertyValueToAttribute",value:function(e,t){if(void 0!==t.reflect){var n=t.type,i=t.converter;return(i&&i.toAttribute||x.toAttribute)(e,n)}}},{key:"observedAttributes",get:function(){var e=this;this.finalize();var t=[];return this._classProperties.forEach((function(n,i){var r=e._attributeNameForProperty(i,n);void 0!==r&&(e._attributeToPropertyMap.set(r,i),t.push(r))})),t}}]),i}(Object(v.a)(HTMLElement));M.finalized=!0;function S(e){return function(t,n){return void 0!==n?function(e,t,n){t.constructor.createProperty(n,e)}(e,t,n):function(e,t){return"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Object.assign(Object.assign({},t),{finisher:function(n){n.createProperty(t.key,e)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer:function(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher:function(n){n.createProperty(t.key,e)}}}(e,t)}}window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&CSSStyleSheet.prototype,(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");var T=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,E=T&&self.XRSession.prototype.requestHitTestSource,A=null!=self.ResizeObserver,L=null!=self.IntersectionObserver,k=E,R=(function(){var e=navigator.userAgent||navigator.vendor||self.opera;/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}(),/\bCrOS\b/.test(navigator.userAgent),/android/i.test(navigator.userAgent)),O=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,C=function(){var e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))}(),P=/Safari\//.test(navigator.userAgent),I=/firefox/i.test(navigator.userAgent),D=/OculusBrowser/.test(navigator.userAgent),N=O&&/CriOS\//.test(navigator.userAgent),F=O&&P,U=R&&!I&&!D,z=document.createElement("template");function j(){}z.innerHTML='\n<style>\n:host {\n  display: block;\n  position: relative;\n  contain: strict;\n  width: 300px;\n  height: 150px;\n}\n\n/* NOTE: This ruleset is our integration surface area with the\n * :focus-visible polyfill.\n *\n * @see https://github.com/WICG/focus-visible/pull/196 */\n:host([data-js-focus-visible]:focus:not(.focus-visible)),\n:host([data-js-focus-visible]) :focus:not(.focus-visible) {\n  outline: none;\n}\n\n.container {\n  position: relative;\n}\n\n.userInput {\n  width: 100%;\n  height: 100%;\n  display: block;\n  position: relative;\n  overflow: hidden;\n}\n\ncanvas {\n  position: absolute;\n  display: none;\n  pointer-events: none;\n  /* NOTE(cdata): Chrome 76 and below apparently have a bug\n   * that causes our canvas not to display pixels unless it is\n   * on its own render layer\n   * @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893\n   */\n  transform: translateZ(0);\n}\n\ncanvas.show {\n  display: block;\n}\n\n/* Adapted from HTML5 Boilerplate\n *\n * @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */\n.screen-reader-only {\n  border: 0;\n  clip: rect(0, 0, 0, 0);\n  height: 1px;\n  margin: -1px;\n  overflow: hidden;\n  padding: 0;\n  position: absolute;\n  white-space: nowrap;\n  width: 1px;\n}\n\n.slot {\n  position: absolute;\n  pointer-events: none;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n}\n\n.slot > * {\n  pointer-events: initial;\n}\n\n.annotation-wrapper ::slotted(*) {\n  opacity: var(--max-hotspot-opacity, 1);\n  transition: opacity 0.3s;\n}\n\n.pointer-tumbling .annotation-wrapper ::slotted(*) {\n  pointer-events: none;\n}\n\n.annotation-wrapper ::slotted(*) {\n  pointer-events: initial;\n}\n\n.annotation-wrapper.hide ::slotted(*) {\n  opacity: var(--min-hotspot-opacity, 0.25);\n}\n\n.slot.poster {\n  opacity: 0;\n  transition: opacity 0.3s 0.3s;\n  background-color: inherit;\n}\n\n.slot.poster.show {\n  opacity: 1;\n  transition: none;\n}\n\n.slot.poster > * {\n  pointer-events: initial;\n}\n\n.slot.poster:not(.show) > * {\n  pointer-events: none;\n}\n\n#default-poster {\n  width: 100%;\n  height: 100%;\n  /* The default poster is a <button> so we need to set display\n   * to prevent it from being affected by text-align: */\n  display: block;\n  position: absolute;\n  border: none;\n  padding: 0;\n  background-size: contain;\n  background-repeat: no-repeat;\n  background-position: center;\n  background-color: var(--poster-color, #fff);\n  background-image: var(--poster-image, none);\n}\n\n#default-progress-bar {\n  display: block;\n  position: relative;\n  width: 100%;\n  height: 100%;\n  pointer-events: none;\n  overflow: hidden;\n}\n\n#default-progress-bar > .mask {\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  background: var(--progress-mask, #fff);\n  transition: opacity 0.3s;\n  opacity: 0.2;\n}\n\n#default-progress-bar > .bar {\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: var(--progress-bar-height, 5px);\n  transition: transform 0.09s;\n  transform-origin: top left;\n  transform: scaleX(0);\n  overflow: hidden;\n}\n\n#default-progress-bar > .bar:before {\n  content: \'\';\n  display: block;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n\n  background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4));\n\n  transition: none;\n  transform-origin: top left;\n  transform: translateY(0);\n}\n\n#default-progress-bar > .bar.hide:before {\n  transition: transform 0.3s 1s;\n  transform: translateY(-100%);\n}\n\n.slot.interaction-prompt {\n  display: var(--interaction-prompt-display, flex);\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  pointer-events: none;\n  align-items: center;\n  justify-content: center;\n\n  opacity: 0;\n  will-change: opacity;\n  overflow: hidden;\n  transition: opacity 0.3s;\n}\n\n.slot.interaction-prompt.visible {\n  opacity: 1;\n}\n\n.slot.interaction-prompt > .animated-container {\n  will-change: transform, opacity;\n}\n\n.slot.interaction-prompt > * {\n  pointer-events: none;\n}\n\n.slot.ar-button {\n  -moz-user-select: none;\n  -webkit-tap-highlight-color: transparent;\n  user-select: none;\n\n  display: var(--ar-button-display, block);\n}\n\n.slot.ar-button:not(.enabled) {\n  display: none;\n}\n\n.fab {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  box-sizing: border-box;\n  width: 40px;\n  height: 40px;\n  cursor: pointer;\n  background-color: #fff;\n  box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15);\n  border-radius: 100px;\n}\n\n.fab > * {\n  opacity: 0.87;\n}\n\n#default-ar-button {\n  position: absolute;\n  bottom: 16px;\n  right: 16px;\n  transform: scale(var(--ar-button-scale, 1));\n  transform-origin: bottom right;\n}\n\n.slot.default {\n  pointer-events: none;\n}\n\n.slot.progress-bar {\n  pointer-events: none;\n}\n\n.slot.exit-webxr-ar-button {\n  pointer-events: none;\n}\n\n.slot.exit-webxr-ar-button:not(.enabled) {\n  display: none;\n}\n\n#default-exit-webxr-ar-button {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  position: absolute;\n  top: 16px;\n  left: 16px;\n  width: 40px;\n  height: 40px;\n  box-sizing: border-box;\n}\n\n#default-exit-webxr-ar-button > svg {\n  fill: #fff;\n}\n</style>\n<div class="container">\n  <div class="userInput" tabindex="0" role="img"\n      aria-label="A depiction of a 3D model"\n      aria-live="polite">\n    <canvas></canvas>\n  </div>\n\n  \x3c!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM\n        will have their <slot> elements removed by ShadyCSS --\x3e\n  <div class="slot poster">\n    <slot name="poster">\n      <button type="button" id="default-poster" aria-hidden="true" aria-label="Activate to view in 3D!"></button>\n    </slot>\n  </div>\n\n  <div class="slot ar-button">\n    <slot name="ar-button">\n      <a id="default-ar-button" class="fab"\n          tabindex="2"\n          aria-label="View this 3D model up close">\n        \n<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"\n\t xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"\n\t viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">\n<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>\n<g id="Art_layer">\n\t<path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>\n\t<path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>\n\t<path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>\n\t<path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>\n\t<g>\n\t\t<path d="M18.25,7.6l-5.5-3.18c-0.46-0.27-1.04-0.27-1.5,0L5.75,7.6C5.29,7.87,5,8.36,5,8.9v6.35c0,0.54,0.29,1.03,0.75,1.3\n\t\t\tl5.5,3.18c0.46,0.27,1.04,0.27,1.5,0l5.5-3.18c0.46-0.27,0.75-0.76,0.75-1.3V8.9C19,8.36,18.71,7.87,18.25,7.6z M7,14.96v-4.62\n\t\t\tl4,2.32v4.61L7,14.96z M12,10.93L8,8.61l4-2.31l4,2.31L12,10.93z M13,17.27v-4.61l4-2.32v4.62L13,17.27z"/>\n\t</g>\n</g>\n</svg>\n      </a>\n    </slot>\n  </div>\n\n  <div class="slot interaction-prompt">\n    <div class="animated-container" part="interaction-prompt">\n      <slot name="interaction-prompt" aria-hidden="true">\n        \n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">\n    <defs>\n        <path id="A" d="M.001.232h24.997V36H.001z" />\n    </defs>\n    <g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">\n        <path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />\n        <g transform="translate(11 3)">\n            <path d="M8.733 11.165c.04-1.108.766-2.027 1.743-2.307a2.54 2.54 0 0 1 .628-.089c.16 0 .314.017.463.044 1.088.2 1.9 1.092 1.9 2.16v8.88h1.26c2.943-1.39 5-4.45 5-8.025a9.01 9.01 0 0 0-1.9-5.56l-.43-.5c-.765-.838-1.683-1.522-2.712-2-1.057-.49-2.226-.77-3.46-.77s-2.4.278-3.46.77c-1.03.478-1.947 1.162-2.71 2l-.43.5a9.01 9.01 0 0 0-1.9 5.56 9.04 9.04 0 0 0 .094 1.305c.03.21.088.41.13.617l.136.624c.083.286.196.56.305.832l.124.333a8.78 8.78 0 0 0 .509.953l.065.122a8.69 8.69 0 0 0 3.521 3.191l1.11.537v-9.178z" fill-opacity=".5" fill="#e4e4e4" />\n            <path d="M22.94 26.218l-2.76 7.74c-.172.485-.676.8-1.253.8H12.24c-1.606 0-3.092-.68-3.98-1.82-1.592-2.048-3.647-3.822-6.11-5.27-.095-.055-.15-.137-.152-.23-.004-.1.046-.196.193-.297.56-.393 1.234-.6 1.926-.6a3.43 3.43 0 0 1 .691.069l4.922.994V10.972c0-.663.615-1.203 1.37-1.203s1.373.54 1.373 1.203v9.882h2.953c.273 0 .533.073.757.21l6.257 3.874c.027.017.045.042.07.06.41.296.586.77.426 1.22M4.1 16.614c-.024-.04-.042-.083-.065-.122a8.69 8.69 0 0 1-.509-.953c-.048-.107-.08-.223-.124-.333l-.305-.832c-.058-.202-.09-.416-.136-.624l-.13-.617a9.03 9.03 0 0 1-.094-1.305c0-2.107.714-4.04 1.9-5.56l.43-.5c.764-.84 1.682-1.523 2.71-2 1.058-.49 2.226-.77 3.46-.77s2.402.28 3.46.77c1.03.477 1.947 1.16 2.712 2l.428.5a9 9 0 0 1 1.901 5.559c0 3.577-2.056 6.636-5 8.026h-1.26v-8.882c0-1.067-.822-1.96-1.9-2.16-.15-.028-.304-.044-.463-.044-.22 0-.427.037-.628.09-.977.28-1.703 1.198-1.743 2.306v9.178l-1.11-.537C6.18 19.098 4.96 18 4.1 16.614M22.97 24.09l-6.256-3.874c-.102-.063-.218-.098-.33-.144 2.683-1.8 4.354-4.855 4.354-8.243 0-.486-.037-.964-.104-1.43a9.97 9.97 0 0 0-1.57-4.128l-.295-.408-.066-.092a10.05 10.05 0 0 0-.949-1.078c-.342-.334-.708-.643-1.094-.922-1.155-.834-2.492-1.412-3.94-1.65l-.732-.088-.748-.03a9.29 9.29 0 0 0-1.482.119c-1.447.238-2.786.816-3.94 1.65a9.33 9.33 0 0 0-.813.686 9.59 9.59 0 0 0-.845.877l-.385.437-.36.5-.288.468-.418.778-.04.09c-.593 1.28-.93 2.71-.93 4.222 0 3.832 2.182 7.342 5.56 8.938l1.437.68v4.946L5 25.64a4.44 4.44 0 0 0-.888-.086c-.017 0-.034.003-.05.003-.252.004-.503.033-.75.08a5.08 5.08 0 0 0-.237.056c-.193.046-.382.107-.568.18-.075.03-.15.057-.225.1-.25.114-.494.244-.723.405a1.31 1.31 0 0 0-.566 1.122 1.28 1.28 0 0 0 .645 1.051C4 29.925 5.96 31.614 7.473 33.563a5.06 5.06 0 0 0 .434.491c1.086 1.082 2.656 1.713 4.326 1.715h6.697c.748-.001 1.43-.333 1.858-.872.142-.18.256-.38.336-.602l2.757-7.74c.094-.26.13-.53.112-.794s-.088-.52-.203-.76a2.19 2.19 0 0 0-.821-.91" fill-opacity=".6" fill="#000" />\n            <path d="M22.444 24.94l-6.257-3.874a1.45 1.45 0 0 0-.757-.211h-2.953v-9.88c0-.663-.616-1.203-1.373-1.203s-1.37.54-1.37 1.203v16.643l-4.922-.994a3.44 3.44 0 0 0-.692-.069 3.35 3.35 0 0 0-1.925.598c-.147.102-.198.198-.194.298.004.094.058.176.153.23 2.462 1.448 4.517 3.22 6.11 5.27.887 1.14 2.373 1.82 3.98 1.82h6.686c.577 0 1.08-.326 1.253-.8l2.76-7.74c.16-.448-.017-.923-.426-1.22-.025-.02-.043-.043-.07-.06z" fill="#fff" />\n            <g transform="translate(0 .769)">\n                <mask id="B" fill="#fff">\n                    <use xlink:href="#A" />\n                </mask>\n                <path d="M23.993 24.992a1.96 1.96 0 0 1-.111.794l-2.758 7.74c-.08.22-.194.423-.336.602-.427.54-1.11.87-1.857.872h-6.698c-1.67-.002-3.24-.633-4.326-1.715-.154-.154-.3-.318-.434-.49C5.96 30.846 4 29.157 1.646 27.773c-.385-.225-.626-.618-.645-1.05a1.31 1.31 0 0 1 .566-1.122 4.56 4.56 0 0 1 .723-.405l.225-.1a4.3 4.3 0 0 1 .568-.18l.237-.056c.248-.046.5-.075.75-.08.018 0 .034-.003.05-.003.303-.001.597.027.89.086l3.722.752V20.68l-1.436-.68c-3.377-1.596-5.56-5.106-5.56-8.938 0-1.51.336-2.94.93-4.222.015-.03.025-.06.04-.09.127-.267.268-.525.418-.778.093-.16.186-.316.288-.468.063-.095.133-.186.2-.277L3.773 5c.118-.155.26-.29.385-.437.266-.3.544-.604.845-.877a9.33 9.33 0 0 1 .813-.686C6.97 2.167 8.31 1.59 9.757 1.35a9.27 9.27 0 0 1 1.481-.119 8.82 8.82 0 0 1 .748.031c.247.02.49.05.733.088 1.448.238 2.786.816 3.94 1.65.387.28.752.588 1.094.922a9.94 9.94 0 0 1 .949 1.078l.066.092c.102.133.203.268.295.408a9.97 9.97 0 0 1 1.571 4.128c.066.467.103.945.103 1.43 0 3.388-1.67 6.453-4.353 8.243.11.046.227.08.33.144l6.256 3.874c.37.23.645.55.82.9.115.24.185.498.203.76m.697-1.195c-.265-.55-.677-1.007-1.194-1.326l-5.323-3.297c2.255-2.037 3.564-4.97 3.564-8.114 0-2.19-.637-4.304-1.84-6.114-.126-.188-.26-.37-.4-.552-.645-.848-1.402-1.6-2.252-2.204C15.472.91 13.393.232 11.238.232A10.21 10.21 0 0 0 5.23 2.19c-.848.614-1.606 1.356-2.253 2.205-.136.18-.272.363-.398.55C1.374 6.756.737 8.87.737 11.06c0 4.218 2.407 8.08 6.133 9.842l.863.41v3.092l-2.525-.51c-.356-.07-.717-.106-1.076-.106a5.45 5.45 0 0 0-3.14.996c-.653.46-1.022 1.202-.99 1.983a2.28 2.28 0 0 0 1.138 1.872c2.24 1.318 4.106 2.923 5.543 4.772 1.26 1.62 3.333 2.59 5.55 2.592h6.698c1.42-.001 2.68-.86 3.134-2.138l2.76-7.74c.272-.757.224-1.584-.134-2.325" fill-opacity=".05" fill="#000" mask="url(#B)" />\n            </g>\n        </g>\n    </g>\n</svg>\n      </slot>\n    </div>\n  </div>\n\n  <div class="slot default">\n    <slot></slot>\n\n    <div class="slot progress-bar">\n      <slot name="progress-bar">\n        <div id="default-progress-bar" aria-hidden="true">\n          <div class="mask"></div>\n          <div class="bar"></div>\n        </div>\n      </slot>\n    </div>\n    \n    <div class="slot exit-webxr-ar-button">\n      <slot name="exit-webxr-ar-button">\n        <a id="default-exit-webxr-ar-button"\n            tabindex="3"\n            aria-label="Exit AR"\n            aria-hidden="true">\n          \n<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">\n    \x3c!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement\n         support for dynamic re-coloring of UI components --\x3e\n    <defs>\n      <filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">\n        <feGaussianBlur in="SourceAlpha" stdDeviation="1"/>\n        <feOffset dx="0" dy="0" result="offsetblur"/>\n        <feFlood flood-color="#000000"/>\n        <feComposite in2="offsetblur" operator="in"/>\n        <feMerge>\n          <feMergeNode/>\n          <feMergeNode in="SourceGraphic"/>\n        </feMerge>\n      </filter>\n    </defs>\n    <path filter="url(#drop-shadow)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>\n    <path d="M0 0h24v24H0z" fill="none"/>\n</svg>\n        </a>\n      </slot>\n    </div>\n  </div>\n</div>',Object.assign(j.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[e]&&-1!==n[e].indexOf(t)},removeEventListener:function(e,t){if(void 0!==this._listeners){var n=this._listeners[e];if(void 0!==n){var i=n.indexOf(t);-1!==i&&n.splice(i,1)}}},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),i=0,r=n.length;i<r;i++)n[i].call(this,e)}}}});for(var B=[],H=0;H<256;H++)B[H]=(H<16?"0":"")+H.toString(16);var G,V=1234567,W={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(B[255&e]+B[e>>8&255]+B[e>>16&255]+B[e>>24&255]+"-"+B[255&t]+B[t>>8&255]+"-"+B[t>>16&15|64]+B[t>>24&255]+"-"+B[63&n|128]+B[n>>8&255]+"-"+B[n>>16&255]+B[n>>24&255]+B[255&i]+B[i>>8&255]+B[i>>16&255]+B[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){return void 0!==e&&(V=e%2147483647),((V=16807*V%2147483647)-1)/2147483646},degToRad:function(e){return e*W.DEG2RAD},radToDeg:function(e){return e*W.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),c=a((t+i)/2),u=o((t+i)/2),h=a((t-i)/2),d=o((t-i)/2),p=a((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(s*u,l*h,l*d,s*c);break;case"YZY":e.set(l*d,s*u,l*h,s*c);break;case"ZXZ":e.set(l*h,l*d,s*u,s*c);break;case"XZX":e.set(s*u,l*f,l*p,s*c);break;case"YXY":e.set(l*p,s*u,l*f,s*c);break;case"ZYZ":e.set(l*f,l*p,s*u,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}},q=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;Object(h.a)(this,e),Object.defineProperty(this,"isVector2",{value:!0}),this.x=t,this.y=n}return Object(d.a)(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,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}},{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(){return Math.atan2(-this.y,-this.x)+Math.PI}},{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,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this}},{key:"toArray",value:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),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),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}},{key:"random",value:function(){return this.x=Math.random(),this.y=Math.random(),this}},{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}}]),e}(),X=function(){function e(){Object(h.a)(this,e),Object.defineProperty(this,"isMatrix3",{value:!0}),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 Object(d.a)(e,[{key:"set",value:function(e,t,n,i,r,a,o,s,l){var c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this}},{key:"identity",value:function(){return this.set(1,0,0,0,1,0,0,0,1),this}},{key:"clone",value:function(){return(new this.constructor).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],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,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],v=i[6],g=i[1],y=i[4],b=i[7],x=i[2],w=i[5],_=i[8];return r[0]=a*f+o*g+s*x,r[3]=a*m+o*y+s*w,r[6]=a*v+o*b+s*_,r[1]=l*f+c*g+u*x,r[4]=l*m+c*y+u*w,r[7]=l*v+c*b+u*_,r[2]=h*f+d*g+p*x,r[5]=h*m+d*y+p*w,r[8]=h*v+d*b+p*_,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],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8];return t*a*c-t*o*l-n*r*c+n*o*s+i*r*l-i*a*s}},{key:"getInverse",value:function(e,t){void 0!==t&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var n=e.elements,i=this.elements,r=n[0],a=n[1],o=n[2],s=n[3],l=n[4],c=n[5],u=n[6],h=n[7],d=n[8],p=d*l-c*h,f=c*u-d*s,m=h*s-l*u,v=r*p+a*f+o*m;if(0===v)return this.set(0,0,0,0,0,0,0,0,0);var g=1/v;return i[0]=p*g,i[1]=(o*h-d*a)*g,i[2]=(c*a-o*l)*g,i[3]=f*g,i[4]=(d*r-o*u)*g,i[5]=(o*s-c*r)*g,i[6]=m*g,i[7]=(a*u-h*r)*g,i[8]=(l*r-a*s)*g,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).getInverse(this).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,i,r,a,o){var s=Math.cos(r),l=Math.sin(r);this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-i*l,i*s,-i*(-l*a+s*o)+o+t,0,0,1)}},{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),i=this.elements,r=i[0],a=i[3],o=i[6],s=i[1],l=i[4],c=i[7];return i[0]=t*r+n*s,i[3]=t*a+n*l,i[6]=t*o+n*c,i[1]=-n*r+t*s,i[4]=-n*a+t*l,i[7]=-n*o+t*c,this}},{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,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}},{key:"fromArray",value:function(e,t){void 0===t&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}}]),e}(),Y={getDataURL: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===G&&(G=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),G.width=e.width,G.height=e.height;var n=G.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=G}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},J=0;function Z(e,t,n,i,r,a,o,s,l,c){Object.defineProperty(this,"id",{value:J++}),this.uuid=W.generateUUID(),this.name="",this.image=void 0!==e?e:Z.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:Z.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:1001,this.wrapT=void 0!==i?i:1001,this.magFilter=void 0!==r?r:1006,this.minFilter=void 0!==a?a:1008,this.anisotropy=void 0!==l?l:1,this.format=void 0!==o?o:1023,this.internalFormat=null,this.type=void 0!==s?s:1009,this.offset=new q(0,0),this.repeat=new q(1,1),this.center=new q(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new X,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==c?c:3e3,this.version=0,this.onUpdate=null}Z.DEFAULT_IMAGE=void 0,Z.DEFAULT_MAPPING=300,Z.prototype=Object.assign(Object.create(j.prototype),{constructor:Z,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var i=this.image;if(void 0===i.uuid&&(i.uuid=W.generateUUID()),!t&&void 0===e.images[i.uuid]){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a<o;a++)r.push(Y.getDataURL(i[a]))}else r=Y.getDataURL(i);e.images[i.uuid]={uuid:i.uuid,url:r}}n.image=i.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}}),Object.defineProperty(Z.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}});var K=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,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;Object(h.a)(this,e),Object.defineProperty(this,"isVector4",{value:!0}),this.x=t,this.y=n,this.z=i,this.w=r}return Object(d.a)(e,[{key:"set",value:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,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:"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,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}},{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,i,r,a=.01,o=.1,s=e.elements,l=s[0],c=s[4],u=s[8],h=s[1],d=s[5],p=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(c-h)<a&&Math.abs(u-f)<a&&Math.abs(p-m)<a){if(Math.abs(c+h)<o&&Math.abs(u+f)<o&&Math.abs(p+m)<o&&Math.abs(l+d+v-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var g=(l+1)/2,y=(d+1)/2,b=(v+1)/2,x=(c+h)/4,w=(u+f)/4,_=(p+m)/4;return g>y&&g>b?g<a?(n=0,i=.707106781,r=.707106781):(i=x/(n=Math.sqrt(g)),r=w/n):y>b?y<a?(n=.707106781,i=0,r=.707106781):(n=x/(i=Math.sqrt(y)),r=_/i):b<a?(n=.707106781,i=.707106781,r=0):(n=w/(r=Math.sqrt(b)),i=_/r),this.set(n,i,r,t),this}var M=Math.sqrt((m-p)*(m-p)+(u-f)*(u-f)+(h-c)*(h-c));return Math.abs(M)<.001&&(M=1),this.x=(m-p)/M,this.y=(u-f)/M,this.z=(h-c)/M,this.w=Math.acos((l+d+v-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,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}},{key:"toArray",value:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}},{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:"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}}]),e}();function Q(e,t,n){this.width=e,this.height=t,this.scissor=new K(0,0,e,t),this.scissorTest=!1,this.viewport=new K(0,0,e,t),n=n||{},this.texture=new Z(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:1006,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function $(e,t,n){Q.call(this,e,t,n),this.samples=4}Q.prototype=Object.assign(Object.create(j.prototype),{constructor:Q,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),$.prototype=Object.assign(Object.create(Q.prototype),{constructor:$,isWebGLMultisampleRenderTarget:!0,copy:function(e){return Q.prototype.copy.call(this,e),this.samples=e.samples,this}});var ee=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,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;Object(h.a)(this,e),Object.defineProperty(this,"isQuaternion",{value:!0}),this._x=t,this._y=n,this._z=i,this._w=r}return Object(d.a)(e,[{key:"set",value:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,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,i=e._y,r=e._z,a=e._order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(i/2),u=o(r/2),h=s(n/2),d=s(i/2),p=s(r/2);switch(a){case"XYZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"YZX":this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p;break;case"XZY":this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+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,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}},{key:"setFromRotationMatrix",value:function(e){var t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],s=t[9],l=t[2],c=t[6],u=t[10],h=n+o+u;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(c-s)*d,this._y=(r-l)*d,this._z=(a-i)*d}else if(n>o&&n>u){var p=2*Math.sqrt(1+n-o-u);this._w=(c-s)/p,this._x=.25*p,this._y=(i+a)/p,this._z=(r+l)/p}else if(o>u){var f=2*Math.sqrt(1+o-n-u);this._w=(r-l)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(s+c)/f}else{var m=2*Math.sqrt(1+u-n-o);this._w=(a-i)/m,this._x=(r+l)/m,this._y=(s+c)/m,this._z=.25*m}return this._onChangeCallback(),this}},{key:"setFromUnitVectors",value:function(e,t){var n=e.dot(t)+1;return n<1e-6?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(W.clamp(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"inverse",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,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+i*l-r*s,this._y=i*c+a*s+r*o-n*l,this._z=r*c+a*l+n*s-i*o,this._w=a*c-n*o-i*s-r*l,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*i+t*this._y,this._z=l*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var c=Math.sqrt(s),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),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,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}},{key:"toArray",value:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}},{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:"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:"slerp",value:function(e,t,n,i){return n.copy(e).slerp(t,i)}},{key:"slerpFlat",value:function(e,t,n,i,r,a,o){var s=n[i+0],l=n[i+1],c=n[i+2],u=n[i+3],h=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(u!==f||s!==h||l!==d||c!==p){var m=1-o,v=s*h+l*d+c*p+u*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var b=Math.sqrt(y),x=Math.atan2(b,v*g);m=Math.sin(m*x)/b,o=Math.sin(o*x)/b}var w=o*g;if(s=s*m+h*w,l=l*m+d*w,c=c*m+p*w,u=u*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=_,l*=_,c*=_,u*=_}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=u}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,i,r,a){var o=n[i],s=n[i+1],l=n[i+2],c=n[i+3],u=r[a],h=r[a+1],d=r[a+2],p=r[a+3];return e[t]=o*p+c*u+s*d-l*h,e[t+1]=s*p+c*h+l*u-o*d,e[t+2]=l*p+c*d+o*h-s*u,e[t+3]=c*p-o*u-s*h-l*d,e}}]),e}(),te=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,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;Object(h.a)(this,e),Object.defineProperty(this,"isVector3",{value:!0}),this.x=t,this.y=n,this.z=i}return Object(d.a)(e,[{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(ie.setFromEuler(e))}},{key:"applyAxisAngle",value:function(e,t){return this.applyQuaternion(ie.setFromAxisAngle(e,t))}},{key:"applyMatrix3",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}},{key:"applyNormalMatrix",value:function(e){return this.applyMatrix3(e).normalize()}},{key:"applyMatrix4",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}},{key:"applyQuaternion",value:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*i-o*n,c=s*n+o*t-r*i,u=s*i+r*n-a*t,h=-r*t-a*n-o*i;return this.x=l*s+h*-r+c*-o-u*-a,this.y=c*s+h*-a+u*-r-l*-o,this.z=u*s+h*-o+l*-a-c*-r,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,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}},{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,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this}},{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 ne.copy(this).projectOnVector(e),this.sub(ne)}},{key:"reflect",value:function(e){return this.sub(ne.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(W.clamp(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,i=this.z-e.z;return t*t+n*n+i*i}},{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 i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}},{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(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,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:"equals",value:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}},{key:"fromArray",value:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}},{key:"toArray",value:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}},{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}}]),e}(),ne=new te,ie=new ee,re=function(){function e(t,n){Object(h.a)(this,e),Object.defineProperty(this,"isBox3",{value:!0}),this.min=void 0!==t?t:new te(1/0,1/0,1/0),this.max=void 0!==n?n:new te(-1/0,-1/0,-1/0)}return Object(d.a)(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,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;s<l;s+=3){var c=e[s],u=e[s+1],h=e[s+2];c<t&&(t=c),u<n&&(n=u),h<i&&(i=h),c>r&&(r=c),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this}},{key:"setFromBufferAttribute",value:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;s<l;s++){var c=e.getX(s),u=e.getY(s),h=e.getZ(s);c<t&&(t=c),u<n&&(n=u),h<i&&(i=h),c>r&&(r=c),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,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=se.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}},{key:"setFromObject",value:function(e){return this.makeEmpty(),this.expandByObject(e)}},{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 void 0===e&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new te),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return void 0===e&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new te),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){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),le.copy(t.boundingBox),le.applyMatrix4(e.matrixWorld),this.union(le));for(var n=e.children,i=0,r=n.length;i<r;i++)this.expandByObject(n[i]);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 void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new te),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,se),se.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(me),ve.subVectors(this.max,me),ce.subVectors(e.a,me),ue.subVectors(e.b,me),he.subVectors(e.c,me),de.subVectors(ue,ce),pe.subVectors(he,ue),fe.subVectors(ce,he);var t=[0,-de.z,de.y,0,-pe.z,pe.y,0,-fe.z,fe.y,de.z,0,-de.x,pe.z,0,-pe.x,fe.z,0,-fe.x,-de.y,de.x,0,-pe.y,pe.x,0,-fe.y,fe.x,0];return!!ae(t,ce,ue,he,ve)&&(!!ae(t=[1,0,0,0,1,0,0,0,1],ce,ue,he,ve)&&(ge.crossVectors(de,pe),ae(t=[ge.x,ge.y,ge.z],ce,ue,he,ve)))}},{key:"clampPoint",value:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new te),t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return se.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"getBoundingSphere",value:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(se).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()||(oe[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),oe[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),oe[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),oe[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),oe[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),oe[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),oe[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),oe[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(oe)),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}();function ae(e,t,n,i,r){for(var a=0,o=e.length-3;a<=o;a+=3){ye.fromArray(e,a);var s=r.x*Math.abs(ye.x)+r.y*Math.abs(ye.y)+r.z*Math.abs(ye.z),l=t.dot(ye),c=n.dot(ye),u=i.dot(ye);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>s)return!1}return!0}var oe=[new te,new te,new te,new te,new te,new te,new te,new te],se=new te,le=new re,ce=new te,ue=new te,he=new te,de=new te,pe=new te,fe=new te,me=new te,ve=new te,ge=new te,ye=new te,be=new re,xe=function(){function e(t,n){Object(h.a)(this,e),this.center=void 0!==t?t:new te,this.radius=void 0!==n?n:-1}return Object(d.a)(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):be.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this}},{key:"clone",value:function(){return(new this.constructor).copy(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 void 0===t&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new te),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 void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new re),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:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}]),e}(),we=new te,_e=new te,Me=new te,Se=new te,Te=new te,Ee=new te,Ae=new te,Le=function(){function e(t,n){Object(h.a)(this,e),this.origin=void 0!==t?t:new te,this.direction=void 0!==n?n:new te(0,0,-1)}return Object(d.a)(e,[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"clone",value:function(){return(new this.constructor).copy(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 void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new te),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,we)),this}},{key:"closestPointToPoint",value:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new te),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=we.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(we.copy(this.direction).multiplyScalar(t).add(this.origin),we.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,i){_e.copy(e).add(t).multiplyScalar(.5),Me.copy(t).sub(e).normalize(),Se.copy(this.origin).sub(_e);var r,a,o,s,l=.5*e.distanceTo(t),c=-this.direction.dot(Me),u=Se.dot(this.direction),h=-Se.dot(Me),d=Se.lengthSq(),p=Math.abs(1-c*c);if(p>0)if(a=c*u-h,s=l*p,(r=c*h-u)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(r*=f)*(r+c*(a*=f)+2*u)+a*(c*r+a+2*h)+d}else a=l,o=-(r=Math.max(0,-(c*a+u)))*r+a*(a+2*h)+d;else a=-l,o=-(r=Math.max(0,-(c*a+u)))*r+a*(a+2*h)+d;else a<=-s?o=-(r=Math.max(0,-(-c*l+u)))*r+(a=r>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(r=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(r=Math.max(0,-(c*l+u)))*r+(a=r>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=c>0?-l:l,o=-(r=Math.max(0,-(c*a+u)))*r+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(Me).multiplyScalar(a).add(_e),o}},{key:"intersectSphere",value:function(e,t){we.subVectors(e.center,this.origin);var n=we.dot(this.direction),i=we.dot(we)-n*n,r=e.radius*e.radius;if(i>r)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)}},{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,i,r,a,o,s,l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),c>=0?(r=(e.min.y-h.y)*c,a=(e.max.y-h.y)*c):(r=(e.max.y-h.y)*c,a=(e.min.y-h.y)*c),n>a||r>i?null:((r>n||n!=n)&&(n=r),(a<i||i!=i)&&(i=a),u>=0?(o=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s<i||i!=i)&&(i=s),i<0?null:this.at(n>=0?n:i,t)))}},{key:"intersectsBox",value:function(e){return null!==this.intersectBox(e,we)}},{key:"intersectTriangle",value:function(e,t,n,i,r){Te.subVectors(t,e),Ee.subVectors(n,e),Ae.crossVectors(Te,Ee);var a,o=this.direction.dot(Ae);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Se.subVectors(this.origin,e);var s=a*this.direction.dot(Ee.crossVectors(Se,Ee));if(s<0)return null;var l=a*this.direction.dot(Te.cross(Se));if(l<0)return null;if(s+l>o)return null;var c=-a*Se.dot(Ae);return c<0?null:this.at(c/o,r)}},{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)}}]),e}(),ke=function(){function e(){Object(h.a)(this,e),Object.defineProperty(this,"isMatrix4",{value:!0}),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 Object(d.a)(e,[{key:"set",value:function(e,t,n,i,r,a,o,s,l,c,u,h,d,p,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=i,v[1]=r,v[5]=a,v[9]=o,v[13]=s,v[2]=l,v[6]=c,v[10]=u,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[15]=m,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:"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,i=1/Re.setFromMatrixColumn(e,0).length(),r=1/Re.setFromMatrixColumn(e,1).length(),a=1/Re.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}},{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,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),u=Math.sin(r);if("XYZ"===e.order){var h=a*c,d=a*u,p=o*c,f=o*u;t[0]=s*c,t[4]=-s*u,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 m=s*c,v=s*u,g=l*c,y=l*u;t[0]=m+y*o,t[4]=g*o-v,t[8]=a*l,t[1]=a*u,t[5]=a*c,t[9]=-o,t[2]=v*o-g,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){var b=s*c,x=s*u,w=l*c,_=l*u;t[0]=b-_*o,t[4]=-a*u,t[8]=w+x*o,t[1]=x+w*o,t[5]=a*c,t[9]=_-b*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){var M=a*c,S=a*u,T=o*c,E=o*u;t[0]=s*c,t[4]=T*l-S,t[8]=M*l+E,t[1]=s*u,t[5]=E*l+M,t[9]=S*l-T,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var A=a*s,L=a*l,k=o*s,R=o*l;t[0]=s*c,t[4]=R-A*u,t[8]=k*u+L,t[1]=u,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=L*u+k,t[10]=A-R*u}else if("XZY"===e.order){var O=a*s,C=a*l,P=o*s,I=o*l;t[0]=s*c,t[4]=-u,t[8]=l*c,t[1]=O*u+I,t[5]=a*c,t[9]=C*u-P,t[2]=P*u-C,t[6]=o*c,t[10]=I*u+O}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(Ce,e,Pe)}},{key:"lookAt",value:function(e,t,n){var i=this.elements;return Ne.subVectors(e,t),0===Ne.lengthSq()&&(Ne.z=1),Ne.normalize(),Ie.crossVectors(n,Ne),0===Ie.lengthSq()&&(1===Math.abs(n.z)?Ne.x+=1e-4:Ne.z+=1e-4,Ne.normalize(),Ie.crossVectors(n,Ne)),Ie.normalize(),De.crossVectors(Ne,Ie),i[0]=Ie.x,i[4]=De.x,i[8]=Ne.x,i[1]=Ie.y,i[5]=De.y,i[9]=Ne.y,i[2]=Ie.z,i[6]=De.z,i[10]=Ne.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,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],b=n[11],x=n[15],w=i[0],_=i[4],M=i[8],S=i[12],T=i[1],E=i[5],A=i[9],L=i[13],k=i[2],R=i[6],O=i[10],C=i[14],P=i[3],I=i[7],D=i[11],N=i[15];return r[0]=a*w+o*T+s*k+l*P,r[4]=a*_+o*E+s*R+l*I,r[8]=a*M+o*A+s*O+l*D,r[12]=a*S+o*L+s*C+l*N,r[1]=c*w+u*T+h*k+d*P,r[5]=c*_+u*E+h*R+d*I,r[9]=c*M+u*A+h*O+d*D,r[13]=c*S+u*L+h*C+d*N,r[2]=p*w+f*T+m*k+v*P,r[6]=p*_+f*E+m*R+v*I,r[10]=p*M+f*A+m*O+v*D,r[14]=p*S+f*L+m*C+v*N,r[3]=g*w+y*T+b*k+x*P,r[7]=g*_+y*E+b*R+x*I,r[11]=g*M+y*A+b*O+x*D,r[15]=g*S+y*L+b*C+x*N,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],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],l=e[13],c=e[2],u=e[6],h=e[10],d=e[14];return e[3]*(+r*s*u-i*l*u-r*o*h+n*l*h+i*o*d-n*s*d)+e[7]*(+t*s*d-t*l*h+r*a*h-i*a*d+i*l*c-r*s*c)+e[11]*(+t*l*u-t*o*d-r*a*u+n*a*d+r*o*c-n*l*c)+e[15]*(-i*o*c-t*s*u+t*o*h+i*a*u-n*a*h+n*s*c)}},{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 i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}},{key:"getInverse",value:function(e,t){void 0!==t&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var n=this.elements,i=e.elements,r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],c=i[5],u=i[6],h=i[7],d=i[8],p=i[9],f=i[10],m=i[11],v=i[12],g=i[13],y=i[14],b=i[15],x=p*y*h-g*f*h+g*u*m-c*y*m-p*u*b+c*f*b,w=v*f*h-d*y*h-v*u*m+l*y*m+d*u*b-l*f*b,_=d*g*h-v*p*h+v*c*m-l*g*m-d*c*b+l*p*b,M=v*p*u-d*g*u-v*c*f+l*g*f+d*c*y-l*p*y,S=r*x+a*w+o*_+s*M;if(0===S)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var T=1/S;return n[0]=x*T,n[1]=(g*f*s-p*y*s-g*o*m+a*y*m+p*o*b-a*f*b)*T,n[2]=(c*y*s-g*u*s+g*o*h-a*y*h-c*o*b+a*u*b)*T,n[3]=(p*u*s-c*f*s-p*o*h+a*f*h+c*o*m-a*u*m)*T,n[4]=w*T,n[5]=(d*y*s-v*f*s+v*o*m-r*y*m-d*o*b+r*f*b)*T,n[6]=(v*u*s-l*y*s-v*o*h+r*y*h+l*o*b-r*u*b)*T,n[7]=(l*f*s-d*u*s+d*o*h-r*f*h-l*o*m+r*u*m)*T,n[8]=_*T,n[9]=(v*p*s-d*g*s-v*a*m+r*g*m+d*a*b-r*p*b)*T,n[10]=(l*g*s-v*c*s+v*a*h-r*g*h-l*a*b+r*c*b)*T,n[11]=(d*c*s-l*p*s-d*a*h+r*p*h+l*a*m-r*c*m)*T,n[12]=M*T,n[13]=(d*g*o-v*p*o+v*a*f-r*g*f-d*a*y+r*p*y)*T,n[14]=(v*c*o-l*g*o-v*a*u+r*g*u+l*a*y-r*c*y)*T,n[15]=(l*p*o-d*c*o+d*a*u-r*p*u-l*a*f+r*c*f)*T,this}},{key:"scale",value:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}},{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],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}},{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),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,l=r*a,c=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,c*o+n,c*s-i*a,0,l*s-i*o,c*s+i*a,r*s*s+n,0,0,0,0,1),this}},{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){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this}},{key:"compose",value:function(e,t,n){var i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,l=r+r,c=a+a,u=o+o,h=r*l,d=r*c,p=r*u,f=a*c,m=a*u,v=o*u,g=s*l,y=s*c,b=s*u,x=n.x,w=n.y,_=n.z;return i[0]=(1-(f+v))*x,i[1]=(d+b)*x,i[2]=(p-y)*x,i[3]=0,i[4]=(d-b)*w,i[5]=(1-(h+v))*w,i[6]=(m+g)*w,i[7]=0,i[8]=(p+y)*_,i[9]=(m-g)*_,i[10]=(1-(h+f))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}},{key:"decompose",value:function(e,t,n){var i=this.elements,r=Re.set(i[0],i[1],i[2]).length(),a=Re.set(i[4],i[5],i[6]).length(),o=Re.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Oe.copy(this);var s=1/r,l=1/a,c=1/o;return Oe.elements[0]*=s,Oe.elements[1]*=s,Oe.elements[2]*=s,Oe.elements[4]*=l,Oe.elements[5]*=l,Oe.elements[6]*=l,Oe.elements[8]*=c,Oe.elements[9]*=c,Oe.elements[10]*=c,t.setFromRotationMatrix(Oe),n.x=r,n.y=a,n.z=o,this}},{key:"makePerspective",value:function(e,t,n,i,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(t-e),l=2*r/(n-i),c=(t+e)/(t-e),u=(n+i)/(n-i),h=-(a+r)/(a-r),d=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=u,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,i,r,a){var o=this.elements,s=1/(t-e),l=1/(n-i),c=1/(a-r),u=(t+e)*s,h=(n+i)*l,d=(a+r)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*c,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,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}},{key:"fromArray",value:function(e,t){void 0===t&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this}},{key:"toArray",value:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}]),e}(),Re=new te,Oe=new ke,Ce=new te(0,0,0),Pe=new te(1,1,1),Ie=new te,De=new te,Ne=new te,Fe=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,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.DefaultOrder;Object(h.a)(this,e),Object.defineProperty(this,"isEuler",{value:!0}),this._x=t,this._y=n,this._z=i,this._order=r}return Object(d.a)(e,[{key:"set",value:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,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,t,n){var i=W.clamp,r=e.elements,a=r[0],o=r[4],s=r[8],l=r[1],c=r[5],u=r[9],h=r[2],d=r[6],p=r[10];switch(t=t||this._order){case"XYZ":this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!1!==n&&this._onChangeCallback(),this}},{key:"setFromQuaternion",value:function(e,t,n){return Ue.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ue,t,n)}},{key:"setFromVector3",value:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)}},{key:"reorder",value:function(e){return ze.setFromEuler(this),this.setFromQuaternion(ze,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(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}},{key:"toVector3",value:function(e){return e?e.set(this._x,this._y,this._z):new te(this._x,this._y,this._z)}},{key:"_onChange",value:function(e){return this._onChangeCallback=e,this}},{key:"_onChangeCallback",value:function(){}},{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()}}]),e}();Fe.DefaultOrder="XYZ",Fe.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var Ue=new ke,ze=new ee,je=function(){function e(){Object(h.a)(this,e),this.mask=1}return Object(d.a)(e,[{key:"set",value:function(e){this.mask=1<<e|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)}}]),e}(),Be=0,He=new te,Ge=new ee,Ve=new ke,We=new te,qe=new te,Xe=new te,Ye=new ee,Je=new te(1,0,0),Ze=new te(0,1,0),Ke=new te(0,0,1),Qe={type:"added"},$e={type:"removed"};function et(){Object.defineProperty(this,"id",{value:Be++}),this.uuid=W.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=et.DefaultUp.clone();var e=new te,t=new Fe,n=new ee,i=new te(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new ke},normalMatrix:{value:new X}}),this.matrix=new ke,this.matrixWorld=new ke,this.matrixAutoUpdate=et.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new je,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}et.DefaultUp=new te(0,1,0),et.DefaultMatrixAutoUpdate=!0,et.prototype=Object.assign(Object.create(j.prototype),{constructor:et,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return Ge.setFromAxisAngle(e,t),this.quaternion.multiply(Ge),this},rotateOnWorldAxis:function(e,t){return Ge.setFromAxisAngle(e,t),this.quaternion.premultiply(Ge),this},rotateX:function(e){return this.rotateOnAxis(Je,e)},rotateY:function(e){return this.rotateOnAxis(Ze,e)},rotateZ:function(e){return this.rotateOnAxis(Ke,e)},translateOnAxis:function(e,t){return He.copy(e).applyQuaternion(this.quaternion),this.position.add(He.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(Je,e)},translateY:function(e){return this.translateOnAxis(Ze,e)},translateZ:function(e){return this.translateOnAxis(Ke,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(Ve.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?We.copy(e):We.set(e,t,n);var i=this.parent;this.updateWorldMatrix(!0,!1),qe.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ve.lookAt(qe,We,this.up):Ve.lookAt(We,qe,this.up),this.quaternion.setFromRotationMatrix(Ve),i&&(Ve.extractRotation(i.matrixWorld),Ge.setFromRotationMatrix(Ve),this.quaternion.premultiply(Ge.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Qe)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return-1!==n&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent($e)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),Ve.getInverse(this.matrixWorld),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Ve.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ve),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n].getObjectByProperty(e,t);if(void 0!==r)return r}},getWorldPosition:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new te),this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new ee),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(qe,e,Xe),e},getWorldScale:function(e){return void 0===e&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new te),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(qe,Ye,e),e},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new te),this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverse(e)},traverseVisible:function(e){if(!1!==this.visible){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t)for(var i=this.children,r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON()),this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);var a=this.geometry.parameters;if(void 0!==a&&void 0!==a.shapes){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var c=o[s];r(e.shapes,c)}else r(e.shapes,o)}}if(void 0!==this.material)if(Array.isArray(this.material)){for(var u=[],h=0,d=this.material.length;h<d;h++)u.push(r(e.materials,this.material[h]));i.material=u}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(var p=0;p<this.children.length;p++)i.children.push(this.children[p].toJSON(e).object)}if(t){var f=b(e.geometries),m=b(e.materials),v=b(e.textures),g=b(e.images),y=b(e.shapes);f.length>0&&(n.geometries=f),m.length>0&&(n.materials=m),v.length>0&&(n.textures=v),g.length>0&&(n.images=g),y.length>0&&(n.shapes=y)}return n.object=i,n;function b(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.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 i=e.children[n];this.add(i.clone())}return this}});var tt=new te,nt=new te,it=new X,rt=function(){function e(t,n){Object(h.a)(this,e),Object.defineProperty(this,"isPlane",{value:!0}),this.normal=void 0!==t?t:new te(1,0,0),this.constant=void 0!==n?n:0}return Object(d.a)(e,[{key:"set",value:function(e,t){return this.normal.copy(e),this.constant=t,this}},{key:"setComponents",value:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,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 i=tt.subVectors(n,t).cross(nt.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}},{key:"clone",value:function(){return(new this.constructor).copy(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 void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new te),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}},{key:"intersectLine",value:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new te);var n=e.delta(tt),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?void 0:t.copy(n).multiplyScalar(r).add(e.start)}},{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 void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new te),e.copy(this.normal).multiplyScalar(-this.constant)}},{key:"applyMatrix4",value:function(e,t){var n=t||it.getNormalMatrix(e),i=this.coplanarPoint(tt).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),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}}]),e}(),at=new te,ot=new te,st=new te,lt=new te,ct=new te,ut=new te,ht=new te,dt=new te,pt=new te,ft=new te,mt=function(){function e(t,n,i){Object(h.a)(this,e),this.a=void 0!==t?t:new te,this.b=void 0!==n?n:new te,this.c=void 0!==i?i:new te}return Object(d.a)(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,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),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 at.subVectors(this.c,this.b),ot.subVectors(this.a,this.b),.5*at.cross(ot).length()}},{key:"getMidpoint",value:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new te),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 void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new rt),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,i,r,a){return e.getUV(t,this.a,this.b,this.c,n,i,r,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){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new te);var n,i,r=this.a,a=this.b,o=this.c;ct.subVectors(a,r),ut.subVectors(o,r),dt.subVectors(e,r);var s=ct.dot(dt),l=ut.dot(dt);if(s<=0&&l<=0)return t.copy(r);pt.subVectors(e,a);var c=ct.dot(pt),u=ut.dot(pt);if(c>=0&&u<=c)return t.copy(a);var h=s*u-c*l;if(h<=0&&s>=0&&c<=0)return n=s/(s-c),t.copy(r).addScaledVector(ct,n);ft.subVectors(e,o);var d=ct.dot(ft),p=ut.dot(ft);if(p>=0&&d<=p)return t.copy(o);var f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return i=l/(l-p),t.copy(r).addScaledVector(ut,i);var m=c*p-d*u;if(m<=0&&u-c>=0&&d-p>=0)return ht.subVectors(o,a),i=(u-c)/(u-c+(d-p)),t.copy(a).addScaledVector(ht,i);var v=1/(m+f+h);return n=f*v,i=h*v,t.copy(r).addScaledVector(ct,n).addScaledVector(ut,i)}},{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,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new te),i.subVectors(n,t),at.subVectors(e,t),i.cross(at);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}},{key:"getBarycoord",value:function(e,t,n,i,r){at.subVectors(i,t),ot.subVectors(n,t),st.subVectors(e,t);var a=at.dot(at),o=at.dot(ot),s=at.dot(st),l=ot.dot(ot),c=ot.dot(st),u=a*l-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new te),0===u)return r.set(-2,-1,-1);var h=1/u,d=(l*s-o*c)*h,p=(a*c-o*s)*h;return r.set(1-d-p,p,d)}},{key:"containsPoint",value:function(e,t,n,i){return this.getBarycoord(e,t,n,i,lt),lt.x>=0&&lt.y>=0&&lt.x+lt.y<=1}},{key:"getUV",value:function(e,t,n,i,r,a,o,s){return this.getBarycoord(e,t,n,i,lt),s.set(0,0),s.addScaledVector(r,lt.x),s.addScaledVector(a,lt.y),s.addScaledVector(o,lt.z),s}},{key:"isFrontFacing",value:function(e,t,n,i){return at.subVectors(n,t),ot.subVectors(e,t),at.cross(ot).dot(i)<0}}]),e}(),vt={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},gt={h:0,s:0,l:0},yt={h:0,s:0,l:0};function bt(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 xt(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function wt(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}var _t=function(){function e(t,n,i){return Object(h.a)(this,e),Object.defineProperty(this,"isColor",{value:!0}),void 0===n&&void 0===i?this.set(t):this.setRGB(t,n,i)}return Object(d.a)(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){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}},{key:"setRGB",value:function(e,t,n){return this.r=e,this.g=t,this.b=n,this}},{key:"setHSL",value:function(e,t,n){if(e=W.euclideanModulo(e,1),t=W.clamp(t,0,1),n=W.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=bt(r,i,e+1/3),this.g=bt(r,i,e),this.b=bt(r,i,e-1/3)}return this}},{key:"setStyle",value:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],a=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(o,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var c=n[1],u=c.length;if(3===u)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}},{key:"setColorName",value:function(e){var t=vt[e];return void 0!==t?this.setHex(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:"copyGammaToLinear",value:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}},{key:"copyLinearToGamma",value:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this}},{key:"convertGammaToLinear",value:function(e){return this.copyGammaToLinear(this,e),this}},{key:"convertLinearToGamma",value:function(e){return this.copyLinearToGamma(this,e),this}},{key:"copySRGBToLinear",value:function(e){return this.r=xt(e.r),this.g=xt(e.g),this.b=xt(e.b),this}},{key:"copyLinearToSRGB",value:function(e){return this.r=wt(e.r),this.g=wt(e.g),this.b=wt(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(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}},{key:"getHexString",value:function(){return("000000"+this.getHex().toString(16)).slice(-6)}},{key:"getHSL",value:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,i=this.r,r=this.g,a=this.b,o=Math.max(i,r,a),s=Math.min(i,r,a),l=(s+o)/2;if(s===o)t=0,n=0;else{var c=o-s;switch(n=l<=.5?c/(o+s):c/(2-o-s),o){case i:t=(r-a)/c+(r<a?6:0);break;case r:t=(a-i)/c+2;break;case a:t=(i-r)/c+4}t/=6}return e.h=t,e.s=n,e.l=l,e}},{key:"getStyle",value:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}},{key:"offsetHSL",value:function(e,t,n){return this.getHSL(gt),gt.h+=e,gt.s+=t,gt.l+=n,this.setHSL(gt.h,gt.s,gt.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:"lerpHSL",value:function(e,t){this.getHSL(gt),e.getHSL(yt);var n=W.lerp(gt.h,yt.h,t),i=W.lerp(gt.s,yt.s,t),r=W.lerp(gt.l,yt.l,t);return this.setHSL(n,i,r),this}},{key:"equals",value:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}},{key:"fromArray",value:function(e,t){return void 0===t&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}},{key:"toArray",value:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}},{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}();_t.NAMES=vt,_t.prototype.r=1,_t.prototype.g=1,_t.prototype.b=1;var Mt=function(){function e(t,n,i,r,a,o){Object(h.a)(this,e),this.a=t,this.b=n,this.c=i,this.normal=r&&r.isVector3?r:new te,this.vertexNormals=Array.isArray(r)?r:[],this.color=a&&a.isColor?a:new _t,this.vertexColors=Array.isArray(a)?a:[],this.materialIndex=void 0!==o?o:0}return Object(d.a)(e,[{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var i=0,r=e.vertexColors.length;i<r;i++)this.vertexColors[i]=e.vertexColors[i].clone();return this}}]),e}(),St=0;function Tt(){Object.defineProperty(this,"id",{value:St++}),this.uuid=W.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}function Et(e){Tt.call(this),this.type="MeshBasicMaterial",this.color=new _t(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(e)}Tt.prototype=Object.assign(Object.create(j.prototype),{constructor:Tt,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Tt.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Et.prototype=Object.create(Tt.prototype),Et.prototype.constructor=Et,Et.prototype.isMeshBasicMaterial=!0,Et.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var At=new te,Lt=new q;function kt(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=!0===n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}function Rt(e,t,n){kt.call(this,new Int8Array(e),t,n)}function Ot(e,t,n){kt.call(this,new Uint8Array(e),t,n)}function Ct(e,t,n){kt.call(this,new Uint8ClampedArray(e),t,n)}function Pt(e,t,n){kt.call(this,new Int16Array(e),t,n)}function It(e,t,n){kt.call(this,new Uint16Array(e),t,n)}function Dt(e,t,n){kt.call(this,new Int32Array(e),t,n)}function Nt(e,t,n){kt.call(this,new Uint32Array(e),t,n)}function Ft(e,t,n){kt.call(this,new Float32Array(e),t,n)}function Ut(e,t,n){kt.call(this,new Float64Array(e),t,n)}Object.defineProperty(kt.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(kt.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new _t),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new q),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new te),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new K),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){if(2===this.itemSize)for(var t=0,n=this.count;t<n;t++)Lt.fromBufferAttribute(this,t),Lt.applyMatrix3(e),this.setXY(t,Lt.x,Lt.y);else if(3===this.itemSize)for(var i=0,r=this.count;i<r;i++)At.fromBufferAttribute(this,i),At.applyMatrix3(e),this.setXYZ(i,At.x,At.y,At.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)At.x=this.getX(t),At.y=this.getY(t),At.z=this.getZ(t),At.applyMatrix4(e),this.setXYZ(t,At.x,At.y,At.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)At.x=this.getX(t),At.y=this.getY(t),At.z=this.getZ(t),At.applyNormalMatrix(e),this.setXYZ(t,At.x,At.y,At.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)At.x=this.getX(t),At.y=this.getY(t),At.z=this.getZ(t),At.transformDirection(e),this.setXYZ(t,At.x,At.y,At.z);return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}}),Rt.prototype=Object.create(kt.prototype),Rt.prototype.constructor=Rt,Ot.prototype=Object.create(kt.prototype),Ot.prototype.constructor=Ot,Ct.prototype=Object.create(kt.prototype),Ct.prototype.constructor=Ct,Pt.prototype=Object.create(kt.prototype),Pt.prototype.constructor=Pt,It.prototype=Object.create(kt.prototype),It.prototype.constructor=It,Dt.prototype=Object.create(kt.prototype),Dt.prototype.constructor=Dt,Nt.prototype=Object.create(kt.prototype),Nt.prototype.constructor=Nt,Ft.prototype=Object.create(kt.prototype),Ft.prototype.constructor=Ft,Ut.prototype=Object.create(kt.prototype),Ut.prototype.constructor=Ut;var zt=function(){function e(){Object(h.a)(this,e),this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}return Object(d.a)(e,[{key:"computeGroups",value:function(e){var t,n,i=[],r=void 0,a=e.faces;for(n=0;n<a.length;n++){var o=a[n];o.materialIndex!==r&&(r=o.materialIndex,void 0!==t&&(t.count=3*n-t.start,i.push(t)),t={start:3*n,materialIndex:r})}void 0!==t&&(t.count=3*n-t.start,i.push(t)),this.groups=i}},{key:"fromGeometry",value:function(e){var t,n=e.faces,i=e.vertices,r=e.faceVertexUvs,a=r[0]&&r[0].length>0,o=r[1]&&r[1].length>0,s=e.morphTargets,l=s.length;if(l>0){t=[];for(var c=0;c<l;c++)t[c]={name:s[c].name,data:[]};this.morphTargets.position=t}var u,h=e.morphNormals,d=h.length;if(d>0){u=[];for(var p=0;p<d;p++)u[p]={name:h[p].name,data:[]};this.morphTargets.normal=u}var f=e.skinIndices,m=e.skinWeights,v=f.length===i.length,g=m.length===i.length;i.length>0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var y=0;y<n.length;y++){var b=n[y];this.vertices.push(i[b.a],i[b.b],i[b.c]);var x=b.vertexNormals;if(3===x.length)this.normals.push(x[0],x[1],x[2]);else{var w=b.normal;this.normals.push(w,w,w)}var _=b.vertexColors;if(3===_.length)this.colors.push(_[0],_[1],_[2]);else{var M=b.color;this.colors.push(M,M,M)}if(!0===a){var S=r[0][y];void 0!==S?this.uvs.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",y),this.uvs.push(new q,new q,new q))}if(!0===o){var T=r[1][y];void 0!==T?this.uvs2.push(T[0],T[1],T[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",y),this.uvs2.push(new q,new q,new q))}for(var E=0;E<l;E++){var A=s[E].vertices;t[E].data.push(A[b.a],A[b.b],A[b.c])}for(var L=0;L<d;L++){var k=h[L].vertexNormals[y];u[L].data.push(k.a,k.b,k.c)}v&&this.skinIndices.push(f[b.a],f[b.b],f[b.c]),g&&this.skinWeights.push(m[b.a],m[b.b],m[b.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this}}]),e}();function jt(e){if(0===e.length)return-1/0;for(var t=e[0],n=1,i=e.length;n<i;++n)e[n]>t&&(t=e[n]);return t}var Bt=1,Ht=new ke,Gt=new et,Vt=new te,Wt=new re,qt=new re,Xt=new te;function Yt(){Object.defineProperty(this,"id",{value:Bt+=2}),this.uuid=W.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}Yt.prototype=Object.assign(Object.create(j.prototype),{constructor:Yt,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){return Array.isArray(e)?this.index=new(jt(e)>65535?Nt:It)(e,1):this.index=e,this},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var i=(new X).getNormalMatrix(e);n.applyNormalMatrix(i),n.needsUpdate=!0}var r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(e),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return Ht.makeRotationX(e),this.applyMatrix4(Ht),this},rotateY:function(e){return Ht.makeRotationY(e),this.applyMatrix4(Ht),this},rotateZ:function(e){return Ht.makeRotationZ(e),this.applyMatrix4(Ht),this},translate:function(e,t,n){return Ht.makeTranslation(e,t,n),this.applyMatrix4(Ht),this},scale:function(e,t,n){return Ht.makeScale(e,t,n),this.applyMatrix4(Ht),this},lookAt:function(e){return Gt.lookAt(e),Gt.updateMatrix(),this.applyMatrix4(Gt.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Vt).negate(),this.translate(Vt.x,Vt.y,Vt.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new Ft(3*t.vertices.length,3),i=new Ft(3*t.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new Ft(t.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Ft(t,3)),this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var n=t.__directGeometry;if(!0===t.elementsNeedUpdate&&(n=void 0,t.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(t);n.verticesNeedUpdate=t.verticesNeedUpdate,n.normalsNeedUpdate=t.normalsNeedUpdate,n.colorsNeedUpdate=t.colorsNeedUpdate,n.uvsNeedUpdate=t.uvsNeedUpdate,n.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=n}if(!0===t.verticesNeedUpdate){var i=this.attributes.position;void 0!==i&&(i.copyVector3sArray(t.vertices),i.needsUpdate=!0),t.verticesNeedUpdate=!1}if(!0===t.normalsNeedUpdate){var r=this.attributes.normal;void 0!==r&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1}if(!0===t.colorsNeedUpdate){var a=this.attributes.color;void 0!==a&&(a.copyColorsArray(t.colors),a.needsUpdate=!0),t.colorsNeedUpdate=!1}if(t.uvsNeedUpdate){var o=this.attributes.uv;void 0!==o&&(o.copyVector2sArray(t.uvs),o.needsUpdate=!0),t.uvsNeedUpdate=!1}if(t.lineDistancesNeedUpdate){var s=this.attributes.lineDistance;void 0!==s&&(s.copyArray(t.lineDistances),s.needsUpdate=!0),t.lineDistancesNeedUpdate=!1}return t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=(new zt).fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(3*e.vertices.length);if(this.setAttribute("position",new kt(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(3*e.normals.length);this.setAttribute("normal",new kt(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.setAttribute("color",new kt(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new kt(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new kt(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],l=e.morphTargets[o],c=0,u=l.length;c<u;c++){var h=l[c],d=new Ft(3*h.data.length,3);d.name=h.name,s.push(d.copyVector3sArray(h.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var p=new Ft(4*e.skinIndices.length,4);this.setAttribute("skinIndex",p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new Ft(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new re);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 te(-1/0,-1/0,-1/0),new te(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n<i;n++){var r=t[n];Wt.setFromBufferAttribute(r),this.morphTargetsRelative?(Xt.addVectors(this.boundingBox.min,Wt.min),this.boundingBox.expandByPoint(Xt),Xt.addVectors(this.boundingBox.max,Wt.max),this.boundingBox.expandByPoint(Xt)):(this.boundingBox.expandByPoint(Wt.min),this.boundingBox.expandByPoint(Wt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new xe);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 te,1/0);if(e){var n=this.boundingSphere.center;if(Wt.setFromBufferAttribute(e),t)for(var i=0,r=t.length;i<r;i++){var a=t[i];qt.setFromBufferAttribute(a),this.morphTargetsRelative?(Xt.addVectors(Wt.min,qt.min),Wt.expandByPoint(Xt),Xt.addVectors(Wt.max,qt.max),Wt.expandByPoint(Xt)):(Wt.expandByPoint(qt.min),Wt.expandByPoint(qt.max))}Wt.getCenter(n);for(var o=0,s=0,l=e.count;s<l;s++)Xt.fromBufferAttribute(e,s),o=Math.max(o,n.distanceToSquared(Xt));if(t)for(var c=0,u=t.length;c<u;c++)for(var h=t[c],d=this.morphTargetsRelative,p=0,f=h.count;p<f;p++)Xt.fromBufferAttribute(h,p),d&&(Vt.fromBufferAttribute(e,p),Xt.add(Vt)),o=Math.max(o,n.distanceToSquared(Xt));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.getAttribute("position");if(void 0!==t){var n=this.getAttribute("normal");if(void 0===n)n=new kt(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(var i=0,r=n.count;i<r;i++)n.setXYZ(i,0,0,0);var a=new te,o=new te,s=new te,l=new te,c=new te,u=new te,h=new te,d=new te;if(e)for(var p=0,f=e.count;p<f;p+=3){var m=e.getX(p+0),v=e.getX(p+1),g=e.getX(p+2);a.fromBufferAttribute(t,m),o.fromBufferAttribute(t,v),s.fromBufferAttribute(t,g),h.subVectors(s,o),d.subVectors(a,o),h.cross(d),l.fromBufferAttribute(n,m),c.fromBufferAttribute(n,v),u.fromBufferAttribute(n,g),l.add(h),c.add(h),u.add(h),n.setXYZ(m,l.x,l.y,l.z),n.setXYZ(v,c.x,c.y,c.z),n.setXYZ(g,u.x,u.y,u.z)}else for(var y=0,b=t.count;y<b;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}},merge:function(e,t){if(e&&e.isBufferGeometry){void 0===t&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var i in n)if(void 0!==e.attributes[i])for(var r=n[i].array,a=e.attributes[i],o=a.array,s=a.itemSize*t,l=Math.min(o.length,r.length-s),c=0,u=s;c<l;c++,u++)r[u]=o[c];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)Xt.fromBufferAttribute(e,t),Xt.normalize(),e.setXYZ(t,Xt.x,Xt.y,Xt.z)},toNonIndexed:function(){function e(e,t){for(var n=e.array,i=e.itemSize,r=e.normalized,a=new n.constructor(t.length*i),o=0,s=0,l=0,c=t.length;l<c;l++){o=t[l]*i;for(var u=0;u<i;u++)a[s++]=n[o++]}return new kt(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Yt,n=this.index.array,i=this.attributes;for(var r in i){var a=e(i[r],n);t.setAttribute(r,a)}var o=this.morphAttributes;for(var s in o){for(var l=[],c=o[s],u=0,h=c.length;u<h;u++){var d=e(c[u],n);l.push(d)}t.morphAttributes[s]=l}t.morphTargetsRelative=this.morphTargetsRelative;for(var p=this.groups,f=0,m=p.length;f<m;f++){var v=p[f];t.addGroup(v.start,v.count,v.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var a in r){var o=r[a],s=o.toJSON(e.data);""!==o.name&&(s.name=o.name),e.data.attributes[a]=s}var l={},c=!1;for(var u in this.morphAttributes){for(var h=this.morphAttributes[u],d=[],p=0,f=h.length;p<f;p++){var m=h[p],v=m.toJSON(e.data);""!==m.name&&(v.name=m.name),d.push(v)}d.length>0&&(l[u]=d,c=!0)}c&&(e.data.morphAttributes=l,e.data.morphTargetsRelative=this.morphTargetsRelative);var g=this.groups;g.length>0&&(e.data.groups=JSON.parse(JSON.stringify(g)));var y=this.boundingSphere;return null!==y&&(e.data.boundingSphere={center:y.center.toArray(),radius:y.radius}),e},clone:function(){return(new Yt).copy(this)},copy: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 i=e.attributes;for(var r in i){var a=i[r];this.setAttribute(r,a.clone(t))}var o=e.morphAttributes;for(var s in o){for(var l=[],c=o[s],u=0,h=c.length;u<h;u++)l.push(c[u].clone(t));this.morphAttributes[s]=l}this.morphTargetsRelative=e.morphTargetsRelative;for(var d=e.groups,p=0,f=d.length;p<f;p++){var m=d[p];this.addGroup(m.start,m.count,m.materialIndex)}var v=e.boundingBox;null!==v&&(this.boundingBox=v.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,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Jt=new ke,Zt=new Le,Kt=new xe,Qt=new te,$t=new te,en=new te,tn=new te,nn=new te,rn=new te,an=new te,on=new te,sn=new te,ln=new q,cn=new q,un=new q,hn=new te,dn=new te;function pn(e,t){et.call(this),this.type="Mesh",this.geometry=void 0!==e?e:new Yt,this.material=void 0!==t?t:new Et,this.updateMorphTargets()}function fn(e,t,n,i,r,a,o,s){if(null===(1===t.side?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,2!==t.side,s)))return null;dn.copy(s),dn.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(dn);return l<n.near||l>n.far?null:{distance:l,point:dn.clone(),object:e}}function mn(e,t,n,i,r,a,o,s,l,c,u,h){Qt.fromBufferAttribute(r,c),$t.fromBufferAttribute(r,u),en.fromBufferAttribute(r,h);var d=e.morphTargetInfluences;if(t.morphTargets&&a&&d){an.set(0,0,0),on.set(0,0,0),sn.set(0,0,0);for(var p=0,f=a.length;p<f;p++){var m=d[p],v=a[p];0!==m&&(tn.fromBufferAttribute(v,c),nn.fromBufferAttribute(v,u),rn.fromBufferAttribute(v,h),o?(an.addScaledVector(tn,m),on.addScaledVector(nn,m),sn.addScaledVector(rn,m)):(an.addScaledVector(tn.sub(Qt),m),on.addScaledVector(nn.sub($t),m),sn.addScaledVector(rn.sub(en),m)))}Qt.add(an),$t.add(on),en.add(sn)}e.isSkinnedMesh&&(e.boneTransform(c,Qt),e.boneTransform(u,$t),e.boneTransform(h,en));var g=fn(e,t,n,i,Qt,$t,en,hn);if(g){s&&(ln.fromBufferAttribute(s,c),cn.fromBufferAttribute(s,u),un.fromBufferAttribute(s,h),g.uv=mt.getUV(hn,Qt,$t,en,ln,cn,un,new q)),l&&(ln.fromBufferAttribute(l,c),cn.fromBufferAttribute(l,u),un.fromBufferAttribute(l,h),g.uv2=mt.getUV(hn,Qt,$t,en,ln,cn,un,new q));var y=new Mt(c,u,h);mt.getNormal(Qt,$t,en,y.normal),g.face=y}return g}pn.prototype=Object.assign(Object.create(et.prototype),{constructor:pn,isMesh:!0,copy:function(e){return et.prototype.copy.call(this,e),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this},updateMorphTargets:function(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(n.length>0){var i=t[n[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,a=i.length;r<a;r++){var o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}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.")}},raycast:function(e,t){var n,i=this.geometry,r=this.material,a=this.matrixWorld;if(void 0!==r&&(null===i.boundingSphere&&i.computeBoundingSphere(),Kt.copy(i.boundingSphere),Kt.applyMatrix4(a),!1!==e.ray.intersectsSphere(Kt)&&(Jt.getInverse(a),Zt.copy(e.ray).applyMatrix4(Jt),null===i.boundingBox||!1!==Zt.intersectsBox(i.boundingBox))))if(i.isBufferGeometry){var o=i.index,s=i.attributes.position,l=i.morphAttributes.position,c=i.morphTargetsRelative,u=i.attributes.uv,h=i.attributes.uv2,d=i.groups,p=i.drawRange;if(null!==o)if(Array.isArray(r))for(var f=0,m=d.length;f<m;f++)for(var v=d[f],g=r[v.materialIndex],y=Math.max(v.start,p.start),b=Math.min(v.start+v.count,p.start+p.count);y<b;y+=3){var x=o.getX(y),w=o.getX(y+1),_=o.getX(y+2);(n=mn(this,g,e,Zt,s,l,c,u,h,x,w,_))&&(n.faceIndex=Math.floor(y/3),n.face.materialIndex=v.materialIndex,t.push(n))}else for(var M=Math.max(0,p.start),S=Math.min(o.count,p.start+p.count);M<S;M+=3){var T=o.getX(M),E=o.getX(M+1),A=o.getX(M+2);(n=mn(this,r,e,Zt,s,l,c,u,h,T,E,A))&&(n.faceIndex=Math.floor(M/3),t.push(n))}else if(void 0!==s)if(Array.isArray(r))for(var L=0,k=d.length;L<k;L++)for(var R=d[L],O=r[R.materialIndex],C=Math.max(R.start,p.start),P=Math.min(R.start+R.count,p.start+p.count);C<P;C+=3)(n=mn(this,O,e,Zt,s,l,c,u,h,C,C+1,C+2))&&(n.faceIndex=Math.floor(C/3),n.face.materialIndex=R.materialIndex,t.push(n));else for(var I=Math.max(0,p.start),D=Math.min(s.count,p.start+p.count);I<D;I+=3)(n=mn(this,r,e,Zt,s,l,c,u,h,I,I+1,I+2))&&(n.faceIndex=Math.floor(I/3),t.push(n))}else if(i.isGeometry){var N,F=Array.isArray(r),U=i.vertices,z=i.faces,j=i.faceVertexUvs[0];j.length>0&&(N=j);for(var B=0,H=z.length;B<H;B++){var G=z[B],V=F?r[G.materialIndex]:r;if(void 0!==V){var W=U[G.a],X=U[G.b],Y=U[G.c];if(n=fn(this,V,e,Zt,W,X,Y,hn)){if(N&&N[B]){var J=N[B];ln.copy(J[0]),cn.copy(J[1]),un.copy(J[2]),n.uv=mt.getUV(hn,W,X,Y,ln,cn,un,new q)}n.face=G,n.faceIndex=B,t.push(n)}}}}}});var vn=function(e){Object(p.a)(n,e);var t=b(n);function n(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;Object(h.a)(this,n),(e=t.call(this)).type="BoxBufferGeometry",e.parameters={width:i,height:r,depth:a,widthSegments:s,heightSegments:l,depthSegments:c};var u=Object(o.a)(e);s=Math.floor(s),l=Math.floor(l),c=Math.floor(c);var d=[],p=[],f=[],m=[],v=0,g=0;function y(e,t,n,i,r,a,o,s,l,c,h){for(var y=a/l,b=o/c,x=a/2,w=o/2,_=s/2,M=l+1,S=c+1,T=0,E=0,A=new te,L=0;L<S;L++)for(var k=L*b-w,R=0;R<M;R++){var O=R*y-x;A[e]=O*i,A[t]=k*r,A[n]=_,p.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[n]=s>0?1:-1,f.push(A.x,A.y,A.z),m.push(R/l),m.push(1-L/c),T+=1}for(var C=0;C<c;C++)for(var P=0;P<l;P++){var I=v+P+M*C,D=v+P+M*(C+1),N=v+(P+1)+M*(C+1),F=v+(P+1)+M*C;d.push(I,D,F),d.push(D,N,F),E+=6}u.addGroup(g,E,h),g+=E,v+=T}return y("z","y","x",-1,-1,a,r,i,c,l,0),y("z","y","x",1,-1,a,r,-i,c,l,1),y("x","z","y",1,1,i,a,r,s,c,2),y("x","z","y",1,-1,i,a,-r,s,c,3),y("x","y","z",1,-1,i,r,a,s,l,4),y("x","y","z",-1,-1,i,r,-a,s,l,5),e.setIndex(d),e.setAttribute("position",new Ft(p,3)),e.setAttribute("normal",new Ft(f,3)),e.setAttribute("uv",new Ft(m,2)),e}return n}(Yt);function gn(e){var t={};for(var n in e)for(var i in t[n]={},e[n]){var r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}return t}function yn(e){for(var t={},n=0;n<e.length;n++){var i=gn(e[n]);for(var r in i)t[r]=i[r]}return t}var bn={clone:gn,merge:yn};function xn(e){Tt.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&(void 0!==e.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}function wn(){et.call(this),this.type="Camera",this.matrixWorldInverse=new ke,this.projectionMatrix=new ke,this.projectionMatrixInverse=new ke}function _n(e,t,n,i){wn.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Mn(e,t,n){if(et.call(this),this.type="CubeCamera",!0===n.isWebGLCubeRenderTarget){this.renderTarget=n;var i=new _n(90,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new te(1,0,0)),this.add(i);var r=new _n(90,1,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new te(-1,0,0)),this.add(r);var a=new _n(90,1,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new te(0,1,0)),this.add(a);var o=new _n(90,1,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new te(0,-1,0)),this.add(o);var s=new _n(90,1,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new te(0,0,1)),this.add(s);var l=new _n(90,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new te(0,0,-1)),this.add(l),this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var c=e.xr.enabled,u=e.getRenderTarget();e.xr.enabled=!1;var h=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,r),e.setRenderTarget(n,2),e.render(t,a),e.setRenderTarget(n,3),e.render(t,o),e.setRenderTarget(n,4),e.render(t,s),n.texture.generateMipmaps=h,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(u),e.xr.enabled=c},this.clear=function(e,t,i,r){for(var a=e.getRenderTarget(),o=0;o<6;o++)e.setRenderTarget(n,o),e.clear(t,i,r);e.setRenderTarget(a)}}else console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")}function Sn(e,t,n,i,r,a,o,s,l,c){e=void 0!==e?e:[],t=void 0!==t?t:301,o=void 0!==o?o:1022,Z.call(this,e,t,n,i,r,a,o,s,l,c),this.flipY=!1,this._needsFlipEnvMap=!0}function Tn(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),Q.call(this,e,e,t),t=t||{},this.texture=new Sn(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture._needsFlipEnvMap=!1}function En(e,t,n,i,r,a,o,s,l,c,u,h){Z.call(this,null,a,o,s,l,c,i,r,u,h),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==l?l:1003,this.minFilter=void 0!==c?c:1003,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}xn.prototype=Object.create(Tt.prototype),xn.prototype.constructor=xn,xn.prototype.isShaderMaterial=!0,xn.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=gn(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this},xn.prototype.toJSON=function(e){var t=Tt.prototype.toJSON.call(this,e);for(var n in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){var i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var r={};for(var a in this.extensions)!0===this.extensions[a]&&(r[a]=!0);return Object.keys(r).length>0&&(t.extensions=r),t},wn.prototype=Object.assign(Object.create(et.prototype),{constructor:wn,isCamera:!0,copy:function(e,t){return et.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new te),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){et.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){et.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),_n.prototype=Object.assign(Object.create(wn.prototype),{constructor:_n,isPerspectiveCamera:!0,copy:function(e,t){return wn.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*W.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*W.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*W.RAD2DEG*Math.atan(Math.tan(.5*W.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*W.DEG2RAD*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(r+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=et.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}),Mn.prototype=Object.create(et.prototype),Mn.prototype.constructor=Mn,Sn.prototype=Object.create(Z.prototype),Sn.prototype.constructor=Sn,Sn.prototype.isCubeTexture=!0,Object.defineProperty(Sn.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),Tn.prototype=Object.create(Q.prototype),Tn.prototype.constructor=Tn,Tn.prototype.isWebGLCubeRenderTarget=!0,Tn.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=1023,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}},i="\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t#include <begin_vertex>\n\t\t\t\t#include <project_vertex>\n\n\t\t\t}\n\t\t",r="\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t",a=new vn(5,5,5),o=new xn({name:"CubemapFromEquirect",uniforms:gn(n),vertexShader:i,fragmentShader:r,side:1,blending:0});o.uniforms.tEquirect.value=t;var s=new pn(a,o),l=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new Mn(1,10,this).update(e,s),t.minFilter=l,s.geometry.dispose(),s.material.dispose(),this},En.prototype=Object.create(Z.prototype),En.prototype.constructor=En,En.prototype.isDataTexture=!0;var An=new xe,Ln=new te,kn=function(){function e(t,n,i,r,a,o){Object(h.a)(this,e),this.planes=[void 0!==t?t:new rt,void 0!==n?n:new rt,void 0!==i?i:new rt,void 0!==r?r:new rt,void 0!==a?a:new rt,void 0!==o?o:new rt]}return Object(d.a)(e,[{key:"set",value:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}},{key:"clone",value:function(){return(new this.constructor).copy(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,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(o-i,u-s,f-h,y-m).normalize(),t[1].setComponents(o+i,u+s,f+h,y+m).normalize(),t[2].setComponents(o+r,u+l,f+d,y+v).normalize(),t[3].setComponents(o-r,u-l,f-d,y-v).normalize(),t[4].setComponents(o-a,u-c,f-p,y-g).normalize(),t[5].setComponents(o+a,u+c,f+p,y+g).normalize(),this}},{key:"intersectsObject",value:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),An.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(An)}},{key:"intersectsSprite",value:function(e){return An.center.set(0,0,0),An.radius=.7071067811865476,An.applyMatrix4(e.matrixWorld),this.intersectsSphere(An)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++)if(t[r].distanceToPoint(n)<i)return!1;return!0}},{key:"intersectsBox",value:function(e){for(var t=this.planes,n=0;n<6;n++){var i=t[n];if(Ln.x=i.normal.x>0?e.max.x:e.min.x,Ln.y=i.normal.y>0?e.max.y:e.min.y,Ln.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ln)<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}}]),e}();function Rn(){var e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function On(e,t){var n=t.isWebGL2,i=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),i.get(e)},remove:function(t){t.isInterleavedBufferAttribute&&(t=t.data);var n=i.get(t);n&&(e.deleteBuffer(n.buffer),i.delete(t))},update:function(t,r){if(t.isGLBufferAttribute){var a=i.get(t);(!a||a.version<t.version)&&i.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version})}else{t.isInterleavedBufferAttribute&&(t=t.data);var o=i.get(t);void 0===o?i.set(t,function(t,n){var i=t.array,r=t.usage,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,i,r),t.onUploadCallback();var o=5126;return i instanceof Float32Array?o=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?o=5123:i instanceof Int16Array?o=5122:i instanceof Uint32Array?o=5125:i instanceof Int32Array?o=5124:i instanceof Int8Array?o=5120:i instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(t,r)):o.version<t.version&&(function(t,i,r){var a=i.array,o=i.updateRange;e.bindBuffer(r,t),-1===o.count?e.bufferSubData(r,0,a):(n?e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a,o.offset,o.count):e.bufferSubData(r,o.offset*a.BYTES_PER_ELEMENT,a.subarray(o.offset,o.offset+o.count)),o.count=-1)}(o.buffer,t,r),o.version=t.version)}}}}var Cn=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i,r,a){var o;Object(h.a)(this,n),(o=t.call(this)).type="PlaneBufferGeometry",o.parameters={width:e,height:i,widthSegments:r,heightSegments:a};for(var s=(e=e||1)/2,l=(i=i||1)/2,c=Math.floor(r)||1,u=Math.floor(a)||1,d=c+1,p=u+1,f=e/c,m=i/u,v=[],g=[],y=[],b=[],x=0;x<p;x++)for(var w=x*m-l,_=0;_<d;_++){var M=_*f-s;g.push(M,-w,0),y.push(0,0,1),b.push(_/c),b.push(1-x/u)}for(var S=0;S<u;S++)for(var T=0;T<c;T++){var E=T+d*S,A=T+d*(S+1),L=T+1+d*(S+1),k=T+1+d*S;v.push(E,A,k),v.push(A,L,k)}return o.setIndex(v),o.setAttribute("position",new Ft(g,3)),o.setAttribute("normal",new Ft(y,3)),o.setAttribute("uv",new Ft(b,2)),o}return n}(Yt),Pn={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\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 average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\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_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.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\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\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\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\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_maxMipLevel );\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\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\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#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_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_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 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\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(    0, 1,    0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\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; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\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 )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <transmissionmap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\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 <transmissionmap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <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 <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},In={common:{diffuse:{value:new _t(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new X},uv2Transform:{value:new X},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new q(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 _t(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 _t(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new X}},sprite:{diffuse:{value:new _t(15658734)},opacity:{value:1},center:{value:new q(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new X}}},Dn={basic:{uniforms:yn([In.common,In.specularmap,In.envmap,In.aomap,In.lightmap,In.fog]),vertexShader:Pn.meshbasic_vert,fragmentShader:Pn.meshbasic_frag},lambert:{uniforms:yn([In.common,In.specularmap,In.envmap,In.aomap,In.lightmap,In.emissivemap,In.fog,In.lights,{emissive:{value:new _t(0)}}]),vertexShader:Pn.meshlambert_vert,fragmentShader:Pn.meshlambert_frag},phong:{uniforms:yn([In.common,In.specularmap,In.envmap,In.aomap,In.lightmap,In.emissivemap,In.bumpmap,In.normalmap,In.displacementmap,In.fog,In.lights,{emissive:{value:new _t(0)},specular:{value:new _t(1118481)},shininess:{value:30}}]),vertexShader:Pn.meshphong_vert,fragmentShader:Pn.meshphong_frag},standard:{uniforms:yn([In.common,In.envmap,In.aomap,In.lightmap,In.emissivemap,In.bumpmap,In.normalmap,In.displacementmap,In.roughnessmap,In.metalnessmap,In.fog,In.lights,{emissive:{value:new _t(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Pn.meshphysical_vert,fragmentShader:Pn.meshphysical_frag},toon:{uniforms:yn([In.common,In.aomap,In.lightmap,In.emissivemap,In.bumpmap,In.normalmap,In.displacementmap,In.gradientmap,In.fog,In.lights,{emissive:{value:new _t(0)}}]),vertexShader:Pn.meshtoon_vert,fragmentShader:Pn.meshtoon_frag},matcap:{uniforms:yn([In.common,In.bumpmap,In.normalmap,In.displacementmap,In.fog,{matcap:{value:null}}]),vertexShader:Pn.meshmatcap_vert,fragmentShader:Pn.meshmatcap_frag},points:{uniforms:yn([In.points,In.fog]),vertexShader:Pn.points_vert,fragmentShader:Pn.points_frag},dashed:{uniforms:yn([In.common,In.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Pn.linedashed_vert,fragmentShader:Pn.linedashed_frag},depth:{uniforms:yn([In.common,In.displacementmap]),vertexShader:Pn.depth_vert,fragmentShader:Pn.depth_frag},normal:{uniforms:yn([In.common,In.bumpmap,In.normalmap,In.displacementmap,{opacity:{value:1}}]),vertexShader:Pn.normal_vert,fragmentShader:Pn.normal_frag},sprite:{uniforms:yn([In.sprite,In.fog]),vertexShader:Pn.sprite_vert,fragmentShader:Pn.sprite_frag},background:{uniforms:{uvTransform:{value:new X},t2D:{value:null}},vertexShader:Pn.background_vert,fragmentShader:Pn.background_frag},cube:{uniforms:yn([In.envmap,{opacity:{value:1}}]),vertexShader:Pn.cube_vert,fragmentShader:Pn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Pn.equirect_vert,fragmentShader:Pn.equirect_frag},distanceRGBA:{uniforms:yn([In.common,In.displacementmap,{referencePosition:{value:new te},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Pn.distanceRGBA_vert,fragmentShader:Pn.distanceRGBA_frag},shadow:{uniforms:yn([In.lights,In.fog,{color:{value:new _t(0)},opacity:{value:1}}]),vertexShader:Pn.shadow_vert,fragmentShader:Pn.shadow_frag}};function Nn(e,t,n,i,r){var a,o,s=new _t(0),l=0,c=null,u=0,h=null;function d(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,r)}return{getClearColor:function(){return s},setClearColor:function(e,t){s.set(e),d(s,l=void 0!==t?t:1)},getClearAlpha:function(){return l},setClearAlpha:function(e){d(s,l=e)},render:function(n,r,p,f){var m=!0===r.isScene?r.background:null;m&&m.isTexture&&(m=t.get(m));var v=e.xr,g=v.getSession&&v.getSession();g&&"additive"===g.environmentBlendMode&&(m=null),null===m?d(s,l):m&&m.isColor&&(d(m,1),f=!0),(e.autoClear||f)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.isWebGLCubeRenderTarget||306===m.mapping)?(void 0===o&&((o=new pn(new vn(1,1,1),new xn({name:"BackgroundCubeMaterial",uniforms:gn(Dn.cube.uniforms),vertexShader:Dn.cube.vertexShader,fragmentShader:Dn.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(o)),m.isWebGLCubeRenderTarget&&(m=m.texture),o.material.uniforms.envMap.value=m,o.material.uniforms.flipEnvMap.value=m.isCubeTexture&&m._needsFlipEnvMap?-1:1,c===m&&u===m.version&&h===e.toneMapping||(o.material.needsUpdate=!0,c=m,u=m.version,h=e.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null)):m&&m.isTexture&&(void 0===a&&((a=new pn(new Cn(2,2),new xn({name:"BackgroundMaterial",uniforms:gn(Dn.background.uniforms),vertexShader:Dn.background.vertexShader,fragmentShader:Dn.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(a)),a.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),a.material.uniforms.uvTransform.value.copy(m.matrix),c===m&&u===m.version&&h===e.toneMapping||(a.material.needsUpdate=!0,c=m,u=m.version,h=e.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null))}}}function Fn(e,t,n,i){var r=e.getParameter(34921),a=i.isWebGL2?null:t.get("OES_vertex_array_object"),o=i.isWebGL2||null!==a,s={},l=d(null),c=l;function u(t){return i.isWebGL2?e.bindVertexArray(t):a.bindVertexArrayOES(t)}function h(t){return i.isWebGL2?e.deleteVertexArray(t):a.deleteVertexArrayOES(t)}function d(e){for(var t=[],n=[],i=[],a=0;a<r;a++)t[a]=0,n[a]=0,i[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:i,object:e,attributes:{},index:null}}function p(){for(var e=c.newAttributes,t=0,n=e.length;t<n;t++)e[t]=0}function f(e){m(e,0)}function m(n,r){var a=c.newAttributes,o=c.enabledAttributes,s=c.attributeDivisors;a[n]=1,0===o[n]&&(e.enableVertexAttribArray(n),o[n]=1),s[n]!==r&&((i.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),s[n]=r)}function v(){for(var t=c.newAttributes,n=c.enabledAttributes,i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function g(t,n,r,a,o,s){!0!==i.isWebGL2||5124!==r&&5125!==r?e.vertexAttribPointer(t,n,r,a,o,s):e.vertexAttribIPointer(t,n,r,o,s)}function y(){b(),c!==l&&u((c=l).object)}function b(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,h,y,b){var x=!1;if(o){var w=function(t,n,r){var o=!0===r.wireframe,l=s[t.id];void 0===l&&(l={},s[t.id]=l);var c=l[n.id];void 0===c&&(c={},l[n.id]=c);var u=c[o];return void 0===u&&(u=d(i.isWebGL2?e.createVertexArray():a.createVertexArrayOES()),c[o]=u),u}(y,h,l);c!==w&&u((c=w).object),(x=function(e,t){var n=c.attributes,i=e.attributes;if(Object.keys(n).length!==Object.keys(i).length)return!0;for(var r in i){var a=n[r],o=i[r];if(void 0===a)return!0;if(a.attribute!==o)return!0;if(a.data!==o.data)return!0}return c.index!==t}(y,b))&&function(e,t){var n={},i=e.attributes;for(var r in i){var a=i[r],o={};o.attribute=a,a.data&&(o.data=a.data),n[r]=o}c.attributes=n,c.index=t}(y,b)}else{var _=!0===l.wireframe;c.geometry===y.id&&c.program===h.id&&c.wireframe===_||(c.geometry=y.id,c.program=h.id,c.wireframe=_,x=!0)}!0===r.isInstancedMesh&&(x=!0),null!==b&&n.update(b,34963),x&&(function(r,a,o,s){if(!1!==i.isWebGL2||!r.isInstancedMesh&&!s.isInstancedBufferGeometry||null!==t.get("ANGLE_instanced_arrays")){p();var l=s.attributes,c=o.getAttributes(),u=a.defaultAttributeValues;for(var h in c){var d=c[h];if(d>=0){var y=l[h];if(void 0!==y){var b=y.normalized,x=y.itemSize,w=n.get(y);if(void 0===w)continue;var _=w.buffer,M=w.type,S=w.bytesPerElement;if(y.isInterleavedBufferAttribute){var T=y.data,E=T.stride,A=y.offset;T&&T.isInstancedInterleavedBuffer?(m(d,T.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=T.meshPerAttribute*T.count)):f(d),e.bindBuffer(34962,_),g(d,x,M,b,E*S,A*S)}else y.isInstancedBufferAttribute?(m(d,y.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=y.meshPerAttribute*y.count)):f(d),e.bindBuffer(34962,_),g(d,x,M,b,0,0)}else if("instanceMatrix"===h){var L=n.get(r.instanceMatrix);if(void 0===L)continue;var k=L.buffer,R=L.type;m(d+0,1),m(d+1,1),m(d+2,1),m(d+3,1),e.bindBuffer(34962,k),e.vertexAttribPointer(d+0,4,R,!1,64,0),e.vertexAttribPointer(d+1,4,R,!1,64,16),e.vertexAttribPointer(d+2,4,R,!1,64,32),e.vertexAttribPointer(d+3,4,R,!1,64,48)}else if("instanceColor"===h){var O=n.get(r.instanceColor);if(void 0===O)continue;var C=O.buffer,P=O.type;m(d,1),e.bindBuffer(34962,C),e.vertexAttribPointer(d,3,P,!1,12,0)}else if(void 0!==u){var I=u[h];if(void 0!==I)switch(I.length){case 2:e.vertexAttrib2fv(d,I);break;case 3:e.vertexAttrib3fv(d,I);break;case 4:e.vertexAttrib4fv(d,I);break;default:e.vertexAttrib1fv(d,I)}}}}v()}}(r,l,h,y),null!==b&&e.bindBuffer(34963,n.get(b).buffer))},reset:y,resetDefaultState:b,dispose:function(){for(var e in y(),s){var t=s[e];for(var n in t){var i=t[n];for(var r in i)h(i[r].object),delete i[r];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 i=t[n];for(var r in i)h(i[r].object),delete i[r];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 i=n[e.id];for(var r in i)h(i[r].object),delete i[r];delete n[e.id]}}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:v}}function Un(e,t,n,i){var r,a=i.isWebGL2;this.setMode=function(e){r=e},this.render=function(t,i){e.drawArrays(r,t,i),n.update(i,r,1)},this.renderInstances=function(i,o,s){if(0!==s){var l,c;if(a)l=e,c="drawArraysInstanced";else if(c="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[c](r,i,o,s),n.update(o,r,s)}}}function zn(e,t,n){var i;function r(t){if("highp"===t){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),u=e.getParameter(35660),h=e.getParameter(3379),d=e.getParameter(34076),p=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),v=e.getParameter(36349),g=u>0,y=a||!!t.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:u,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:a?e.getParameter(36183):0}}function jn(e){var t=this,n=null,i=0,r=!1,a=!1,o=new rt,s=new X,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function u(e,n,i,r){var a=null!==e?e.length:0,c=null;if(0!==a){if(c=l.value,!0!==r||null===c){var u=i+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===c||c.length<u)&&(c=new Float32Array(u));for(var d=0,p=i;d!==a;++d,p+=4)o.copy(e[d]).applyMatrix4(h,s),o.normal.toArray(c,p),c[p+3]=o.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,a){var o=0!==e.length||t||0!==i||r;return r=t,n=u(e,a,0),i=e.length,o},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1,c()},this.setState=function(t,o,s){var h=t.clippingPlanes,d=t.clipIntersection,p=t.clipShadows,f=e.get(t);if(!r||null===h||0===h.length||a&&!p)a?u(null):c();else{var m=a?0:i,v=4*m,g=f.clippingState||null;l.value=g,g=u(h,o,v,s);for(var y=0;y!==v;++y)g[y]=n[y];f.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=m}}}function Bn(e){var t=new WeakMap;function n(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}return{get:function(i){if(i&&i.isTexture){var r=i.mapping;if(303===r||304===r){if(t.has(i))return n(t.get(i).texture,i.mapping);var a=i.image;if(a&&a.height>0){var o=e.getRenderList(),s=e.getRenderTarget(),l=e.getRenderState(),c=new Tn(a.height/2);return c.fromEquirectangularTexture(e,i),t.set(i,c),e.setRenderTarget(s),e.setRenderList(o),e.setRenderState(l),n(c.texture,i.mapping)}return null}}return i},dispose:function(){t=new WeakMap}}}function Hn(e){var t={};return{has:function(n){if(void 0!==t[n])return null!==t[n];var i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return t[n]=i,null!==i},get:function(e){return this.has(e)||console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t[e]}}}function Gn(e,t,n,i){var r=new WeakMap,a=new WeakMap;function o(e){var s=e.target,l=r.get(s);for(var c in null!==l.index&&t.remove(l.index),l.attributes)t.remove(l.attributes[c]);s.removeEventListener("dispose",o),r.delete(s);var u=a.get(l);u&&(t.remove(u),a.delete(l)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(e){var n=[],i=e.index,r=e.attributes.position,o=0;if(null!==i){var s=i.array;o=i.version;for(var l=0,c=s.length;l<c;l+=3){var u=s[l+0],h=s[l+1],d=s[l+2];n.push(u,h,h,d,d,u)}}else{var p=r.array;o=r.version;for(var f=0,m=p.length/3-1;f<m;f+=3){var v=f+0,g=f+1,y=f+2;n.push(v,g,g,y,y,v)}}var b=new(jt(n)>65535?Nt:It)(n,1);b.version=o;var x=a.get(e);x&&t.remove(x),a.set(e,b)}return{get:function(e,t){var i=r.get(t);return i||(t.addEventListener("dispose",o),t.isBufferGeometry?i=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Yt).setFromObject(e)),i=t._bufferGeometry),r.set(t,i),n.memory.geometries++,i)},update:function(e){var n=e.attributes;for(var i in n)t.update(n[i],34962);var r=e.morphAttributes;for(var a in r)for(var o=r[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 Vn(e,t,n,i){var r,a,o,s=i.isWebGL2;this.setMode=function(e){r=e},this.setIndex=function(e){a=e.type,o=e.bytesPerElement},this.render=function(t,i){e.drawElements(r,i,a,t*o),n.update(i,r,1)},this.renderInstances=function(i,l,c){if(0!==c){var u,h;if(s)u=e,h="drawElementsInstanced";else if(h="drawElementsInstancedANGLE",null===(u=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");u[h](r,l,a,i*o,c),n.update(l,r,c)}}}function Wn(e){var t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(e,n,i){switch(t.calls++,n){case 4:t.triangles+=i*(e/3);break;case 1:t.lines+=i*(e/2);break;case 3:t.lines+=i*(e-1);break;case 2:t.lines+=i*e;break;case 0:t.points+=i*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function qn(e,t){return e[0]-t[0]}function Xn(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Yn(e){for(var t={},n=new Float32Array(8),i=[],r=0;r<8;r++)i[r]=[r,0];return{update:function(r,a,o,s){var l=r.morphTargetInfluences,c=void 0===l?0:l.length,u=t[a.id];if(void 0===u){u=[];for(var h=0;h<c;h++)u[h]=[h,0];t[a.id]=u}for(var d=0;d<c;d++){var p=u[d];p[0]=d,p[1]=l[d]}u.sort(Xn);for(var f=0;f<8;f++)f<c&&u[f][1]?(i[f][0]=u[f][0],i[f][1]=u[f][1]):(i[f][0]=Number.MAX_SAFE_INTEGER,i[f][1]=0);i.sort(qn);for(var m=o.morphTargets&&a.morphAttributes.position,v=o.morphNormals&&a.morphAttributes.normal,g=0,y=0;y<8;y++){var b=i[y],x=b[0],w=b[1];x!==Number.MAX_SAFE_INTEGER&&w?(m&&a.getAttribute("morphTarget"+y)!==m[x]&&a.setAttribute("morphTarget"+y,m[x]),v&&a.getAttribute("morphNormal"+y)!==v[x]&&a.setAttribute("morphNormal"+y,v[x]),n[y]=w,g+=w):(m&&void 0!==a.getAttribute("morphTarget"+y)&&a.deleteAttribute("morphTarget"+y),v&&void 0!==a.getAttribute("morphNormal"+y)&&a.deleteAttribute("morphNormal"+y),n[y]=0)}var _=a.morphTargetsRelative?1:1-g;s.getUniforms().setValue(e,"morphTargetBaseInfluence",_),s.getUniforms().setValue(e,"morphTargetInfluences",n)}}}function Jn(e,t,n,i){var r=new WeakMap;return{update:function(e){var a=i.render.frame,o=e.geometry,s=t.get(e,o);return r.get(s)!==a&&(o.isGeometry&&s.updateFromObject(e),t.update(s),r.set(s,a)),e.isInstancedMesh&&(n.update(e.instanceMatrix,34962),null!==e.instanceColor&&n.update(e.instanceColor,34962)),s},dispose:function(){r=new WeakMap}}}function Zn(e,t,n,i){Z.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Kn(e,t,n,i){Z.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}Dn.physical={uniforms:yn([Dn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new q(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new _t(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:Pn.meshphysical_vert,fragmentShader:Pn.meshphysical_frag},Zn.prototype=Object.create(Z.prototype),Zn.prototype.constructor=Zn,Zn.prototype.isDataTexture2DArray=!0,Kn.prototype=Object.create(Z.prototype),Kn.prototype.constructor=Kn,Kn.prototype.isDataTexture3D=!0;var Qn=new Z,$n=new Zn,ei=new Kn,ti=new Sn,ni=[],ii=[],ri=new Float32Array(16),ai=new Float32Array(9),oi=new Float32Array(4);function si(e,t,n){var i=e[0];if(i<=0||i>0)return e;var r=t*n,a=ni[r];if(void 0===a&&(a=new Float32Array(r),ni[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function li(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function ci(e,t){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]}function ui(e,t){var n=ii[t];void 0===n&&(n=new Int32Array(t),ii[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function hi(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function di(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(li(n,t))return;e.uniform2fv(this.addr,t),ci(n,t)}}function pi(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(li(n,t))return;e.uniform3fv(this.addr,t),ci(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(li(n,t))return;e.uniform4fv(this.addr,t),ci(n,t)}}function mi(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(li(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),ci(n,t)}else{if(li(n,i))return;oi.set(i),e.uniformMatrix2fv(this.addr,!1,oi),ci(n,i)}}function vi(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(li(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),ci(n,t)}else{if(li(n,i))return;ai.set(i),e.uniformMatrix3fv(this.addr,!1,ai),ci(n,i)}}function gi(e,t){var n=this.cache,i=t.elements;if(void 0===i){if(li(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),ci(n,t)}else{if(li(n,i))return;ri.set(i),e.uniformMatrix4fv(this.addr,!1,ri),ci(n,i)}}function yi(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(t||Qn,r)}function bi(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||$n,r)}function xi(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||ei,r)}function wi(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(t||ti,r)}function _i(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Mi(e,t){var n=this.cache;li(n,t)||(e.uniform2iv(this.addr,t),ci(n,t))}function Si(e,t){var n=this.cache;li(n,t)||(e.uniform3iv(this.addr,t),ci(n,t))}function Ti(e,t){var n=this.cache;li(n,t)||(e.uniform4iv(this.addr,t),ci(n,t))}function Ei(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Ai(e,t){e.uniform1fv(this.addr,t)}function Li(e,t){e.uniform1iv(this.addr,t)}function ki(e,t){e.uniform2iv(this.addr,t)}function Ri(e,t){e.uniform3iv(this.addr,t)}function Oi(e,t){e.uniform4iv(this.addr,t)}function Ci(e,t){var n=si(t,this.size,2);e.uniform2fv(this.addr,n)}function Pi(e,t){var n=si(t,this.size,3);e.uniform3fv(this.addr,n)}function Ii(e,t){var n=si(t,this.size,4);e.uniform4fv(this.addr,n)}function Di(e,t){var n=si(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Ni(e,t){var n=si(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Fi(e,t){var n=si(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function Ui(e,t,n){var i=t.length,r=ui(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.safeSetTexture2D(t[a]||Qn,r[a])}function zi(e,t,n){var i=t.length,r=ui(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.safeSetTextureCube(t[a]||ti,r[a])}function ji(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=function(e){switch(e){case 5126:return hi;case 35664:return di;case 35665:return pi;case 35666:return fi;case 35674:return mi;case 35675:return vi;case 35676:return gi;case 5124:case 35670:return _i;case 35667:case 35671:return Mi;case 35668:case 35672:return Si;case 35669:case 35673:return Ti;case 5125:return Ei;case 35678:case 36198:case 36298:case 36306:case 35682:return yi;case 35679:case 36299:case 36307:return xi;case 35680:case 36300:case 36308:case 36293:return wi;case 36289:case 36303:case 36311:case 36292:return bi}}(t.type)}function Bi(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Ai;case 35664:return Ci;case 35665:return Pi;case 35666:return Ii;case 35674:return Di;case 35675:return Ni;case 35676:return Fi;case 5124:case 35670:return Li;case 35667:case 35671:return ki;case 35668:case 35672:return Ri;case 35669:case 35673:return Oi;case 35678:case 36198:case 36298:case 36306:case 35682:return Ui;case 35680:case 36300:case 36308:case 36293:return zi}}(t.type)}function Hi(e){this.id=e,this.seq=[],this.map={}}Bi.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),ci(t,e)},Hi.prototype.setValue=function(e,t,n){for(var i=this.seq,r=0,a=i.length;r!==a;++r){var o=i[r];o.setValue(e,t[o.id],n)}};var Gi=/([\w\d_]+)(\])?(\[|\.)?/g;function Vi(e,t){e.seq.push(t),e.map[t.id]=t}function Wi(e,t,n){var i=e.name,r=i.length;for(Gi.lastIndex=0;;){var a=Gi.exec(i),o=Gi.lastIndex,s=a[1],l="]"===a[2],c=a[3];if(l&&(s|=0),void 0===c||"["===c&&o+2===r){Vi(n,void 0===c?new ji(s,e,t):new Bi(s,e,t));break}var u=n.map[s];void 0===u&&Vi(n,u=new Hi(s)),n=u}}function qi(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),i=0;i<n;++i){var r=e.getActiveUniform(t,i);Wi(r,e.getUniformLocation(t,r.name),this)}}function Xi(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}qi.prototype.setValue=function(e,t,n,i){var r=this.map[t];void 0!==r&&r.setValue(e,n,i)},qi.prototype.setOptional=function(e,t,n){var i=t[n];void 0!==i&&this.setValue(e,n,i)},qi.upload=function(e,t,n,i){for(var r=0,a=t.length;r!==a;++r){var o=t[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(e,s.value,i)}},qi.seqWithValue=function(e,t){for(var n=[],i=0,r=e.length;i!==r;++i){var a=e[i];a.id in t&&n.push(a)}return n};var Yi=0;function Ji(e){switch(e){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}function Zi(e,t,n){var i=e.getShaderParameter(t,35713),r=e.getShaderInfoLog(t).trim();return i&&""===r?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+n+"\n"+r+function(e){for(var t=e.split("\n"),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join("\n")}(e.getShaderSource(t))}function Ki(e,t){var n=Ji(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Qi(e,t){var n=Ji(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function $i(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 er(e){return""!==e}function tr(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 nr(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var ir=/^[ \t]*#include +<([\w\d./]+)>/gm;function rr(e){return e.replace(ir,ar)}function ar(e,t){var n=Pn[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return rr(n)}var or=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,sr=/#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 lr(e){return e.replace(sr,ur).replace(or,cr)}function cr(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),ur(e,t,n,i)}function ur(e,t,n,i){for(var r="",a=parseInt(t);a<parseInt(n);a++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function hr(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 dr(e,t,n,i){var r,a,o=e.getContext(),s=n.defines,l=n.vertexShader,c=n.fragmentShader,u=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 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:case 307:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),d=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case 302:case 307: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=e.gammaFactor>0?e.gammaFactor:1,m=n.isWebGL2?"":function(e){return[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||"physical"===e.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(er).join("\n")}(n),v=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(s),g=o.createProgram(),y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((r=[v].filter(er).join("\n")).length>0&&(r+="\n"),(a=[m,v].filter(er).join("\n")).length>0&&(a+="\n")):(r=[hr(n),"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+f,"#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.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",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","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(er).join("\n"),a=[m,hr(n),"#define SHADER_NAME "+n.shaderName,v,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+f,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:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Pn.tonemapping_pars_fragment:"",0!==n.toneMapping?$i("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Pn.encodings_pars_fragment,n.map?Ki("mapTexelToLinear",n.mapEncoding):"",n.matcap?Ki("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?Ki("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?Ki("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?Ki("lightMapTexelToLinear",n.lightMapEncoding):"",Qi("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(er).join("\n")),l=nr(l=tr(l=rr(l),n),n),c=nr(c=tr(c=rr(c),n),n),l=lr(l),c=lr(c),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",r=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+r,a=["#define varying in","300 es"===n.glslVersion?"":"out highp vec4 pc_fragColor;","300 es"===n.glslVersion?"":"#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 b,x,w=y+a+c,_=Xi(o,35633,y+r+l),M=Xi(o,35632,w);if(o.attachShader(g,_),o.attachShader(g,M),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(),T=o.getShaderInfoLog(_).trim(),E=o.getShaderInfoLog(M).trim(),A=!0,L=!0;if(!1===o.getProgramParameter(g,35714)){A=!1;var k=Zi(o,_,"vertex"),R=Zi(o,M,"fragment");console.error("THREE.WebGLProgram: shader error: ",o.getError(),"35715",o.getProgramParameter(g,35715),"gl.getProgramInfoLog",S,k,R)}else""!==S?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",S):""!==T&&""!==E||(L=!1);L&&(this.diagnostics={runnable:A,programLog:S,vertexShader:{log:T,prefix:r},fragmentShader:{log:E,prefix:a}})}return o.deleteShader(_),o.deleteShader(M),this.getUniforms=function(){return void 0===b&&(b=new qi(o,g)),b},this.getAttributes=function(){return void 0===x&&(x=function(e,t){for(var n={},i=e.getProgramParameter(t,35721),r=0;r<i;r++){var a=e.getActiveAttrib(t,r).name;n[a]=e.getAttribLocation(t,a)}return n}(o,g)),x},this.destroy=function(){i.releaseStatesOfProgram(this),o.deleteProgram(g),this.program=void 0},this.name=n.shaderName,this.id=Yi++,this.cacheKey=t,this.usedTimes=1,this.program=g,this.vertexShader=_,this.fragmentShader=M,this}function pr(e,t,n,i,r,a){var o=[],s=i.isWebGL2,l=i.logarithmicDepthBuffer,c=i.floatVertexTextures,u=i.maxVertexUniforms,h=i.vertexTextures,d=i.precision,p={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"},f=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function m(e){var t;return e?e.isTexture?t=e.encoding:e.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=3e3,t}return{getParameters:function(r,o,f,v,g){var y,b,x=v.fog,w=r.isMeshStandardMaterial?v.environment:null,_=t.get(r.envMap||w),M=p[r.type],S=g.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(c)return 1024;var n=u,i=Math.floor((n-20)/4),r=Math.min(i,t.length);return r<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+r+"."),0):r}(g):0;if(null!==r.precision&&((d=i.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",d,"instead.")),M){var T=Dn[M];y=T.vertexShader,b=T.fragmentShader}else y=r.vertexShader,b=r.fragmentShader;var E=e.getRenderTarget();return{isWebGL2:s,shaderID:M,shaderName:r.type,vertexShader:y,fragmentShader:b,defines:r.defines,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:d,instancing:!0===g.isInstancedMesh,instancingColor:!0===g.isInstancedMesh&&null!==g.instanceColor,supportsVertexTextures:h,outputEncoding:null!==E?m(E.texture):e.outputEncoding,map:!!r.map,mapEncoding:m(r.map),matcap:!!r.matcap,matcapEncoding:m(r.matcap),envMap:!!_,envMapMode:_&&_.mapping,envMapEncoding:m(_),envMapCubeUV:!!_&&(306===_.mapping||307===_.mapping),lightMap:!!r.lightMap,lightMapEncoding:m(r.lightMap),aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:m(r.emissiveMap),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,objectSpaceNormalMap:1===r.normalMapType,tangentSpaceNormalMap:0===r.normalMapType,clearcoatMap:!!r.clearcoatMap,clearcoatRoughnessMap:!!r.clearcoatRoughnessMap,clearcoatNormalMap:!!r.clearcoatNormalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,sheen:!!r.sheen,transmissionMap:!!r.transmissionMap,combine:r.combine,vertexTangents:r.normalMap&&r.vertexTangents,vertexColors:r.vertexColors,vertexUvs:!!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatMap||r.clearcoatRoughnessMap||r.clearcoatNormalMap||r.displacementMap||r.transmissionMap),uvsVertexOnly:!(r.map||r.bumpMap||r.normalMap||r.specularMap||r.alphaMap||r.emissiveMap||r.roughnessMap||r.metalnessMap||r.clearcoatNormalMap||r.transmissionMap||!r.displacementMap),fog:!!x,useFog:r.fog,fogExp2:x&&x.isFogExp2,flatShading:r.flatShading,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:l,skinning:r.skinning&&S>0,maxBones:S,useVertexTexture:c,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&f.length>0,shadowMapType:e.shadowMap.type,toneMapping:r.toneMapped?e.toneMapping:0,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:2===r.side,flipSided:1===r.side,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:s||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:s||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:s||n.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(t){var n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);if(!1===t.isRawShaderMaterial){for(var r=0;r<f.length;r++)n.push(t[f[r]]);n.push(e.outputEncoding),n.push(e.gammaFactor)}return n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){var t,n=p[e.type];if(n){var i=Dn[n];t=bn.clone(i.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){for(var i,a=0,s=o.length;a<s;a++){var l=o[a];if(l.cacheKey===n){++(i=l).usedTimes;break}}return void 0===i&&(i=new dr(e,n,t,r),o.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){var t=o.indexOf(e);o[t]=o[o.length-1],o.pop(),e.destroy()}},programs:o}}function fr(){var e=new WeakMap;return{get:function(t){var n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function mr(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function vr(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 gr(e){var t=[],n=0,i=[],r=[],a={id:-1};function o(i,r,o,s,l,c){var u=t[n],h=e.get(o);return void 0===u?(u={id:i.id,object:i,geometry:r,material:o,program:h.program||a,groupOrder:s,renderOrder:i.renderOrder,z:l,group:c},t[n]=u):(u.id=i.id,u.object=i,u.geometry=r,u.material=o,u.program=h.program||a,u.groupOrder=s,u.renderOrder=i.renderOrder,u.z=l,u.group=c),n++,u}return{opaque:i,transparent:r,init:function(){n=0,i.length=0,r.length=0},push:function(e,t,n,a,s,l){var c=o(e,t,n,a,s,l);(!0===n.transparent?r:i).push(c)},unshift:function(e,t,n,a,s,l){var c=o(e,t,n,a,s,l);(!0===n.transparent?r:i).unshift(c)},finish:function(){for(var e=n,i=t.length;e<i;e++){var r=t[e];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.program=null,r.group=null}},sort:function(e,t){i.length>1&&i.sort(e||mr),r.length>1&&r.sort(t||vr)}}}function yr(e){var t=new WeakMap;return{get:function(n,i){var r,a=t.get(n);return void 0===a?(r=new gr(e),t.set(n,new WeakMap),t.get(n).set(i,r)):void 0===(r=a.get(i))&&(r=new gr(e),a.set(i,r)),r},dispose:function(){t=new WeakMap}}}function br(){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 te,color:new _t};break;case"SpotLight":n={position:new te,direction:new te,color:new _t,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new te,color:new _t,distance:0,decay:0};break;case"HemisphereLight":n={direction:new te,skyColor:new _t,groundColor:new _t};break;case"RectAreaLight":n={color:new _t,position:new te,halfWidth:new te,halfHeight:new te}}return e[t.id]=n,n}}}var xr=0;function wr(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function _r(){for(var e=new br,t=function(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new q};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new q,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),n={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:[]},i=0;i<9;i++)n.probe.push(new te);var r=new te,a=new ke,o=new ke;return{setup:function(i,s,l){for(var c=0,u=0,h=0,d=0;d<9;d++)n.probe[d].set(0,0,0);var p=0,f=0,m=0,v=0,g=0,y=0,b=0,x=0,w=l.matrixWorldInverse;i.sort(wr);for(var _=0,M=i.length;_<M;_++){var S=i[_],T=S.color,E=S.intensity,A=S.distance,L=S.shadow&&S.shadow.map?S.shadow.map.texture:null;if(S.isAmbientLight)c+=T.r*E,u+=T.g*E,h+=T.b*E;else if(S.isLightProbe)for(var k=0;k<9;k++)n.probe[k].addScaledVector(S.sh.coefficients[k],E);else if(S.isDirectionalLight){var R=e.get(S);if(R.color.copy(S.color).multiplyScalar(S.intensity),R.direction.setFromMatrixPosition(S.matrixWorld),r.setFromMatrixPosition(S.target.matrixWorld),R.direction.sub(r),R.direction.transformDirection(w),S.castShadow){var O=S.shadow,C=t.get(S);C.shadowBias=O.bias,C.shadowNormalBias=O.normalBias,C.shadowRadius=O.radius,C.shadowMapSize=O.mapSize,n.directionalShadow[p]=C,n.directionalShadowMap[p]=L,n.directionalShadowMatrix[p]=S.shadow.matrix,y++}n.directional[p]=R,p++}else if(S.isSpotLight){var P=e.get(S);if(P.position.setFromMatrixPosition(S.matrixWorld),P.position.applyMatrix4(w),P.color.copy(T).multiplyScalar(E),P.distance=A,P.direction.setFromMatrixPosition(S.matrixWorld),r.setFromMatrixPosition(S.target.matrixWorld),P.direction.sub(r),P.direction.transformDirection(w),P.coneCos=Math.cos(S.angle),P.penumbraCos=Math.cos(S.angle*(1-S.penumbra)),P.decay=S.decay,S.castShadow){var I=S.shadow,D=t.get(S);D.shadowBias=I.bias,D.shadowNormalBias=I.normalBias,D.shadowRadius=I.radius,D.shadowMapSize=I.mapSize,n.spotShadow[m]=D,n.spotShadowMap[m]=L,n.spotShadowMatrix[m]=S.shadow.matrix,x++}n.spot[m]=P,m++}else if(S.isRectAreaLight){var N=e.get(S);N.color.copy(T).multiplyScalar(E),N.position.setFromMatrixPosition(S.matrixWorld),N.position.applyMatrix4(w),o.identity(),a.copy(S.matrixWorld),a.premultiply(w),o.extractRotation(a),N.halfWidth.set(.5*S.width,0,0),N.halfHeight.set(0,.5*S.height,0),N.halfWidth.applyMatrix4(o),N.halfHeight.applyMatrix4(o),n.rectArea[v]=N,v++}else if(S.isPointLight){var F=e.get(S);if(F.position.setFromMatrixPosition(S.matrixWorld),F.position.applyMatrix4(w),F.color.copy(S.color).multiplyScalar(S.intensity),F.distance=S.distance,F.decay=S.decay,S.castShadow){var U=S.shadow,z=t.get(S);z.shadowBias=U.bias,z.shadowNormalBias=U.normalBias,z.shadowRadius=U.radius,z.shadowMapSize=U.mapSize,z.shadowCameraNear=U.camera.near,z.shadowCameraFar=U.camera.far,n.pointShadow[f]=z,n.pointShadowMap[f]=L,n.pointShadowMatrix[f]=S.shadow.matrix,b++}n.point[f]=F,f++}else if(S.isHemisphereLight){var j=e.get(S);j.direction.setFromMatrixPosition(S.matrixWorld),j.direction.transformDirection(w),j.direction.normalize(),j.skyColor.copy(S.color).multiplyScalar(E),j.groundColor.copy(S.groundColor).multiplyScalar(E),n.hemi[g]=j,g++}}v>0&&(n.rectAreaLTC1=In.LTC_1,n.rectAreaLTC2=In.LTC_2),n.ambient[0]=c,n.ambient[1]=u,n.ambient[2]=h;var B=n.hash;B.directionalLength===p&&B.pointLength===f&&B.spotLength===m&&B.rectAreaLength===v&&B.hemiLength===g&&B.numDirectionalShadows===y&&B.numPointShadows===b&&B.numSpotShadows===x||(n.directional.length=p,n.spot.length=m,n.rectArea.length=v,n.point.length=f,n.hemi.length=g,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=x,n.spotShadowMap.length=x,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=b,n.spotShadowMatrix.length=x,B.directionalLength=p,B.pointLength=f,B.spotLength=m,B.rectAreaLength=v,B.hemiLength=g,B.numDirectionalShadows=y,B.numPointShadows=b,B.numSpotShadows=x,n.version=xr++)},state:n}}function Mr(){var e=new _r,t=[],n=[];return{init:function(){t.length=0,n.length=0},state:{lightsArray:t,shadowsArray:n,lights:e},setupLights:function(i){e.setup(t,n,i)},pushLight:function(e){t.push(e)},pushShadow:function(e){n.push(e)}}}function Sr(){var e=new WeakMap;return{get:function(t,n){var i;return!1===e.has(t)?(i=new Mr,e.set(t,new WeakMap),e.get(t).set(n,i)):!1===e.get(t).has(n)?(i=new Mr,e.get(t).set(n,i)):i=e.get(t).get(n),i},dispose:function(){e=new WeakMap}}}function Tr(e){Tt.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function Er(e){Tt.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new te,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}function Ar(e,t,n){var i=new kn,r=new q,a=new q,o=new K,s=[],l=[],c={},u={0:1,1:0,2:2},h=new xn({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new q},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\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 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, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),d=h.clone();d.defines.HORIZONAL_PASS=1;var p=new Yt;p.setAttribute("position",new kt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var f=new pn(p,h),m=this;function v(n,i){var r=t.update(f);h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,r,h,f,null),d.uniforms.shadow_pass.value=n.mapPass.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,r,d,f,null)}function g(e,t,n){var i=e<<0|t<<1|n<<2,r=s[i];return void 0===r&&(r=new Tr({depthPacking:3201,morphTargets:e,skinning:t}),s[i]=r),r}function y(e,t,n){var i=e<<0|t<<1|n<<2,r=l[i];return void 0===r&&(r=new Er({morphTargets:e,skinning:t}),l[i]=r),r}function b(t,n,i,r,a,o,s){var l=null,h=g,d=t.customDepthMaterial;if(!0===r.isPointLight&&(h=y,d=t.customDistanceMaterial),void 0===d){var p=!1;!0===i.morphTargets&&(p=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var f=!1;!0===t.isSkinnedMesh&&(!0===i.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),l=h(p,f,!0===t.isInstancedMesh)}else l=d;if(e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var m=l.uuid,v=i.uuid,b=c[m];void 0===b&&(b={},c[m]=b);var x=b[v];void 0===x&&(x=l.clone(),b[v]=x),l=x}return l.visible=i.visible,l.wireframe=i.wireframe,l.side=3===s?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:u[i.side],l.clipShadows=i.clipShadows,l.clippingPlanes=i.clippingPlanes,l.clipIntersection=i.clipIntersection,l.wireframeLinewidth=i.wireframeLinewidth,l.linewidth=i.linewidth,!0===r.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(r.matrixWorld),l.nearDistance=a,l.farDistance=o),l}function x(n,r,a,o,s){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),c=n.material;if(Array.isArray(c))for(var u=l.groups,h=0,d=u.length;h<d;h++){var p=u[h],f=c[p.materialIndex];if(f&&f.visible){var m=b(n,l,f,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,m,n,p)}}else if(c.visible){var v=b(n,l,c,o,a.near,a.far,s);e.renderBufferDirect(a,null,l,v,n,null)}}for(var g=n.children,y=0,w=g.length;y<w;y++)x(g[y],r,a,o,s)}}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(t,s,l){if(!1!==m.enabled&&(!1!==m.autoUpdate||!1!==m.needsUpdate)&&0!==t.length){var c=e.getRenderTarget(),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 g=t[p],y=g.shadow;if(void 0!==y){if(!1!==y.autoUpdate||!1!==y.needsUpdate){r.copy(y.mapSize);var b=y.getFrameExtents();if(r.multiply(b),a.copy(y.mapSize),(r.x>n||r.y>n)&&(r.x>n&&(a.x=Math.floor(n/b.x),r.x=a.x*b.x,y.mapSize.x=a.x),r.y>n&&(a.y=Math.floor(n/b.y),r.y=a.y*b.y,y.mapSize.y=a.y)),null===y.map&&!y.isPointLightShadow&&3===this.type){var w={minFilter:1006,magFilter:1006,format:1023};y.map=new Q(r.x,r.y,w),y.map.texture.name=g.name+".shadowMap",y.mapPass=new Q(r.x,r.y,w),y.camera.updateProjectionMatrix()}if(null===y.map){y.map=new Q(r.x,r.y,{minFilter:1003,magFilter:1003,format:1023}),y.map.texture.name=g.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var _=y.getViewportCount(),M=0;M<_;M++){var S=y.getViewport(M);o.set(a.x*S.x,a.y*S.y,a.x*S.z,a.y*S.w),d.viewport(o),y.updateMatrices(g,M),i=y.getFrustum(),x(s,l,y.camera,g,this.type)}y.isPointLightShadow||3!==this.type||v(y,l),y.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}m.needsUpdate=!1,e.setRenderTarget(c,u,h)}}}function Lr(e,t,n){var i=n.isWebGL2,r=new function(){var t=!1,n=new K,i=null,r=new K(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},a=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(e){e?P(2929):I(2929)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){if(t)switch(t){case 0:e.depthFunc(512);break;case 1:e.depthFunc(519);break;case 2:e.depthFunc(513);break;case 3:e.depthFunc(515);break;case 4:e.depthFunc(514);break;case 5:e.depthFunc(518);break;case 6:e.depthFunc(516);break;case 7:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},o=new function(){var t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(e){t||(e?P(2960):I(2960))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null}}},s={},l=null,c=null,u=null,h=null,d=null,p=null,f=null,m=null,v=null,g=!1,y=null,b=null,x=null,w=null,_=null,M=e.getParameter(35661),S=!1,T=0,E=e.getParameter(7938);-1!==E.indexOf("WebGL")?(T=parseFloat(/^WebGL\ ([0-9])/.exec(E)[1]),S=T>=1):-1!==E.indexOf("OpenGL ES")&&(T=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(E)[1]),S=T>=2);var A=null,L={},k=new K,R=new K;function O(t,n,i){var r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;o<i;o++)e.texImage2D(n+o,0,6408,1,1,0,6408,5121,r);return a}var C={};function P(t){!0!==s[t]&&(e.enable(t),s[t]=!0)}function I(t){!1!==s[t]&&(e.disable(t),s[t]=!1)}C[3553]=O(3553,3553,1),C[34067]=O(34067,34069,6),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),P(2929),a.setFunc(3),z(!1),j(1),P(2884),U(0);var D={100:32774,101:32778,102:32779};if(i)D[103]=32775,D[104]=32776;else{var N=t.get("EXT_blend_minmax");null!==N&&(D[103]=N.MIN_EXT,D[104]=N.MAX_EXT)}var F={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function U(t,n,i,r,a,o,s,l){if(0!==t){if(c||(P(3042),c=!0),5===t)a=a||n,o=o||i,s=s||r,n===h&&a===f||(e.blendEquationSeparate(D[n],D[a]),h=n,f=a),i===d&&r===p&&o===m&&s===v||(e.blendFuncSeparate(F[i],F[r],F[o],F[s]),d=i,p=r,m=o,v=s),u=t,g=null;else if(t!==u||l!==g){if(100===h&&100===f||(e.blendEquation(32774),h=100,f=100),l)switch(t){case 1:e.blendFuncSeparate(1,771,1,771);break;case 2:e.blendFunc(1,1);break;case 3:e.blendFuncSeparate(0,0,769,771);break;case 4:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(770,771,1,771);break;case 2:e.blendFunc(770,1);break;case 3:e.blendFunc(0,769);break;case 4:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}d=null,p=null,m=null,v=null,u=t,g=l}}else c&&(I(3042),c=!1)}function z(t){y!==t&&(t?e.frontFace(2304):e.frontFace(2305),y=t)}function j(t){0!==t?(P(2884),t!==b&&(1===t?e.cullFace(1029):2===t?e.cullFace(1028):e.cullFace(1032))):I(2884),b=t}function B(t,n,i){t?(P(32823),w===n&&_===i||(e.polygonOffset(n,i),w=n,_=i)):I(32823)}function H(t){void 0===t&&(t=33984+M-1),A!==t&&(e.activeTexture(t),A=t)}return{buffers:{color:r,depth:a,stencil:o},enable:P,disable:I,useProgram:function(t){return l!==t&&(e.useProgram(t),l=t,!0)},setBlending:U,setMaterial:function(e,t){2===e.side?I(2884):P(2884);var n=1===e.side;t&&(n=!n),z(n),1===e.blending&&!1===e.transparent?U(0):U(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),a.setFunc(e.depthFunc),a.setTest(e.depthTest),a.setMask(e.depthWrite),r.setMask(e.colorWrite);var i=e.stencilWrite;o.setTest(i),i&&(o.setMask(e.stencilWriteMask),o.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),o.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),B(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)},setFlipSided:z,setCullFace:j,setLineWidth:function(t){t!==x&&(S&&e.lineWidth(t),x=t)},setPolygonOffset:B,setScissorTest:function(e){e?P(3089):I(3089)},activeTexture:H,bindTexture:function(t,n){null===A&&H();var i=L[A];void 0===i&&(i={type:void 0,texture:void 0},L[A]=i),i.type===t&&i.texture===n||(e.bindTexture(t,n||C[t]),i.type=t,i.texture=n)},unbindTexture:function(){var t=L[A];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===k.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),k.copy(t))},viewport:function(t){!1===R.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),R.copy(t))},reset:function(){s={},A=null,L={},l=null,u=null,y=null,b=null,r.reset(),a.reset(),o.reset()}}}function kr(e,t,n,i,r,a,o){var s,l=r.isWebGL2,c=r.maxTextures,u=r.maxCubemapSize,h=r.maxTextureSize,d=r.maxSamples,p=new WeakMap,f=!1;try{f="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function m(e,t){return f?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function v(e,t,n,i){var r=1;if((e.width>i||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?W.floorPowerOfTwo:Math.floor,o=a(r*e.width),l=a(r*e.height);void 0===s&&(s=m(o,l));var c=n?m(o,l):s;return c.width=o,c.height=l,c.getContext("2d").drawImage(e,0,0,o,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+l+")."),c}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function g(e){return W.isPowerOfTwo(e.width)&&W.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function b(t,n,r,a){e.generateMipmap(t),i.get(n).__maxMipLevel=Math.log(Math.max(r,a))*Math.LOG2E}function x(n,i,r){if(!1===l)return i;if(null!==n){if(void 0!==e[n])return e[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var a=i;return 6403===i&&(5126===r&&(a=33326),5131===r&&(a=33325),5121===r&&(a=33321)),6407===i&&(5126===r&&(a=34837),5131===r&&(a=34843),5121===r&&(a=32849)),6408===i&&(5126===r&&(a=34836),5131===r&&(a=34842),5121===r&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||t.get("EXT_color_buffer_float"),a}function w(e){return 1003===e||1004===e||1005===e?9728:9729}function _(t){var n=t.target;n.removeEventListener("dispose",_),function(t){var n=i.get(t);void 0!==n.__webglInit&&(e.deleteTexture(n.__webglTexture),i.remove(t))}(n),n.isVideoTexture&&p.delete(n),o.memory.textures--}function M(t){var n=t.target;n.removeEventListener("dispose",M),function(t){var n=i.get(t),r=i.get(t.texture);if(t){if(void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer&&e.deleteRenderbuffer(n.__webglColorRenderbuffer),n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer);i.remove(t.texture),i.remove(t)}}(n),o.memory.textures--}var S=0;function T(e,t){var r=i.get(e);if(e.isVideoTexture&&function(e){var t=o.render.frame;p.get(e)!==t&&(p.set(e,t),e.update())}(e),e.version>0&&r.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void O(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}function E(t,r){var o=i.get(t);t.version>0&&o.__version!==t.version?function(t,i,r){if(6===i.image.length){R(t,i),n.activeTexture(33984+r),n.bindTexture(34067,t.__webglTexture),e.pixelStorei(37440,i.flipY);for(var o=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),s=i.image[0]&&i.image[0].isDataTexture,c=[],h=0;h<6;h++)c[h]=o||s?s?i.image[h].image:i.image[h]:v(i.image[h],!1,!0,u);var d,p=c[0],f=g(p)||l,m=a.convert(i.format),w=a.convert(i.type),_=x(i.internalFormat,m,w);if(k(34067,i,f),o){for(var M=0;M<6;M++){d=c[M].mipmaps;for(var S=0;S<d.length;S++){var T=d[S];1023!==i.format&&1022!==i.format?null!==m?n.compressedTexImage2D(34069+M,S,_,T.width,T.height,0,T.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+M,S,_,T.width,T.height,0,m,w,T.data)}}t.__maxMipLevel=d.length-1}else{d=i.mipmaps;for(var E=0;E<6;E++)if(s){n.texImage2D(34069+E,0,_,c[E].width,c[E].height,0,m,w,c[E].data);for(var A=0;A<d.length;A++){var L=d[A].image[E].image;n.texImage2D(34069+E,A+1,_,L.width,L.height,0,m,w,L.data)}}else{n.texImage2D(34069+E,0,_,m,w,c[E]);for(var O=0;O<d.length;O++){var C=d[O];n.texImage2D(34069+E,O+1,_,m,w,C.image[E])}}t.__maxMipLevel=d.length}y(i,f)&&b(34067,i,p.width,p.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}}(o,t,r):(n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture))}var A={1e3:10497,1001:33071,1002:33648},L={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function k(n,a,o){o?(e.texParameteri(n,10242,A[a.wrapS]),e.texParameteri(n,10243,A[a.wrapT]),32879!==n&&35866!==n||e.texParameteri(n,32882,A[a.wrapR]),e.texParameteri(n,10240,L[a.magFilter]),e.texParameteri(n,10241,L[a.minFilter])):(e.texParameteri(n,10242,33071),e.texParameteri(n,10243,33071),32879!==n&&35866!==n||e.texParameteri(n,32882,33071),1001===a.wrapS&&1001===a.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(n,10240,w(a.magFilter)),e.texParameteri(n,10241,w(a.minFilter)),1003!==a.minFilter&&1006!==a.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var s=t.get("EXT_texture_filter_anisotropic");if(s){if(1015===a.type&&null===t.get("OES_texture_float_linear"))return;if(1016===a.type&&null===(l||t.get("OES_texture_half_float_linear")))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function R(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",_),t.__webglTexture=e.createTexture(),o.memory.textures++)}function O(t,i,r){var o=3553;i.isDataTexture2DArray&&(o=35866),i.isDataTexture3D&&(o=32879),R(t,i),n.activeTexture(33984+r),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment);var s,c=function(e){return!l&&(1001!==e.wrapS||1001!==e.wrapT||1003!==e.minFilter&&1006!==e.minFilter)}(i)&&!1===g(i.image),u=v(i.image,c,!1,h),d=g(u)||l,p=a.convert(i.format),f=a.convert(i.type),m=x(i.internalFormat,p,f);k(o,i,d);var w=i.mipmaps;if(i.isDepthTexture)m=6402,l?m=1015===i.type?36012:1014===i.type?33190:1020===i.type?35056:33189:1015===i.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===i.format&&6402===m&&1012!==i.type&&1014!==i.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=1012,f=a.convert(i.type)),1027===i.format&&6402===m&&(m=34041,1020!==i.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=1020,f=a.convert(i.type))),n.texImage2D(3553,0,m,u.width,u.height,0,p,f,null);else if(i.isDataTexture)if(w.length>0&&d){for(var _=0,M=w.length;_<M;_++)s=w[_],n.texImage2D(3553,_,m,s.width,s.height,0,p,f,s.data);i.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,m,u.width,u.height,0,p,f,u.data),t.__maxMipLevel=0;else if(i.isCompressedTexture){for(var S=0,T=w.length;S<T;S++)s=w[S],1023!==i.format&&1022!==i.format?null!==p?n.compressedTexImage2D(3553,S,m,s.width,s.height,0,s.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,S,m,s.width,s.height,0,p,f,s.data);t.__maxMipLevel=w.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,m,u.width,u.height,u.depth,0,p,f,u.data),t.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,m,u.width,u.height,u.depth,0,p,f,u.data),t.__maxMipLevel=0;else if(w.length>0&&d){for(var E=0,A=w.length;E<A;E++)s=w[E],n.texImage2D(3553,E,m,p,f,s);i.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else n.texImage2D(3553,0,m,p,f,u),t.__maxMipLevel=0;y(i,d)&&b(o,i,u.width,u.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}function C(t,r,o,s){var l=a.convert(r.texture.format),c=a.convert(r.texture.type),u=x(r.texture.internalFormat,l,c);n.texImage2D(s,0,u,r.width,r.height,0,l,c,null),e.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,s,i.get(r.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function P(t,n,i){if(e.bindRenderbuffer(36161,t),n.depthBuffer&&!n.stencilBuffer){var r=33189;if(i){var o=n.depthTexture;o&&o.isDepthTexture&&(1015===o.type?r=36012:1014===o.type&&(r=33190));var s=I(n);e.renderbufferStorageMultisample(36161,s,r,n.width,n.height)}else e.renderbufferStorage(36161,r,n.width,n.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(n.depthBuffer&&n.stencilBuffer){if(i){var l=I(n);e.renderbufferStorageMultisample(36161,l,35056,n.width,n.height)}else e.renderbufferStorage(36161,34041,n.width,n.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var c=a.convert(n.texture.format),u=a.convert(n.texture.type),h=x(n.texture.internalFormat,c,u);if(i){var d=I(n);e.renderbufferStorageMultisample(36161,d,h,n.width,n.height)}else e.renderbufferStorage(36161,h,n.width,n.height)}e.bindRenderbuffer(36161,null)}function I(e){return l&&e.isWebGLMultisampleRenderTarget?Math.min(d,e.samples):0}var D=!1,N=!1;this.allocateTextureUnit=function(){var e=S;return e>=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),S+=1,e},this.resetTextureUnits=function(){S=0},this.setTexture2D=T,this.setTexture2DArray=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?O(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?O(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=E,this.setupRenderTarget=function(t){var r=i.get(t),s=i.get(t.texture);t.addEventListener("dispose",M),s.__webglTexture=e.createTexture(),o.memory.textures++;var c=!0===t.isWebGLCubeRenderTarget,u=!0===t.isWebGLMultisampleRenderTarget,h=g(t)||l;if(!l||1022!==t.texture.format||1015!==t.texture.type&&1016!==t.texture.type||(t.texture.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){r.__webglFramebuffer=[];for(var d=0;d<6;d++)r.__webglFramebuffer[d]=e.createFramebuffer()}else if(r.__webglFramebuffer=e.createFramebuffer(),u)if(l){r.__webglMultisampledFramebuffer=e.createFramebuffer(),r.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,r.__webglColorRenderbuffer);var p=a.convert(t.texture.format),f=a.convert(t.texture.type),m=x(t.texture.internalFormat,p,f),v=I(t);e.renderbufferStorageMultisample(36161,v,m,t.width,t.height),e.bindFramebuffer(36160,r.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,r.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(r.__webglDepthRenderbuffer=e.createRenderbuffer(),P(r.__webglDepthRenderbuffer,t,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){n.bindTexture(34067,s.__webglTexture),k(34067,t.texture,h);for(var w=0;w<6;w++)C(r.__webglFramebuffer[w],t,36064,34069+w);y(t.texture,h)&&b(34067,t.texture,t.width,t.height),n.bindTexture(34067,null)}else n.bindTexture(3553,s.__webglTexture),k(3553,t.texture,h),C(r.__webglFramebuffer,t,36064,3553),y(t.texture,h)&&b(3553,t.texture,t.width,t.height),n.bindTexture(3553,null);t.depthBuffer&&function(t){var n=i.get(t),r=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,n){if(n&&n.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,t),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),T(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(1026===n.depthTexture.format)e.framebufferTexture2D(36160,36096,3553,r,0);else{if(1027!==n.depthTexture.format)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,r,0)}}(n.__webglFramebuffer,t)}else if(r){n.__webglDepthbuffer=[];for(var a=0;a<6;a++)e.bindFramebuffer(36160,n.__webglFramebuffer[a]),n.__webglDepthbuffer[a]=e.createRenderbuffer(),P(n.__webglDepthbuffer[a],t,!1)}else e.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),P(n.__webglDepthbuffer,t,!1);e.bindFramebuffer(36160,null)}(t)},this.updateRenderTargetMipmap=function(e){var t=e.texture;if(y(t,g(e)||l)){var r=e.isWebGLCubeRenderTarget?34067:3553,a=i.get(t).__webglTexture;n.bindTexture(r,a),b(r,t,e.width,e.height),n.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(l){var n=i.get(t);e.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,n.__webglFramebuffer);var r=t.width,a=t.height,o=16384;t.depthBuffer&&(o|=256),t.stencilBuffer&&(o|=1024),e.blitFramebuffer(0,0,r,a,0,0,r,a,o,9728),e.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===D&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),D=!0),e=e.texture),T(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===N&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),N=!0),e=e.texture),E(e,t)}}function Rr(e,t,n){var i=n.isWebGL2;return{convert:function(e){var n;if(1009===e)return 5121;if(1017===e)return 32819;if(1018===e)return 32820;if(1019===e)return 33635;if(1010===e)return 5120;if(1011===e)return 5122;if(1012===e)return 5123;if(1013===e)return 5124;if(1014===e)return 5125;if(1015===e)return 5126;if(1016===e)return i?5131:null!==(n=t.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(1021===e)return 6406;if(1022===e)return 6407;if(1023===e)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(1026===e)return 6402;if(1027===e)return 34041;if(1028===e)return 6403;if(1029===e)return 36244;if(1030===e)return 33319;if(1031===e)return 33320;if(1032===e)return 36248;if(1033===e)return 36249;if(33776===e||33777===e||33778===e||33779===e){if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===e)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===e||35841===e||35842===e||35843===e){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===e)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===e)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===e)return null!==(n=t.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===e||37496===e)&&null!==(n=t.get("WEBGL_compressed_texture_etc"))){if(37492===e)return n.COMPRESSED_RGB8_ETC2;if(37496===e)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e||37840===e||37841===e||37842===e||37843===e||37844===e||37845===e||37846===e||37847===e||37848===e||37849===e||37850===e||37851===e||37852===e||37853===e?null!==(n=t.get("WEBGL_compressed_texture_astc"))?e:null:36492===e?null!==(n=t.get("EXT_texture_compression_bptc"))?e:null:1020===e?i?34042:null!==(n=t.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function Or(e){_n.call(this),this.cameras=e||[]}function Cr(){et.call(this),this.type="Group"}function Pr(){this._targetRay=null,this._grip=null,this._hand=null}function Ir(e,t){var n=this,i=null,r=1,a=null,o="local-floor",s=null,l=[],c=new Map,u=new _n;u.layers.enable(1),u.viewport=new K;var h=new _n;h.layers.enable(2),h.viewport=new K;var d=[u,h],p=new Or;p.layers.enable(1),p.layers.enable(2);var f=null,m=null;function v(e){var t=c.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function g(){c.forEach((function(e,t){e.disconnect(t)})),c.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),S.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(e){a=e,S.setContext(i),S.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}function b(e){for(var t=i.inputSources,n=0;n<l.length;n++)c.set(t[n],l[n]);for(var r=0;r<e.removed.length;r++){var a=e.removed[r],o=c.get(a);o&&(o.dispatchEvent({type:"disconnected",data:a}),c.delete(a))}for(var s=0;s<e.added.length;s++){var u=e.added[s],h=c.get(u);h&&h.dispatchEvent({type:"connected",data:u})}}this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=l[e];return void 0===t&&(t=new Pr,l[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=l[e];return void 0===t&&(t=new Pr,l[e]=t),t.getGripSpace()},this.getHand=function(e){var t=l[e];return void 0===t&&(t=new Pr,l[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getSession=function(){return i},this.setSession=function(e){if(null!==(i=e)){i.addEventListener("select",v),i.addEventListener("selectstart",v),i.addEventListener("selectend",v),i.addEventListener("squeeze",v),i.addEventListener("squeezestart",v),i.addEventListener("squeezeend",v),i.addEventListener("end",g);var n=t.getContextAttributes();!0!==n.xrCompatible&&t.makeXRCompatible();var a={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:r},s=new XRWebGLLayer(i,t,a);i.updateRenderState({baseLayer:s}),i.requestReferenceSpace(o).then(y),i.addEventListener("inputsourceschange",b)}};var x=new te,w=new te;function _(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.getInverse(e.matrixWorld)}this.getCamera=function(e){p.near=h.near=u.near=e.near,p.far=h.far=u.far=e.far,f===p.near&&m===p.far||(i.updateRenderState({depthNear:p.near,depthFar:p.far}),f=p.near,m=p.far);var t=e.parent,n=p.cameras;_(p,t);for(var r=0;r<n.length;r++)_(n[r],t);e.matrixWorld.copy(p.matrixWorld);for(var a=e.children,o=0,s=a.length;o<s;o++)a[o].updateMatrixWorld(!0);return 2===n.length?function(e,t,n){x.setFromMatrixPosition(t.matrixWorld),w.setFromMatrixPosition(n.matrixWorld);var i=x.distanceTo(w),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],h=(a[8]+1)/a[0],d=o*u,p=o*h,f=i/(-u+h),m=f*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(m),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var v=o+f,g=s+f,y=d-m,b=p+(i-m),_=l*s/g*v,M=c*s/g*v;e.projectionMatrix.makePerspective(y,b,_,M,v,g)}(p,u,h):p.projectionMatrix.copy(u.projectionMatrix),p};var M=null,S=new Rn;S.setAnimationLoop((function(t,n){if(null!==(s=n.getViewerPose(a))){var r=s.views,o=i.renderState.baseLayer;e.setFramebuffer(o.framebuffer);var c=!1;r.length!==p.cameras.length&&(p.cameras.length=0,c=!0);for(var u=0;u<r.length;u++){var h=r[u],f=o.getViewport(h),m=d[u];m.matrix.fromArray(h.transform.matrix),m.projectionMatrix.fromArray(h.projectionMatrix),m.viewport.set(f.x,f.y,f.width,f.height),0===u&&p.matrix.copy(m.matrix),!0===c&&p.cameras.push(m)}}for(var v=i.inputSources,g=0;g<l.length;g++){var y=l[g],b=v[g];y.update(b,n,a)}M&&M(t,n)})),this.setAnimationLoop=function(e){M=e},this.dispose=function(){}}function Dr(e){function t(t,n){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map),n.alphaMap&&(t.alphaMap.value=n.alphaMap),n.specularMap&&(t.specularMap.value=n.specularMap);var i,r,a=e.get(n).envMap;if(a){t.envMap.value=a,t.flipEnvMap.value=a.isCubeTexture&&a._needsFlipEnvMap?-1:1,t.reflectivity.value=n.reflectivity,t.refractionRatio.value=n.refractionRatio;var o=e.get(a).__maxMipLevel;void 0!==o&&(t.maxMipLevel.value=o)}n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity),n.map?i=n.map:n.specularMap?i=n.specularMap:n.displacementMap?i=n.displacementMap:n.normalMap?i=n.normalMap:n.bumpMap?i=n.bumpMap:n.roughnessMap?i=n.roughnessMap:n.metalnessMap?i=n.metalnessMap:n.alphaMap?i=n.alphaMap:n.emissiveMap?i=n.emissiveMap:n.clearcoatMap?i=n.clearcoatMap:n.clearcoatNormalMap?i=n.clearcoatNormalMap:n.clearcoatRoughnessMap&&(i=n.clearcoatRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix)),n.aoMap?r=n.aoMap:n.lightMap&&(r=n.lightMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uv2Transform.value.copy(r.matrix))}function n(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),n.emissiveMap&&(t.emissiveMap.value=n.emissiveMap),n.bumpMap&&(t.bumpMap.value=n.bumpMap,t.bumpScale.value=n.bumpScale,1===n.side&&(t.bumpScale.value*=-1)),n.normalMap&&(t.normalMap.value=n.normalMap,t.normalScale.value.copy(n.normalScale),1===n.side&&t.normalScale.value.negate()),n.displacementMap&&(t.displacementMap.value=n.displacementMap,t.displacementScale.value=n.displacementScale,t.displacementBias.value=n.displacementBias),e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)},refreshMaterialUniforms:function(e,i,r,a){i.isMeshBasicMaterial?t(e,i):i.isMeshLambertMaterial?(t(e,i),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(e,i)):i.isMeshToonMaterial?(t(e,i),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshPhongMaterial?(t(e,i),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshStandardMaterial?(t(e,i),i.isMeshPhysicalMaterial?function(e,t){n(e,t),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen),t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap),t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,1===t.side&&e.clearcoatNormalScale.value.negate()),e.transmission.value=t.transmission,t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap)}(e,i):n(e,i)):i.isMeshMatcapMaterial?(t(e,i),function(e,t){t.matcap&&(e.matcap.value=t.matcap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDepthMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isMeshDistanceMaterial?(t(e,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(e,i)):i.isMeshNormalMaterial?(t(e,i),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,1===t.side&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),1===t.side&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(e,i)):i.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(e,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,i)):i.isPointsMaterial?function(e,t,n,i){var r;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*n,e.scale.value=.5*i,t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.map?r=t.map:t.alphaMap&&(r=t.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i,r,a):i.isSpriteMaterial?function(e,t){var n;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.map?n=t.map:t.alphaMap&&(n=t.alphaMap),void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function Nr(e){var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=void 0!==e.context?e.context:null,i=void 0!==e.alpha&&e.alpha,r=void 0===e.depth||e.depth,a=void 0===e.stencil||e.stencil,o=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,l=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,c=void 0!==e.powerPreference?e.powerPreference:"default",u=void 0!==e.failIfMajorPerformanceCaveat&&e.failIfMajorPerformanceCaveat,h=null,d=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var p=this,f=!1,m=null,v=0,g=0,y=null,b=null,x=-1,w=null,_=null,M=new K,S=new K,T=null,E=t.width,A=t.height,L=1,k=null,R=null,O=new K(0,0,E,A),C=new K(0,0,E,A),P=!1,I=new kn,D=!1,N=!1,F=new ke,U=new te,z={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===y?L:1}var B,H,G,V,X,Y,J,Z,Q,$,ee,ne,ie,re,ae,oe,se,le,ce,ue,he,de=n;function pe(e,n){for(var i=0;i<e.length;i++){var r=e[i],a=t.getContext(r,n);if(null!==a)return a}return null}try{var fe={alpha:i,depth:r,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if(t.addEventListener("webglcontextlost",be,!1),t.addEventListener("webglcontextrestored",xe,!1),null===de){var me=["webgl2","webgl","experimental-webgl"];if(!0===p.isWebGL1Renderer&&me.shift(),null===(de=pe(me,fe)))throw pe(me)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===de.getShaderPrecisionFormat&&(de.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function ve(){B=new Hn(de),!1===(H=new zn(de,B,e)).isWebGL2&&(B.get("WEBGL_depth_texture"),B.get("OES_texture_float"),B.get("OES_texture_half_float"),B.get("OES_texture_half_float_linear"),B.get("OES_standard_derivatives"),B.get("OES_element_index_uint"),B.get("OES_vertex_array_object"),B.get("ANGLE_instanced_arrays")),B.get("OES_texture_float_linear"),ue=new Rr(de,B,H),(G=new Lr(de,B,H)).scissor(S.copy(C).multiplyScalar(L).floor()),G.viewport(M.copy(O).multiplyScalar(L).floor()),V=new Wn(de),X=new fr,Y=new kr(de,B,G,X,H,ue,V),J=new Bn(p),Z=new On(de,H),he=new Fn(de,B,Z,H),Q=new Gn(de,Z,V,he),$=new Jn(de,Q,Z,V),se=new Yn(de),ae=new jn(X),ee=new pr(p,J,B,H,he,ae),ne=new Dr(X),ie=new yr(X),re=new Sr,oe=new Nn(p,J,G,$,s),le=new Un(de,B,V,H),ce=new Vn(de,B,V,H),V.programs=ee.programs,p.capabilities=H,p.extensions=B,p.properties=X,p.renderLists=ie,p.state=G,p.info=V}ve();var ge=new Ir(p,de);this.xr=ge;var ye=new Ar(p,$,H.maxTextureSize);function be(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),f=!0}function xe(){console.log("THREE.WebGLRenderer: Context Restored."),f=!1,ve()}function we(e){var t=e.target;t.removeEventListener("dispose",we),function(e){_e(e),X.remove(e)}(t)}function _e(e){var t=X.get(e).program;void 0!==t&&ee.releaseProgram(t)}this.shadowMap=ye,this.getContext=function(){return de},this.getContextAttributes=function(){return de.getContextAttributes()},this.forceContextLoss=function(){var e=B.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=B.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(e){void 0!==e&&(L=e,this.setSize(E,A,!1))},this.getSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),e=new q),e.set(E,A)},this.setSize=function(e,n,i){ge.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(E=e,A=n,t.width=Math.floor(e*L),t.height=Math.floor(n*L),!1!==i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),e=new q),e.set(E*L,A*L).floor()},this.setDrawingBufferSize=function(e,n,i){E=e,A=n,L=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return void 0===e&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),e=new K),e.copy(M)},this.getViewport=function(e){return e.copy(O)},this.setViewport=function(e,t,n,i){e.isVector4?O.set(e.x,e.y,e.z,e.w):O.set(e,t,n,i),G.viewport(M.copy(O).multiplyScalar(L).floor())},this.getScissor=function(e){return e.copy(C)},this.setScissor=function(e,t,n,i){e.isVector4?C.set(e.x,e.y,e.z,e.w):C.set(e,t,n,i),G.scissor(S.copy(C).multiplyScalar(L).floor())},this.getScissorTest=function(){return P},this.setScissorTest=function(e){G.setScissorTest(P=e)},this.setOpaqueSort=function(e){k=e},this.setTransparentSort=function(e){R=e},this.getClearColor=function(){return oe.getClearColor()},this.setClearColor=function(){oe.setClearColor.apply(oe,arguments)},this.getClearAlpha=function(){return oe.getClearAlpha()},this.setClearAlpha=function(){oe.setClearAlpha.apply(oe,arguments)},this.clear=function(e,t,n){var i=0;(void 0===e||e)&&(i|=16384),(void 0===t||t)&&(i|=256),(void 0===n||n)&&(i|=1024),de.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",be,!1),t.removeEventListener("webglcontextrestored",xe,!1),ie.dispose(),re.dispose(),X.dispose(),J.dispose(),$.dispose(),he.dispose(),ge.dispose(),Se.stop()},this.renderBufferImmediate=function(e,t){he.initAttributes();var n=X.get(e);e.hasPositions&&!n.position&&(n.position=de.createBuffer()),e.hasNormals&&!n.normal&&(n.normal=de.createBuffer()),e.hasUvs&&!n.uv&&(n.uv=de.createBuffer()),e.hasColors&&!n.color&&(n.color=de.createBuffer());var i=t.getAttributes();e.hasPositions&&(de.bindBuffer(34962,n.position),de.bufferData(34962,e.positionArray,35048),he.enableAttribute(i.position),de.vertexAttribPointer(i.position,3,5126,!1,0,0)),e.hasNormals&&(de.bindBuffer(34962,n.normal),de.bufferData(34962,e.normalArray,35048),he.enableAttribute(i.normal),de.vertexAttribPointer(i.normal,3,5126,!1,0,0)),e.hasUvs&&(de.bindBuffer(34962,n.uv),de.bufferData(34962,e.uvArray,35048),he.enableAttribute(i.uv),de.vertexAttribPointer(i.uv,2,5126,!1,0,0)),e.hasColors&&(de.bindBuffer(34962,n.color),de.bufferData(34962,e.colorArray,35048),he.enableAttribute(i.color),de.vertexAttribPointer(i.color,3,5126,!1,0,0)),he.disableUnusedAttributes(),de.drawArrays(4,0,e.count),e.count=0},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=z);var o=r.isMesh&&r.matrixWorld.determinant()<0,s=Re(e,t,i,r);G.setMaterial(i,o);var l=n.index,c=n.attributes.position;if(null===l){if(void 0===c||0===c.count)return}else if(0===l.count)return;var u,h=1;!0===i.wireframe&&(l=Q.getWireframeAttribute(n),h=2),(i.morphTargets||i.morphNormals)&&se.update(r,n,i,s),he.setup(r,i,s,n,l);var d=le;null!==l&&(u=Z.get(l),(d=ce).setIndex(u));var p=null!==l?l.count:c.count,f=n.drawRange.start*h,m=n.drawRange.count*h,v=null!==a?a.start*h:0,g=null!==a?a.count*h:1/0,y=Math.max(f,v),b=Math.min(p,f+m,v+g)-1,x=Math.max(0,b-y+1);if(0!==x){if(r.isMesh)!0===i.wireframe?(G.setLineWidth(i.wireframeLinewidth*j()),d.setMode(1)):d.setMode(4);else if(r.isLine){var w=i.linewidth;void 0===w&&(w=1),G.setLineWidth(w*j()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);if(r.isInstancedMesh)d.renderInstances(y,x,r.count);else if(n.isInstancedBufferGeometry){var _=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(y,x,_)}else d.render(y,x)}},this.compile=function(e,t){(d=re.get(e,t)).init(),e.traverse((function(e){e.isLight&&(d.pushLight(e),e.castShadow&&d.pushShadow(e))})),d.setupLights(t);var n=new WeakMap;e.traverse((function(t){var i=t.material;if(i)if(Array.isArray(i))for(var r=0;r<i.length;r++){var a=i[r];!1===n.has(a)&&(Le(a,e,t),n.set(a))}else!1===n.has(i)&&(Le(i,e,t),n.set(i))}))};var Me=null,Se=new Rn;function Te(e,t,n,i){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||I.intersectsSprite(e)){i&&U.setFromMatrixPosition(e.matrixWorld).applyMatrix4(F);var r=$.update(e),a=e.material;a.visible&&h.push(e,r,a,n,U.z,null)}}else if(e.isImmediateRenderObject)i&&U.setFromMatrixPosition(e.matrixWorld).applyMatrix4(F),h.push(e,null,e.material,n,U.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==V.render.frame&&(e.skeleton.update(),e.skeleton.frame=V.render.frame),!e.frustumCulled||I.intersectsObject(e))){i&&U.setFromMatrixPosition(e.matrixWorld).applyMatrix4(F);var o=$.update(e),s=e.material;if(Array.isArray(s))for(var l=o.groups,c=0,u=l.length;c<u;c++){var p=l[c],f=s[p.materialIndex];f&&f.visible&&h.push(e,o,f,n,U.z,p)}else s.visible&&h.push(e,o,s,n,U.z,null)}for(var m=e.children,v=0,g=m.length;v<g;v++)Te(m[v],t,n,i)}}function Ee(e,t,n){for(var i=!0===t.isScene?t.overrideMaterial:null,r=0,a=e.length;r<a;r++){var o=e[r],s=o.object,l=o.geometry,c=null===i?o.material:i,u=o.group;if(n.isArrayCamera){_=n;for(var h=n.cameras,p=0,f=h.length;p<f;p++){var m=h[p];s.layers.test(m.layers)&&(G.viewport(M.copy(m.viewport)),d.setupLights(m),Ae(s,t,m,l,c,u))}}else _=null,Ae(s,t,n,l,c,u)}}function Ae(e,t,n,i,r,a){if(e.onBeforeRender(p,t,n,i,r,a),d=re.get(t,_||n),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var o=Re(n,t,r,e);G.setMaterial(r),he.reset(),function(e,t){e.render((function(e){p.renderBufferImmediate(e,t)}))}(e,o)}else p.renderBufferDirect(n,t,i,r,e,a);e.onAfterRender(p,t,n,i,r,a),d=re.get(t,_||n)}function Le(e,t,n){!0!==t.isScene&&(t=z);var i=X.get(e),r=d.state.lights,a=d.state.shadowsArray,o=r.state.version,s=ee.getParameters(e,r.state,a,t,n),l=ee.getProgramCacheKey(s),c=i.program,u=!0;if(void 0===c)e.addEventListener("dispose",we);else if(c.cacheKey!==l)_e(e);else if(i.lightsStateVersion!==o)u=!1;else{if(void 0!==s.shaderID){var h=e.isMeshStandardMaterial?t.environment:null;return void(i.envMap=J.get(e.envMap||h))}u=!1}u&&(s.uniforms=ee.getUniforms(e),e.onBeforeCompile(s,p),c=ee.acquireProgram(s,l),i.program=c,i.uniforms=s.uniforms,i.outputEncoding=s.outputEncoding);var f=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=ae.numPlanes,i.numIntersection=ae.numIntersection,f.clippingPlanes=ae.uniform),i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=J.get(e.envMap||i.environment),i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=o,i.needsLights&&(f.ambientLightColor.value=r.state.ambient,f.lightProbe.value=r.state.probe,f.directionalLights.value=r.state.directional,f.directionalLightShadows.value=r.state.directionalShadow,f.spotLights.value=r.state.spot,f.spotLightShadows.value=r.state.spotShadow,f.rectAreaLights.value=r.state.rectArea,f.ltc_1.value=r.state.rectAreaLTC1,f.ltc_2.value=r.state.rectAreaLTC2,f.pointLights.value=r.state.point,f.pointLightShadows.value=r.state.pointShadow,f.hemisphereLights.value=r.state.hemi,f.directionalShadowMap.value=r.state.directionalShadowMap,f.directionalShadowMatrix.value=r.state.directionalShadowMatrix,f.spotShadowMap.value=r.state.spotShadowMap,f.spotShadowMatrix.value=r.state.spotShadowMatrix,f.pointShadowMap.value=r.state.pointShadowMap,f.pointShadowMatrix.value=r.state.pointShadowMatrix);var m=i.program.getUniforms(),v=qi.seqWithValue(m.seq,f);i.uniformsList=v}function Re(e,t,n,i){!0!==t.isScene&&(t=z),Y.resetTextureUnits();var r=t.fog,a=n.isMeshStandardMaterial?t.environment:null,o=null===y?p.outputEncoding:y.texture.encoding,s=J.get(n.envMap||a),l=X.get(n),c=d.state.lights;if(!0===D&&(!0===N||e!==w)){var u=e===w&&n.id===x;ae.setState(n,e,u)}n.version===l.__version?n.fog&&l.fog!==r||l.environment!==a||l.needsLights&&l.lightsStateVersion!==c.state.version?Le(n,t,i):void 0===l.numClippingPlanes||l.numClippingPlanes===ae.numPlanes&&l.numIntersection===ae.numIntersection?(l.outputEncoding!==o||l.envMap!==s)&&Le(n,t,i):Le(n,t,i):(Le(n,t,i),l.__version=n.version);var h,f,m=!1,v=!1,g=!1,b=l.program,_=b.getUniforms(),M=l.uniforms;if(G.useProgram(b.program)&&(m=!0,v=!0,g=!0),n.id!==x&&(x=n.id,v=!0),m||w!==e){if(_.setValue(de,"projectionMatrix",e.projectionMatrix),H.logarithmicDepthBuffer&&_.setValue(de,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),w!==e&&(w=e,v=!0,g=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){var S=_.map.cameraPosition;void 0!==S&&S.setValue(de,U.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&_.setValue(de,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||n.skinning)&&_.setValue(de,"viewMatrix",e.matrixWorldInverse)}if(n.skinning){_.setOptional(de,i,"bindMatrix"),_.setOptional(de,i,"bindMatrixInverse");var T=i.skeleton;if(T){var E=T.bones;if(H.floatVertexTextures){if(void 0===T.boneTexture){var k=Math.sqrt(4*E.length);k=W.ceilPowerOfTwo(k),k=Math.max(k,4);var R=new Float32Array(k*k*4);R.set(T.boneMatrices);var O=new En(R,k,k,1023,1015);T.boneMatrices=R,T.boneTexture=O,T.boneTextureSize=k}_.setValue(de,"boneTexture",T.boneTexture,Y),_.setValue(de,"boneTextureSize",T.boneTextureSize)}else _.setOptional(de,T,"boneMatrices")}}return(v||l.receiveShadow!==i.receiveShadow)&&(l.receiveShadow=i.receiveShadow,_.setValue(de,"receiveShadow",i.receiveShadow)),v&&(_.setValue(de,"toneMappingExposure",p.toneMappingExposure),l.needsLights&&(f=g,(h=M).ambientLightColor.needsUpdate=f,h.lightProbe.needsUpdate=f,h.directionalLights.needsUpdate=f,h.directionalLightShadows.needsUpdate=f,h.pointLights.needsUpdate=f,h.pointLightShadows.needsUpdate=f,h.spotLights.needsUpdate=f,h.spotLightShadows.needsUpdate=f,h.rectAreaLights.needsUpdate=f,h.hemisphereLights.needsUpdate=f),r&&n.fog&&ne.refreshFogUniforms(M,r),ne.refreshMaterialUniforms(M,n,L,A),qi.upload(de,l.uniformsList,M,Y)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(qi.upload(de,l.uniformsList,M,Y),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&_.setValue(de,"center",i.center),_.setValue(de,"modelViewMatrix",i.modelViewMatrix),_.setValue(de,"normalMatrix",i.normalMatrix),_.setValue(de,"modelMatrix",i.matrixWorld),b}Se.setAnimationLoop((function(e){ge.isPresenting||Me&&Me(e)})),"undefined"!=typeof window&&Se.setContext(window),this.setAnimationLoop=function(e){Me=e,ge.setAnimationLoop(e),null===e?Se.stop():Se.start()},this.render=function(e,t){var n,i;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),i=arguments[3]),void 0===t||!0===t.isCamera){if(!0!==f){he.resetDefaultState(),x=-1,w=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),!0===ge.enabled&&!0===ge.isPresenting&&(t=ge.getCamera(t)),!0===e.isScene&&e.onBeforeRender(p,e,t,n||y),(d=re.get(e,t)).init(),F.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),I.setFromProjectionMatrix(F),N=this.localClippingEnabled,D=ae.init(this.clippingPlanes,N,t),(h=ie.get(e,t)).init(),Te(e,t,0,p.sortObjects),h.finish(),!0===p.sortObjects&&h.sort(k,R),!0===D&&ae.beginShadows();var r=d.state.shadowsArray;ye.render(r,e,t),d.setupLights(t),!0===D&&ae.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),oe.render(h,e,t,i);var a=h.opaque,o=h.transparent;a.length>0&&Ee(a,e,t),o.length>0&&Ee(o,e,t),!0===e.isScene&&e.onAfterRender(p,e,t),null!==y&&(Y.updateRenderTargetMipmap(y),Y.updateMultisampleRenderTarget(y)),G.buffers.depth.setTest(!0),G.buffers.depth.setMask(!0),G.buffers.color.setMask(!0),G.setPolygonOffset(!1),h=null,d=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(e){m!==e&&null===y&&de.bindFramebuffer(36160,e),m=e},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return g},this.getRenderList=function(){return h},this.setRenderList=function(e){h=e},this.getRenderState=function(){return d},this.setRenderState=function(e){d=e},this.getRenderTarget=function(){return y},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;y=e,v=t,g=n,e&&void 0===X.get(e).__webglFramebuffer&&Y.setupRenderTarget(e);var i=m,r=!1;if(e){var a=X.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=a[t],r=!0):i=e.isWebGLMultisampleRenderTarget?X.get(e).__webglMultisampledFramebuffer:a,M.copy(e.viewport),S.copy(e.scissor),T=e.scissorTest}else M.copy(O).multiplyScalar(L).floor(),S.copy(C).multiplyScalar(L).floor(),T=P;if(b!==i&&(de.bindFramebuffer(36160,i),b=i),G.viewport(M),G.scissor(S),G.setScissorTest(T),r){var o=X.get(e.texture);de.framebufferTexture2D(36160,36064,34069+t,o.__webglTexture,n)}},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(e&&e.isWebGLRenderTarget){var s=X.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){var l=!1;s!==b&&(de.bindFramebuffer(36160,s),l=!0);try{var c=e.texture,u=c.format,h=c.type;if(1023!==u&&ue.convert(u)!==de.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(1009===h||ue.convert(h)===de.getParameter(35738)||1015===h&&(H.isWebGL2||B.get("OES_texture_float")||B.get("WEBGL_color_buffer_float"))||1016===h&&(H.isWebGL2?B.get("EXT_color_buffer_float"):B.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===de.checkFramebufferStatus(36160)?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&de.readPixels(t,n,i,r,ue.convert(u),ue.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&de.bindFramebuffer(36160,b)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),o=ue.convert(t.format);Y.setTexture2D(t,0),de.copyTexImage2D(3553,n,o,e.x,e.y,r,a,0),G.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i){void 0===i&&(i=0);var r=t.image.width,a=t.image.height,o=ue.convert(n.format),s=ue.convert(n.type);Y.setTexture2D(n,0),de.pixelStorei(37440,n.flipY),de.pixelStorei(37441,n.premultiplyAlpha),de.pixelStorei(3317,n.unpackAlignment),t.isDataTexture?de.texSubImage2D(3553,i,e.x,e.y,r,a,o,s,t.image.data):t.isCompressedTexture?de.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,o,t.mipmaps[0].data):de.texSubImage2D(3553,i,e.x,e.y,o,s,t.image),0===i&&n.generateMipmaps&&de.generateMipmap(3553),G.unbindTexture()},this.initTexture=function(e){Y.setTexture2D(e,0),G.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Fr(e){Nr.call(this,e)}Tr.prototype=Object.create(Tt.prototype),Tr.prototype.constructor=Tr,Tr.prototype.isMeshDepthMaterial=!0,Tr.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},Er.prototype=Object.create(Tt.prototype),Er.prototype.constructor=Er,Er.prototype.isMeshDistanceMaterial=!0,Er.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},Or.prototype=Object.assign(Object.create(_n.prototype),{constructor:Or,isArrayCamera:!0}),Cr.prototype=Object.assign(Object.create(et.prototype),{constructor:Cr,isGroup:!0}),Object.assign(Pr.prototype,{constructor:Pr,getHandSpace:function(){if(null===this._hand&&(this._hand=new Cr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints=[],this._hand.inputState={pinching:!1},window.XRHand))for(var e=0;e<=window.XRHand.LITTLE_PHALANX_TIP;e++){var t=new Cr;t.matrixAutoUpdate=!1,t.visible=!1,this._hand.joints.push(t),this._hand.add(t)}return this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Cr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Cr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(e,t,n){var i=null,r=null,a=null,o=this._targetRay,s=this._grip,l=this._hand;if(e)if(l&&e.hand){a=!0;for(var c=0;c<=window.XRHand.LITTLE_PHALANX_TIP;c++)if(e.hand[c]){var u=t.getJointPose(e.hand[c],n),h=l.joints[c];null!==u&&(h.matrix.fromArray(u.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.jointRadius=u.radius),h.visible=null!==u;var d=l.joints[window.XRHand.INDEX_PHALANX_TIP],p=l.joints[window.XRHand.THUMB_PHALANX_TIP],f=d.position.distanceTo(p.position);l.inputState.pinching&&f>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&f<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}}else null!==o&&(null!==(i=t.getPose(e.targetRaySpace,n))&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale))),null!==s&&e.gripSpace&&(null!==(r=t.getPose(e.gripSpace,n))&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale)));return null!==o&&(o.visible=null!==i),null!==s&&(s.visible=null!==r),null!==l&&(l.visible=null!==a),this}}),Object.assign(Ir.prototype,j.prototype),Fr.prototype=Object.assign(Object.create(Nr.prototype),{constructor:Fr,isWebGL1Renderer:!0});var Ur=function(e){Object(p.a)(n,e);var t=b(n);function n(){var e;return Object(h.a)(this,n),e=t.call(this),Object.defineProperty(Object(o.a)(e),"isScene",{value:!0}),e.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:Object(o.a)(e)})),e}return Object(d.a)(n,[{key:"copy",value:function(e,t){return Object(a.a)(Object(m.a)(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=Object(a.a)(Object(m.a)(n.prototype),"toJSON",this).call(this,e);return null!==this.background&&(t.object.background=this.background.toJSON(e)),null!==this.environment&&(t.object.environment=this.environment.toJSON(e)),null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}]),n}(et);function zr(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=W.generateUUID()}Object.defineProperty(zr.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(zr.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this},set:function(e,t){return void 0===t&&(t=0),this.array.set(e,t),this},clone:function(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=W.generateUUID()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new zr(new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),this.stride);return t.setUsage(this.usage),t},onUpload:function(e){return this.onUploadCallback=e,this},toJSON:function(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=W.generateUUID()),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}}});var jr,Br=new te;function Hr(e,t,n,i){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}function Gr(e){Tt.call(this),this.type="SpriteMaterial",this.color=new _t(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.defineProperties(Hr.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}},needsUpdate:{set:function(e){this.data.needsUpdate=e}}}),Object.assign(Hr.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)Br.x=this.getX(t),Br.y=this.getY(t),Br.z=this.getZ(t),Br.applyMatrix4(e),this.setXYZ(t,Br.x,Br.y,Br.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this},clone:function(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var t=[],n=0;n<this.count;n++)for(var i=n*this.data.stride+this.offset,r=0;r<this.itemSize;r++)t.push(this.data.array[i+r]);return new kt(new this.array.constructor(t),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 Hr(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)},toJSON: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 i=n*this.data.stride+this.offset,r=0;r<this.itemSize;r++)t.push(this.data.array[i+r]);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}}}),Gr.prototype=Object.create(Tt.prototype),Gr.prototype.constructor=Gr,Gr.prototype.isSpriteMaterial=!0,Gr.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var Vr=new te,Wr=new te,qr=new te,Xr=new q,Yr=new q,Jr=new ke,Zr=new te,Kr=new te,Qr=new te,$r=new q,ea=new q,ta=new q;function na(e){if(et.call(this),this.type="Sprite",void 0===jr){jr=new Yt;var t=new zr(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);jr.setIndex([0,1,2,0,2,3]),jr.setAttribute("position",new Hr(t,3,0,!1)),jr.setAttribute("uv",new Hr(t,2,3,!1))}this.geometry=jr,this.material=void 0!==e?e:new Gr,this.center=new q(.5,.5)}function ia(e,t,n,i,r,a){Xr.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(Yr.x=a*Xr.x-r*Xr.y,Yr.y=r*Xr.x+a*Xr.y):Yr.copy(Xr),e.copy(t),e.x+=Yr.x,e.y+=Yr.y,e.applyMatrix4(Jr)}na.prototype=Object.assign(Object.create(et.prototype),{constructor:na,isSprite:!0,raycast:function(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Wr.setFromMatrixScale(this.matrixWorld),Jr.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),qr.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Wr.multiplyScalar(-qr.z);var n,i,r=this.material.rotation;0!==r&&(i=Math.cos(r),n=Math.sin(r));var a=this.center;ia(Zr.set(-.5,-.5,0),qr,a,Wr,n,i),ia(Kr.set(.5,-.5,0),qr,a,Wr,n,i),ia(Qr.set(.5,.5,0),qr,a,Wr,n,i),$r.set(0,0),ea.set(1,0),ta.set(1,1);var o=e.ray.intersectTriangle(Zr,Kr,Qr,!1,Vr);if(null!==o||(ia(Kr.set(-.5,.5,0),qr,a,Wr,n,i),ea.set(0,1),null!==(o=e.ray.intersectTriangle(Zr,Qr,Kr,!1,Vr)))){var s=e.ray.origin.distanceTo(Vr);s<e.near||s>e.far||t.push({distance:s,point:Vr.clone(),uv:mt.getUV(Vr,Zr,Kr,Qr,$r,ea,ta,new q),face:null,object:this})}},copy:function(e){return et.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}});var ra=new te,aa=new te;function oa(){et.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function sa(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),pn.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ke,this.bindMatrixInverse=new ke}oa.prototype=Object.assign(Object.create(et.prototype),{constructor:oa,isLOD:!0,copy:function(e){et.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n<i;n++){var r=t[n];this.addLevel(r.object.clone(),r.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){void 0===t&&(t=0),t=Math.abs(t);var n,i=this.levels;for(n=0;n<i.length&&!(t<i[n].distance);n++);return i.splice(n,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){var n,i;for(n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){if(this.levels.length>0){ra.setFromMatrixPosition(this.matrixWorld);var n=e.ray.origin.distanceTo(ra);this.getObjectForDistance(n).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){ra.setFromMatrixPosition(e.matrixWorld),aa.setFromMatrixPosition(this.matrixWorld);var n,i,r=ra.distanceTo(aa)/e.zoom;for(t[0].object.visible=!0,n=1,i=t.length;n<i&&r>=t[n].distance;n++)t[n-1].object.visible=!1,t[n].object.visible=!0;for(this._currentLevel=n-1;n<i;n++)t[n].object.visible=!1}},toJSON:function(e){var t=et.prototype.toJSON.call(this,e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,i=0,r=n.length;i<r;i++){var a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}}),sa.prototype=Object.assign(Object.create(pn.prototype),{constructor:sa,isSkinnedMesh:!0,copy:function(e){return pn.prototype.copy.call(this,e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this},bind:function(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new K,t=this.geometry.attributes.skinWeight,n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){pn.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},boneTransform:function(){var e=new te,t=new K,n=new K,i=new te,r=new ke;return function(a,o){var s=this.skeleton,l=this.geometry;t.fromBufferAttribute(l.attributes.skinIndex,a),n.fromBufferAttribute(l.attributes.skinWeight,a),e.fromBufferAttribute(l.attributes.position,a).applyMatrix4(this.bindMatrix),o.set(0,0,0);for(var c=0;c<4;c++){var u=n.getComponent(c);if(0!==u){var h=t.getComponent(c);r.multiplyMatrices(s.bones[h].matrixWorld,s.boneInverses[h]),o.addScaledVector(i.copy(e).applyMatrix4(r),u)}}return o.applyMatrix4(this.bindMatrixInverse)}}()});var la=new ke,ca=new ke;function ua(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),this.frame=-1,void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new ke)}}function ha(){et.call(this),this.type="Bone"}Object.assign(ua.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new ke;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){for(var e=0,t=this.bones.length;e<t;e++){var n=this.bones[e];n&&n.matrixWorld.getInverse(this.boneInverses[e])}for(var i=0,r=this.bones.length;i<r;i++){var a=this.bones[i];a&&(a.parent&&a.parent.isBone?(a.matrix.getInverse(a.parent.matrixWorld),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture,r=0,a=e.length;r<a;r++){var o=e[r]?e[r].matrixWorld:ca;la.multiplyMatrices(o,t[r]),la.toArray(n,16*r)}void 0!==i&&(i.needsUpdate=!0)},clone:function(){return new ua(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var i=this.bones[t];if(i.name===e)return i}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}}),ha.prototype=Object.assign(Object.create(et.prototype),{constructor:ha,isBone:!0});var da=new ke,pa=new ke,fa=[],ma=new pn;function va(e,t,n){pn.call(this,e,t),this.instanceMatrix=new kt(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}function ga(e){Tt.call(this),this.type="LineBasicMaterial",this.color=new _t(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}va.prototype=Object.assign(Object.create(pn.prototype),{constructor:va,isInstancedMesh:!0,copy:function(e){return pn.prototype.copy.call(this,e),this.instanceMatrix.copy(e.instanceMatrix),this.count=e.count,this},setColorAt:function(e,t){null===this.instanceColor&&(this.instanceColor=new kt(new Float32Array(3*this.count),3)),t.toArray(this.instanceColor.array,3*e)},getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,16*e)},raycast:function(e,t){var n=this.matrixWorld,i=this.count;if(ma.geometry=this.geometry,ma.material=this.material,void 0!==ma.material)for(var r=0;r<i;r++){this.getMatrixAt(r,da),pa.multiplyMatrices(n,da),ma.matrixWorld=pa,ma.raycast(e,fa);for(var a=0,o=fa.length;a<o;a++){var s=fa[a];s.instanceId=r,s.object=this,t.push(s)}fa.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,16*e)},updateMorphTargets:function(){}}),ga.prototype=Object.create(Tt.prototype),ga.prototype.constructor=ga,ga.prototype.isLineBasicMaterial=!0,ga.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this};var ya=new te,ba=new te,xa=new ke,wa=new Le,_a=new xe;function Ma(e,t,n){1===n&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),et.call(this),this.type="Line",this.geometry=void 0!==e?e:new Yt,this.material=void 0!==t?t:new ga,this.updateMorphTargets()}Ma.prototype=Object.assign(Object.create(et.prototype),{constructor:Ma,isLine:!0,copy:function(e){return et.prototype.copy.call(this,e),this.material=e.material,this.geometry=e.geometry,this},computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[0],i=1,r=t.count;i<r;i++)ya.fromBufferAttribute(t,i-1),ba.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=ya.distanceTo(ba);e.setAttribute("lineDistance",new Ft(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices,o=e.lineDistances;o[0]=0;for(var s=1,l=a.length;s<l;s++)o[s]=o[s-1],o[s]+=a[s-1].distanceTo(a[s])}return this},raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),_a.copy(n.boundingSphere),_a.applyMatrix4(i),_a.radius+=r,!1!==e.ray.intersectsSphere(_a)){xa.getInverse(i),wa.copy(e.ray).applyMatrix4(xa);var a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new te,l=new te,c=new te,u=new te,h=this.isLineSegments?2:1;if(n.isBufferGeometry){var d=n.index,p=n.attributes.position;if(null!==d)for(var f=d.array,m=0,v=f.length-1;m<v;m+=h){var g=f[m],y=f[m+1];if(s.fromBufferAttribute(p,g),l.fromBufferAttribute(p,y),!(wa.distanceSqToSegment(s,l,u,c)>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else for(var x=0,w=p.count-1;x<w;x+=h)if(s.fromBufferAttribute(p,x),l.fromBufferAttribute(p,x+1),!(wa.distanceSqToSegment(s,l,u,c)>o)){u.applyMatrix4(this.matrixWorld);var _=e.ray.origin.distanceTo(u);_<e.near||_>e.far||t.push({distance:_,point:c.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else if(n.isGeometry)for(var M=n.vertices,S=M.length,T=0;T<S-1;T+=h)if(!(wa.distanceSqToSegment(M[T],M[T+1],u,c)>o)){u.applyMatrix4(this.matrixWorld);var E=e.ray.origin.distanceTo(u);E<e.near||E>e.far||t.push({distance:E,point:c.clone().applyMatrix4(this.matrixWorld),index:T,face:null,faceIndex:null,object:this})}}},updateMorphTargets:function(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(n.length>0){var i=t[n[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,a=i.length;r<a;r++){var o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}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.")}}});var Sa=new te,Ta=new te;function Ea(e,t){Ma.call(this,e,t),this.type="LineSegments"}function Aa(e,t){Ma.call(this,e,t),this.type="LineLoop"}function La(e){Tt.call(this),this.type="PointsMaterial",this.color=new _t(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}Ea.prototype=Object.assign(Object.create(Ma.prototype),{constructor:Ea,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],i=0,r=t.count;i<r;i+=2)Sa.fromBufferAttribute(t,i),Ta.fromBufferAttribute(t,i+1),n[i]=0===i?0:n[i-1],n[i+1]=n[i]+Sa.distanceTo(Ta);e.setAttribute("lineDistance",new Ft(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry)for(var a=e.vertices,o=e.lineDistances,s=0,l=a.length;s<l;s+=2)Sa.copy(a[s]),Ta.copy(a[s+1]),o[s]=0===s?0:o[s-1],o[s+1]=o[s]+Sa.distanceTo(Ta);return this}}),Aa.prototype=Object.assign(Object.create(Ma.prototype),{constructor:Aa,isLineLoop:!0}),La.prototype=Object.create(Tt.prototype),La.prototype.constructor=La,La.prototype.isPointsMaterial=!0,La.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};var ka=new ke,Ra=new Le,Oa=new xe,Ca=new te;function Pa(e,t){et.call(this),this.type="Points",this.geometry=void 0!==e?e:new Yt,this.material=void 0!==t?t:new La,this.updateMorphTargets()}function Ia(e,t,n,i,r,a,o){var s=Ra.distanceSqToPoint(e);if(s<n){var l=new te;Ra.closestPointToPoint(e,l),l.applyMatrix4(i);var c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}function Da(e,t,n,i,r,a,o,s,l){Z.call(this,e,t,n,i,r,a,o,s,l),this.format=void 0!==o?o:1022,this.minFilter=void 0!==a?a:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1;var c=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){c.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}function Na(e,t,n,i,r,a,o,s,l,c,u,h){Z.call(this,null,a,o,s,l,c,i,r,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Fa(e,t,n,i,r,a,o,s,l){Z.call(this,e,t,n,i,r,a,o,s,l),this.needsUpdate=!0}function Ua(e,t,n,i,r,a,o,s,l,c){if(1026!==(c=void 0!==c?c:1026)&&1027!==c)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&1026===c&&(n=1012),void 0===n&&1027===c&&(n=1020),Z.call(this,null,i,r,a,o,s,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:1003,this.minFilter=void 0!==s?s:1003,this.flipY=!1,this.generateMipmaps=!1}Pa.prototype=Object.assign(Object.create(et.prototype),{constructor:Pa,isPoints:!0,copy:function(e){return et.prototype.copy.call(this,e),this.material=e.material,this.geometry=e.geometry,this},raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Oa.copy(n.boundingSphere),Oa.applyMatrix4(i),Oa.radius+=r,!1!==e.ray.intersectsSphere(Oa)){ka.getInverse(i),Ra.copy(e.ray).applyMatrix4(ka);var a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,l=n.attributes.position;if(null!==s)for(var c=s.array,u=0,h=c.length;u<h;u++){var d=c[u];Ca.fromBufferAttribute(l,d),Ia(Ca,d,o,i,e,t,this)}else for(var p=0,f=l.count;p<f;p++)Ca.fromBufferAttribute(l,p),Ia(Ca,p,o,i,e,t,this)}else for(var m=n.vertices,v=0,g=m.length;v<g;v++)Ia(m[v],v,o,i,e,t,this)}},updateMorphTargets:function(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(n.length>0){var i=t[n[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var r=0,a=i.length;r<a;r++){var o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}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.")}}}),Da.prototype=Object.assign(Object.create(Z.prototype),{constructor:Da,isVideoTexture:!0,update:function(){var e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Na.prototype=Object.create(Z.prototype),Na.prototype.constructor=Na,Na.prototype.isCompressedTexture=!0,Fa.prototype=Object.create(Z.prototype),Fa.prototype.constructor=Fa,Fa.prototype.isCanvasTexture=!0,Ua.prototype=Object.create(Z.prototype),Ua.prototype.constructor=Ua,Ua.prototype.isDepthTexture=!0;var za=0,ja=new ke,Ba=new et,Ha=new te;function Ga(){Object.defineProperty(this,"id",{value:za+=2}),this.uuid=W.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}Ga.prototype=Object.assign(Object.create(j.prototype),{constructor:Ga,isGeometry:!0,applyMatrix4:function(e){for(var t=(new X).getNormalMatrix(e),n=0,i=this.vertices.length;n<i;n++)this.vertices[n].applyMatrix4(e);for(var r=0,a=this.faces.length;r<a;r++){var o=this.faces[r];o.normal.applyMatrix3(t).normalize();for(var s=0,l=o.vertexNormals.length;s<l;s++)o.vertexNormals[s].applyMatrix3(t).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return ja.makeRotationX(e),this.applyMatrix4(ja),this},rotateY:function(e){return ja.makeRotationY(e),this.applyMatrix4(ja),this},rotateZ:function(e){return ja.makeRotationZ(e),this.applyMatrix4(ja),this},translate:function(e,t,n){return ja.makeTranslation(e,t,n),this.applyMatrix4(ja),this},scale:function(e,t,n){return ja.makeScale(e,t,n),this.applyMatrix4(ja),this},lookAt:function(e){return Ba.lookAt(e),Ba.updateMatrix(),this.applyMatrix4(Ba.matrix),this},fromBufferGeometry:function(e){var t=this,n=null!==e.index?e.index:void 0,i=e.attributes;if(void 0===i.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var r=i.position,a=i.normal,o=i.color,s=i.uv,l=i.uv2;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var c=0;c<r.count;c++)t.vertices.push((new te).fromBufferAttribute(r,c)),void 0!==o&&t.colors.push((new _t).fromBufferAttribute(o,c));function u(e,n,i,r){var c=void 0===o?[]:[t.colors[e].clone(),t.colors[n].clone(),t.colors[i].clone()],u=void 0===a?[]:[(new te).fromBufferAttribute(a,e),(new te).fromBufferAttribute(a,n),(new te).fromBufferAttribute(a,i)],h=new Mt(e,n,i,u,c,r);t.faces.push(h),void 0!==s&&t.faceVertexUvs[0].push([(new q).fromBufferAttribute(s,e),(new q).fromBufferAttribute(s,n),(new q).fromBufferAttribute(s,i)]),void 0!==l&&t.faceVertexUvs[1].push([(new q).fromBufferAttribute(l,e),(new q).fromBufferAttribute(l,n),(new q).fromBufferAttribute(l,i)])}var h=e.groups;if(h.length>0)for(var d=0;d<h.length;d++)for(var p=h[d],f=p.start,m=f,v=f+p.count;m<v;m+=3)void 0!==n?u(n.getX(m),n.getX(m+1),n.getX(m+2),p.materialIndex):u(m,m+1,m+2,p.materialIndex);else if(void 0!==n)for(var g=0;g<n.count;g+=3)u(n.getX(g),n.getX(g+1),n.getX(g+2));else for(var y=0;y<r.count;y+=3)u(y,y+1,y+2);return this.computeFaceNormals(),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ha).negate(),this.translate(Ha.x,Ha.y,Ha.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=0===t?1:1/t,i=new ke;return i.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(i),this},computeFaceNormals:function(){for(var e=new te,t=new te,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){void 0===e&&(e=!0);for(var t=new Array(this.vertices.length),n=0,i=this.vertices.length;n<i;n++)t[n]=new te;if(e)for(var r=new te,a=new te,o=0,s=this.faces.length;o<s;o++){var l=this.faces[o],c=this.vertices[l.a],u=this.vertices[l.b],h=this.vertices[l.c];r.subVectors(h,u),a.subVectors(c,u),r.cross(a),t[l.a].add(r),t[l.b].add(r),t[l.c].add(r)}else{this.computeFaceNormals();for(var d=0,p=this.faces.length;d<p;d++){var f=this.faces[d];t[f.a].add(f.normal),t[f.b].add(f.normal),t[f.c].add(f.normal)}}for(var m=0,v=this.vertices.length;m<v;m++)t[m].normalize();for(var g=0,y=this.faces.length;g<y;g++){var b=this.faces[g],x=b.vertexNormals;3===x.length?(x[0].copy(t[b.a]),x[1].copy(t[b.b]),x[2].copy(t[b.c])):(x[0]=t[b.a].clone(),x[1]=t[b.b].clone(),x[2]=t[b.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){this.computeFaceNormals();for(var e=0,t=this.faces.length;e<t;e++){var n=this.faces[e],i=n.vertexNormals;3===i.length?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(var e=0,t=this.faces.length;e<t;e++){var n=this.faces[e];n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]);for(var i=0,r=n.vertexNormals.length;i<r;i++)n.__originalVertexNormals[i]?n.__originalVertexNormals[i].copy(n.vertexNormals[i]):n.__originalVertexNormals[i]=n.vertexNormals[i].clone()}var a=new Ga;a.faces=this.faces;for(var o=0,s=this.morphTargets.length;o<s;o++){if(!this.morphNormals[o]){this.morphNormals[o]={},this.morphNormals[o].faceNormals=[],this.morphNormals[o].vertexNormals=[];for(var l=this.morphNormals[o].faceNormals,c=this.morphNormals[o].vertexNormals,u=0,h=this.faces.length;u<h;u++){var d=new te,p={a:new te,b:new te,c:new te};l.push(d),c.push(p)}}var f=this.morphNormals[o];a.vertices=this.morphTargets[o].vertices,a.computeFaceNormals(),a.computeVertexNormals();for(var m=0,v=this.faces.length;m<v;m++){var g=this.faces[m],y=f.faceNormals[m],b=f.vertexNormals[m];y.copy(g.normal),b.a.copy(g.vertexNormals[0]),b.b.copy(g.vertexNormals[1]),b.c.copy(g.vertexNormals[2])}}for(var x=0,w=this.faces.length;x<w;x++){var _=this.faces[x];_.normal=_.__originalFaceNormal,_.vertexNormals=_.__originalVertexNormals}},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new re),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new xe),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(e&&e.isGeometry){var i,r=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,l=e.faces,c=this.colors,u=e.colors;void 0===n&&(n=0),void 0!==t&&(i=(new X).getNormalMatrix(t));for(var h=0,d=o.length;h<d;h++){var p=o[h].clone();void 0!==t&&p.applyMatrix4(t),a.push(p)}for(var f=0,m=u.length;f<m;f++)c.push(u[f].clone());for(var v=0,g=l.length;v<g;v++){var y=l[v],b=void 0,x=void 0,w=y.vertexNormals,_=y.vertexColors,M=new Mt(y.a+r,y.b+r,y.c+r);M.normal.copy(y.normal),void 0!==i&&M.normal.applyMatrix3(i).normalize();for(var S=0,T=w.length;S<T;S++)b=w[S].clone(),void 0!==i&&b.applyMatrix3(i).normalize(),M.vertexNormals.push(b);M.color.copy(y.color);for(var E=0,A=_.length;E<A;E++)x=_[E],M.vertexColors.push(x.clone());M.materialIndex=y.materialIndex+n,s.push(M)}for(var L=0,k=e.faceVertexUvs.length;L<k;L++){var R=e.faceVertexUvs[L];void 0===this.faceVertexUvs[L]&&(this.faceVertexUvs[L]=[]);for(var O=0,C=R.length;O<C;O++){for(var P=R[O],I=[],D=0,N=P.length;D<N;D++)I.push(P[D].clone());this.faceVertexUvs[L].push(I)}}}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)):console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){for(var e={},t=[],n=[],i=Math.pow(10,4),r=0,a=this.vertices.length;r<a;r++){var o=this.vertices[r],s=Math.round(o.x*i)+"_"+Math.round(o.y*i)+"_"+Math.round(o.z*i);void 0===e[s]?(e[s]=r,t.push(this.vertices[r]),n[r]=t.length-1):n[r]=n[e[s]]}for(var l=[],c=0,u=this.faces.length;c<u;c++){var h=this.faces[c];h.a=n[h.a],h.b=n[h.b],h.c=n[h.c];for(var d=[h.a,h.b,h.c],p=0;p<3;p++)if(d[p]===d[(p+1)%3]){l.push(c);break}}for(var f=l.length-1;f>=0;f--){var m=l[f];this.faces.splice(m,1);for(var v=0,g=this.faceVertexUvs.length;v<g;v++)this.faceVertexUvs[v].splice(m,1)}var y=this.vertices.length-t.length;return this.vertices=t,y},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var i=e[t];this.vertices.push(new te(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));var i,r,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===t&&(i=[]),o&&o.length===t&&(r=[]);for(var s=0;s<t;s++){var l=e[s]._id;i&&i.push(a[l]),r&&r.push(o[l])}i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}for(var i=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];i.push(a.x,a.y,a.z)}for(var o=[],s=[],l={},c=[],u={},h=[],d={},p=0;p<this.faces.length;p++){var f=this.faces[p],m=void 0!==this.faceVertexUvs[0][p],v=f.normal.length()>0,g=f.vertexNormals.length>0,y=1!==f.color.r||1!==f.color.g||1!==f.color.b,b=f.vertexColors.length>0,x=0;if(x=S(x,0,0),x=S(x,1,!0),x=S(x,2,!1),x=S(x,3,m),x=S(x,4,v),x=S(x,5,g),x=S(x,6,y),x=S(x,7,b),o.push(x),o.push(f.a,f.b,f.c),o.push(f.materialIndex),m){var w=this.faceVertexUvs[0][p];o.push(A(w[0]),A(w[1]),A(w[2]))}if(v&&o.push(T(f.normal)),g){var _=f.vertexNormals;o.push(T(_[0]),T(_[1]),T(_[2]))}if(y&&o.push(E(f.color)),b){var M=f.vertexColors;o.push(E(M[0]),E(M[1]),E(M[2]))}}function S(e,t,n){return n?e|1<<t:e&~(1<<t)}function T(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0!==l[t]||(l[t]=s.length/3,s.push(e.x,e.y,e.z)),l[t]}function E(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0!==u[t]||(u[t]=c.length,c.push(e.getHex())),u[t]}function A(e){var t=e.x.toString()+e.y.toString();return void 0!==d[t]||(d[t]=h.length/2,h.push(e.x,e.y)),d[t]}return e.data={},e.data.vertices=i,e.data.normals=s,c.length>0&&(e.data.colors=c),h.length>0&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return(new Ga).copy(this)},copy:function(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;for(var t=e.vertices,n=0,i=t.length;n<i;n++)this.vertices.push(t[n].clone());for(var r=e.colors,a=0,o=r.length;a<o;a++)this.colors.push(r[a].clone());for(var s=e.faces,l=0,c=s.length;l<c;l++)this.faces.push(s[l].clone());for(var u=0,h=e.faceVertexUvs.length;u<h;u++){var d=e.faceVertexUvs[u];void 0===this.faceVertexUvs[u]&&(this.faceVertexUvs[u]=[]);for(var p=0,f=d.length;p<f;p++){for(var m=d[p],v=[],g=0,y=m.length;g<y;g++){var b=m[g];v.push(b.clone())}this.faceVertexUvs[u].push(v)}}for(var x=e.morphTargets,w=0,_=x.length;w<_;w++){var M={};if(M.name=x[w].name,void 0!==x[w].vertices){M.vertices=[];for(var S=0,T=x[w].vertices.length;S<T;S++)M.vertices.push(x[w].vertices[S].clone())}if(void 0!==x[w].normals){M.normals=[];for(var E=0,A=x[w].normals.length;E<A;E++)M.normals.push(x[w].normals[E].clone())}this.morphTargets.push(M)}for(var L=e.morphNormals,k=0,R=L.length;k<R;k++){var O={};if(void 0!==L[k].vertexNormals){O.vertexNormals=[];for(var C=0,P=L[k].vertexNormals.length;C<P;C++){var I=L[k].vertexNormals[C],D={};D.a=I.a.clone(),D.b=I.b.clone(),D.c=I.c.clone(),O.vertexNormals.push(D)}}if(void 0!==L[k].faceNormals){O.faceNormals=[];for(var N=0,F=L[k].faceNormals.length;N<F;N++)O.faceNormals.push(L[k].faceNormals[N].clone())}this.morphNormals.push(O)}for(var U=e.skinWeights,z=0,j=U.length;z<j;z++)this.skinWeights.push(U[z].clone());for(var B=e.skinIndices,H=0,G=B.length;H<G;H++)this.skinIndices.push(B[H].clone());for(var V=e.lineDistances,W=0,q=V.length;W<q;W++)this.lineDistances.push(V[W]);var X=e.boundingBox;null!==X&&(this.boundingBox=X.clone());var Y=e.boundingSphere;return null!==Y&&(this.boundingSphere=Y.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),new te,new te,new te,new mt;function Va(e,t,n,i,r){var a,o;if(r===function(e,t,n,i){for(var r=0,a=t,o=n-i;a<n;a+=i)r+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return r}(e,t,n,i)>0)for(a=t;a<n;a+=i)o=ho(a,e[a],e[a+1],o);else for(a=n-i;a>=t;a-=i)o=ho(a,e[a],e[a+1],o);return o&&ao(o,o.next)&&(po(o),o=o.next),o}function Wa(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!ao(i,i.next)&&0!==ro(i.prev,i,i.next))i=i.next;else{if(po(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function qa(e,t,n,i,r,a,o){if(e){!o&&a&&function(e,t,n,i){var r=e;do{null===r.z&&(r.z=eo(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){var t,n,i,r,a,o,s,l,c=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t<c&&(s++,i=i.nextZ);t++);for(l=c;s>0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,a);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?Ya(e,i,r,a):Xa(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),po(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?qa(e=Ja(Wa(e),t,n),t,n,i,r,a,2):2===o&&Za(e,t,n,i,r,a):qa(Wa(e),t,n,i,r,a,1);break}}}function Xa(e){var t=e.prev,n=e,i=e.next;if(ro(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(no(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&ro(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Ya(e,t,n,i){var r=e.prev,a=e,o=e.next;if(ro(r,a,o)>=0)return!1;for(var s=r.x<a.x?r.x<o.x?r.x:o.x:a.x<o.x?a.x:o.x,l=r.y<a.y?r.y<o.y?r.y:o.y:a.y<o.y?a.y:o.y,c=r.x>a.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,u=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,h=eo(s,l,t,n,i),d=eo(c,u,t,n,i),p=e.prevZ,f=e.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&no(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&ro(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&no(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&ro(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&no(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&ro(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&no(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&ro(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Ja(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!ao(r,a)&&oo(r,i,i.next,a)&&co(r,a)&&co(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),po(i),po(i.next),i=e=a),i=i.next}while(i!==e);return Wa(i)}function Za(e,t,n,i,r,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&io(o,s)){var l=uo(o,s);return o=Wa(o,o.next),l=Wa(l,l.next),qa(o,t,n,i,r,a),void qa(l,t,n,i,r,a)}s=s.next}o=o.next}while(o!==e)}function Ka(e,t){return e.x-t.x}function Qa(e,t){if(t=function(e,t){var n,i=t,r=e.x,a=e.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>o){if(o=s,s===r){if(a===i.y)return i;if(a===i.next.y)return i.next}n=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!n)return null;if(r===o)return n;var l,c=n,u=n.x,h=n.y,d=1/0;i=n;do{r>=i.x&&i.x>=u&&r!==i.x&&no(a<h?r:o,a,u,h,a<h?o:r,a,i.x,i.y)&&(l=Math.abs(a-i.y)/(r-i.x),co(i,e)&&(l<d||l===d&&(i.x>n.x||i.x===n.x&&$a(n,i)))&&(n=i,d=l)),i=i.next}while(i!==c);return n}(e,t)){var n=uo(t,e);Wa(t,t.next),Wa(n,n.next)}}function $a(e,t){return ro(e.prev,e,t.prev)<0&&ro(t.next,e,e.next)<0}function eo(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function to(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 no(e,t,n,i,r,a,o,s){return(r-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(i-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(r-o)*(i-s)>=0}function io(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&&oo(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(co(e,t)&&co(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(ro(e.prev,e,t.prev)||ro(e,t.prev,t))||ao(e,t)&&ro(e.prev,e,e.next)>0&&ro(t.prev,t,t.next)>0)}function ro(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ao(e,t){return e.x===t.x&&e.y===t.y}function oo(e,t,n,i){var r=lo(ro(e,t,n)),a=lo(ro(e,t,i)),o=lo(ro(n,i,e)),s=lo(ro(n,i,t));return r!==a&&o!==s||!(0!==r||!so(e,n,t))||!(0!==a||!so(e,i,t))||!(0!==o||!so(n,e,i))||!(0!==s||!so(n,t,i))}function so(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 lo(e){return e>0?1:e<0?-1:0}function co(e,t){return ro(e.prev,e,e.next)<0?ro(e,t,e.next)>=0&&ro(e,e.prev,t)>=0:ro(e,t,e.prev)<0||ro(e,e.next,t)<0}function uo(e,t){var n=new fo(e.i,e.x,e.y),i=new fo(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function ho(e,t,n,i){var r=new fo(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function po(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 fo(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 mo={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n},isClockWise:function(e){return mo.area(e)<0},triangulateShape:function(e,t){var n=[],i=[],r=[];vo(e),go(n,e);var a=e.length;t.forEach(vo);for(var o=0;o<t.length;o++)i.push(a),a+=t[o].length,go(n,t[o]);for(var s=function(e,t,n){n=n||2;var i,r,a,o,s,l,c,u=t&&t.length,h=u?t[0]*n:e.length,d=Va(e,0,h,n,!0),p=[];if(!d||d.next===d.prev)return p;if(u&&(d=function(e,t,n,i){var r,a,o,s=[];for(r=0,a=t.length;r<a;r++)(o=Va(e,t[r]*i,r<a-1?t[r+1]*i:e.length,i,!1))===o.next&&(o.steiner=!0),s.push(to(o));for(s.sort(Ka),r=0;r<s.length;r++)Qa(s[r],n),n=Wa(n,n.next);return n}(e,t,d,n)),e.length>80*n){i=a=e[0],r=o=e[1];for(var f=n;f<h;f+=n)(s=e[f])<i&&(i=s),(l=e[f+1])<r&&(r=l),s>a&&(a=s),l>o&&(o=l);c=0!==(c=Math.max(a-i,o-r))?1/c:0}return qa(d,p,n,i,r,c),p}(n,i),l=0;l<s.length;l+=3)r.push(s.slice(l,l+3));return r}};function vo(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function go(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var yo=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i){var r;Object(h.a)(this,n),(r=t.call(this)).type="ExtrudeBufferGeometry",r.parameters={shapes:e,options:i},e=Array.isArray(e)?e:[e];for(var a=Object(o.a)(r),s=[],l=[],c=0,u=e.length;c<u;c++)d(e[c]);function d(e){var t=[],n=void 0!==i.curveSegments?i.curveSegments:12,r=void 0!==i.steps?i.steps:1,o=void 0!==i.depth?i.depth:100,c=void 0===i.bevelEnabled||i.bevelEnabled,u=void 0!==i.bevelThickness?i.bevelThickness:6,h=void 0!==i.bevelSize?i.bevelSize:u-2,d=void 0!==i.bevelOffset?i.bevelOffset:0,p=void 0!==i.bevelSegments?i.bevelSegments:3,f=i.extrudePath,m=void 0!==i.UVGenerator?i.UVGenerator:bo;void 0!==i.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),o=i.amount);var v,g,y,b,x,w=!1;f&&(v=f.getSpacedPoints(r),w=!0,c=!1,g=f.computeFrenetFrames(r,!1),y=new te,b=new te,x=new te),c||(p=0,u=0,h=0,d=0);var _=e.extractPoints(n),M=_.shape,S=_.holes;if(!mo.isClockWise(M)){M=M.reverse();for(var T=0,E=S.length;T<E;T++){var A=S[T];mo.isClockWise(A)&&(S[T]=A.reverse())}}for(var L=mo.triangulateShape(M,S),k=M,R=0,O=S.length;R<O;R++){var C=S[R];M=M.concat(C)}function P(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(n).add(e)}var I=M.length,D=L.length;function N(e,t,n){var i,r,a,o=e.x-t.x,s=e.y-t.y,l=n.x-e.x,c=n.y-e.y,u=o*o+s*s,h=o*c-s*l;if(Math.abs(h)>Number.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(l*l+c*c),f=t.x-s/d,m=t.y+o/d,v=((n.x-c/p-f)*c-(n.y+l/p-m)*l)/(o*c-s*l),g=(i=f+o*v-e.x)*i+(r=m+s*v-e.y)*r;if(g<=2)return new q(i,r);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(c)&&(y=!0),y?(i=-s,r=o,a=Math.sqrt(u)):(i=o,r=s,a=Math.sqrt(u/2))}return new q(i/a,r/a)}for(var F=[],U=0,z=k.length,j=z-1,B=U+1;U<z;U++,j++,B++)j===z&&(j=0),B===z&&(B=0),F[U]=N(k[U],k[j],k[B]);for(var H,G=[],V=F.concat(),W=0,X=S.length;W<X;W++){var Y=S[W];H=[];for(var J=0,Z=Y.length,K=Z-1,Q=J+1;J<Z;J++,K++,Q++)K===Z&&(K=0),Q===Z&&(Q=0),H[J]=N(Y[J],Y[K],Y[Q]);G.push(H),V=V.concat(H)}for(var $=0;$<p;$++){for(var ee=$/p,ne=u*Math.cos(ee*Math.PI/2),ie=h*Math.sin(ee*Math.PI/2)+d,re=0,ae=k.length;re<ae;re++){var oe=P(k[re],F[re],ie);Pe(oe.x,oe.y,-ne)}for(var se=0,le=S.length;se<le;se++){var ce=S[se];H=G[se];for(var ue=0,he=ce.length;ue<he;ue++){var de=P(ce[ue],H[ue],ie);Pe(de.x,de.y,-ne)}}}for(var pe=h+d,fe=0;fe<I;fe++){var me=c?P(M[fe],V[fe],pe):M[fe];w?(b.copy(g.normals[0]).multiplyScalar(me.x),y.copy(g.binormals[0]).multiplyScalar(me.y),x.copy(v[0]).add(b).add(y),Pe(x.x,x.y,x.z)):Pe(me.x,me.y,0)}for(var ve=1;ve<=r;ve++)for(var ge=0;ge<I;ge++){var ye=c?P(M[ge],V[ge],pe):M[ge];w?(b.copy(g.normals[ve]).multiplyScalar(ye.x),y.copy(g.binormals[ve]).multiplyScalar(ye.y),x.copy(v[ve]).add(b).add(y),Pe(x.x,x.y,x.z)):Pe(ye.x,ye.y,o/r*ve)}for(var be=p-1;be>=0;be--){for(var xe=be/p,we=u*Math.cos(xe*Math.PI/2),_e=h*Math.sin(xe*Math.PI/2)+d,Me=0,Se=k.length;Me<Se;Me++){var Te=P(k[Me],F[Me],_e);Pe(Te.x,Te.y,o+we)}for(var Ee=0,Ae=S.length;Ee<Ae;Ee++){var Le=S[Ee];H=G[Ee];for(var ke=0,Re=Le.length;ke<Re;ke++){var Oe=P(Le[ke],H[ke],_e);w?Pe(Oe.x,Oe.y+v[r-1].y,v[r-1].x+we):Pe(Oe.x,Oe.y,o+we)}}}function Ce(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,c=I*(o+1);De(t+i+l,t+a+l,t+a+c,t+i+c)}}}function Pe(e,n,i){t.push(e),t.push(n),t.push(i)}function Ie(e,t,n){Ne(e),Ne(t),Ne(n);var i=s.length/3,r=m.generateTopUV(a,s,i-3,i-2,i-1);Fe(r[0]),Fe(r[1]),Fe(r[2])}function De(e,t,n,i){Ne(e),Ne(t),Ne(i),Ne(t),Ne(n),Ne(i);var r=s.length/3,o=m.generateSideWallUV(a,s,r-6,r-3,r-2,r-1);Fe(o[0]),Fe(o[1]),Fe(o[3]),Fe(o[1]),Fe(o[2]),Fe(o[3])}function Ne(e){s.push(t[3*e+0]),s.push(t[3*e+1]),s.push(t[3*e+2])}function Fe(e){l.push(e.x),l.push(e.y)}!function(){var e=s.length/3;if(c){for(var t=0,n=I*t,i=0;i<D;i++){var o=L[i];Ie(o[2]+n,o[1]+n,o[0]+n)}n=I*(t=r+2*p);for(var l=0;l<D;l++){var u=L[l];Ie(u[0]+n,u[1]+n,u[2]+n)}}else{for(var h=0;h<D;h++){var d=L[h];Ie(d[2],d[1],d[0])}for(var f=0;f<D;f++){var m=L[f];Ie(m[0]+I*r,m[1]+I*r,m[2]+I*r)}}a.addGroup(e,s.length/3-e,0)}(),function(){var e=s.length/3,t=0;Ce(k,t),t+=k.length;for(var n=0,i=S.length;n<i;n++){var r=S[n];Ce(r,t),t+=r.length}a.addGroup(e,s.length/3-e,1)}()}return r.setAttribute("position",new Ft(s,3)),r.setAttribute("uv",new Ft(l,2)),r.computeVertexNormals(),r}return Object(d.a)(n,[{key:"toJSON",value:function(){var e=Yt.prototype.toJSON.call(this);return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(var i=0,r=e.length;i<r;i++){var a=e[i];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,e)}}]),n}(Yt),bo={generateTopUV:function(e,t,n,i,r){var a=t[3*n],o=t[3*n+1],s=t[3*i],l=t[3*i+1],c=t[3*r],u=t[3*r+1];return[new q(a,o),new q(s,l),new q(c,u)]},generateSideWallUV:function(e,t,n,i,r,a){var o=t[3*n],s=t[3*n+1],l=t[3*n+2],c=t[3*i],u=t[3*i+1],h=t[3*i+2],d=t[3*r],p=t[3*r+1],f=t[3*r+2],m=t[3*a],v=t[3*a+1],g=t[3*a+2];return Math.abs(s-u)<.01?[new q(o,1-l),new q(c,1-h),new q(d,1-f),new q(m,1-g)]:[new q(s,1-l),new q(u,1-h),new q(p,1-f),new q(v,1-g)]}},xo=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i){var r;return Object(h.a)(this,n),(r=t.call(this)).type="ExtrudeGeometry",r.parameters={shapes:e,options:i},r.fromBufferGeometry(new yo(e,i)),r.mergeVertices(),r}return Object(d.a)(n,[{key:"toJSON",value:function(){var e=Object(a.a)(Object(m.a)(n.prototype),"toJSON",this).call(this);return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(var i=0,r=e.length;i<r;i++){var a=e[i];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,e)}}]),n}(Ga);function wo(e,t,n){Yt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var i=[],r=[],a=[],o=[],s=1e-5,l=new te,c=new te,u=new te,h=new te,d=new te;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");for(var p=t+1,f=0;f<=n;f++)for(var m=f/n,v=0;v<=t;v++){var g=v/t;e(g,m,c),r.push(c.x,c.y,c.z),g-s>=0?(e(g-s,m,u),h.subVectors(c,u)):(e(g+s,m,u),h.subVectors(u,c)),m-s>=0?(e(g,m-s,u),d.subVectors(c,u)):(e(g,m+s,u),d.subVectors(u,c)),l.crossVectors(h,d).normalize(),a.push(l.x,l.y,l.z),o.push(g,m)}for(var y=0;y<n;y++)for(var b=0;b<t;b++){var x=y*p+b,w=y*p+b+1,_=(y+1)*p+b+1,M=(y+1)*p+b;i.push(x,w,M),i.push(w,_,M)}this.setIndex(i),this.setAttribute("position",new Ft(r,3)),this.setAttribute("normal",new Ft(a,3)),this.setAttribute("uv",new Ft(o,2))}function _o(e,t,n){Ga.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new wo(e,t,n)),this.mergeVertices()}wo.prototype=Object.create(Yt.prototype),wo.prototype.constructor=wo,_o.prototype=Object.create(Ga.prototype),_o.prototype.constructor=_o;var Mo=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i){var r;Object(h.a)(this,n),(r=t.call(this)).type="ShapeBufferGeometry",r.parameters={shapes:e,curveSegments:i},i=i||12;var a=[],o=[],s=[],l=[],c=0,u=0;if(!1===Array.isArray(e))p(e);else for(var d=0;d<e.length;d++)p(e[d]),r.addGroup(c,u,d),c+=u,u=0;function p(e){var t=o.length/3,n=e.extractPoints(i),r=n.shape,c=n.holes;!1===mo.isClockWise(r)&&(r=r.reverse());for(var h=0,d=c.length;h<d;h++){var p=c[h];!0===mo.isClockWise(p)&&(c[h]=p.reverse())}for(var f=mo.triangulateShape(r,c),m=0,v=c.length;m<v;m++){var g=c[m];r=r.concat(g)}for(var y=0,b=r.length;y<b;y++){var x=r[y];o.push(x.x,x.y,0),s.push(0,0,1),l.push(x.x,x.y)}for(var w=0,_=f.length;w<_;w++){var M=f[w],S=M[0]+t,T=M[1]+t,E=M[2]+t;a.push(S,T,E),u+=3}}return r.setIndex(a),r.setAttribute("position",new Ft(o,3)),r.setAttribute("normal",new Ft(s,3)),r.setAttribute("uv",new Ft(l,2)),r}return Object(d.a)(n,[{key:"toJSON",value:function(){var e=Yt.prototype.toJSON.call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}]),n}(Yt),So=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i){var r;return Object(h.a)(this,n),(r=t.call(this)).type="ShapeGeometry","object"==typeof i&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),i=i.curveSegments),r.parameters={shapes:e,curveSegments:i},r.fromBufferGeometry(new Mo(e,i)),r.mergeVertices(),r}return Object(d.a)(n,[{key:"toJSON",value:function(){var e=Ga.prototype.toJSON.call(this);return function(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}}]),n}(Ga);function To(e){Tt.call(this),this.type="ShadowMaterial",this.color=new _t(0),this.transparent=!0,this.setValues(e)}function Eo(e){xn.call(this,e),this.type="RawShaderMaterial"}function Ao(e){Tt.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new _t(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _t(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}function Lo(e){Ao.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new q(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(e){this.reflectivity=W.clamp(2.5*(e-1)/(e+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(e)}function ko(e){Tt.call(this),this.type="MeshPhongMaterial",this.color=new _t(16777215),this.specular=new _t(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _t(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Ro(e){Tt.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new _t(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _t(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Oo(e){Tt.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Co(e){Tt.call(this),this.type="MeshLambertMaterial",this.color=new _t(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _t(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Po(e){Tt.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new _t(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new q(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function Io(e){ga.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}To.prototype=Object.create(Tt.prototype),To.prototype.constructor=To,To.prototype.isShadowMaterial=!0,To.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.color.copy(e.color),this},Eo.prototype=Object.create(xn.prototype),Eo.prototype.constructor=Eo,Eo.prototype.isRawShaderMaterial=!0,Ao.prototype=Object.create(Tt.prototype),Ao.prototype.constructor=Ao,Ao.prototype.isMeshStandardMaterial=!0,Ao.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this},Lo.prototype=Object.create(Ao.prototype),Lo.prototype.constructor=Lo,Lo.prototype.isMeshPhysicalMaterial=!0,Lo.prototype.copy=function(e){return Ao.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new _t).copy(e.sheen):this.sheen=null,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this},ko.prototype=Object.create(Tt.prototype),ko.prototype.constructor=ko,ko.prototype.isMeshPhongMaterial=!0,ko.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Ro.prototype=Object.create(Tt.prototype),Ro.prototype.constructor=Ro,Ro.prototype.isMeshToonMaterial=!0,Ro.prototype.copy=function(e){return Tt.prototype.copy.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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Oo.prototype=Object.create(Tt.prototype),Oo.prototype.constructor=Oo,Oo.prototype.isMeshNormalMaterial=!0,Oo.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Co.prototype=Object.create(Tt.prototype),Co.prototype.constructor=Co,Co.prototype.isMeshLambertMaterial=!0,Co.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Po.prototype=Object.create(Tt.prototype),Po.prototype.constructor=Po,Po.prototype.isMeshMatcapMaterial=!0,Po.prototype.copy=function(e){return Tt.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},Io.prototype=Object.create(ga.prototype),Io.prototype.constructor=Io,Io.prototype.isLineDashedMaterial=!0,Io.prototype.copy=function(e){return ga.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Do=Object.freeze({__proto__:null,ShadowMaterial:To,SpriteMaterial:Gr,RawShaderMaterial:Eo,ShaderMaterial:xn,PointsMaterial:La,MeshPhysicalMaterial:Lo,MeshStandardMaterial:Ao,MeshPhongMaterial:ko,MeshToonMaterial:Ro,MeshNormalMaterial:Oo,MeshLambertMaterial:Co,MeshDepthMaterial:Tr,MeshDistanceMaterial:Er,MeshBasicMaterial:Et,MeshMatcapMaterial:Po,LineDashedMaterial:Io,LineBasicMaterial:ga,Material:Tt}),No={arraySlice:function(e,t,n){return No.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort((function(t,n){return e[t]-e[n]})),n},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,l=0;l!==t;++l)r[o++]=e[s+l];return r},flattenJSON:function(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}},subclip:function(e,t,n,i,r){r=r||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var l=a.tracks[s],c=l.getValueSize(),u=[],h=[],d=0;d<l.times.length;++d){var p=l.times[d]*r;if(!(p<n||p>=i)){u.push(l.times[d]);for(var f=0;f<c;++f)h.push(l.values[d*c+f])}}0!==u.length&&(l.times=No.convertArray(u,l.times.constructor),l.values=No.convertArray(h,l.values.constructor),o.push(l))}a.tracks=o;for(var m=1/0,v=0;v<a.tracks.length;++v)m>a.tracks[v].times[0]&&(m=a.tracks[v].times[0]);for(var g=0;g<a.tracks.length;++g)a.tracks[g].shift(-1*m);return a.resetDuration(),a},makeClipAdditive:function(e,t,n,i){void 0===t&&(t=0),void 0===n&&(n=e),(void 0===i||i<=0)&&(i=30);for(var r=n.tracks.length,a=t/i,o=function(t){var i=n.tracks[t],r=i.ValueTypeName;if("bool"===r||"string"===r)return"continue";var o=e.tracks.find((function(e){return e.name===i.name&&e.ValueTypeName===r}));if(void 0===o)return"continue";var s=0,l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);var c=0,u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=u/3);var h=i.times.length-1,d=void 0;if(a<=i.times[0]){var p=s,f=l-s;d=No.arraySlice(i.values,p,f)}else if(a>=i.times[h]){var m=h*l+s,v=m+l-s;d=No.arraySlice(i.values,m,v)}else{var g=i.createInterpolant(),y=s,b=l-s;g.evaluate(a),d=No.arraySlice(g.resultBuffer,y,b)}"quaternion"===r&&(new ee).fromArray(d).normalize().conjugate().toArray(d);for(var x=o.times.length,w=0;w<x;++w){var _=w*u+c;if("quaternion"===r)ee.multiplyQuaternionsFlat(o.values,_,d,0,o.values,_);else for(var M=u-2*c,S=0;S<M;++S)o.values[_+S]-=d[S]}},s=0;s<r;++s)o(s);return e.blendMode=2501,e}};function Fo(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}function Uo(e,t,n,i){Fo.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function zo(e,t,n,i){Fo.call(this,e,t,n,i)}function jo(e,t,n,i){Fo.call(this,e,t,n,i)}function Bo(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=No.convertArray(t,this.TimeBufferType),this.values=No.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}function Ho(e,t,n){Bo.call(this,e,t,n)}function Go(e,t,n,i){Bo.call(this,e,t,n,i)}function Vo(e,t,n,i){Bo.call(this,e,t,n,i)}function Wo(e,t,n,i){Fo.call(this,e,t,n,i)}function qo(e,t,n,i){Bo.call(this,e,t,n,i)}function Xo(e,t,n,i){Bo.call(this,e,t,n,i)}function Yo(e,t,n,i){Bo.call(this,e,t,n,i)}function Jo(e,t,n,i){this.name=e,this.tracks=n,this.duration=void 0!==t?t:-1,this.blendMode=void 0!==i?i:2500,this.uuid=W.generateUUID(),this.duration<0&&this.resetDuration()}function Zo(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 Vo;case"vector":case"vector2":case"vector3":case"vector4":return Yo;case"color":return Go;case"quaternion":return qo;case"bool":case"boolean":return Ho;case"string":return Xo}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var n=[],i=[];No.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(Fo.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var a;n:{i:if(!(e<i)){for(var o=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,r)}if(n===o)break;if(r=i,e<(i=t[++n]))break t}a=t.length;break n}if(e>=r)break e;var s=t[1];e<s&&(n=2,r=s);for(var l=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===l)break;if(i=r,e>=(r=t[--n-1]))break t}a=n,n=0}for(;n<a;){var c=n+a>>>1;e<t[c]?a=c:n=c+1}if(i=t[n],void 0===(r=t[n-1]))return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,r,e)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i,a=0;a!==i;++a)t[a]=n[r+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}}),Object.assign(Fo.prototype,{beforeStart_:Fo.prototype.copySampleValue_,afterEnd_:Fo.prototype.copySampleValue_}),Uo.prototype=Object.assign(Object.create(Fo.prototype),{constructor:Uo,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(e,t,n){var i=this.parameterPositions,r=e-2,a=e+1,o=i[r],s=i[a];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=e,o=2*t-n;break;case 2402:o=t+i[r=i.length-2]-i[r+1];break;default:r=e,o=n}if(void 0===s)switch(this.getSettings_().endingEnd){case 2401:a=e,s=2*n-t;break;case 2402:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}var l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=r*c,this._offsetNext=a*c},interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-t)/(i-t),f=p*p,m=f*p,v=-h*m+2*h*f-h*p,g=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,b=d*m-d*f,x=0;x!==o;++x)r[x]=v*a[c+x]+g*a[l+x]+y*a[s+x]+b*a[u+x];return r}}),zo.prototype=Object.assign(Object.create(Fo.prototype),{constructor:zo,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=(n-t)/(i-t),u=1-c,h=0;h!==o;++h)r[h]=a[l+h]*u+a[s+h]*c;return r}}),jo.prototype=Object.assign(Object.create(Fo.prototype),{constructor:jo,interpolate_:function(e){return this.copySampleValue_(e-1)}}),Object.assign(Bo,{toJSON:function(e){var t,n=e.constructor;if(void 0!==n.toJSON)t=n.toJSON(e);else{t={name:e.name,times:No.convertArray(e.times,Array),values:No.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}}),Object.assign(Bo.prototype,{constructor:Bo,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(e){return new jo(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new zo(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Uo(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(0!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]+=e;return this},scale:function(e){if(1!==e)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,i=n.length,r=0,a=i-1;r!==i&&n[r]<e;)++r;for(;-1!==a&&n[a]>t;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=No.arraySlice(n,r,a),this.values=No.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&No.isTypedArray(i))for(var l=0,c=i.length;l!==c;++l){var u=i[l];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,u),e=!1;break}}return e},optimize:function(){for(var e=No.arraySlice(this.times),t=No.arraySlice(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=e.length-1,a=1,o=1;o<r;++o){var s=!1,l=e[o];if(l!==e[o+1]&&(1!==o||l!==l[0]))if(i)s=!0;else for(var c=o*n,u=c-n,h=c+n,d=0;d!==n;++d){var p=t[c+d];if(p!==t[u+d]||p!==t[h+d]){s=!0;break}}if(s){if(o!==a){e[a]=e[o];for(var f=o*n,m=a*n,v=0;v!==n;++v)t[m+v]=t[f+v]}++a}}if(r>0){e[a]=e[r];for(var g=r*n,y=a*n,b=0;b!==n;++b)t[y+b]=t[g+b];++a}return a!==e.length?(this.times=No.arraySlice(e,0,a),this.values=No.arraySlice(t,0,a*n)):(this.times=e,this.values=t),this},clone:function(){var e=No.arraySlice(this.times,0),t=No.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),Ho.prototype=Object.assign(Object.create(Bo.prototype),{constructor:Ho,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Go.prototype=Object.assign(Object.create(Bo.prototype),{constructor:Go,ValueTypeName:"color"}),Vo.prototype=Object.assign(Object.create(Bo.prototype),{constructor:Vo,ValueTypeName:"number"}),Wo.prototype=Object.assign(Object.create(Fo.prototype),{constructor:Wo,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(i-t),l=e*o,c=l+o;l!==c;l+=4)ee.slerpFlat(r,0,a,l-o,a,l,s);return r}}),qo.prototype=Object.assign(Object.create(Bo.prototype),{constructor:qo,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new Wo(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Xo.prototype=Object.assign(Object.create(Bo.prototype),{constructor:Xo,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Yo.prototype=Object.assign(Object.create(Bo.prototype),{constructor:Yo,ValueTypeName:"vector"}),Object.assign(Jo,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(Zo(n[r]).scale(i));return new Jo(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},r=0,a=n.length;r!==a;++r)t.push(Bo.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,a=[],o=0;o<r;o++){var s=[],l=[];s.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);var c=No.getKeyframeOrder(s);s=No.sortedArray(s,1,c),l=No.sortedArray(l,1,c),i||0!==s[0]||(s.push(r),l.push(l[0])),a.push(new Vo(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/n))}return new Jo(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var i=e;n=i.geometry&&i.geometry.animations||i.animations}for(var r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],l=s.name.match(r);if(l&&l.length>1){var c=l[1],u=i[c];u||(i[c]=u=[]),u.push(s)}}var h=[];for(var d in i)h.push(Jo.CreateFromMorphTargetSequence(d,i[d],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];No.flattenJSON(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.fps||30,o=e.blendMode,s=e.length||-1,l=e.hierarchy||[],c=0;c<l.length;c++){var u=l[c].keys;if(u&&0!==u.length)if(u[0].morphTargets){var h={},d=void 0;for(d=0;d<u.length;d++)if(u[d].morphTargets)for(var p=0;p<u[d].morphTargets.length;p++)h[u[d].morphTargets[p]]=-1;for(var f in h){for(var m=[],v=[],g=0;g!==u[d].morphTargets.length;++g){var y=u[d];m.push(y.time),v.push(y.morphTarget===f?1:0)}i.push(new Vo(".morphTargetInfluence["+f+"]",m,v))}s=h.length*(a||1)}else{var b=".bones["+t[c].name+"]";n(Yo,b+".position",u,"pos",i),n(qo,b+".quaternion",u,"rot",i),n(Yo,b+".scale",u,"scl",i)}}return 0===i.length?null:new Jo(r,s,i,o)}}),Object.assign(Jo.prototype,{resetDuration:function(){for(var e=0,t=0,n=this.tracks.length;t!==n;++t){var i=this.tracks[t];e=Math.max(e,i.times[i.times.length-1])}return this.duration=e,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new Jo(this.name,this.duration,e,this.blendMode)}});var Ko={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={}}},Qo=new function(e,t,n){var i=this,r=!1,a=0,o=0,s=void 0,l=[];this.onStart=void 0,this.onLoad=void 0,this.onProgress=void 0,this.onError=void 0,this.itemStart=function(e){o++,!1===r&&void 0!==i.onStart&&i.onStart(e,a,o),r=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,o),a===o&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return s?s(e):e},this.setURLModifier=function(e){return s=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){var t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(var t=0,n=l.length;t<n;t+=2){var i=l[t],r=l[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return r}return null}};function $o(e){this.manager=void 0!==e?e:Qo,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}Object.assign($o.prototype,{load:function(){},loadAsync:function(e,t){var n=this;return new Promise((function(i,r){n.load(e,i,t,r)}))},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}});var es={};function ts(e){$o.call(this,e)}function ns(e){$o.call(this,e)}function is(e){$o.call(this,e)}function rs(e){$o.call(this,e)}function as(e){$o.call(this,e)}function os(e){$o.call(this,e)}function ss(e){$o.call(this,e)}function ls(){this.type="Curve",this.arcLengthDivisions=200}function cs(e,t,n,i,r,a,o,s){ls.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function us(e,t,n,i,r,a){cs.call(this,e,t,n,n,i,r,a),this.type="ArcCurve"}function hs(){var e=0,t=0,n=0,i=0;function r(r,a,o,s){e=r,t=o,n=-3*r+3*a-2*o-s,i=2*r-2*a+o+s}return{initCatmullRom:function(e,t,n,i,a){r(t,n,a*(n-e),a*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,a,o,s){var l=(t-e)/a-(n-e)/(a+o)+(n-t)/o,c=(n-t)/o-(i-t)/(o+s)+(i-n)/s;r(t,n,l*=o,c*=o)},calc:function(r){var a=r*r;return e+t*r+n*a+i*(a*r)}}}ts.prototype=Object.assign(Object.create($o.prototype),{constructor:ts,load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Ko.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;if(void 0===es[e]){var o,s=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(s){var l=s[1],c=!!s[2],u=s[3];u=decodeURIComponent(u),c&&(u=atob(u));try{var h,d=(this.responseType||"").toLowerCase();switch(d){case"arraybuffer":case"blob":for(var p=new Uint8Array(u.length),f=0;f<u.length;f++)p[f]=u.charCodeAt(f);h="blob"===d?new Blob([p.buffer],{type:l}):p.buffer;break;case"document":var m=new DOMParser;h=m.parseFromString(u,l);break;case"json":h=JSON.parse(u);break;default:h=u}setTimeout((function(){t&&t(h),r.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}),0)}}else{for(var v in es[e]=[],es[e].push({onLoad:t,onProgress:n,onError:i}),(o=new XMLHttpRequest).open("GET",e,!0),o.addEventListener("load",(function(t){var n=this.response,i=es[e];if(delete es[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Ko.add(e,n);for(var a=0,o=i.length;a<o;a++){var s=i[a];s.onLoad&&s.onLoad(n)}r.manager.itemEnd(e)}else{for(var l=0,c=i.length;l<c;l++){var u=i[l];u.onError&&u.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}}),!1),o.addEventListener("progress",(function(t){for(var n=es[e],i=0,r=n.length;i<r;i++){var a=n[i];a.onProgress&&a.onProgress(t)}}),!1),o.addEventListener("error",(function(t){var n=es[e];delete es[e];for(var i=0,a=n.length;i<a;i++){var o=n[i];o.onError&&o.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}),!1),o.addEventListener("abort",(function(t){var n=es[e];delete es[e];for(var i=0,a=n.length;i<a;i++){var o=n[i];o.onError&&o.onError(t)}r.manager.itemError(e),r.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(o.responseType=this.responseType),void 0!==this.withCredentials&&(o.withCredentials=this.withCredentials),o.overrideMimeType&&o.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)o.setRequestHeader(v,this.requestHeader[v]);o.send(null)}return r.manager.itemStart(e),o}es[e].push({onLoad:t,onProgress:n,onError:i})},setResponseType:function(e){return this.responseType=e,this},setMimeType:function(e){return this.mimeType=e,this}}),ns.prototype=Object.assign(Object.create($o.prototype),{constructor:ns,load:function(e,t,n,i){var r=this,a=new ts(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var i=Jo.parse(e[n]);t.push(i)}return t}}),is.prototype=Object.assign(Object.create($o.prototype),{constructor:is,load:function(e,t,n,i){var r=this,a=[],o=new Na;o.image=a;var s=new ts(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(r.withCredentials);var l=0;function c(c){s.load(e[c],(function(e){var n=r.parse(e,!0);a[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(l+=1)&&(1===n.mipmapCount&&(o.minFilter=1006),o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,i)}if(Array.isArray(e))for(var u=0,h=e.length;u<h;++u)c(u);else s.load(e,(function(e){var n=r.parse(e,!0);if(n.isCubemap)for(var i=n.mipmaps.length/n.mipmapCount,s=0;s<i;s++){a[s]={mipmaps:[]};for(var l=0;l<n.mipmapCount;l++)a[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+l]),a[s].format=n.format,a[s].width=n.width,a[s].height=n.height}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=1006),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,i);return o}}),rs.prototype=Object.assign(Object.create($o.prototype),{constructor:rs,load:function(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Ko.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),Ko.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}),as.prototype=Object.assign(Object.create($o.prototype),{constructor:as,load:function(e,t,n,i){var r=new Sn,a=new rs(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(n){a.load(e[n],(function(e){r.images[n]=e,6===++o&&(r.needsUpdate=!0,t&&t(r))}),void 0,i)}for(var l=0;l<e.length;++l)s(l);return r}}),os.prototype=Object.assign(Object.create($o.prototype),{constructor:os,load:function(e,t,n,i){var r=this,a=new En,o=new ts(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,(function(e){var n=r.parse(e);n&&(void 0!==n.image?a.image=n.image:void 0!==n.data&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data),a.wrapS=void 0!==n.wrapS?n.wrapS:1001,a.wrapT=void 0!==n.wrapT?n.wrapT:1001,a.magFilter=void 0!==n.magFilter?n.magFilter:1006,a.minFilter=void 0!==n.minFilter?n.minFilter:1006,a.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(a.format=n.format),void 0!==n.type&&(a.type=n.type),void 0!==n.mipmaps&&(a.mipmaps=n.mipmaps,a.minFilter=1008),1===n.mipmapCount&&(a.minFilter=1006),a.needsUpdate=!0,t&&t(a,n))}),n,i),a}}),ss.prototype=Object.assign(Object.create($o.prototype),{constructor:ss,load:function(e,t,n,i){var r=new Z,a=new rs(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(n){r.image=n;var i=e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/);r.format=i?1022:1023,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}),Object.assign(ls.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n=[],i=this.getPoint(0),r=0;n.push(0);for(var a=1;a<=e;a++)r+=(t=this.getPoint(a/e)).distanceTo(i),n.push(r),i=t;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=i[r=Math.floor(s+(l-s)/2)]-n)<0)s=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(a-1);var c=i[r];return(r+(n-c)/(i[r+1]-c))/(a-1)},getTangent:function(e,t){var n=1e-4,i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);var a=this.getPoint(i),o=this.getPoint(r),s=t||(a.isVector2?new q:new te);return s.copy(o).sub(a).normalize(),s},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){for(var n=new te,i=[],r=[],a=[],o=new te,s=new ke,l=0;l<=e;l++){var c=l/e;i[l]=this.getTangentAt(c,new te),i[l].normalize()}r[0]=new te,a[0]=new te;var u=Number.MAX_VALUE,h=Math.abs(i[0].x),d=Math.abs(i[0].y),p=Math.abs(i[0].z);h<=u&&(u=h,n.set(1,0,0)),d<=u&&(u=d,n.set(0,1,0)),p<=u&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]);for(var f=1;f<=e;f++){if(r[f]=r[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();var m=Math.acos(W.clamp(i[f-1].dot(i[f]),-1,1));r[f].applyMatrix4(s.makeRotationAxis(o,m))}a[f].crossVectors(i[f],r[f])}if(!0===t){var v=Math.acos(W.clamp(r[0].dot(r[e]),-1,1));v/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(v=-v);for(var g=1;g<=e;g++)r[g].applyMatrix4(s.makeRotationAxis(i[g],v*g)),a[g].crossVectors(i[g],r[g])}return{tangents:i,normals:r,binormals:a}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),cs.prototype=Object.create(ls.prototype),cs.prototype.constructor=cs,cs.prototype.isEllipseCurve=!0,cs.prototype.getPoint=function(e,t){for(var n=t||new q,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=a?0:i),!0!==this.aClockwise||a||(r===i?r=-i:r-=i);var o=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var c=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,d=l-this.aY;s=h*c-d*u+this.aX,l=h*u+d*c+this.aY}return n.set(s,l)},cs.prototype.copy=function(e){return ls.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},cs.prototype.toJSON=function(){var e=ls.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e},cs.prototype.fromJSON=function(e){return ls.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this},us.prototype=Object.create(cs.prototype),us.prototype.constructor=us,us.prototype.isArcCurve=!0;var ds=new te,ps=new hs,fs=new hs,ms=new hs;function vs(e,t,n,i){ls.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=void 0!==i?i:.5}function gs(e,t,n,i,r){var a=.5*(i-t),o=.5*(r-n),s=e*e;return(2*n-2*i+a+o)*(e*s)+(-3*n+3*i-2*a-o)*s+a*e+n}function ys(e,t,n,i){return function(e,t){var n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function bs(e,t,n,i,r){return function(e,t){var n=1-e;return n*n*n*t}(e,t)+function(e,t){var n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}function xs(e,t,n,i){ls.call(this),this.type="CubicBezierCurve",this.v0=e||new q,this.v1=t||new q,this.v2=n||new q,this.v3=i||new q}function ws(e,t,n,i){ls.call(this),this.type="CubicBezierCurve3",this.v0=e||new te,this.v1=t||new te,this.v2=n||new te,this.v3=i||new te}function _s(e,t){ls.call(this),this.type="LineCurve",this.v1=e||new q,this.v2=t||new q}function Ms(e,t){ls.call(this),this.type="LineCurve3",this.v1=e||new te,this.v2=t||new te}function Ss(e,t,n){ls.call(this),this.type="QuadraticBezierCurve",this.v0=e||new q,this.v1=t||new q,this.v2=n||new q}function Ts(e,t,n){ls.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new te,this.v1=t||new te,this.v2=n||new te}function Es(e){ls.call(this),this.type="SplineCurve",this.points=e||[]}vs.prototype=Object.create(ls.prototype),vs.prototype.constructor=vs,vs.prototype.isCatmullRomCurve3=!0,vs.prototype.getPoint=function(e,t){var n,i,r=t||new te,a=this.points,o=a.length,s=(o-(this.closed?0:1))*e,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/o)+1)*o:0===c&&l===o-1&&(l=o-2,c=1),this.closed||l>0?n=a[(l-1)%o]:(ds.subVectors(a[0],a[1]).add(a[0]),n=ds);var u=a[l%o],h=a[(l+1)%o];if(this.closed||l+2<o?i=a[(l+2)%o]:(ds.subVectors(a[o-1],a[o-2]).add(a[o-1]),i=ds),"centripetal"===this.curveType||"chordal"===this.curveType){var d="chordal"===this.curveType?.5:.25,p=Math.pow(n.distanceToSquared(u),d),f=Math.pow(u.distanceToSquared(h),d),m=Math.pow(h.distanceToSquared(i),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),ps.initNonuniformCatmullRom(n.x,u.x,h.x,i.x,p,f,m),fs.initNonuniformCatmullRom(n.y,u.y,h.y,i.y,p,f,m),ms.initNonuniformCatmullRom(n.z,u.z,h.z,i.z,p,f,m)}else"catmullrom"===this.curveType&&(ps.initCatmullRom(n.x,u.x,h.x,i.x,this.tension),fs.initCatmullRom(n.y,u.y,h.y,i.y,this.tension),ms.initCatmullRom(n.z,u.z,h.z,i.z,this.tension));return r.set(ps.calc(c),fs.calc(c),ms.calc(c)),r},vs.prototype.copy=function(e){ls.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},vs.prototype.toJSON=function(){var e=ls.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e},vs.prototype.fromJSON=function(e){ls.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new te).fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this},xs.prototype=Object.create(ls.prototype),xs.prototype.constructor=xs,xs.prototype.isCubicBezierCurve=!0,xs.prototype.getPoint=function(e,t){var n=t||new q,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(bs(e,i.x,r.x,a.x,o.x),bs(e,i.y,r.y,a.y,o.y)),n},xs.prototype.copy=function(e){return ls.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},xs.prototype.toJSON=function(){var e=ls.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},xs.prototype.fromJSON=function(e){return ls.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},ws.prototype=Object.create(ls.prototype),ws.prototype.constructor=ws,ws.prototype.isCubicBezierCurve3=!0,ws.prototype.getPoint=function(e,t){var n=t||new te,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(bs(e,i.x,r.x,a.x,o.x),bs(e,i.y,r.y,a.y,o.y),bs(e,i.z,r.z,a.z,o.z)),n},ws.prototype.copy=function(e){return ls.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this},ws.prototype.toJSON=function(){var e=ls.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e},ws.prototype.fromJSON=function(e){return ls.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this},_s.prototype=Object.create(ls.prototype),_s.prototype.constructor=_s,_s.prototype.isLineCurve=!0,_s.prototype.getPoint=function(e,t){var n=t||new q;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},_s.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},_s.prototype.getTangent=function(e,t){var n=t||new q;return n.copy(this.v2).sub(this.v1).normalize(),n},_s.prototype.copy=function(e){return ls.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},_s.prototype.toJSON=function(){var e=ls.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},_s.prototype.fromJSON=function(e){return ls.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Ms.prototype=Object.create(ls.prototype),Ms.prototype.constructor=Ms,Ms.prototype.isLineCurve3=!0,Ms.prototype.getPoint=function(e,t){var n=t||new te;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n},Ms.prototype.getPointAt=function(e,t){return this.getPoint(e,t)},Ms.prototype.copy=function(e){return ls.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ms.prototype.toJSON=function(){var e=ls.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ms.prototype.fromJSON=function(e){return ls.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Ss.prototype=Object.create(ls.prototype),Ss.prototype.constructor=Ss,Ss.prototype.isQuadraticBezierCurve=!0,Ss.prototype.getPoint=function(e,t){var n=t||new q,i=this.v0,r=this.v1,a=this.v2;return n.set(ys(e,i.x,r.x,a.x),ys(e,i.y,r.y,a.y)),n},Ss.prototype.copy=function(e){return ls.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ss.prototype.toJSON=function(){var e=ls.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ss.prototype.fromJSON=function(e){return ls.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Ts.prototype=Object.create(ls.prototype),Ts.prototype.constructor=Ts,Ts.prototype.isQuadraticBezierCurve3=!0,Ts.prototype.getPoint=function(e,t){var n=t||new te,i=this.v0,r=this.v1,a=this.v2;return n.set(ys(e,i.x,r.x,a.x),ys(e,i.y,r.y,a.y),ys(e,i.z,r.z,a.z)),n},Ts.prototype.copy=function(e){return ls.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this},Ts.prototype.toJSON=function(){var e=ls.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e},Ts.prototype.fromJSON=function(e){return ls.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this},Es.prototype=Object.create(ls.prototype),Es.prototype.constructor=Es,Es.prototype.isSplineCurve=!0,Es.prototype.getPoint=function(e,t){var n=t||new q,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,s=i[0===a?a:a-1],l=i[a],c=i[a>i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(gs(o,s.x,l.x,c.x,u.x),gs(o,s.y,l.y,c.y,u.y)),n},Es.prototype.copy=function(e){ls.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this},Es.prototype.toJSON=function(){var e=ls.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e},Es.prototype.fromJSON=function(e){ls.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push((new q).fromArray(i))}return this};var As=Object.freeze({__proto__:null,ArcCurve:us,CatmullRomCurve3:vs,CubicBezierCurve:xs,CubicBezierCurve3:ws,EllipseCurve:cs,LineCurve:_s,LineCurve3:Ms,QuadraticBezierCurve:Ss,QuadraticBezierCurve3:Ts,SplineCurve:Es});function Ls(){ls.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function ks(e){Ls.call(this),this.type="Path",this.currentPoint=new q,e&&this.setFromPoints(e)}function Rs(e){ks.call(this,e),this.uuid=W.generateUUID(),this.type="Shape",this.holes=[]}function Os(e,t){et.call(this),this.type="Light",this.color=new _t(e),this.intensity=void 0!==t?t:1}function Cs(e,t,n){Os.call(this,e,n),this.type="HemisphereLight",this.position.copy(et.DefaultUp),this.updateMatrix(),this.groundColor=new _t(t)}function Ps(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new q(512,512),this.map=null,this.mapPass=null,this.matrix=new ke,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new kn,this._frameExtents=new q(1,1),this._viewportCount=1,this._viewports=[new K(0,0,1,1)]}function Is(){Ps.call(this,new _n(50,1,.5,500)),this.focus=1}function Ds(e,t,n,i,r,a){Os.call(this,e,t),this.type="SpotLight",this.position.copy(et.DefaultUp),this.updateMatrix(),this.target=new et,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(e){this.intensity=e/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==a?a:1,this.shadow=new Is}function Ns(){Ps.call(this,new _n(90,1,.5,500)),this._frameExtents=new q(4,2),this._viewportCount=6,this._viewports=[new K(2,1,1,1),new K(0,1,1,1),new K(3,1,1,1),new K(1,1,1,1),new K(3,0,1,1),new K(1,0,1,1)],this._cubeDirections=[new te(1,0,0),new te(-1,0,0),new te(0,0,1),new te(0,0,-1),new te(0,1,0),new te(0,-1,0)],this._cubeUps=[new te(0,1,0),new te(0,1,0),new te(0,1,0),new te(0,1,0),new te(0,0,1),new te(0,0,-1)]}function Fs(e,t,n,i){Os.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(e){this.intensity=e/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new Ns}function Us(e,t,n,i,r,a){wn.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==e?e:-1,this.right=void 0!==t?t:1,this.top=void 0!==n?n:1,this.bottom=void 0!==i?i:-1,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function zs(){Ps.call(this,new Us(-5,5,5,-5,.5,500))}function js(e,t){Os.call(this,e,t),this.type="DirectionalLight",this.position.copy(et.DefaultUp),this.updateMatrix(),this.target=new et,this.shadow=new zs}function Bs(e,t){Os.call(this,e,t),this.type="AmbientLight"}function Hs(e,t,n,i){Os.call(this,e,t),this.type="RectAreaLight",this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}Ls.prototype=Object.assign(Object.create(ls.prototype),{constructor:Ls,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new _s(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),i=0;i<n.length;){if(n[i]>=t){var r=n[i]-t,a=this.curves[i],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){void 0===e&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t,n=[],i=0,r=this.curves;i<r.length;i++)for(var a=r[i],o=a&&a.isEllipseCurve?2*e:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),l=0;l<s.length;l++){var c=s[l];t&&t.equals(c)||(n.push(c),t=c)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){ls.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=ls.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e},fromJSON:function(e){ls.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push((new As[i.type]).fromJSON(i))}return this}}),ks.prototype=Object.assign(Object.create(Ls.prototype),{constructor:ks,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new _s(this.currentPoint.clone(),new q(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,i){var r=new Ss(this.currentPoint.clone(),new q(e,t),new q(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this},bezierCurveTo:function(e,t,n,i,r,a){var o=new xs(this.currentPoint.clone(),new q(e,t),new q(n,i),new q(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this},splineThru:function(e){var t=new Es([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,i,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,i,r,a),this},absarc:function(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this},ellipse:function(e,t,n,i,r,a,o,s){var l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,i,r,a,o,s),this},absellipse:function(e,t,n,i,r,a,o,s){var l=new cs(e,t,n,i,r,a,o,s);if(this.curves.length>0){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var u=l.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return Ls.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=Ls.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return Ls.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),Rs.prototype=Object.assign(Object.create(ks.prototype),{constructor:Rs,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){ks.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push(i.clone())}return this},toJSON:function(){var e=ks.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e},fromJSON:function(e){ks.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push((new ks).fromJSON(i))}return this}}),Os.prototype=Object.assign(Object.create(et.prototype),{constructor:Os,isLight:!0,copy:function(e){return et.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=et.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}}),Cs.prototype=Object.assign(Object.create(Os.prototype),{constructor:Cs,isHemisphereLight:!0,copy:function(e){return Os.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}),Object.assign(Ps.prototype,{_projScreenMatrix:new ke,_lightPositionWorld:new te,_lookTarget:new te,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,i=this._projScreenMatrix,r=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),r.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(r),t.updateMatrixWorld(),i.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(i),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e={};return 0!==this.bias&&(e.bias=this.bias),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}}),Is.prototype=Object.assign(Object.create(Ps.prototype),{constructor:Is,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=2*W.RAD2DEG*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),Ps.prototype.updateMatrices.call(this,e)}}),Ds.prototype=Object.assign(Object.create(Os.prototype),{constructor:Ds,isSpotLight:!0,copy:function(e){return Os.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Ns.prototype=Object.assign(Object.create(Ps.prototype),{constructor:Ns,isPointLightShadow:!0,updateMatrices:function(e,t){void 0===t&&(t=0);var n=this.camera,i=this.matrix,r=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;r.setFromMatrixPosition(e.matrixWorld),n.position.copy(r),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),i.makeTranslation(-r.x,-r.y,-r.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}}),Fs.prototype=Object.assign(Object.create(Os.prototype),{constructor:Fs,isPointLight:!0,copy:function(e){return Os.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}),Us.prototype=Object.assign(Object.create(wn.prototype),{constructor:Us,isOrthographicCamera:!0,copy:function(e,t){return wn.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,s=i-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(r+=l*this.view.offsetX)+l*this.view.width,s=(o-=c*this.view.offsetY)-c*this.view.height}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=et.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}),zs.prototype=Object.assign(Object.create(Ps.prototype),{constructor:zs,isDirectionalLightShadow:!0,updateMatrices:function(e){Ps.prototype.updateMatrices.call(this,e)}}),js.prototype=Object.assign(Object.create(Os.prototype),{constructor:js,isDirectionalLight:!0,copy:function(e){return Os.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}),Bs.prototype=Object.assign(Object.create(Os.prototype),{constructor:Bs,isAmbientLight:!0}),Hs.prototype=Object.assign(Object.create(Os.prototype),{constructor:Hs,isRectAreaLight:!0,copy:function(e){return Os.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=Os.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}});var Gs=function(){function e(){Object(h.a)(this,e),Object.defineProperty(this,"isSphericalHarmonics3",{value:!0}),this.coefficients=[];for(var t=0;t<9;t++)this.coefficients.push(new te)}return Object(d.a)(e,[{key:"set",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}},{key:"zero",value:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}},{key:"getAt",value:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*r),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*i*1.092548),t.addScaledVector(a[5],i*r*1.092548),t.addScaledVector(a[6],.315392*(3*r*r-1)),t.addScaledVector(a[7],n*r*1.092548),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}},{key:"getIrradianceAt",value:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*i),t.addScaledVector(a[2],1.023328*r),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*i),t.addScaledVector(a[5],.858086*i*r),t.addScaledVector(a[6],.743125*r*r-.247708),t.addScaledVector(a[7],.858086*n*r),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}},{key:"add",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}},{key:"addScaledSH",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}},{key:"scale",value:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}},{key:"lerp",value:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}},{key:"equals",value:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}},{key:"copy",value:function(e){return this.set(e.coefficients)}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"fromArray",value:function(e,t){void 0===t&&(t=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this}},{key:"toArray",value:function(e,t){void 0===e&&(e=[]),void 0===t&&(t=0);for(var n=this.coefficients,i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}}],[{key:"getBasisAt",value:function(e,t){var n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}]),e}();function Vs(e,t){Os.call(this,void 0,t),this.type="LightProbe",this.sh=void 0!==e?e:new Gs}function Ws(e){$o.call(this,e),this.textures={}}Vs.prototype=Object.assign(Object.create(Os.prototype),{constructor:Vs,isLightProbe:!0,copy:function(e){return Os.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=Os.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}}),Ws.prototype=Object.assign(Object.create($o.prototype),{constructor:Ws,load:function(e,t,n,i){var r=this,a=new ts(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)},parse:function(e){var t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}var i=new Do[e.type];if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=(new _t).setHex(e.sheen)),void 0!==e.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&i.specular.setHex(e.specular),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),1!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.skinning&&(i.skinning=e.skinning),void 0!==e.morphTargets&&(i.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(i.morphNormals=e.morphNormals),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.vertexTangents&&(i.vertexTangents=e.vertexTangents),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var r in e.uniforms){var a=e.uniforms[r];switch(i.uniforms[r]={},a.type){case"t":i.uniforms[r].value=n(a.value);break;case"c":i.uniforms[r].value=(new _t).setHex(a.value);break;case"v2":i.uniforms[r].value=(new q).fromArray(a.value);break;case"v3":i.uniforms[r].value=(new te).fromArray(a.value);break;case"v4":i.uniforms[r].value=(new K).fromArray(a.value);break;case"m3":i.uniforms[r].value=(new X).fromArray(a.value);break;case"m4":i.uniforms[r].value=(new ke).fromArray(a.value);break;default:i.uniforms[r].value=a.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.extensions)for(var o in e.extensions)i.extensions[o]=e.extensions[o];if(void 0!==e.shading&&(i.flatShading=1===e.shading),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var s=e.normalScale;!1===Array.isArray(s)&&(s=[s,s]),i.normalScale=(new q).fromArray(s)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new q).fromArray(e.clearcoatNormalScale)),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),i},setTextures:function(e){return this.textures=e,this}});var qs=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}},Xs=function(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)};function Ys(){Yt.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}function Js(e,t,n,i){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),kt.call(this,e,t,n),this.meshPerAttribute=i||1}function Zs(e){$o.call(this,e)}Ys.prototype=Object.assign(Object.create(Yt.prototype),{constructor:Ys,isInstancedBufferGeometry:!0,copy:function(e){return Yt.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var e=Yt.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}),Js.prototype=Object.assign(Object.create(kt.prototype),{constructor:Js,isInstancedBufferAttribute:!0,copy:function(e){return kt.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=kt.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}),Zs.prototype=Object.assign(Object.create($o.prototype),{constructor:Zs,load:function(e,t,n,i){var r=this,a=new ts(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)},parse:function(e){var t={},n={};function i(e,i){if(void 0!==t[i])return t[i];var r=e.interleavedBuffers[i],a=function(e,t){if(void 0!==n[t])return n[t];var i=e.arrayBuffers[t],r=new Uint32Array(i).buffer;return n[t]=r,r}(e,r.buffer),o=new zr(new Qs[r.type](a),r.stride);return o.uuid=r.uuid,t[i]=o,o}var r=e.isInstancedBufferGeometry?new Ys:new Yt,a=e.data.index;if(void 0!==a){var o=new Qs[a.type](a.array);r.setIndex(new kt(o,1))}var s=e.data.attributes;for(var l in s){var c=s[l],u=void 0;if(c.isInterleavedBufferAttribute)u=new Hr(i(e.data,c.data),c.itemSize,c.offset,c.normalized);else{var h=new Qs[c.type](c.array);u=new(c.isInstancedBufferAttribute?Js:kt)(h,c.itemSize,c.normalized)}void 0!==c.name&&(u.name=c.name),r.setAttribute(l,u)}var d=e.data.morphAttributes;if(d)for(var p in d){for(var f=d[p],m=[],v=0,g=f.length;v<g;v++){var y=f[v],b=void 0;b=y.isInterleavedBufferAttribute?new Hr(i(e.data,y.data),y.itemSize,y.offset,y.normalized):new kt(new Qs[y.type](y.array),y.itemSize,y.normalized),void 0!==y.name&&(b.name=y.name),m.push(b)}r.morphAttributes[p]=m}e.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);var x=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==x)for(var w=0,_=x.length;w!==_;++w){var M=x[w];r.addGroup(M.start,M.count,M.materialIndex)}var S=e.data.boundingSphere;if(void 0!==S){var T=new te;void 0!==S.center&&T.fromArray(S.center),r.boundingSphere=new xe(T,S.radius)}return e.name&&(r.name=e.name),e.userData&&(r.userData=e.userData),r}});var Ks,Qs={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function $s(e){"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),$o.call(this,e),this.options={premultiplyAlpha:"none"}}function el(){this.type="ShapePath",this.color=new _t,this.subPaths=[],this.currentPath=null}function tl(e){this.type="Font",this.data=e}function nl(e,t,n,i,r){var a=r.glyphs[e]||r.glyphs["?"];if(a){var o,s,l,c,u,h,d,p,f=new el;if(a.o)for(var m=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),v=0,g=m.length;v<g;)switch(m[v++]){case"m":o=m[v++]*t+n,s=m[v++]*t+i,f.moveTo(o,s);break;case"l":o=m[v++]*t+n,s=m[v++]*t+i,f.lineTo(o,s);break;case"q":l=m[v++]*t+n,c=m[v++]*t+i,u=m[v++]*t+n,h=m[v++]*t+i,f.quadraticCurveTo(u,h,l,c);break;case"b":l=m[v++]*t+n,c=m[v++]*t+i,u=m[v++]*t+n,h=m[v++]*t+i,d=m[v++]*t+n,p=m[v++]*t+i,f.bezierCurveTo(u,h,d,p,l,c)}return{offsetX:a.ha*t,path:f}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+r.familyName+".")}function il(e){$o.call(this,e)}$s.prototype=Object.assign(Object.create($o.prototype),{constructor:$s,isImageBitmapLoader:!0,setOptions:function(e){return this.options=e,this},load:function(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Ko.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout((function(){t&&t(a),r.manager.itemEnd(e)}),0),a;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,r.options)})).then((function(n){Ko.add(e,n),t&&t(n),r.manager.itemEnd(e)})).catch((function(t){i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)})),r.manager.itemStart(e)}}),Object.assign(el.prototype,{moveTo:function(e,t){return this.currentPath=new ks,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this},bezierCurveTo:function(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n],a=new Rs;a.curves=r.curves,t.push(a)}return t}function i(e,t){for(var n=t.length,i=!1,r=n-1,a=0;a<n;r=a++){var o=t[r],s=t[a],l=s.x-o.x,c=s.y-o.y;if(Math.abs(c)>Number.EPSILON){if(c<0&&(o=t[a],l=-l,s=t[r],c=-c),e.y<o.y||e.y>s.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var u=c*(e.x-o.x)-l*(e.y-o.y);if(0===u)return!0;if(u<0)continue;i=!i}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return i}var r,a,o,s=mo.isClockWise,l=this.subPaths;if(0===l.length)return[];if(!0===t)return n(l);var c=[];if(1===l.length)return a=l[0],(o=new Rs).curves=a.curves,c.push(o),c;var u=!s(l[0].getPoints());u=e?!u:u;var h,d,p=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=l.length;g<y;g++)r=s(h=(a=l[g]).getPoints()),(r=e?!r:r)?(!u&&f[v]&&v++,f[v]={s:new Rs,p:h},f[v].s.curves=a.curves,u&&v++,m[v]=[]):m[v].push({h:a,p:h[0]});if(!f[0])return n(l);if(f.length>1){for(var b=!1,x=[],w=0,_=f.length;w<_;w++)p[w]=[];for(var M=0,S=f.length;M<S;M++)for(var T=m[M],E=0;E<T.length;E++){for(var A=T[E],L=!0,k=0;k<f.length;k++)i(A.p,f[k].p)&&(M!==k&&x.push({froms:M,tos:k,hole:E}),L?(L=!1,p[k].push(A)):b=!0);L&&p[M].push(A)}x.length>0&&(b||(m=p))}for(var R=0,O=f.length;R<O;R++){o=f[R].s,c.push(o);for(var C=0,P=(d=m[R]).length;C<P;C++)o.holes.push(d[C].h)}return c}}),Object.assign(tl.prototype,{isFont:!0,generateShapes:function(e,t){void 0===t&&(t=100);for(var n=[],i=function(e,t,n){for(var i=Array.from?Array.from(e):String(e).split(""),r=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,o=[],s=0,l=0,c=0;c<i.length;c++){var u=i[c];if("\n"===u)s=0,l-=a;else{var h=nl(u,r,s,l,n);s+=h.offsetX,o.push(h.path)}}return o}(e,t,this.data),r=0,a=i.length;r<a;r++)Array.prototype.push.apply(n,i[r].toShapes());return n}}),il.prototype=Object.assign(Object.create($o.prototype),{constructor:il,load:function(e,t,n,i){var r=this,a=new ts(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,(function(e){var n;try{n=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(e.substring(65,e.length-2))}var i=r.parse(n);t&&t(i)}),n,i)},parse:function(e){return new tl(e)}});function rl(e){$o.call(this,e)}function al(e,t,n){Vs.call(this,void 0,n);var i=(new _t).set(e),r=(new _t).set(t),a=new te(i.r,i.g,i.b),o=new te(r.r,r.g,r.b),s=Math.sqrt(Math.PI),l=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(l)}function ol(e,t){Vs.call(this,void 0,t);var n=(new _t).set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}rl.prototype=Object.assign(Object.create($o.prototype),{constructor:rl,load:function(e,t,n,i){var r=this,a=new ts(r.manager);a.setResponseType("arraybuffer"),a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,(function(n){try{var a=n.slice(0);(void 0===Ks&&(Ks=new(window.AudioContext||window.webkitAudioContext)),Ks).decodeAudioData(a,(function(e){t(e)}))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}}),al.prototype=Object.assign(Object.create(Vs.prototype),{constructor:al,isHemisphereLightProbe:!0,copy:function(e){return Vs.prototype.copy.call(this,e),this},toJSON:function(e){return Vs.prototype.toJSON.call(this,e)}}),ol.prototype=Object.assign(Object.create(Vs.prototype),{constructor:ol,isAmbientLightProbe:!0,copy:function(e){return Vs.prototype.copy.call(this,e),this},toJSON:function(e){return Vs.prototype.toJSON.call(this,e)}});var sl=new ke,ll=new ke;function cl(e,t,n){var i,r,a;switch(this.binding=e,this.valueSize=n,t){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}Object.assign(function(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new _n,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new _n,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}.prototype,{update:function(e){var t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep;var n,i,r=e.projectionMatrix.clone(),a=t.eyeSep/2,o=a*t.near/t.focus,s=t.near*Math.tan(W.DEG2RAD*t.fov*.5)/t.zoom;ll.elements[12]=-a,sl.elements[12]=a,n=-s*t.aspect+o,i=s*t.aspect+o,r.elements[0]=2*t.near/(i-n),r.elements[8]=(i+n)/(i-n),this.cameraL.projectionMatrix.copy(r),n=-s*t.aspect-o,i=s*t.aspect-o,r.elements[0]=2*t.near/(i-n),r.elements[8]=(i+n)/(i-n),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(ll),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(sl)}}),Object.assign(cl.prototype,{accumulate:function(e,t){var n=this.buffer,i=this.valueSize,r=e*i+i,a=this.cumulativeWeight;if(0===a){for(var o=0;o!==i;++o)n[r+o]=n[o];a=t}else{var s=t/(a+=t);this._mixBufferRegion(n,r,0,s,i)}this.cumulativeWeight=a},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){var s=t*this._origIndex;this._mixBufferRegion(n,i,s,1-r,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(var l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){o.setValue(n,i);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(var r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,i,r){if(i>=.5)for(var a=0;a!==r;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,i){ee.slerpFlat(e,t,e,t,e,n,i)},_slerpAdditive:function(e,t,n,i,r){var a=this._workIndex*r;ee.multiplyQuaternionsFlat(e,a,e,t,e,n),ee.slerpFlat(e,t,e,t,e,a,i)},_lerp:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}},_lerpAdditive:function(e,t,n,i,r){for(var a=0;a!==r;++a){var o=t+a;e[o]=e[o]+e[n+a]*i}}});var ul=new RegExp("[\\[\\]\\.:\\/]","g"),hl="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",dl=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),pl=/(WCOD+)?/.source.replace("WCOD",hl),fl=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),ml=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),vl=new RegExp("^"+dl+pl+fl+ml+"$"),gl=["material","materials","bones"];function yl(e,t,n){var i=n||bl.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}function bl(e,t,n){this.path=t,this.parsedPath=n||bl.parseTrackName(t),this.node=bl.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}Object.assign(yl.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}),Object.assign(bl,{Composite:yl,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new bl.Composite(e,t,n):new bl(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(ul,"")},parseTrackName:function(e){var t=vl.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var r=n.nodeName.substring(i+1);-1!==gl.indexOf(r)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){var i=function e(n){for(var i=0;i<n.length;i++){var r=n[i];if(r.name===t||r.uuid===t)return r;var a=e(r.children);if(a)return a}return null}(e.children);if(i)return i}return null}}),Object.assign(bl.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(e,t){e[t]=this.node[this.propertyName]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)e[t++]=n[i]},function(e,t){e[t]=this.resolvedProperty[this.propertyIndex]},function(e,t){this.resolvedProperty.toArray(e,t)}],SetterByBindingTypeAndVersioning:[[function(e,t){this.targetObject[this.propertyName]=e[t]},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++]},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0},function(e,t){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty[this.propertyIndex]=e[t]},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(e,t){this.resolvedProperty.fromArray(e,t)},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0},function(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(e,t){this.bind(),this.getValue(e,t)},setValue:function(e,t){this.bind(),this.setValue(e,t)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=bl.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==a){if(void 0===e[a])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[a]}}var s=e[i];if(void 0!==s){var l=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?l=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate);var c=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}c=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(c=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(c=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][l]}else{var u=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+u+"."+i+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}),Object.assign(bl.prototype,{_getValue_unbound:bl.prototype.getValue,_setValue_unbound:bl.prototype.setValue}),Object.assign(function(){this.uuid=W.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,a=r.length,o=void 0,s=e.length,l=this.nCachedObjects_,c=0,u=arguments.length;c!==u;++c){var h=arguments[c],d=h.uuid,p=t[d];if(void 0===p){p=s++,t[d]=p,e.push(h);for(var f=0,m=a;f!==m;++f)r[f].push(new bl(h,n[f],i[f]))}else if(p<l){o=e[p];var v=--l,g=e[v];t[g.uuid]=p,e[p]=g,t[d]=v,e[v]=h;for(var y=0,b=a;y!==b;++y){var x=r[y],w=x[v],_=x[p];x[p]=w,void 0===_&&(_=new bl(h,n[y],i[y])),x[v]=_}}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},remove:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,r=this.nCachedObjects_,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,c=t[l];if(void 0!==c&&c>=r){var u=r++,h=e[u];t[h.uuid]=c,e[c]=h,t[l]=u,e[u]=s;for(var d=0,p=i;d!==p;++d){var f=n[d],m=f[u],v=f[c];f[c]=m,f[u]=v}}}this.nCachedObjects_=r},uncache:function(){for(var e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length,r=this.nCachedObjects_,a=e.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o].uuid,c=t[l];if(void 0!==c)if(delete t[l],c<r){var u=--r,h=e[u],d=--a,p=e[d];t[h.uuid]=c,e[c]=h,t[p.uuid]=u,e[u]=p,e.pop();for(var f=0,m=i;f!==m;++f){var v=n[f],g=v[u],y=v[d];v[c]=g,v[u]=y,v.pop()}}else{var b=--a,x=e[b];t[x.uuid]=c,e[c]=x,e.pop();for(var w=0,_=i;w!==_;++w){var M=n[w];M[c]=M[b],M.pop()}}}this.nCachedObjects_=r},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(void 0!==i)return r[i];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,u=new Array(l);i=r.length,n[e]=i,a.push(e),o.push(t),r.push(u);for(var h=c,d=s.length;h!==d;++h){var p=s[h];u[h]=new bl(p,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){var i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];t[e[o]]=n,a[n]=s,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}});var xl=function(){function e(t,n,i,r){Object(h.a)(this,e),this._mixer=t,this._clip=n,this._localRoot=i||null,this.blendMode=r||n.blendMode;for(var a=n.tracks,o=a.length,s=new Array(o),l={endingStart:2400,endingEnd:2400},c=0;c!==o;++c){var u=a[c].createInterpolant(null);s[c]=u,u.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 Object(d.a)(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 i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this}},{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 i=this._mixer,r=i.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,l=o.sampleValues;return s[0]=r,s[1]=r+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,i){if(this.enabled){var r=this._startTime;if(null!==r){var a=(e-r)*n;if(a<0||0===n)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case 2501:for(var u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(s);break;case 2500:default:for(var d=0,p=l.length;d!==p;++d)l[d].evaluate(o),c[d].accumulate(i,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 i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(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;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,i=this.time+e,r=this._loopCount,a=2202===n;if(0===e)return-1===r?i:a&&1==(1&r)?t-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=t||i<0){var o=Math.floor(i/t);i-=t*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&1==(1&r))return t-i}return i}},{key:"_setEndings",value:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=e?this.zeroSlopeAtStart?2401:2400:2402,i.endingEnd=t?this.zeroSlopeAtEnd?2401:2400:2402)}},{key:"_scheduleFading",value:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}}]),e}();function wl(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}wl.prototype=Object.assign(Object.create(j.prototype),{constructor:wl,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var u=0;u!==r;++u){var h=i[u],d=h.name,p=c[d];if(void 0!==p)a[u]=p;else{if(void 0!==(p=a[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[u].binding.parsedPath;++(p=new cl(bl.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[u]=p}o[u].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var i=this._actions,r=this._actionsByClip,a=r[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;var r=e._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,l=s[s.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===s.length&&delete a[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_addInactiveBinding:function(e,t,n){var i=this._bindingsByRootAndName,r=this._bindings,a=i[t];void 0===a&&(a={},i[t]=a),a[n]=e,e._cacheIndex=r.length,r.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],s=t[t.length-1],l=e._cacheIndex;s._cacheIndex=l,t[l]=s,t.pop(),delete o[r],0===Object.keys(o).length&&delete a[i]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return void 0===n&&((n=new zo(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var i=t||this._root,r=i.uuid,a="string"==typeof e?Jo.findByName(i,e):e,o=null!==a?a.uuid:e,s=this._actionsByClip[o],l=null;if(void 0===n&&(n=null!==a?a.blendMode:2500),void 0!==s){var c=s.actionByRoot[r];if(void 0!==c&&c.blendMode===n)return c;l=s.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;var u=new xl(this,a,t,n);return this._bindAction(u,l),this._addInactiveAction(u,o,r),u},existingAction:function(e,t){var n=t||this._root,i=n.uuid,r="string"==typeof e?Jo.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return void 0!==o&&o.actionByRoot[i]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o)t[o]._update(i,e,r,a);for(var s=this._bindings,l=this._nActiveBindings,c=0;c!==l;++c)s[c].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var c=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,u._cacheIndex=c,t[c]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot[t];void 0!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var o in a){var s=a[o];s.restoreOriginalState(),this._removeInactiveBinding(s)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}});var _l=function(){function e(t){Object(h.a)(this,e),"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}return Object(d.a)(e,[{key:"clone",value:function(){return new e(void 0===this.value.clone?this.value:this.value.clone())}}]),e}();function Ml(e,t,n){zr.call(this,e,t),this.meshPerAttribute=n||1}function Sl(e,t,n,i,r){this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}function Tl(e,t,n,i){this.ray=new Le(e,t),this.near=n||0,this.far=i||1/0,this.camera=null,this.layers=new je,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function El(e,t){return e.distance-t.distance}function Al(e,t,n,i){if(e.layers.test(t.layers)&&e.raycast(t,n),!0===i)for(var r=e.children,a=0,o=r.length;a<o;a++)Al(r[a],t,n,!0)}Ml.prototype=Object.assign(Object.create(zr.prototype),{constructor:Ml,isInstancedInterleavedBuffer:!0,copy:function(e){return zr.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},clone:function(e){var t=zr.prototype.clone.call(this,e);return t.meshPerAttribute=this.meshPerAttribute,t},toJSON:function(e){var t=zr.prototype.toJSON.call(this,e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}),Object.defineProperty(Sl.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Sl.prototype,{isGLBufferAttribute:!0,setBuffer:function(e){return this.buffer=e,this},setType:function(e,t){return this.type=e,this.elementSize=t,this},setItemSize:function(e){return this.itemSize=e,this},setCount:function(e){return this.count=e,this}}),Object.assign(Tl.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var i=n||[];return Al(e,this,i,t),i.sort(El),i},intersectObjects:function(e,t,n){var i=n||[];if(!1===Array.isArray(e))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var r=0,a=e.length;r<a;r++)Al(e[r],this,i,t);return i.sort(El),i}});var Ll=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Object(h.a)(this,e),this.radius=t,this.phi=n,this.theta=i,this}return Object(d.a)(e,[{key:"set",value:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}},{key:"makeSafe",value:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}},{key:"setFromVector3",value:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}},{key:"setFromCartesianCoords",value:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(W.clamp(t/this.radius,-1,1))),this}}]),e}(),kl=new q;function Rl(e){et.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}Rl.prototype=Object.create(et.prototype),Rl.prototype.constructor=Rl,Rl.prototype.isImmediateRenderObject=!0;var Ol=new te,Cl=new ke,Pl=new ke,Il=function(e){Object(p.a)(n,e);var t=b(n);function n(e){var i;Object(h.a)(this,n);for(var r=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var i=0;i<t.children.length;i++)n.push.apply(n,e(t.children[i]));return n}(e),a=new Yt,o=[],s=[],l=new _t(0,0,1),c=new _t(0,1,0),u=0;u<r.length;u++){var d=r[u];d.parent&&d.parent.isBone&&(o.push(0,0,0),o.push(0,0,0),s.push(l.r,l.g,l.b),s.push(c.r,c.g,c.b))}return a.setAttribute("position",new Ft(o,3)),a.setAttribute("color",new Ft(s,3)),(i=t.call(this,a,new ga({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0}))).type="SkeletonHelper",i.isSkeletonHelper=!0,i.root=e,i.bones=r,i.matrix=e.matrixWorld,i.matrixAutoUpdate=!1,i}return Object(d.a)(n,[{key:"updateMatrixWorld",value:function(e){var t=this.bones,i=this.geometry,r=i.getAttribute("position");Pl.getInverse(this.root.matrixWorld);for(var o=0,s=0;o<t.length;o++){var l=t[o];l.parent&&l.parent.isBone&&(Cl.multiplyMatrices(Pl,l.matrixWorld),Ol.setFromMatrixPosition(Cl),r.setXYZ(s,Ol.x,Ol.y,Ol.z),Cl.multiplyMatrices(Pl,l.parent.matrixWorld),Ol.setFromMatrixPosition(Cl),r.setXYZ(s+1,Ol.x,Ol.y,Ol.z),s+=2)}i.getAttribute("position").needsUpdate=!0,Object(a.a)(Object(m.a)(n.prototype),"updateMatrixWorld",this).call(this,e)}}]),n}(Ea);var Dl=Math.pow(2,8),Nl=[.125,.215,.35,.446,.526,.582],Fl=5+Nl.length,Ul={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},zl=new Us,jl=function(){for(var e=[],t=[],n=[],i=8,r=0;r<Fl;r++){var a=Math.pow(2,i);t.push(a);var o=1/a;r>4?o=Nl[r-8+4-1]:0==r&&(o=0),n.push(o);for(var s=1/(a-1),l=-s/2,c=1+s/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],h=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,v=f>2?0:-1,g=[m,v,0,m+2/3,v,0,m+2/3,v+1,0,m,v,0,m+2/3,v+1,0,m,v+1,0];h.set(g,18*f),d.set(u,12*f);var y=[f,f,f,f,f,f];p.set(y,6*f)}var b=new Yt;b.setAttribute("position",new kt(h,3)),b.setAttribute("uv",new kt(d,2)),b.setAttribute("faceIndex",new kt(p,1)),e.push(b),i>4&&i--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}(),Bl=jl._lodPlanes,Hl=jl._sizeLods,Gl=jl._sigmas,Vl=null,Wl=(1+Math.sqrt(5))/2,ql=1/Wl,Xl=[new te(1,1,1),new te(-1,1,1),new te(1,1,-1),new te(-1,1,-1),new te(0,Wl,ql),new te(0,Wl,-ql),new te(ql,0,Wl),new te(-ql,0,Wl),new te(Wl,ql,0),new te(-Wl,ql,0)],Yl=function(){function e(t){Object(h.a)(this,e),this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=new Eo({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new te(0,1,0)},inputEncoding:{value:Ul[3e3]},outputEncoding:{value:Ul[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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".concat("\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t","\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\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:0,depthTest:!1,depthWrite:!1}),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}return Object(d.a)(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,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;Vl=this._renderer.getRenderTarget();var r=this._allocateTargets();return this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}},{key:"fromEquirectangular",value:function(e){return this._fromTexture(e)}},{key:"fromCubemap",value:function(e){return this._fromTexture(e)}},{key:"compileCubemapShader",value:function(){null===this._cubemapShader&&(this._cubemapShader=$l(),this._compileMaterial(this._cubemapShader))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectShader&&(this._equirectShader=Ql(),this._compileMaterial(this._equirectShader))}},{key:"dispose",value:function(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(var e=0;e<Bl.length;e++)Bl[e].dispose()}},{key:"_cleanup",value:function(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(Vl),e.scissorTest=!1,Kl(e,0,0,e.width,e.height)}},{key:"_fromTexture",value:function(e){Vl=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}},{key:"_allocateTargets",value:function(e){var t={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:1009,format:1023,encoding:Jl(e)?e.encoding:3002,depthBuffer:!1},n=Zl(t);return n.depthBuffer=!e,this._pingPongRenderTarget=Zl(t),n}},{key:"_compileMaterial",value:function(e){var t=new pn(Bl[0],e);this._renderer.compile(t,zl)}},{key:"_sceneToCubeUV",value:function(e,t,n,i){var r=new _n(90,1,t,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.outputEncoding,c=s.toneMapping,u=s.getClearColor(),h=s.getClearAlpha();s.toneMapping=0,s.outputEncoding=3e3;var d=e.background;if(d&&d.isColor){d.convertSRGBToLinear();var p=Math.max(d.r,d.g,d.b),f=Math.min(Math.max(Math.ceil(Math.log2(p)),-128),127);d=d.multiplyScalar(Math.pow(2,-f));var m=(f+128)/255;s.setClearColor(d,m),e.background=null}for(var v=0;v<6;v++){var g=v%3;0==g?(r.up.set(0,a[v],0),r.lookAt(o[v],0,0)):1==g?(r.up.set(0,0,a[v]),r.lookAt(0,o[v],0)):(r.up.set(0,a[v],0),r.lookAt(0,0,o[v])),Kl(i,g*Dl,v>2?Dl:0,Dl,Dl),s.setRenderTarget(i),s.render(e,r)}s.toneMapping=c,s.outputEncoding=l,s.setClearColor(u,h)}},{key:"_textureToCubeUV",value:function(e,t){var n=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=$l()):null==this._equirectShader&&(this._equirectShader=Ql());var i=e.isCubeTexture?this._cubemapShader:this._equirectShader,r=new pn(Bl[0],i),a=i.uniforms;a.envMap.value=e,e.isCubeTexture||a.texelSize.value.set(1/e.image.width,1/e.image.height),a.inputEncoding.value=Ul[e.encoding],a.outputEncoding.value=Ul[t.texture.encoding],Kl(t,0,0,3*Dl,2*Dl),n.setRenderTarget(t),n.render(r,zl)}},{key:"_applyPMREM",value:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var i=1;i<Fl;i++){var r=Math.sqrt(Gl[i]*Gl[i]-Gl[i-1]*Gl[i-1]),a=Xl[(i-1)%Xl.length];this._blur(e,i-1,i,r,a)}t.autoClear=n}},{key:"_blur",value:function(e,t,n,i,r){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}},{key:"_halfBlur",value:function(e,t,n,i,r,a,o){var s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var c=new pn(Bl[i],l),u=l.uniforms,h=Hl[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn("sigmaRadians, ".concat(r,", is too large and will clip, as it requested ").concat(f," samples when the maximum is set to 20"));for(var m=[],v=0,g=0;g<20;++g){var y=g/p,b=Math.exp(-y*y/2);m.push(b),0==g?v+=b:g<f&&(v+=2*b)}for(var x=0;x<m.length;x++)m[x]=m[x]/v;u.envMap.value=e.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===a,o&&(u.poleAxis.value=o),u.dTheta.value=d,u.mipInt.value=8-n,u.inputEncoding.value=Ul[e.texture.encoding],u.outputEncoding.value=Ul[e.texture.encoding];var w=Hl[i];Kl(t,3*Math.max(0,Dl-2*w),(0===i?0:2*Dl)+2*w*(i>4?i-8+4:0),3*w,2*w),s.setRenderTarget(t),s.render(c,zl)}}]),e}();function Jl(e){return void 0!==e&&1009===e.type&&(3e3===e.encoding||3001===e.encoding||3007===e.encoding)}function Zl(e){var t=new Q(3*Dl,3*Dl,e);return t.texture.mapping=306,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function Kl(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Ql(){return new Eo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:new q(1,1)},inputEncoding:{value:Ul[3e3]},outputEncoding:{value:Ul[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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 vec2 texelSize;\n\n\t\t\t".concat("\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t","\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:0,depthTest:!1,depthWrite:!1})}function $l(){return new Eo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Ul[3e3]},outputEncoding:{value:Ul[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\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 samplerCube envMap;\n\n\t\t\t".concat("\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t","\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:0,depthTest:!1,depthWrite:!1})}function ec(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),vs.call(this,e),this.type="catmullrom"}ls.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(ls.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(Ls.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new Ga,n=0,i=e.length;n<i;n++){var r=e[n];t.vertices.push(new te(r.x,r.y,r.z||0))}return t}}),Object.assign(ks.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}}),ec.prototype=Object.create(vs.prototype),Object.assign(ec.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),Il.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Object.assign($o.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Xs(e)}}),$o.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Object.assign(function(){function e(t,n){Object(h.a)(this,e),Object.defineProperty(this,"isBox2",{value:!0}),this.min=void 0!==t?t:new q(1/0,1/0),this.max=void 0!==n?n:new q(-1/0,-1/0)}return Object(d.a)(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=kl.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 void 0===e&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new q),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}},{key:"getSize",value:function(e){return void 0===e&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new q),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 void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new q),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 void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new q),t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return kl.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}().prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(re.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}}),Object.assign(xe.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}}),kn.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},Object.assign(W,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),W.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),W.ceilPowerOfTwo(e)}}),Object.assign(X.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(ke.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new te).setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,i,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,a)}}),rt.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},ee.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},Object.assign(Le.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}}),Object.assign(mt.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}}),Object.assign(mt,{barycoordFromPoint:function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),mt.getBarycoord(e,t,n,i,r)},normal:function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),mt.getNormal(e,t,n,i)}}),Object.assign(Rs.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new xo(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new So(this,e)}}),Object.assign(q.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(te.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(K.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}}),Object.assign(Ga.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.assign(et.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(et.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.assign(pn.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(pn.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(oa.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(ua.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),sa.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(ls.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}}),_n.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(Os.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(kt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),Object.assign(kt.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?35048:35044),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(Yt.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new kt(arguments[1],arguments[2])))},addDrawCall:function(e,t,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}}),Object.defineProperties(Yt.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Ys.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}}),Object.defineProperties(Tl.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}}),Object.defineProperties(zr.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),35048===this.usage},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}}),Object.assign(zr.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?35048:35044),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}}),Object.assign(yo.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}}),Object.assign(Ur.prototype,{dispose:function(){console.error("THREE.Scene: .dispose() has been removed.")}}),Object.defineProperties(_l.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(Tt.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 _t}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===e}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(e){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=e}}}),Object.defineProperties(ko.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Lo.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(e){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=e}}}),Object.defineProperties(xn.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}}),Object.assign(Nr.prototype,{clearTarget:function(e,t,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,i)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}}),Object.defineProperties(Nr.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(e){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===e?3001:3e3}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Ar.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(Q.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}}),Object.defineProperties(function(e){Object(p.a)(n,e);var t=b(n);function n(e){var i;return Object(h.a)(this,n),(i=t.call(this)).type="Audio",i.listener=e,i.context=e.context,i.gain=i.context.createGain(),i.gain.connect(e.getInput()),i.autoplay=!1,i.buffer=null,i.detune=0,i.loop=!1,i.loopStart=0,i.loopEnd=0,i.offset=0,i.duration=void 0,i.playbackRate=1,i.isPlaying=!1,i.hasPlaybackControl=!0,i.source=null,i.sourceType="empty",i._startedAt=0,i._progress=0,i._connected=!1,i.filters=[],i}return Object(d.a)(n,[{key:"getOutput",value:function(){return this.gain}},{key:"setNodeSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}},{key:"setMediaElementSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}},{key:"setMediaStreamSource",value:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}},{key:"setBuffer",value:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}},{key:"play",value:function(e){if(void 0===e&&(e=0),!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")}},{key:"pause",value:function(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"stop",value:function(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"connect",value:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}},{key:"disconnect",value:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}},{key:"getFilters",value:function(){return this.filters}},{key:"setFilters",value:function(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this}},{key:"setDetune",value:function(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}},{key:"getDetune",value:function(){return this.detune}},{key:"getFilter",value:function(){return this.getFilters()[0]}},{key:"setFilter",value:function(e){return this.setFilters(e?[e]:[])}},{key:"setPlaybackRate",value:function(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"getPlaybackRate",value:function(){return this.playbackRate}},{key:"onEnded",value:function(){this.isPlaying=!1}},{key:"getLoop",value:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}},{key:"setLoop",value:function(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}},{key:"setLoopStart",value:function(e){return this.loopStart=e,this}},{key:"setLoopEnd",value:function(e){return this.loopEnd=e,this}},{key:"getVolume",value:function(){return this.gain.gain.value}},{key:"setVolume",value:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}]),n}(et).prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new rl).load(e,(function(e){t.setBuffer(e)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Mn.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},Y.crossOrigin=void 0,Y.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new ss;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},Y.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new as;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a},Y.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},Y.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:"121"}}));var tc=function(e){$o.call(this,e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}};tc.prototype=Object.assign(Object.create($o.prototype),{constructor:tc,setDecoderPath:function(e){return this.decoderPath=e,this},setDecoderConfig:function(e){return this.decoderConfig=e,this},setWorkerLimit:function(e){return this.workerLimit=e,this},setVerbosity:function(){console.warn("THREE.DRACOLoader: The .setVerbosity() method has been removed.")},setDrawMode:function(){console.warn("THREE.DRACOLoader: The .setDrawMode() method has been removed.")},setSkipDequantization:function(){console.warn("THREE.DRACOLoader: The .setSkipDequantization() method has been removed.")},load:function(e,t,n,i){var r=this,a=new ts(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(e){var n={attributeIDs:r.defaultAttributeIDs,attributeTypes:r.defaultAttributeTypes,useUniqueIDs:!1};r.decodeGeometry(e,n).then(t).catch(i)}),n,i)},decodeDracoFile:function(e,t,n,i){var r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,r).then(t)},decodeGeometry:function(e,t){var n=this;for(var i in t.attributeTypes){var r=t.attributeTypes[i];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[i]=r.name)}var a,o=JSON.stringify(t);if(tc.taskCache.has(e)){var s=tc.taskCache.get(e);if(s.key===o)return s.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var l=this.workerNextTaskID++,c=e.byteLength,u=this._getWorker(l,c).then((function(n){return a=n,new Promise((function(n,i){a._callbacks[l]={resolve:n,reject:i},a.postMessage({type:"decode",id:l,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)}));return u.catch((function(){return!0})).then((function(){a&&l&&n._releaseTask(a,l)})),tc.taskCache.set(e,{key:o,promise:u}),u},_createGeometry:function(e){var t=new Yt;e.index&&t.setIndex(new kt(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var i=e.attributes[n],r=i.name,a=i.array,o=i.itemSize;t.setAttribute(r,new kt(a,o))}return t},_loadLibrary:function(e,t){var n=new ts(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((function(t,i){n.load(e,t,void 0,i)}))},preload:function(){return this._initDecoder(),this},_initDecoder:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,n=[];return t?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then((function(n){var i=n[0];t||(e.decoderConfig.wasmBinary=n[1]);var r=tc.DRACOWorker.toString(),a=["/* draco decoder */",i,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");e.workerSourceURL=URL.createObjectURL(new Blob([a]))})),this.decoderPending},_getWorker:function(e,t){var n=this;return this._initDecoder().then((function(){var i;return n.workerPool.length<n.workerLimit?((i=new Worker(n.workerSourceURL))._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:n.decoderConfig}),i.onmessage=function(e){var t=e.data;switch(t.type){case"decode":i._callbacks[t.id].resolve(t);break;case"error":i._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},n.workerPool.push(i)):n.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1})),(i=n.workerPool[n.workerPool.length-1])._taskCosts[e]=t,i._taskLoad+=t,i}))},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))},dispose:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}),tc.DRACOWorker=function(){var e,t;function n(e,t,n,i,r,a){var o=a.num_components(),s=n.num_points()*o,l=s*r.BYTES_PER_ELEMENT,c=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,r),u=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,a,c,l,u);var h=new r(e.HEAPF32.buffer,u,s).slice();return e._free(u),{name:i,array:h,itemSize:o}}onmessage=function(i){var r=i.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var a=r.buffer,o=r.taskConfig;t.then((function(e){var t=e.draco,i=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(a),a.byteLength);try{var l=function(e,t,i,r){var a,o,s=r.attributeIDs,l=r.attributeTypes,c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,o=t.DecodeBufferToMesh(i,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,o=t.DecodeBufferToPointCloud(i,a)}if(!o.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+o.error_msg());var u={index:null,attributes:[]};for(var h in s){var d,p,f=self[l[h]];if(r.useUniqueIDs)p=s[h],d=t.GetAttributeByUniqueId(a,p);else{if(-1===(p=t.GetAttributeId(a,e[s[h]])))continue;d=t.GetAttribute(a,p)}u.attributes.push(n(e,t,a,h,f,d))}return c===e.TRIANGULAR_MESH&&(u.index=function(e,t,n){var i=3*n.num_faces(),r=4*i,a=e._malloc(r);t.GetTrianglesUInt32Array(n,r,a);var o=new Uint32Array(e.HEAPF32.buffer,a,i).slice();return e._free(a),{array:o,itemSize:1}}(e,t,a)),e.destroy(a),u}(t,i,s,o),c=l.attributes.map((function(e){return e.array.buffer}));l.index&&c.push(l.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:l},c)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(s),t.destroy(i)}}))}}},tc.taskCache=new WeakMap,tc.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},tc.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},tc.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},tc.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};var nc,ic,rc,ac,oc,sc,lc=function(){function e(e){$o.call(this,e),this.dracoLoader=null,this.ddsLoader=null,this.ktx2Loader=null,this.pluginCallbacks=[],this.register((function(e){return new o(e)})),this.register((function(e){return new l(e)})),this.register((function(e){return new s(e)})),this.register((function(e){return new r(e)}))}function t(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}e.prototype=Object.assign(Object.create($o.prototype),{constructor:e,load:function(e,t,n,i){var r,a=this;r=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:Xs(e),this.manager.itemStart(e);var o=function(t){i?i(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},s=new ts(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{a.parse(n,r,(function(n){t(n),a.manager.itemEnd(e)}),o)}catch(e){o(e)}}),n,o)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},setKTX2Loader:function(e){return this.ktx2Loader=e,this},register:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this},unregister:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this},parse:function(e,t,r,o){var s,l={},p={};if("string"==typeof e)s=e;else if(qs(new Uint8Array(e,0,4))===c){try{l[n.KHR_BINARY_GLTF]=new u(e)}catch(e){return void(o&&o(e))}s=l[n.KHR_BINARY_GLTF].content}else s=qs(new Uint8Array(e));var v=JSON.parse(s);if(void 0===v.asset||v.asset.version[0]<2)o&&o(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var g=new R(v,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager,ktx2Loader:this.ktx2Loader});g.fileLoader.setRequestHeader(this.requestHeader);for(var y=0;y<this.pluginCallbacks.length;y++){var b=this.pluginCallbacks[y](g);p[b.name]=b,l[b.name]=!0}if(v.extensionsUsed)for(y=0;y<v.extensionsUsed.length;++y){var x=v.extensionsUsed[y],w=v.extensionsRequired||[];switch(x){case n.KHR_MATERIALS_UNLIT:l[x]=new a;break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:l[x]=new f;break;case n.KHR_DRACO_MESH_COMPRESSION:l[x]=new h(v,this.dracoLoader);break;case n.MSFT_TEXTURE_DDS:l[x]=new i(this.ddsLoader);break;case n.KHR_TEXTURE_TRANSFORM:l[x]=new d;break;case n.KHR_MESH_QUANTIZATION:l[x]=new m;break;default:w.indexOf(x)>=0&&void 0===p[x]&&console.warn('THREE.GLTFLoader: Unknown extension "'+x+'".')}}g.setExtensions(l),g.setPlugins(p),g.parse(r,o)}}});var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function i(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=e}function r(e){this.parser=e,this.name=n.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}function a(){this.name=n.KHR_MATERIALS_UNLIT}function o(e){this.parser=e,this.name=n.KHR_MATERIALS_CLEARCOAT}function s(e){this.parser=e,this.name=n.KHR_MATERIALS_TRANSMISSION}function l(e){this.parser=e,this.name=n.KHR_TEXTURE_BASISU}r.prototype._markDefs=function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,i=t.length;n<i;n++){var r=t[n];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}},r.prototype._loadLight=function(e){var t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;var r,a=t.json,o=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],s=new _t(16777215);void 0!==o.color&&s.fromArray(o.color);var l=void 0!==o.range?o.range:0;switch(o.type){case"directional":(r=new js(s)).target.position.set(0,0,-1),r.add(r.target);break;case"point":(r=new Fs(s)).distance=l;break;case"spot":(r=new Ds(s)).distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,r.angle=o.spot.outerConeAngle,r.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,r.target.position.set(0,0,-1),r.add(r.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+o.type+'".')}return r.position.set(0,0,0),r.decay=2,void 0!==o.intensity&&(r.intensity=o.intensity),r.name=t.createUniqueName(o.name||"light_"+e),i=Promise.resolve(r),t.cache.add(n,i),i},r.prototype.createNodeAttachment=function(e){var t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(e){return n._getNodeRef(t.cache,r,e)}))},a.prototype.getMaterialType=function(){return Et},a.prototype.extendParams=function(e,t,n){var i=[];e.color=new _t(1,1,1),e.opacity=1;var r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){var a=r.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture))}return Promise.all(i)},o.prototype.getMaterialType=function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Lo:null},o.prototype.extendMaterialParams=function(e,t){var n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();var r=[],a=i.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){var o=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new q(o,o)}return Promise.all(r)},s.prototype.getMaterialType=function(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Lo:null},s.prototype.extendMaterialParams=function(e,t){var n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();var r=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)},l.prototype.loadTexture=function(e){var t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;var r=i.extensions[this.name],a=n.images[r.source],o=t.options.ktx2Loader;if(!o)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,a,o)};var c="glTF";function u(e){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,12);if(this.header={magic:qs(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==c)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=new DataView(e,12),r=0;r<i.byteLength;){var a=i.getUint32(r,!0);r+=4;var o=i.getUint32(r,!0);if(r+=4,1313821514===o){var s=new Uint8Array(e,12+r,a);this.content=qs(s)}else if(5130562===o){var l=12+r;this.body=e.slice(l,l+a)}r+=a}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function h(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}function d(){this.name=n.KHR_TEXTURE_TRANSFORM}function p(e){Ao.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var t=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),i=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),r=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),a=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),o={specular:{value:(new _t).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=o,this.onBeforeCompile=function(e){for(var s in o)e.uniforms[s]=o[s];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",t).replace("#include <metalnessmap_pars_fragment>",n).replace("#include <roughnessmap_fragment>",i).replace("#include <metalnessmap_fragment>",r).replace("#include <lights_physical_fragment>",a)},Object.defineProperties(this,{specular:{get:function(){return o.specular.value},set:function(e){o.specular.value=e}},specularMap:{get:function(){return o.specularMap.value},set:function(e){o.specularMap.value=e,e?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return o.glossiness.value},set:function(e){o.glossiness.value=e}},glossinessMap:{get:function(){return o.glossinessMap.value},set:function(e){o.glossinessMap.value=e,e?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}function f(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return p},extendParams:function(e,t,n){var i=t.extensions[this.name];e.color=new _t(1,1,1),e.opacity=1;var r=[];if(Array.isArray(i.diffuseFactor)){var a=i.diffuseFactor;e.color.fromArray(a),e.opacity=a[3]}if(void 0!==i.diffuseTexture&&r.push(n.assignTexture(e,"map",i.diffuseTexture)),e.emissive=new _t(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new _t(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){var o=i.specularGlossinessTexture;r.push(n.assignTexture(e,"glossinessMap",o)),r.push(n.assignTexture(e,"specularMap",o))}return Promise.all(r)},createMaterial:function(e){var t=new p(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=0,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}}function m(){this.name=n.KHR_MESH_QUANTIZATION}function v(e,t,n,i){Fo.call(this,e,t,n,i)}h.prototype.decodePrimitive=function(e,t){var n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},l={};for(var c in a){var u=w[c]||c.toLowerCase();o[u]=a[c]}for(c in e.attributes)if(u=w[c]||c.toLowerCase(),void 0!==a[c]){var h=n.accessors[e.attributes[c]],d=g[h.componentType];l[u]=d,s[u]=!0===h.normalized}return t.getDependency("bufferView",r).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var n in e.attributes){var i=e.attributes[n],r=s[n];void 0!==r&&(i.normalized=r)}t(e)}),o,l)}))}))},d.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},p.prototype=Object.create(Ao.prototype),p.prototype.constructor=p,p.prototype.copy=function(e){return Ao.prototype.copy.call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},v.prototype=Object.create(Fo.prototype),v.prototype.constructor=v,v.prototype.copySampleValue_=function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i,a=0;a!==i;a++)t[a]=n[r+a];return t},v.prototype.beforeStart_=v.prototype.copySampleValue_,v.prototype.afterEnd_=v.prototype.copySampleValue_,v.prototype.interpolate_=function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,c=i-t,u=(n-t)/c,h=u*u,d=h*u,p=e*l,f=p-l,m=-2*d+3*h,v=d-h,g=1-m,y=v-h+u,b=0;b!==o;b++){var x=a[f+b+o],w=a[f+b+s]*c,_=a[p+b+o],M=a[p+b]*c;r[b]=g*x+y*w+m*_+v*M}return r};var g={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},y={9728:1003,9729:1006,9984:1004,9985:1007,9986:1005,9987:1008},b={33071:1001,33648:1002,10497:1e3},x={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},w={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},_={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},M={CUBICSPLINE:void 0,LINEAR:2301,STEP:2300};function S(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}function T(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new Ao({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function E(e,t,n){for(var i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function A(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function L(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){var r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length)for(e.morphTargetDictionary={},n=0,i=r.length;n<i;n++)e.morphTargetDictionary[r[n]]=n;else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function k(e){for(var t="",n=Object.keys(e).sort(),i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function R(e,n){this.json=e||{},this.extensions={},this.plugins={},this.options=n||{},this.cache=new t,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?this.textureLoader=new $s(this.options.manager):this.textureLoader=new ss(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new ts(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function O(e,t,n){var i=t.attributes,r=[];function a(t,i){return n.getDependency("accessor",t).then((function(t){e.setAttribute(i,t)}))}for(var o in i){var s=w[o]||o.toLowerCase();s in e.attributes||r.push(a(i[o],s))}if(void 0!==t.indices&&!e.index){var l=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));r.push(l)}return A(e,t),function(e,t,n){var i=t.attributes,r=new re;if(void 0!==i.POSITION){var a=(d=n.json.accessors[i.POSITION]).min,o=d.max;if(void 0!==a&&void 0!==o){r.set(new te(a[0],a[1],a[2]),new te(o[0],o[1],o[2]));var s=t.targets;if(void 0!==s){for(var l=new te,c=new te,u=0,h=s.length;u<h;u++){var d,p=s[u];void 0!==p.POSITION&&(a=(d=n.json.accessors[p.POSITION]).min,o=d.max,void 0!==a&&void 0!==o?(c.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),c.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),c.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),l.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}r.expandByVector(l)}e.boundingBox=r;var f=new xe;r.getCenter(f.center),f.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=f}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,n),Promise.all(r).then((function(){return void 0!==t.targets?function(e,t,n){for(var i=!1,r=!1,a=0,o=t.length;a<o&&(void 0!==(c=t[a]).POSITION&&(i=!0),void 0!==c.NORMAL&&(r=!0),!i||!r);a++);if(!i&&!r)return Promise.resolve(e);var s=[],l=[];for(a=0,o=t.length;a<o;a++){var c=t[a];if(i){var u=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):e.attributes.position;s.push(u)}r&&(u=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):e.attributes.normal,l.push(u))}return Promise.all([Promise.all(s),Promise.all(l)]).then((function(t){var n=t[0],a=t[1];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=a),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}function C(e,t){var n=e.getIndex();if(null===n){var i=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a<r.count;a++)i.push(a);e.setIndex(i),n=e.getIndex()}var o=n.count-2,s=[];if(2===t)for(a=1;a<=o;a++)s.push(n.getX(0)),s.push(n.getX(a)),s.push(n.getX(a+1));else for(a=0;a<o;a++)a%2==0?(s.push(n.getX(a)),s.push(n.getX(a+1)),s.push(n.getX(a+2))):(s.push(n.getX(a+2)),s.push(n.getX(a+1)),s.push(n.getX(a)));s.length/3!==o&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var l=e.clone();return l.setIndex(s),l}return R.prototype.setExtensions=function(e){this.extensions=e},R.prototype.setPlugins=function(e){this.plugins=e},R.prototype.parse=function(e,t){var n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all([this.getDependencies("scene"),this.getDependencies("animation"),this.getDependencies("camera")]).then((function(t){var a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};E(r,a,i),A(a,i),e(a)})).catch(t)},R.prototype._markDefs=function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],i=0,r=t.length;i<r;i++)for(var a=t[i].joints,o=0,s=a.length;o<s;o++)e[a[o]].isBone=!0;for(var l=0,c=e.length;l<c;l++){var u=e[l];void 0!==u.mesh&&(this._addNodeRef(this.meshCache,u.mesh),void 0!==u.skin&&(n[u.mesh].isSkinnedMesh=!0)),void 0!==u.camera&&this._addNodeRef(this.cameraCache,u.camera)}},R.prototype._addNodeRef=function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)},R.prototype._getNodeRef=function(e,t,n){if(e.refs[t]<=1)return n;var i=n.clone();return i.name+="_instance_"+e.uses[t]++,i},R.prototype._invokeOne=function(e){var t=Object.values(this.plugins);t.push(this);for(var n=0;n<t.length;n++){var i=e(t[n]);if(i)return i}},R.prototype._invokeAll=function(e){var t=Object.values(this.plugins);t.unshift(this);for(var n=[],i=0;i<t.length;i++){var r=e(t[i]);r&&n.push(r)}return n},R.prototype.getDependency=function(e,t){var n=e+":"+t,i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this.loadNode(t);break;case"mesh":i=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":i=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":i=this.loadSkin(t);break;case"animation":i=this.loadAnimation(t);break;case"camera":i=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i},R.prototype.getDependencies=function(e){var t=this.cache.get(e);if(!t){var n=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map((function(t,i){return n.getDependency(e,i)}))),this.cache.add(e,t)}return t},R.prototype.loadBuffer=function(e){var t=this.json.buffers[e],i=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);var r=this.options;return new Promise((function(e,n){i.load(S(t.uri,r.path),e,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))},R.prototype.loadBufferView=function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)}))},R.prototype.loadAccessor=function(e){var t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse)return Promise.resolve(null);var r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then((function(e){var r,a=e[0],o=x[i.type],s=g[i.componentType],l=s.BYTES_PER_ELEMENT,c=l*o,u=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized;if(h&&h!==c){var p=Math.floor(u/h),f="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count,m=t.cache.get(f);m||(m=new zr(new s(a,p*h,i.count*h/l),h/l),t.cache.add(f,m)),r=new Hr(m,o,u%h/l,d)}else r=new kt(null===a?new s(i.count*o):new s(a,u,i.count*o),o,d);if(void 0!==i.sparse){var v=x.SCALAR,y=g[i.sparse.indices.componentType],b=i.sparse.indices.byteOffset||0,w=i.sparse.values.byteOffset||0,_=new y(e[1],b,i.sparse.count*v),M=new s(e[2],w,i.sparse.count*o);null!==a&&(r=new kt(r.array.slice(),r.itemSize,r.normalized));for(var S=0,T=_.length;S<T;S++){var E=_[S];if(r.setX(E,M[S*o]),o>=2&&r.setY(E,M[S*o+1]),o>=3&&r.setZ(E,M[S*o+2]),o>=4&&r.setW(E,M[S*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return r}))},R.prototype.loadTexture=function(e){var t,i,r=this.json,a=this.options,o=r.textures[e],s=o.extensions||{};return(t=s[n.MSFT_TEXTURE_DDS]?r.images[s[n.MSFT_TEXTURE_DDS].source]:r.images[o.source]).uri&&(i=a.manager.getHandler(t.uri)),i||(i=s[n.MSFT_TEXTURE_DDS]?this.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:this.textureLoader),this.loadTextureImage(e,t,i)},R.prototype.loadTextureImage=function(e,t,n){var i=this,r=this.json,a=this.options,o=r.textures[e],s=self.URL||self.webkitURL,l=t.uri,c=!1,u=!0;return"image/jpeg"===t.mimeType&&(u=!1),void 0!==t.bufferView&&(l=i.getDependency("bufferView",t.bufferView).then((function(e){if("image/png"===t.mimeType){var n=new DataView(e,25,1).getUint8(0,!1);u=6===n||4===n||3===n}c=!0;var i=new Blob([e],{type:t.mimeType});return l=s.createObjectURL(i)}))),Promise.resolve(l).then((function(e){return new Promise((function(t,i){var r=t;!0===n.isImageBitmapLoader&&(r=function(e){t(new Fa(e))}),n.load(S(e,a.path),r,void 0,i)}))})).then((function(t){!0===c&&s.revokeObjectURL(l),t.flipY=!1,o.name&&(t.name=o.name),u||(t.format=1022);var n=(r.samplers||{})[o.sampler]||{};return t.magFilter=y[n.magFilter]||1006,t.minFilter=y[n.minFilter]||1008,t.wrapS=b[n.wrapS]||1e3,t.wrapT=b[n.wrapT]||1e3,i.associations.set(t,{type:"textures",index:e}),t}))},R.prototype.assignTexture=function(e,t,i){var r=this;return this.getDependency("texture",i.index).then((function(a){if(void 0===i.texCoord||0==i.texCoord||"aoMap"===t&&1==i.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+i.texCoord+" for texture "+t+" not yet supported."),r.extensions[n.KHR_TEXTURE_TRANSFORM]){var o=void 0!==i.extensions?i.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(o){var s=r.associations.get(a);a=r.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),r.associations.set(a,s)}}e[t]=a}))},R.prototype.assignFinalMaterial=function(e){var t=e.geometry,n=e.material,i=void 0!==t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal,o=!0===e.isSkinnedMesh,s=Object.keys(t.morphAttributes).length>0,l=s&&void 0!==t.morphAttributes.normal;if(e.isPoints){var c="PointsMaterial:"+n.uuid,u=this.cache.get(c);u||(u=new La,Tt.prototype.copy.call(u,n),u.color.copy(n.color),u.map=n.map,u.sizeAttenuation=!1,this.cache.add(c,u)),n=u}else if(e.isLine){c="LineBasicMaterial:"+n.uuid;var h=this.cache.get(c);h||(h=new ga,Tt.prototype.copy.call(h,n),h.color.copy(n.color),this.cache.add(c,h)),n=h}if(i||r||a||o||s){c="ClonedMaterial:"+n.uuid+":",n.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),o&&(c+="skinning:"),i&&(c+="vertex-tangents:"),r&&(c+="vertex-colors:"),a&&(c+="flat-shading:"),s&&(c+="morph-targets:"),l&&(c+="morph-normals:");var d=this.cache.get(c);d||(d=n.clone(),o&&(d.skinning=!0),i&&(d.vertexTangents=!0),r&&(d.vertexColors=!0),a&&(d.flatShading=!0),s&&(d.morphTargets=!0),l&&(d.morphNormals=!0),this.cache.add(c,d),this.associations.set(d,this.associations.get(n))),n=d}n.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),n.normalScale&&!i&&(n.normalScale.y=-n.normalScale.y),n.clearcoatNormalScale&&!i&&(n.clearcoatNormalScale.y=-n.clearcoatNormalScale.y),e.material=n},R.prototype.getMaterialType=function(){return Ao},R.prototype.loadMaterial=function(e){var t,i=this,r=this.json,a=this.extensions,o=r.materials[e],s={},l=o.extensions||{},c=[];if(l[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var u=a[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=u.getMaterialType(),c.push(u.extendParams(s,o,i))}else if(l[n.KHR_MATERIALS_UNLIT]){var h=a[n.KHR_MATERIALS_UNLIT];t=h.getMaterialType(),c.push(h.extendParams(s,o,i))}else{var d=o.pbrMetallicRoughness||{};if(s.color=new _t(1,1,1),s.opacity=1,Array.isArray(d.baseColorFactor)){var f=d.baseColorFactor;s.color.fromArray(f),s.opacity=f[3]}void 0!==d.baseColorTexture&&c.push(i.assignTexture(s,"map",d.baseColorTexture)),s.metalness=void 0!==d.metallicFactor?d.metallicFactor:1,s.roughness=void 0!==d.roughnessFactor?d.roughnessFactor:1,void 0!==d.metallicRoughnessTexture&&(c.push(i.assignTexture(s,"metalnessMap",d.metallicRoughnessTexture)),c.push(i.assignTexture(s,"roughnessMap",d.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),c.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)}))))}!0===o.doubleSided&&(s.side=2);var m=o.alphaMode||"OPAQUE";return"BLEND"===m?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===m&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==Et&&(c.push(i.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new q(1,1),void 0!==o.normalTexture.scale&&s.normalScale.set(o.normalTexture.scale,o.normalTexture.scale)),void 0!==o.occlusionTexture&&t!==Et&&(c.push(i.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==Et&&(s.emissive=(new _t).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==Et&&c.push(i.assignTexture(s,"emissiveMap",o.emissiveTexture)),Promise.all(c).then((function(){var r;return r=t===p?a[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new t(s),o.name&&(r.name=o.name),r.map&&(r.map.encoding=3001),r.emissiveMap&&(r.emissiveMap.encoding=3001),A(r,o),i.associations.set(r,{type:"materials",index:e}),o.extensions&&E(a,r,o),r}))},R.prototype.createUniqueName=function(e){for(var t=bl.sanitizeNodeName(e||""),n=1;this.nodeNamesUsed[t];++n)t=e+"_"+n;return this.nodeNamesUsed[t]=!0,t},R.prototype.loadGeometries=function(e){var t=this,i=this.extensions,r=this.primitiveCache;function a(e){return i[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return O(n,e,t)}))}for(var o,s,l=[],c=0,u=e.length;c<u;c++){var h,d=e[c],p=(void 0,(s=(o=d).extensions&&o.extensions[n.KHR_DRACO_MESH_COMPRESSION])?"draco:"+s.bufferView+":"+s.indices+":"+k(s.attributes):o.indices+":"+k(o.attributes)+":"+o.mode),f=r[p];f?l.push(f.promise):(h=d.extensions&&d.extensions[n.KHR_DRACO_MESH_COMPRESSION]?a(d):O(new Yt,d,t),r[p]={primitive:d,promise:h},l.push(h))}return Promise.all(l)},R.prototype.loadMesh=function(e){for(var t=this,n=this.json.meshes[e],i=n.primitives,r=[],a=0,o=i.length;a<o;a++){var s=void 0===i[a].material?T(this.cache):this.getDependency("material",i[a].material);r.push(s)}return r.push(t.loadGeometries(i)),Promise.all(r).then((function(r){for(var a=r.slice(0,r.length-1),o=r[r.length-1],s=[],l=0,c=o.length;l<c;l++){var u,h=o[l],d=i[l],p=a[l];if(4===d.mode||5===d.mode||6===d.mode||void 0===d.mode)!0!==(u=!0===n.isSkinnedMesh?new sa(h,p):new pn(h,p)).isSkinnedMesh||u.geometry.attributes.skinWeight.normalized||u.normalizeSkinWeights(),5===d.mode?u.geometry=C(u.geometry,1):6===d.mode&&(u.geometry=C(u.geometry,2));else if(1===d.mode)u=new Ea(h,p);else if(3===d.mode)u=new Ma(h,p);else if(2===d.mode)u=new Aa(h,p);else{if(0!==d.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);u=new Pa(h,p)}Object.keys(u.geometry.morphAttributes).length>0&&L(u,n),u.name=t.createUniqueName(n.name||"mesh_"+e),o.length>1&&(u.name+="_"+l),A(u,n),t.assignFinalMaterial(u),s.push(u)}if(1===s.length)return s[0];var f=new Cr;for(l=0,c=s.length;l<c;l++)f.add(s[l]);return f}))},R.prototype.loadCamera=function(e){var t,n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new _n(W.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new Us(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),A(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")},R.prototype.loadSkin=function(e){var t=this.json.skins[e],n={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(n):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return n.inverseBindMatrices=e,n}))},R.prototype.loadAnimation=function(e){for(var t=this.json.animations[e],n=[],i=[],r=[],a=[],o=[],s=0,l=t.channels.length;s<l;s++){var c=t.channels[s],u=t.samplers[c.sampler],h=c.target,d=void 0!==h.node?h.node:h.id,p=void 0!==t.parameters?t.parameters[u.input]:u.input,f=void 0!==t.parameters?t.parameters[u.output]:u.output;n.push(this.getDependency("node",d)),i.push(this.getDependency("accessor",p)),r.push(this.getDependency("accessor",f)),a.push(u),o.push(h)}return Promise.all([Promise.all(n),Promise.all(i),Promise.all(r),Promise.all(a),Promise.all(o)]).then((function(n){for(var i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=[],c=0,u=i.length;c<u;c++){var h=i[c],d=r[c],p=a[c],f=o[c],m=s[c];if(void 0!==h){var g;switch(h.updateMatrix(),h.matrixAutoUpdate=!0,_[m.path]){case _.weights:g=Vo;break;case _.rotation:g=qo;break;case _.position:case _.scale:default:g=Yo}var y=h.name?h.name:h.uuid,b=void 0!==f.interpolation?M[f.interpolation]:2301,x=[];_[m.path]===_.weights?h.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&x.push(e.name?e.name:e.uuid)})):x.push(y);var w=p.array;if(p.normalized){var S;if(w.constructor===Int8Array)S=1/127;else if(w.constructor===Uint8Array)S=1/255;else if(w.constructor==Int16Array)S=1/32767;else{if(w.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");S=1/65535}for(var T=new Float32Array(w.length),E=0,A=w.length;E<A;E++)T[E]=w[E]*S;w=T}for(E=0,A=x.length;E<A;E++){var L=new g(x[E]+"."+_[m.path],d.array,w,b);"CUBICSPLINE"===f.interpolation&&(L.createInterpolant=function(e){return new v(this.times,this.values,this.getValueSize()/3,e)},L.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),l.push(L)}}}return new Jo(t.name?t.name:"animation_"+e,void 0,l)}))},R.prototype.loadNode=function(e){var t,n=this.json,i=this.extensions,r=this,a=n.nodes[e],o=a.name?r.createUniqueName(a.name):"";return(t=[],void 0!==a.mesh&&t.push(r.getDependency("mesh",a.mesh).then((function(e){var t=r._getNodeRef(r.meshCache,a.mesh,e);return void 0!==a.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,n=a.weights.length;t<n;t++)e.morphTargetInfluences[t]=a.weights[t]})),t}))),void 0!==a.camera&&t.push(r.getDependency("camera",a.camera).then((function(e){return r._getNodeRef(r.cameraCache,a.camera,e)}))),r._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),Promise.all(t)).then((function(t){var n;if((n=!0===a.isBone?new ha:t.length>1?new Cr:1===t.length?t[0]:new et)!==t[0])for(var s=0,l=t.length;s<l;s++)n.add(t[s]);if(a.name&&(n.userData.name=a.name,n.name=o),A(n,a),a.extensions&&E(i,n,a),void 0!==a.matrix){var c=new ke;c.fromArray(a.matrix),n.applyMatrix4(c)}else void 0!==a.translation&&n.position.fromArray(a.translation),void 0!==a.rotation&&n.quaternion.fromArray(a.rotation),void 0!==a.scale&&n.scale.fromArray(a.scale);return r.associations.set(n,{type:"nodes",index:e}),n}))},R.prototype.loadScene=function(){function e(t,n,i,r){var a=i.nodes[t];return r.getDependency("node",t).then((function(e){return void 0===a.skin?e:r.getDependency("skin",a.skin).then((function(e){for(var n=[],i=0,a=(t=e).joints.length;i<a;i++)n.push(r.getDependency("node",t.joints[i]));return Promise.all(n)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var i=[],r=[],a=0,o=n.length;a<o;a++){var s=n[a];if(s){i.push(s);var l=new ke;void 0!==t.inverseBindMatrices&&l.fromArray(t.inverseBindMatrices.array,16*a),r.push(l)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}e.bind(new ua(i,r),e.matrixWorld)}})),e}));var t})).then((function(t){n.add(t);var o=[];if(a.children)for(var s=a.children,l=0,c=s.length;l<c;l++){var u=s[l];o.push(e(u,t,i,r))}return Promise.all(o)}))}return function(t){var n=this.json,i=this.extensions,r=this.json.scenes[t],a=new Cr;r.name&&(a.name=this.createUniqueName(r.name)),A(a,r),r.extensions&&E(i,a,r);for(var o=r.nodes||[],s=[],l=0,c=o.length;l<c;l++)s.push(e(o[l],a,n,this));return Promise.all(s).then((function(){return a}))}}(),e}(),cc=Symbol("retainerCount"),uc=Symbol("recentlyUsed"),hc=Symbol("evict"),dc=Symbol("evictionThreshold"),pc=Symbol("cache"),fc=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;Object(h.a)(this,e),this[nc]=new Map,this[ic]=[],this[pc]=t,this[dc]=n}return Object(d.a)(e,[{key:"retainerCount",value:function(e){return this[cc].get(e)||0}},{key:"reset",value:function(){this[cc].clear(),this[uc]=[]}},{key:"retain",value:function(e){this[cc].has(e)||this[cc].set(e,0),this[cc].set(e,this[cc].get(e)+1);var t=this[uc].indexOf(e);-1!==t&&this[uc].splice(t,1),this[uc].unshift(e),this[hc]()}},{key:"release",value:function(e){this[cc].has(e)&&this[cc].set(e,Math.max(this[cc].get(e)-1,0)),this[hc]()}},{key:(nc=cc,ic=uc,hc),value:function(){if(!(this[uc].length<this[dc]))for(var e=this[uc].length-1;e>=this[dc];--e){var t=this[uc][e];0===this[cc].get(t)&&(this[pc].delete(t),this[uc].splice(e,1))}}},{key:"evictionThreshold",set:function(e){this[dc]=e,this[hc]()},get:function(){return this[dc]}},{key:"cache",get:function(){return this[pc]}}]),e}(),mc=new Map,vc=new Map,gc=new tc,yc=Symbol("loader"),bc=Symbol("evictionPolicy"),xc=Symbol("GLTFInstance"),wc=function(e){Object(p.a)(a,e);var t,n,i,r=b(a);function a(e){var t;return Object(h.a)(this,a),(t=r.call(this))[ac]=new lc,t[xc]=e,t[yc].setDRACOLoader(gc),t}return Object(d.a)(a,[{key:"preload",value:(i=Object(u.a)(c.a.mark((function e(t,n){var i,r,a,o,s=arguments;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:function(){},this.dispatchEvent({type:"preload",element:n,src:t}),mc.has(t)||(r=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},i=function(e){var t=e.loaded/e.total;n(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise((function(n,r){t.load(e,n,i,r)}))}(t,this[yc],(function(e){i(.8*e)})),a=this[xc],o=r.then((function(e){return a.prepare(e)})).then((function(e){return i(.9),new a(e)})),mc.set(t,o)),e.next=4,mc.get(t);case 4:vc.set(t,!0),i&&i(1);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"load",value:(n=Object(u.a)(c.a.mark((function e(t,n){var i,r,a,o=this,s=arguments;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:function(){},e.next=3,this.preload(t,n,i);case 3:return e.next=5,mc.get(t);case 5:return r=e.sent,e.next=8,r.clone();case 8:return a=e.sent,e.abrupt("return",(this[bc].retain(t),a.dispose=function(){var e=a.dispose,n=!1;return function(){n||(n=!0,e.apply(a),o[bc].release(t))}}(),a));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:(rc=bc,ac=yc,bc),get:function(){return this.constructor[bc]}}],[{key:"setDRACODecoderLocation",value:function(e){oc=e,gc.setDecoderPath(e)}},{key:"getDRACODecoderLocation",value:function(){return oc}},{key:"clearCache",value:function(){var e=this;mc.forEach((function(t,n){e.delete(n)})),this[bc].reset()}},{key:"has",value:function(e){return mc.has(e)}},{key:"delete",value:(t=Object(u.a)(c.a.mark((function e(t){var n;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.has(t)){e.next=2;break}return e.abrupt("return");case 2:return n=mc.get(t),vc.delete(t),mc.delete(t),e.next=6,n;case 6:e.sent.dispose();case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hasFinishedLoading",value:function(e){return!!vc.get(e)}},{key:"cache",get:function(){return mc}}]),a}(j);wc[rc]=new fc(wc);var _c=Symbol("velocity"),Mc=function(){function e(){Object(h.a)(this,e),this[sc]=0}return Object(d.a)(e,[{key:"update",value:function(e,t,n,i){if(null==e||0===i)return t;if(e===t&&0===this[_c])return t;if(n<0)return e;var r=e-t,a=this[_c]+.02*r,o=r+n*a,s=Math.exp(-.02*n),l=(a-.02*o)*s,c=-.02*(l+a*s);return Math.abs(l)<4000000000000001e-21*Math.abs(i)&&c*r>=0?(this[_c]=0,t):(this[_c]=l,t+o*s)}}]),e}();sc=_c;var Sc=function(e){et.call(this),this.element=e||document.createElement("div"),this.element.style.position="absolute",this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))};Sc.prototype=Object.assign(Object.create(et.prototype),{constructor:Sc,copy:function(e,t){return et.prototype.copy.call(this,e,t),this.element=e.element.cloneNode(!0),this}});var Tc,Ec,Ac=function(){var e,t,n,i,r=this,a=new te,o=new ke,s=new ke,l={objects:new WeakMap},c=document.createElement("div");c.style.overflow="hidden",this.domElement=c,this.getSize=function(){return{width:e,height:t}},this.setSize=function(r,a){n=(e=r)/2,i=(t=a)/2,c.style.width=r+"px",c.style.height=a+"px"};var u,h,d=(u=new te,h=new te,function(e,t){return u.setFromMatrixPosition(e.matrixWorld),h.setFromMatrixPosition(t.matrixWorld),u.distanceToSquared(h)});this.render=function(e,t){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),o.copy(t.matrixWorldInverse),s.multiplyMatrices(t.projectionMatrix,o),function e(t,o,u){if(t instanceof Sc){t.onBeforeRender(r,o,u),a.setFromMatrixPosition(t.matrixWorld),a.applyMatrix4(s);var h=t.element,p="translate(-50%,-50%) translate("+(a.x*n+n)+"px,"+(-a.y*i+i)+"px)";h.style.WebkitTransform=p,h.style.MozTransform=p,h.style.oTransform=p,h.style.transform=p,h.style.display=t.visible&&a.z>=-1&&a.z<=1?"":"none";var f={distanceToCameraSquared:d(u,t)};l.objects.set(t,f),h.parentNode!==c&&c.appendChild(h),t.onAfterRender(r,o,u)}for(var m=0,v=t.children.length;m<v;m++)e(t.children[m],o,u)}(e,e,t),function(e){for(var t=function(e){var t=[];return e.traverse((function(e){e instanceof Sc&&t.push(e)})),t}(e).sort((function(e,t){return l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),n=t.length,i=0,r=t.length;i<r;i++)t[i].element.style.zIndex=n-i}(e)}},Lc=function(e,t){return{type:"number",number:e,unit:t}},kc=function(){var e={};return function(t){var n=t;if(n in e)return e[n];for(var i=[],r=0;t;){if(++r>1e3){t="";break}var a=Rc(t),o=a.nodes[0];if(null==o||0===o.terms.length)break;i.push(o),t=a.remainingInput}return e[n]=i}}(),Rc=function(){var e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,n=/^[\),]/;return function(i){for(var r=[];i.length&&(i=i.trim(),!n.test(i));)if("("===i[0]){var a=Ic(i),o=a.nodes;i=a.remainingInput,r.push({type:"function",name:{type:"ident",value:"calc"},arguments:o})}else if(e.test(i)){var s=Oc(i),l=s.nodes[0];if("("===(i=s.remainingInput)[0]){var c=Ic(i),u=c.nodes,h=c.remainingInput;r.push({type:"function",name:l,arguments:u}),i=h}else r.push(l)}else if(t.test(i))r.push({type:"operator",value:i[0]}),i=i.slice(1);else{var d="#"===i[0]?Pc(i):Cc(i),p=d.nodes,f=d.remainingInput;if(0===p.length)break;r.push(p[0]),i=f}return{nodes:[{type:"expression",terms:r}],remainingInput:i}}}(),Oc=function(){var e=/[^a-z^0-9^_^\-^\u0240-\uffff]/i;return function(t){var n=t.match(e);return{nodes:[{type:"ident",value:null==n?t:t.substr(0,n.index)}],remainingInput:null==n?"":t.substr(n.index)}}}(),Cc=function(){var e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,n=/^(m|mm|cm|rad|deg|[%])$/;return function(i){var r=i.match(e),a=null==r?"0":r[0],o=(i=null==a?i:i.slice(a.length)).match(t),s=null!=o&&""!==o[0]?o[0]:null,l=null==o?i:i.slice(s.length);return null==s||n.test(s)||(s=null),{nodes:[{type:"number",number:parseFloat(a)||0,unit:s}],remainingInput:l}}}(),Pc=function(){var e=/^[a-f0-9]*/i;return function(t){var n=(t=t.slice(1).trim()).match(e);return{nodes:null==n?[]:[{type:"hex",value:n[0]}],remainingInput:null==n?t:t.slice(n[0].length)}}}(),Ic=function(e){var t=[];for(e=e.slice(1).trim();e.length;){var n=Rc(e);if(t.push(n.nodes[0]),","===(e=n.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},Dc=Symbol("visitedTypes"),Nc=function(){function e(t){Object(h.a)(this,e),this[Dc]=t}return Object(d.a)(e,[{key:"walk",value:function(e,t){for(var n=e.slice();n.length;){var i=n.shift();switch(this[Dc].indexOf(i.type)>-1&&t(i),i.type){case"expression":n.unshift.apply(n,Object(s.a)(i.terms));break;case"function":n.unshift.apply(n,[i.name].concat(Object(s.a)(i.arguments)))}}}}]),e}(),Fc=Object.freeze({type:"number",number:0,unit:null}),Uc=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=e.number,i=e.unit;if(isFinite(n)){if("rad"===e.unit||null==e.unit)return e}else n=t,i="rad";return{type:"number",number:("deg"===i&&null!=n?n:0)*Math.PI/180,unit:"rad"}},zc=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e.number,r=e.unit;if(isFinite(i)){if("m"===e.unit)return e}else i=n,r="m";switch(r){default:t=1;break;case"cm":t=.01;break;case"mm":t=.001}return{type:"number",number:t*i,unit:"m"}},jc=function(){var e=function(e){return e},t={rad:e,deg:Uc,m:e,mm:zc,cm:zc};return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fc,i=e.number,r=e.unit;if(isFinite(i)||(i=n.number,r=n.unit),null==r)return e;var a=t[r];return null==a?n:a(e)}}(),Bc=function(e){Object(p.a)(n,e);var t=b(n);function n(e){var i;return Object(h.a)(this,n),(i=t.call(this,document.createElement("div"))).normal=new te(0,1,0),i.initialized=!1,i.referenceCount=1,i.pivot=document.createElement("div"),i.slot=document.createElement("slot"),i.element.classList.add("annotation-wrapper"),i.slot.name=e.name,i.element.appendChild(i.pivot),i.pivot.appendChild(i.slot),i.updatePosition(e.position),i.updateNormal(e.normal),i}return Object(d.a)(n,[{key:"show",value:function(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}},{key:"hide",value:function(){!this.facingCamera&&this.initialized||this.updateVisibility(!1)}},{key:"increment",value:function(){this.referenceCount++}},{key:"decrement",value:function(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}},{key:"updatePosition",value:function(e){if(null!=e)for(var t=kc(e)[0].terms,n=0;n<3;++n)this.position.setComponent(n,jc(t[n]).number)}},{key:"updateNormal",value:function(e){if(null!=e)for(var t=kc(e)[0].terms,n=0;n<3;++n)this.normal.setComponent(n,jc(t[n]).number)}},{key:"orient",value:function(e){this.pivot.style.transform="rotate(".concat(e,"rad)")}},{key:"updateVisibility",value:function(e){e?this.element.classList.remove("hide"):this.element.classList.add("hide"),this.slot.assignedNodes().forEach((function(t){if(t.nodeType===Node.ELEMENT_NODE){var n=t,i=n.dataset.visibilityAttribute;if(null!=i){var r="data-"+i;e?n.setAttribute(r,""):n.removeAttribute(r)}n.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))}})),this.initialized=!0}},{key:"facingCamera",get:function(){return!this.element.classList.contains("hide")}}]),n}(Sc),Hc=function(e,t){var n=0,i=new te;return e.traverse((function(e){var r,a;e.updateWorldMatrix(!1,!1);var o=e.geometry;if(void 0!==o)if(o.isGeometry){var s=o.vertices;for(r=0,a=s.length;r<a;r++)i.copy(s[r]),i.applyMatrix4(e.matrixWorld),n=t(n,i)}else if(o.isBufferGeometry){var l=o.attributes.position;if(void 0!==l)for(r=0,a=l.count;r<a;r++)i.fromBufferAttribute(l,r).applyMatrix4(e.matrixWorld),n=t(n,i)}})),n},Gc=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i){var r;return Object(h.a)(this,n),(r=t.call(this)).shadowMaterial=new To,r.boundingBox=new re,r.size=new te,r.isAnimated=!1,r.needsUpdate=!1,r.intensity=0,r.castShadow=!0,r.frustumCulled=!1,r.floor=new pn(new Cn,r.shadowMaterial),r.floor.rotateX(-Math.PI/2),r.floor.receiveShadow=!0,r.floor.castShadow=!1,r.floor.frustumCulled=!1,r.add(r.floor),r.shadow.camera.up.set(0,0,1),e.add(Object(o.a)(r)),r.target=e,r.setModel(e,i),r}return Object(d.a)(n,[{key:"setModel",value:function(e,t){this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size);var n=this.boundingBox,i=this.size;if(this.isAnimated){var r=2*Math.max(i.x,i.y,i.z);i.y=r,n.expandByVector(i.subScalar(r).multiplyScalar(-.5)),n.max.y=n.min.y+r,i.set(r,r,r)}var a=.001*i.y;this.position.y=n.max.y+a,n.getCenter(this.floor.position),this.setSoftness(t)}},{key:"setSoftness",value:function(e){var t=Math.pow(2,9-3*e);this.setMapSize(t)}},{key:"setMapSize",value:function(e){var t=this.shadow,n=t.camera,i=t.mapSize,r=t.map,a=this.size,o=this.boundingBox;null!=r&&(r.dispose(),this.shadow.map=null),this.isAnimated&&(e*=2);var s=Math.floor(a.x>a.z?e:e*a.x/a.z),l=Math.floor(a.x>a.z?e*a.z/a.x:e);i.set(s,l);var c=2.5*a.x/s,u=2.5*a.z/l;n.left=-o.max.x-c,n.right=-o.min.x+c,n.bottom=o.min.z-u,n.top=o.max.z+u,this.setScaleAndOffset(n.zoom,0),this.shadow.updateMatrices(this),this.floor.scale.set(a.x+2*c,a.z+2*u,1),this.needsUpdate=!0}},{key:"setIntensity",value:function(e){this.shadowMaterial.opacity=e,e>0?(this.visible=!0,this.floor.visible=!0):(this.visible=!1,this.floor.visible=!1)}},{key:"getIntensity",value:function(){return this.shadowMaterial.opacity}},{key:"setRotation",value:function(e){this.shadow.camera.up.set(Math.sin(e),0,Math.cos(e)),this.shadow.updateMatrices(this)}},{key:"setScaleAndOffset",value:function(e,t){var n=this.size.y,i=1/e,r=.001*n;this.floor.position.y=2*r-n+t*i;var a=this.shadow.camera;a.zoom=e,a.near=0,a.far=n*e-t,a.projectionMatrix.makeOrthographic(a.left*e,a.right*e,a.top*e,a.bottom*e,a.near,a.far),a.projectionMatrixInverse.getInverse(a.projectionMatrix)}}]),n}(js),Vc=22.5*Math.PI/180,Wc=Math.sin(Vc),qc=Math.tan(Vc),Xc=Symbol("shadow"),Yc=Symbol("cancelPendingSourceChange"),Jc=Symbol("currentGLTF"),Zc=new te,Kc=new te,Qc=new te,$c=function(e){Object(p.a)(i,e);var t,n=b(i);function i(){var e;return Object(h.a)(this,i),(e=n.call(this))[Tc]=null,e[Ec]=null,e.animationsByName=new Map,e.currentAnimationAction=null,e.animations=[],e.modelContainer=new et,e.animationNames=[],e.boundingBox=new re,e.size=new te,e.idealCameraDistance=0,e.fieldOfViewAspect=0,e.userData={url:null},e.url=null,e.name="Model",e.modelContainer.name="ModelContainer",e.add(e.modelContainer),e.mixer=new wl(e.modelContainer),e}return Object(d.a)(i,[{key:"hasModel",value:function(){return!!this.modelContainer.children.length}},{key:"setObject",value:function(e){this.clear(),this.modelContainer.add(e),this.updateFraming(),this.dispatchEvent({type:"model-load"})}},{key:"setSource",value:(t=Object(u.a)(c.a.mark((function e(t,n,i){var r,a,o,s,l,h,d,p=this;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n&&n!==this.url){e.next=2;break}return e.abrupt("return",void(i&&i(1)));case 2:return null!=this[Yc]&&(this[Yc](),this[Yc]=null),this.url=n,e.prev=3,e.next=6,new Promise(function(){var e=Object(u.a)(c.a.mark((function e(r,a){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return p[Yc]=function(){return a()},e.prev=1,e.t0=r,e.next=5,t[Mp].loader.load(n,t,i);case 5:e.t1=e.sent,(0,e.t0)(e.t1),e.next=12;break;case 9:e.prev=9,e.t2=e.catch(1),a(e.t2);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,n){return e.apply(this,arguments)}}());case 6:r=e.sent,e.next=14;break;case 9:if(e.prev=9,e.t0=e.catch(3),null!=e.t0){e.next=13;break}return e.abrupt("return");case 13:throw e.t0;case 14:this.clear(),this[Jc]=r,null!=r&&this.modelContainer.add(r.scene),a=r.animations,o=new Map,s=[],l=g(a);try{for(l.s();!(h=l.n()).done;)d=h.value,o.set(d.name,d),s.push(d.name)}catch(f){l.e(f)}finally{l.f()}this.animations=a,this.animationsByName=o,this.animationNames=s,this.userData.url=n,this.updateFraming(),this.dispatchEvent({type:"model-load",url:n});case 19:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e,n,i){return t.apply(this,arguments)})},{key:"playAnimation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.animations;if(null!=n&&0!==n.length){var i=null;null!=e&&(i=this.animationsByName.get(e)),null==i&&(i=n[0]);try{var r=this.currentAnimationAction;this.currentAnimationAction=this.mixer.clipAction(i,this).play(),this.currentAnimationAction.enabled=!0,null!=r&&this.currentAnimationAction!==r&&this.currentAnimationAction.crossFadeFrom(r,t,!1)}catch(e){console.error(e)}}else console.warn("Cannot play animation (model does not have any animations)")}},{key:"stopAnimation",value:function(){null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction.reset(),this.currentAnimationAction=null),this.mixer.stopAllAction()}},{key:"updateAnimation",value:function(e){this.mixer.update(e)}},{key:"clear",value:function(){this.url=null,this.userData={url:null};var e=this[Jc];if(null!=e){var t,n=g(this.modelContainer.children);try{for(n.s();!(t=n.n()).done;){var i=t.value;this.modelContainer.remove(i)}}catch(r){n.e(r)}finally{n.f()}e.dispose(),this[Jc]=null}null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}},{key:"updateFraming",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.remove(this.modelContainer),null==t&&(this.boundingBox.setFromObject(this.modelContainer),this.boundingBox.getSize(this.size),t=this.boundingBox.getCenter(new te));var n=Math.sqrt(Hc(this.modelContainer,(function(e,n){return Math.max(e,t.distanceToSquared(n))})));this.idealCameraDistance=n/Wc,this.fieldOfViewAspect=Hc(this.modelContainer,(function(n,i){i.sub(t);var r=Math.sqrt(i.x*i.x+i.z*i.z);return Math.max(n,r/(e.idealCameraDistance-Math.abs(i.y)))}))/qc,this.add(this.modelContainer)}},{key:"setShadowIntensity",value:function(e,t){var n=this[Xc];null!=n?(n.setIntensity(e),n.setModel(this,t)):e>0&&((n=new Gc(this,t)).setIntensity(e),this[Xc]=n)}},{key:"setShadowSoftness",value:function(e){var t=this[Xc];null!=t&&t.setSoftness(e)}},{key:"setShadowRotation",value:function(e){var t=this[Xc];null!=t&&t.setRotation(e)}},{key:"updateShadow",value:function(){var e=this[Xc];if(null==e)return!1;var t=e.needsUpdate;return e.needsUpdate=!1,t}},{key:"setShadowScaleAndOffset",value:function(e,t){var n=this[Xc];null!=n&&n.setScaleAndOffset(e,t)}},{key:"addHotspot",value:function(e){this.add(e)}},{key:"removeHotspot",value:function(e){this.remove(e)}},{key:"forHotspots",value:function(e){for(var t=this.children,n=0,i=t.length;n<i;n++){var r=t[n];r instanceof Bc&&e(r)}}},{key:"updateHotspots",value:function(e){var t=this;this.forHotspots((function(n){Zc.copy(e),Kc.setFromMatrixPosition(n.matrixWorld),Zc.sub(Kc),Qc.copy(n.normal).transformDirection(t.matrixWorld),Zc.dot(Qc)<0?n.hide():n.show()}))}},{key:"orientHotspots",value:function(e){this.forHotspots((function(t){t.orient(e)}))}},{key:"setHotspotsVisibility",value:function(e){this.forHotspots((function(t){t.visible=e}))}},{key:"currentGLTF",get:function(){return this[Jc]}},{key:"animationTime",set:function(e){this.mixer.setTime(e)},get:function(){return null!=this.currentAnimationAction?this.currentAnimationAction.time:0}},{key:"hasActiveAnimation",get:function(){return null!=this.currentAnimationAction}}]),i}(et);Tc=Xc,Ec=Jc;var eu,tu=Math.tan(22.5*Math.PI/180),nu=new Tl,iu=new te,ru=function(e){Object(p.a)(i,e);var t,n=b(i);function i(e){var t,r=e.canvas,a=e.element,o=e.width,s=e.height;return Object(h.a)(this,i),(t=n.call(this)).aspect=1,t.shadowIntensity=0,t.shadowSoftness=1,t.width=1,t.height=1,t.isDirty=!1,t.context=null,t.exposure=1,t.canScale=!0,t.framedFieldOfView=45,t.camera=new _n(45,1,.1,100),t.goalTarget=new te,t.targetDamperX=new Mc,t.targetDamperY=new Mc,t.targetDamperZ=new Mc,t.name="ModelScene",t.element=a,t.canvas=r,t.model=new $c,t.camera=new _n(45,1,.1,100),t.camera.name="MainCamera",t.activeCamera=t.camera,t.add(t.model),t.setSize(o,s),t.model.addEventListener("model-load",(function(e){return t.onModelLoad(e)})),t}return Object(d.a)(i,[{key:"createContext",value:function(){this.context=this.canvas.getContext("2d")}},{key:"setModelSource",value:(t=Object(u.a)(c.a.mark((function e(t,n){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.model.setSource(this.element,t,n);case 3:e.next=8;break;case 5:throw e.prev=5,e.t0=e.catch(0),new Error("Could not set model source to '".concat(t,"': ").concat(e.t0.message));case 8:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(e,n){return t.apply(this,arguments)})},{key:"setSize",value:function(e,t){this.width===e&&this.height===t||(this.width=Math.max(e,1),this.height=Math.max(t,1),this.aspect=this.width/this.height,this.frameModel(),this.isDirty=!0)}},{key:"frameModel",value:function(){var e=tu*Math.max(1,this.model.fieldOfViewAspect/this.aspect);this.framedFieldOfView=2*Math.atan(e)*180/Math.PI}},{key:"getSize",value:function(){return{width:this.width,height:this.height}}},{key:"getCamera",value:function(){return this.activeCamera}},{key:"setCamera",value:function(e){this.activeCamera=e}},{key:"onModelLoad",value:function(e){this.frameModel(),this.setShadowIntensity(this.shadowIntensity),this.isDirty=!0,this.dispatchEvent({type:"model-load",url:e.url})}},{key:"setTarget",value:function(e,t,n){this.goalTarget.set(-e,-t,-n)}},{key:"getTarget",value:function(){return iu.copy(this.goalTarget).multiplyScalar(-1)}},{key:"jumpToGoal",value:function(){this.updateTarget(1e4)}},{key:"updateTarget",value:function(e){var t=this.goalTarget,n=this.model.position;if(!t.equals(n)){var i=this.model.idealCameraDistance,r=n.x,a=n.y,o=n.z;r=this.targetDamperX.update(r,t.x,e,i),a=this.targetDamperY.update(a,t.y,e,i),o=this.targetDamperZ.update(o,t.z,e,i),this.model.position.set(r,a,o),this.model.updateMatrixWorld(),this.model.setShadowRotation(this.yaw),this.isDirty=!0}}},{key:"pointTowards",value:function(e,t){var n=this.position,i=n.x,r=n.z;this.yaw=Math.atan2(e-i,t-r)}},{key:"setShadowIntensity",value:function(e){e=Math.max(e,0),this.shadowIntensity=e,this.model.hasModel()&&this.model.setShadowIntensity(e,this.shadowSoftness)}},{key:"setShadowSoftness",value:function(e){this.shadowSoftness=e,this.model.setShadowSoftness(e)}},{key:"positionAndNormalFromPoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this;nu.setFromCamera(e,this.getCamera());var n=nu.intersectObject(t,!0);if(0===n.length)return null;var i=n[0];return null==i.face?null:(i.face.normal.applyNormalMatrix((new X).getNormalMatrix(i.object.matrixWorld)),{position:i.point,normal:i.face.normal})}},{key:"yaw",set:function(e){this.rotation.y=e,this.model.setShadowRotation(e),this.isDirty=!0},get:function(){return this.rotation.y}}]),i}(Ur),au=((eu=new Eo({uniforms:{roughnessMap:{value:null},normalMap:{value:null},texelSize:{value:new q(1,1)}},vertexShader:"\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tattribute vec3 position;\n\t\t\tattribute vec2 uv;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main() {\n\n\t\t\t\tvUv = uv;\n\n\t\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t\t}\n\t\t",fragmentShader:"\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tuniform sampler2D roughnessMap;\n\t\t\tuniform sampler2D normalMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec4 envMapTexelToLinear( vec4 a ) { return a; }\n\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tfloat roughnessToVariance( float roughness ) {\n\n\t\t\t\tfloat variance = 0.0;\n\n\t\t\t\tif ( roughness >= r1 ) {\n\n\t\t\t\t\tvariance = ( r0 - roughness ) * ( v1 - v0 ) / ( r0 - r1 ) + v0;\n\n\t\t\t\t} else if ( roughness >= r4 ) {\n\n\t\t\t\t\tvariance = ( r1 - roughness ) * ( v4 - v1 ) / ( r1 - r4 ) + v1;\n\n\t\t\t\t} else if ( roughness >= r5 ) {\n\n\t\t\t\t\tvariance = ( r4 - roughness ) * ( v5 - v4 ) / ( r4 - r5 ) + v4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tfloat roughness2 = roughness * roughness;\n\n\t\t\t\t\tvariance = 1.79 * roughness2 * roughness2;\n\n\t\t\t\t}\n\n\t\t\t\treturn variance;\n\n\t\t\t}\n\n\t\t\tfloat varianceToRoughness( float variance ) {\n\n\t\t\t\tfloat roughness = 0.0;\n\n\t\t\t\tif ( variance >= v1 ) {\n\n\t\t\t\t\troughness = ( v0 - variance ) * ( r1 - r0 ) / ( v0 - v1 ) + r0;\n\n\t\t\t\t} else if ( variance >= v4 ) {\n\n\t\t\t\t\troughness = ( v1 - variance ) * ( r4 - r1 ) / ( v1 - v4 ) + r1;\n\n\t\t\t\t} else if ( variance >= v5 ) {\n\n\t\t\t\t\troughness = ( v4 - variance ) * ( r5 - r4 ) / ( v4 - v5 ) + r4;\n\n\t\t\t\t} else {\n\n\t\t\t\t\troughness = pow( 0.559 * variance, 0.25 ); // 0.559 = 1.0 / 1.79\n\n\t\t\t\t}\n\n\t\t\t\treturn roughness;\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = texture2D( roughnessMap, vUv, - 1.0 );\n\n\t\t\t\tif ( texelSize.x == 0.0 ) return;\n\n\t\t\t\tfloat roughness = gl_FragColor.g;\n\n\t\t\t\tfloat variance = roughnessToVariance( roughness );\n\n\t\t\t\tvec3 avgNormal;\n\n\t\t\t\tfor ( float x = - 1.0; x < 2.0; x += 2.0 ) {\n\n\t\t\t\t\tfor ( float y = - 1.0; y < 2.0; y += 2.0 ) {\n\n\t\t\t\t\t\tvec2 uv = vUv + vec2( x, y ) * 0.25 * texelSize;\n\n\t\t\t\t\t\tavgNormal += normalize( texture2D( normalMap, uv, - 1.0 ).xyz - 0.5 );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tvariance += 1.0 - 0.25 * length( avgNormal );\n\n\t\t\t\tgl_FragColor.g = varianceToRoughness( variance );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})).type="RoughnessMipmapper",eu),ou=new pn(new Cn(2,2),au),su=new Us(0,1,0,1,0,1),lu=null,cu=null;function uu(e){(cu=e).compile(ou,su)}uu.prototype={constructor:uu,generateMipmaps:function(e){if("roughnessMap"in e!=0){var t=e.roughnessMap,n=e.normalMap;if(null!==t&&null!==n&&t.generateMipmaps&&!e.userData.roughnessUpdated){e.userData.roughnessUpdated=!0;var i=Math.max(t.image.width,n.image.width),r=Math.max(t.image.height,n.image.height);if(W.isPowerOfTwo(i)&&W.isPowerOfTwo(r)){var a=cu.getRenderTarget(),o=cu.autoClear;if(cu.autoClear=!1,null!==lu&&lu.width===i&&lu.height===r||(null!==lu&&lu.dispose(),(lu=new Q(i,r,{depthBuffer:!1})).scissorTest=!0),i!==t.image.width||r!==t.image.height){var s=new Q(i,r,{wrapS:t.wrapS,wrapT:t.wrapT,magFilter:t.magFilter,minFilter:t.minFilter,depthBuffer:!1});s.texture.generateMipmaps=!0,cu.setRenderTarget(s),e.roughnessMap=s.texture,e.metalnessMap==t&&(e.metalnessMap=e.roughnessMap),e.aoMap==t&&(e.aoMap=e.roughnessMap)}au.uniforms.roughnessMap.value=t,au.uniforms.normalMap.value=n;for(var l=new q(0,0),c=au.uniforms.texelSize.value,u=0;i>=1&&r>=1;++u,i/=2,r/=2)c.set(1/i,1/r),0==u&&c.set(0,0),lu.viewport.set(l.x,l.y,i,r),lu.scissor.set(l.x,l.y,i,r),cu.setRenderTarget(lu),cu.render(ou,su),cu.copyFramebufferToTexture(l,e.roughnessMap,u),au.uniforms.roughnessMap.value=e.roughnessMap;t!==e.roughnessMap&&t.dispose(),cu.setRenderTarget(a),cu.autoClear=o}}}},dispose:function(){au.dispose(),ou.geometry.dispose(),null!=lu&&lu.dispose()}};var hu,du,pu,fu,mu,vu,gu,yu,bu,xu,wu,_u,Mu,Su,Tu,Eu,Au,Lu,ku,Ru,Ou,Cu,Pu,Iu,Du,Nu,Fu,Uu,zu,ju,Bu,Hu,Gu,Vu,Wu,qu,Xu,Yu=function(e){return e&&"null"!==e?Zu(e):null},Ju=function(){if(!k){var e=[];throw T||e.push("WebXR Device API"),E||e.push("WebXR Hit Test API"),new Error("The following APIs are required for AR, but are missing in this browser: "+e.join(", "))}},Zu=function(e){return new URL(e,window.location.toString()).toString()},Ku=function(e,t){var n=null;return function(){for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];null!=n&&self.clearTimeout(n),n=self.setTimeout((function(){n=null,e.apply(void 0,r)}),t)}},Qu=function(e,t,n){return Math.max(t,Math.min(n,e))},$u=function(){var e=function(){var e,t=g(null!=document.head?Array.from(document.head.querySelectorAll("meta")):[]);try{for(t.s();!(e=t.n()).done;){if("viewport"===e.value.name)return!0}}catch(n){t.e(n)}finally{t.f()}return!1}();return e||console.warn('No <meta name="viewport"> detected; <model-viewer> will cap pixel density at 1.'),function(){return e?window.devicePixelRatio:1}}(),eh=function(){var e=new RegExp("[?&]model-viewer-debug-mode(&|$)");return function(){return self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)}}(),th=Math.PI/24,nh=new q,ih=function(e,t,n){for(var i=t>0?n>0?0:-Math.PI/2:n>0?Math.PI/2:Math.PI,r=0;r<=12;++r)e.push(t+.17*Math.cos(i),n+.17*Math.sin(i),0,t+.2*Math.cos(i),n+.2*Math.sin(i),0),i+=th},rh=function(e){Object(p.a)(n,e);var t=b(n);function n(e){var i;Object(h.a)(this,n);var r=new Yt,a=[],s=[],l=e.size,c=e.boundingBox,u=l.x/2,d=l.z/2;ih(s,u,d),ih(s,-u,d),ih(s,-u,-d),ih(s,u,-d);for(var p=s.length/3,f=0;f<p-2;f+=2)a.push(f,f+1,f+3,f,f+3,f+2);var m=p-2;a.push(m,m+1,1,m,1,0),r.setAttribute("position",new Ft(s,3)),r.setIndex(a);var v=(i=t.call(this,r)).material;return v.side=2,v.transparent=!0,v.opacity=0,i.goalOpacity=0,i.opacityDamper=new Mc,i.hitPlane=new pn(new Cn(l.x+.4,l.z+.4)),i.hitPlane.visible=!1,i.add(i.hitPlane),i.rotateX(-Math.PI/2),c.getCenter(i.position),i.shadowHeight=c.min.y,i.position.y=i.shadowHeight,e.add(Object(o.a)(i)),i}return Object(d.a)(n,[{key:"getHit",value:function(e,t,n){nh.set(t,-n),this.hitPlane.visible=!0;var i=e.positionAndNormalFromPoint(nh,this.hitPlane);return this.hitPlane.visible=!1,null==i?null:i.position}},{key:"updateOpacity",value:function(e){var t=this.material;t.opacity=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1),this.visible=t.opacity>0}},{key:"dispose",value:function(){var e=this.hitPlane,t=e.geometry,n=e.material;t.dispose(),n.dispose(),this.geometry.dispose(),this.material.dispose()}},{key:"offsetHeight",set:function(e){this.position.y=this.shadowHeight+e},get:function(){return this.position.y-this.shadowHeight}},{key:"show",set:function(e){this.goalOpacity=e?.75:0}}]),n}(pn),ah="not-presenting",oh=Symbol("presentedScene"),sh=Symbol("placementBox"),lh=Symbol("lastTick"),ch=Symbol("turntableRotation"),uh=Symbol("oldShadowIntensity"),hh=Symbol("oldBackground"),dh=Symbol("rafId"),ph=Symbol("currentSession"),fh=Symbol("tick"),mh=Symbol("refSpace"),vh=Symbol("viewerRefSpace"),gh=Symbol("frame"),yh=Symbol("initialized"),bh=Symbol("initialModelToWorld"),xh=Symbol("placementComplete"),wh=Symbol("hitTestSource"),_h=Symbol("transiertHitTestSource"),Mh=Symbol("inputSource"),Sh=Symbol("isTranslating"),Th=Symbol("isRotating"),Eh=Symbol("isScaling"),Ah=Symbol("lastDragPosition"),Lh=Symbol("lastScalar"),kh=Symbol("goalPosition"),Rh=Symbol("goalYaw"),Oh=Symbol("goalScale"),Ch=Symbol("xDamper"),Ph=Symbol("yDamper"),Ih=Symbol("zDamper"),Dh=Symbol("yawDamper"),Nh=Symbol("scaleDamper"),Fh=Symbol("damperRate"),Uh=Symbol("resolveCleanup"),zh=Symbol("exitWebXRButtonContainer"),jh=Symbol("onWebXRFrame"),Bh=Symbol("postSessionCleanup"),Hh=Symbol("updateCamera"),Gh=Symbol("placeInitially"),Vh=Symbol("getHitPoint"),Wh=Symbol("onSelectStart"),qh=Symbol("onSelect"),Xh=Symbol("onUpdateScene"),Yh=Symbol("fingerSeparation"),Jh=Symbol("processInput"),Zh=Symbol("moveScene"),Kh=Symbol("onExitWebXRButtonContainerClick"),Qh=new te,$h=new ke,ed=new te,td=function(e){Object(p.a)(o,e);var t,n,i,r,a=b(o);function o(e){var t;return Object(h.a)(this,o),(t=a.call(this)).renderer=e,t.camera=new _n,t[hu]=null,t[du]=null,t[pu]=null,t[fu]=null,t[mu]=null,t[vu]=null,t[gu]=null,t[yu]=null,t[bu]=null,t[xu]=null,t[wu]=null,t[_u]=null,t[Mu]=null,t[Su]=null,t[Tu]=null,t[Eu]=null,t[Au]=!1,t[Lu]=new ke,t[ku]=!1,t[Ru]=!1,t[Ou]=!1,t[Cu]=!1,t[Pu]=new te,t[Iu]=0,t[Du]=new te,t[Nu]=0,t[Fu]=1,t[Uu]=new Mc,t[zu]=new Mc,t[ju]=new Mc,t[Bu]=new Mc,t[Hu]=new Mc,t[Gu]=1,t[Vu]=function(){return t.stopPresenting()},t[Wu]=function(){null!=t[sh]&&t.isPresenting&&(t[sh].dispose(),t[sh]=new rh(t[oh].model))},t[qu]=function(e){var n=t[_h];if(null!=n){var i=t[gh].getHitTestResultsForTransientInput(n),r=t[oh],a=t[sh];if(1===i.length){t[Mh]=e.inputSource;var o=t[Mh].gamepad.axes,s=a.getHit(t[oh],o[0],o[1]);a.show=!0,null!=s?(t[Sh]=!0,t[Ah].copy(s)):(t[Th]=!0,t[Lh]=o[0])}else 2===i.length&&r.canScale&&(a.show=!0,t[Eh]=!0,t[Lh]=t[Yh](i)/r.scale.x)}},t[Xu]=function(){t[Sh]=!1,t[Th]=!1,t[Eh]=!1,t[Mh]=null,t[kh].y+=t[sh].offsetHeight*t[oh].scale.x,t[sh].show=!1},t.threeRenderer=e.threeRenderer,t.camera.matrixAutoUpdate=!1,t}return Object(d.a)(o,[{key:"resolveARSession",value:(r=Object(u.a)(c.a.mark((function e(t){var n,i,r,a,o,s,l,u;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ju(),e.next=3,navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay"],domOverlay:{root:t.element.shadowRoot.querySelector("div.default")}});case 3:return n=e.sent,i=this.threeRenderer.context,e.next=7,i.makeXRCompatible();case 7:return n.updateRenderState({baseLayer:new XRWebGLLayer(n,i,{alpha:!0})}),r=new Promise((function(e,t){n.requestAnimationFrame((function(){return e()}))})),e.next=11,r;case 11:return t.element[_p](window.screen),a=n.renderState.baseLayer,o=a.framebuffer,s=a.framebufferWidth,l=a.framebufferHeight,this.threeRenderer.setFramebuffer(o),this.threeRenderer.setPixelRatio(1),this.threeRenderer.setSize(s,l,!1),u=t.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button"),e.abrupt("return",(u.classList.add("enabled"),u.addEventListener("click",this[Kh]),this[zh]=u,n));case 16:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"supportsPresentation",value:(i=Object(u.a)(c.a.mark((function e(){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,Ju(),e.next=4,navigator.xr.isSessionSupported("immersive-ar");case 4:return e.abrupt("return",e.sent);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),function(){return i.apply(this,arguments)})},{key:"present",value:(n=Object(u.a)(c.a.mark((function e(t){var n,i,r,a,o=this;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isPresenting&&console.warn("Cannot present while a model is already presenting"),n=new Promise((function(e,t){requestAnimationFrame((function(){return e()}))})),t.model.setHotspotsVisibility(!1),t.isDirty=!0,e.next=6,n;case 6:return this[oh]=t,e.next=9,this.resolveARSession(t);case 9:return(i=e.sent).addEventListener("end",(function(){o[Bh]()}),{once:!0}),e.next=13,i.requestReferenceSpace("local");case 13:return this[mh]=e.sent,e.next=16,i.requestReferenceSpace("viewer");case 16:this[vh]=e.sent,t.setCamera(this.camera),this[yh]=!1,this[Fh]=.4,this[ch]=t.yaw,t.yaw=0,this[Rh]=0,this[Oh]=1,this[hh]=t.background,t.background=null,this[uh]=t.shadowIntensity,t.setShadowIntensity(0),t.addEventListener("model-load",this[Xh]),r=20*Math.PI/180,a=new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(r),z:-Math.cos(r)}),i.requestHitTestSource({space:this[vh],offsetRay:a}).then((function(e){o[wh]=e})),this[ph]=i,this[sh]=new rh(t.model),this[xh]=!1,this[lh]=performance.now(),this[fh]();case 31:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"stopPresenting",value:(t=Object(u.a)(c.a.mark((function e(){var t,n=this;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isPresenting){e.next=2;break}return e.abrupt("return");case 2:return t=new Promise((function(e){n[Uh]=e})),e.prev=3,e.next=6,this[ph].end();case 6:return e.next=8,t;case 8:e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),console.warn("Error while trying to end AR session"),console.warn(e.t0),this[Bh]();case 13:case"end":return e.stop()}}),e,this,[[3,10]])}))),function(){return t.apply(this,arguments)})},{key:(hu=sh,du=lh,pu=ch,fu=uh,mu=hh,vu=dh,gu=ph,yu=mh,bu=vh,xu=gh,wu=wh,_u=_h,Mu=Mh,Su=oh,Tu=Uh,Eu=zh,Au=yh,Lu=bh,ku=xh,Ru=Sh,Ou=Th,Cu=Eh,Pu=Ah,Iu=Lh,Du=kh,Nu=Rh,Fu=Oh,Uu=Ch,zu=Ph,ju=Ih,Bu=Dh,Hu=Nh,Gu=Fh,Vu=Kh,Bh),value:function(){this.threeRenderer.setFramebuffer(null);var e=this[ph];null!=e&&(e.removeEventListener("selectstart",this[Wh]),e.removeEventListener("selectend",this[qh]),e.cancelAnimationFrame(this[dh]),this[ph]=null);var t=this[oh];if(null!=t){var n=t.model,i=t.element;t.setCamera(t.camera),n.remove(this[sh]),t.position.set(0,0,0),t.scale.set(1,1,1),n.setShadowScaleAndOffset(1,0);var r=this[ch];null!=r&&(t.yaw=r);var a=this[uh];null!=a&&t.setShadowIntensity(a);var o=this[hh];null!=o&&(t.background=o),t.removeEventListener("model-load",this[Xh]),n.orientHotspots(0),i.requestUpdate("cameraTarget"),i[_p](i.getBoundingClientRect())}this.renderer.height=0;var s=this[zh];null!=s&&(s.classList.remove("enabled"),s.removeEventListener("click",this[Kh]),this[zh]=null);var l=this[_h];null!=l&&(l.cancel(),this[_h]=null);var c=this[wh];null!=c&&(c.cancel(),this[wh]=null),null!=this[sh]&&(this[sh].dispose(),this[sh]=null),this[lh]=null,this[ch]=null,this[uh]=null,this[hh]=null,this[dh]=null,this[mh]=null,this[oh]=null,this[vh]=null,this[gh]=null,this[Mh]=null,null!=this[Uh]&&this[Uh](),this.dispatchEvent({type:"status",status:ah})}},{key:"updateTarget",value:function(){var e=this[oh];if(null!=e){var t=e.getTarget();e.setTarget(t.x,e.model.boundingBox.min.y,t.z)}}},{key:(Wu=Xh,Hh),value:function(e){var t=this.camera,n=t.matrix;if(n.fromArray(e.transform.matrix),t.updateMatrixWorld(!0),t.position.setFromMatrixPosition(n),null!=this[wh]){var i=this[oh],r=i.position,a=i.model.idealCameraDistance;t.getWorldDirection(r),r.multiplyScalar(a),r.add(t.position)}if(!this[yh]){t.projectionMatrix.fromArray(e.projectionMatrix),t.projectionMatrixInverse.getInverse(t.projectionMatrix);var o=t.position,s=o.x,l=o.z,c=this[oh];c.pointTowards(s,l),c.model.updateMatrixWorld(!0),this[Rh]=c.yaw,this[bh].copy(c.model.matrixWorld),c.model.setHotspotsVisibility(!0),this[yh]=!0,this.dispatchEvent({type:"status",status:"session-started"})}if(e.requestViewportScale&&e.recommendedViewportScale){var u=e.recommendedViewportScale;e.requestViewportScale(Math.max(u,.25))}var h=this[ph].renderState.baseLayer.getViewport(e);this.threeRenderer.setViewport(h.x,h.y,h.width,h.height),this[oh].model.orientHotspots(Math.atan2(n.elements[1],n.elements[5]))}},{key:Gh,value:function(e){var t=this,n=this[wh];if(null!=n){var i=e.getHitTestResults(n);if(0!=i.length){var r=i[0],a=this[Vh](r);if(null!=a){this.placeModel(a),n.cancel(),this[wh]=null;var o=e.session;o.addEventListener("selectstart",this[Wh]),o.addEventListener("selectend",this[qh]),o.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((function(e){t[_h]=e}))}}}}},{key:Vh,value:function(e){var t=e.getPose(this[mh]);if(null==t)return null;var n=$h.fromArray(t.transform.matrix);return n.elements[5]>.75?ed.setFromMatrixPosition(n):null}},{key:"placeModel",value:function(e){var t=this[oh],n=t.model,i=n.boundingBox,r=i.min,a=i.max;this[sh].show=!0;var o=this[kh];o.copy(e);var s=e.y,l=this.camera.position.clone(),c=e.clone().sub(l).normalize();l.sub(c.multiplyScalar(n.idealCameraDistance));var u=new Le(l,c.normalize()),h=this[bh],d=(new te).setFromMatrixPosition(h).add(e);h.setPosition(d);var p=(new ke).getInverse(h);u.applyMatrix4(p),a.y+=10,u.intersectBox(n.boundingBox,d),a.y-=10,null!=d&&(d.applyMatrix4(h),o.add(e).sub(d));var f=t.getTarget();t.setTarget(f.x,r.y,f.z),o.y=s,this.dispatchEvent({type:"status",status:"object-placed"})}},{key:(qu=Wh,Xu=qh,Yh),value:function(e){var t=e[0].inputSource.gamepad.axes,n=e[1].inputSource.gamepad.axes,i=n[0]-t[0],r=n[1]-t[1];return Math.sqrt(i*i+r*r)}},{key:Jh,value:function(e){var t=this,n=this[_h];if(null!=n&&(this[Sh]||this[Eh]||this[Th])){var i=e.getHitTestResultsForTransientInput(n),r=this[oh],a=r.scale.x;if(this[Eh])if(i.length<2)this[Eh]=!1;else{var o=this[Yh](i)/this[Lh];this[Oh]=o<1.2&&o>.8333333333333334?1:o}else{if(2===i.length&&r.canScale)return this[Sh]=!1,this[Th]=!1,this[Eh]=!0,void(this[Lh]=this[Yh](i)/a);if(this[Th]){var s=this[Mh].gamepad.axes[0];this[Rh]+=1.5*(s-this[Lh]),this[Lh]=s}else this[Sh]&&i.forEach((function(e){if(!(e.inputSource!==t[Mh]||e.results.length<1)){var n=t[Vh](e.results[0]);if(null!=n){t[kh].sub(t[Ah]);var i=n.y-t[Ah].y;if(i<0){t[sh].offsetHeight=i/a,t[oh].model.setShadowScaleAndOffset(a,i);var r=Qh.copy(t.camera.position),o=-i/(r.y-n.y);r.multiplyScalar(o),n.multiplyScalar(1-o).add(r)}t[kh].add(n),t[Ah].copy(n)}}}))}}}},{key:Zh,value:function(e){var t=this[oh],n=t.model,i=t.position,r=t.yaw,a=n.idealCameraDistance,o=this[kh],s=t.scale.x,l=this[sh];if(null==this[wh]&&(!o.equals(i)||this[Oh]!==s)){var c=i.x,u=i.y,h=i.z;e*=this[Fh],c=this[Ch].update(c,o.x,e,a),u=this[Ph].update(u,o.y,e,a),h=this[Ih].update(h,o.z,e,a),i.set(c,u,h);var d=this[Nh].update(s,this[Oh],e,1);if(t.scale.set(d,d,d),!this[Sh]){var p=o.y-u;this[xh]?(l.offsetHeight=p/d,n.setShadowScaleAndOffset(d,p)):0===p&&(this[xh]=!0,l.show=!1,t.setShadowIntensity(.3),this[Fh]=1)}}l.updateOpacity(e),t.updateTarget(e),t.updateMatrixWorld(!0),t.yaw=this[Dh].update(r,this[Rh],e,Math.PI)}},{key:fh,value:function(){var e=this;this[dh]=this[ph].requestAnimationFrame((function(t,n){return e[jh](t,n)}))}},{key:jh,value:function(e,t){this[gh]=t;var n=t.getViewerPose(this[mh]);this[fh]();var i=this[oh];if(null!=n&&null!=i){var r,a=!0,o=g(n.views);try{for(o.s();!(r=o.n()).done;){var s=r.value;if(this[Hh](s),a){this[Gh](t),this[Jh](t);var l=e-this[lh];this[Zh](l),this.renderer.preRender(i,e,l),this[lh]=e}this.threeRenderer.render(i,this.camera),a=!1}}catch(c){o.e(c)}finally{o.f()}}}},{key:"presentedScene",get:function(){return this[oh]}},{key:"isPresenting",get:function(){return null!=this[oh]}}]),o}(j),nd=function(){function e(t){Object(h.a)(this,e),t.threeRenderer.debug={checkShaderErrors:!0},Promise.resolve().then((function(){self.dispatchEvent(new CustomEvent("model-viewer-renderer-debug",{detail:{renderer:t,THREE:{ShaderMaterial:xn,Texture:Z,Mesh:pn,Scene:Ur,PlaneBufferGeometry:Cn,OrthographicCamera:Us,WebGLRenderTarget:Q}}}))}))}return Object(d.a)(e,[{key:"addScene",value:function(e){self.dispatchEvent(new CustomEvent("model-viewer-scene-added-debug",{detail:{scene:e}}))}},{key:"removeScene",value:function(e){self.dispatchEvent(new CustomEvent("model-viewer-scene-removed-debug",{detail:{scene:e}}))}}]),e}(),id=Symbol("threeGLTF"),rd=Symbol("gltf"),ad=Symbol("gltfElementMap"),od=Symbol("threeObjectMap"),sd=Symbol("parallelTraverseThreeScene"),ld=Symbol("correlateOriginalThreeGLTF"),cd=Symbol("correlateCloneThreeGLTF"),ud=function(){function e(t,n,i,r){Object(h.a)(this,e),this[id]=t,this[rd]=n,this[ad]=r,this[od]=i}return Object(d.a)(e,[{key:"threeGLTF",get:function(){return this[id]}},{key:"gltf",get:function(){return this[rd]}},{key:"gltfElementMap",get:function(){return this[ad]}},{key:"threeObjectMap",get:function(){return this[od]}}],[{key:"from",value:function(e,t){return null!=t?this[cd](e,t):this[ld](e)}},{key:ld,value:function(t){var n=t.parser.json,i=t.parser.associations,r=new Map;return i.forEach((function(e,t){if(null!=e){var i=e.type,a=e.index,o=(n[i]||[])[a];if(null!=o){var s=r.get(o);null==s&&(s=new Set,r.set(o,s)),s.add(t)}}})),new e(t,n,i,r)}},{key:cd,value:function(t,n){for(var i=n.threeGLTF,r=n.gltf,a=JSON.parse(JSON.stringify(r)),o=new Map,s=new Map,l=0;l<i.scenes.length;l++)this[sd](i.scenes[l],t.scenes[l],(function(e,t){var i=n.threeObjectMap.get(e);if(null!=i){var r=i.type,l=i.index,c=a[r][l];o.set(t,{type:r,index:l});var u=s.get(c)||new Set;u.add(t),s.set(c,u)}}));return new e(t,a,o,s)}},{key:sd,value:function(e,t,n){!function e(t,i){if(n(t,i),t.isObject3D){if(t.isMesh)if(Array.isArray(t.material))for(var r=0;r<t.material.length;++r)e(t.material[r],i.material[r]);else e(t.material,i.material);for(var a=0;a<t.children.length;++a)e(t.children[a],i.children[a])}}(e,t)}}]),e}();new te,new ee,new te,new ke,new ke,new ke,new te,new te,new te,new te,new q,new q;var hd=function(e){var t=new Map,n=new Map,i=e.clone();return function e(t,n,i){i(t,n);for(var r=0;r<t.children.length;r++)e(t.children[r],n.children[r],i)}(e,i,(function(e,i){t.set(i,e),n.set(e,i)})),i.traverse((function(e){if(e.isSkinnedMesh){var i=e,r=t.get(e),a=r.skeleton.bones;i.skeleton=r.skeleton.clone(),i.bindMatrix.copy(r.bindMatrix),i.skeleton.bones=a.map((function(e){return n.get(e)})),i.bind(i.skeleton,i.bindMatrix)}})),i};var dd=Symbol("prepared"),pd=Symbol("prepare"),fd=Symbol("preparedGLTF"),md=Symbol("clone"),vd=function(){function e(t){Object(h.a)(this,e),this[fd]=t}return Object(d.a)(e,[{key:"clone",value:function(){return new(0,this.constructor)(this[md]())}},{key:"dispose",value:function(){this.scenes.forEach((function(e){e.traverse((function(e){if(e.isMesh){var t=e;(Array.isArray(t.material)?t.material:[t.material]).forEach((function(e){e.dispose()})),t.geometry.dispose()}}))}))}},{key:md,value:function(){var e=this[fd],t=hd(this.scene),n=[t],i=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:n,userData:i})}},{key:"parser",get:function(){return this[fd].parser}},{key:"animations",get:function(){return this[fd].animations}},{key:"scene",get:function(){return this[fd].scene}},{key:"scenes",get:function(){return this[fd].scenes}},{key:"cameras",get:function(){return this[fd].cameras}},{key:"asset",get:function(){return this[fd].asset}},{key:"userData",get:function(){return this[fd].userData}}],[{key:"prepare",value:function(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[dd])return e;var t=this[pd](e);return t[dd]=!0,t}},{key:pd,value:function(e){var t=e.scene,n=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:n})}}]),e}(),gd="\n#ifdef ALPHATEST\n\n    if ( diffuseColor.a < ALPHATEST ) discard;\n    diffuseColor.a = 1.0;\n\n#endif\n",yd=Symbol("cloneAndPatchMaterial"),bd=Symbol("correlatedSceneGraph"),xd=function(e){Object(p.a)(n,e);var t=b(n);function n(){return Object(h.a)(this,n),t.apply(this,arguments)}return Object(d.a)(n,[{key:md,value:function(){var e=this,t=Object(a.a)(Object(m.a)(n.prototype),md,this).call(this),i=new Map;return t.scene.traverse((function(t){if(t.isMesh){var n=t;Array.isArray(n.material)?n.material=n.material.map((function(t){return e[yd](t,i)})):null!=n.material&&(n.material=e[yd](n.material,i))}})),t[bd]=ud.from(t,this.correlatedSceneGraph),t}},{key:yd,value:function(e,t){if(t.has(e.uuid))return t.get(e.uuid);var n=e.clone(),i=e.onBeforeCompile;return n.onBeforeCompile=e.isGLTFSpecularGlossinessMaterial?function(e){i(e,void 0),e.fragmentShader=e.fragmentShader.replace("#include <alphatest_fragment>",gd)}:function(e){e.fragmentShader=e.fragmentShader.replace("#include <alphatest_fragment>",gd),i(e,void 0)},n.shadowSide=0,n.transparent&&(n.depthWrite=!1),n.alphaTest||n.transparent||(n.alphaTest=-.5),t.set(e.uuid,n),n}},{key:"correlatedSceneGraph",get:function(){return this[fd][bd]}}],[{key:pd,value:function(e){var t=Object(a.a)(Object(m.a)(n),pd,this).call(this,e);null==t[bd]&&(t[bd]=ud.from(t));var i=t.scene,r=[];i.traverse((function(e){if(e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid),e.isMesh){e.castShadow=!0;var t=e,n=!1;(Array.isArray(t.material)?t.material:[t.material]).forEach((function(e){e.isMeshStandardMaterial&&(e.transparent&&2===e.side&&(n=!0,e.side=0),Dd.singleton.roughnessMipmapper.generateMipmaps(e))})),n&&r.push(t)}}));for(var o=0,s=r;o<s.length;o++){var l=s[o],c=(Array.isArray(l.material)?l.material:[l.material]).map((function(e){var t=e.clone();return t.side=1,t})),u=Array.isArray(l.material)?c:c[0],h=new pn(l.geometry,u);h.renderOrder=-1,l.add(h)}return t}}]),n}(vd),wd=function(e){os.call(this,e),this.type=1009};wd.prototype=Object.assign(Object.create(os.prototype),{constructor:wd,parse:function(e){var t=function(e,t){switch(e){case 1:console.error("RGBELoader Read Error: "+(t||""));break;case 2:console.error("RGBELoader Write Error: "+(t||""));break;case 3:console.error("RGBELoader Bad File Format: "+(t||""));break;default:case 4:console.error("RGBELoader: Error: "+(t||""))}return-1},n=function(e,t,n){t=t||1024;for(var i=e.pos,r=-1,a=0,o="",s=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));0>(r=s.indexOf("\n"))&&a<t&&i<e.byteLength;)o+=s,a+=s.length,i+=128,s+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));return-1<r&&(!1!==n&&(e.pos+=a+r+1),o+s.slice(0,r))},i=function(e,t,n,i){var r=e[t+3],a=Math.pow(2,r-128)/255;n[i+0]=e[t+0]*a,n[i+1]=e[t+1]*a,n[i+2]=e[t+2]*a},r=function(){var e=new Float32Array(1),t=new Int32Array(e.buffer);function n(n){e[0]=n;var i=t[0],r=i>>16&32768,a=i>>12&2047,o=i>>23&255;return o<103?r:o>142?(r|=31744,r|=(255==o?0:1)&&8388607&i):o<113?r|=((a|=2048)>>114-o)+(a>>113-o&1):(r|=o-112<<10|a>>1,r+=1&a)}return function(e,t,i,r){var a=e[t+3],o=Math.pow(2,a-128)/255;i[r+0]=n(e[t+0]*o),i[r+1]=n(e[t+1]*o),i[r+2]=n(e[t+2]*o)}}(),a=new Uint8Array(e);a.pos=0;var o=function(e){var i,r,a=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,l=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,c={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(i=n(e)))return t(1,"no header found");if(!(r=i.match(/^#\?(\S+)$/)))return t(3,"bad initial token");for(c.valid|=1,c.programtype=r[1],c.string+=i+"\n";!1!==(i=n(e));)if(c.string+=i+"\n","#"!==i.charAt(0)){if((r=i.match(a))&&(c.gamma=parseFloat(r[1],10)),(r=i.match(o))&&(c.exposure=parseFloat(r[1],10)),(r=i.match(s))&&(c.valid|=2,c.format=r[1]),(r=i.match(l))&&(c.valid|=4,c.height=parseInt(r[1],10),c.width=parseInt(r[2],10)),2&c.valid&&4&c.valid)break}else c.comments+=i+"\n";return 2&c.valid?4&c.valid?c:t(3,"missing image size specifier"):t(3,"missing format specifier")}(a);if(-1!==o){var s=o.width,l=o.height,c=function(e,n,i){var r,a,o,s,l,c,u,h,d,p,f,m,v,g=n,y=i;if(g<8||g>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(g!==(e[2]<<8|e[3]))return t(3,"wrong scanline width");if(!(r=new Uint8Array(4*n*i)).length)return t(4,"unable to allocate buffer space");for(a=0,o=0,h=4*g,v=new Uint8Array(4),c=new Uint8Array(h);y>0&&o<e.byteLength;){if(o+4>e.byteLength)return t(1);if(v[0]=e[o++],v[1]=e[o++],v[2]=e[o++],v[3]=e[o++],2!=v[0]||2!=v[1]||(v[2]<<8|v[3])!=g)return t(3,"bad rgbe scanline format");for(u=0;u<h&&o<e.byteLength;){if((m=(s=e[o++])>128)&&(s-=128),0===s||u+s>h)return t(3,"bad scanline data");if(m)for(l=e[o++],d=0;d<s;d++)c[u++]=l;else c.set(e.subarray(o,o+s),u),u+=s,o+=s}for(p=g,d=0;d<p;d++)f=0,r[a]=c[d+f],f+=g,r[a+1]=c[d+f],f+=g,r[a+2]=c[d+f],f+=g,r[a+3]=c[d+f],a+=4;y--}return r}(a.subarray(a.pos),s,l);if(-1!==c){switch(this.type){case 1009:var u=c,h=1023,d=1009;break;case 1015:for(var p=c.length/4*3,f=new Float32Array(p),m=0;m<p;m++)i(c,4*m,f,3*m);u=f,h=1022,d=1015;break;case 1016:p=c.length/4*3;var v=new Uint16Array(p);for(m=0;m<p;m++)r(c,4*m,v,3*m);u=v,h=1022,d=1016;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:s,height:l,data:u,header:o.string,gamma:o.gamma,exposure:o.exposure,format:h,type:d}}}return null},setDataType:function(e){return this.type=e,this},load:function(e,t,n,i){return os.prototype.load.call(this,e,(function(e,n){switch(e.type){case 1009:e.encoding=3002,e.minFilter=1003,e.magFilter=1003,e.generateMipmaps=!1,e.flipY=!0;break;case 1015:case 1016:e.encoding=3e3,e.minFilter=1006,e.magFilter=1006,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,n)}),n,i)}});var _d=function(e){Object(p.a)(n,e);var t=b(n);function n(){var e;Object(h.a)(this,n),(e=t.call(this)).position.y=-3.5;var i=new vn;i.deleteAttribute("uv");var r=new Ao({metalness:0,side:1}),a=new Ao({metalness:0}),o=new Fs(16777215,500,28,2);o.position.set(.418,16.199,.3),e.add(o);var s=new pn(i,r);s.position.set(-.757,13.219,.717),s.scale.set(31.713,28.305,28.591),e.add(s);var l=new pn(i,a);l.position.set(-10.906,2.009,1.846),l.rotation.set(0,-.195,0),l.scale.set(2.328,7.905,4.651),e.add(l);var c=new pn(i,a);c.position.set(-5.607,-.754,-.758),c.rotation.set(0,.994,0),c.scale.set(1.97,1.534,3.955),e.add(c);var u=new pn(i,a);u.position.set(6.167,.857,7.803),u.rotation.set(0,.561,0),u.scale.set(3.927,6.285,3.687),e.add(u);var d=new pn(i,a);d.position.set(-2.017,.018,6.124),d.rotation.set(0,.333,0),d.scale.set(2.002,4.566,2.064),e.add(d);var p=new pn(i,a);p.position.set(2.291,-.756,-2.621),p.rotation.set(0,-.286,0),p.scale.set(1.546,1.552,1.496),e.add(p);var f=new pn(i,a);f.position.set(-2.193,-.369,-5.547),f.rotation.set(0,.516,0),f.scale.set(3.875,3.487,2.986),e.add(f);var m=new pn(i,e.createAreaLightMaterial(50));m.position.set(-16.116,14.37,8.208),m.scale.set(.1,2.428,2.739),e.add(m);var v=new pn(i,e.createAreaLightMaterial(50));v.position.set(-16.109,18.021,-8.207),v.scale.set(.1,2.425,2.751),e.add(v);var g=new pn(i,e.createAreaLightMaterial(17));g.position.set(14.904,12.198,-1.832),g.scale.set(.15,4.265,6.331),e.add(g);var y=new pn(i,e.createAreaLightMaterial(43));y.position.set(-.462,8.89,14.52),y.scale.set(4.38,5.441,.088),e.add(y);var b=new pn(i,e.createAreaLightMaterial(20));b.position.set(3.235,11.486,-12.541),b.scale.set(2.5,2,.1),e.add(b);var x=new pn(i,e.createAreaLightMaterial(100));return x.position.set(0,20,0),x.scale.set(1,.1,1),e.add(x),e}return Object(d.a)(n,[{key:"createAreaLightMaterial",value:function(e){var t=new Et;return t.color.setScalar(e),t}}]),n}(Ur);Ko.enabled=!0;var Md,Sd,Td,Ed,Ad=/\.hdr(\.js)?$/,Ld=new ss,kd=new wd,Rd={url:null},Od=function(e){Object(p.a)(o,e);var t,n,i,a=b(o);function o(e){var t;return Object(h.a)(this,o),(t=a.call(this)).generatedEnvironmentMap=null,t.skyboxCache=new Map,t.environmentMapCache=new Map,t.PMREMGenerator=new Yl(e),t}return Object(d.a)(o,[{key:"load",value:(i=Object(u.a)(c.a.mark((function e(t){var n,i,r,a,o=arguments;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>1&&void 0!==o[1]?o[1]:function(){},e.prev=1,i=Ad.test(t),r=i?kd:Ld,e.next=6,new Promise((function(e,i){return r.load(t,e,(function(e){n(e.loaded/e.total*.9)}),i)}));case 6:return a=e.sent,e.abrupt("return",(n(1),this.addMetadata(a,t),a.mapping=303,i?(a.encoding=3002,a.minFilter=1003,a.magFilter=1003,a.flipY=!0):a.encoding=3007,a));case 8:return e.prev=8,n&&n(1),e.finish(8);case 11:case"end":return e.stop()}}),e,this,[[1,,8,11]])}))),function(e){return i.apply(this,arguments)})},{key:"generateEnvironmentMapAndSkybox",value:(n=Object(u.a)(c.a.mark((function e(){var t,n,i,a,o,s,l,u,h,d,p,f=arguments;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=f.length>0&&void 0!==f[0]?f[0]:null,n=f.length>1&&void 0!==f[1]?f[1]:null,i=f.length>2&&void 0!==f[2]?f[2]:{},a=i.progressTracker,o=null!=a?a.beginActivity():function(){},e.prev=4,l=Promise.resolve(null),t&&(l=this.loadSkyboxFromUrl(t,a)),s=n?this.loadEnvironmentMapFromUrl(n,a):t?this.loadEnvironmentMapFromUrl(t,a):this.loadGeneratedEnvironmentMap(),e.next=9,Promise.all([s,l]);case 9:if(u=e.sent,h=Object(r.a)(u,2),d=h[0],p=h[1],null!=d){e.next=15;break}throw new Error("Failed to load environment map.");case 15:return e.abrupt("return",{environmentMap:d,skybox:p});case 16:return e.prev=16,o(1),e.finish(16);case 19:case"end":return e.stop()}}),e,this,[[4,,16,19]])}))),function(){return n.apply(this,arguments)})},{key:"addMetadata",value:function(e,t){null!=e&&(e.userData=Object.assign(Object.assign({},Rd),{url:t}))}},{key:"loadSkyboxFromUrl",value:function(e,t){if(!this.skyboxCache.has(e)){var n=t?t.beginActivity():function(){},i=this.load(e,n);this.skyboxCache.set(e,i)}return this.skyboxCache.get(e)}},{key:"loadEnvironmentMapFromUrl",value:function(e,t){var n=this;if(!this.environmentMapCache.has(e)){var i=this.loadSkyboxFromUrl(e,t).then((function(t){var i=n.PMREMGenerator.fromEquirectangular(t);return n.addMetadata(i.texture,e),i}));this.PMREMGenerator.compileEquirectangularShader(),this.environmentMapCache.set(e,i)}return this.environmentMapCache.get(e)}},{key:"loadGeneratedEnvironmentMap",value:function(){if(null==this.generatedEnvironmentMap){var e=new _d;this.generatedEnvironmentMap=this.PMREMGenerator.fromScene(e,.04),this.addMetadata(this.generatedEnvironmentMap.texture,null)}return Promise.resolve(this.generatedEnvironmentMap)}},{key:"dispose",value:(t=Object(u.a)(c.a.mark((function e(){var t,n,i,r;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],this.environmentMapCache.forEach((function(e){t.push(e)})),this.environmentMapCache.clear(),n=0,i=t;case 3:if(!(n<i.length)){e.next=16;break}return r=i[n],e.prev=5,e.next=8,r;case 8:e.sent.dispose(),e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:n++,e.next=3;break;case 16:null!=this.generatedEnvironmentMap&&(this.generatedEnvironmentMap.dispose(),this.generatedEnvironmentMap=null);case 17:case"end":return e.stop()}}),e,this,[[5,11]])}))),function(){return t.apply(this,arguments)})}]),o}(j),Cd=Symbol("onWebGLContextLost"),Pd=Symbol("webGLContextLostHandler"),Id=Symbol("singleton"),Dd=function(e){Object(p.a)(n,e);var t=b(n);function n(e){var i;Object(h.a)(this,n),(i=t.call(this)).loader=new wc(xd),i.width=0,i.height=0,i.dpr=1,i.minScale=.5,i.debugger=null,i.scenes=new Set,i.multipleScenesVisible=!1,i.scale=1,i.avgFrameDuration=22,i[Sd]=function(e){return i[Cd](e)},i.dpr=$u(),i.canvasElement=document.createElement("canvas"),i.canvasElement.id="webgl-canvas",i.canvas3D=i.canvasElement,i.canvas3D.addEventListener("webglcontextlost",i[Pd]);try{i.threeRenderer=new Fr({canvas:i.canvas3D,alpha:!0,antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),i.threeRenderer.autoClear=!0,i.threeRenderer.outputEncoding=3007,i.threeRenderer.gammaFactor=2.2,i.threeRenderer.physicallyCorrectLights=!0,i.threeRenderer.setPixelRatio(1),i.threeRenderer.shadowMap.enabled=!0,i.threeRenderer.shadowMap.type=2,i.threeRenderer.shadowMap.autoUpdate=!1,i.debugger=null!=e&&e.debug?new nd(Object(o.a)(i)):null,i.threeRenderer.debug={checkShaderErrors:!!i.debugger},i.threeRenderer.toneMapping=4}catch(e){console.warn(e)}return i.arRenderer=new td(Object(o.a)(i)),i.textureUtils=i.canRender?new Od(i.threeRenderer):null,i.roughnessMipmapper=new uu(i.threeRenderer),i.updateRendererSize(),i.lastTick=performance.now(),i.avgFrameDuration=0,i}return Object(d.a)(n,[{key:"updateRendererSize",value:function(){var e=$u();if(e!==this.dpr){var t,n=g(this.scenes);try{for(n.s();!(t=n.n()).done;){var i=t.value.element;i[lp](i.getBoundingClientRect())}}catch(m){n.e(m)}finally{n.f()}}var r,a=0,o=0,s=g(this.scenes);try{for(s.s();!(r=s.n()).done;){var l=r.value;a=Math.max(a,l.width),o=Math.max(o,l.height)}}catch(m){s.e(m)}finally{s.f()}if(a!==this.width||o!==this.height||e!==this.dpr){this.width=a,this.height=o,this.dpr=e,this.canRender&&this.threeRenderer.setSize(a*e,o*e,!1);var c=a/this.scale,u=o/this.scale;this.canvasElement.style.width=c+"px",this.canvasElement.style.height=u+"px";var h,d=g(this.scenes);try{for(d.s();!(h=d.n()).done;){var p=h.value,f=p.canvas;f.width=Math.round(a*e),f.height=Math.round(o*e),f.style.width=c+"px",f.style.height=u+"px",p.isDirty=!0}}catch(m){d.e(m)}finally{d.f()}}}},{key:"updateRendererScale",value:function(){var e=this.scale;if(this.avgFrameDuration>26&&e>this.minScale?e*=.79:this.avgFrameDuration<18&&e<1&&(e/=.79,e=Math.min(e,1)),(e=Math.max(e,this.minScale))!=this.scale){this.scale=e,this.avgFrameDuration=22;var t=this.width/e,n=this.height/e;this.canvasElement.style.width=t+"px",this.canvasElement.style.height=n+"px";var i,r=g(this.scenes);try{for(r.s();!(i=r.n()).done;){var a=i.value,o=a.canvas.style;o.width=t+"px",o.height=n+"px",a.isDirty=!0}}catch(s){r.e(s)}finally{r.f()}}}},{key:"registerScene",value:function(e){var t=this;this.scenes.add(e);var n=e.canvas;n.width=Math.round(this.width*this.dpr),n.height=Math.round(this.height*this.dpr),n.style.width=this.width/this.scale+"px",n.style.height=this.height/this.scale+"px",this.multipleScenesVisible&&n.classList.add("show"),e.isDirty=!0,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop((function(e){return t.render(e)})),null!=this.debugger&&this.debugger.addScene(e)}},{key:"unregisterScene",value:function(e){this.scenes.delete(e),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null),null!=this.debugger&&this.debugger.removeScene(e)}},{key:"displayCanvas",value:function(e){return this.multipleScenesVisible?e.element[gp]:this.canvasElement}},{key:"selectCanvas",value:function(){var e,t=0,n=null,i=g(this.scenes);try{for(i.s();!(e=i.n()).done;){var r=e.value.element;r.modelIsVisible&&(++t,n=r[vp])}}catch(d){i.e(d)}finally{i.f()}var a=t>1||!1,o=this.canvasElement;if(a!==this.multipleScenesVisible||!a&&o.parentElement!==n){this.multipleScenesVisible=a,a&&o.classList.remove("show");var s,l=g(this.scenes);try{for(l.s();!(s=l.n()).done;){var c=s.value,u=c.element[vp],h=c.element[gp];a?(h.classList.add("show"),c.isDirty=!0):u===n&&(u.appendChild(o),o.classList.add("show"),h.classList.remove("show"),c.isDirty=!0)}}catch(d){l.e(d)}finally{l.f()}}}},{key:"orderedScenes",value:function(){for(var e=[],t=0,n=[!1,!0];t<n.length;t++){var i,r=n[t],a=g(this.scenes);try{for(a.s();!(i=a.n()).done;){var o=i.value;o.element.modelIsVisible===r&&e.push(o)}}catch(s){a.e(s)}finally{a.f()}}return e}},{key:"preRender",value:function(e,t,n){var i=e.element,r=e.exposure,a=e.model;i[xp](t,n);var o="number"==typeof r&&!self.isNaN(r);this.threeRenderer.toneMappingExposure=o?r:1,a.updateShadow()&&(this.threeRenderer.shadowMap.needsUpdate=!0)}},{key:"render",value:function(e){var t=e-this.lastTick;if(this.lastTick=e,this.canRender&&!this.isPresenting){this.avgFrameDuration+=Qu(.2*(t-this.avgFrameDuration),-2,2),this.selectCanvas(),this.updateRendererSize(),this.updateRendererScale();var n,i=this.dpr,r=this.scale,a=g(this.orderedScenes());try{for(a.s();!(n=a.n()).done;){var o=n.value;if(o.element[Lp]()&&(this.preRender(o,e,t),o.isDirty)){if(o.isDirty=!1,!o.element.modelIsVisible&&!this.multipleScenesVisible){var s,l=g(this.scenes);try{for(l.s();!(s=l.n()).done;){var c=s.value;c.element.modelIsVisible&&(c.isDirty=!0)}}catch(p){l.e(p)}finally{l.f()}}var u=Math.min(Math.ceil(o.width*r*i),this.canvas3D.width),h=Math.min(Math.ceil(o.height*r*i),this.canvas3D.height);if(this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.floor(this.height*i)-h,u,h),this.threeRenderer.render(o,o.getCamera()),this.multipleScenesVisible){null==o.context&&o.createContext();var d=o.context;d.clearRect(0,0,u,h),d.drawImage(this.canvas3D,0,0,u,h,0,0,u,h)}}}}catch(p){a.e(p)}finally{a.f()}}}},{key:"dispose",value:function(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null,this.scenes.clear(),this.canvas3D.removeEventListener("webglcontextlost",this[Pd])}},{key:(Md=Id,Sd=Pd,Cd),value:function(e){this.dispatchEvent({type:"contextlost",sourceEvent:e})}},{key:"canRender",get:function(){return null!=this.threeRenderer}},{key:"scaleFactor",get:function(){return this.scale}},{key:"isPresenting",get:function(){return this.arRenderer.isPresenting}}],[{key:"resetSingleton",value:function(){this[Id].dispose(),this[Id]=new n({debug:eh()})}},{key:"singleton",get:function(){return this[Id]}}]),n}(j);Dd[Md]=new Dd({debug:eh()});var Nd,Fd,Ud,zd,jd,Bd,Hd,Gd,Vd,Wd,qd=Symbol("ongoingActivities"),Xd=Symbol("announceTotalProgress"),Yd=Symbol("eventDelegate"),Jd=function(){function e(){var t=this;Object(h.a)(this,e),this[Td]=document.createDocumentFragment(),this.addEventListener=function(){var e;return(e=t[Yd]).addEventListener.apply(e,arguments)},this.removeEventListener=function(){var e;return(e=t[Yd]).removeEventListener.apply(e,arguments)},this.dispatchEvent=function(){var e;return(e=t[Yd]).dispatchEvent.apply(e,arguments)},this[Ed]=new Set}return Object(d.a)(e,[{key:"beginActivity",value:function(){var e=this,t={progress:0};return this[qd].add(t),1===this.ongoingActivityCount&&this[Xd](),function(n){var i;return(i=Math.max(Qu(n,0,1),t.progress))!==t.progress&&(t.progress=i,e[Xd]()),t.progress}}},{key:(Td=Yd,Ed=qd,Xd),value:function(){var e,t=0,n=0,i=0,r=g(this[qd]);try{for(r.s();!(e=r.n()).done;){var a=e.value.progress;t+=a*(.5/Math.pow(2,n++)),1===a&&i++}}catch(o){r.e(o)}finally{r.f()}i===this.ongoingActivityCount&&(t=1,this[qd].clear()),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t}}))}},{key:"ongoingActivityCount",get:function(){return this[qd].size}}]),e}(),Zd=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},Kd=document.createElement("canvas"),Qd=null,$d=Symbol("template"),ep=Symbol("fallbackResizeHandler"),tp=Symbol("defaultAriaLabel"),np=Symbol("resizeObserver"),ip=Symbol("intersectionObserver"),rp=Symbol("clearModelTimeout"),ap=Symbol("onContextLost"),op=Symbol("contextLostHandler"),sp=Symbol("loaded"),lp=Symbol("updateSize"),cp=Symbol("isElementInViewport"),up=Symbol("announceModelVisibility"),hp=Symbol("ariaLabel"),dp=Symbol("loadedTime"),pp=Symbol("updateSource"),fp=Symbol("markLoaded"),mp=Symbol("container"),vp=Symbol("input"),gp=Symbol("canvas"),yp=Symbol("scene"),bp=Symbol("needsRender"),xp=Symbol("tick"),wp=Symbol("onModelLoad"),_p=Symbol("onResize"),Mp=Symbol("renderer"),Sp=Symbol("progressTracker"),Tp=Symbol("getLoaded"),Ep=Symbol("getModelIsVisible"),Ap=Symbol("shouldAttemptPreload"),Lp=Symbol("sceneIsReady"),kp=Symbol("hasTransitioned"),Rp=function(e){return{x:e.x,y:e.y,z:e.z,toString:function(){return"".concat(this.x,"m ").concat(this.y,"m ").concat(this.z,"m")}}},Op=function(e){Object(p.a)(r,e);var t,n,i=b(r);function r(){var e;Object(h.a)(this,r),(e=i.call(this)).alt=null,e.src=null,e[Nd]=!1,e[Fd]=!1,e[Ud]=0,e[zd]=null,e[jd]=Ku((function(){var t=e.getBoundingClientRect();e[lp](t)}),50),e[Bd]=Ku((function(t){var n=e.modelIsVisible;n!==t&&e.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:n}}))}),0),e[Hd]=null,e[Gd]=null,e[Vd]=new Jd,e[Wd]=function(t){return e[ap](t)};var t=e.constructor.template;window.ShadyCSS&&window.ShadyCSS.styleElement(Object(o.a)(e),{}),e.attachShadow({mode:"open"});var n,a,s=e.shadowRoot;if(s.appendChild(t.content.cloneNode(!0)),e[mp]=s.querySelector(".container"),e[vp]=s.querySelector(".userInput"),e[gp]=s.querySelector("canvas"),e[tp]=e[vp].getAttribute("aria-label"),e.isConnected){var l=e.getBoundingClientRect();n=l.width,a=l.height}else n=300,a=150;return e[yp]=new ru({canvas:e[gp],element:Object(o.a)(e),width:n,height:a}),e[yp].addEventListener("model-load",(function(t){e[fp](),e[wp](),e.dispatchEvent(new CustomEvent("load",{detail:{url:t.url}}))})),Promise.resolve().then((function(){e[lp](e.getBoundingClientRect())})),A&&(e[np]=new ResizeObserver((function(t){if(!e[Mp].isPresenting){var n,i=g(t);try{for(i.s();!(n=i.n()).done;){var r=n.value;r.target===Object(o.a)(e)&&e[lp](r.contentRect)}}catch(a){i.e(a)}finally{i.f()}}}))),L?e[ip]=new IntersectionObserver((function(t){var n,i=g(t);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(r.target===Object(o.a)(e)){var a=e.modelIsVisible;e[cp]=r.isIntersecting,e[up](a),e[cp]&&!e[Lp]()&&e[pp]()}}}catch(s){i.e(s)}finally{i.f()}}),{root:null,rootMargin:"0px",threshold:0}):e[cp]=!0,e}return Object(d.a)(r,[{key:"connectedCallback",value:function(){Object(a.a)(Object(m.a)(r.prototype),"connectedCallback",this)&&Object(a.a)(Object(m.a)(r.prototype),"connectedCallback",this).call(this),A?this[np].observe(this):self.addEventListener("resize",this[ep]),L&&this[ip].observe(this);var e=this[Mp];e.addEventListener("contextlost",this[op]),e.registerScene(this[yp]),null!=this[rp]&&(self.clearTimeout(this[rp]),this[rp]=null,this.requestUpdate("src",null))}},{key:"disconnectedCallback",value:function(){var e=this;Object(a.a)(Object(m.a)(r.prototype),"disconnectedCallback",this)&&Object(a.a)(Object(m.a)(r.prototype),"disconnectedCallback",this).call(this),A?this[np].unobserve(this):self.removeEventListener("resize",this[ep]),L&&this[ip].unobserve(this);var t=this[Mp];t.removeEventListener("contextlost",this[op]),t.unregisterScene(this[yp]),this[rp]=self.setTimeout((function(){e[yp].model.clear()}),1e3)}},{key:"updated",value:function(e){if(Object(a.a)(Object(m.a)(r.prototype),"updated",this).call(this,e),!e.has("src")||null!=this.src&&this.src===this[yp].model.url||(this[sp]=!1,this[dp]=0,this[pp]()),e.has("alt")){var t=null==this.alt?this[tp]:this.alt;this[vp].setAttribute("aria-label",t)}}},{key:"toDataURL",value:function(e,t){return this[Mp].displayCanvas(this[yp]).toDataURL(e,t)}},{key:"toBlob",value:(n=Object(u.a)(c.a.mark((function e(t){var n,i,r,a,o,s,l,h,d,p,f,m,v,g,y,b,x,w=this;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t?t.mimeType:void 0,i=t?t.qualityArgument:void 0,r=t?t.idealAspect:void 0,a=this[yp],o=a.width,s=a.height,l=a.model,h=a.aspect,d=this[Mp],p=d.dpr,f=d.scaleFactor,m=o*f*p,v=s*f*p,g=0,y=0,!0===r&&(l.fieldOfViewAspect>h?(b=v,v=Math.round(m/l.fieldOfViewAspect),y=(b-v)/2):(x=m,m=Math.round(v*l.fieldOfViewAspect),g=(x-m)/2)),Kd.width=m,Kd.height=v,e.prev=4,e.abrupt("return",new Promise(function(){var e=Object(u.a)(c.a.mark((function e(t,r){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==Qd&&(Qd=Kd.getContext("2d")),Qd.drawImage(w[Mp].displayCanvas(w[yp]),g,y,m,v,0,0,m,v),Kd.msToBlob&&(!n||"image/png"===n)){e.next=15;break}if(!Kd.toBlob){e.next=7;break}e.t1=void Kd.toBlob((function(e){if(!e)return r(new Error("Unable to retrieve canvas blob"));t(e)}),n,i),e.next=12;break;case 7:return e.t2=t,e.next=10,function(){var e=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var i=t.match(/data:(.*);/);if(!i)return n(new Error(t+" is not a valid data Url"));for(var r=i[1],a=t.replace(/data:image\/\w+;base64,/,""),o=atob(a),s=[],l=0;l<o.length;l+=512){for(var c=o.slice(l,l+512),u=new Array(c.length),h=0;h<c.length;h++)u[h]=c.charCodeAt(h);var d=new Uint8Array(u);s.push(d)}e(new Blob(s,{type:r}))})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()(Kd.toDataURL(n,i));case 10:e.t3=e.sent,e.t1=(0,e.t2)(e.t3);case 12:e.t0=e.t1,e.next=16;break;case 15:e.t0=t(Kd.msToBlob());case 16:return e.abrupt("return",e.t0);case 17:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()));case 6:return e.prev=6,this[lp]({width:o,height:s}),e.finish(6);case 9:case"end":return e.stop()}}),e,this,[[4,,6,9]])}))),function(e){return n.apply(this,arguments)})},{key:Tp,value:function(){return this[sp]}},{key:Ep,value:function(){return this.loaded&&this[cp]}},{key:kp,value:function(){return this.modelIsVisible}},{key:Ap,value:function(){return!!this.src&&this[cp]}},{key:Lp,value:function(){return this[sp]}},{key:lp,value:function(e){var t=e.width,n=e.height;this[mp].style.width=t+"px",this[mp].style.height=n+"px",this[_p]({width:parseFloat(t),height:parseFloat(n)})}},{key:xp,value:function(e,t){}},{key:fp,value:function(){this[sp]||(this[sp]=!0,this[dp]=performance.now())}},{key:bp,value:function(){this[yp].isDirty=!0}},{key:wp,value:function(){}},{key:_p,value:function(e){this[yp].setSize(e.width,e.height)}},{key:ap,value:function(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))}},{key:pp,value:(t=Object(u.a)(c.a.mark((function e(){var t,n,i;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.loaded&&this[Ap]()){e.next=2;break}return e.abrupt("return");case 2:return t=this[Sp].beginActivity(),n=this.src,e.prev=3,e.next=6,this[yp].setModelSource(n,(function(e){return t(.8*e)}));case 6:i={url:n},this.dispatchEvent(new CustomEvent("preload",{detail:i})),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),this.dispatchEvent(new CustomEvent("error",{detail:e.t0}));case 13:return e.prev=13,t(.9),requestAnimationFrame((function(){requestAnimationFrame((function(){t(1)}))})),e.finish(13);case 16:case"end":return e.stop()}}),e,this,[[3,10,13,16]])}))),function(){return t.apply(this,arguments)})},{key:"loaded",get:function(){return this[Tp]()}},{key:(Nd=cp,Fd=sp,Ud=dp,zd=rp,jd=ep,Bd=up,Hd=np,Gd=ip,Vd=Sp,Wd=op,Mp),get:function(){return Dd.singleton}},{key:"modelIsVisible",get:function(){return this[Ep]()}},{key:hp,get:function(){return null==this.alt||"null"===this.alt?this[tp]:this.alt}}],[{key:"is",get:function(){return"model-viewer"}},{key:"template",get:function(){return this.hasOwnProperty($d)||(this[$d]=function(e){var t=document.createElement("template");return t.innerHTML=z.innerHTML,window.ShadyCSS&&window.ShadyCSS.prepareTemplate(t,e),t}(this.is)),this[$d]}},{key:"modelCacheSize",set:function(e){wc[bc].evictionThreshold=e},get:function(){return wc[bc].evictionThreshold}},{key:"minimumRenderScale",set:function(e){e>1&&console.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&console.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0. This could result in single-pixel renders on some devices; consider increasing."),Dd.singleton.minScale=Math.max(0,Math.min(1,e))},get:function(){return Dd.singleton.minScale}}]),r}(M);Zd([S({type:String})],Op.prototype,"alt",void 0),Zd([S({type:String})],Op.prototype,"src",void 0);var Cp,Pp,Ip,Dp=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},Np=Symbol("changeAnimation"),Fp=Symbol("paused"),Up=Symbol("annotationRenderer"),zp=Symbol("hotspotMap"),jp=Symbol("mutationCallback"),Bp=Symbol("observer"),Hp=Symbol("addHotspot"),Gp=Symbol("removeHotspot"),Vp=new q,Wp=new ke,qp=new X,Xp=function(e){return function(t){try{var n,i=kc(t),r=(i.length?i[0].terms:[]).filter((function(e){return e&&"ident"===e.type})).map((function(e){return e.value})).filter((function(t){return e.indexOf(t)>-1})),a=new Set,o=g(r);try{for(o.s();!(n=o.n()).done;){var s=n.value;a.add(s)}}catch(l){o.e(l)}finally{o.f()}return a}catch(e){}return new Set}},Yp=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},Jp=!1,Zp=!1,Kp=Xp(["safari","chrome"]),Qp=Xp(["quick-look","scene-viewer","webxr","none"]),$p="quick-look",ef="scene-viewer",tf="none",nf=Symbol("arButtonContainer"),rf=Symbol("enterARWithWebXR"),af=Symbol("openSceneViewer"),of=Symbol("openIOSARQuickLook"),sf=Symbol("canActivateAR"),lf=Symbol("arMode"),cf=Symbol("arModes"),uf=Symbol("canLaunchQuickLook"),hf=Symbol("quickLookBrowsers"),df=Symbol("arAnchor"),pf=Symbol("preload"),ff=Symbol("onARButtonContainerClick"),mf=Symbol("onARStatus"),vf=Symbol("onARTap"),gf=Symbol("selectARMode"),yf=Symbol("evaluate"),bf=Symbol("lastValue"),xf=function(){function e(){Object(h.a)(this,e),this[Cp]=null}return Object(d.a)(e,[{key:"evaluate",value:function(){return this.isConstant&&null!=this[bf]||(this[bf]=this[yf]()),this[bf]}},{key:"isConstant",get:function(){return!1}}],[{key:"evaluatableFor",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fc;if(t instanceof e)return t;if("number"===t.type)return"%"===t.unit?new Af(t,n):t;switch(t.name.value){case"calc":return new Cf(t,n);case"env":return new kf(t)}return Fc}},{key:"evaluate",value:function(t){return t instanceof e?t.evaluate():t}},{key:"isConstant",value:function(t){return!(t instanceof e)||t.isConstant}},{key:"applyIntrinsics",value:function(e,t){var n=t.basis,i=t.keywords,r=i.auto;return n.map((function(t,n){var a=null==r[n]?t:r[n],o=e[n]?e[n]:a;if("ident"===o.type){var s=o.value;s in i&&(o=i[s][n])}return null!=o&&"ident"!==o.type||(o=a),"%"===o.unit?Lc(o.number/100*t.number,t.unit):(o=jc(o,t)).unit!==t.unit?t:o}))}}]),e}();Cp=bf;var wf,_f,Mf,Sf,Tf=Symbol("percentage"),Ef=Symbol("basis"),Af=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i){var r;return Object(h.a)(this,n),(r=t.call(this))[Tf]=e,r[Ef]=i,r}return Object(d.a)(n,[{key:yf,value:function(){return Lc(this[Tf].number/100*this[Ef].number,this[Ef].unit)}},{key:"isConstant",get:function(){return!0}}]),n}(xf),Lf=Symbol("identNode"),kf=function(e){Object(p.a)(n,e);var t=b(n);function n(e){var i;Object(h.a)(this,n),(i=t.call(this))[Pp]=null;var r=e.arguments.length?e.arguments[0].terms[0]:null;return null!=r&&"ident"===r.type&&(i[Lf]=r),i}return Object(d.a)(n,[{key:(Pp=Lf,yf),value:function(){if(null!=this[Lf])switch(this[Lf].value){case"window-scroll-y":return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return Fc}},{key:"isConstant",get:function(){return!1}}]),n}(xf),Rf=/[\*\/]/,Of=Symbol("evalutor"),Cf=function(e){Object(p.a)(n,e);var t=b(n);function n(e){var i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fc;if(Object(h.a)(this,n),(i=t.call(this))[Ip]=null,1!==e.arguments.length)return Object(f.a)(i);for(var o=e.arguments[0].terms.slice(),s=[];o.length;){var l=o.shift();if(s.length>0){var c=s[s.length-1];if("operator"===c.type&&Rf.test(c.value)){var u=s.pop(),d=s.pop();if(null==d)return Object(f.a)(i);s.push(new Nf(u,xf.evaluatableFor(d,a),xf.evaluatableFor(l,a)));continue}}s.push("operator"===l.type?l:xf.evaluatableFor(l,a))}for(;s.length>2;){var p=s.splice(0,3),m=Object(r.a)(p,3),v=m[0],g=m[1],y=m[2];if("operator"!==g.type)return Object(f.a)(i);s.unshift(new Nf(g,xf.evaluatableFor(v,a),xf.evaluatableFor(y,a)))}return 1===s.length&&(i[Of]=s[0]),Object(f.a)(i)}return Object(d.a)(n,[{key:(Ip=Of,yf),value:function(){return null!=this[Of]?xf.evaluate(this[Of]):Fc}},{key:"isConstant",get:function(){return null==this[Of]||xf.isConstant(this[Of])}}]),n}(xf),Pf=Symbol("operator"),If=Symbol("left"),Df=Symbol("right"),Nf=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i,r){var a;return Object(h.a)(this,n),(a=t.call(this))[Pf]=e,a[If]=i,a[Df]=r,a}return Object(d.a)(n,[{key:yf,value:function(){var e=jc(xf.evaluate(this[If])),t=jc(xf.evaluate(this[Df])),n=e.number,i=e.unit,r=t.number,a=t.unit;if(null!=a&&null!=i&&a!=i)return Fc;var o,s=i||a;switch(this[Pf].value){case"+":o=n+r;break;case"-":o=n-r;break;case"/":o=n/r;break;case"*":o=n*r;break;default:return Fc}return{type:"number",number:o,unit:s}}},{key:"isConstant",get:function(){return xf.isConstant(this[If])&&xf.isConstant(this[Df])}}]),n}(xf),Ff=Symbol("evaluatables"),Uf=Symbol("intrinsics"),zf=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i){var r;Object(h.a)(this,n),(r=t.call(this))[Uf]=i;var a=e[0],o=null!=a?a.terms:[];return r[Ff]=i.basis.map((function(e,t){var n=o[t];return null==n?{type:"ident",value:"auto"}:"ident"===n.type?n:xf.evaluatableFor(n,e)})),r}return Object(d.a)(n,[{key:yf,value:function(){var e=this[Ff].map((function(e){return xf.evaluate(e)}));return xf.applyIntrinsics(e,this[Uf]).map((function(e){return e.number}))}},{key:"isConstant",get:function(){var e,t=g(this[Ff]);try{for(t.s();!(e=t.n()).done;){var n=e.value;if(!xf.isConstant(n))return!1}}catch(i){t.e(i)}finally{t.f()}return!0}}]),n}(xf),jf=Symbol("instances"),Bf=Symbol("activateListener"),Hf=Symbol("deactivateListener"),Gf=Symbol("notifyInstances"),Vf=Symbol("notify"),Wf=Symbol("callback"),qf=function(){function e(t){Object(h.a)(this,e),this[Wf]=t}return Object(d.a)(e,[{key:"observe",value:function(){0===e[jf].size&&e[Bf](),e[jf].add(this)}},{key:"disconnect",value:function(){e[jf].delete(this),0===e[jf].size&&e[Hf]()}},{key:Vf,value:function(){this[Wf]()}}],[{key:Gf,value:function(){var t,n=g(e[jf]);try{for(n.s();!(t=n.n()).done;){t.value[Vf]()}}catch(i){n.e(i)}finally{n.f()}}},{key:(wf=jf,Bf),value:function(){window.addEventListener("scroll",this[Gf],{passive:!0})}},{key:Hf,value:function(){window.removeEventListener("scroll",this[Gf])}}]),e}();qf[wf]=new Set;var Xf,Yf,Jf=Symbol("computeStyleCallback"),Zf=Symbol("astWalker"),Kf=Symbol("dependencies"),Qf=Symbol("scrollHandler"),$f=Symbol("onScroll"),em=function(){function e(t){var n=this;Object(h.a)(this,e),this[_f]={},this[Mf]=new Nc(["function"]),this[Sf]=function(){return n[$f]()},this[Jf]=t}return Object(d.a)(e,[{key:"observeEffectsFor",value:function(e){var t=this,n={},i=this[Kf];for(var r in this[Zf].walk(e,(function(e){var r=e.name,a=e.arguments[0].terms[0];if("env"===r.value&&null!=a&&"ident"===a.type)switch(a.value){case"window-scroll-y":if(null==n["window-scroll"]){var o="window-scroll"in i?i["window-scroll"]:new qf(t[Qf]);o.observe(),delete i["window-scroll"],n["window-scroll"]=o}}})),i)i[r].disconnect();this[Kf]=n}},{key:"dispose",value:function(){for(var e in this[Kf])this[Kf][e].disconnect()}},{key:(_f=Kf,Mf=Zf,Sf=Qf,$f),value:function(){this[Jf]({relatedState:"window-scroll"})}}]),e}(),tm=function(e){var t=e.observeEffects||!1,n=e.intrinsics instanceof Function?e.intrinsics:function(){return e.intrinsics};return function(r,a){var o,s=r.updated,l=r.connectedCallback,c=r.disconnectedCallback,u=Symbol(a+"StyleEffector"),h=Symbol(a+"StyleEvaluator"),d=Symbol(a+"UpdateEvaluator"),p=Symbol(a+"EvaluateAndSync");Object.defineProperties(r,(o={},Object(i.a)(o,u,{value:null,writable:!0}),Object(i.a)(o,h,{value:null,writable:!0}),Object(i.a)(o,d,{value:function(){var e=this,i=kc(this[a]);this[h]=new zf(i,n(this)),null==this[u]&&t&&(this[u]=new em((function(){return e[p]()}))),null!=this[u]&&this[u].observeEffectsFor(i)}}),Object(i.a)(o,p,{value:function(){if(null!=this[h]){var t=this[h].evaluate();this[e.updateHandler](t)}}}),Object(i.a)(o,"updated",{value:function(e){e.has(a)&&(this[d](),this[p]()),s.call(this,e)}}),Object(i.a)(o,"connectedCallback",{value:function(){l.call(this),this.requestUpdate(a,this[a])}}),Object(i.a)(o,"disconnectedCallback",{value:function(){c.call(this),null!=this[u]&&(this[u].dispose(),this[u]=null)}}),o))}},nm=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,interactionPolicy:"always-allow",touchAction:"pan-y"}),im=/^touch(start|end|move)$/,rm=Math.PI/8,am="user-interaction",om=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i){var r;return Object(h.a)(this,n),(r=t.call(this)).camera=e,r.element=i,r.sensitivity=1,r._interactionEnabled=!1,r.isUserChange=!1,r.isUserPointing=!1,r.spherical=new Ll,r.goalSpherical=new Ll,r.thetaDamper=new Mc,r.phiDamper=new Mc,r.radiusDamper=new Mc,r.logFov=Math.log(nm.maximumFieldOfView),r.goalLogFov=r.logFov,r.fovDamper=new Mc,r.pointerIsDown=!1,r.lastPointerPosition={clientX:0,clientY:0},r.touchMode="rotate",r.touchDecided=!1,r.onPointerMove=function(e){if(r.pointerIsDown&&r.canInteract){if(im.test(e.type)){var t=e.touches;switch(r.touchMode){case"zoom":if(r.lastTouches.length>1&&t.length>1){var n=.04*(r.twoTouchDistance(r.lastTouches[0],r.lastTouches[1])-r.twoTouchDistance(t[0],t[1]))/10;r.userAdjustOrbit(0,0,n)}break;case"rotate":var i=r._options.touchAction;if(!r.touchDecided&&"none"!==i){r.touchDecided=!0;var a=t[0],o=a.clientX,s=a.clientY,l=Math.abs(o-r.lastPointerPosition.clientX),c=Math.abs(s-r.lastPointerPosition.clientY);if("pan-y"===i&&c>l&&document.body.scrollHeight>window.innerHeight||"pan-x"===i&&l>c)return void(r.touchMode="scroll")}r.handleSinglePointerMove(t[0]);break;case"scroll":return}r.lastTouches=t}else r.handleSinglePointerMove(e);e.cancelable&&e.preventDefault()}},r.onPointerDown=function(e){if(r.pointerIsDown=!0,r.isUserPointing=!1,im.test(e.type)){var t=e.touches;switch(r.touchDecided=!1,t.length){default:case 1:r.touchMode="rotate",r.handleSinglePointerDown(t[0]);break;case 2:r.touchMode="zoom"}r.lastTouches=t}else r.handleSinglePointerDown(e)},r.onPointerUp=function(e){r.element.style.cursor="grab",r.pointerIsDown=!1,r.isUserPointing&&r.dispatchEvent({type:"pointer-change-end",pointer:Object.assign({},r.lastPointerPosition)})},r.onWheel=function(e){if(r.canInteract){var t=e.deltaY*(1==e.deltaMode?18:1)*.04/30;r.userAdjustOrbit(0,0,t),e.cancelable&&e.preventDefault()}},r.onKeyDown=function(e){var t=!1;switch(e.keyCode){case 33:t=!0,r.userAdjustOrbit(0,0,.04);break;case 34:t=!0,r.userAdjustOrbit(0,0,-.04);break;case 38:t=!0,r.userAdjustOrbit(0,-rm,0);break;case 40:t=!0,r.userAdjustOrbit(0,rm,0);break;case 37:t=!0,r.userAdjustOrbit(-rm,0,0);break;case 39:t=!0,r.userAdjustOrbit(rm,0,0)}t&&e.cancelable&&e.preventDefault()},r._options=Object.assign({},nm),r.setOrbit(0,Math.PI/2,1),r.setFieldOfView(100),r.jumpToGoal(),r}return Object(d.a)(n,[{key:"enableInteraction",value:function(){if(!1===this._interactionEnabled){var e=this.element;e.addEventListener("mousemove",this.onPointerMove),e.addEventListener("mousedown",this.onPointerDown),e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchstart",this.onPointerDown,{passive:!0}),e.addEventListener("touchmove",this.onPointerMove),self.addEventListener("mouseup",this.onPointerUp),self.addEventListener("touchend",this.onPointerUp),this.element.style.cursor="grab",this._interactionEnabled=!0}}},{key:"disableInteraction",value:function(){if(!0===this._interactionEnabled){var e=this.element;e.removeEventListener("mousemove",this.onPointerMove),e.removeEventListener("mousedown",this.onPointerDown),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("touchstart",this.onPointerDown),e.removeEventListener("touchmove",this.onPointerMove),self.removeEventListener("mouseup",this.onPointerUp),self.removeEventListener("touchend",this.onPointerUp),e.style.cursor="",this._interactionEnabled=!1}}},{key:"getCameraSpherical",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ll;return e.copy(this.spherical)}},{key:"getFieldOfView",value:function(){return this.camera.fov}},{key:"applyOptions",value:function(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}},{key:"updateNearFar",value:function(e,t){this.camera.near=Math.max(e,t/1e3),this.camera.far=t,this.camera.updateProjectionMatrix()}},{key:"updateAspect",value:function(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}},{key:"setOrbit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.goalSpherical.theta,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.goalSpherical.phi,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.goalSpherical.radius,i=this._options,r=i.minimumAzimuthalAngle,a=i.maximumAzimuthalAngle,o=i.minimumPolarAngle,s=i.maximumPolarAngle,l=i.minimumRadius,c=i.maximumRadius,u=this.goalSpherical,h=u.theta,d=u.phi,p=u.radius,f=Qu(e,r,a);isFinite(r)||isFinite(a)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-f)+f);var m=Qu(t,o,s),v=Qu(n,l,c);return(f!==h||m!==d||v!==p)&&(this.goalSpherical.theta=f,this.goalSpherical.phi=m,this.goalSpherical.radius=v,this.goalSpherical.makeSafe(),this.isUserChange=!1,!0)}},{key:"setRadius",value:function(e){this.goalSpherical.radius=e,this.setOrbit()}},{key:"setFieldOfView",value:function(e){var t=this._options,n=t.minimumFieldOfView,i=t.maximumFieldOfView;e=Qu(e,n,i),this.goalLogFov=Math.log(e)}},{key:"adjustOrbit",value:function(e,t,n){var i=this.goalSpherical,r=i.theta,a=i.phi,o=i.radius,s=this._options,l=s.minimumRadius,c=s.maximumRadius,u=s.minimumFieldOfView,h=s.maximumFieldOfView,d=this.spherical.theta-r,p=Math.PI-.001,f=r-Qu(e,-p-d,p-d),m=a-t,v=0===n?0:n>0?(c-o)/(Math.log(h)-this.goalLogFov):(o-l)/(this.goalLogFov-Math.log(u)),g=o+n*Math.min(isFinite(v)?v:1/0,c-l);if(this.setOrbit(f,m,g),0!==n){var y=this.goalLogFov+n;this.setFieldOfView(Math.exp(y))}}},{key:"jumpToGoal",value:function(){this.update(0,1e4)}},{key:"update",value:function(e,t){if(!this.isStationary()){var n=this._options,i=n.maximumPolarAngle,r=n.maximumRadius,a=this.spherical.theta-this.goalSpherical.theta;Math.abs(a)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(a)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,i),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,r),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera()}}},{key:"isStationary",value:function(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}},{key:"moveCamera",value:function(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new Fe(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix());var e=this.isUserChange?am:"none";this.dispatchEvent({type:"change",source:e})}},{key:"userAdjustOrbit",value:function(e,t,n){this.adjustOrbit(e*this.sensitivity,t*this.sensitivity,n),this.isUserChange=!0,this.dispatchEvent({type:"change",source:am})}},{key:"wrapAngle",value:function(e){var t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}},{key:"pixelLengthToSphericalAngle",value:function(e){return 2*Math.PI*e/this.element.clientHeight}},{key:"twoTouchDistance",value:function(e,t){var n=e.clientX,i=e.clientY,r=t.clientX-n,a=t.clientY-i;return Math.sqrt(r*r+a*a)}},{key:"handleSinglePointerMove",value:function(e){var t=e.clientX,n=e.clientY,i=this.pixelLengthToSphericalAngle(t-this.lastPointerPosition.clientX),r=this.pixelLengthToSphericalAngle(n-this.lastPointerPosition.clientY);this.lastPointerPosition.clientX=t,this.lastPointerPosition.clientY=n,!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start",pointer:Object.assign({},e)})),this.userAdjustOrbit(i,r,0)}},{key:"handleSinglePointerDown",value:function(e){this.lastPointerPosition.clientX=e.clientX,this.lastPointerPosition.clientY=e.clientY,this.element.style.cursor="grabbing"}},{key:"interactionEnabled",get:function(){return this._interactionEnabled}},{key:"options",get:function(){return this._options}},{key:"canInteract",get:function(){return"allow-when-focused"==this._options.interactionPolicy?this.element.getRootNode().activeElement===this.element:"always-allow"===this._options.interactionPolicy}}]),n}(j),sm=function(e){return e<.5?2*e*e:(4-2*e)*e-1},lm=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:sm;return function(i){return e+(t-e)*n(i)}},cm=function(e,t){for(var n=[],i=[],r=e,a=0;a<t.length;++a){var o=t[a],s=o.value,l=o.frames,c=o.ease||sm,u=lm(r,s,c);n.push(u),i.push(l),r=s}return function(e,t){var n=t.reduce((function(e,t){return e+t}),0),i=t.map((function(e){return e/n}));return function(t){for(var n=0,r=1/0,a=function(){return 0},o=0;o<i.length&&(r=i[o],a=e[o],!(t<=n+r));++o)n+=r;return a((t-n)/r)}}(n,i)},um=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},hm=cm(0,[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]),dm=cm(0,[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]),pm=1.1*Wc,fm=["front","right","back","left"],mm=["upper-","","lower-"],vm="auto",gm="when-focused",ym="wiggle",bm="always-allow",xm=function(e){return{basis:[Lc(e[Zm]*Math.PI/180,"rad")],keywords:{auto:[null]}}},wm={basis:[Uc(Lc(25,"deg"))],keywords:{auto:[null]}},_m=function(e){var t=e[yp];return{basis:[Uc(Lc(45,"deg"))],keywords:{auto:[Lc(t.framedFieldOfView,"deg")]}}},Mm=function(){var e=kc("0deg 75deg 105%")[0].terms,t=jc(e[0]),n=jc(e[1]);return function(e){var i=e[yp].model.idealCameraDistance;return{basis:[t,n,Lc(i,"m")],keywords:{auto:[null,null,Lc(105,"%")]}}}}(),Sm=function(e){var t=pm*e[yp].model.idealCameraDistance;return{basis:[Lc(-1/0,"rad"),Lc(Math.PI/8,"rad"),Lc(t,"m")],keywords:{auto:[null,null,null]}}},Tm=function(e){var t=Mm(e),n=new zf([],t).evaluate()[2];return{basis:[Lc(1/0,"rad"),Lc(Math.PI-Math.PI/8,"rad"),Lc(n,"m")],keywords:{auto:[null,null,null]}}},Em=function(e){var t=e[yp].model.boundingBox.getCenter(new te);return{basis:[Lc(t.x,"m"),Lc(t.y,"m"),Lc(t.z,"m")],keywords:{auto:[null,null,null]}}},Am=Math.PI/2,Lm=Math.PI/3,km=Am/2,Rm=2*Math.PI,Om=Symbol("controls"),Cm=Symbol("promptElement"),Pm=Symbol("promptAnimatedContainer"),Im=Symbol("deferInteractionPrompt"),Dm=Symbol("updateAria"),Nm=Symbol("updateCameraForRadius"),Fm=Symbol("blurHandler"),Um=Symbol("focusHandler"),zm=Symbol("changeHandler"),jm=Symbol("pointerChangeHandler"),Bm=Symbol("onBlur"),Hm=Symbol("onFocus"),Gm=Symbol("onChange"),Vm=Symbol("onPointerChange"),Wm=Symbol("waitingToPromptUser"),qm=Symbol("userHasInteracted"),Xm=Symbol("promptElementVisibleTime"),Ym=Symbol("lastPromptOffset"),Jm=Symbol("focusedTime"),Zm=Symbol("zoomAdjustedFieldOfView"),Km=Symbol("lastSpherical"),Qm=Symbol("jumpCamera"),$m=Symbol("initialized"),ev=Symbol("maintainThetaPhi"),tv=Symbol("syncCameraOrbit"),nv=Symbol("syncFieldOfView"),iv=Symbol("syncCameraTarget"),rv=Symbol("syncMinCameraOrbit"),av=Symbol("syncMaxCameraOrbit"),ov=Symbol("syncMinFieldOfView"),sv=Symbol("syncMaxFieldOfView"),lv=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},cv=Symbol("currentEnvironmentMap"),uv=Symbol("applyEnvironmentMap"),hv=Symbol("updateEnvironment"),dv=Symbol("cancelEnvironmentUpdate"),pv=Symbol("onPreload"),fv=Symbol("modelViewerStatusInstance"),mv=Symbol("updateStatus");Xf=fv,Yf=mv;var vv,gv,yv,bv,xv=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},wv="auto",_v=new(function(e){Object(p.a)(i,e);var t,n=b(i);function i(){var e;Object(h.a)(this,i),(e=n.call(this))[Xf]=null,e.registeredInstanceStatuses=new Map,e.loadingPromises=[],e.statusElement=document.createElement("p"),e.statusUpdateInProgress=!1,e[Yf]=Ku((function(){return e.updateStatus()}),100);var t=Object(o.a)(e).statusElement,r=t.style;return t.setAttribute("role","status"),t.classList.add("screen-reader-only"),r.top=r.left="0",r.pointerEvents="none",e}return Object(d.a)(i,[{key:"registerInstance",value:function(e){if(!this.registeredInstanceStatuses.has(e)){var t=function(){},n=!1===e.loaded&&!!e.src,i=new Promise((function(i){if(n){var r=function t(){i(),e.removeEventListener("load",t),e.removeEventListener("error",t)};e.addEventListener("load",r),e.addEventListener("error",r),t=r}else i()}));this.registeredInstanceStatuses.set(e,{onUnregistered:t}),this.loadingPromises.push(i),null==this.modelViewerStatusInstance&&(this.modelViewerStatusInstance=e)}}},{key:"unregisterInstance",value:function(e){if(this.registeredInstanceStatuses.has(e)){var t=this.registeredInstanceStatuses,n=t.get(e);t.delete(e),n.onUnregistered(),this.modelViewerStatusInstance===e&&(this.modelViewerStatusInstance=t.size>0?function(e){if(null!=e.keys)return e.keys().next().value||null;var t=null;try{e.forEach((function(e,n,i){throw t=n,new Error}))}catch(e){}return t}(t):null)}}},{key:"updateStatus",value:(t=Object(u.a)(c.a.mark((function e(){var t;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.statusUpdateInProgress||0===this.loadingPromises.length){e.next=10;break}this.statusElement.textContent="This page includes one or more 3D models that are loading",this.statusUpdateInProgress=!0,this.dispatchEvent({type:"initial-status-announced"});case 2:if(!this.loadingPromises.length){e.next=9;break}return t=this.loadingPromises,this.loadingPromises=[],e.next=7,Promise.all(t);case 7:e.next=2;break;case 9:this.statusElement.textContent="All 3D models in the page have loaded",this.statusUpdateInProgress=!1,this.dispatchEvent({type:"finished-loading-announced"});case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"modelViewerStatusInstance",get:function(){return this[fv]},set:function(e){if(this[fv]!==e){var t=this.statusElement;null!=e&&null!=e.shadowRoot?e.shadowRoot.appendChild(t):null!=t.parentNode&&t.parentNode.removeChild(t),this[fv]=e,this[mv]()}}}]),i}(j)),Mv=Symbol("defaultProgressBarElement"),Sv=Symbol("defaultProgressMaskElement"),Tv=Symbol("posterContainerElement"),Ev=Symbol("defaultPosterElement"),Av=Symbol("posterDismissalSource"),Lv=Symbol("showPoster"),kv=Symbol("hidePoster"),Rv=Symbol("modelIsRevealed"),Ov=Symbol("updateProgressBar"),Cv=Symbol("lastReportedProgress"),Pv=Symbol("transitioned"),Iv=Symbol("ariaLabelCallToAction"),Dv=Symbol("clickHandler"),Nv=Symbol("keydownHandler"),Fv=Symbol("processHandler"),Uv=Symbol("onClick"),zv=Symbol("onKeydown"),jv=Symbol("onProgress"),Bv=Symbol("ownerModel"),Hv=function(){function e(t){if(Object(h.a)(this,e),null==t)throw new Error("Illegal constructor");this[Bv]=t.model}return Object(d.a)(e,[{key:"ownerModel",get:function(){return this[Bv]}}]),e}(),Gv=Symbol("kernel"),Vv=Symbol("uri"),Wv=Symbol("name"),qv=Symbol("pbrMetallicRoughness"),Xv=Symbol("normalTexture"),Yv=Symbol("occlusionTexture"),Jv=Symbol("emissiveTexture"),Zv=Symbol("kernel"),Kv=Symbol("name");vv=Xv,gv=Yv,yv=Jv;var Qv,$v,eg=Symbol("material"),tg=Symbol("kernel");bv=eg;var ng,ig,rg=Symbol("kernel"),ag=Symbol("baseColorFactor"),og=Symbol("baseColorTexture"),sg=Symbol("metallicRoughnessTexture"),lg=Symbol("metallicFactor"),cg=Symbol("roughnessFactor");Qv=og,$v=sg;var ug,hg=Symbol("kernel"),dg=Symbol("minFilter"),pg=Symbol("magFilter"),fg=Symbol("wrapS"),mg=Symbol("wrapT"),vg=Symbol("name");ng=dg,ig=pg;var gg,yg,bg=Symbol("kernel"),xg=Symbol("texture");ug=xg;var wg,_g,Mg,Sg,Tg,Eg,Ag=Symbol("kernel"),Lg=Symbol("source"),kg=Symbol("sampler"),Rg=Symbol("name");gg=Lg,yg=kg;var Og,Cg={model:function(e){Object(p.a)(n,e);var t=b(n);function n(e,i){var r;Object(h.a)(this,n),(r=t.call(this,e))[bv]=Object.freeze([]),r[tg]=e;var a,o=g(i.materials);try{for(o.s();!(a=o.n()).done;){var s=a.value;r[tg].deserialize("material",s)}}catch(l){o.e(l)}finally{o.f()}return r}return Object(d.a)(n,[{key:"materials",get:function(){return this[tg].getElementsByType("material")}},{key:"ownerModel",get:function(){return this}}]),n}(Hv),material:function(e){Object(p.a)(n,e);var t=b(n);function n(e,i){var r;Object(h.a)(this,n),(r=t.call(this,e))[vv]=null,r[gv]=null,r[yv]=null,r[Zv]=e,null!=i.name&&(r[Kv]=i.name);var a=i.pbrMetallicRoughness,o=i.normalTexture,s=i.occlusionTexture,l=i.emissiveTexture;return r[qv]=e.deserialize("pbr-metallic-roughness",a),null!=o&&(r[Xv]=e.deserialize("texture-info",o)),null!=s&&(r[Yv]=e.deserialize("texture-info",s)),null!=l&&(r[Jv]=e.deserialize("texture-info",l)),r}return Object(d.a)(n,[{key:"pbrMetallicRoughness",get:function(){return this[qv]}},{key:"normalTexture",get:function(){return this[Xv]}},{key:"occlusionTexture",get:function(){return this[Yv]}},{key:"emissiveTexture",get:function(){return this[Jv]}},{key:"name",get:function(){return this[Kv]}}]),n}(Hv),"pbr-metallic-roughness":function(e){Object(p.a)(a,e);var t,n,i,r=b(a);function a(e,t){var n;Object(h.a)(this,a),(n=r.call(this,e))[Qv]=null,n[$v]=null,n[rg]=e,n[ag]=Object.freeze(t.baseColorFactor),n[lg]=t.metallicFactor,n[cg]=t.roughnessFactor;var i=t.baseColorTexture,o=t.metallicRoughnessTexture;return null!=i&&(n[og]=e.deserialize("texture-info",i)),null!=o&&(n[sg]=e.deserialize("texture-info",o)),n}return Object(d.a)(a,[{key:"setBaseColorFactor",value:(i=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this[rg].mutate(this,"baseColorFactor",t);case 2:this[ag]=Object.freeze(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"setMetallicFactor",value:(n=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this[rg].mutate(this,"metallicFactor",t);case 2:this[lg]=t;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setRoughnessFactor",value:(t=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this[rg].mutate(this,"roughnessFactor",t);case 2:this[cg]=t;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"baseColorFactor",get:function(){return this[ag]}},{key:"metallicFactor",get:function(){return this[lg]}},{key:"roughnessFactor",get:function(){return this[cg]}},{key:"baseColorTexture",get:function(){return this[og]}},{key:"metallicRoughnessTexture",get:function(){return this[sg]}}]),a}(Hv),image:function(e){Object(p.a)(i,e);var t,n=b(i);function i(e,t){var r;return Object(h.a)(this,i),(r=n.call(this,e))[Gv]=e,r[Vv]=t.uri||null,null!=t.name&&(r[Wv]=t.name),r}return Object(d.a)(i,[{key:"setURI",value:(t=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this[Gv].mutate(this,"uri",t);case 2:this[Vv]=t;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"name",get:function(){return this[Wv]}},{key:"type",get:function(){return null!=this.uri?"external":"embedded"}},{key:"uri",get:function(){return this[Vv]}}]),i}(Hv),sampler:function(e){Object(p.a)(o,e);var t,n,i,r,a=b(o);function o(e,t){var n;return Object(h.a)(this,o),(n=a.call(this,e))[ng]=null,n[ig]=null,n[hg]=e,null!=t.name&&(n[vg]=t.name),n[dg]=t.minFilter||null,n[pg]=t.magFilter||null,n[fg]=t.wrapS||10497,n[mg]=t.wrapT||10497,n}return Object(d.a)(o,[{key:"setMinFilter",value:(r=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this[hg].mutate(this,"minFilter",t);case 2:this[dg]=t;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setMagFilter",value:(i=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this[hg].mutate(this,"magFilter",t);case 2:this[pg]=t;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"setWrapS",value:(n=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this[hg].mutate(this,"wrapS",t);case 2:this[fg]=t;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setWrapT",value:(t=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this[hg].mutate(this,"wrapT",t);case 2:this[mg]=t;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"name",get:function(){return this[vg]}},{key:"minFilter",get:function(){return this[dg]}},{key:"magFilter",get:function(){return this[pg]}},{key:"wrapS",get:function(){return this[fg]}},{key:"wrapT",get:function(){return this[mg]}}]),o}(Hv),texture:function(e){Object(p.a)(r,e);var t,n,i=b(r);function r(e,t){var n;Object(h.a)(this,r),(n=i.call(this,e))[gg]=null,n[yg]=null,n[Ag]=e;var a=t.sampler,o=t.source,s=t.name;return null!=s&&(n[Rg]=s),null!=a&&(n[kg]=e.deserialize("sampler",a)),null!=o&&(n[Lg]=e.deserialize("image",o)),n}return Object(d.a)(r,[{key:"setSampler",value:(n=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this[Ag].mutate(this,"sampler",t);case 2:this[kg]=t;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setSource",value:(t=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this[Ag].mutate(this,"source",t);case 2:this[Lg]=t;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"name",get:function(){return this[Rg]}},{key:"sampler",get:function(){return this[kg]}},{key:"source",get:function(){return this[Lg]}}]),r}(Hv),"texture-info":function(e){Object(p.a)(i,e);var t,n=b(i);function i(e,t){var r;Object(h.a)(this,i),(r=n.call(this,e))[ug]=null,r[bg]=e;var a=t.texture;return null!=a&&(r[xg]=e.deserialize("texture",a)),r}return Object(d.a)(i,[{key:"setTexture",value:(t=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this[bg].mutate(this,"texture",t);case 2:this[xg]=t;case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"texture",get:function(){return this[xg]}}]),i}(Hv)},Pg=Symbol("onMessageEvent"),Ig=Symbol("port"),Dg=Symbol("model"),Ng=Symbol("elementsByLocalId"),Fg=Symbol("localIdsByElement"),Ug=Symbol("elementsByType"),zg=Symbol("pendingMutations"),jg=Symbol("nextMutationId"),Bg=function(){function e(t,n){var i=this;Object(h.a)(this,e),this[wg]=new Map,this[_g]=new Map,this[Mg]=new Map,this[Sg]=new Map,this[Tg]=0,this[Eg]=function(e){var t=e.data;switch(t&&t.type){case 4:var n=t,r=n.applied,a=n.mutationId,o=i[zg].get(a);i[zg].delete(a),null!=o&&(r?o.resolve():o.reject())}};for(var r=0,a=new Array("model","material","pbr-metallic-roughness","sampler","image","texture","texture-info");r<a.length;r++){var o=a[r];this[Ug].set(o,new Set)}this[Ig]=t,this[Ig].addEventListener("message",this[Pg]),this[Ig].start(),this[Dg]=this.deserialize("model",n)}var t;return Object(d.a)(e,[{key:"mutate",value:(t=Object(u.a)(c.a.mark((function e(t,n,i){var r,a=this;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this[Fg].has(t)){e.next=2;break}throw new Error("Cannot mutate unknown element");case 2:return r=this[Fg].get(t),e.abrupt("return",(i instanceof Hv&&(i=this[Fg].get(i)),new Promise((function(e,t){var o=a[jg]++;a[Ig].postMessage({type:6,id:r,property:n,value:i,mutationId:o}),a[zg].set(o,{resolve:e,reject:t})}))));case 4:case"end":return e.stop()}}),e,this)}))),function(e,n,i){return t.apply(this,arguments)})},{key:"deserialize",value:function(e,t){var n=t.id;if(this[Ng].has(n))return this[Ng].get(n);var i=Cg[e];if(null==i)throw new Error("Cannot deserialize unknown type: "+e);var r=new i(this,t);return this[Ng].set(n,r),this[Fg].set(r,n),this[Ug].get(e).add(r),r}},{key:"getElementsByType",value:function(e){return this[Ug].has(e)?Array.from(this[Ug].get(e)):[]}},{key:"deactivate",value:function(){this[Ig].close(),this[Ig].removeEventListener("message",this[Pg])}},{key:"model",get:function(){return this[Dg]}}]),e}();wg=Ng,_g=Fg,Mg=Ug,Sg=zg,Tg=jg,Eg=Pg;var Hg=Symbol("modelGraft"),Gg=Symbol("port"),Vg=Symbol("onMessageEvent"),Wg=function(){function e(t,n){var i=this;Object(h.a)(this,e),this[Og]=function(){var e=Object(u.a)(c.a.mark((function e(t){var n,r,a;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=t.data)||!n.type||6!==n.type){e.next=11;break}return r=!1,a=n.mutationId,e.prev=4,e.next=7,i[Hg].mutate(n.id,n.property,n.value);case 7:r=!0;case 8:return e.prev=8,i[Gg].postMessage({type:4,applied:r,mutationId:a}),e.finish(8);case 11:case"end":return e.stop()}}),e,null,[[4,,8,11]])})));return function(t){return e.apply(this,arguments)}}(),this[Hg]=t,this[Gg]=n,this[Gg].addEventListener("message",this[Vg]),this[Gg].start()}return Object(d.a)(e,[{key:"dispose",value:function(){this[Gg].removeEventListener("message",this[Vg]),this[Gg].close()}}]),e}();Og=Vg;var qg,Xg,Yg=function(){var e=0;return function(){return e++}}(),Jg=Symbol("callbacks"),Zg=Symbol("visitMesh"),Kg=Symbol("visitElement"),Qg=Symbol("visitNode"),$g=Symbol("visitScene"),ey=Symbol("visitMaterial"),ty=function(){function e(t){Object(h.a)(this,e),this[Jg]=t}return Object(d.a)(e,[{key:"visit",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=!!n.allScenes,r=!!n.sparse,a=i?e.scenes||[]:e.scenes&&null!=e.scene?[e.scenes[e.scene]]:[],o={hierarchy:[],visited:new Set,sparse:r,gltf:e},s=g(a);try{for(s.s();!(t=s.n()).done;){var l=t.value;this[$g](e.scenes.indexOf(l),o)}}catch(c){s.e(c)}finally{s.f()}}},{key:Kg,value:function(e,t,n,i,r){if(null!=t){var a=t[e],o=n.sparse,s=n.hierarchy,l=n.visited;null!=a&&(o&&l.has(a)||(l.add(a),s.push(a),null!=i&&i(a,e,s),null!=r&&r(a),s.pop()))}}},{key:$g,value:function(e,t){var n=this,i=t.gltf,r=this[Jg].scene;this[Kg](e,i.scenes,t,r,(function(e){if(null!=e.nodes){var i,r=g(e.nodes);try{for(r.s();!(i=r.n()).done;){var a=i.value;n[Qg](a,t)}}catch(o){r.e(o)}finally{r.f()}}}))}},{key:Qg,value:function(e,t){var n=this,i=t.gltf,r=this[Jg].node;this[Kg](e,i.nodes,t,r,(function(e){if(null!=e.mesh&&n[Zg](e.mesh,t),null!=e.children){var i,r=g(e.children);try{for(r.s();!(i=r.n()).done;){var a=i.value;n[Qg](a,t)}}catch(o){r.e(o)}finally{r.f()}}}))}},{key:Zg,value:function(e,t){var n=this,i=t.gltf,r=this[Jg].mesh;this[Kg](e,i.meshes,t,r,(function(e){var i,r=g(e.primitives);try{for(r.s();!(i=r.n()).done;){var a=i.value;null!=a.material&&n[ey](a.material,t)}}catch(o){r.e(o)}finally{r.f()}}))}},{key:ey,value:function(e,t){var n=t.gltf,i=this[Jg].material;this[Kg](e,n.materials,t,i)}}]),e}(),ny=Symbol("correlatedObjects"),iy=Symbol("sourceObject"),ry=Symbol("graft"),ay=Symbol("id"),oy=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Object(h.a)(this,e),this[qg]=Yg(),this[ry]=t,this[iy]=n,this[ny]=i,t.adopt(this)}return Object(d.a)(e,[{key:"mutate",value:function(e,t){throw new Error("Mutation not implemented for this element")}},{key:"toJSON",value:function(){var e={id:this[ay]},t=this.name;return null!=t&&(e.name=t),e}},{key:"ownerModel",get:function(){return this[ry].model}},{key:"internalID",get:function(){return this[ay]}},{key:"name",get:function(){return this[iy].name||null}},{key:"correlatedObjects",get:function(){return this[ny]}},{key:"sourceObject",get:function(){return this[iy]}}]),e}();qg=ay;var sy=new rs,ly=Symbol("threeTextures"),cy=Symbol("bufferViewImages"),uy=function(e){Object(p.a)(i,e);var t,n=b(i);function i(e,t,r){var a;if(Object(h.a)(this,i),(a=n.call(this,e,t,r))[Xg]=new WeakMap,null!=t.bufferView){var o,s=g(r);try{for(s.s();!(o=s.n()).done;){var l=o.value;a[cy].set(l,l.image)}}catch(c){s.e(c)}finally{s.f()}}return Object(f.a)(a)}return Object(d.a)(i,[{key:"mutate",value:(t=Object(u.a)(c.a.mark((function e(t,n){var i,r,a,o;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=null,"uri"===t){e.next=3;break}throw new Error('Cannot configure property "'.concat(t,'" on Image'));case 3:if(e.t0=null!=n,!e.t0){e.next=8;break}return e.next=7,new Promise((function(e,t){sy.load(n,e,void 0,t)}));case 7:i=e.sent;case 8:r=g(this[ly]);try{for(r.s();!(a=r.n()).done;)o=a.value,null==i&&null!=this.sourceObject.bufferView?o.image=this[cy].get(o):o.image=i,o.needsUpdate=!0}catch(s){r.e(s)}finally{r.f()}case 10:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"toJSON",value:function(){var e=Object(a.a)(Object(m.a)(i.prototype),"toJSON",this).call(this),t=this.sourceObject.uri;return null!=t&&(e.uri=t),e}},{key:ly,get:function(){return this[ny]}}]),i}(oy);Xg=cy;var hy,dy,py,fy=function(){var e=[9728,9729,9984,9985,9986,9987];return function(t){return e.indexOf(t)>-1}}(),my=function(){var e=[9728,9729];return function(t){return e.indexOf(t)>-1}}(),vy=function(){var e=[33071,33648,10497];return function(t){return e.indexOf(t)>-1}}(),gy={minFilter:9987,magFilter:9729,wrapS:10497,wrapT:10497},yy=Symbol("threeTextures"),by=function(e){Object(p.a)(i,e);var t,n=b(i);function i(e,t,r){return Object(h.a)(this,i),n.call(this,e,t,r)}return Object(d.a)(i,[{key:yy,get:function(){return this[ny]}}]),Object(d.a)(i,[{key:"mutate",value:(t=Object(u.a)(c.a.mark((function e(t,n){var i,r,a,o,s,l,u;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=this.sourceObject,null!=n){if(function(e,t){switch(e){case"minFilter":return fy(t);case"magFilter":return my(t);case"wrapS":case"wrapT":return vy(t);default:throw new Error('Cannot configure property "'.concat(e,'" on Sampler'))}}(t,n)){i[t]=n,r=g(this[yy]);try{for(r.s();!(a=r.n()).done;)(o=a.value)[t]=n,o.needsUpdate=!0}catch(c){r.e(c)}finally{r.f()}}}else if(t in i){delete i[t],s=g(this[yy]);try{for(s.s();!(l=s.n()).done;)(u=l.value)[t]=gy[t],u.needsUpdate=!0}catch(c){s.e(c)}finally{s.f()}}case 2:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"toJSON",value:function(){var e=Object(a.a)(Object(m.a)(i.prototype),"toJSON",this).call(this),t=this.sourceObject,n=t.minFilter,r=t.magFilter,o=t.wrapS,s=t.wrapT;return null!=n&&(e.minFilter=n),null!=r&&(e.magFilter=r),10497!==o&&(e.wrapS=o),10497!==s&&(e.wrapT=s),e}}]),i}(oy),xy=Symbol("source"),wy=Symbol("sampler"),_y=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i,r){var a;Object(h.a)(this,n),(a=t.call(this,e,i,r))[hy]=null,a[dy]=null;var o=e.correlatedSceneGraph.gltf,s=i.sampler,l=i.source;if(null!=s){var c=o.samplers&&o.samplers[s];null!=c&&(a[wy]=new by(e,c,r))}if(null!=l){var u=o.images&&o.images[l];null!=u&&(a[xy]=new uy(e,u,r))}return a}return Object(d.a)(n,[{key:"toJSON",value:function(){var e=Object(a.a)(Object(m.a)(n.prototype),"toJSON",this).call(this),t=this.sampler,i=this.source;return null!=t&&(e.sampler=t.toJSON()),null!=i&&(e.source=i.toJSON()),e}},{key:"sampler",get:function(){return this[wy]}},{key:"source",get:function(){return this[xy]}}]),n}(oy);hy=xy,dy=wy;var My,Sy,Ty=Symbol("texture"),Ey=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i,r){var a;Object(h.a)(this,n),(a=t.call(this,e,i,r))[py]=null;var o=e.correlatedSceneGraph.gltf,s=i.index,l=null!=s&&null!=o.textures?o.textures[s]:null;return null!=l&&(a[Ty]=new _y(e,l,r)),a}return Object(d.a)(n,[{key:"toJSON",value:function(){var e=Object(a.a)(Object(m.a)(n.prototype),"toJSON",this).call(this),t=this.texture;return null!=t&&(e.texture=t.toJSON()),e}},{key:"texture",get:function(){return this[Ty]}}]),n}(oy);py=Ty;var Ay,Ly,ky,Ry,Oy,Cy,Py=Symbol("threeMaterials"),Iy=Symbol("baseColorTexture"),Dy=Symbol("metallicRoughnessTexture"),Ny=function(e){Object(p.a)(i,e);var t,n=b(i);function i(e,t,r){var a;Object(h.a)(this,i),(a=n.call(this,e,t,r))[My]=null,a[Sy]=null;var o,s=t.baseColorTexture,l=t.metallicRoughnessTexture,c=new Set,u=new Set,d=g(r);try{for(d.s();!(o=d.n()).done;){var p=o.value;null!=s&&null!=p.map&&c.add(p.map),null!=l&&null!=p.metalnessMap&&u.add(p.metalnessMap)}}catch(f){d.e(f)}finally{d.f()}return c.size>0&&(a[Iy]=new Ey(e,s,c)),u.size>0&&(a[Dy]=new Ey(e,l,u)),a}return Object(d.a)(i,[{key:"mutate",value:(t=Object(u.a)(c.a.mark((function e(t,n){var i,r,a,o,s,l,u,h;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(["baseColorFactor","metallicFactor","roughnessFactor"].includes(t)){e.next=2;break}throw new Error("Cannot mutate ".concat(t," on PBRMetallicRoughness"));case 2:e.t0=t,e.next="baseColorFactor"===e.t0?5:"metallicFactor"===e.t0?8:"roughnessFactor"===e.t0?11:13;break;case 5:i=g(this[Py]);try{for(i.s();!(r=i.n()).done;)(a=r.value).color.fromArray(n),a.opacity=n[3],o=this[iy],1===n&&1===n&&1===n&&1===n?delete o.baseColorFactor:o.baseColorFactor=n}catch(c){i.e(c)}finally{i.f()}return e.abrupt("break",13);case 8:s=g(this[Py]);try{for(s.s();!(l=s.n()).done;)l.value.metalness=n,this[iy].metallicFactor=n}catch(c){s.e(c)}finally{s.f()}return e.abrupt("break",13);case 11:u=g(this[Py]);try{for(u.s();!(h=u.n()).done;)h.value.roughness=n,this[iy].roughnessFactor=n}catch(c){u.e(c)}finally{u.f()}case 13:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"toJSON",value:function(){var e=Object(a.a)(Object(m.a)(i.prototype),"toJSON",this).call(this),t=this.baseColorTexture,n=this.metallicRoughnessTexture,r=this.baseColorFactor,o=this.roughnessFactor,s=this.metallicFactor;return null!=t&&(e.baseColorTexture=t.toJSON()),null!=r&&(e.baseColorFactor=r),null!=s&&(e.metallicFactor=s),null!=o&&(e.roughnessFactor=o),null!=n&&(e.metallicRoughnessTexture=n.toJSON()),e}},{key:(My=Iy,Sy=Dy,Py),get:function(){return this[ny]}},{key:"baseColorFactor",get:function(){return this.sourceObject.baseColorFactor||[1,1,1,1]}},{key:"metallicFactor",get:function(){return this.sourceObject.metallicFactor||0}},{key:"roughnessFactor",get:function(){return this.sourceObject.roughnessFactor||0}},{key:"baseColorTexture",get:function(){return this[Iy]}},{key:"metallicRoughnessTexture",get:function(){return this[Dy]}}]),i}(oy),Fy=Symbol("pbrMetallicRoughness"),Uy=Symbol("normalTexture"),zy=Symbol("occlusionTexture"),jy=Symbol("emissiveTexture"),By=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i,r){var a;Object(h.a)(this,n),(a=t.call(this,e,i,r))[Ay]=null,a[Ly]=null,a[ky]=null,a[Ry]=null;var o=i.pbrMetallicRoughness,s=i.normalTexture,l=i.occlusionTexture,c=i.emissiveTexture;null!=o&&(a[Fy]=new Ny(e,o,r));var u,d=new Set,p=new Set,f=new Set,m=g(r);try{for(m.s();!(u=m.n()).done;){var v=u.value,y=v.normalMap,b=v.aoMap,x=v.emissiveMap;null!=s&&null!=y&&d.add(y),null!=l&&null!=b&&p.add(b),null!=c&&null!=x&&f.add(x)}}catch(w){m.e(w)}finally{m.f()}return d.size>0&&(a[Uy]=new Ey(e,s,d)),p.size>0&&(a[zy]=new Ey(e,l,p)),f.size>0&&(a[jy]=new Ey(e,c,f)),a}return Object(d.a)(n,[{key:"toJSON",value:function(){var e=Object(a.a)(Object(m.a)(n.prototype),"toJSON",this).call(this),t=this.pbrMetallicRoughness,i=this.normalTexture,r=this.occlusionTexture,o=this.emissiveTexture;return null!=t&&(e.pbrMetallicRoughness=t.toJSON()),null!=i&&(e.normalTexture=i.toJSON()),null!=r&&(e.occlusionTexture=r.toJSON()),null!=o&&(e.emissiveTexture=o.toJSON()),e}},{key:"pbrMetallicRoughness",get:function(){return this[Fy]}},{key:"normalTexture",get:function(){return this[Uy]}},{key:"occlusionTexture",get:function(){return this[zy]}},{key:"emissiveTexture",get:function(){return this[jy]}}]),n}(oy);Ay=Fy,Ly=Uy,ky=zy,Ry=jy;var Hy,Gy,Vy=Symbol("modelUri"),Wy=Symbol("materials"),qy=function(e){Object(p.a)(n,e);var t=b(n);function n(e,i,r){var a;return Object(h.a)(this,n),(a=t.call(this,e,r.gltf))[Oy]="",a[Cy]=[],a[Vy]=i,new ty({material:function(t){a[Wy].push(new By(e,t,r.gltfElementMap.get(t)))}}).visit(r.gltf,{sparse:!0}),a}return Object(d.a)(n,[{key:"toJSON",value:function(){var e=Object(a.a)(Object(m.a)(n.prototype),"toJSON",this).call(this);return e.modelUri=this[Vy],e.materials=this[Wy].map((function(e){return e.toJSON()})),e}},{key:"materials",get:function(){return this[Wy]}}]),n}(oy);Oy=Vy,Cy=Wy;var Xy=Symbol("model"),Yy=Symbol("correlatedSceneGraph"),Jy=Symbol("elementsByInternalId"),Zy=Symbol("eventDelegate"),Ky=function(){function e(t,n){var i=this;Object(h.a)(this,e),this[Hy]=document.createDocumentFragment(),this.addEventListener=function(){var e;return(e=i[Zy]).addEventListener.apply(e,arguments)},this.removeEventListener=function(){var e;return(e=i[Zy]).removeEventListener.apply(e,arguments)},this.dispatchEvent=function(){var e;return(e=i[Zy]).dispatchEvent.apply(e,arguments)},this[Gy]=new Map,this[Yy]=n,this[Xy]=new qy(this,t,n)}var t;return Object(d.a)(e,[{key:"getElementByInternalId",value:function(e){var t=this[Jy].get(e);return null==t?null:t}},{key:"adopt",value:function(e){this[Jy].set(e.internalID,e)}},{key:"mutate",value:(t=Object(u.a)(c.a.mark((function e(t,n,i){var r;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.getElementByInternalId(t),e.next=3,r.mutate(n,i);case 3:this.dispatchEvent(new CustomEvent("mutation",{detail:{element:r}}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,n,i){return t.apply(this,arguments)})},{key:"correlatedSceneGraph",get:function(){return this[Yy]}},{key:"model",get:function(){return this[Xy]}}]),e}();Hy=Zy,Gy=Jy;var Qy={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987,1001:33071,1e3:10497,1002:33648},$y={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},eb=function(){};eb.prototype={constructor:eb,parse:function(e,t,n){(n=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],forcePowerOfTwoTextures:!1,includeCustomExtensions:!1},n)).animations.length>0&&(n.trs=!0);var i,r={asset:{version:"2.0",generator:"GLTFExporter"}},a=0,o=[],s=[],l=new Map,c=[],u={},h={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},d=new Map,p=0;function f(e){return d.has(e)||d.set(e,p++),d.get(e)}function m(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))}function v(e){return 4*Math.ceil(e/4)}function g(e,t){t=t||0;var n=v(e.byteLength);if(n!==e.byteLength){var i=new Uint8Array(n);if(i.set(new Uint8Array(e)),0!==t)for(var r=e.byteLength;r<n;r++)i[r]=t;return i.buffer}return e}function y(e,t){if(0!==Object.keys(e.userData).length)try{var i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){for(var r in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[r]=i.gltfExtensions[r],u[r]=!0;delete i.gltfExtensions}Object.keys(i).length>0&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}function b(e,t){var n=!1,i={};0===t.offset.x&&0===t.offset.y||(i.offset=t.offset.toArray(),n=!0),0!==t.rotation&&(i.rotation=t.rotation,n=!0),1===t.repeat.x&&1===t.repeat.y||(i.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,u.KHR_texture_transform=!0)}function x(e){return r.buffers||(r.buffers=[{byteLength:0}]),o.push(e),0}function w(e,t,i,o){var s;if(e.array.constructor===Float32Array)s=5126;else if(e.array.constructor===Uint32Array)s=5125;else if(e.array.constructor===Uint16Array)s=5123;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");s=5121}if(void 0===i&&(i=0),void 0===o&&(o=e.count),n.truncateDrawRange&&void 0!==t&&null===t.index){var l=i+o,c=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;i=Math.max(i,t.drawRange.start),(o=Math.min(l,c)-i)<0&&(o=0)}if(0===o)return null;var u,h=function(e,t,n){for(var i={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},r=t;r<t+n;r++)for(var a=0;a<e.itemSize;a++){var o=e.array[r*e.itemSize+a];i.min[a]=Math.min(i.min[a],o),i.max[a]=Math.max(i.max[a],o)}return i}(e,i,o);void 0!==t&&(u=e===t.index?34963:34962);var d=function(e,t,n,i,o){var s;r.bufferViews||(r.bufferViews=[]),s=5121===t?1:5123===t?2:4;for(var l=v(i*e.itemSize*s),c=new DataView(new ArrayBuffer(l)),u=0,h=n;h<n+i;h++)for(var d=0;d<e.itemSize;d++){var p;e.itemSize>4?p=e.array[h*e.itemSize+d]:0===d?p=e.getX(h):1===d?p=e.getY(h):2===d?p=e.getZ(h):3===d&&(p=e.getW(h)),5126===t?c.setFloat32(u,p,!0):5125===t?c.setUint32(u,p,!0):5123===t?c.setUint16(u,p,!0):5121===t&&c.setUint8(u,p),u+=s}var f={buffer:x(c.buffer),byteOffset:a,byteLength:l};return void 0!==o&&(f.target=o),34962===o&&(f.byteStride=e.itemSize*s),a+=l,r.bufferViews.push(f),{id:r.bufferViews.length-1,byteLength:0}}(e,s,i,o,u),p={bufferView:d.id,byteOffset:d.byteOffset,componentType:s,count:o,max:h.max,min:h.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(p.normalized=!0),r.accessors||(r.accessors=[]),r.accessors.push(p),r.accessors.length-1}function _(e,t,o){h.images.has(e)||h.images.set(e,{});var l=h.images.get(e),c=1023===t?"image/png":"image/jpeg",u=c+":flipY/"+o.toString();if(void 0!==l[u])return l[u];r.images||(r.images=[]);var d={mimeType:c};if(n.embedImages){var p=i=i||document.createElement("canvas");p.width=Math.min(e.width,n.maxTextureSize),p.height=Math.min(e.height,n.maxTextureSize),n.forcePowerOfTwoTextures&&!function(e){return W.isPowerOfTwo(e.width)&&W.isPowerOfTwo(e.height)}(p)&&(console.warn("GLTFExporter: Resized non-power-of-two image.",e),p.width=W.floorPowerOfTwo(p.width),p.height=W.floorPowerOfTwo(p.height));var f=p.getContext("2d");!0===o&&(f.translate(0,p.height),f.scale(1,-1)),f.drawImage(e,0,0,p.width,p.height),!0===n.binary?s.push(new Promise((function(e){p.toBlob((function(t){(function(e){return r.bufferViews||(r.bufferViews=[]),new Promise((function(t){var n=new window.FileReader;n.readAsArrayBuffer(e),n.onloadend=function(){var e=g(n.result),i={buffer:x(e),byteOffset:a,byteLength:e.byteLength};a+=e.byteLength,r.bufferViews.push(i),t(r.bufferViews.length-1)}}))})(t).then((function(t){d.bufferView=t,e()}))}),c)}))):d.uri=p.toDataURL(c)}else d.uri=e.src;r.images.push(d);var m=r.images.length-1;return l[u]=m,m}function M(e){r.samplers||(r.samplers=[]);var t={magFilter:Qy[e.magFilter],minFilter:Qy[e.minFilter],wrapS:Qy[e.wrapS],wrapT:Qy[e.wrapT]};return r.samplers.push(t),r.samplers.length-1}function S(e){if(h.textures.has(e))return h.textures.get(e);r.textures||(r.textures=[]);var t={sampler:M(e),source:_(e.image,e.format,e.flipY)};e.name&&(t.name=e.name),r.textures.push(t);var n=r.textures.length-1;return h.textures.set(e,n),n}function T(e){if(h.materials.has(e))return h.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var t={pbrMetallicRoughness:{}};e.isMeshBasicMaterial?(t.extensions={KHR_materials_unlit:{}},u.KHR_materials_unlit=!0):e.isGLTFSpecularGlossinessMaterial?(t.extensions={KHR_materials_pbrSpecularGlossiness:{}},u.KHR_materials_pbrSpecularGlossiness=!0):e.isMeshStandardMaterial||console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");var n=e.color.toArray().concat([e.opacity]);if(m(n,[1,1,1,1])||(t.pbrMetallicRoughness.baseColorFactor=n),e.isMeshStandardMaterial?(t.pbrMetallicRoughness.metallicFactor=e.metalness,t.pbrMetallicRoughness.roughnessFactor=e.roughness):e.isMeshBasicMaterial?(t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9):(t.pbrMetallicRoughness.metallicFactor=.5,t.pbrMetallicRoughness.roughnessFactor=.5),e.isGLTFSpecularGlossinessMaterial){t.pbrMetallicRoughness.baseColorFactor&&(t.extensions.KHR_materials_pbrSpecularGlossiness.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);var i=[1,1,1];e.specular.toArray(i,0),t.extensions.KHR_materials_pbrSpecularGlossiness.specularFactor=i,t.extensions.KHR_materials_pbrSpecularGlossiness.glossinessFactor=e.glossiness}if(e.metalnessMap||e.roughnessMap)if(e.metalnessMap===e.roughnessMap){var a={index:S(e.metalnessMap)};b(a,e.metalnessMap),t.pbrMetallicRoughness.metallicRoughnessTexture=a}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(e.map){var o={index:S(e.map)};b(o,e.map),e.isGLTFSpecularGlossinessMaterial&&(t.extensions.KHR_materials_pbrSpecularGlossiness.diffuseTexture=o),t.pbrMetallicRoughness.baseColorTexture=o}if(e.isGLTFSpecularGlossinessMaterial&&e.specularMap){var s={index:S(e.specularMap)};b(s,e.specularMap),t.extensions.KHR_materials_pbrSpecularGlossiness.specularGlossinessTexture=s}if(e.emissive){var l=e.emissive.clone().multiplyScalar(e.emissiveIntensity).toArray();if(m(l,[0,0,0])||(t.emissiveFactor=l),e.emissiveMap){var c={index:S(e.emissiveMap)};b(c,e.emissiveMap),t.emissiveTexture=c}}if(e.normalMap){var d={index:S(e.normalMap)};e.normalScale&&-1!==e.normalScale.x&&(e.normalScale.x!==e.normalScale.y&&console.warn("THREE.GLTFExporter: Normal scale components are different, ignoring Y and exporting X."),d.scale=e.normalScale.x),b(d,e.normalMap),t.normalTexture=d}if(e.aoMap){var p={index:S(e.aoMap),texCoord:1};1!==e.aoMapIntensity&&(p.strength=e.aoMapIntensity),b(p,e.aoMap),t.occlusionTexture=p}e.transparent?t.alphaMode="BLEND":e.alphaTest>0&&(t.alphaMode="MASK",t.alphaCutoff=e.alphaTest),2===e.side&&(t.doubleSided=!0),""!==e.name&&(t.name=e.name),y(e,t),r.materials.push(t);var f=r.materials.length-1;return h.materials.set(e,f),f}function E(e){var t=[e.geometry.uuid];if(Array.isArray(e.material))for(var n=0,i=e.material.length;n<i;n++)t.push(e.material[n].uuid);else t.push(e.material.uuid);var a=t.join(":");if(h.meshes.has(a))return h.meshes.get(a);var o,s=e.geometry;o=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,s.isBufferGeometry||(console.warn("GLTFExporter: Exporting THREE.Geometry will increase file size. Use BufferGeometry instead."),s=(new Yt).setFromObject(e));var l={},c={},u=[],d=[],p={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},m=s.getAttribute("normal");void 0===m||function(e){if(h.attributesNormalized.has(e))return!1;for(var t=new te,n=0,i=e.count;n<i;n++)if(Math.abs(t.fromArray(e.array,3*n).length()-1)>5e-4)return!1;return!0}(m)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",function(e){if(h.attributesNormalized.has(e))return h.attributesNormalized.get(e);for(var t=e.clone(),n=new te,i=0,r=t.count;i<r;i++)n.fromArray(t.array,3*i),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),n.toArray(t.array,3*i);return h.attributesNormalized.set(e,t),t}(m)));var v=null;for(var g in s.attributes)if("morph"!==g.substr(0,5)){var b=s.attributes[g];if(g=p[g]||g.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(g)||(g="_"+g),h.attributes.has(f(b)))c[g]=h.attributes.get(f(b));else{v=null;var x=b.array;"JOINTS_0"!==g||x instanceof Uint16Array||x instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),v=new kt(new Uint16Array(x),b.itemSize,b.normalized));var _=w(v||b,s);null!==_&&(c[g]=_,h.attributes.set(f(b),_))}}if(void 0!==m&&s.setAttribute("normal",m),0===Object.keys(c).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){var M=[],S=[],E={};if(void 0!==e.morphTargetDictionary)for(var A in e.morphTargetDictionary)E[e.morphTargetDictionary[A]]=A;for(n=0;n<e.morphTargetInfluences.length;++n){var L={},k=!1;for(var g in s.morphAttributes)if("position"===g||"normal"===g){b=s.morphAttributes[g][n];var R=g.toUpperCase(),O=s.attributes[g];if(h.attributes.has(f(b)))L[R]=h.attributes.get(f(b));else{var C=b.clone();if(!s.morphTargetsRelative)for(var P=0,I=b.count;P<I;P++)C.setXYZ(P,b.getX(P)-O.getX(P),b.getY(P)-O.getY(P),b.getZ(P)-O.getZ(P));L[R]=w(C,s),h.attributes.set(f(O),L[R])}}else k||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),k=!0);d.push(L),M.push(e.morphTargetInfluences[n]),void 0!==e.morphTargetDictionary&&S.push(E[n])}l.weights=M,S.length>0&&(l.extras={},l.extras.targetNames=S)}var D=Array.isArray(e.material);if(D&&0===s.groups.length)return null;for(var N=D?e.material:[e.material],F=D?s.groups:[{materialIndex:0,start:void 0,count:void 0}],U=(n=0,F.length);n<U;n++){var z={mode:o,attributes:c};if(y(s,z),d.length>0&&(z.targets=d),null!==s.index){var j=f(s.index);void 0===F[n].start&&void 0===F[n].count||(j+=":"+F[n].start+":"+F[n].count),h.attributes.has(j)?z.indices=h.attributes.get(j):(z.indices=w(s.index,s,F[n].start,F[n].count),h.attributes.set(j,z.indices)),null===z.indices&&delete z.indices}var B=T(N[F[n].materialIndex]);null!==B&&(z.material=B),u.push(z)}l.primitives=u,r.meshes||(r.meshes=[]),r.meshes.push(l);var H=r.meshes.length-1;return h.meshes.set(a,H),H}function A(e,t){r.animations||(r.animations=[]);for(var n=(e=eb.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,i=[],a=[],o=0;o<n.length;++o){var s=n[o],c=bl.parseTrackName(s.name),u=bl.findNode(t,c.nodeName),h=$y[c.propertyName];if("bones"===c.objectName&&(u=!0===u.isSkinnedMesh?u.skeleton.getBoneByName(c.objectIndex):void 0),!u||!h)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',s.name),null;var d,p=s.values.length/s.times.length;h===$y.morphTargetInfluences&&(p/=u.morphTargetInfluences.length),!0===s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(d="CUBICSPLINE",p/=3):d=2300===s.getInterpolation()?"STEP":"LINEAR",a.push({input:w(new kt(s.times,1)),output:w(new kt(s.values,p)),interpolation:d}),i.push({sampler:a.length-1,target:{node:l.get(u),path:h}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:a,channels:i}),r.animations.length-1}function L(e){var t=r.nodes[l.get(e)],n=e.skeleton;if(void 0===n)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var a=[],o=new Float32Array(16*n.bones.length),s=0;s<n.bones.length;++s)a.push(l.get(n.bones[s])),n.boneInverses[s].toArray(o,16*s);return void 0===r.skins&&(r.skins=[]),r.skins.push({inverseBindMatrices:w(new kt(o,16)),joints:a,skeleton:l.get(i)}),t.skin=r.skins.length-1}function k(e){var t={};e.name&&(t.name=e.name),t.color=e.color.toArray(),t.intensity=e.intensity,e.isDirectionalLight?t.type="directional":e.isPointLight?(t.type="point",e.distance>0&&(t.range=e.distance)):e.isSpotLight&&(t.type="spot",e.distance>0&&(t.range=e.distance),t.spot={},t.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,t.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1.");var n=r.extensions.KHR_lights_punctual.lights;return n.push(t),n.length-1}function R(e){r.nodes||(r.nodes=[]);var t={};if(n.trs){var i=e.quaternion.toArray(),a=e.position.toArray(),o=e.scale.toArray();m(i,[0,0,0,1])||(t.rotation=i),m(a,[0,0,0])||(t.translation=a),m(o,[1,1,1])||(t.scale=o)}else e.matrixAutoUpdate&&e.updateMatrix(),m(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])||(t.matrix=e.matrix.elements);if(""!==e.name&&(t.name=String(e.name)),y(e,t),e.isMesh||e.isLine||e.isPoints){var s=E(e);null!==s&&(t.mesh=s)}else if(e.isCamera)t.camera=function(e){r.cameras||(r.cameras=[]);var t=e.isOrthographicCamera,n={type:t?"orthographic":"perspective"};return t?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:W.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),r.cameras.push(n),r.cameras.length-1}(e);else if(e.isDirectionalLight||e.isPointLight||e.isSpotLight)u.KHR_lights_punctual||(r.extensions=r.extensions||{},r.extensions.KHR_lights_punctual={lights:[]},u.KHR_lights_punctual=!0),t.extensions=t.extensions||{},t.extensions.KHR_lights_punctual={light:k(e)};else if(e.isLight)return console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e),null;if(e.isSkinnedMesh&&c.push(e),e.children.length>0){for(var h=[],d=0,p=e.children.length;d<p;d++){var f=e.children[d];if(f.visible||!1===n.onlyVisible){var v=R(f);null!==v&&h.push(v)}}h.length>0&&(t.children=h)}r.nodes.push(t);var g=r.nodes.length-1;return l.set(e,g),g}function O(e){r.scenes||(r.scenes=[],r.scene=0);var t={};""!==e.name&&(t.name=e.name),r.scenes.push(t);for(var i=[],a=0,o=e.children.length;a<o;a++){var s=e.children[a];if(s.visible||!1===n.onlyVisible){var l=R(s);null!==l&&i.push(l)}}i.length>0&&(t.nodes=i),y(e,t)}!function(e){e=e instanceof Array?e:[e];for(var t=[],i=0;i<e.length;i++)e[i]instanceof Ur?O(e[i]):t.push(e[i]);for(t.length>0&&function(e){var t=new Ur;t.name="AuxScene";for(var n=0;n<e.length;n++)t.children.push(e[n]);O(t)}(t),i=0;i<c.length;++i)L(c[i]);for(i=0;i<n.animations.length;++i)A(n.animations[i],e[0])}(e),Promise.all(s).then((function(){var e,i=new Blob(o,{type:"application/octet-stream"}),a=Object.keys(u);(a.length>0&&(r.extensionsUsed=a),r.buffers&&r.buffers.length>0&&(r.buffers[0].byteLength=i.size),!0===n.binary)?((e=new window.FileReader).readAsArrayBuffer(i),e.onloadend=function(){var n=g(e.result),i=new DataView(new ArrayBuffer(8));i.setUint32(0,n.byteLength,!0),i.setUint32(4,5130562,!0);var a=g(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t=new Uint8Array(new ArrayBuffer(e.length)),n=0,i=e.length;n<i;n++){var r=e.charCodeAt(n);t[n]=r>255?32:r}return t.buffer}(JSON.stringify(r)),32),o=new DataView(new ArrayBuffer(8));o.setUint32(0,a.byteLength,!0),o.setUint32(4,1313821514,!0);var s=new ArrayBuffer(12),l=new DataView(s);l.setUint32(0,1179937895,!0),l.setUint32(4,2,!0);var c=12+o.byteLength+a.byteLength+i.byteLength+n.byteLength;l.setUint32(8,c,!0);var u=new Blob([s,o,a,i,n],{type:"application/octet-stream"}),h=new window.FileReader;h.readAsArrayBuffer(u),h.onloadend=function(){t(h.result)}}):r.buffers&&r.buffers.length>0?((e=new window.FileReader).readAsDataURL(i),e.onloadend=function(){var n=e.result;r.buffers[0].uri=n,t(r)}):t(r)}))}},eb.Utils={insertKeyframe:function(e,t){var n,i=.001,r=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),o=new e.ValueBufferType(e.values.length+r),s=e.createInterpolant(new e.ValueBufferType(r));if(0===e.times.length){a[0]=t;for(var l=0;l<r;l++)o[l]=0;n=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<i)return 0;a[0]=t,a.set(e.times,1),o.set(s.evaluate(t),0),o.set(e.values,r),n=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<i)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),o.set(e.values,0),o.set(s.evaluate(t),e.values.length),n=a.length-1}else for(l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<i)return l;if(e.times[l]<t&&e.times[l+1]>t){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),o.set(e.values.slice(0,(l+1)*r),0),o.set(s.evaluate(t),(l+1)*r),o.set(e.values.slice((l+1)*r),(l+2)*r),n=l+1;break}}return e.times=a,e.values=o,n},mergeMorphTargetTracks:function(e,t){for(var n=[],i={},r=e.tracks,a=0;a<r.length;++a){var o=r[a],s=bl.parseTrackName(o.name),l=bl.findNode(t,s.nodeName);if("morphTargetInfluences"===s.propertyName&&void 0!==s.propertyIndex){if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(o=o.clone()).setInterpolation(2301)}var c,u=l.morphTargetInfluences.length,h=l.morphTargetDictionary[s.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+s.propertyIndex);if(void 0!==i[l.uuid]){var d=o.createInterpolant(new o.ValueBufferType(1));for(c=i[l.uuid],m=0;m<c.times.length;m++)c.values[m*u+h]=d.evaluate(c.times[m]);for(m=0;m<o.times.length;m++){var p=this.insertKeyframe(c,o.times[m]);c.values[p*u+h]=o.values[m]}}else{for(var f=new((c=o.clone()).ValueBufferType)(u*c.times.length),m=0;m<c.times.length;m++)f[m*u+h]=c.values[m];c.name=s.nodeName+".morphTargetInfluences",c.values=f,i[l.uuid]=c,n.push(c)}}else n.push(o)}return e.tracks=n,e}};var tb=Symbol("updateThreeSide"),nb=Symbol("currentGLTF"),ib=Symbol("modelGraft"),rb=Symbol("mainPort"),ab=Symbol("threePort"),ob=Symbol("manipulator"),sb=Symbol("modelKernel"),lb=Symbol("onModelChange"),cb=Symbol("onModelGraftMutation"),ub=function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},hb=Math.PI/32,db={basis:[Uc(Lc(hb,"rad"))],keywords:{auto:[null]}},pb=Symbol("autoRotateStartTime"),fb=Symbol("radiansPerSecond"),mb=Symbol("syncRotationRate"),vb=Symbol("cameraChangeHandler"),gb=Symbol("onCameraChange"),yb=function(e){var t,n,i,r;return function(e){Object(p.a)(s,e);var o=b(s);function s(){var e;Object(h.a)(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];(e=o.call.apply(o,[this].concat(l)))[t]=new Ac,e[n]=new Map,e[i]=function(t){t.forEach((function(t){t instanceof MutationRecord&&"childList"!==t.type||(t.addedNodes.forEach((function(t){e[Hp](t)})),t.removedNodes.forEach((function(t){e[Gp](t)})),e[bp]())}))},e[r]=new MutationObserver(e[jp]);var u=e[Up].domElement,d=u.style;return d.display="none",d.pointerEvents="none",d.position="absolute",d.top="0",e.shadowRoot.querySelector(".default").appendChild(u),e}return Object(d.a)(s,[{key:"connectedCallback",value:function(){Object(a.a)(Object(m.a)(s.prototype),"connectedCallback",this).call(this);for(var e=0;e<this.children.length;++e)this[Hp](this.children[e]);var t=self.ShadyDOM;null==t?this[Bp].observe(this,{childList:!0}):this[Bp]=t.observeChildren(this,this[jp])}},{key:"disconnectedCallback",value:function(){Object(a.a)(Object(m.a)(s.prototype),"disconnectedCallback",this).call(this);var e=self.ShadyDOM;null==e?this[Bp].disconnect():e.unobserveChildren(this[Bp])}},{key:"updateHotspot",value:function(e){var t=this[zp].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal))}},{key:"positionAndNormalFromPoint",value:function(e,t){var n=this[yp],i=n.width,r=n.height,a=n.model;Vp.set(e/i,t/r).multiplyScalar(2).subScalar(1),Vp.y*=-1;var o=n.positionAndNormalFromPoint(Vp);if(null==o)return null;Wp.getInverse(a.matrixWorld);var s=Rp(o.position.applyMatrix4(Wp));return qp.getNormalMatrix(Wp),{position:s,normal:Rp(o.normal.applyNormalMatrix(qp))}}},{key:(t=Up,n=zp,i=jp,r=Bp,xp),value:function(e,t){Object(a.a)(Object(m.a)(s.prototype),xp,this).call(this,e,t);var n=this[yp],i=n.getCamera();n.isDirty&&(n.model.updateHotspots(i.position),this[Up].domElement.style.display="",this[Up].render(n,i))}},{key:_p,value:function(e){Object(a.a)(Object(m.a)(s.prototype),_p,this).call(this,e),this[Up].setSize(e.width,e.height)}},{key:Hp,value:function(e){if(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")){var t=this[zp].get(e.slot);null!=t?t.increment():(t=new Bc({name:e.slot,position:e.dataset.position,normal:e.dataset.normal}),this[zp].set(e.slot,t),this[yp].model.addHotspot(t),this[Up].domElement.appendChild(t.element)),this[yp].isDirty=!0}}},{key:Gp,value:function(e){if(e instanceof HTMLElement){var t=this[zp].get(e.slot);t&&(t.decrement()&&(this[yp].model.removeHotspot(t),this[zp].delete(e.slot)),this[yp].isDirty=!0)}}}]),s}(e)}(function(e){var t,n,i,r,o,s,l,f,v=function(e){Object(p.a)(y,e);var v,g=b(y);function y(){var e;return Object(h.a)(this,y),(e=g.apply(this,arguments))[f]=null,e[t]=null,e[n]=null,e[i]=null,e[r]=null,e[o]=null,e[s]=function(t){var n=t.data;if(n&&3===n.type){var i=n.model,r=e[sb];if(null!=r)r.deactivate();else if(null==i)return;e[sb]=null!=i?new Bg(n.port,i):null,e.dispatchEvent(new CustomEvent("scene-graph-ready",{detail:{url:i?i.modelUri:null}}))}},e[l]=function(t){e[bp]()},e}return Object(d.a)(y,[{key:"connectedCallback",value:function(){Object(a.a)(Object(m.a)(y.prototype),"connectedCallback",this).call(this);var e=new MessageChannel,t=e.port1,n=e.port2;t.start(),n.start(),this[rb]=t,this[ab]=n,this[rb].onmessage=this[lb]}},{key:"disconnectedCallback",value:function(){Object(a.a)(Object(m.a)(y.prototype),"disconnectedCallback",this).call(this),this[rb].close(),this[ab].close(),this[rb]=null,this[ab]=null,null!=this[ob]&&this[ob].dispose(),null!=this[sb]&&this[sb].deactivate()}},{key:"updated",value:function(e){if(Object(a.a)(Object(m.a)(y.prototype),"updated",this).call(this,e),e.has(ib)){var t=e.get(ib);null!=t&&t.removeEventListener("mutation",this[cb]);var n=this[ib];null!=n&&n.addEventListener("mutation",this[cb])}}},{key:(f=ib,t=nb,n=rb,i=ab,r=ob,o=sb,wp),value:function(){Object(a.a)(Object(m.a)(y.prototype),wp,this).call(this),this[tb]()}},{key:tb,value:function(){var e=this[yp].model,t=e.currentGLTF,n=null,i=null;if(null!=t){var r=t.correlatedSceneGraph,a=this[ib],o=this[ob];if(null!=r){if(null!=o&&o.dispose(),null!=a&&t===this[nb])return;var s=null;null!=(n=new Ky(e.url||"",r))&&null!=n.model?(s=new MessageChannel,i=new Wg(n,s.port1),this[ab].postMessage({type:3,model:n.model.toJSON(),port:s.port2},[s.port2])):this[ab].postMessage({type:3,model:null,port:null})}}this[ib]=n,this[ob]=i,this[nb]=t}},{key:"exportScene",value:(v=Object(u.a)(c.a.mark((function e(t){var n;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this[yp].model,e.abrupt("return",new Promise(function(){var e=Object(u.a)(c.a.mark((function e(i,r){var a,o,s;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=n){e.next=2;break}return e.abrupt("return",r("Model missing or not yet loaded"));case 2:a={binary:!0,onlyVisible:!0,maxTextureSize:1/0,forcePowerOfTwoTextures:!1,includeCustomExtensions:!1,embedImages:!0},Object.assign(a,t),a.animations=n.animations,a.truncateDrawRange=!0,o=n[Xc],s=!1,null!=o&&(s=o.visible,o.visible=!1),(new eb).parse(n.modelContainer,(function(e){return i(new Blob([a.binary?e:JSON.stringify(e)],{type:a.binary?"application/octet-stream":"application/json"}))}),a),null!=o&&(o.visible=s);case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"model",get:function(){var e=this[sb];return e?e.model:void 0}}]),y}(e);return s=lb,l=cb,function(e,t,n,i){for(var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i,s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);a>3&&o&&Object.defineProperty(t,n,o)}([S({type:Object})],v.prototype,f,void 0),v}(function(e){var t,n,i,r=function(e){Object(p.a)(o,e);var r=b(o);function o(){var e;return Object(h.a)(this,o),(e=r.apply(this,arguments)).autoRotate=!1,e.autoRotateDelay=3e3,e.rotationPerSecond="auto",e[t]=performance.now(),e[n]=0,e[i]=function(t){return e[gb](t)},e}return Object(d.a)(o,[{key:"connectedCallback",value:function(){Object(a.a)(Object(m.a)(o.prototype),"connectedCallback",this).call(this),this.addEventListener("camera-change",this[vb]),this[pb]=performance.now()}},{key:"disconnectedCallback",value:function(){Object(a.a)(Object(m.a)(o.prototype),"disconnectedCallback",this).call(this),this.removeEventListener("camera-change",this[vb]),this[pb]=performance.now()}},{key:"updated",value:function(e){Object(a.a)(Object(m.a)(o.prototype),"updated",this).call(this,e),e.has("autoRotate")&&(this[pb]=performance.now())}},{key:(t=pb,n=fb,i=vb,mb),value:function(e){this[fb]=e[0]}},{key:xp,value:function(e,t){if(Object(a.a)(Object(m.a)(o.prototype),xp,this).call(this,e,t),this.autoRotate&&this[kp]()&&!this[Mp].isPresenting){var n=Math.min(t,e-this[pb]-this.autoRotateDelay);n>0&&(this[yp].yaw=this.turntableRotation+this[fb]*n*.001)}}},{key:gb,value:function(e){this.autoRotate&&"user-interaction"===e.detail.source&&(this[pb]=performance.now())}},{key:"resetTurntableRotation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this[yp].yaw=e}},{key:"turntableRotation",get:function(){return this[yp].yaw}}]),o}(e);return ub([S({type:Boolean,attribute:"auto-rotate"})],r.prototype,"autoRotate",void 0),ub([S({type:Number,attribute:"auto-rotate-delay"})],r.prototype,"autoRotateDelay",void 0),ub([tm({intrinsics:db,updateHandler:mb}),S({type:String,attribute:"rotation-per-second"})],r.prototype,"rotationPerSecond",void 0),r}(function(e){var t,n,i,r=function(e){Object(p.a)(l,e);var r,s=b(l);function l(){var e;return Object(h.a)(this,l),(e=s.apply(this,arguments)).environmentImage=null,e.skyboxImage=null,e.shadowIntensity=0,e.shadowSoftness=1,e.exposure=1,e[t]=null,e[n]=null,e[i]=function(t){t.element===Object(o.a)(e)&&e[hv]()},e}return Object(d.a)(l,[{key:"connectedCallback",value:function(){Object(a.a)(Object(m.a)(l.prototype),"connectedCallback",this).call(this),this[Mp].loader.addEventListener("preload",this[pv])}},{key:"disconnectedCallback",value:function(){Object(a.a)(Object(m.a)(l.prototype),"disconnectedCallback",this).call(this),this[Mp].loader.removeEventListener("preload",this[pv])}},{key:"updated",value:function(e){Object(a.a)(Object(m.a)(l.prototype),"updated",this).call(this,e),e.has("shadowIntensity")&&(this[yp].setShadowIntensity(.1*this.shadowIntensity),this[bp]()),e.has("shadowSoftness")&&(this[yp].setShadowSoftness(this.shadowSoftness),this[bp]()),e.has("exposure")&&(this[yp].exposure=this.exposure,this[bp]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[Ap]()&&this[hv]()}},{key:(t=cv,n=dv,i=pv,wp),value:function(){Object(a.a)(Object(m.a)(l.prototype),wp,this).call(this),null!=this[cv]&&this[uv](this[cv])}},{key:hv,value:(r=Object(u.a)(c.a.mark((function e(){var t,n,i,r,a,o,s,l=this;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.skyboxImage,n=this.environmentImage,null!=this[dv]&&(this[dv](),this[dv]=null),null==(i=this[Mp].textureUtils)){e.next=18;break}return e.prev=4,e.next=7,new Promise(function(){var e=Object(u.a)(c.a.mark((function e(r,a){var o;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=i.generateEnvironmentMapAndSkybox(Yu(t),Yu(n),{progressTracker:l[Sp]}),l[dv]=function(){return a(o)},e.t0=r,e.next=5,o;case 5:e.t1=e.sent,(0,e.t0)(e.t1);case 7:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}());case 7:r=e.sent,a=r.environmentMap,o=r.skybox,s=a.texture,this[yp].background=null!=o?o.userData.url===s.userData.url?s:o:null,this[uv](a.texture),this[yp].model.dispatchEvent({type:"envmap-update"}),e.next=18;break;case 14:if(e.prev=14,e.t0=e.catch(4),!(e.t0 instanceof Error)){e.next=18;break}throw this[uv](null),e.t0;case 18:case"end":return e.stop()}}),e,this,[[4,14]])}))),function(){return r.apply(this,arguments)})},{key:uv,value:function(e){this[cv]=e,this[yp].environment=this[cv],this.dispatchEvent(new CustomEvent("environment-change")),this[bp]()}}]),l}(e);return lv([S({type:String,attribute:"environment-image"})],r.prototype,"environmentImage",void 0),lv([S({type:String,attribute:"skybox-image"})],r.prototype,"skyboxImage",void 0),lv([S({type:Number,attribute:"shadow-intensity"})],r.prototype,"shadowIntensity",void 0),lv([S({type:Number,attribute:"shadow-softness"})],r.prototype,"shadowSoftness",void 0),lv([S({type:Number})],r.prototype,"exposure",void 0),r}(function(e){var t,n,i,o,s,l,c,u,f,v,g,y,x,w,_,M,T,E=function(e){Object(p.a)(E,e);var S=b(E);function E(){var e;return Object(h.a)(this,E),(e=S.apply(this,arguments)).cameraControls=!1,e.cameraOrbit="0deg 75deg 105%",e.cameraTarget="auto auto auto",e.fieldOfView="auto",e.minCameraOrbit="auto",e.maxCameraOrbit="auto",e.minFieldOfView="auto",e.maxFieldOfView="auto",e.interactionPromptThreshold=3e3,e.interactionPromptStyle=ym,e.interactionPrompt=vm,e.interactionPolicy=bm,e.orbitSensitivity=1,e.touchAction="pan-y",e[t]=e.shadowRoot.querySelector(".interaction-prompt"),e[n]=e.shadowRoot.querySelector(".interaction-prompt > .animated-container"),e[i]=1/0,e[o]=0,e[s]=1/0,e[l]=!1,e[c]=!1,e[u]=new om(e[yp].camera,e[vp]),e[f]=0,e[v]=new Ll,e[g]=!1,e[y]=!1,e[x]=!1,e[w]=function(t){return e[Gm](t)},e[_]=function(t){return e[Vm](t)},e[M]=function(){return e[Hm]()},e[T]=function(){return e[Bm]()},e}return Object(d.a)(E,[{key:"getCameraOrbit",value:function(){var e=this[Km];return{theta:e.theta,phi:e.phi,radius:e.radius}}},{key:"getCameraTarget",value:function(){return Rp(this[yp].getTarget())}},{key:"getFieldOfView",value:function(){return this[Om].getFieldOfView()}},{key:"getMinimumFieldOfView",value:function(){return this[Om].options.minimumFieldOfView}},{key:"getMaximumFieldOfView",value:function(){return this[Om].options.maximumFieldOfView}},{key:"jumpCameraToGoal",value:function(){this[Qm]=!0,this.requestUpdate(Qm,!1)}},{key:"resetInteractionPrompt",value:function(){this[Ym]=0,this[Xm]=1/0,this[qm]=!1,this[Wm]=this.interactionPrompt===vm&&this.cameraControls}},{key:"connectedCallback",value:function(){Object(a.a)(Object(m.a)(E.prototype),"connectedCallback",this).call(this),this[Om].addEventListener("change",this[zm]),this[Om].addEventListener("pointer-change-start",this[jm]),this[Om].addEventListener("pointer-change-end",this[jm])}},{key:"disconnectedCallback",value:function(){Object(a.a)(Object(m.a)(E.prototype),"disconnectedCallback",this).call(this),this[Om].removeEventListener("change",this[zm]),this[Om].removeEventListener("pointer-change-start",this[jm]),this[Om].removeEventListener("pointer-change-end",this[jm])}},{key:"updated",value:function(e){var t=this;Object(a.a)(Object(m.a)(E.prototype),"updated",this).call(this,e);var n=this[Om],i=this[vp];if(e.has("cameraControls")&&(this.cameraControls?(n.enableInteraction(),this.interactionPrompt===vm&&(this[Wm]=!0),i.addEventListener("focus",this[Um]),i.addEventListener("blur",this[Fm])):(i.removeEventListener("focus",this[Um]),i.removeEventListener("blur",this[Fm]),n.disableInteraction(),this[Im]())),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===vm&&this.cameraControls&&!this[qm]?this[Wm]=!0:this[Im]()),e.has("interactionPromptStyle")&&this[Cm].classList.toggle("wiggle",this.interactionPromptStyle===ym),e.has("interactionPolicy")){var r=this.interactionPolicy;n.applyOptions({interactionPolicy:r})}if(e.has("touchAction")){var o=this.touchAction;n.applyOptions({touchAction:o})}e.has("orbitSensitivity")&&(this[Om].sensitivity=this.orbitSensitivity),!0===this[Qm]&&Promise.resolve().then((function(){t[Om].jumpToGoal(),t[yp].jumpToGoal(),t[Qm]=!1}))}},{key:(t=Cm,n=Pm,i=Jm,o=Ym,s=Xm,l=qm,c=Wm,u=Om,f=Zm,v=Km,g=Qm,y=$m,x=ev,w=zm,_=jm,M=Um,T=Fm,nv),value:function(e){this[Om].setFieldOfView(180*e[0]/Math.PI)}},{key:tv,value:function(e){if(this[ev]){var t=this.getCameraOrbit(),n=t.theta,i=t.phi;e[0]=n,e[1]=i,this[ev]=!1}this[Om].setOrbit(e[0],e[1],e[2])}},{key:rv,value:function(e){this[Om].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}},{key:av,value:function(e){this[Om].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[Nm](e[2]),this.jumpCameraToGoal()}},{key:ov,value:function(e){this[Om].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}},{key:sv,value:function(e){this[Om].applyOptions({maximumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}},{key:iv,value:function(e){var t=Object(r.a)(e,3),n=t[0],i=t[1],a=t[2];this[yp].setTarget(n,i,a),this[Mp].arRenderer.updateTarget()}},{key:xp,value:function(e,t){if(Object(a.a)(Object(m.a)(E.prototype),xp,this).call(this,e,t),!this[Mp].isPresenting&&this[kp]()){var n=performance.now();if(this[Wm]){var i=this.interactionPrompt===vm?this[dp]:this[Jm];this.loaded&&n>i+this.interactionPromptThreshold&&(this[vp].setAttribute("aria-label","Use mouse, touch or arrow keys to control the camera!"),this[Wm]=!1,this[Xm]=n,this[Cm].classList.add("visible"))}if(isFinite(this[Xm])&&this.interactionPromptStyle===ym){var r=this[yp],o=(n-this[Xm])/5e3%1,s=hm(o),l=dm(o);if(this[Pm].style.opacity=""+l,s!==this[Ym]){var c=s*r.width*.05,u=(s-this[Ym])*Math.PI/16;this[Pm].style.transform="translateX(".concat(c,"px)"),this[Om].adjustOrbit(u,0,0),this[Ym]=s}}this[Om].update(e,t),this[yp].updateTarget(t)}}},{key:Im,value:function(){this[Wm]=!1,this[Cm].classList.remove("visible"),this[Xm]=1/0}},{key:Nm,value:function(e){var t=this[yp].model.idealCameraDistance,n=2*Math.max(t,e);this[Om].updateNearFar(0,n)}},{key:Dm,value:function(){var e=this[Km],t=e.theta,n=e.phi,i=this[Om].getCameraSpherical(this[Km]),r=i.theta,a=i.phi,o=this.getRootNode();if(null!=o&&o.activeElement===this){var s=(4+Math.floor((t%Rm+km)/Am))%4,l=(4+Math.floor((r%Rm+km)/Am))%4,c=Math.floor(n/Lm),u=Math.floor(a/Lm);if(l!==s||u!==c){var h="View from stage ".concat(mm[u]).concat(fm[l]);this[vp].setAttribute("aria-label",h)}}}},{key:_p,value:function(e){var t=this[Om],n=this[yp].framedFieldOfView;Object(a.a)(Object(m.a)(E.prototype),_p,this).call(this,e);var i=this[yp].framedFieldOfView,r=t.getFieldOfView()/n;this[Zm]=i*r,t.updateAspect(this[yp].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.jumpCameraToGoal()}},{key:wp,value:function(){Object(a.a)(Object(m.a)(E.prototype),wp,this).call(this);var e=this[yp].framedFieldOfView;this[Zm]=e,this[$m]?this[ev]=!0:this[$m]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}},{key:Hm,value:function(){var e=this[vp];isFinite(this[Jm])||(this[Jm]=performance.now());var t=this[hp];e.getAttribute("aria-label")!==t&&e.setAttribute("aria-label",t),this.interactionPrompt!==gm||this[qm]||(this[Wm]=!0)}},{key:Bm,value:function(){this.interactionPrompt===gm&&(this[Wm]=!1,this[Cm].classList.remove("visible"),this[Xm]=1/0,this[Jm]=1/0)}},{key:Gm,value:function(e){var t=e.source;this[Dm](),this[bp](),t===am&&(this[qm]=!0,this[Im]()),this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:t}}))}},{key:Vm,value:function(e){"pointer-change-start"===e.type?this[mp].classList.add("pointer-tumbling"):this[mp].classList.remove("pointer-tumbling")}}]),E}(e);return um([S({type:Boolean,attribute:"camera-controls"})],E.prototype,"cameraControls",void 0),um([tm({intrinsics:Mm,observeEffects:!0,updateHandler:tv}),S({type:String,attribute:"camera-orbit",hasChanged:function(){return!0}})],E.prototype,"cameraOrbit",void 0),um([tm({intrinsics:Em,observeEffects:!0,updateHandler:iv}),S({type:String,attribute:"camera-target",hasChanged:function(){return!0}})],E.prototype,"cameraTarget",void 0),um([tm({intrinsics:xm,observeEffects:!0,updateHandler:nv}),S({type:String,attribute:"field-of-view",hasChanged:function(){return!0}})],E.prototype,"fieldOfView",void 0),um([tm({intrinsics:Sm,updateHandler:rv}),S({type:String,attribute:"min-camera-orbit",hasChanged:function(){return!0}})],E.prototype,"minCameraOrbit",void 0),um([tm({intrinsics:Tm,updateHandler:av}),S({type:String,attribute:"max-camera-orbit",hasChanged:function(){return!0}})],E.prototype,"maxCameraOrbit",void 0),um([tm({intrinsics:wm,updateHandler:ov}),S({type:String,attribute:"min-field-of-view",hasChanged:function(){return!0}})],E.prototype,"minFieldOfView",void 0),um([tm({intrinsics:_m,updateHandler:sv}),S({type:String,attribute:"max-field-of-view",hasChanged:function(){return!0}})],E.prototype,"maxFieldOfView",void 0),um([S({type:Number,attribute:"interaction-prompt-threshold"})],E.prototype,"interactionPromptThreshold",void 0),um([S({type:String,attribute:"interaction-prompt-style"})],E.prototype,"interactionPromptStyle",void 0),um([S({type:String,attribute:"interaction-prompt"})],E.prototype,"interactionPrompt",void 0),um([S({type:String,attribute:"interaction-policy"})],E.prototype,"interactionPolicy",void 0),um([S({type:Number,attribute:"orbit-sensitivity"})],E.prototype,"orbitSensitivity",void 0),um([S({type:String,attribute:"touch-action"})],E.prototype,"touchAction",void 0),E}(function(e){var t,n,i,r,o,s,l,f,v,g,y=function(e){Object(p.a)(S,e);var y,x,w,_,M=b(S);function S(){var e;return Object(h.a)(this,S),(e=M.apply(this,arguments)).ar=!1,e.arScale="auto",e.arModes="webxr scene-viewer quick-look",e.iosSrc=null,e.quickLookBrowsers="safari",e[t]=!1,e[n]=e.shadowRoot.querySelector(".ar-button"),e[i]=document.createElement("a"),e[r]=new Set,e[o]=tf,e[s]=!1,e[l]=new Set,e[f]=function(t){t.preventDefault(),e.activateAR()},e[v]=function(t){var n=t.status;n!==ah&&e[Mp].arRenderer.presentedScene!==e[yp]||(e.setAttribute("ar-status",n),e.dispatchEvent(new CustomEvent("ar-status",{detail:{status:n}})))},e[g]=function(t){"_apple_ar_quicklook_button_tapped"==t.data&&e.dispatchEvent(new CustomEvent("quick-look-button-tapped"))},e}return Object(d.a)(S,[{key:"connectedCallback",value:function(){Object(a.a)(Object(m.a)(S.prototype),"connectedCallback",this).call(this),this[Mp].arRenderer.addEventListener("status",this[mf]),this.setAttribute("ar-status",ah),this[df].addEventListener("message",this[vf])}},{key:"disconnectedCallback",value:function(){Object(a.a)(Object(m.a)(S.prototype),"disconnectedCallback",this).call(this),this[Mp].arRenderer.removeEventListener("status",this[mf]),this[df].removeEventListener("message",this[vf])}},{key:"update",value:(_=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Object(a.a)(Object(m.a)(S.prototype),"update",this).call(this,t),t.has("quickLookBrowsers")&&(this[hf]=Kp(this.quickLookBrowsers)),(t.has("ar")||t.has("arModes")||t.has("iosSrc"))&&(t.has("arModes")&&(this[cf]=Qp(this.arModes)),t.has("arScale")&&(this[yp].canScale="fixed"!==this.arScale),this[gf]());case 1:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"activateAR",value:(w=Object(u.a)(c.a.mark((function e(){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=this[lf],e.next=e.t0===$p?3:"webxr"===e.t0?5:e.t0===ef?8:10;break;case 3:return this[of](),e.abrupt("break",11);case 5:return e.next=7,this[rf]();case 7:return e.abrupt("break",11);case 8:return this[af](),e.abrupt("break",11);case 10:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities");case 11:case"end":return e.stop()}}),e,this)}))),function(){return w.apply(this,arguments)})},{key:(t=sf,n=nf,i=df,r=cf,o=lf,s=pf,l=hf,f=ff,v=mf,g=vf,gf),value:(x=Object(u.a)(c.a.mark((function e(){var t,n,i,r;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this[lf]=tf,!this.ar){e.next=23;break}t=[],this[cf].forEach((function(e){t.push(e)})),n=0,i=t;case 4:if(!(n<i.length)){e.next=23;break}if(r=i[n],e.t0="webxr"===r&&k&&!Jp,!e.t0){e.next=11;break}return e.next=10,this[Mp].arRenderer.supportsPresentation();case 10:e.t0=e.sent;case 11:if(!e.t0){e.next=14;break}return this[lf]="webxr",e.abrupt("break",23);case 14:if("scene-viewer"!==r||!U||Zp){e.next=17;break}return this[lf]=ef,e.abrupt("break",23);case 17:if(!("quick-look"===r&&this.iosSrc&&this[uf]&&C)){e.next=20;break}return this[lf]=$p,e.abrupt("break",23);case 20:n++,e.next=4;break;case 23:this.canActivateAR?(this[nf].classList.add("enabled"),this[nf].addEventListener("click",this[ff])):this[nf].classList.contains("enabled")&&(this[nf].removeEventListener("click",this[ff]),this[nf].classList.remove("enabled"),this.setAttribute("ar-status","failed"),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:"failed"}})));case 24:case"end":return e.stop()}}),e,this)}))),function(){return x.apply(this,arguments)})},{key:rf,value:(y=Object(u.a)(c.a.mark((function e(){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("Attempting to present in AR..."),e.t0=this[sp],e.t0){e.next=8;break}return this[pf]=!0,this[pp](),e.next=7,function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new Promise((function(i){e.addEventListener(t,(function r(a){n&&!n(a)||(i(a),e.removeEventListener(t,r))}))}))}(this,"load");case 7:this[pf]=!1;case 8:return e.prev=8,this[nf].removeEventListener("click",this[ff]),e.next=12,this[Mp].arRenderer.present(this[yp]);case 12:e.next=24;break;case 14:return e.prev=14,e.t1=e.catch(8),console.warn("Error while trying to present to AR"),console.error(e.t1),e.next=20,this[Mp].arRenderer.stopPresenting();case 20:return Jp=!0,e.next=23,this[gf]();case 23:this.activateAR();case 24:return e.prev=24,this[gf](),e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[8,14,24,27]])}))),function(){return y.apply(this,arguments)})},{key:Ap,value:function(){return Object(a.a)(Object(m.a)(S.prototype),Ap,this).call(this)||this[pf]}},{key:af,value:function(){var e=this,t=this.src.replace("?","&"),n=self.location.toString(),i=new URL(n),r=new URL(t,n);i.hash="#model-viewer-no-ar-fallback";var a="?file=".concat(r.toString(),"&mode=ar_only");t.includes("&link=")||(a+="&link="+n),t.includes("&title=")||(a+="&title="+encodeURIComponent(this.alt||"")),"fixed"===this.arScale&&(a+="&resizable=false");var o="intent://arvr.google.com/scene-viewer/1.0".concat(a,"#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=").concat(encodeURIComponent(i.toString()),";end;");self.addEventListener("hashchange",(function(){"#model-viewer-no-ar-fallback"===self.location.hash&&(Zp=!0,self.history.back(),e[gf]())}),{once:!0}),this[df].setAttribute("href",o),this[df].click()}},{key:of,value:function(){var e=new URL(this.iosSrc,self.location.toString());"fixed"===this.arScale&&(e.hash="allowsContentScaling=0");var t=this[df];t.setAttribute("rel","ar");var n=document.createElement("img");t.appendChild(n),t.setAttribute("href",e.toString()),t.click(),t.removeChild(n)}},{key:"canActivateAR",get:function(){return this[lf]!==tf}},{key:uf,get:function(){return N?this[hf].has("chrome"):!!F&&this[hf].has("safari")}}]),S}(e);return Yp([S({type:Boolean,attribute:"ar"})],y.prototype,"ar",void 0),Yp([S({type:String,attribute:"ar-scale"})],y.prototype,"arScale",void 0),Yp([S({type:String,attribute:"ar-modes"})],y.prototype,"arModes",void 0),Yp([S({type:String,attribute:"ios-src"})],y.prototype,"iosSrc",void 0),Yp([S({type:String,attribute:"quick-look-browsers"})],y.prototype,"quickLookBrowsers",void 0),y}(function(e){var t,n,i,r,o,s,l,f,v,g,y,x,w,_=function(e){Object(p.a)(T,e);var _,M,S=b(T);function T(){var e;Object(h.a)(this,T);for(var a=arguments.length,c=new Array(a),u=0;u<a;u++)c[u]=arguments[u];(e=S.call.apply(S,[this].concat(c))).poster=null,e.reveal=wv,e.loading="auto",e[t]=!1,e[n]=!1,e[i]=0,e[r]=null,e[o]=e.shadowRoot.querySelector(".slot.poster"),e[s]=e.shadowRoot.querySelector("#default-poster"),e[l]=e.shadowRoot.querySelector("#default-progress-bar > .bar"),e[f]=e.shadowRoot.querySelector("#default-progress-bar > .mask"),e[v]=e[Ev].getAttribute("aria-label"),e[g]=function(){return e[Uv]()},e[y]=function(t){return e[zv](t)},e[x]=function(t){return e[jv](t)},e[w]=function(e,t){var n=null,i=function(){null==n&&(e.apply(void 0,arguments),n=self.setTimeout((function(){return n=null}),100))};return i.flush=function(){null!=n&&(self.clearTimeout(n),n=null)},i}((function(t){var n=e[Mv].parentNode;requestAnimationFrame((function(){e[Sv].style.opacity=""+.2*(1-t),e[Mv].style.transform="scaleX(".concat(t,")"),0===t&&(n.removeChild(e[Mv]),n.appendChild(e[Mv])),1===t?e[Mv].classList.add("hide"):e[Mv].classList.remove("hide")}))}));var d=(self.ModelViewerElement||{}).dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.3.6/";return wc.setDRACODecoderLocation(d),e}return Object(d.a)(T,[{key:"dismissPoster",value:function(){this[Lp]()?this[kv]():(this[Av]="interaction",this[pp]())}},{key:"getDimensions",value:function(){return Rp(this[yp].model.size)}},{key:"connectedCallback",value:function(){Object(a.a)(Object(m.a)(T.prototype),"connectedCallback",this).call(this),this[Tv].addEventListener("click",this[Dv]),this[Tv].addEventListener("keydown",this[Nv]),this[Sp].addEventListener("progress",this[Fv]),_v.registerInstance(this)}},{key:"disconnectedCallback",value:function(){Object(a.a)(Object(m.a)(T.prototype),"disconnectedCallback",this).call(this),this[Tv].removeEventListener("click",this[Dv]),this[Tv].removeEventListener("keydown",this[Nv]),this[Sp].removeEventListener("progress",this[Fv]),_v.unregisterInstance(this)}},{key:"updated",value:(M=Object(u.a)(c.a.mark((function e(t){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Object(a.a)(Object(m.a)(T.prototype),"updated",this).call(this,t),t.has("poster")&&null!=this.poster&&(this[Ev].style.backgroundImage="url(".concat(this.poster,")")),t.has("alt")&&this[Ev].setAttribute("aria-label","".concat(this[hp],". ").concat(this[Iv])),(t.has("reveal")||t.has("loaded"))&&(this[Lp]()||this[pp]());case 1:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:(t=Rv,n=Pv,i=Cv,r=Av,o=Tv,s=Ev,l=Mv,f=Sv,v=Iv,g=Dv,y=Nv,x=Fv,w=Ov,Uv),value:function(){"manual"!==this.reveal&&this.dismissPoster()}},{key:zv,value:function(e){if("manual"!==this.reveal)switch(e.keyCode){case 32:case 13:this.dismissPoster()}}},{key:jv,value:function(e){var t=e.detail.totalProgress;this[Cv]=Math.max(t,this[Cv]),1===t&&(this[Ov].flush(),!this[Lp]()||null==this[Av]&&this.reveal!==wv||this[kv]()),this[Ov](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t}}))}},{key:Ap,value:function(){return!!this.src&&(null!=this[Av]||"eager"===this.loading||this.reveal===wv&&this[cp])}},{key:Lp,value:function(){return!!this.src&&Object(a.a)(Object(m.a)(T.prototype),Lp,this).call(this)&&1===this[Cv]}},{key:Lv,value:function(){var e=this[Tv],t=this[Ev];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden"),e.classList.add("show");var n=this.modelIsVisible;this[Rv]=!1,this[up](n),this[Pv]=!1}},{key:kv,value:function(){var e=this;this[Av]=null;var t=this[Tv],n=this[Ev];if(t.classList.contains("show")){t.classList.remove("show");var i=this.modelIsVisible;this[Rv]=!0,this[up](i),t.addEventListener("transitionend",(function(){requestAnimationFrame((function(){e[Pv]=!0;var t=e.getRootNode();t&&t.activeElement===e&&e[vp].focus(),n.setAttribute("aria-hidden","true"),n.tabIndex=-1,e.dispatchEvent(new CustomEvent("poster-dismissed"))}))}),{once:!0})}}},{key:Ep,value:function(){return Object(a.a)(Object(m.a)(T.prototype),Ep,this).call(this)&&this[Rv]}},{key:kp,value:function(){return Object(a.a)(Object(m.a)(T.prototype),kp,this).call(this)&&this[Pv]}},{key:pp,value:(_=Object(u.a)(c.a.mark((function e(){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this[Cv]=0,null!=this[yp].model.currentGLTF&&null!=this.src&&this[Ap]()||this[Lv](),e.next=4,Object(a.a)(Object(m.a)(T.prototype),pp,this).call(this);case 4:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})}],[{key:"mapURLs",value:function(e){Dd.singleton.loader[yc].manager.setURLModifier(e)}},{key:"dracoDecoderLocation",set:function(e){wc.setDRACODecoderLocation(e)},get:function(){return wc.getDRACODecoderLocation()}}]),T}(e);return xv([S({type:String})],_.prototype,"poster",void 0),xv([S({type:String})],_.prototype,"reveal",void 0),xv([S({type:String})],_.prototype,"loading",void 0),_}(function(e){var t,n=function(e){Object(p.a)(r,e);var n,i=b(r);function r(){var e;return Object(h.a)(this,r),(e=i.apply(this,arguments)).autoplay=!1,e.animationName=void 0,e.animationCrossfadeDuration=300,e[t]=!0,e}return Object(d.a)(r,[{key:"pause",value:function(){this[Fp]||(this[Fp]=!0,this[Mp].threeRenderer.shadowMap.autoUpdate=!1,this.dispatchEvent(new CustomEvent("pause")))}},{key:"play",value:function(){this[Fp]&&this.availableAnimations.length>0&&(this[Fp]=!1,this[Mp].threeRenderer.shadowMap.autoUpdate=!0,this[yp].model.hasActiveAnimation||this[Np](),this.dispatchEvent(new CustomEvent("play")))}},{key:(t=Fp,wp),value:function(){Object(a.a)(Object(m.a)(r.prototype),wp,this).call(this),this[Fp]=!0,this.autoplay&&(this[Np](),this.play())}},{key:xp,value:function(e,t){if(Object(a.a)(Object(m.a)(n.prototype),xp,this).call(this,e,t),!this[Fp]&&this[kp]()){var n=this[yp].model;n.updateAnimation(t/1e3),this[bp]()}}},{key:"updated",value:function(e){Object(a.a)(Object(m.a)(r.prototype),"updated",this).call(this,e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[Np]()}},{key:pp,value:(n=Object(u.a)(c.a.mark((function e(){return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(this[yp].model.stopAnimation(),Object(a.a)(Object(m.a)(r.prototype),pp,this).call(this)));case 1:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:Np,value:function(){var e=this[yp].model;e.playAnimation(this.animationName,this.animationCrossfadeDuration/1e3),this[Fp]&&(e.updateAnimation(0),this[bp]())}},{key:"availableAnimations",get:function(){return this.loaded?this[yp].model.animationNames:[]}},{key:"paused",get:function(){return this[Fp]}},{key:"currentTime",get:function(){return this[yp].model.animationTime},set:function(e){this[yp].model.animationTime=e,this[Mp].threeRenderer.shadowMap.needsUpdate=!0,this[bp]()}}]),r}(e);return Dp([S({type:Boolean})],n.prototype,"autoplay",void 0),Dp([S({type:String,attribute:"animation-name"})],n.prototype,"animationName",void 0),Dp([S({type:Number,attribute:"animation-crossfade-duration"})],n.prototype,"animationCrossfadeDuration",void 0),n}(function(e){var t,n=Symbol("endPolyfillCoordination");return t=n,function(e){Object(p.a)(r,e);var i=b(r);function r(){var e;return Object(h.a)(this,r),(e=i.apply(this,arguments))[t]=null,e}return Object(d.a)(r,[{key:"connectedCallback",value:function(){Object(a.a)(Object(m.a)(r.prototype),"connectedCallback",this)&&Object(a.a)(Object(m.a)(r.prototype),"connectedCallback",this).call(this),null==this[n]&&(this[n]=function(e){if(null==e.shadowRoot||e.hasAttribute("data-js-focus-visible"))return function(){};if(!self.applyFocusVisiblePolyfill){var t=function(){self.applyFocusVisiblePolyfill(e.shadowRoot)};return self.addEventListener("focus-visible-polyfill-ready",t,{once:!0}),function(){self.removeEventListener("focus-visible-polyfill-ready",t)}}return self.applyFocusVisiblePolyfill(e.shadowRoot),function(){}}(this))}},{key:"disconnectedCallback",value:function(){Object(a.a)(Object(m.a)(r.prototype),"disconnectedCallback",this)&&Object(a.a)(Object(m.a)(r.prototype),"disconnectedCallback",this).call(this),null!=this[n]&&(this[n](),this[n]=null)}}]),r}(e)}(Op)))))))));customElements.define("model-viewer",yb)}}]);
  //# sourceMappingURL=cafc52b5-c73a516d9b2ae22b5255.js.map